This commit is contained in:
aozhiwei 2023-03-17 16:08:50 +08:00
parent efd3a5753b
commit ef830ecbab
3 changed files with 26 additions and 1 deletions

View File

@ -100,7 +100,25 @@ void CondAddBuff::ProcBulletHit()
void CondAddBuff::ProcBulletKill()
{
auto context = A8_MAKE_ANON_STRUCT_SHARED
(
);
handlers_.push_back
(
owner->GetTrigger()->AddListener
(
kBulletKill,
[this, context]
(const a8::Args& args)
{
IBullet* bullet = args.Get<IBullet*>(0);
Creature* c = args.Get<Creature*>(0);
if (!owner->dead) {
owner->TryAddBuff(owner, meta->_int_buff_param4, skill_meta);
}
})
);
}
void CondAddBuff::ProcBulletEnd()

View File

@ -507,3 +507,8 @@ void Trigger::EndJump(Creature* sender)
{
DispatchEvent(kEndJump, {});
}
void Trigger::BulletKill(IBullet* bullet, Creature* target)
{
DispatchEvent(kBulletKill, {bullet, target});
}

View File

@ -41,7 +41,8 @@ enum EventId_e
kAttacked,
kStartJump,
kEndJump,
kTakeonWeaponEvent
kTakeonWeaponEvent,
kBulletKill
};
class Weapon;
@ -67,6 +68,7 @@ public:
void ReceiveDmg();
void PreDie(int killer_id, int weapon_id);
void Die(int killer_id, int weapon_id);
void BulletKill(IBullet* bullet, Creature* target);
void ActiveBuff(const mt::Buff* buff_meta);
void DeactiveBuff(const mt::Buff* buff_meta);
void BulletHit(IBullet* bullet, Creature* target);