Updated Combat to Make Combos Reversible

This commit is contained in:
Philip W 2023-05-22 18:40:17 +01:00
parent eda89672b4
commit 38d3378c5a
2 changed files with 10 additions and 8 deletions

BIN
Content/Levels/Build.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -343,7 +343,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
{
FOutputDeviceNull AR;
UStatusSystem* StatusSystem = Cast<UStatusSystem>(PlayerActor->GetComponentByClass(UStatusSystem::StaticClass()));
if (Combo == "PA")
if (Combo == "PA" || Combo == "AP")
{
UStatusEffect* TempThornsStatusEffect = NewObject<UStatusEffect>(PlayerActor, ThornsStatusEffect);
StatusSystem->AddStatusEffect(TempThornsStatusEffect, 1, false);
@ -354,7 +354,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
}
else if (Combo == "PI")
else if (Combo == "PI" || Combo == "IP")
{
UStatusEffect* TempDOTStatusEffect = NewObject<UStatusEffect>(PlayerActor, DOTStatusEffect);
StatusSystem->AddStatusEffect(TempDOTStatusEffect, 1, false);
@ -365,7 +365,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
}
else if (Combo == "AI")
else if (Combo == "AI" || Combo == "IA")
{
UStatusEffect* TempDamageDownStatusEffect = NewObject<UStatusEffect>(PlayerActor, DamageDownStatusEffect);
StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1, true);
@ -413,7 +413,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
{
case true:
// Player Turn
DamageEnemy(*ValidCombos.Find(Combo));
DamageEnemy(ValidCombos.Contains(Combo) ? *ValidCombos.Find(Combo) : *ValidCombos.Find(Combo.Reverse()));
OnPlayerTurn.Broadcast(PlayerActor, EnemyActor);
break;
case false:
@ -565,12 +565,14 @@ float ATurnBaseCombatV2::CalculateEscapePercentage() const
bool ATurnBaseCombatV2::IsValidCombo(const FString& Combo) const
{
return ValidCombos.Contains(Combo);
if (ValidCombos.Contains(Combo) || ValidCombos.Contains(Combo.Reverse())) return true;
return false;
}
bool ATurnBaseCombatV2::IsSpecialCombo(const FString& Combo) const
{
return SpecialCombos.Contains(Combo);
if (SpecialCombos.Contains(Combo) || SpecialCombos.Contains(Combo.Reverse())) return true;
return false;
}
void ATurnBaseCombatV2::SwitchTurn()