dual:: if there is no effect, do no move rather than double swing

This commit is contained in:
Zeno Rogue 2019-05-29 23:09:50 +02:00
parent e99896be06
commit 5e05a0db61
2 changed files with 6 additions and 1 deletions

View File

@ -8025,6 +8025,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
c2->wall == waMirrorWall;
if(attackable && markOrb(itOrbAether) && c2->wall != waMirrorWall)
attackable = false;
bool nm; nm = attackable;
if(forcedmovetype == fmAttack) attackable = true;
attackable = attackable && (!c2->monst || isFriendly(c2));
attackable = attackable && !nonAdjacentPlayer(cwt.at,c2);
@ -8035,7 +8036,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
if(!checkonly && errormsgs) wouldkill("%The1 would get you!");
return false;
}
if(checkonly) { nextmovetype = lmAttack; return true; }
if(checkonly) { nextmovetype = nm ? lmAttack : lmSkip; return true; }
if(c2->wall == waSmallTree) {
drawParticles(c2, winf[c2->wall].color, 4);
addMessage(XLAT("You chop down the tree."));

View File

@ -121,11 +121,13 @@ namespace dual {
}
bool lms[2][5];
eLastmovetype lmt[2][5];
for(int k=0; k<2; k++) {
switch_to(k);
for(eForcemovetype fm: { fmMove, fmAttack, fmInstant, fmActivate }) {
forcedmovetype = fm;
lms[k][fm] = movepcto(fm == fmMove ? d : 0, subdir, true);
lmt[k][fm] = nextmovetype;
println(hlog, k, int(fm), " -> ", lms[k][fm]);
forcedmovetype = fmSkip;
for(int i=0; i<ittypes; i++) orbused[i] = orbusedbak[i];
@ -144,6 +146,8 @@ namespace dual {
return true;
}
for(auto fm: {fmMove, fmInstant, fmAttack}) if(lms[0][fm] && lms[1][fm]) {
if(lmt[0][fm] == lmSkip && lmt[1][fm] == lmSkip)
continue;
println(hlog, "apply ", int(fm));
if(checkonly) { switch_to(cg); return true; }
int flash = items[itOrbFlash], lgt = items[itOrbLightning];