1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-18 14:45:12 +00:00

Add a cheat to hold orb powers at their current level

This commit is contained in:
Joseph C. Sible
2025-09-30 20:16:58 -04:00
parent 8b7e82b460
commit c4c9379fcb
4 changed files with 25 additions and 1 deletions

View File

@@ -123,6 +123,18 @@ vector<cheatkey> cheats = {
kills[moCultist] = qkills; kills[moCultist] = qkills;
kills[moTroll] = qkills; kills[moTroll] = qkills;
}}, }},
cheatkey{'H', "toggle hold of orb powers", [] {
if(cheat_items_enabled) {
cheat_items_enabled = false;
addMessage(XLAT("Hold of orb powers disabled!"));
}
else {
cheat_items = items;
cheat_items_enabled = true;
cheater++;
addMessage(XLAT("Hold of orb powers enabled!"));
}
}},
cheatkey{'M', "deplete orb powers", [] { cheatkey{'M', "deplete orb powers", [] {
for(int i=0; i<ittypes; i++) for(int i=0; i<ittypes; i++)
if(itemclass(eItem(i)) == IC_ORB) if(itemclass(eItem(i)) == IC_ORB)

View File

@@ -14,6 +14,9 @@ EX int currentLocalTreasure;
/** for treasures, the number collected; for orbs, the number of charges */ /** for treasures, the number collected; for orbs, the number of charges */
EX array<int, ittypes> items; EX array<int, ittypes> items;
EX array<int, ittypes> cheat_items;
EX bool cheat_items_enabled;
EX map<modecode_t, array<int, ittypes> > hiitems; EX map<modecode_t, array<int, ittypes> > hiitems;
EX bool pickable_from_water(eItem it) { EX bool pickable_from_water(eItem it) {

View File

@@ -50,7 +50,7 @@ EX void useupOrb(eItem it, int qty) {
} }
EX void drainOrb(eItem it, int target IS(0)) { EX void drainOrb(eItem it, int target IS(0)) {
if(items[it] > target) useupOrb(it, items[it] - target); if(!cheat_items_enabled && items[it] > target) useupOrb(it, items[it] - target);
} }
EX void empathyMove(const movei& mi) { EX void empathyMove(const movei& mi) {
@@ -233,6 +233,14 @@ EX void reduceOrbPowers() {
else else
items[itCrossbow]--; items[itCrossbow]--;
} }
if(cheat_items_enabled)
for(int i=0; i<ittypes; i++) {
if(i == itOrbSpeed) {
if(items[i] < cheat_items[i]) items[i] = cheat_items[i] + 1; // Orb of Speed always needs to alternate between an odd and even number to work right
}
else if(itemclass(eItem(i)) == IC_ORB && i != itOrbSafety)
items[i] = cheat_items[i];
}
} }
eWall orig_wall; eWall orig_wall;

View File

@@ -184,6 +184,7 @@ EX void reset_cheats() {
cheater = 0; cheater = 0;
reptilecheat = false; reptilecheat = false;
shadingcheat = false; shadingcheat = false;
cheat_items_enabled = false;
timerghost = true; timerghost = true;
gen_wandering = true; gen_wandering = true;
} }