diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index feca7d5..dd719ec 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1888,6 +1888,18 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase) }); } }; + auto missile_trace_func = + [] (const a8::XParams& param) + { + Human* sender = (Human*)param.sender.GetUserData(); + MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(param.param1); + if (sender && bullet_meta) { + Human* target = sender->room->GetHumanByUniId(param.param2); + if (target && !target->dead) { + + } + } + }; switch (phase->func_id) { case Skill_Jump: @@ -1920,6 +1932,15 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase) MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(phase->param1.GetInt()); if (bullet_meta) { DirectShot(bullet_meta); + if (bullet_meta->i->equip_subtype() == BulletType_Missile) { + room->xtimer.AddRepeatTimerAndAttach(bullet_meta->i->time() * SERVER_FRAME_RATE, + a8::XParams() + .SetSender(this) + .SetParam1(phase->param1.GetInt()) + .SetParam2(skill_target_id), + missile_trace_func, + &xtimer_attacher.timer_list_); + } } } break; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index b7af83a..1587d7d 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -139,6 +139,12 @@ Player* Room::GetPlayerByUniId(int uniid) return entity->entity_type == ET_Player && entity->entity_subtype == EST_Player ? (Player*)entity : nullptr; } +Human* Room::GetHumanByUniId(int uniid) +{ + Entity* entity = GetEntityByUniId(uniid); + return entity->entity_type == ET_Player ? (Human*)entity : nullptr; +} + Entity* Room::GetEntityByUniId(int uniid) { auto itr = uniid_hash_.find(uniid); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 25dd2c1..8d8e5a3 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -53,6 +53,7 @@ public: int AliveCount(); Player* GetPlayerByAccountId(const std::string& accountid); Player* GetPlayerByUniId(int uniid); + Human* GetHumanByUniId(int uniid); Entity* GetEntityByUniId(int uniid); void AddPlayer(Player* hum);