fix hp
This commit is contained in:
parent
72dd0846f5
commit
38397e98d1
@ -2614,8 +2614,12 @@ float Creature::GetHP()
|
|||||||
|
|
||||||
float Creature::GetMaxHP()
|
float Creature::GetMaxHP()
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
return ability.max_hp;
|
||||||
|
#else
|
||||||
return ability.max_hp * (1 + GetAbility()->GetAttrRate(kHAT_MaxHp)) +
|
return ability.max_hp * (1 + GetAbility()->GetAttrRate(kHAT_MaxHp)) +
|
||||||
GetAbility()->GetAttrAbs(kHAT_MaxHp);
|
GetAbility()->GetAttrAbs(kHAT_MaxHp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::GetHitEnemys(std::set<Creature*>& enemys, float radius)
|
void Creature::GetHitEnemys(std::set<Creature*>& enemys, float radius)
|
||||||
@ -2655,11 +2659,29 @@ void Creature::AddHp(float hp)
|
|||||||
void Creature::SetHP(float hp)
|
void Creature::SetHP(float hp)
|
||||||
{
|
{
|
||||||
ability.hp = hp;
|
ability.hp = hp;
|
||||||
|
#ifdef DEBUG1
|
||||||
|
if (IsPlayer()) {
|
||||||
|
a8::XPrintf("hp:%f maxhp:%f\n",
|
||||||
|
{
|
||||||
|
GetHP(),
|
||||||
|
GetMaxHP()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::SetMaxHP(float max_hp)
|
void Creature::SetMaxHP(float max_hp)
|
||||||
{
|
{
|
||||||
ability.max_hp = 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)
|
bool Creature::TryMove(const a8::Vec2& target_pos, a8::Vec2& out_pos)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user