Repair and simplify complicated pirare-robbery logic.
I think we previously mistranslated this in a way that didn't show up because it would only manifest if you found the penultimare treasure without encountering the pirate. This version is much easier to understand.
This commit is contained in:
parent
d0f943f4fb
commit
7af0c7b059
1 changed files with 30 additions and 27 deletions
51
main.c
51
main.c
|
@ -269,20 +269,41 @@ bool spotted_by_pirate(int i)
|
||||||
* (game.prop=0). */
|
* (game.prop=0). */
|
||||||
if (game.loc == game.chloc || game.prop[CHEST] >= 0)
|
if (game.loc == game.chloc || game.prop[CHEST] >= 0)
|
||||||
return true;
|
return true;
|
||||||
int k=0;
|
int snarfed=0;
|
||||||
|
bool movechest = false, robplayer = false;
|
||||||
for (int j=MINTRS; j<=MAXTRS; j++) {
|
for (int j=MINTRS; j<=MAXTRS; j++) {
|
||||||
/* Pirate won't take pyramid from plover room or dark
|
/* Pirate won't take pyramid from plover room or dark
|
||||||
* room (too easy!). */
|
* room (too easy!). */
|
||||||
if (j==PYRAM && (game.loc==PLAC[PYRAM] || game.loc==PLAC[EMRALD])) {
|
if (j==PYRAM && (game.loc==PLAC[PYRAM] || game.loc==PLAC[EMRALD])) {
|
||||||
return true;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (TOTING(j) || HERE(j))
|
||||||
|
++snarfed;
|
||||||
if (TOTING(j)) {
|
if (TOTING(j)) {
|
||||||
if (game.place[CHEST] == 0) {
|
movechest = true;
|
||||||
/* Install chest only once, to insure it is
|
robplayer = true;
|
||||||
* the last treasure in the list. */
|
}
|
||||||
|
}
|
||||||
|
/* Force chest placement before player finds last treasure */
|
||||||
|
if (game.tally == 1 && snarfed == 0 && game.place[CHEST] == 0 && HERE(LAMP) && game.prop[LAMP] == 1) {
|
||||||
|
RSPEAK(186);
|
||||||
|
movechest = true;
|
||||||
|
}
|
||||||
|
/* Do things in this order (chest move before robbery) so chest is listed
|
||||||
|
* last at the maze location. */
|
||||||
|
if (movechest) {
|
||||||
MOVE(CHEST,game.chloc);
|
MOVE(CHEST,game.chloc);
|
||||||
MOVE(MESSAG,game.chloc2);
|
MOVE(MESSAG,game.chloc2);
|
||||||
|
game.dloc[PIRATE]=game.chloc;
|
||||||
|
game.odloc[PIRATE]=game.chloc;
|
||||||
|
game.dseen[PIRATE]=false;
|
||||||
|
} else {
|
||||||
|
/* You might get a hint of the pirate's presence even if the
|
||||||
|
* chest doesn't move... */
|
||||||
|
if (game.odloc[PIRATE] != game.dloc[PIRATE] && PCT(20))
|
||||||
|
RSPEAK(127);
|
||||||
}
|
}
|
||||||
|
if (robplayer) {
|
||||||
RSPEAK(128);
|
RSPEAK(128);
|
||||||
for (int j=MINTRS; j<=MAXTRS; j++) {
|
for (int j=MINTRS; j<=MAXTRS; j++) {
|
||||||
if (!(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) {
|
if (!(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) {
|
||||||
|
@ -292,26 +313,8 @@ bool spotted_by_pirate(int i)
|
||||||
DROP(j,game.chloc);
|
DROP(j,game.chloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game.dloc[PIRATE]=game.chloc;
|
|
||||||
game.odloc[PIRATE]=game.chloc;
|
|
||||||
game.dseen[PIRATE]=false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (HERE(j))
|
|
||||||
k=1;
|
|
||||||
}
|
|
||||||
/* Force chest placement before player finds last treasure */
|
|
||||||
if (game.tally == 1 && k == 0 && game.place[CHEST] == 0 && HERE(LAMP) && game.prop[LAMP] == 1) {
|
|
||||||
RSPEAK(186);
|
|
||||||
MOVE(CHEST,game.chloc);
|
|
||||||
MOVE(MESSAG,game.chloc2);
|
|
||||||
game.dloc[PIRATE]=game.chloc;
|
|
||||||
game.odloc[PIRATE]=game.chloc;
|
|
||||||
game.dseen[PIRATE]=false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (game.odloc[PIRATE] != game.dloc[PIRATE] && PCT(20))
|
|
||||||
RSPEAK(127);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue