This commit is contained in:
aozhiwei 2024-01-09 14:52:37 +08:00
parent 17bdb3084b
commit bbbffd3c3b
2 changed files with 6 additions and 6 deletions

View File

@ -172,7 +172,7 @@ AttrHandle Ability::AddAttr(int attr_id, float val)
}
if (std::fabs(owner_.Get()->GetMaxHP() - old_max_hp) > 0.000001f) {
owner_.Get()->SetMaxHP(owner_.Get()->GetMaxHP());
owner_.Get()->SetHP(owner_.Get()->GetHP() * (old_max_hp / owner_.Get()->GetMaxHP()));
owner_.Get()->SetHP(owner_.Get()->GetHP() * (owner_.Get()->GetMaxHP() / old_max_hp));
owner_.Get()->room->frame_event.AddHpChg(owner_);
}
return p;
@ -195,7 +195,7 @@ void Ability::RemoveAttr(AttrHandle handle)
p->holder = nullptr;
if (std::fabs(owner_.Get()->GetMaxHP() - old_max_hp) > 0.000001f) {
owner_.Get()->SetMaxHP(owner_.Get()->GetMaxHP());
owner_.Get()->SetHP(owner_.Get()->GetHP() * (old_max_hp / owner_.Get()->GetMaxHP()));
owner_.Get()->SetHP(owner_.Get()->GetHP() * (owner_.Get()->GetMaxHP() / old_max_hp));
owner_.Get()->room->frame_event.AddHpChg(owner_);
}
}
@ -324,7 +324,7 @@ void Ability::GMDelAttr(int attr_id, int idx)
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
list_entry);
if (i == idx) {
RemoveAttr(e->shared_from_this());
return;
@ -363,7 +363,7 @@ std::vector<std::string> Ability::GMShowAttrs()
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
list_entry);
data += "" + a8::XValue(e->value).GetString() + ",";
++i;
}
@ -394,7 +394,7 @@ std::vector<std::string> Ability::GMShowAttrs()
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
list_entry);
data += "" + a8::XValue(e->value).GetString() + ",";
++i;
}

View File

@ -1970,7 +1970,7 @@ float Creature::GetHP()
float Creature::GetMaxHP()
{
return ability.max_hp;
return GetNetData()->GetMaxHP();
}
float Creature::GetHPRate()