From 50efc34c229b6f7186e8ad3e8aed01bfd698f85f Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Sat, 17 Apr 2021 13:54:25 -0700 Subject: [PATCH] Fixes monster hp calculation so the first hit die is averaged like the others. Characters rolled as players will need to use custom HP. --- .../main/java/com/majinnaibu/monstercards/models/Monster.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java b/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java index dd00eb2..690e881 100644 --- a/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java +++ b/app/src/main/java/com/majinnaibu/monstercards/models/Monster.java @@ -371,6 +371,9 @@ public class Monster { int hitDice = getHitDice(); int dieSize = getHitDieForSize(getSize()); int conMod = getConstitutionModifier(); + // For PC style calculations use this + //int hpTotal = (int) Math.max(1, Math.ceil(dieSize + conMod + (hitDice - 1) * ((dieSize + 1) / 2.0 + conMod))); + // For monster style calculations use this int hpTotal = (int) Math.max(1, Math.ceil(hitDice * ((dieSize + 1) / 2.0 + conMod))); return String.format(Locale.US, "%d (%dd%d %+d)", hpTotal, hitDice, dieSize, conMod * hitDice); }