v0.8.0: fixed golden mimics gaining huge stat boosts from save/load

This commit is contained in:
Evan Debenham 2020-03-26 17:39:13 -04:00
parent 432c069691
commit e3d2d12e37
2 changed files with 10 additions and 7 deletions

View File

@ -76,9 +76,8 @@ public class GoldenMimic extends Mimic {
} }
@Override @Override
public void adjustStats(int level) { public void setLevel(int level) {
//FIXME this causes level to keep increasing over save/load super.setLevel(Math.round(level*1.33f));
super.adjustStats(Math.round(level*1.33f));
} }
@Override @Override

View File

@ -85,7 +85,8 @@ public class Mimic extends Mob {
if (bundle.contains( ITEMS )) { if (bundle.contains( ITEMS )) {
items = new ArrayList<>((Collection<Item>) ((Collection<?>) bundle.getCollection(ITEMS))); items = new ArrayList<>((Collection<Item>) ((Collection<?>) bundle.getCollection(ITEMS)));
} }
adjustStats( bundle.getInt( LEVEL ) ); level = bundle.getInt( LEVEL );
adjustStats(level);
super.restoreFromBundle(bundle); super.restoreFromBundle(bundle);
if (state != PASSIVE && alignment == Alignment.NEUTRAL){ if (state != PASSIVE && alignment == Alignment.NEUTRAL){
alignment = Alignment.ENEMY; alignment = Alignment.ENEMY;
@ -217,9 +218,12 @@ public class Mimic extends Mob {
} }
} }
public void adjustStats( int level ) { public void setLevel( int level ){
this.level = level; this.level = level;
adjustStats(level);
}
public void adjustStats( int level ) {
HP = HT = (1 + level) * 6; HP = HT = (1 + level) * 6;
defenseSkill = 2 + level/2; defenseSkill = 2 + level/2;
@ -273,7 +277,7 @@ public class Mimic extends Mob {
} }
m.items = new ArrayList<>( items ); m.items = new ArrayList<>( items );
m.adjustStats( Dungeon.depth ); m.setLevel( Dungeon.depth );
m.pos = pos; m.pos = pos;
//generate an extra reward for killing the mimic //generate an extra reward for killing the mimic