mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
some more special cases for Magnetism
This commit is contained in:
parent
b2d9a6ff1d
commit
daba860085
53
game.cpp
53
game.cpp
@ -1124,12 +1124,6 @@ int monstersnear(stalemate1& sm) {
|
|||||||
bool eaten = false;
|
bool eaten = false;
|
||||||
|
|
||||||
if(hardcore && sm.who == moPlayer) return 0;
|
if(hardcore && sm.who == moPlayer) return 0;
|
||||||
dynamicval<eMonster> sw(passive_switch, passive_switch);
|
|
||||||
if(sm.moveto->item && itemclass(sm.moveto->item) == IC_TREASURE)
|
|
||||||
passive_switch = active_switch();
|
|
||||||
if(items[itOrbMagnetism]) forCellEx(c2, sm.moveto)
|
|
||||||
if(canPickupItemWithMagnetism(c2, sm.comefrom) && itemclass(c2->item) == IC_TREASURE)
|
|
||||||
passive_switch = active_switch();
|
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
bool fast = false;
|
bool fast = false;
|
||||||
@ -1256,11 +1250,23 @@ int monstersnear2() {
|
|||||||
for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i];
|
for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i];
|
||||||
if(multi::cpid == multi::players || multi::players == 1 || multi::checkonly) {
|
if(multi::cpid == multi::players || multi::players == 1 || multi::checkonly) {
|
||||||
|
|
||||||
// check for safe orbs first
|
dynamicval<eMonster> sw(passive_switch, passive_switch);
|
||||||
for(int i=0; i<size(stalemate::moves); i++)
|
|
||||||
if(hasSafeOrb(stalemate::moves[i].moveto)) {
|
// check for safe orbs and switching first
|
||||||
|
for(auto &sm: stalemate::moves) {
|
||||||
|
if(hasSafeOrb(sm.moveto)) {
|
||||||
multi::cpid--; return 0;
|
multi::cpid--; return 0;
|
||||||
}
|
}
|
||||||
|
if(sm.moveto->item && itemclass(sm.moveto->item) == IC_TREASURE)
|
||||||
|
passive_switch = active_switch();
|
||||||
|
if(items[itOrbMagnetism]) forCellEx(c2, sm.moveto)
|
||||||
|
if(canPickupItemWithMagnetism(c2, sm.comefrom)) {
|
||||||
|
if(itemclass(c2->item) == IC_TREASURE)
|
||||||
|
passive_switch = active_switch();
|
||||||
|
if(hasSafeOrb(c2))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=0; i<size(stalemate::moves); i++)
|
for(int i=0; i<size(stalemate::moves); i++)
|
||||||
for(int j=0; j<size(stalemate::moves); j++) if(i != j) {
|
for(int j=0; j<size(stalemate::moves); j++) if(i != j) {
|
||||||
@ -3180,16 +3186,6 @@ void playerMoveEffects(cell *c1, cell *c2) {
|
|||||||
addMessage(XLAT("Better not to let your greed make you stray from your path."));
|
addMessage(XLAT("Better not to let your greed make you stray from your path."));
|
||||||
playSound(c2, "nervous");
|
playSound(c2, "nervous");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(items[itOrbMagnetism])
|
|
||||||
forCellEx(c3, c2) if(canPickupItemWithMagnetism(c3, c2)) {
|
|
||||||
if(c3->item == itCompass) {
|
|
||||||
if(!c2->item)
|
|
||||||
moveItem(c3, c2, false);
|
|
||||||
}
|
|
||||||
else if(markOrb(itOrbMagnetism))
|
|
||||||
collectItem(c3, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void beastcrash(cell *c, cell *beast) {
|
void beastcrash(cell *c, cell *beast) {
|
||||||
@ -6317,6 +6313,24 @@ bool canPickupItemWithMagnetism(cell *c, cell *from) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool doPickupItemsWithMagnetism(cell *c) {
|
||||||
|
cell *csaf = NULL;
|
||||||
|
if(items[itOrbMagnetism])
|
||||||
|
forCellEx(c3, c) if(canPickupItemWithMagnetism(c3, c)) {
|
||||||
|
if(c3->item == itCompass) {
|
||||||
|
if(!c->item)
|
||||||
|
moveItem(c3, c, false);
|
||||||
|
}
|
||||||
|
else if(c3->item == itOrbSafety || c3->item == itBuggy || c3->item == itBuggy2)
|
||||||
|
csaf = c3;
|
||||||
|
else if(markOrb(itOrbMagnetism))
|
||||||
|
collectItem(c3, false);
|
||||||
|
}
|
||||||
|
if(csaf)
|
||||||
|
return collectItem(csaf, false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void pickupMovedItems(cell *c) {
|
void pickupMovedItems(cell *c) {
|
||||||
if(!c->item) return;
|
if(!c->item) return;
|
||||||
if(isPlayerOn(c)) collectItem(c, true);
|
if(isPlayerOn(c)) collectItem(c, true);
|
||||||
@ -7491,6 +7505,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!boatmove && collectItem(c2)) return true;
|
if(!boatmove && collectItem(c2)) return true;
|
||||||
|
if(doPickupItemsWithMagnetism(c2)) return true;
|
||||||
|
|
||||||
if(isIcyLand(cwt.c) && cwt.c->wall == waNone && markOrb(itOrbWinter)) {
|
if(isIcyLand(cwt.c) && cwt.c->wall == waNone && markOrb(itOrbWinter)) {
|
||||||
invismove = false;
|
invismove = false;
|
||||||
|
4
orbs.cpp
4
orbs.cpp
@ -108,12 +108,14 @@ void reduceOrbPowers() {
|
|||||||
reduceOrbPower(itOrbDigging, 100);
|
reduceOrbPower(itOrbDigging, 100);
|
||||||
reduceOrbPower(itOrbTeleport, 200);
|
reduceOrbPower(itOrbTeleport, 200);
|
||||||
reduceOrbPower(itOrbSpace, 150);
|
reduceOrbPower(itOrbSpace, 150);
|
||||||
|
reduceOrbPower(itOrbMagnetism, 150);
|
||||||
reduceOrbPowerAlways(itOrbSafety);
|
reduceOrbPowerAlways(itOrbSafety);
|
||||||
reduceOrbPower(itOrbThorns, 150);
|
reduceOrbPower(itOrbThorns, 150);
|
||||||
reduceOrbPower(itOrbWater, 150);
|
reduceOrbPower(itOrbWater, 150);
|
||||||
reduceOrbPower(itOrbAir, 150);
|
reduceOrbPower(itOrbAir, 150);
|
||||||
reduceOrbPower(itOrbFrog, 77);
|
reduceOrbPower(itOrbFrog, 77);
|
||||||
reduceOrbPower(itOrbDash, 77);
|
reduceOrbPower(itOrbDash, 77);
|
||||||
|
reduceOrbPower(itOrbPhasing, 77);
|
||||||
reduceOrbPower(itOrbDiscord, 67);
|
reduceOrbPower(itOrbDiscord, 67);
|
||||||
reduceOrbPower(itOrbSummon, 333);
|
reduceOrbPower(itOrbSummon, 333);
|
||||||
reduceOrbPower(itOrbMatter, 333);
|
reduceOrbPower(itOrbMatter, 333);
|
||||||
@ -1298,6 +1300,7 @@ int orbcharges(eItem it) {
|
|||||||
return 40;
|
return 40;
|
||||||
case itOrbFrog:
|
case itOrbFrog:
|
||||||
case itOrbDash:
|
case itOrbDash:
|
||||||
|
case itOrbPhasing:
|
||||||
return 45;
|
return 45;
|
||||||
case itOrb37:
|
case itOrb37:
|
||||||
case itOrbEnergy:
|
case itOrbEnergy:
|
||||||
@ -1324,6 +1327,7 @@ int orbcharges(eItem it) {
|
|||||||
case itOrbPsi:
|
case itOrbPsi:
|
||||||
case itOrbDigging:
|
case itOrbDigging:
|
||||||
case itOrbTeleport:
|
case itOrbTeleport:
|
||||||
|
case itOrbMagnetism:
|
||||||
return 77;
|
return 77;
|
||||||
case itOrbDomination:
|
case itOrbDomination:
|
||||||
return 90;
|
return 90;
|
||||||
|
Loading…
Reference in New Issue
Block a user