This commit is contained in:
aozhiwei 2024-05-20 15:47:18 +08:00
parent af87dfc37e
commit 7254d889a3
4 changed files with 20 additions and 0 deletions

View File

@ -376,6 +376,7 @@ enum EventAddBuff_e
kEventBuffDmgOut = 19,
kEventEnterBattleMode = 20,
kEventLeaveBattleMode = 21,
kEventBeAttack = 22,
kEventBuffEnd
};

View File

@ -432,6 +432,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
only_self);
}
}
GetTrigger()->BeAttack(killer_id);
}
GetTrigger()->HpChg();
room->OnTeamPartChg(this);

View File

@ -706,3 +706,20 @@ void Trigger::LeaveBattleMode()
}
});
}
void Trigger::BeAttack(int attacker_id)
{
TraverseCondBuffs
(kEventBeAttack,
[this] (Buff* buff, bool& stop)
{
for (int buff_id : buff->meta->_buff_param4_int_list) {
if (buff_id > 0) {
owner_->TryAddBuff(owner_, buff_id, buff->skill_meta);
} else {
owner_->ClearBuffById(-buff_id);
}
}
});
}

View File

@ -89,6 +89,7 @@ public:
void EnterCrazeMode();
void EnterBattleMode();
void LeaveBattleMode();
void BeAttack(int attacker_id);
std::weak_ptr<EventHandler> AddListener(int event_id, a8::CommonCbProc cb);
void RemoveEventHandler(std::weak_ptr<EventHandler> handler_ptr);