… | |
… | |
946 | cast_spell (object *op, object *caster, int dir, object *spell_ob, char *spellparam) |
946 | cast_spell (object *op, object *caster, int dir, object *spell_ob, char *spellparam) |
947 | { |
947 | { |
948 | const char *godname; |
948 | const char *godname; |
949 | int success = 0; |
949 | int success = 0; |
950 | |
950 | |
|
|
951 | // make sure spells always take a while, so a) we don't flood the |
|
|
952 | // user with messages and b) too many failures can be harmful (smiting). |
|
|
953 | op->speed_left -= 4 * op->speed; // ~0.5s on failure |
|
|
954 | |
951 | if (!spell_ob) |
955 | if (!spell_ob) |
952 | { |
956 | { |
953 | LOG (llevError, "cast_spell: null spell object passed\n"); |
957 | LOG (llevError, "cast_spell: null spell object passed\n"); |
954 | return 0; |
958 | return 0; |
955 | } |
959 | } |
… | |
… | |
1118 | op->failmsg ("Something blocks the spell!"); |
1122 | op->failmsg ("Something blocks the spell!"); |
1119 | |
1123 | |
1120 | return 0; |
1124 | return 0; |
1121 | } |
1125 | } |
1122 | |
1126 | |
|
|
1127 | // undo the flood protection from earlier |
|
|
1128 | op->speed_left += 4 * op->speed; // ~0.5s on failure |
|
|
1129 | |
1123 | /* Take into account how long it takes to cast the spell. |
1130 | /* Take into account how long it takes to cast the spell. |
1124 | * if the player is casting it, then we use the time in |
1131 | * if the player is casting it, then we use the time in |
1125 | * the spell object. If it is a spell object, have it |
1132 | * the spell object. If it is a spell object, have it |
1126 | * take two ticks. Things that cast spells on the players |
1133 | * take two ticks. Things that cast spells on the players |
1127 | * behalf (eg, altars, and whatever else) shouldn't cost |
1134 | * behalf (eg, altars, and whatever else) shouldn't cost |