… | |
… | |
887 | } |
887 | } |
888 | } |
888 | } |
889 | } |
889 | } |
890 | |
890 | |
891 | int |
891 | int |
892 | cast_party_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg) |
892 | cast_party_spell (object *op, object *caster, int dir, object *spell_ob, char *spellparam) |
893 | { |
893 | { |
894 | int success; |
894 | int success; |
895 | object *spell; |
895 | object *spell; |
896 | |
896 | |
897 | if (!spell_ob->other_arch) |
897 | if (!spell_ob->other_arch) |
… | |
… | |
901 | } |
901 | } |
902 | |
902 | |
903 | spell = arch_to_object (spell_ob->other_arch); |
903 | spell = arch_to_object (spell_ob->other_arch); |
904 | |
904 | |
905 | /* Always cast spell on caster */ |
905 | /* Always cast spell on caster */ |
906 | success = cast_spell (op, caster, dir, spell, stringarg); |
906 | success = cast_spell (op, caster, dir, spell, spellparam); |
907 | |
907 | |
908 | if (!op->contr || !op->contr->party) |
908 | if (!op->contr || !op->contr->party) |
909 | { |
909 | { |
910 | spell->remove (); |
910 | spell->remove (); |
911 | return success; |
911 | return success; |
912 | } |
912 | } |
913 | |
913 | |
914 | for_all_players (pl) |
914 | for_all_players (pl) |
915 | if ((pl->ob->contr->party == op->contr->party) && (on_same_map (pl->ob, caster))) |
915 | if ((pl->ob->contr->party == op->contr->party) && (on_same_map (pl->ob, caster))) |
916 | cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg); |
916 | cast_spell (pl->ob, caster, pl->ob->facing, spell, spellparam); |
917 | |
917 | |
918 | spell->remove (); |
918 | spell->remove (); |
919 | return success; |
919 | return success; |
920 | } |
920 | } |
921 | |
921 | |
… | |
… | |
927 | * same as op. |
927 | * same as op. |
928 | * dir is the direction to cast in. Note in some cases, if the spell |
928 | * dir is the direction to cast in. Note in some cases, if the spell |
929 | * is self only, dir really doesn't make a difference. |
929 | * is self only, dir really doesn't make a difference. |
930 | * spell_ob is the spell object that is being cast. From that, |
930 | * spell_ob is the spell object that is being cast. From that, |
931 | * we can determine what to do. |
931 | * we can determine what to do. |
932 | * stringarg is any options that are being used. It can be NULL. Almost |
932 | * spellparam is any options that are being used. It can be NULL. Almost |
933 | * certainly, only players will set it. It is basically used as optional |
933 | * certainly, only players will set it. It is basically used as optional |
934 | * parameters to a spell (eg, item to create, information for marking runes, |
934 | * parameters to a spell (eg, item to create, information for marking runes, |
935 | * etc. |
935 | * etc. |
936 | * returns 1 on successful cast, or 0 on error. These values should really |
936 | * returns 1 on successful cast, or 0 on error. These values should really |
937 | * be swapped, so that 0 is successful, and non zero is failure, with a code |
937 | * be swapped, so that 0 is successful, and non zero is failure, with a code |
… | |
… | |
945 | * if it is a player casting the spell (op->type == PLAYER, op == caster), |
945 | * if it is a player casting the spell (op->type == PLAYER, op == caster), |
946 | * this function will decrease the mana/grace appropriately. For other |
946 | * this function will decrease the mana/grace appropriately. For other |
947 | * objects, the caller should do what it considers appropriate. |
947 | * objects, the caller should do what it considers appropriate. |
948 | */ |
948 | */ |
949 | int |
949 | int |
950 | cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg) |
950 | cast_spell (object *op, object *caster, int dir, object *spell_ob, char *spellparam) |
951 | { |
951 | { |
952 | const char *godname; |
952 | const char *godname; |
953 | int success = 0; |
953 | int success = 0; |
954 | object *skill = NULL; |
954 | object *skill = NULL; |
955 | |
955 | |
… | |
… | |
1162 | } |
1162 | } |
1163 | |
1163 | |
1164 | op->change_skill (skill); /* needed for proper exp credit */ |
1164 | op->change_skill (skill); /* needed for proper exp credit */ |
1165 | } |
1165 | } |
1166 | |
1166 | |
1167 | if (INVOKE_OBJECT (CAST_SPELL, spell_ob, ARG_OBJECT (op), ARG_OBJECT (caster), ARG_INT (dir), ARG_STRING (stringarg))) |
1167 | if (INVOKE_OBJECT (CAST_SPELL, spell_ob, ARG_OBJECT (op), ARG_OBJECT (caster), ARG_INT (dir), ARG_STRING (spellparam))) |
1168 | return RESULT_INT (0); |
1168 | return RESULT_INT (0); |
1169 | |
1169 | |
1170 | switch (spell_ob->subtype) |
1170 | switch (spell_ob->subtype) |
1171 | { |
1171 | { |
1172 | /* The order of case statements is same as the order they show up |
1172 | /* The order of case statements is same as the order they show up |
1173 | * in spells.h. |
1173 | * in spells.h. |
1174 | */ |
1174 | */ |
1175 | case SP_RAISE_DEAD: |
1175 | case SP_RAISE_DEAD: |
1176 | success = cast_raise_dead_spell (op, caster, spell_ob, dir, stringarg); |
1176 | success = cast_raise_dead_spell (op, caster, spell_ob, dir, spellparam); |
1177 | break; |
1177 | break; |
1178 | |
1178 | |
1179 | case SP_RUNE: |
1179 | case SP_RUNE: |
1180 | success = write_rune (op, caster, spell_ob, dir, stringarg); |
1180 | success = write_rune (op, caster, spell_ob, dir, spellparam); |
1181 | break; |
1181 | break; |
1182 | |
1182 | |
1183 | case SP_MAKE_MARK: |
1183 | case SP_MAKE_MARK: |
1184 | success = write_mark (op, spell_ob, stringarg); |
1184 | success = write_mark (op, spell_ob, spellparam); |
1185 | break; |
1185 | break; |
1186 | |
1186 | |
1187 | case SP_BOLT: |
1187 | case SP_BOLT: |
1188 | success = fire_bolt (op, caster, dir, spell_ob, skill); |
1188 | success = fire_bolt (op, caster, dir, spell_ob, skill); |
1189 | break; |
1189 | break; |
… | |
… | |
1218 | |
1218 | |
1219 | case SP_DIMENSION_DOOR: |
1219 | case SP_DIMENSION_DOOR: |
1220 | /* dimension door needs the actual caster, because that is what is |
1220 | /* dimension door needs the actual caster, because that is what is |
1221 | * moved. |
1221 | * moved. |
1222 | */ |
1222 | */ |
1223 | success = dimension_door (op, caster, spell_ob, dir); |
1223 | success = dimension_door (op, caster, spell_ob, dir, spellparam); |
1224 | break; |
1224 | break; |
1225 | |
1225 | |
1226 | case SP_MAGIC_MAPPING: |
1226 | case SP_MAGIC_MAPPING: |
1227 | if (op->type == PLAYER) |
1227 | if (op->type == PLAYER) |
1228 | { |
1228 | { |
… | |
… | |
1261 | case SP_HEALING: |
1261 | case SP_HEALING: |
1262 | success = cast_heal (op, caster, spell_ob, dir); |
1262 | success = cast_heal (op, caster, spell_ob, dir); |
1263 | break; |
1263 | break; |
1264 | |
1264 | |
1265 | case SP_CREATE_FOOD: |
1265 | case SP_CREATE_FOOD: |
1266 | success = cast_create_food (op, caster, spell_ob, dir, stringarg); |
1266 | success = cast_create_food (op, caster, spell_ob, dir, spellparam); |
1267 | break; |
1267 | break; |
1268 | |
1268 | |
1269 | case SP_EARTH_TO_DUST: |
1269 | case SP_EARTH_TO_DUST: |
1270 | success = cast_earth_to_dust (op, caster, spell_ob); |
1270 | success = cast_earth_to_dust (op, caster, spell_ob); |
1271 | break; |
1271 | break; |
… | |
… | |
1281 | case SP_CURSE: |
1281 | case SP_CURSE: |
1282 | success = cast_curse (op, caster, spell_ob, dir); |
1282 | success = cast_curse (op, caster, spell_ob, dir); |
1283 | break; |
1283 | break; |
1284 | |
1284 | |
1285 | case SP_SUMMON_MONSTER: |
1285 | case SP_SUMMON_MONSTER: |
1286 | success = summon_object (op, caster, spell_ob, dir, stringarg); |
1286 | success = summon_object (op, caster, spell_ob, dir, spellparam); |
1287 | break; |
1287 | break; |
1288 | |
1288 | |
1289 | case SP_CHARGING: |
1289 | case SP_CHARGING: |
1290 | success = recharge (op, caster, spell_ob); |
1290 | success = recharge (op, caster, spell_ob); |
1291 | break; |
1291 | break; |
… | |
… | |
1345 | /* in rune.c */ |
1345 | /* in rune.c */ |
1346 | success = dispel_rune (op, caster, spell_ob, skill, dir); |
1346 | success = dispel_rune (op, caster, spell_ob, skill, dir); |
1347 | break; |
1347 | break; |
1348 | |
1348 | |
1349 | case SP_CREATE_MISSILE: |
1349 | case SP_CREATE_MISSILE: |
1350 | success = cast_create_missile (op, caster, spell_ob, dir, stringarg); |
1350 | success = cast_create_missile (op, caster, spell_ob, dir, spellparam); |
1351 | break; |
1351 | break; |
1352 | |
1352 | |
1353 | case SP_CONSECRATE: |
1353 | case SP_CONSECRATE: |
1354 | success = cast_consecrate (op, caster, spell_ob); |
1354 | success = cast_consecrate (op, caster, spell_ob); |
1355 | break; |
1355 | break; |
… | |
… | |
1377 | case SP_AURA: |
1377 | case SP_AURA: |
1378 | success = create_aura (op, caster, spell_ob); |
1378 | success = create_aura (op, caster, spell_ob); |
1379 | break; |
1379 | break; |
1380 | |
1380 | |
1381 | case SP_PARTY_SPELL: |
1381 | case SP_PARTY_SPELL: |
1382 | success = cast_party_spell (op, caster, dir, spell_ob, stringarg); |
1382 | success = cast_party_spell (op, caster, dir, spell_ob, spellparam); |
1383 | break; |
1383 | break; |
1384 | |
1384 | |
1385 | default: |
1385 | default: |
1386 | LOG (llevError, "cast_spell: Unhandled spell subtype %d\n", spell_ob->subtype); |
1386 | LOG (llevError, "cast_spell: Unhandled spell subtype %d\n", spell_ob->subtype); |
1387 | } |
1387 | } |