Hi, I have a problem with the MAX_HP_PCT life percentage bonus, my functions look like this:
case POINT_MAX_HP:
{
SetPoint(type, GetPoint(type) + amount);
int hp = GetRealPoint(POINT_MAX_HP);
int add_hp = hp * GetPoint(POINT_MAX_HP_PCT) / 100;
add_hp += GetPoint(POINT_MAX_HP);
add_hp += GetPoint(POINT_PARTY_TANKER_BONUS);
sys_log(0, "DEBUG: Base HP: %d, MAX_HP_PCT: %d%%, Additional HP: %d", hp, GetPoint(POINT_MAX_HP_PCT), add_hp);
SetMaxHP(hp + add_hp);
sys_log(0, "DEBUG: Final MaxHP: %d", GetMaxHP());
val = GetMaxHP();
}
break;
case POINT_MAX_HP_PCT:
SetPoint(type, GetPoint(type) + amount);
val = GetPoint(type);
sys_log(0, "DEBUG: Updated MAX_HP_PCT: %d", GetPoint(POINT_MAX_HP_PCT));
PointChange(POINT_MAX_HP, 0);
break;
case APPLY_MAX_HP_PCT:
{
int i = GetMaxHP(); if(i == 0) break;
PointChange(aApplyInfo[bApplyType].bPointType, iVal);
float fRatio = (float)GetMaxHP() / (float)i;
PointChange(POINT_HP, GetHP() * fRatio - GetHP());
}
break;
From the logs it appears that the wrong HP of the character is being retrieved via: int hp = GetRealPoint(POINT_MAX_HP);
The starting HP of the character is 60112, after equipping an item with MAX_HP_PCT +5% it is 60867 which is incorrect.
Jan 26 13:39:53 :: DEBUG: GetMaxHP called. Current MaxHP: 60112
Jan 26 13:39:53 :: DEBUG: Updated MAX_HP_PCT: 5
Jan 26 13:39:53 :: DEBUG: Base HP: 15112, MAX_HP_PCT: 5%, Additional HP: 0
Jan 26 13:39:53 :: DEBUG: SetMaxHP called. New MaxHP: 60867
Jan 26 13:39:53 :: DEBUG: GetMaxHP called. Current MaxHP: 60867
Jan 26 13:39:53 :: DEBUG: Final MaxHP: 60867
Jan 26 13:39:53 :: DEBUG: GetMaxHP called. Current MaxHP: 60867
You can see that as base hp did not take 60112 but 15112. Why? How to fix it?
Thanks in advance.
My char.cpp: [Hidden Content]
My char.h: [Hidden Content]