2021-06-28 09:40:06 +00:00

79 lines
1.3 KiB
C++

#include "precompile.h"
#include <a8/list.h>
#include "trigger.h"
#include "creature.h"
void Trigger::Init()
{
}
void Trigger::UnInit()
{
}
void Trigger::TakeonWeapon(Weapon* old_weapon, Weapon* new_weapon)
{
}
void Trigger::Shot(MetaData::Equip* weapon_meta)
{
}
void Trigger::Kill(Creature* target)
{
}
void Trigger::UseItemAction(int slot_id)
{
}
void Trigger::UseSkill(Skill* skill)
{
}
void Trigger::HpChg(float old_hp, float new_hp)
{
}
void Trigger::Die()
{
}
void Trigger::TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> func)
{
if (!IsValidCondBuff(cond)) {
abort();
}
list_head* pos = nullptr;
list_head* next = nullptr;
list_head* head = &owner_->cond_buffs_[cond];
RemoveBuffCbConext cb;
cb.next = &next;
INIT_LIST_HEAD(&cb.entry);
list_for_each_safe(pos, next, head) {
if (list_empty(next)) {
Buff *next_buff = list_entry(next, Buff, cond_entry);
list_add_tail(&cb.entry, &next_buff->on_remove_contexts);
}
Buff *curr_buff = list_entry(pos, Buff, cond_entry);
bool stop = false;
func(curr_buff, stop);
if (!list_empty(&cb.entry)) {
list_del_init(&cb.entry);
}
if (stop) {
return;
}
}
}