From e3d2d12e37b7802fdc507e960d29fa5db3b8f800 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 26 Mar 2020 17:39:13 -0400 Subject: [PATCH] v0.8.0: fixed golden mimics gaining huge stat boosts from save/load --- .../actors/mobs/GoldenMimic.java | 5 ++--- .../shatteredpixeldungeon/actors/mobs/Mimic.java | 12 ++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/GoldenMimic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/GoldenMimic.java index 84aeb2b00..f545b4662 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/GoldenMimic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/GoldenMimic.java @@ -76,9 +76,8 @@ public class GoldenMimic extends Mimic { } @Override - public void adjustStats(int level) { - //FIXME this causes level to keep increasing over save/load - super.adjustStats(Math.round(level*1.33f)); + public void setLevel(int level) { + super.setLevel(Math.round(level*1.33f)); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java index 01add218e..b2a09c09d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mimic.java @@ -85,7 +85,8 @@ public class Mimic extends Mob { if (bundle.contains( ITEMS )) { items = new ArrayList<>((Collection) ((Collection) bundle.getCollection(ITEMS))); } - adjustStats( bundle.getInt( LEVEL ) ); + level = bundle.getInt( LEVEL ); + adjustStats(level); super.restoreFromBundle(bundle); if (state != PASSIVE && alignment == Alignment.NEUTRAL){ alignment = Alignment.ENEMY; @@ -216,10 +217,13 @@ public class Mimic extends Mob { return 6 + level; } } + + public void setLevel( int level ){ + this.level = level; + adjustStats(level); + } public void adjustStats( int level ) { - this.level = level; - HP = HT = (1 + level) * 6; defenseSkill = 2 + level/2; @@ -273,7 +277,7 @@ public class Mimic extends Mob { } m.items = new ArrayList<>( items ); - m.adjustStats( Dungeon.depth ); + m.setLevel( Dungeon.depth ); m.pos = pos; //generate an extra reward for killing the mimic