This commit is contained in:
aozhiwei 2023-02-15 11:45:24 +08:00
parent 8b942f050f
commit f9b40e6c01
5 changed files with 12 additions and 14 deletions

View File

@ -335,6 +335,7 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int
if (dec_hp < 0.001f) {
return;
}
last_receive_dmg_frameno = room->GetFrameNo();
float old_health = GetHP();
float new_health = std::max(0.0f, GetHP() - dec_hp);
SetHP(std::max(0.0f, new_health));

View File

@ -69,6 +69,7 @@ class Creature : public MoveableEntity
long long hero_uniid = 0;
std::vector<Weapon> weapons;
long long last_shot_frameno_ = 0;
long long last_receive_dmg_frameno = 0;
int status = 0;
bool downed = false;
bool dead = false;

View File

@ -172,6 +172,7 @@ void Hero::DecHP(float dec_hp, int killer_id, const std::string& killer_name, in
if (dec_hp < 0.001f) {
return;
}
last_receive_dmg_frameno = room->GetFrameNo();
float old_health = GetHP();
float new_health = std::max(0.0f, GetHP() - dec_hp);
SetHP(std::max(0.0f, new_health));

View File

@ -688,6 +688,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
std::string real_killer_name;
};
last_receive_dmg_frameno = room->GetFrameNo();
float old_hp = GetHP();
if (energy_shield > 0.001f) {
energy_shield = std::max(0.0f, energy_shield - dec_hp);

View File

@ -399,27 +399,21 @@ void Skill::Proc30301XL()
{
a8::XTimerWp recover_timer = owner->room->xtimer.SetIntervalWpEx
(
GetCd() / FRAME_RATE_MS,
[this] (int event, const a8::Args* args)
SERVER_FRAME_RATE,
[this] (int event, const a8::Args* args) mutable
{
if (a8::TIMER_EXEC_EVENT == event) {
if (!owner->dead) {
if (owner->room->GetFrameNo() - owner->last_receive_dmg_frameno >
(int)(meta->_number_meta->number() / FRAME_RATE_MS)) {
if (owner->GetHP() < owner->GetMaxHP()) {
owner->AddHp(owner->GetMaxHP() * meta->_number_meta->resume());
}
}
}
}
},
&xtimer_attacher);
owner->GetTrigger()->AddListener
(
kReceiveDmgEvent,
[this, recover_timer] (const a8::Args& args) mutable
{
if (!recover_timer.expired()) {
owner->room->xtimer.ResetTimer(recover_timer);
}
}
);
}
void Skill::Proc30401MAO()