Turn SecondaryEffect class into pointer type, owned by AttackData.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-10 22:17:48 +02:00
parent beb50a60b0
commit 5ac2b7b3c9
8 changed files with 28 additions and 24 deletions

View File

@@ -172,11 +172,11 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
if (!preventSecondary) {
auto effect = attackData->GetSecondaryEffect();
bool hasSecondaryEffect;
if (effect.GetChance() == -1) {
if (effect->GetChance() == -1) {
hasSecondaryEffect = true;
} else {
hasSecondaryEffect =
user->GetBattle()->GetRandom()->EffectChance(effect.GetChance(), attack, target);
user->GetBattle()->GetRandom()->EffectChance(effect->GetChance(), attack, target);
}
if (hasSecondaryEffect) {
HOOK(OnSecondaryEffect, userSource, attack, target, hitIndex);