move the player like wizard blink if there's no monster at the chosen square). Two monsters can be made to swap positions, and unseen monsters/squares can be targeted.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5423 c06c8d41-db1a-0410-9941-cceddc491573
Y5RFQ6KNJCBQUSV2T6WDR7TPZLZYLOAWBVMUTHDXGOZQDZ2U423AC
RV4L36J3DCVW3SONFFYAVK44XJQOFVNPGKHET7VOIFYHWZHCJRNAC
L254F6ZIU2HWGLFFGPIORTN4C3TDQ3E5JZ7Z7GQA5AEDIKL6PKDAC
LW4N5EHKL776DURXZMAM6JEW3JPWWX5BSNP7TCZHTLCDOQTTGFCAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
PI5BATR2SER3RFE76IUGHM2AGXVFOUM3PLU7WC2K2Q2BA5K2E73QC
HSRRNAU5UAYC6B6IQWGJPFROMZBTJICPCH6DJVZDHDTAGOQ6IOYAC
J6APXOT4QOGQFONWB7G546VTVF6QG42HVOROMHF7YBDJPR4K26OAC
WLX2RQMMOMP2PYPAGJRM4VFD2WTLJTOAZZPPY3MV76FU2EGEJ54QC
#ifdef WIZARD
static void _move_player(int x, int y)
{
// no longer held in net
clear_trapping_net();
if (!you.can_pass_through_feat(grd[x][y]))
grd[x][y] = DNGN_FLOOR;
move_player_to_grid(x, y, false, true, true);
}
static void _move_monster(int x, int y, int mid1)
{
dist moves;
direction(moves, DIR_NONE, TARG_ANY, -1, true, false,
"Move monster to where?");
if (!moves.isValid || !in_bounds(moves.tx, moves.ty))
return;
struct monsters* mon1 = &menv[mid1];
if (mons_is_caught(mon1))
mons_clear_trapping_net(mon1);
int mid2 = mgrd[moves.tx][moves.ty];
struct monsters* mon2 = NULL;
if (mid2 != NON_MONSTER)
{
mon2 = &menv[mid2];
if (mons_is_caught(mon2))
mons_clear_trapping_net(mon2);
}
mon1->x = moves.tx;
mon1->y = moves.ty;
mgrd[moves.tx][moves.ty] = mid1;
mon1->check_redraw(moves.target());
mgrd[x][y] = mid2;
if (mon2 != NULL)
{
mon2->x = x;
mon2->y = y;
mon1->check_redraw(coord_def(x, y));
}
}
void wizard_move_player_or_monster(int x, int y)
{
crawl_state.cancel_cmd_again();
crawl_state.cancel_cmd_repeat();
static bool already_moving = false;
if (already_moving)
{
mpr("Already doing a move command.");
return;
}
already_moving = true;
int mid = mgrd[x][y];
if (mid == NON_MONSTER)
_move_player(x, y);
else
_move_monster(x, y, mid);
already_moving = false;
}
#endif