This commit is contained in:
aozhiwei 2021-03-30 17:22:51 +08:00
parent b4ec86c3b2
commit 49c8e679ee
5 changed files with 30 additions and 30 deletions

View File

@ -934,3 +934,26 @@ void Creature::TouchProperTargets(std::function<void (Creature*, bool&)> func)
GetGridList(),
callback);
}
void Creature::UpdatePoisoning()
{
if (dead) {
return;
}
bool need_notify = poisoning_time > 1000;
while (poisoning_time > 1000) {
if (room->GetGasData().is_last_gas) {
DecHP(room->GetGasData().new_area_meta->i->hurt(), VP_SafeArea, TEXT("battle_server_killer_gas", "毒圈"), VW_SafeArea);
} else {
DecHP(room->GetGasData().old_area_meta->i->hurt(), VP_SafeArea, TEXT("battle_server_killer_gas", "毒圈"), VW_SafeArea);
}
if (dead) {
poisoning_time = 0;
break;
}
poisoning_time -= 1000;
}
if (need_notify && IsEntitySubType(EST_Player)) {
SyncAroundPlayers(__FILE__, __LINE__, __func__);
}
}

View File

@ -62,6 +62,7 @@ class Creature : public MoveableEntity
void ClearSkill();
void AddPassiveSkill(int skill_id);
void ClearPassiveSkill();
void UpdatePoisoning();
bool IsProperTarget(Creature* target);
bool IsEnemy(Creature* target);

View File

@ -38,14 +38,14 @@ HeroAI::~HeroAI()
void HeroAI::Update(int delta_time)
{
Hero* hero = (Hero*)owner;
#if 0
if (hum->poisoning) {
hum->poisoning_time += delta_time;
if (hero->poisoning) {
hero->poisoning_time += delta_time;
}
if (hum->poisoning) {
hum->UpdatePoisoning();
if (hero->poisoning) {
#if 0
hero->UpdatePoisoning();
#endif
}
#endif
if (hero->dead) {
return;
}

View File

@ -741,29 +741,6 @@ float Human::GetMaxHP()
return ability.max_hp;
}
void Human::UpdatePoisoning()
{
if (dead) {
return;
}
bool need_notify = poisoning_time > 1000;
while (poisoning_time > 1000) {
if (room->GetGasData().is_last_gas) {
DecHP(room->GetGasData().new_area_meta->i->hurt(), VP_SafeArea, TEXT("battle_server_killer_gas", "毒圈"), VW_SafeArea);
} else {
DecHP(room->GetGasData().old_area_meta->i->hurt(), VP_SafeArea, TEXT("battle_server_killer_gas", "毒圈"), VW_SafeArea);
}
if (dead) {
poisoning_time = 0;
break;
}
poisoning_time -= 1000;
}
if (need_notify && IsEntitySubType(EST_Player)) {
SyncAroundPlayers(__FILE__, __LINE__, __func__);
}
}
void Human::AutoLoadingBullet(bool manual)
{
Weapon* p_weapon = curr_weapon;

View File

@ -156,7 +156,6 @@ class Human : public Creature
float GetRadius();
float GetHP();
float GetMaxHP();
void UpdatePoisoning();
void AutoLoadingBullet(bool manual = false);
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
virtual void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id) override;