MCPcopy Create free account
hub / github.com/PCGen/pcgen / hitPoints

Method hitPoints

code/src/java/pcgen/core/PlayerCharacter.java:5081–5117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5079 }
5080
5081 public int hitPoints()
5082 {
5083 int total = 0;
5084
5085 double iConMod = getStatBonusTo("HP", "BONUS");
5086
5087 for (PCClass pcClass : getClassSet())
5088 {
5089 total += getClassHitPoints(pcClass, (int) iConMod);
5090 }
5091
5092 total += (int) getTotalBonusTo("HP", "CURRENTMAX");
5093
5094 //
5095 // now we see if this PC is a Familiar
5096 final PlayerCharacter nPC = getMasterPC();
5097
5098 if (nPC == null)
5099 {
5100 return total;
5101 }
5102
5103 if (masterFacet.getCopyMasterHP(id).isEmpty())
5104 {
5105 return total;
5106 }
5107 //
5108 // In order for the BONUS's to work, the PC we want
5109 // to get the hit points for must be the "current" one.
5110 //
5111 int masterHP = nPC.hitPoints();
5112
5113 final String copyMasterHP = replaceMasterString(masterFacet.getCopyMasterHP(id), masterHP);
5114 masterHP = getVariableValue(copyMasterHP, "").intValue();
5115
5116 return masterHP;
5117 }
5118
5119 private int getClassHitPoints(PCClass pcClass, int iConMod)
5120 {

Callers 15

testNoChoiceBonusMethod · 0.95
testNoSubsChoiceBonusMethod · 0.95
getTokenMethod · 0.80
passesMethod · 0.80
initForCharacterMethod · 0.80
addAbilityMethod · 0.80
removeAbilityMethod · 0.80
postLevellingUpdatesMethod · 0.80
postEquippingUpdatesMethod · 0.80

Calls 10

getStatBonusToMethod · 0.95
getClassSetMethod · 0.95
getClassHitPointsMethod · 0.95
getTotalBonusToMethod · 0.95
getMasterPCMethod · 0.95
replaceMasterStringMethod · 0.95
getVariableValueMethod · 0.95
getCopyMasterHPMethod · 0.80
intValueMethod · 0.80
isEmptyMethod · 0.65

Tested by 6

testNoChoiceBonusMethod · 0.76
testNoSubsChoiceBonusMethod · 0.76
passesMethod · 0.64