This commit is contained in:
aozhiwei 2022-09-23 18:37:41 +08:00
parent 72dd0846f5
commit 38397e98d1

View File

@ -2614,8 +2614,12 @@ float Creature::GetHP()
float Creature::GetMaxHP()
{
#if 1
return ability.max_hp;
#else
return ability.max_hp * (1 + GetAbility()->GetAttrRate(kHAT_MaxHp)) +
GetAbility()->GetAttrAbs(kHAT_MaxHp);
#endif
}
void Creature::GetHitEnemys(std::set<Creature*>& enemys, float radius)
@ -2655,11 +2659,29 @@ void Creature::AddHp(float hp)
void Creature::SetHP(float hp)
{
ability.hp = hp;
#ifdef DEBUG1
if (IsPlayer()) {
a8::XPrintf("hp:%f maxhp:%f\n",
{
GetHP(),
GetMaxHP()
});
}
#endif
}
void Creature::SetMaxHP(float max_hp)
{
ability.max_hp = max_hp;
#ifdef DEBUG1
if (IsPlayer()) {
a8::XPrintf("hp:%f maxhp:%f\n",
{
GetHP(),
GetMaxHP()
});
}
#endif
}
bool Creature::TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos)