mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-05 11:12:49 +00:00
fixed the 4xStabber and Princess achievements
This commit is contained in:
parent
e7865a62b4
commit
0c0ca95897
@ -12,6 +12,8 @@ namespace hr {
|
|||||||
|
|
||||||
#define NUMLEADER 85
|
#define NUMLEADER 85
|
||||||
|
|
||||||
|
EX bool test_achievements = false;
|
||||||
|
|
||||||
EX bool offlineMode = false;
|
EX bool offlineMode = false;
|
||||||
|
|
||||||
EX const char* leadernames[NUMLEADER] = {
|
EX const char* leadernames[NUMLEADER] = {
|
||||||
@ -132,19 +134,26 @@ EX set<string> got_achievements;
|
|||||||
|
|
||||||
EX void achievement_gain_once(const string& s, char flags IS(0)) {
|
EX void achievement_gain_once(const string& s, char flags IS(0)) {
|
||||||
LATE(achievement_gain_once(s, flags));
|
LATE(achievement_gain_once(s, flags));
|
||||||
if(wrongMode(flags)) return;
|
|
||||||
if(got_achievements.count(s)) return;
|
if(got_achievements.count(s)) return;
|
||||||
|
if(wrongMode(flags)) {
|
||||||
|
if(test_achievements) println(hlog, "wrong mode for achievement: ", s);
|
||||||
|
else return;
|
||||||
|
}
|
||||||
got_achievements.insert(s);
|
got_achievements.insert(s);
|
||||||
achievement_gain(s.c_str(), flags);
|
achievement_gain(s.c_str(), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void achievement_log(const char* s, char flags) {
|
EX void achievement_log(const char* s, char flags) {
|
||||||
|
|
||||||
#ifdef PRINT_ACHIEVEMENTS
|
if(wrongMode(flags)) {
|
||||||
printf("achievement = %s [%d]\n", s, wrongMode(flags));
|
if(test_achievements) println(hlog, "wrong mode for achievement: ", s);
|
||||||
#endif
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(wrongMode(flags)) return;
|
if(test_achievements) {
|
||||||
|
println(hlog, "got achievement:", s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(int i=0; i<isize(achievementsReceived); i++)
|
for(int i=0; i<isize(achievementsReceived); i++)
|
||||||
if(achievementsReceived[i] == s) return;
|
if(achievementsReceived[i] == s) return;
|
||||||
@ -199,7 +208,7 @@ EX void achievement_collection(eItem it) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void achievement_collection2(eItem it, int q) {
|
EX void achievement_collection2(eItem it, int q) {
|
||||||
if(cheater) return;
|
if(cheater && !test_achievements) return;
|
||||||
if(randomPatternsMode) return;
|
if(randomPatternsMode) return;
|
||||||
LATE( achievement_collection2(it, q); )
|
LATE( achievement_collection2(it, q); )
|
||||||
|
|
||||||
@ -529,7 +538,7 @@ EX void achievement_collection2(eItem it, int q) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
EX void achievement_count(const string& s, int current, int prev) {
|
EX void achievement_count(const string& s, int current, int prev) {
|
||||||
if(cheater) return;
|
if(cheater && !test_achievements) return;
|
||||||
if(shmup::on) return;
|
if(shmup::on) return;
|
||||||
if(randomPatternsMode) return;
|
if(randomPatternsMode) return;
|
||||||
LATE( achievement_count(s, current, prev); )
|
LATE( achievement_count(s, current, prev); )
|
||||||
|
@ -1298,7 +1298,7 @@ EX void stabbingAttack(movei mi, eMonster who, int bonuskill IS(0)) {
|
|||||||
|
|
||||||
if(numsh == 2) {
|
if(numsh == 2) {
|
||||||
if(lastdouble == turncount-1) achievement_count("STAB", 4, 0);
|
if(lastdouble == turncount-1) achievement_count("STAB", 4, 0);
|
||||||
lastdouble = turncount;
|
changes.value_set(lastdouble, turncount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,9 @@ int arg::readCommon() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
else if(argis("-test-ach"))
|
||||||
|
test_achievements = true;
|
||||||
|
|
||||||
else if(argis("-test"))
|
else if(argis("-test"))
|
||||||
callhooks(hooks_tests);
|
callhooks(hooks_tests);
|
||||||
else if(argis("-offline")) {
|
else if(argis("-offline")) {
|
||||||
|
@ -634,10 +634,10 @@ struct info {
|
|||||||
if(!inv::on || !inv::usedForbidden)
|
if(!inv::on || !inv::usedForbidden)
|
||||||
#endif
|
#endif
|
||||||
achievement_gain_once("PRINCESS1");
|
achievement_gain_once("PRINCESS1");
|
||||||
princess::saved = true;
|
changes.value_set(princess::saved, true);
|
||||||
princess::everSaved = true;
|
changes.value_set(princess::everSaved, true);
|
||||||
if(inv::on && !princess::reviveAt)
|
if(inv::on && !princess::reviveAt)
|
||||||
princess::reviveAt = gold(NO_LOVE);
|
changes.value_set(princess::reviveAt, gold(NO_LOVE));
|
||||||
items[itSavedPrincess]++;
|
items[itSavedPrincess]++;
|
||||||
}
|
}
|
||||||
if(newdist == OUT_OF_PRISON && princess::challenge) {
|
if(newdist == OUT_OF_PRISON && princess::challenge) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user