This commit is contained in:
aozhiwei 2019-07-13 17:45:04 +08:00
parent 4297a64681
commit 72314bbad6
3 changed files with 28 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);