1
This commit is contained in:
parent
8b942f050f
commit
f9b40e6c01
@ -335,6 +335,7 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string& killer_name, int
|
|||||||
if (dec_hp < 0.001f) {
|
if (dec_hp < 0.001f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
last_receive_dmg_frameno = room->GetFrameNo();
|
||||||
float old_health = GetHP();
|
float old_health = GetHP();
|
||||||
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
||||||
SetHP(std::max(0.0f, new_health));
|
SetHP(std::max(0.0f, new_health));
|
||||||
|
@ -69,6 +69,7 @@ class Creature : public MoveableEntity
|
|||||||
long long hero_uniid = 0;
|
long long hero_uniid = 0;
|
||||||
std::vector<Weapon> weapons;
|
std::vector<Weapon> weapons;
|
||||||
long long last_shot_frameno_ = 0;
|
long long last_shot_frameno_ = 0;
|
||||||
|
long long last_receive_dmg_frameno = 0;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
bool downed = false;
|
bool downed = false;
|
||||||
bool dead = false;
|
bool dead = false;
|
||||||
|
@ -172,6 +172,7 @@ void Hero::DecHP(float dec_hp, int killer_id, const std::string& killer_name, in
|
|||||||
if (dec_hp < 0.001f) {
|
if (dec_hp < 0.001f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
last_receive_dmg_frameno = room->GetFrameNo();
|
||||||
float old_health = GetHP();
|
float old_health = GetHP();
|
||||||
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
||||||
SetHP(std::max(0.0f, new_health));
|
SetHP(std::max(0.0f, new_health));
|
||||||
|
@ -688,6 +688,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
|||||||
std::string real_killer_name;
|
std::string real_killer_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
last_receive_dmg_frameno = room->GetFrameNo();
|
||||||
float old_hp = GetHP();
|
float old_hp = GetHP();
|
||||||
if (energy_shield > 0.001f) {
|
if (energy_shield > 0.001f) {
|
||||||
energy_shield = std::max(0.0f, energy_shield - dec_hp);
|
energy_shield = std::max(0.0f, energy_shield - dec_hp);
|
||||||
|
@ -399,27 +399,21 @@ void Skill::Proc30301XL()
|
|||||||
{
|
{
|
||||||
a8::XTimerWp recover_timer = owner->room->xtimer.SetIntervalWpEx
|
a8::XTimerWp recover_timer = owner->room->xtimer.SetIntervalWpEx
|
||||||
(
|
(
|
||||||
GetCd() / FRAME_RATE_MS,
|
SERVER_FRAME_RATE,
|
||||||
[this] (int event, const a8::Args* args)
|
[this] (int event, const a8::Args* args) mutable
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
if (!owner->dead) {
|
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);
|
&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()
|
void Skill::Proc30401MAO()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user