with weird targeting (like Conjure Flame) still target after the miscast check.
Tweaked targeting prompt slightly.
Don't dock turn for zapping non-wand.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1039 c06c8d41-db1a-0410-9941-cceddc491573
NQMXQ6OQVUSC7Y7F7IL252QW4A5JED224EECNHWAM4ZZYVNY745AC 4JNV6RTRY2UR3PZFMCNPRGCBSUAB7QTXYJCSYBIUAFMCCYVGN6PQC 6GQU5BMORHTHJGGVYPGJZSEIHPOVXDAS23BE7OHU4X6WVDYRC2MAC EAQJ2VSSFA3MKDR7ELP7M5VHTHGN2DCBPPZHXRAXDRKKAX2R6SHQC Q5SFQO7ANODRI6OXKHPFQ4QWKGQ367S64DPURQW2TWK7ANTYO4NQC 77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC YAAJ6PTN6QUSWE52URI5AENOGD366FIHOIFUOXFUJLVZYE4OG6HQC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC TJRYL3NXPW5IUGEV3YOC7JYWEXCZDBFPLT4AUG4P227WVKVB72ZAC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC FEGNPOJI2SALUA2PVIXIQ2CIXFLSXD7UB7CNUSAAKV4L3POXCRFQC LW4N5EHKL776DURXZMAM6JEW3JPWWX5BSNP7TCZHTLCDOQTTGFCAC KCHX2F3JFEWOZT3WMJVZAAQUU2QSZ5Q7RDCD7WUJ7VE65J52JFUQC NLSZ4SHFD6LN6AWB3HLLKQTCKQW55ZHEW3YM7XRAVAKIPD3C3Q3AC // returns 1 if spell is successfully cast for purposes of exercising and 0// otherwise (note: false == less exercise, not none). If the player aborts the// spell, returns -1.
static bool spell_is_uncastable(int spell){if (you.is_undead && spell_typematch( spell, SPTYP_HOLY )){mpr( "You can't use this type of magic!" );return (true);}// Normally undead can't memorize these spells, so this check is// to catch those in Lich form. As such, we allow the Lich form// to be extended here. -- bwrif (spell != SPELL_NECROMUTATION&& undead_cannot_memorise( spell, you.is_undead )){mpr( "You cannot cast that spell in your current form!" );return (true);}if (spell == SPELL_SYMBOL_OF_TORMENT && player_res_torment()){mpr("To torment others, one must first know what torment means. ");return (true);}return (false);}// returns SPRET_SUCCESS if spell is successfully cast for purposes of// exercising, SPRET_FAIL otherwise, or SPRET_ABORT if the player canceled// the casting.
const int flags = get_spell_flags(spc2);// XXX: This handles only some of the cases where spells need targeting...// there are others that do their own that will be missed by this// (and thus will not properly ESC without cost because of it).// Hopefully, those will eventually be fixed. -- bwrif (flags & SPFLAG_TARGETING_MASK){int targ = (testbits(flags, SPFLAG_HELPFUL) ? TARG_FRIEND : TARG_ENEMY);targeting_type dir =(testbits( flags, SPFLAG_TARGET ) ? DIR_TARGET :testbits( flags, SPFLAG_GRID ) ? DIR_TARGET :testbits( flags, SPFLAG_DIR ) ? DIR_DIR : DIR_NONE);if (spell_direction( spd, beam, dir, targ,get_spell_target_prompt(spc2) ) == -1)return (SPRET_ABORT);if (testbits( flags, SPFLAG_NOT_SELF ) && spd.isMe){if (spc2 == SPELL_TELEPORT_OTHER || spc2 == SPELL_HEAL_OTHER|| spc2 == SPELL_POLYMORPH_OTHER){mpr( "Sorry, this spell works on others only." );}else{canned_msg(MSG_UNTHINKING_ACT);}return (SPRET_ABORT);}}
if (you.is_undead && spell_typematch( spc2, SPTYP_HOLY )){mpr( "You can't use this type of magic!" );return (-1);}// Normally undead can't memorize these spells, so this check is// to catch those in Lich form. As such, we allow the Lich form// to be extended here. -- bwrif (spc2 != SPELL_NECROMUTATION&& undead_cannot_memorise( spc2, you.is_undead )){mpr( "You cannot cast that spell in your current form!" );return (-1);}
if (spell_direction(spd, beam, DIR_NONE, TARG_FRIEND) == -1)return (-1);if (spd.isMe){mpr("Sorry, it doesn't work like that.");return (-1);}
if (player_res_torment()){mpr("To torment others, one must first know what torment means. ");return (-1);}
mpr("Strike whom?", MSGCH_PROMPT);direction( beam, DIR_TARGET, TARG_ENEMY );if (!beam.isValid){canned_msg(MSG_OK);return (-1);}
struct dist fire_ball;message_current_target();direction( fire_ball, DIR_NONE, TARG_ENEMY );if (!fire_ball.isValid){canned_msg(MSG_OK);return (-1);}else{struct bolt beam;beam.source_x = you.x_pos;beam.source_y = you.y_pos;beam.set_target(fire_ball);zapping(ZAP_FIREBALL, power, beam);}
zapping(ZAP_FIREBALL, power, beam);
struct bolt beam;struct dist targ;mpr("Where?");direction( targ, DIR_TARGET, TARG_ENEMY );beam.set_target(targ);if (!targ.isValid){canned_msg(MSG_OK);return (-1);}
struct dist spelld;struct bolt beem;message_current_target();direction( spelld, DIR_NONE, TARG_ENEMY );if (!spelld.isValid){canned_msg(MSG_OK);return (-1);}beem.set_target(spelld);beem.source_x = you.x_pos;beem.source_y = you.y_pos;
struct dist cdis;mpr("Where do you want to put it?", MSGCH_PROMPT);direction( cdis, DIR_TARGET, TARG_ENEMY );if (!cdis.isValid){canned_msg(MSG_OK);return (-1);}big_cloud( cty, cdis.tx, cdis.ty, pow, 8 + random2(3) );
big_cloud( cty, beam.target_x, beam.target_y, pow, 8 + random2(3) );
static command_type shift_direction(command_type cmd){switch (cmd){case CMD_TARGET_DOWN_LEFT: return CMD_TARGET_DIR_DOWN_LEFT;case CMD_TARGET_LEFT: return CMD_TARGET_DIR_LEFT;case CMD_TARGET_DOWN: return CMD_TARGET_DIR_DOWN;case CMD_TARGET_UP: return CMD_TARGET_DIR_UP;case CMD_TARGET_RIGHT: return CMD_TARGET_DIR_RIGHT;case CMD_TARGET_DOWN_RIGHT: return CMD_TARGET_DIR_DOWN_RIGHT;case CMD_TARGET_UP_RIGHT: return CMD_TARGET_DIR_UP_RIGHT;case CMD_TARGET_UP_LEFT: return CMD_TARGET_DIR_UP_LEFT;default: return (cmd);}}static const char *target_mode_help_text(int mode){switch (mode){case DIR_NONE:return "? - help, Shift-Dir - shoot in a straight line";case DIR_TARGET:return "? - help, Dir - move target cursor";default:return "? - help";}}
static void extend_move_to_edge(dist &moves){if (!moves.dx && !moves.dy)return;// now the tricky bit - extend the target x,y out to map edge.int mx = 0, my = 0;if (moves.dx > 0)mx = (GXM - 1) - you.x_pos;if (moves.dx < 0)mx = you.x_pos;if (moves.dy > 0)my = (GYM - 1) - you.y_pos;if (moves.dy < 0)my = you.y_pos;if (!(mx == 0 || my == 0)){if (mx < my)my = mx;elsemx = my;}moves.tx = you.x_pos + moves.dx * mx;moves.ty = you.y_pos + moves.dy * my;}