More Assertions to validate state correctness.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-03-22 15:35:58 +01:00
parent 475392f9b6
commit f190121e74
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 4 additions and 0 deletions

View File

@ -103,6 +103,8 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* target,
ExecutingAttack::TargetData* targetData) {
auto user = attack->GetUser();
AssertNotNull(user)
AssertNotNull(target)
ScriptSource* targetSource = target;
ScriptSource* userSource = attack;
@ -131,6 +133,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
return;
auto attackData = attack->GetAttack()->GetAttack();
auto library = user->GetBattle()->GetLibrary();
AssertNotNull(library)
auto dmgLibrary = library->GetDamageLibrary();
for (uint8_t hitIndex = 0; hitIndex < numHits; hitIndex++) {
if (user->IsFainted()) {
@ -141,6 +144,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
break;
}
auto hit = targetData->GetHit(hitIndex);
AssertNotNull(hit)
auto hitType = hit->GetType();
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, &hitType);