Commit TurnHandler from earlier revert.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-01-18 13:44:02 +01:00
parent d66bcee979
commit cc46cd46a7
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 7 additions and 7 deletions

View File

@ -52,7 +52,7 @@ void TurnHandler::ExecuteChoice(BaseTurnChoice* choice) {
void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
auto attackName = choice->GetAttack()->GetAttack()->GetName();
HOOK(ChangeAttack, choice, choice, &attackName);
HOOK(ChangeAttack, choice, choice, attackName);
if (attackName != choice->GetAttack()->GetAttack()->GetName()) {
// TODO: Change attack
}
@ -63,7 +63,7 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
auto attack = new ExecutingAttack(targets, 1, choice->GetUser(), choice->GetAttack(), choice->GetAttackScript());
bool prevented = false;
HOOK(PreventAttack, attack, attack, &prevented);
HOOK(PreventAttack, attack, attack, prevented);
if (prevented) {
return;
}
@ -76,7 +76,7 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
// HOOK: check if attack fails
bool fail = false;
HOOK(FailAttack, attack, attack, &fail);
HOOK(FailAttack, attack, attack, fail);
if (fail) {
// TODO: Fail handling.
return;
@ -101,14 +101,14 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
ScriptSource* userSource = attack;
bool fail = false;
HOOK(FailIncomingAttack, targetSource, attack, target, &fail);
HOOK(FailIncomingAttack, targetSource, attack, target, fail);
if (fail) {
// TODO: Fail handling.
return;
}
bool invulnerable = fail;
HOOK(IsInvulnerable, targetSource, attack, target, &invulnerable);
HOOK(IsInvulnerable, targetSource, attack, target, invulnerable);
if (invulnerable) {
// TODO: We should probably do something when a target is invulnerable.
return;
@ -136,7 +136,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
auto hit = targetData->GetHit(hitIndex);
auto hitType = hit->GetType();
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, &hitType);
HOOK(ChangeAttackType, targetSource, attack, target, hitIndex, hitType);
hit->SetEffectiveness(library->GetTypeLibrary()->GetEffectiveness(hitType, target->GetTypes()));
hit->SetCritical(library->GetMiscLibrary()->IsCritical(attack, target, hitIndex));
hit->SetBasePower(dmgLibrary->GetBasePower(attack, target, hitIndex));
@ -169,7 +169,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
void TurnHandler::ExecuteSwitchChoice(CreatureLib::Battling::SwitchTurnChoice* choice) {
bool preventSwitch = false;
HOOK(PreventSelfSwitch, choice, choice, &preventSwitch);
HOOK(PreventSelfSwitch, choice, choice, preventSwitch);
if (preventSwitch) {
return;
}