the cost of leaving Land of Power now happens before collecting items

This commit is contained in:
Zeno Rogue 2018-08-01 14:04:47 +02:00
parent f1250a677d
commit 508cecb3b3
4 changed files with 25 additions and 16 deletions

View File

@ -6094,7 +6094,7 @@ bool activateRecall() {
}
killFriendlyIvy();
movecost(cwt.c, recallCell);
movecost(cwt.c, recallCell, 3);
playerMoveEffects(cwt.c, recallCell);
mirror::destroyAll();
@ -6280,8 +6280,8 @@ bool multiRevival(cell *on, cell *moveto) {
return false;
}
void movecost(cell* from, cell *to) {
if(from->land == laPower && to->land != laPower) {
void movecost(cell* from, cell *to, int phase) {
if(from->land == laPower && to->land != laPower && (phase & 1)) {
int n=0;
for(int i=0; i<ittypes; i++)
if(itemclass(eItem(i)) == IC_ORB && items[i] >= 2 && i != itOrbFire)
@ -6291,16 +6291,16 @@ void movecost(cell* from, cell *to) {
}
#if CAP_TOUR
if(from->land != to->land && tour::on)
if(from->land != to->land && tour::on && (phase & 2))
tour::checkGoodLand(to->land);
#endif
if(to->land ==laCrossroads4 && !chaosUnlocked && !geometry) {
if(to->land ==laCrossroads4 && !chaosUnlocked && !geometry && (phase & 2)) {
achievement_gain("CR4");
chaosUnlocked = true;
}
if(isHaunted(from->land) && !isHaunted(to->land)) {
if(isHaunted(from->land) && !isHaunted(to->land) && (phase & 2)) {
updateHi(itLotus, truelotus = items[itLotus]);
if(items[itLotus] >= 1) achievement_gain("LOTUS1");
if(items[itLotus] >= (inv::on ? 25 : 10)) achievement_gain("LOTUS2");
@ -6309,7 +6309,7 @@ void movecost(cell* from, cell *to) {
achievement_final(false);
}
if(celldist(to) == 0 && !usedSafety && gold() >= 100)
if(celldist(to) == 0 && !usedSafety && gold() >= 100 && (phase & 2))
achievement_gain("COMEBACK");
bool tortoiseOK =
@ -6317,7 +6317,7 @@ void movecost(cell* from, cell *to) {
(to->land == laDragon && from->land != laTortoise) ||
chaosmode;
if(tortoise::seek() && !from->item && !tortoiseOK && passable(from, NULL, 0)) {
if(tortoise::seek() && !from->item && !tortoiseOK && passable(from, NULL, 0) && (phase & 2)) {
from->item = itBabyTortoise;
tortoise::babymap[from] = tortoise::seekbits;
addMessage(XLAT("You leave %the1.", itBabyTortoise));
@ -7398,7 +7398,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
if(items[itOrbDomination] > ORBBASE && isMountable(c2->monst) && !monstersnear2()) {
if(checkonly) return true;
if(!isMountable(cwt.c->monst)) dragon::target = NULL;
movecost(cwt.c, c2);
movecost(cwt.c, c2, 3);
flipplayer = true; if(multi::players > 1) multi::flipped[multi::cpid] = true;
invismove = (turncount >= noiseuntil) && items[itOrbInvis] > 0;
@ -7839,6 +7839,8 @@ bool movepcto(int d, int subdir, bool checkonly) {
if(earthMove(cwt.c, d)) markOrb(itOrbDigging);
}
movecost(cwt.c, c2, 1);
if(!boatmove && collectItem(c2)) return true;
if(doPickupItemsWithMagnetism(c2)) return true;
@ -7851,7 +7853,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
forCellEx(c3, c2) if(c3->wall == waIcewall && c3->item)
markOrb(itOrbWinter), collectItem(c3);
movecost(cwt.c, c2);
movecost(cwt.c, c2, 2);
{
bool pushpast = false;

View File

@ -1753,7 +1753,7 @@ bool mayExplodeMine(cell *c, eMonster who);
int gravityLevel(cell *c);
void fullcenter();
void movecost(cell* from, cell *to);
void movecost(cell* from, cell *to, int phase); // 1 = pre-collect, 2 = post-collect, 3 = both
void checkmove();
transmatrix eumove(ld x, ld y);

View File

@ -534,7 +534,7 @@ void teleportTo(cell *dest) {
if(b) {
killFriendlyIvy();
drainOrb(itOrbTeleport);
movecost(cwt.c, dest);
movecost(cwt.c, dest, 3);
playerMoveEffects(cwt.c, dest);
afterplayermoved();
bfs();
@ -543,7 +543,8 @@ void teleportTo(cell *dest) {
}
killFriendlyIvy();
movecost(cwt.c, dest);
cell *from = cwt.c;
movecost(from, dest, 1);
playerMoveEffects(cwt.c, dest);
cwt.c = dest; cwt.spin = hrand(dest->type); flipplayer = !!(hrand(2));
drainOrb(itOrbTeleport);
@ -560,11 +561,14 @@ void teleportTo(cell *dest) {
shmup::teleported();
else
checkmoveO();
movecost(from, dest, 2);
}
void jumpTo(cell *dest, eItem byWhat, int bonuskill, eMonster dashmon) {
if(byWhat != itStrongWind) playSound(dest, "orb-frog");
movecost(cwt.c, dest);
cell *from = cwt.c;
movecost(from, dest, 1);
killFriendlyIvy();
@ -582,7 +586,7 @@ void jumpTo(cell *dest, eItem byWhat, int bonuskill, eMonster dashmon) {
playerMoveEffects(c1, dest);
if(cwt.c->item != itOrbYendor && cwt.c->item != itHolyGrail)
collectItem(cwt.c, true);
if(byWhat == itOrbFrog) {
useupOrb(itOrbFrog, 5);
addMessage(XLAT("You jump!"));
@ -603,6 +607,8 @@ void jumpTo(cell *dest, eItem byWhat, int bonuskill, eMonster dashmon) {
for(int i=9; i>=0; i--)
setdist(cwt.c, i, NULL);
movecost(from, dest, 2);
createNoise(1);
if(shmup::on)

View File

@ -1713,7 +1713,7 @@ void movePlayer(monster *m, int delta) {
items[itOrbAether] = 0;
addMessage(XLAT("Your Aether powers are drained by %the1!", c2->wall));
}
movecost(m->base, c2);
movecost(m->base, c2, 1);
bool nomine = (c2->wall == waMineMine || c2->wall == waMineUnknown) && markOrb(itOrbAether);
@ -1743,6 +1743,7 @@ void movePlayer(monster *m, int delta) {
if(c2->item == itOrbYendor && !peace::on) yendor::check(c2);
collectItem(c2);
movecost(m->base, c2, 2);
}
}