This commit is contained in:
aozhiwei 2019-07-16 13:30:25 +08:00
parent 1e4322e36e
commit 0b0c5801ab
4 changed files with 22 additions and 13 deletions

View File

@ -57,7 +57,8 @@ void FrameEvent::AddShot(Human* hum)
}
}
void FrameEvent::AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance, int hit_time)
void FrameEvent::AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance,
int hit_time, int target_id)
{
{
auto& tuple = a8::FastAppend(bullets_);
@ -77,6 +78,9 @@ void FrameEvent::AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fl
if (hit_time != 0) {
p.set_hit_time(hit_time);
}
if (target_id != 0) {
p.set_target_id(target_id);
}
}
{
int bullet_idx = bullets_.size() - 1;

View File

@ -15,7 +15,7 @@ public:
void AddAirDrop(int appear_time, int box_id, a8::Vec2 box_pos);
void AddEmote(Human* hum, int emote_id);
void AddShot(Human* hum);
void AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance, int hit_time);
void AddBullet(Human* hum, a8::Vec2 born_pos, a8::Vec2 dir, float fly_distance, int hit_time, int target_id = 0);
void AddExplosion(int item_id, a8::Vec2 bomb_pos, int effect);
void AddSmoke(Bullet* bullet, int item_id, a8::Vec2 pos);
void AddDead(Human* hum);

View File

@ -245,7 +245,11 @@ void Human::DirectShot(MetaData::Equip* bullet_meta)
if (bullet_meta->i->equip_subtype() == BulletType_Missile) {
hit_time = bullet_meta->i->time() * 1000;
}
room->frame_event.AddBullet(this, bullet_born_pos, attack_dir, fly_distance, hit_time);
if (bullet_meta->i->equip_subtype() == BulletType_Missile) {
room->frame_event.AddBullet(this, bullet_born_pos, attack_dir, fly_distance, hit_time, skill_target_id);
} else {
room->frame_event.AddBullet(this, bullet_born_pos, attack_dir, fly_distance, hit_time);
}
if (room->BattleStarted()) {
if (bullet_meta->i->equip_subtype() != BulletType_Missile) {
room->CreateBullet(this, bullet_meta, bullet_born_pos, bullet_dir, fly_distance);
@ -714,6 +718,7 @@ void Human::DoSkill()
OnAttack();
}
use_skill = false;
need_sync_active_player = true;
}
void Human::FindLocation()
@ -1944,7 +1949,7 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
if (sender && bullet_meta) {
Human* target = sender->room->GetHumanByUniId(param.param2);
if (target && !target->dead) {
target->DecHP(10, sender->entity_uniid, sender->name, bullet_meta->i->id());
}
}
};
@ -1993,13 +1998,13 @@ void Human::ProcSkillPhase(MetaData::SkillPhase* phase)
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_);
room->xtimer.AddDeadLineTimerAndAttach(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_);
}
}
}

View File

@ -357,11 +357,11 @@ namespace MetaData
if (!buff_meta) {
abort();
}
auto itr = trigger_type_buffs.find(buff_meta->i->buff_id());
auto itr = trigger_type_buffs.find(buff_meta->i->trigger_type());
if (itr != trigger_type_buffs.end()) {
itr->second.insert(buff_meta);
} else {
trigger_type_buffs[buff_meta->i->buff_id()] = std::set<MetaData::Buff*>({buff_meta});
trigger_type_buffs[buff_meta->i->trigger_type()] = std::set<MetaData::Buff*>({buff_meta});
}
}
}