Add ChangeEffectiveness script hook.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-19 13:07:28 +02:00
parent 88d55998d0
commit 3dcefebee7
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 5 additions and 1 deletions

View File

@ -148,7 +148,9 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
auto hitType = hit->GetType();
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, &hitType);
hit->SetEffectiveness(library->GetTypeLibrary()->GetEffectiveness(hitType, target->GetTypes()));
auto effectiveness = library->GetTypeLibrary()->GetEffectiveness(hitType, target->GetTypes());
HOOK(ChangeEffectiveness, attack, attack, target, hitIndex, &effectiveness)
hit->SetEffectiveness(effectiveness);
hit->SetCritical(library->GetMiscLibrary()->IsCritical(attack, target, hitIndex));
hit->SetBasePower(dmgLibrary->GetBasePower(attack, target, hitIndex));
hit->SetDamage(dmgLibrary->GetDamage(attack, target, hitIndex));

View File

@ -37,6 +37,8 @@ namespace CreatureLib::Battling {
virtual void IsInvulnerable(ExecutingAttack* attack, Creature* target, bool* outResult){};
virtual void OnAttackMiss(ExecutingAttack* attack, Creature* target){};
virtual void ChangeAttackType(ExecutingAttack* attack, Creature* target, uint8_t hitNumber, uint8_t* outType){};
virtual void ChangeEffectiveness(ExecutingAttack* attack, Creature* target, uint8_t hitNumber,
float* effectiveness){};
virtual void OverrideBasePower(ExecutingAttack* attack, Creature* target, uint8_t hitIndex,
uint8_t* basePower){};