Skip to content

Commit

Permalink
fixed the issue with Orb of Aether being marked as used due to Minefi…
Browse files Browse the repository at this point in the history
…eld uncovering
  • Loading branch information
zenorogue committed Feb 6, 2019
1 parent 41ee2f4 commit 92d9884
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 30 deletions.
51 changes: 35 additions & 16 deletions game.cpp
Expand Up @@ -3340,25 +3340,32 @@ void gainShard(cell *c2, const char *msg) {
invismove = false;
}

void uncoverMinesFull(cell *c2) {
int mineradius =
(items[itBombEgg] < 1 && !tactic::on) ? 0 :
items[itBombEgg] < 20 ? 1 :
items[itBombEgg] < 30 ? 2 :
3;

bool nomine = !normal_gravity_at(c2);
if(!nomine && uncoverMines(c2, mineradius, 0, true) && markOrb(itOrbAether))
nomine = true;

if(!nomine) {
uncoverMines(c2, mineradius, 0, false);
mayExplodeMine(c2, moPlayer);
}
}

void playerMoveEffects(cell *c1, cell *c2) {

if(peace::on) items[itOrbSword] = c2->land == laBurial ? 100 : 0;

sword::angle[multi::cpid] = sword::shift(c1, c2, sword::angle[multi::cpid]);

destroyWeakBranch(c1, c2, moPlayer);

bool nomine = (c2->wall == waMineMine || c2->wall == waMineUnknown) && markOrb(itOrbAether);

if(!nomine) {
uncoverMines(c2,
(items[itBombEgg] < 1 && !tactic::on) ? 0 :
items[itBombEgg] < 20 ? 1 :
items[itBombEgg] < 30 ? 2 :
3, 0
);
mayExplodeMine(c2, moPlayer);
}
uncoverMinesFull(c2);

if((c2->wall == waClosePlate || c2->wall == waOpenPlate) && !markOrb(itOrbAether))
toggleGates(c2, c2->wall);
Expand Down Expand Up @@ -7081,9 +7088,17 @@ void knightFlavorMessage(cell *c2) {
msgid++;
}

void uncoverMines(cell *c, int lev, int dist) {
if(c->wall == waMineUnknown)
c->wall = waMineOpen;
bool uncoverMines(cell *c, int lev, int dist, bool just_checking) {
bool b = false;
if(c->wall == waMineMine && just_checking) return true;
if(c->wall == waMineUnknown) {
if(just_checking)
return true;
else {
c->wall = waMineOpen;
b = true;
}
}

bool minesNearby = false;
bool nominesNearby = false;
Expand All @@ -7096,14 +7111,18 @@ void uncoverMines(cell *c, int lev, int dist) {
}

if(lev && (nominesNearby || mineopens) && !minesNearby) for(int i=0; i<c->type; i++)
if(c->move(i) && (c->move(i)->wall == waMineUnknown || c->move(i)->wall == waMineOpen))
uncoverMines(c->move(i), lev-1, dist+1);
if(c->move(i) && (c->move(i)->wall == waMineUnknown || c->move(i)->wall == waMineOpen)) {
b |= uncoverMines(c->move(i), lev-1, dist+1, just_checking);
if(b && just_checking) return true;
}

if(minesNearby && !nominesNearby && dist == 0) {
forCellEx(c2, c)
if(c2->wall == waMineMine && c2->land == laMinefield)
c2->landparam |= 1;
}

return b;
}

namespace orbbull {
Expand Down
2 changes: 1 addition & 1 deletion hyper.h
Expand Up @@ -695,7 +695,7 @@ bool makeEmpty(cell *c);
bool isCrossroads(eLand l);
enum orbAction { roMouse, roKeyboard, roCheck, roMouseForce, roMultiCheck, roMultiGo };
void moveItem (cell *from, cell *to, bool activateYendor);
void uncoverMines(cell *c, int lev, int dist);
bool uncoverMines(cell *c, int lev, int dist, bool just_checking);
void killMonster(cell *c, eMonster who_killed, flagtype flags = 0);
void toggleGates(cell *ct, eWall type, int rad);
bool destroyHalfvine(cell *c, eWall newwall = waNone, int tval = 6);
Expand Down
17 changes: 4 additions & 13 deletions shmup.cpp
Expand Up @@ -1769,20 +1769,11 @@ void movePlayer(monster *m, int delta) {
}
movecost(m->base, c2, 1);

bool nomine = (c2->wall == waMineMine || c2->wall == waMineUnknown) && markOrb(itOrbAether);

if(!nomine) {
uncoverMines(c2,
items[itBombEgg] < 20 ? 1 :
items[itBombEgg] < 30 ? 2 :
3, 0
);
if(c2->wall == waMineMine && !markOrb(itOrbWinter)) {
items[itOrbLife] = 0;
m->dead = true;
}
mayExplodeMine(c2, moPlayer);
if(c2->wall == waMineMine && !markOrb(itOrbAether) && !markOrb(itOrbWinter)) {
items[itOrbLife] = 0;
m->dead = true;
}
uncoverMinesFull(c2);

if(isWatery(c2) && isWatery(m->base) && m->inBoat)
moveItem(m->base, c2, true);
Expand Down

0 comments on commit 92d9884

Please sign in to comment.