mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Initialize Player & Monster health correctly when respawning either one.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user