… | |
… | |
1169 | * doing. |
1169 | * doing. |
1170 | */ |
1170 | */ |
1171 | |
1171 | |
1172 | 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 :-)! |
1173 | { |
1173 | { |
1174 | 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!"); |
1175 | return 0; |
1175 | return 0; |
1176 | } |
1176 | } |
1177 | |
1177 | |
1178 | if ((spell_ob->type == SPELL) |
1178 | if ((spell_ob->type == SPELL) |
1179 | && (caster->type != POTION) |
1179 | && (caster->type != POTION) |
… | |
… | |
1184 | { |
1184 | { |
1185 | if (op->type != PLAYER) |
1185 | if (op->type != PLAYER) |
1186 | return 0; |
1186 | return 0; |
1187 | |
1187 | |
1188 | if ((mflags & P_NO_CLERIC) && spell_ob->stats.grace) |
1188 | if ((mflags & P_NO_CLERIC) && spell_ob->stats.grace) |
1189 | 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)); |
1190 | else if (object *item = op->contr->ranged_ob) |
1190 | else if (object *item = op->contr->ranged_ob) |
1191 | { |
1191 | { |
1192 | if (item->type == SPELL) |
1192 | if (item->type == SPELL) |
1193 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your spellcasting."); |
1193 | new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your spellcasting."); |
1194 | else if (item->type == SCROLL) |
1194 | else if (item->type == SCROLL) |
… | |
… | |
1230 | |
1230 | |
1231 | /* 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. |
1232 | * 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 |
1233 | * object requires. |
1233 | * object requires. |
1234 | */ |
1234 | */ |
|
|
1235 | fprintf (stderr, "op %p caster %p skill %p cs %s\n", (long)op, (long)caster,(long) skill, &caster->skill);//D |
1235 | if (op != caster && !skill && caster->skill) |
1236 | if (op != caster && !skill && caster->skill) |
1236 | { |
1237 | { |
1237 | skill = find_skill_by_name (op, caster->skill); |
1238 | skill = find_skill_by_name (op, caster->skill); |
1238 | if (!skill) |
1239 | if (!skill) |
1239 | { |
1240 | { |
… | |
… | |
1244 | op->change_skill (skill); /* needed for proper exp credit */ |
1245 | op->change_skill (skill); /* needed for proper exp credit */ |
1245 | } |
1246 | } |
1246 | |
1247 | |
1247 | if (INVOKE_OBJECT (CAST_SPELL, spell_ob, ARG_OBJECT (op), ARG_OBJECT (caster), ARG_INT (dir), ARG_STRING (stringarg))) |
1248 | if (INVOKE_OBJECT (CAST_SPELL, spell_ob, ARG_OBJECT (op), ARG_OBJECT (caster), ARG_INT (dir), ARG_STRING (stringarg))) |
1248 | return RESULT_INT (0); |
1249 | return RESULT_INT (0); |
1249 | |
|
|
1250 | op->play_sound (spell_ob->sound); |
|
|
1251 | |
1250 | |
1252 | switch (spell_ob->subtype) |
1251 | switch (spell_ob->subtype) |
1253 | { |
1252 | { |
1254 | /* The order of case statements is same as the order they show up |
1253 | /* The order of case statements is same as the order they show up |
1255 | * in in spells.h. |
1254 | * in in spells.h. |
… | |
… | |
1466 | |
1465 | |
1467 | default: |
1466 | default: |
1468 | 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); |
1469 | } |
1468 | } |
1470 | |
1469 | |
1471 | /* FIXME - we need some better sound suppport */ |
1470 | op->play_sound (success ? spell_ob->sound : sound_find ("fumble_spell")); |
1472 | // yes, for example, augment map info with the spell effect |
|
|
1473 | // so clients can calculate the sounds themselves |
|
|
1474 | //play_sound_map(op->map, op->x, op->y, SOUND_CAST_SPELL_0 + spell_ob->subtype); |
|
|
1475 | |
1471 | |
1476 | return success; |
1472 | return success; |
1477 | } |
1473 | } |
1478 | |
1474 | |
1479 | |
1475 | |