diff --git a/server/gameserver/android.ai.cc b/server/gameserver/android.ai.cc index 6c86def..40b34b9 100644 --- a/server/gameserver/android.ai.cc +++ b/server/gameserver/android.ai.cc @@ -20,16 +20,10 @@ AndroidAI::~AndroidAI() void AndroidAI::Update(int delta_time) { Human* hum = (Human*)owner; - if (hum->poisoning) { - hum->poisoning_time += delta_time; - } state_elapsed_time += delta_time; if (hum->dead) { return; } - if (hum->poisoning) { - hum->UpdatePoisoning(); - } if (hum->playing_skill) { hum->UpdateSkill(); } diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 0ac9f00..b0f8d79 100755 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -105,7 +105,6 @@ enum SkillCond_e enum VirtualWeapon_e { - VW_SafeArea = 9000000, VW_Spectate = 9000001, VW_SelfDetonate = 9000002, VW_Mine = 9000003, @@ -113,7 +112,6 @@ enum VirtualWeapon_e enum VirtualPlayer_e { - VP_SafeArea = 9000000, VP_Spectate = 9000001, VP_SelfDetonate = 9000002, VP_Mine = 9000003, diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index c0a249a..faff3db 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -400,29 +400,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->gas_data.is_last_gas) { - DecHP(room->gas_data.new_area_meta->i->hurt(), VP_SafeArea, "安全区", VW_SafeArea); - } else { - DecHP(room->gas_data.old_area_meta->i->hurt(), VP_SafeArea, "安全区", VW_SafeArea); - } - if (dead) { - poisoning_time = 0; - break; - } - poisoning_time -= 1000; - } - if (need_notify && entity_subtype == EST_Player) { - SyncAroundPlayers(); - } -} - void Human::UpdateSkill() { if (skill_meta) { @@ -1419,32 +1396,7 @@ void Human::ProcBuffEffect(Buff* buff) void Human::OnAttack() { - if (a8::HasBitFlag(status, HS_InGrass)) { - if (HasBuffEffect(BET_InGrass)) { - RemoveBuffByEffectId(BET_InGrass); - } - if (grass_hide_timer_list_) { - room->xtimer.ModifyTimer(grass_hide_timer_list_, - MetaMgr::Instance()->grass_invisible_time2 * SERVER_FRAME_RATE); - } else { - auto hide_func = - [] (const a8::XParams& param) - { - Human* hum = (Human*)param.sender.GetUserData(); - hum->grass_hide_timer_list_ = nullptr; - MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(GRASS_HIDE_BUFF_ID); - if (buff_meta) { - hum->AddBuff(buff_meta); - } - }; - grass_hide_timer_list_ = - room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->grass_invisible_time2 * SERVER_FRAME_RATE, - a8::XParams() - .SetSender(this), - hide_func, - &xtimer_attacher.timer_list_); - } - } + GrassTempShow(); } void Human::OnEnterGrass() @@ -1535,6 +1487,36 @@ void Human::CheckGrass() } } +void Human::GrassTempShow() +{ + if (a8::HasBitFlag(status, HS_InGrass)) { + if (HasBuffEffect(BET_InGrass)) { + RemoveBuffByEffectId(BET_InGrass); + } + if (grass_hide_timer_list_) { + room->xtimer.ModifyTimer(grass_hide_timer_list_, + MetaMgr::Instance()->grass_invisible_time2 * SERVER_FRAME_RATE); + } else { + auto hide_func = + [] (const a8::XParams& param) + { + Human* hum = (Human*)param.sender.GetUserData(); + hum->grass_hide_timer_list_ = nullptr; + MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(GRASS_HIDE_BUFF_ID); + if (buff_meta) { + hum->AddBuff(buff_meta); + } + }; + grass_hide_timer_list_ = + room->xtimer.AddDeadLineTimerAndAttach(MetaMgr::Instance()->grass_invisible_time2 * SERVER_FRAME_RATE, + a8::XParams() + .SetSender(this), + hide_func, + &xtimer_attacher.timer_list_); + } + } +} + float* Human::GetAbilityById(int attr_id) { switch (attr_id) { diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 6a5c356..f9d5e64 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -74,8 +74,6 @@ class Human : public Entity int max_energy_shield = 0; int vip = 0; int sdmg = 0; - bool poisoning = false; - long long poisoning_time = 0; int lethal_weapon = 0; long long dead_frameno = 0; long long join_frameno = 0; @@ -138,7 +136,6 @@ class Human : public Entity float GetRadius(); float GetHP(); float GetMaxHP(); - void UpdatePoisoning(); void UpdateSkill(); void SyncAroundPlayers(); void AutoLoadingBullet(bool manual = false); @@ -209,6 +206,7 @@ class Human : public Entity void OnEnterGrass(); void OnLeaveGrass(); void CheckGrass(); + void GrassTempShow(); float* GetAbilityById(int attr_id); void RecalcBaseAttr(); diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index 9bdb7c5..ab8771f 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -52,9 +52,6 @@ void Player::Initialize() void Player::Update(int delta_time) { - if (poisoning) { - poisoning_time += delta_time; - } if (a8::HasBitFlag(status, HS_Assaulting)) { _UpdateAssaultMove(); } else { @@ -72,9 +69,6 @@ void Player::Update(int delta_time) if (interaction_objids.size() > 0) { ProcInteraction(); } - if (poisoning) { - UpdatePoisoning(); - } if (playing_skill) { UpdateSkill(); }