ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_util.C
(Generate patch)

Comparing deliantra/server/server/spell_util.C (file contents):
Revision 1.128 by root, Wed Nov 16 23:42:03 2016 UTC vs.
Revision 1.129 by root, Sun Jan 29 02:47:06 2017 UTC

362} 362}
363 363
364/* Returns true if it is ok to put spell *op on the space/may provided. 364/* Returns true if it is ok to put spell *op on the space/may provided.
365 * immune_stop is basically the attacktype of the spell (why 365 * immune_stop is basically the attacktype of the spell (why
366 * passed as a different value, not sure of). If immune_stop 366 * passed as a different value, not sure of). If immune_stop
367 * has the AT_MAGIC bit set, and there is a counterwall 367 * has the AT_MAGIC bit set, and there is a counterwall
368 * on the space, the object doesn't get placed. if immune stop 368 * on the space, the object doesn't get placed. if immune stop
369 * does not have AT_MAGIC, then counterwalls do not effect the spell. 369 * does not have AT_MAGIC, then counterwalls do not effect the spell.
370 */ 370 */
371int 371int
372ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop) 372ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop)
623 623
624 if ((at = archetype::find (monstername)) == NULL) 624 if ((at = archetype::find (monstername)) == NULL)
625 return; 625 return;
626 626
627 /* find a free square nearby 627 /* find a free square nearby
628 * first we check the closest square for free squares 628 * first we check the closest square for free squares
629 */ 629 */
630 630
631 dir = find_first_free_spot (at, op->map, op->x, op->y); 631 dir = find_first_free_spot (at, op->map, op->x, op->y);
632 if (dir != -1) 632 if (dir != -1)
633 { 633 {
720 { AT_PARALYZE, 9}, 720 { AT_PARALYZE, 9},
721 { AT_FEAR, 10}, 721 { AT_FEAR, 10},
722}; 722};
723 723
724/* shuffle_attack: peterm 724/* shuffle_attack: peterm
725 * This routine shuffles the attack of op to one of the 725 * This routine shuffles the attack of op to one of the
726 * ones in the list. It does this at random. It also 726 * ones in the list. It does this at random. It also
727 * chooses a face appropriate to the attack that is 727 * chooses a face appropriate to the attack that is
728 * being committed by that square at the moment. 728 * being committed by that square at the moment.
729 * right now it's being used by color spray and create pool of 729 * right now it's being used by color spray and create pool of
730 * chaos. 730 * chaos.
731 * This could really be a better implementation - the 731 * This could really be a better implementation - the
732 * faces and attacktypes above are hardcoded, which is never 732 * faces and attacktypes above are hardcoded, which is never
733 * good. The faces refer to faces in the animation sequence. 733 * good. The faces refer to faces in the animation sequence.
945 { 945 {
946 LOG (llevError, "cast_spell: null caster object passed\n"); 946 LOG (llevError, "cast_spell: null caster object passed\n");
947 return 0; 947 return 0;
948 } 948 }
949 949
950 /* if caster is a spell casting object, this normally shouldn't be 950 /* if caster is a spell casting object, this normally shouldn't be
951 * an issue, because they don't have any spellpaths set up. 951 * an issue, because they don't have any spellpaths set up.
952 */ 952 */
953 if (caster->path_denied & spell_ob->path_attuned && !caster->flag [FLAG_WIZCAST]) 953 if (caster->path_denied & spell_ob->path_attuned && !caster->flag [FLAG_WIZCAST])
954 { 954 {
955 op->failmsg ("That spell path is denied to you."); 955 op->failmsg ("That spell path is denied to you.");
957 } 957 }
958 958
959 object *skill = 0; 959 object *skill = 0;
960 960
961 /* if it is a player casting the spell, and they are really casting it 961 /* if it is a player casting the spell, and they are really casting it
962 * (vs it coming from a wand, scroll, or whatever else), do some 962 * (vs it coming from a wand, scroll, or whatever else), do some
963 * checks. We let monsters do special things - eg, they 963 * checks. We let monsters do special things - eg, they
964 * don't need the SKILL, BYpass level checks, etc. The monster function 964 * don't need the SKILL, BYpass level checks, etc. The monster function
965 * should take care of that. 965 * should take care of that.
966 * Remove the wiz check here and move it further down - some spells 966 * Remove the wiz check here and move it further down - some spells
967 * need to have the right skill pointer passed, so we need to 967 * need to have the right skill pointer passed, so we need to
999 } 999 }
1000 1000
1001 if (spell_ob->level > caster_level) 1001 if (spell_ob->level > caster_level)
1002 { 1002 {
1003 op->failmsgf ("You lack enough skill to cast that spell! " 1003 op->failmsgf ("You lack enough skill to cast that spell! "
1004 "H<Your effective cast level is %d%s, but level %d is required.>", 1004 "H<Your effective cast level is %d%s, but level %d is required.>",
1005 caster_level, msg, spell_ob->level); 1005 caster_level, msg, spell_ob->level);
1006 if (!op->is_wiz ()) 1006 if (!op->is_wiz ())
1007 return 0; 1007 return 0;
1008 } 1008 }
1009 } 1009 }
1105 1105
1106 // undo the flood protection from earlier 1106 // undo the flood protection from earlier
1107 op->speed_left += 4 * op->speed; // ~0.5s on failure 1107 op->speed_left += 4 * op->speed; // ~0.5s on failure
1108 1108
1109 /* Take into account how long it takes to cast the spell. 1109 /* Take into account how long it takes to cast the spell.
1110 * if the player is casting it, then we use the time in 1110 * if the player is casting it, then we use the time in
1111 * the spell object. If it is a spell object, have it 1111 * the spell object. If it is a spell object, have it
1112 * take two ticks. Things that cast spells on the players 1112 * take two ticks. Things that cast spells on the players
1113 * behalf (eg, altars, and whatever else) shouldn't cost 1113 * behalf (eg, altars, and whatever else) shouldn't cost
1114 * the player any time. 1114 * the player any time.
1115 * Ignore casting time for firewalls 1115 * Ignore casting time for firewalls

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines