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

changed some achievement_gain to achievement_gain_once (this also fixes achievements awarded too soon)

This commit is contained in:
Zeno Rogue 2020-04-06 09:22:05 +02:00
parent a1053d7eea
commit 97fc244ba9
7 changed files with 26 additions and 32 deletions

View File

@ -324,7 +324,7 @@ EX void degradeDemons() {
cell *c = dcal[i];
if(c->monst == moGreaterM || c->monst == moGreater) {
changes.ccell(c);
achievement_gain("DEMONSLAYER");
achievement_gain_once("DEMONSLAYER");
if(c->monst == moGreaterM) c->monst = moLesserM;
if(c->monst == moGreater) c->monst = moLesser;
}
@ -846,7 +846,7 @@ EX void fightmessage(eMonster victim, eMonster attacker, bool stun, flagtype fla
playSound(NULL, "hit-axe"+pick123());
addMessage(XLAT("You slash %the1.", victim));
if(victim == moGoblin)
achievement_gain("GOBLINSWORD");
achievement_gain_once("GOBLINSWORD");
}
else if(victim == moKrakenT || victim == moDragonTail || victim == moDragonHead) {
playSound(NULL, "hit-sword"+pick123());
@ -991,7 +991,7 @@ EX bool attackMonster(cell *c, flagtype flags, eMonster killer) {
}
if(m == moIvyRoot && ntk>tk)
achievement_gain("IVYSLAYER");
achievement_gain_once("IVYSLAYER");
return ntk > tk;
}
@ -1237,7 +1237,7 @@ EX void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill IS(0)) {
addMessage(XLAT("You trick %the1.", c->monst));
}
if(c->monst == moFlailer && isPrincess(who) && isUnarmed(who))
achievement_gain("PRINCESS_PACIFIST");
achievement_gain_once("PRINCESS_PACIFIST");
if(attackMonster(c, 0, who)) {
numflail++;
@ -1264,9 +1264,9 @@ EX void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill IS(0)) {
if(who == moPlayer) {
if(numsh) achievement_count("STAB", numsh, 0);
if(numlance && numflail && numsh) achievement_gain("MELEE3");
if(numlance && numflail && numsh) achievement_gain_once("MELEE3");
if(numlance + numflail + numsh + numslash + bonuskill >= 5) achievement_gain("MELEE5");
if(numlance + numflail + numsh + numslash + bonuskill >= 5) achievement_gain_once("MELEE5");
if(numsh == 2) {
if(lastdouble == turncount-1) achievement_count("STAB", 4, 0);

View File

@ -630,7 +630,7 @@ struct info {
#if CAP_INV
if(!inv::on || !inv::usedForbidden)
#endif
achievement_gain("PRINCESS1");
achievement_gain_once("PRINCESS1");
princess::saved = true;
princess::everSaved = true;
if(inv::on && !princess::reviveAt)
@ -639,9 +639,9 @@ struct info {
}
if(newdist == OUT_OF_PRISON && princess::challenge) {
addMessage(XLAT("Congratulations! Your score is %1.", its(i->value)));
achievement_gain("PRINCESS2");
achievement_gain_once("PRINCESS2");
if(!cheater) achievement_score(36, i->value);
showMissionScreen();
LATE( showMissionScreen(); )
}
}
if(i->princess->land == laDungeon && !saved && !nodungeon) {
@ -2318,8 +2318,6 @@ EX }
bool gardener = false;
bool lifebrought = false; // was Life brought to the Dead Caves?
EX void livecaves() {
vector<cell*>& allcells = currentmap->allcells();
int dcs = isize(allcells);
@ -2449,7 +2447,7 @@ EX void livecaves() {
c->wall = waCavewall;
if(c->land != laCaves && c->land != laDeadCaves && c->land != laEmerald && !gardener) {
gardener = true;
achievement_gain("GARDENER");
achievement_gain_once("GARDENER");
}
}
}
@ -2467,10 +2465,8 @@ EX void livecaves() {
for(int i=0; i<isize(bringlife); i++) {
cell *c = bringlife[i];
if(c->land == laDeadCaves && !lifebrought) {
lifebrought = true;
achievement_gain("LIFEBRINGER");
}
if(c->land == laDeadCaves)
achievement_gain_once("LIFEBRINGER");
if(c->wall == waDeadfloor) c->wall = waCavefloor;
if(c->wall == waDeadfloor2) c->wall = waCavewall;
if(c->wall == waDeadwall) c->wall = waCavewall;

View File

@ -557,7 +557,7 @@ EX void moverefresh(bool turn IS(true)) {
if(c->monst && !survivesChasm(c->monst) && c->monst != moReptile && normal_gravity_at(c)) {
if(c->monst != moRunDog && c->land == laMotion)
achievement_gain("FALLDEATH1");
achievement_gain_once("FALLDEATH1");
addMessage(XLAT("%The1 falls!", c->monst));
fallMonster(c, AF_FALL);
}

View File

@ -464,10 +464,8 @@ EX void gainItem(eItem it) {
if(it == itHyperstone && items[itHyperstone] == 10)
achievement_victory(true);
if(chaosmode && gold() >= 300 && !chaosAchieved) {
achievement_gain("CHAOS", rg::chaos);
chaosAchieved = true;
}
if(chaosmode && gold() >= 300)
achievement_gain_once("CHAOS", rg::chaos);
#if ISMOBILE==1
if(g < lastsafety + R30*3/2 && g2 >= lastsafety + R30*3/2)

View File

@ -116,7 +116,7 @@ EX void moveMonster(const movei& mi) {
moveEffect(mi, m);
if(ct->wall == waCamelotMoat &&
(m == moShark || m == moCShark || m == moGreaterShark))
achievement_gain("MOATSHARK");
achievement_gain_once("MOATSHARK");
if(m == moTentacleGhost) {
cf->monst = moTentacletail;
m = moGhost;
@ -313,7 +313,7 @@ EX void moveMonster(const movei& mi) {
}
if(sword::at(ct) && canAttack(NULL, moPlayer, ct, m, AF_SWORD_INTO)) {
attackMonster(ct, AF_SWORD_INTO | AF_MSG, moPlayer);
achievement_gain("GOSWORD");
achievement_gain_once("GOSWORD");
}
}
@ -858,7 +858,7 @@ EX void moveWorm(cell *c) {
addMessage(XLAT("The sandworm explodes!"));
playSound(NULL, "explosion");
if(geometry == gZebraQuotient)
achievement_gain("ZEBRAWORM", rg::special_geometry);
achievement_gain_once("ZEBRAWORM", rg::special_geometry);
}
return;
}

View File

@ -1433,7 +1433,7 @@ EX void sideAttack(cell *mf, int dir, eMonster who, int bonuskill) {
if(who == moPlayer) {
int kills = tkills() - k + bonuskill;
if(kills >= 5) achievement_gain("MELEE5");
if(kills >= 5) achievement_gain_once("MELEE5");
}
}
@ -1504,22 +1504,22 @@ EX void movecost(cell* from, cell *to, int phase) {
#endif
if(to->land ==laCrossroads4 && !got_crossroads && !geometry && (phase & 2) && !cheater) {
achievement_gain("CR4");
achievement_gain_once("CR4");
got_crossroads = true;
chaosUnlocked = true;
}
if(isHaunted(from->land) && !isHaunted(to->land) && (phase & 2)) {
updateHi(itLotus, truelotus = items[itLotus]);
if(items[itLotus] >= 1) achievement_gain("LOTUS1");
if(items[itLotus] >= (big_unlock ? 25 : 10)) achievement_gain("LOTUS2");
if(items[itLotus] >= (big_unlock ? 50 : 25)) achievement_gain("LOTUS3");
if(items[itLotus] >= 50 && !big_unlock) achievement_gain("LOTUS4");
if(items[itLotus] >= 1) achievement_gain_once("LOTUS1");
if(items[itLotus] >= (big_unlock ? 25 : 10)) achievement_gain_once("LOTUS2");
if(items[itLotus] >= (big_unlock ? 50 : 25)) achievement_gain_once("LOTUS3");
if(items[itLotus] >= 50 && !big_unlock) achievement_gain_once("LOTUS4");
achievement_final(false);
}
if(geometry == gNormal && celldist(to) == 0 && !usedSafety && gold() >= 100 && (phase & 2))
achievement_gain("COMEBACK");
achievement_gain_once("COMEBACK");
bool tortoiseOK =
to->land == from->land || to->land == laTortoise ||

View File

@ -500,7 +500,7 @@ EX namespace yendor {
addMessage(XLAT("You feel that these directions are %1 turns old.", yi[byi].age.get_str(100)));
if(yii != byi) {
yii = byi;
achievement_gain("YENDOR1");
achievement_gain_once("YENDOR1");
playSound(yendor, "pickup-yendor");
return true;
}