View Single Post
  #13  
Old 02-20-2015, 01:47 AM
vacare
Fire Beetle
 
Join Date: Jan 2015
Posts: 20
Default

OK, it's fixed. Don't know if it was the original code, or my faulty transcription, but something about the unsigned ints and bad bounding was causing the number to flip to the high end. I modified the code to the below, and the HP generate correctly:

Code:
int32 Bot::GenerateBaseHitPoints()
{
  int new_base_hp = 0;
  uint32 lm = GetClassLevelFactor();
  uint32 Post255 = 0;
  if (GetSTA() > 255) Post255 = (GetSTA() - 255) / 2;
  new_base_hp = 5 + (GetLevel() * lm / 10) + ((GetSTA() - Post255) * GetLevel() * lm / 3000) + (GetLevel() * lm / 6000);
  return new_base_hp;
}
Reply With Quote