Little question...
Does anyone know how HP is calculated exactly using the endurance stat (or is it using more stats?), and how it is distributed among the bodyparts?
EDIT: So far I have found this:
Quote
bodypart::CalculateMaxHP(ulong Flags)
{
int HPDelta = MaxHP - HP;
MaxHP = 0;
if(Master)
{
if(!UseMaterialAttributes())
{
long Endurance = Master->GetAttribute(ENDURANCE);
MaxHP = GetBodyPartVolume() * Endurance * Endurance / 200000;
}
else
{
long SV = GetMainMaterial()->GetStrengthValue();
MaxHP = (GetBodyPartVolume() * SV >> 4) * SV / 250000;
}
if(MaxHP < 1)
MaxHP = 1;
if(Flags & MAY_CHANGE_HPS)
HP = Max(MaxHP - HPDelta, 1);
if(Flags & CHECK_USABILITY)
SignalPossibleUsabilityChange();
}
}
Which implies that HP is determined by Endurance, and body part volume. Then I went looking for the GetBodyPartVolume() function, and I found this:
Quote
long humanoid::GetBodyPartVolume(int I) const
{
switch(I)
{
case HEAD_INDEX: return 4000;
case TORSO_INDEX: return (GetTotalVolume() - 4000) * 13 / 30;
case RIGHT_ARM_INDEX:
case LEFT_ARM_INDEX: return (GetTotalVolume() - 4000) / 10;
case GROIN_INDEX: return (GetTotalVolume() - 4000) / 10;
case RIGHT_LEG_INDEX:
case LEFT_LEG_INDEX: return ((GetTotalVolume() - 4000) << 1) / 15;
}
ABORT("Illegal humanoid bodypart volume request!");
return 0;
}
Which implies that the head volume doesn't change, for one, and the rest of the volume is divided under the remaining body parts (note that it isn't properly divided, a portion of the number of gettotalvolume is unused for some reason?). But now I can't find that GetTotalVolume() function... So I still don't know exactly how everything works.
EDIT2:
I reverse-used the calculations, and found out that the main player has a total volume of 76. Does anyone know if the devs just gave all humans a volume of 76 (which will probably correspond to 76 kg, a bit around the average weight of a human), or is there more to it? (I'm kinda thinking right now about how a bloated player has increased hp on his torso, but reduced agility/dexterity
)