diff --git a/server/gameserver/buff.cc b/server/gameserver/buff.cc index 2b89e6f..0659eca 100644 --- a/server/gameserver/buff.cc +++ b/server/gameserver/buff.cc @@ -6,6 +6,7 @@ #include "room.h" #include "collider.h" #include "skill.h" +#include "incubator.h" int Buff::GetLeftTime() { @@ -145,6 +146,24 @@ void Buff::ProcSummonHero(Creature* caster) } } +void Buff::ProcBeRecycle(Creature* caster) +{ + owner->room->xtimer.AddRepeatTimerAndAttach + ( + SERVER_FRAME_RATE * 2, + a8::XParams() + .SetSender(this), + [] (const a8::XParams& param) + { + Buff* buff = (Buff*)param.sender.GetUserData(); + if (buff->owner->IsHuman()) { + buff->owner->room->GetIncubator()->RecycleAndroid((Human*)buff->owner); + } + }, + &xtimer_attacher.timer_list_ + ); +} + bool Buff::NeedSync(Human* hum) { return !meta->i->only_server() || !(meta->i->only_self() && owner == hum); diff --git a/server/gameserver/buff.h b/server/gameserver/buff.h index bcf9c29..bc3c860 100644 --- a/server/gameserver/buff.h +++ b/server/gameserver/buff.h @@ -36,6 +36,7 @@ class Buff void ProcIntervalAddBuff(Creature* caster); void ProcBatchAddBuff(Creature* caster); void ProcSummonHero(Creature* caster); + void ProcBeRecycle(Creature* caster); private: void InternalTimerAddBuff(Creature* caster); diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 4072f5b..055822c 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -874,6 +874,11 @@ void Creature::ProcBuffEffect(Creature* caster, Buff* buff) buff->ProcBatchAddBuff(caster); } break; + case kBET_BeRecycle: + { + buff->ProcBeRecycle(caster); + } + break; default: { } diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 97d5d87..22b83b8 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1056,9 +1056,6 @@ void Human::DoJump() MustBeAddBuff(this, JUMP_BUFFID); jump_frameno_ = room->GetFrameNo(); SyncAroundPlayers(__FILE__, __LINE__, __func__); - if (IsAndroid() && team_uuid.empty()) { - MustBeAddBuff(this, kBeRecycleBuffId); - } } } @@ -3226,6 +3223,9 @@ void Human::OnLand() } SetPos(old_pos); } + if (IsAndroid() && team_uuid.empty()) { + MustBeAddBuff(this, kBeRecycleBuffId); + } } void Human::NextReload(int prev_weapon_id, int prev_weapon_idx) diff --git a/server/gameserver/incubator.cc b/server/gameserver/incubator.cc index c30c6cb..6e8ad4d 100644 --- a/server/gameserver/incubator.cc +++ b/server/gameserver/incubator.cc @@ -12,6 +12,11 @@ void Incubator::UnInit() } +void Incubator::RecycleAndroid(Human* hum) +{ + +} + void Incubator::AddHoldHuman(Human* hum) { hold_humans_.insert(hum); diff --git a/server/gameserver/incubator.h b/server/gameserver/incubator.h index f262c6f..3712c2d 100644 --- a/server/gameserver/incubator.h +++ b/server/gameserver/incubator.h @@ -9,6 +9,9 @@ class Incubator void Init(); void UnInit(); + void RecycleAndroid(Human* hum); + +private: void AddHoldHuman(Human* hum); private: diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 0e3977e..26e99b0 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -170,6 +170,7 @@ public: int GetOnlinePlayerNum(); RoomObstacle* CreateObstacle(int id, float x, float y); int AllocUniid(); + Incubator* GetIncubator() { return incubator_;}; private: void ShuaAndroid();