v3.3.0: fixed skele key deleting keys on depths it wasn't initialized on

This commit is contained in:
Evan Debenham
2025-11-25 10:42:37 -05:00
parent 1faa53c4ec
commit 5f11a6fb09

View File

@@ -587,22 +587,28 @@ public class SkeletonKey extends Artifact {
} }
public void processExcessKeys(){ public void processExcessKeys(){
int keysNeeded = Math.max(0, ironKeysNeeded[Dungeon.depth]); int keysNeeded = ironKeysNeeded[Dungeon.depth];
boolean removed = false; boolean removed = false;
while (Notes.keyCount(new IronKey(Dungeon.depth)) > keysNeeded){ if (keysNeeded >= 0) {
while (Notes.keyCount(new IronKey(Dungeon.depth)) > keysNeeded) {
Notes.remove(new IronKey(Dungeon.depth)); Notes.remove(new IronKey(Dungeon.depth));
removed = true; removed = true;
} }
keysNeeded = Math.max(0, goldenKeysNeeded[Dungeon.depth]); }
while (Notes.keyCount(new GoldenKey(Dungeon.depth)) > keysNeeded){ keysNeeded = goldenKeysNeeded[Dungeon.depth];
if (keysNeeded >= 0) {
while (Notes.keyCount(new GoldenKey(Dungeon.depth)) > keysNeeded) {
Notes.remove(new GoldenKey(Dungeon.depth)); Notes.remove(new GoldenKey(Dungeon.depth));
removed = true; removed = true;
} }
keysNeeded = Math.max(0, crystalKeysNeeded[Dungeon.depth]); }
while (Notes.keyCount(new CrystalKey(Dungeon.depth)) > keysNeeded){ keysNeeded = crystalKeysNeeded[Dungeon.depth];
if (keysNeeded >= 0) {
while (Notes.keyCount(new CrystalKey(Dungeon.depth)) > keysNeeded) {
Notes.remove(new CrystalKey(Dungeon.depth)); Notes.remove(new CrystalKey(Dungeon.depth));
removed = true; removed = true;
} }
}
if (removed){ if (removed){
GameScene.updateKeyDisplay(); GameScene.updateKeyDisplay();
GLog.i("You discard your excess keys."); GLog.i("You discard your excess keys.");