Initialize Player & Monster health correctly when respawning either one.

This commit is contained in:
Oskar Wiksten
2012-11-10 15:25:53 +01:00
parent a50c1a1279
commit a99b0fc96f
2 changed files with 7 additions and 2 deletions

View File

@@ -32,12 +32,14 @@ public final class Monster extends Actor {
this.iconID = monsterType.iconID;
this.nextPosition = new CoordRect(new Coord(), monsterType.tileSize);
resetStatsToBaseTraits();
setMaxAP();
setMaxHP();
}
public void resetStatsToBaseTraits() {
this.name = monsterType.name;
this.ap.set(monsterType.maxAP, monsterType.maxAP);
this.health.set(monsterType.maxHP, monsterType.maxHP);
this.ap.max = monsterType.maxAP;
this.health.max = monsterType.maxHP;
this.position.set(position);
this.moveCost = monsterType.moveCost;
this.attackCost = monsterType.attackCost;

View File

@@ -126,6 +126,9 @@ public final class Player extends Actor {
this.skillLevels.clear();
this.availableSkillIncreases = 0;
this.alignments.clear();
this.ap.set(baseTraits.maxAP, baseTraits.maxAP);
this.health.set(baseTraits.maxHP, baseTraits.maxHP);
this.conditions.clear();
Loot startItems = new Loot();
dropLists.getDropList(DropListCollection.DROPLIST_STARTITEMS).createRandomLoot(startItems, this);