Adds hook to completely prevent stat boost change
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-02-12 15:43:15 +01:00
parent 34f1e43269
commit 179b94a677
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 8 additions and 0 deletions

View File

@ -141,6 +141,12 @@ namespace CreatureLib::Battling {
} }
bool Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) { bool Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmount) {
bool preventStatChange = false;
HOOK(PreventStatBoostChange, this, this, stat, diffAmount, &preventStatChange);
if (preventStatChange) {
return false;
}
HOOK(ModifyStatBoostChange, this, this, stat, &diffAmount); HOOK(ModifyStatBoostChange, this, this, stat, &diffAmount);
bool changed = false; bool changed = false;
auto oldValue = this->_statBoost.GetStat(stat); auto oldValue = this->_statBoost.GetStat(stat);

View File

@ -86,6 +86,8 @@ namespace CreatureLib::Battling {
virtual void OnFaintingOpponent(_par_ const ExecutingAttack* attack, _par_ Creature* target, virtual void OnFaintingOpponent(_par_ const ExecutingAttack* attack, _par_ Creature* target,
_par_ u8 hitNumber){}; _par_ u8 hitNumber){};
virtual void PreventStatBoostChange(_par_ Creature* target, _par_ Library::Statistic stat,
_par_ int8_t diffAmount, _par_ bool* prevent){};
virtual void ModifyStatBoostChange(_par_ Creature* target, _par_ Library::Statistic stat, virtual void ModifyStatBoostChange(_par_ Creature* target, _par_ Library::Statistic stat,
_par_ int8_t* diffAmount){}; _par_ int8_t* diffAmount){};
virtual void PreventSecondaryEffects(_par_ const ExecutingAttack* attack, _par_ Creature* target, virtual void PreventSecondaryEffects(_par_ const ExecutingAttack* attack, _par_ Creature* target,