Commit TurnHandler from earlier revert.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d66bcee979
commit
cc46cd46a7
|
@ -52,7 +52,7 @@ void TurnHandler::ExecuteChoice(BaseTurnChoice* choice) {
|
||||||
|
|
||||||
void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
|
void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
|
||||||
auto attackName = choice->GetAttack()->GetAttack()->GetName();
|
auto attackName = choice->GetAttack()->GetAttack()->GetName();
|
||||||
HOOK(ChangeAttack, choice, choice, &attackName);
|
HOOK(ChangeAttack, choice, choice, attackName);
|
||||||
if (attackName != choice->GetAttack()->GetAttack()->GetName()) {
|
if (attackName != choice->GetAttack()->GetAttack()->GetName()) {
|
||||||
// TODO: Change attack
|
// TODO: Change attack
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
|
||||||
|
|
||||||
auto attack = new ExecutingAttack(targets, 1, choice->GetUser(), choice->GetAttack(), choice->GetAttackScript());
|
auto attack = new ExecutingAttack(targets, 1, choice->GetUser(), choice->GetAttack(), choice->GetAttackScript());
|
||||||
bool prevented = false;
|
bool prevented = false;
|
||||||
HOOK(PreventAttack, attack, attack, &prevented);
|
HOOK(PreventAttack, attack, attack, prevented);
|
||||||
if (prevented) {
|
if (prevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void TurnHandler::ExecuteAttackChoice(AttackTurnChoice* choice) {
|
||||||
|
|
||||||
// HOOK: check if attack fails
|
// HOOK: check if attack fails
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
HOOK(FailAttack, attack, attack, &fail);
|
HOOK(FailAttack, attack, attack, fail);
|
||||||
if (fail) {
|
if (fail) {
|
||||||
// TODO: Fail handling.
|
// TODO: Fail handling.
|
||||||
return;
|
return;
|
||||||
|
@ -101,14 +101,14 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
|
||||||
ScriptSource* userSource = attack;
|
ScriptSource* userSource = attack;
|
||||||
|
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
HOOK(FailIncomingAttack, targetSource, attack, target, &fail);
|
HOOK(FailIncomingAttack, targetSource, attack, target, fail);
|
||||||
if (fail) {
|
if (fail) {
|
||||||
// TODO: Fail handling.
|
// TODO: Fail handling.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool invulnerable = fail;
|
bool invulnerable = fail;
|
||||||
HOOK(IsInvulnerable, targetSource, attack, target, &invulnerable);
|
HOOK(IsInvulnerable, targetSource, attack, target, invulnerable);
|
||||||
if (invulnerable) {
|
if (invulnerable) {
|
||||||
// TODO: We should probably do something when a target is invulnerable.
|
// TODO: We should probably do something when a target is invulnerable.
|
||||||
return;
|
return;
|
||||||
|
@ -136,7 +136,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
|
||||||
auto hit = targetData->GetHit(hitIndex);
|
auto hit = targetData->GetHit(hitIndex);
|
||||||
|
|
||||||
auto hitType = hit->GetType();
|
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->SetEffectiveness(library->GetTypeLibrary()->GetEffectiveness(hitType, target->GetTypes()));
|
||||||
hit->SetCritical(library->GetMiscLibrary()->IsCritical(attack, target, hitIndex));
|
hit->SetCritical(library->GetMiscLibrary()->IsCritical(attack, target, hitIndex));
|
||||||
hit->SetBasePower(dmgLibrary->GetBasePower(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) {
|
void TurnHandler::ExecuteSwitchChoice(CreatureLib::Battling::SwitchTurnChoice* choice) {
|
||||||
bool preventSwitch = false;
|
bool preventSwitch = false;
|
||||||
HOOK(PreventSelfSwitch, choice, choice, &preventSwitch);
|
HOOK(PreventSelfSwitch, choice, choice, preventSwitch);
|
||||||
if (preventSwitch) {
|
if (preventSwitch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue