More Assertions to validate state correctness.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
475392f9b6
commit
f190121e74
|
@ -103,6 +103,8 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
|
||||||
void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* target,
|
void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* target,
|
||||||
ExecutingAttack::TargetData* targetData) {
|
ExecutingAttack::TargetData* targetData) {
|
||||||
auto user = attack->GetUser();
|
auto user = attack->GetUser();
|
||||||
|
AssertNotNull(user)
|
||||||
|
AssertNotNull(target)
|
||||||
|
|
||||||
ScriptSource* targetSource = target;
|
ScriptSource* targetSource = target;
|
||||||
ScriptSource* userSource = attack;
|
ScriptSource* userSource = attack;
|
||||||
|
@ -131,6 +133,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
|
||||||
return;
|
return;
|
||||||
auto attackData = attack->GetAttack()->GetAttack();
|
auto attackData = attack->GetAttack()->GetAttack();
|
||||||
auto library = user->GetBattle()->GetLibrary();
|
auto library = user->GetBattle()->GetLibrary();
|
||||||
|
AssertNotNull(library)
|
||||||
auto dmgLibrary = library->GetDamageLibrary();
|
auto dmgLibrary = library->GetDamageLibrary();
|
||||||
for (uint8_t hitIndex = 0; hitIndex < numHits; hitIndex++) {
|
for (uint8_t hitIndex = 0; hitIndex < numHits; hitIndex++) {
|
||||||
if (user->IsFainted()) {
|
if (user->IsFainted()) {
|
||||||
|
@ -141,6 +144,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto hit = targetData->GetHit(hitIndex);
|
auto hit = targetData->GetHit(hitIndex);
|
||||||
|
AssertNotNull(hit)
|
||||||
|
|
||||||
auto hitType = hit->GetType();
|
auto hitType = hit->GetType();
|
||||||
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, &hitType);
|
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, &hitType);
|
||||||
|
|
Loading…
Reference in New Issue