diff --git a/server/gameserver/bullet.cc b/server/gameserver/bullet.cc index 689733a..50f381a 100644 --- a/server/gameserver/bullet.cc +++ b/server/gameserver/bullet.cc @@ -23,6 +23,7 @@ void Bullet::Initialize() { Entity::Initialize(); RecalcSelfCollider(); + skill_meta = MetaMgr::Instance()->GetSkill(skill_id); } void Bullet::Update(int delta_time) @@ -66,6 +67,7 @@ void Bullet::OnHit(std::set& objects) master->stats.damage_amount_out += finaly_dmg; hum->OnHit(); if (!hum->HasBuffEffect(BET_Invincible)) { + hum->OnSkillHit(skill_meta); hum->DecHP(finaly_dmg, master->entity_uniid, master->name, meta->i->id()); } } @@ -279,3 +281,4 @@ void Bullet::ProcMissible(const a8::XParams& param) } } } + diff --git a/server/gameserver/bullet.h b/server/gameserver/bullet.h index 173d29d..608791d 100644 --- a/server/gameserver/bullet.h +++ b/server/gameserver/bullet.h @@ -6,6 +6,7 @@ namespace MetaData { struct Player; struct Equip; + struct Skill; } class Human; @@ -21,6 +22,8 @@ class Bullet : public Entity a8::Vec2 born_pos; a8::Vec2 born_dir; float fly_distance = 0.0f; + int skill_id = 0; + MetaData::Skill* skill_meta = nullptr; Bullet(); virtual ~Bullet() override; diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 2e09b2e..c8bfc0e 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1402,6 +1402,13 @@ void Human::OnHit() GrassTempShow(); } +void Human::OnSkillHit(MetaData::Skill* skill_meta) +{ + std::set target_list; + target_list.insert(this); + TriggerBuff(target_list, BTT_SkillHit); +} + void Human::OnEnterGrass() { if (a8::HasBitFlag(status, HS_InGrass)) { @@ -2024,7 +2031,7 @@ void Human::InternalShot(MetaData::Equip* bullet_meta, int skill_id, size_t offs } if (room->BattleStarted()) { if (bullet_meta->i->equip_subtype() != BulletType_Missile) { - room->CreateBullet(this, bullet_meta, bullet_born_pos, bullet_dir, fly_distance); + room->CreateBullet(this, bullet_meta, bullet_born_pos, bullet_dir, fly_distance, skill_id); } } } diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 0a4a816..df6328f 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -200,6 +200,7 @@ class Human : public Entity void ProcBuffEffect(Buff* buff); void OnAttack(); void OnHit(); + void OnSkillHit(MetaData::Skill* skill_meta); void OnEnterGrass(); void OnLeaveGrass(); void CheckGrass(); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 48d5bb7..a9d963f 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -553,7 +553,7 @@ void Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv) } void Room::CreateBullet(Human* hum, MetaData::Equip* bullet_meta, - a8::Vec2 pos, a8::Vec2 dir, float fly_distance) + a8::Vec2 pos, a8::Vec2 dir, float fly_distance, int skill_id) { Bullet* bullet = new Bullet(); bullet->master = hum; @@ -564,6 +564,7 @@ void Room::CreateBullet(Human* hum, MetaData::Equip* bullet_meta, bullet->born_pos = pos; bullet->born_dir = dir; bullet->fly_distance = fly_distance; + bullet->skill_id = skill_id; bullet->entity_uniid = AllocUniid(); bullet->Initialize(); AddObjectLater(bullet); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index e7e143a..e94614f 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -79,7 +79,7 @@ public: Hero* CreateHero(Human* hum); void CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv); void CreateBullet(Human* hum, MetaData::Equip* bullet_meta, - a8::Vec2 pos, a8::Vec2 dir, float fly_distance); + a8::Vec2 pos, a8::Vec2 dir, float fly_distance, int skill_id); void OnHumanDie(Human* hum); void OnHumanRevive(Human* hum);