… | |
… | |
457 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
457 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
458 | new_draw_info (NDI_UNIQUE, 0, op, "You cast it at your feet."); |
458 | new_draw_info (NDI_UNIQUE, 0, op, "You cast it at your feet."); |
459 | dir = 0; |
459 | dir = 0; |
460 | } |
460 | } |
461 | |
461 | |
|
|
462 | SET_FLAG (new_op, FLAG_IDENTIFIED); |
462 | op->map->insert (new_op, |
463 | op->map->insert (new_op, |
463 | op->x + freearr_x[dir], op->y + freearr_y[dir], |
464 | op->x + freearr_x[dir], op->y + freearr_y[dir], |
464 | op, |
465 | op, |
465 | dir ? 0 : INS_BELOW_ORIGINATOR); |
466 | dir ? 0 : INS_BELOW_ORIGINATOR); |
466 | |
467 | |
… | |
… | |
994 | if (!spell_ob->other_arch) |
995 | if (!spell_ob->other_arch) |
995 | { |
996 | { |
996 | LOG (llevError, "cast_party_spell: empty other arch\n"); |
997 | LOG (llevError, "cast_party_spell: empty other arch\n"); |
997 | return 0; |
998 | return 0; |
998 | } |
999 | } |
|
|
1000 | |
999 | spell = arch_to_object (spell_ob->other_arch); |
1001 | spell = arch_to_object (spell_ob->other_arch); |
1000 | |
1002 | |
1001 | /* Always cast spell on caster */ |
1003 | /* Always cast spell on caster */ |
1002 | success = cast_spell (op, caster, dir, spell, stringarg); |
1004 | success = cast_spell (op, caster, dir, spell, stringarg); |
1003 | |
1005 | |
1004 | if (caster->contr->party == NULL) |
1006 | if (caster->contr->party == NULL) |
1005 | { |
1007 | { |
1006 | spell->remove (); |
1008 | spell->remove (); |
1007 | return success; |
1009 | return success; |
1008 | } |
1010 | } |
|
|
1011 | |
1009 | for_all_players (pl) |
1012 | for_all_players (pl) |
1010 | if ((pl->ob->contr->party == caster->contr->party) && (on_same_map (pl->ob, caster))) |
1013 | if ((pl->ob->contr->party == caster->contr->party) && (on_same_map (pl->ob, caster))) |
1011 | { |
|
|
1012 | cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg); |
1014 | cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg); |
1013 | } |
1015 | |
1014 | spell->remove (); |
1016 | spell->remove (); |
1015 | return success; |
1017 | return success; |
1016 | } |
1018 | } |
1017 | |
1019 | |
1018 | /* This is where the main dispatch when someone casts a spell. |
1020 | /* This is where the main dispatch when someone casts a spell. |
… | |
… | |
1134 | |
1136 | |
1135 | /* player/monster is trying to cast the spell. might fumble it */ |
1137 | /* player/monster is trying to cast the spell. might fumble it */ |
1136 | if (spell_ob->stats.grace && random_roll (0, 99, op, PREFER_HIGH) < |
1138 | if (spell_ob->stats.grace && random_roll (0, 99, op, PREFER_HIGH) < |
1137 | (spell_ob->level / (float) MAX (1, op->level) * cleric_chance[op->stats.Wis])) |
1139 | (spell_ob->level / (float) MAX (1, op->level) * cleric_chance[op->stats.Wis])) |
1138 | { |
1140 | { |
1139 | play_sound_player_only (op->contr, SOUND_FUMBLE_SPELL, 0, 0); |
1141 | op->contr->play_sound (sound_find ("fumble_spell")); |
1140 | new_draw_info (NDI_UNIQUE, 0, op, "You fumble the prayer."); |
1142 | new_draw_info (NDI_UNIQUE, 0, op, "You fumble the prayer."); |
1141 | |
1143 | |
1142 | op->stats.grace -= random_roll (1, SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE), op, PREFER_LOW); |
1144 | op->stats.grace -= random_roll (1, SP_level_spellpoint_cost (caster, spell_ob, SPELL_GRACE), op, PREFER_LOW); |
1143 | return 0; |
1145 | return 0; |
1144 | } |
1146 | } |
… | |
… | |
1167 | * doing. |
1169 | * doing. |
1168 | */ |
1170 | */ |
1169 | |
1171 | |
1170 | if ((mflags & P_SAFE) && !QUERY_FLAG (op, FLAG_WIZCAST)) // There is _ABSOLUTELY_ no magic allowed here (except wizards :-)! |
1172 | if ((mflags & P_SAFE) && !QUERY_FLAG (op, FLAG_WIZCAST)) // There is _ABSOLUTELY_ no magic allowed here (except wizards :-)! |
1171 | { |
1173 | { |
1172 | new_draw_info (NDI_UNIQUE, 0, op, "This ground is sacred! The gods prevent any magical effects done by you here!."); |
1174 | op->failmsg ("This ground is sacred! The gods prevent any magical effects done by you here!"); |
1173 | return 0; |
1175 | return 0; |
1174 | } |
1176 | } |
1175 | |
1177 | |
1176 | if ((spell_ob->type == SPELL) |
1178 | if ((spell_ob->type == SPELL) |
1177 | && (caster->type != POTION) |
1179 | && (caster->type != POTION) |
… | |
… | |
1182 | { |
1184 | { |
1183 | if (op->type != PLAYER) |
1185 | if (op->type != PLAYER) |
1184 | return 0; |
1186 | return 0; |
1185 | |
1187 | |
1186 | if ((mflags & P_NO_CLERIC) && spell_ob->stats.grace) |
1188 | if ((mflags & P_NO_CLERIC) && spell_ob->stats.grace) |
1187 | new_draw_info_format (NDI_UNIQUE, 0, op, "This ground is unholy! %s ignores you.", godname); |
1189 | op->failmsg (format ("This ground is unholy! %s ignores you.", godname)); |
1188 | else if (object *item = op->contr->ranged_ob) |
1190 | else if (object *item = op->contr->ranged_ob) |
1189 | { |
1191 | { |
1190 | if (item->type == SPELL) |
1192 | if (item->type == SPELL) |
1191 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your spellcasting."); |
1193 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your spellcasting."); |
1192 | else if (item->type == SCROLL) |
1194 | else if (item->type == SCROLL) |
… | |
… | |
1228 | |
1230 | |
1229 | /* We want to try to find the skill to properly credit exp. |
1231 | /* We want to try to find the skill to properly credit exp. |
1230 | * for spell casting objects, the exp goes to the skill the casting |
1232 | * for spell casting objects, the exp goes to the skill the casting |
1231 | * object requires. |
1233 | * object requires. |
1232 | */ |
1234 | */ |
|
|
1235 | fprintf (stderr, "op %p caster %p skill %p cs %s\n", (long)op, (long)caster,(long) skill, &caster->skill);//D |
1233 | if (op != caster && !skill && caster->skill) |
1236 | if (op != caster && !skill && caster->skill) |
1234 | { |
1237 | { |
1235 | skill = find_skill_by_name (op, caster->skill); |
1238 | skill = find_skill_by_name (op, caster->skill); |
1236 | if (!skill) |
1239 | if (!skill) |
1237 | { |
1240 | { |
… | |
… | |
1462 | |
1465 | |
1463 | default: |
1466 | default: |
1464 | LOG (llevError, "cast_spell: Unhandled spell subtype %d\n", spell_ob->subtype); |
1467 | LOG (llevError, "cast_spell: Unhandled spell subtype %d\n", spell_ob->subtype); |
1465 | } |
1468 | } |
1466 | |
1469 | |
1467 | /* FIXME - we need some better sound suppport */ |
1470 | op->play_sound (success ? spell_ob->sound : sound_find ("fumble_spell")); |
1468 | // yes, for example, augment map info with the spell effect |
|
|
1469 | // so clients can calculate the sounds themselves |
|
|
1470 | //play_sound_map(op->map, op->x, op->y, SOUND_CAST_SPELL_0 + spell_ob->subtype); |
|
|
1471 | |
1471 | |
1472 | return success; |
1472 | return success; |
1473 | } |
1473 | } |
1474 | |
1474 | |
1475 | |
1475 | |