84 lines
1.6 KiB
C++
84 lines
1.6 KiB
C++
#include "precompile.h"
|
|
|
|
#include "buff/cond_add.h"
|
|
|
|
#include "creature.h"
|
|
|
|
#include "mt/Buff.h"
|
|
|
|
/*
|
|
装备武器
|
|
子弹命中
|
|
击杀
|
|
子弹结束
|
|
*/
|
|
|
|
void CondAddBuff::Activate()
|
|
{
|
|
switch ((CondAddBuff_e)meta->_int_buff_param1) {
|
|
case CondAddBuff_e::kBulletHit:
|
|
{
|
|
ProcBulletHit();
|
|
}
|
|
break;
|
|
case CondAddBuff_e::kBulletKill:
|
|
{
|
|
ProcBulletKill();
|
|
}
|
|
break;
|
|
case CondAddBuff_e::kBulletEnd:
|
|
{
|
|
ProcBulletEnd();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
void CondAddBuff::Deactivate()
|
|
{
|
|
for (auto handler : handlers_) {
|
|
if (!handler.expired()) {
|
|
owner->GetTrigger()->RemoveEventHandler(handler);
|
|
}
|
|
}
|
|
handlers_.clear();
|
|
}
|
|
|
|
|
|
void CondAddBuff::ProcBulletHit()
|
|
{
|
|
const bool is_same_target = meta->_int_buff_param5 ? true : false;
|
|
const float interval_time = meta->_buff_param6;
|
|
const int hit_times = meta->_int_buff_param2;
|
|
|
|
auto context = A8_MAKE_ANON_STRUCT_SHARED
|
|
(
|
|
int last_hit_target_id = 0;
|
|
int hited_times = 0;
|
|
long long last_hit_frameno = 0;
|
|
);
|
|
|
|
handlers_.push_back
|
|
(
|
|
owner->GetTrigger()->AddListener
|
|
(
|
|
kBulletHitEvent,
|
|
[this, context, is_same_target, interval_time, hit_times]
|
|
(const a8::Args& args)
|
|
{
|
|
IBullet* bullet = args.Get<IBullet*>(0);
|
|
Creature* c = args.Get<Creature*>(0);
|
|
})
|
|
);
|
|
}
|
|
|
|
void CondAddBuff::ProcBulletKill()
|
|
{
|
|
|
|
}
|
|
|
|
void CondAddBuff::ProcBulletEnd()
|
|
{
|
|
|
|
}
|