添加追踪弹处理
This commit is contained in:
parent
d980926932
commit
59595e75c0
@ -241,9 +241,16 @@ void Bullet::ProcMissible(const a8::XParams& param)
|
||||
Human* sender = (Human*)param.sender.GetUserData();
|
||||
MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(param.param1);
|
||||
if (sender && bullet_meta && !sender->room->IsGameOver()) {
|
||||
a8::Vec2 src_pos(a8::Low32(param.param3.GetInt64()), a8::High32(param.param3.GetInt64()));
|
||||
Human* target = sender->room->GetHumanByUniId(param.param2);
|
||||
if (target && !target->dead) {
|
||||
target->DecHP(10, sender->entity_uniid, sender->name, bullet_meta->i->id());
|
||||
if (bullet_meta->i->equip_subtype() == BulletType_Trace) {
|
||||
if (src_pos.Distance(target->pos) < bullet_meta->i->range()) {
|
||||
target->DecHP(bullet_meta->i->atk(), sender->entity_uniid, sender->name, bullet_meta->i->id());
|
||||
}
|
||||
} else {
|
||||
target->DecHP(bullet_meta->i->atk(), sender->entity_uniid, sender->name, bullet_meta->i->id());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,8 @@ void Human::Shot()
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(curr_weapon->meta->i->id())
|
||||
.SetParam2(shot_target_id),
|
||||
.SetParam2(shot_target_id)
|
||||
.SetParam3(a8::MakeInt64(pos.x, pos.y)),
|
||||
Bullet::ProcMissible,
|
||||
&xtimer_attacher.timer_list_);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user