1
This commit is contained in:
parent
2e964c8bf0
commit
2b7f01cfe8
@ -32,6 +32,20 @@ void CondAddBuff::Activate()
|
||||
ProcBulletEnd();
|
||||
}
|
||||
break;
|
||||
case CondAddBuff_e::kDisengageBattle:
|
||||
{
|
||||
ProcDisengageBattle();
|
||||
}
|
||||
break;
|
||||
case CondAddBuff_e::kLimitTimeKillTarget:
|
||||
{
|
||||
ProcLimitTimeKillTarget();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,3 +139,13 @@ void CondAddBuff::ProcBulletEnd()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CondAddBuff::ProcDisengageBattle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CondAddBuff::ProcLimitTimeKillTarget()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ A8_DECLARE_CLASS_ENUM(CondAddBuff_e, int,
|
||||
kBulletHit = 11,
|
||||
kBulletKill = 12,
|
||||
kBulletEnd = 13,
|
||||
|
||||
kDisengageBattle = 22,
|
||||
kLimitTimeKillTarget = 23,
|
||||
kEnd
|
||||
);
|
||||
|
||||
@ -22,6 +25,8 @@ class CondAddBuff : public Buff
|
||||
void ProcBulletHit();
|
||||
void ProcBulletKill();
|
||||
void ProcBulletEnd();
|
||||
void ProcDisengageBattle();
|
||||
void ProcLimitTimeKillTarget();
|
||||
|
||||
private:
|
||||
std::vector<std::weak_ptr<EventHandlerPtr>> handlers_;
|
||||
|
@ -79,12 +79,12 @@ void Trigger::TakeonWeapon(Weapon* old_weapon, Weapon* new_weapon)
|
||||
switch (buff->meta->_int_buff_param2) {
|
||||
case kWeaponOptTakeon:
|
||||
{
|
||||
AddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
break;
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
TryAddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
TryAddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -110,7 +110,7 @@ void Trigger::Shot(const mt::Equip* weapon_meta)
|
||||
if (weapon_meta->Match((EventAddBuff_e)cond,
|
||||
buff->meta->_int_buff_param2,
|
||||
buff->meta->_int_buff_param5)) {
|
||||
AddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -153,7 +153,7 @@ void Trigger::Kill(Creature* target, int weapon_id)
|
||||
[this] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (buff->meta->_int_buff_param2 > 0 && (kill_num_ % buff->meta->_int_buff_param2) == 0) {
|
||||
AddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
});
|
||||
DispatchEvent(kKillEvent, {kill_num_, target, weapon_id});
|
||||
@ -166,7 +166,7 @@ void Trigger::UseItemAction(int slot_id)
|
||||
[this, slot_id] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (buff->meta->_buff_param2_int_set.find(slot_id) != buff->meta->_buff_param2_int_set.end()) {
|
||||
AddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -178,7 +178,7 @@ void Trigger::UseSkill(Skill* skill)
|
||||
[this, skill] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (buff->meta->_int_buff_param2 == skill->meta->skill_id()) {
|
||||
AddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
});
|
||||
DispatchEvent(kUseSkillEvent, {skill});
|
||||
@ -220,7 +220,7 @@ void Trigger::HpChg()
|
||||
break;
|
||||
}
|
||||
if (match) {
|
||||
TryAddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
TryAddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
} else {
|
||||
RemoveBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
@ -306,7 +306,7 @@ void Trigger::TriggeCondBuffAll(int cond)
|
||||
(cond,
|
||||
[this, cond] (Buff* buff, bool& stop)
|
||||
{
|
||||
AddBuffs(cond, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, cond, buff->meta->_buff_param4_int_list);
|
||||
});
|
||||
owner_->context_dir = old_context_dir;
|
||||
owner_->context_pos = old_context_pos;
|
||||
@ -324,12 +324,12 @@ void Trigger::ActiveBuff(const mt::Buff* buff_meta)
|
||||
switch (buff->meta->_int_buff_param2) {
|
||||
case kBuffOptActive:
|
||||
{
|
||||
AddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
break;
|
||||
case kBuffOptKeep:
|
||||
{
|
||||
TryAddBuffs(buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
TryAddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -367,27 +367,19 @@ void Trigger::DeactiveBuff(const mt::Buff* buff_meta)
|
||||
}
|
||||
}
|
||||
|
||||
void Trigger::TryAddBuffs(int cond, const std::vector<int>& buffids)
|
||||
void Trigger::TryAddBuffs(Buff* buff, int cond, const std::vector<int>& buffids)
|
||||
{
|
||||
for (int buffid : buffids) {
|
||||
if (!owner_->GetBuffById(buffid)) {
|
||||
#ifdef DEBUG
|
||||
owner_->MustBeAddBuff(owner_, buffid);
|
||||
#else
|
||||
owner_->TryAddBuff(owner_, buffid);
|
||||
#endif
|
||||
owner_->TryAddBuff(buff->GetCaster().Get(), buffid, buff->skill_meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Trigger::AddBuffs(int cond, const std::vector<int>& buffids)
|
||||
void Trigger::AddBuffs(Buff* buff, int cond, const std::vector<int>& buffids)
|
||||
{
|
||||
for (int buffid : buffids) {
|
||||
#ifdef DEBUG
|
||||
owner_->MustBeAddBuff(owner_, buffid);
|
||||
#else
|
||||
owner_->TryAddBuff(owner_, buffid);
|
||||
#endif
|
||||
owner_->TryAddBuff(buff->GetCaster().Get(), buffid, buff->skill_meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,8 @@ public:
|
||||
private:
|
||||
void TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> func);
|
||||
void TriggeCondBuffAll(int cond);
|
||||
void TryAddBuffs(int cond, const std::vector<int>& buffids);
|
||||
void AddBuffs(int cond, const std::vector<int>& buffids);
|
||||
void TryAddBuffs(Buff* buff, int cond, const std::vector<int>& buffids);
|
||||
void AddBuffs(Buff* buff, int cond, const std::vector<int>& buffids);
|
||||
void RemoveBuffs(int cond, const std::vector<int>& buffids);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user