v3.3.0: fixed lock usage not being tracked when normal keys are used

This commit is contained in:
Evan Debenham
2025-11-30 12:22:32 -05:00
parent 472137b18d
commit e9dca7480b
2 changed files with 15 additions and 1 deletions
@@ -2348,6 +2348,7 @@ public class Hero extends Char {
int door = Dungeon.level.map[doorCell]; int door = Dungeon.level.map[doorCell];
SkeletonKey.keyRecharge skele = buff(SkeletonKey.keyRecharge.class); SkeletonKey.keyRecharge skele = buff(SkeletonKey.keyRecharge.class);
SkeletonKey.KeyReplacementTracker keyUseTrack = buff(SkeletonKey.KeyReplacementTracker.class);
if (skele != null && skele.isCursed() && Random.Int(6) != 0){ if (skele != null && skele.isCursed() && Random.Int(6) != 0){
GLog.n(Messages.get(this, "key_distracted")); GLog.n(Messages.get(this, "key_distracted"));
@@ -2358,6 +2359,9 @@ public class Hero extends Char {
if (door == Terrain.LOCKED_DOOR) { if (door == Terrain.LOCKED_DOOR) {
hasKey = Notes.remove(new IronKey(Dungeon.depth)); hasKey = Notes.remove(new IronKey(Dungeon.depth));
if (hasKey) { if (hasKey) {
if (keyUseTrack != null){
keyUseTrack.processIronLockOpened();
}
Level.set(doorCell, Terrain.DOOR); Level.set(doorCell, Terrain.DOOR);
} }
} else if (door == Terrain.HERO_LKD_DR) { } else if (door == Terrain.HERO_LKD_DR) {
@@ -2367,6 +2371,9 @@ public class Hero extends Char {
} else if (door == Terrain.CRYSTAL_DOOR) { } else if (door == Terrain.CRYSTAL_DOOR) {
hasKey = Notes.remove(new CrystalKey(Dungeon.depth)); hasKey = Notes.remove(new CrystalKey(Dungeon.depth));
if (hasKey) { if (hasKey) {
if (keyUseTrack != null){
keyUseTrack.processCrystalLockOpened();
}
Level.set(doorCell, Terrain.EMPTY); Level.set(doorCell, Terrain.EMPTY);
Sample.INSTANCE.play(Assets.Sounds.TELEPORT); Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
CellEmitter.get( doorCell ).start( Speck.factory( Speck.DISCOVER ), 0.025f, 20 ); CellEmitter.get( doorCell ).start( Speck.factory( Speck.DISCOVER ), 0.025f, 20 );
@@ -2389,6 +2396,7 @@ public class Hero extends Char {
Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst ); Heap heap = Dungeon.level.heaps.get( ((HeroAction.OpenChest)curAction).dst );
SkeletonKey.keyRecharge skele = buff(SkeletonKey.keyRecharge.class); SkeletonKey.keyRecharge skele = buff(SkeletonKey.keyRecharge.class);
SkeletonKey.KeyReplacementTracker keyUseTrack = buff(SkeletonKey.KeyReplacementTracker.class);
if (skele != null && skele.isCursed() if (skele != null && skele.isCursed()
&& (heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST) && (heap.type == Type.LOCKED_CHEST || heap.type == Type.CRYSTAL_CHEST)
@@ -2402,8 +2410,14 @@ public class Hero extends Char {
Sample.INSTANCE.play( Assets.Sounds.BONES ); Sample.INSTANCE.play( Assets.Sounds.BONES );
} else if (heap.type == Type.LOCKED_CHEST){ } else if (heap.type == Type.LOCKED_CHEST){
hasKey = Notes.remove(new GoldenKey(Dungeon.depth)); hasKey = Notes.remove(new GoldenKey(Dungeon.depth));
if (hasKey && keyUseTrack != null){
keyUseTrack.processGoldLockOpened();
}
} else if (heap.type == Type.CRYSTAL_CHEST){ } else if (heap.type == Type.CRYSTAL_CHEST){
hasKey = Notes.remove(new CrystalKey(Dungeon.depth)); hasKey = Notes.remove(new CrystalKey(Dungeon.depth));
if (hasKey && keyUseTrack != null){
keyUseTrack.processCrystalLockOpened();
}
} }
if (hasKey) { if (hasKey) {
@@ -632,7 +632,7 @@ public class SkeletonKey extends Artifact {
} }
if (removed){ if (removed){
GameScene.updateKeyDisplay(); GameScene.updateKeyDisplay();
GLog.i("You discard your excess keys."); GLog.i(Messages.get(SkeletonKey.class, "discard"));
} }
} }