1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

cleaned up where summoned creature appears for Orb of Life and Orb of Friendship

This commit is contained in:
Zeno Rogue 2021-08-08 19:04:58 +02:00
parent 683ab67ad9
commit 025893e946
8 changed files with 24 additions and 24 deletions

View File

@ -144,7 +144,7 @@ EX namespace whirlwind {
animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT);
}
for(int i=0; i<z; i++)
pickupMovedItems(whirlline[i]);
pickupMovedItems(whirlline[i], i==z-1 ? whirlline[0] : whirlline[i+1]);
}
EX void move() {
@ -1119,8 +1119,8 @@ EX namespace whirlpool {
if(wfrom->item == itKey || wfrom->item == itOrbYendor)
for(int i=0; i<wto->type; i++) createMov(wto, i);
moveItem(wfrom, wto, false);
pickupMovedItems(wfrom);
pickupMovedItems(wto);
pickupMovedItems(wfrom, wto);
pickupMovedItems(wto, wfrom);
}
if(wto && !wfrom)
@ -2466,7 +2466,7 @@ EX void livecaves() {
if(hv > 0 && c->wall == waNone) {
if(c->item && c->cpdist == 1 && markOrb(itOrbWater)) {
bool saf = c->item == itOrbSafety;
collectItem(c);
collectItem(c, c);
if(saf) return;
}
c->wall = waSea;

View File

@ -261,7 +261,7 @@ EX namespace westwall {
animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT);
}
for(int i=0; i<z; i++)
pickupMovedItems(whirlline[i]);
pickupMovedItems(whirlline[i], i<z-1 ? whirlline[i+1] : whirlline[0]);
}
EX void move() {

View File

@ -799,7 +799,7 @@ EX void monstersTurn() {
if(!phase2) movemonsters();
for(cell *pc: player_positions()) if(pc->item == itOrbSafety) {
collectItem(pc, true);
collectItem(pc, pc, true);
return;
}

View File

@ -661,7 +661,7 @@ EX namespace inv {
eItem it = cwt.at->item;
cwt.at->item = orbmap[uni];
inv::activating = true;
collectItem(cwt.at, true);
collectItem(cwt.at, cwt.at, true);
inv::activating = false;
addMessage(XLAT("You activate %the1.", orbmap[uni]));
if(!cwt.at->item) usedup[orbmap[uni]]++;

View File

@ -57,23 +57,23 @@ EX bool doPickupItemsWithMagnetism(cell *c) {
else if(c3->item == itOrbSafety || c3->item == itBuggy || c3->item == itBuggy2)
csaf = c3;
else if(markOrb(itOrbMagnetism))
collectItem(c3, false);
collectItem(c3, c3, false);
}
if(csaf)
return collectItem(csaf, false);
return collectItem(csaf, csaf, false);
return false;
}
EX void pickupMovedItems(cell *c) {
EX void pickupMovedItems(cell *c, cell *from) {
if(!c->item) return;
if(c->item == itOrbSafety) return;
if(isPlayerOn(c)) collectItem(c, true);
if(isPlayerOn(c)) collectItem(c, from, true);
if(items[itOrbMagnetism])
forCellEx(c2, c)
if(isPlayerOn(c2) && canPickupItemWithMagnetism(c, c2)) {
changes.ccell(c2);
changes.ccell(c);
collectItem(c, true);
collectItem(c, c2, true);
}
}
@ -81,7 +81,7 @@ EX bool in_lovasz() {
return specialland == laMotion && bounded && ls::single() && !daily::on;
}
EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
EX bool collectItem(cell *c2, cell *last, bool telekinesis IS(false)) {
bool dopickup = true;
bool had_choice = false;
@ -119,7 +119,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
#endif
if(isRevivalOrb(c2->item) && multi::revive_queue.size()) {
multiRevival(cwt.at, c2);
multiRevival(last, c2);
}
else if(isShmupLifeOrb(c2->item) && shmup::on) {
playSound(c2, "pickup-orb"); // TODO summon
@ -165,12 +165,12 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
}
else if(c2->item == itOrbLife) {
playSound(c2, "pickup-orb"); // TODO summon
placeGolem(cwt.at, c2, moGolem);
placeGolem(last, c2, moGolem);
if(cwt.at->monst == moGolem) cwt.at->stuntime = 0;
}
else if(c2->item == itOrbFriend) {
playSound(c2, "pickup-orb"); // TODO summon
placeGolem(cwt.at, c2, moTameBomberbird);
placeGolem(last, c2, moTameBomberbird);
if(cwt.at->monst == moTameBomberbird) cwt.at->stuntime = 0;
}
#if CAP_TOUR
@ -209,7 +209,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
changes.value_set(tortoise::seekbits, bnew);
changes.value_set(tortoise::last, seekbits);
if(seek()) {
cell *c = passable(cwt.at, NULL, 0) ? cwt.at : c2;
cell *c = passable(last, NULL, 0) ? last : c2;
changes.ccell(c);
c->item = itBabyTortoise;
if(c == c2) dopickup = false;

View File

@ -695,7 +695,7 @@ EX bool jumpTo(orbAction a, cell *dest, eItem byWhat, int bonuskill IS(0), eMons
from = NULL;
}
if(cwt.at->item != itOrbYendor && cwt.at->item != itHolyGrail) {
auto c = collectItem(cwt.at, true);
auto c = collectItem(cwt.at, from, true);
if(c) {
return true;
}
@ -777,7 +777,7 @@ void telekinesis(cell *dest) {
}
moveItem(dest, cwt.at, true);
collectItem(cwt.at, true);
collectItem(cwt.at, cwt.at, true);
useupOrb(itOrbSpace, cost.first);
if(cost.second)
markOrb(itOrbMagnetism);

View File

@ -1147,11 +1147,11 @@ bool pcmove::perform_actual_move() {
movecost(cwt.at, c2, 1);
if(!boatmove && collectItem(c2)) return true;
if(!boatmove && collectItem(c2, cwt.at)) return true;
if(boatmove && c2->item && cwt.at->item) {
eItem it = c2->item;
c2->item = cwt.at->item;
if(collectItem(c2)) return true;
if(collectItem(c2, cwt.at)) return true;
eItem it2 = c2->item;
c2->item = it;
cwt.at->item = it2;
@ -1167,7 +1167,7 @@ bool pcmove::perform_actual_move() {
forCellEx(c3, c2) if(c3->wall == waIcewall && c3->item) {
changes.ccell(c3);
markOrb(itOrbWinter);
if(collectItem(c3)) return true;
if(collectItem(c3, cwt.at)) return true;
}
movecost(cwt.at, c2, 2);

View File

@ -1098,7 +1098,7 @@ void movePlayer(monster *m, int delta) {
}
else if(m->inBoat && !isWateryOrBoat(c2) && passable(c2, m->base, P_ISPLAYER | P_MIRROR | reflectflag)) {
if(boatGoesThrough(c2) && markOrb(itOrbWater)) {
collectItem(c2);
collectItem(c2, m->base);
c2->wall = isIcyLand(m->base) ? waLake : waSea;
}
else {
@ -1249,7 +1249,7 @@ void movePlayer(monster *m, int delta) {
}
if(c2->item == itOrbYendor && !peace::on) yendor::check(c2);
collectItem(c2);
collectItem(c2, m->base);
movecost(m->base, c2, 2);
}
}