1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-02-23 14:30:08 +00:00

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

View File

@ -1753,7 +1753,7 @@ bool mayExplodeMine(cell *c, eMonster who);
int gravityLevel(cell *c); int gravityLevel(cell *c);
void fullcenter(); 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(); void checkmove();
transmatrix eumove(ld x, ld y); transmatrix eumove(ld x, ld y);

View File

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

View File

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