v0.3.2: rebalanced hunger, now scales with max hp

This commit is contained in:
Evan Debenham 2015-09-22 03:25:56 -04:00
parent 2e1e6547a3
commit 3547cbe580

View File

@ -47,19 +47,23 @@ public class Hunger extends Buff implements Hero.Doom {
private static final String TXT_DEATH = "You starved to death...";
private float level;
private float partialDamage;
private static final String LEVEL = "level";
private static final String LEVEL = "level";
private static final String PARTIALDAMAGE = "partialDamage";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle(bundle);
bundle.put( LEVEL, level );
bundle.put( PARTIALDAMAGE, partialDamage );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
level = bundle.getFloat( LEVEL );
partialDamage = bundle.getFloat(PARTIALDAMAGE);
}
@Override
@ -76,11 +80,13 @@ public class Hunger extends Buff implements Hero.Doom {
if (isStarving()) {
if (Random.Float() < 0.3f && (target.HP > 1 || target.paralysed == 0)) {
hero.damage( 1, this );
partialDamage += target.HT/100f;
if (partialDamage > 1){
target.damage( (int)partialDamage, this);
partialDamage -= (int)partialDamage;
}
} else {
float newLevel = level + STEP;