From 98a9f73095101f77ce48dec97000e6e25d60ad23 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Thu, 23 Mar 2023 01:18:02 +0000 Subject: [PATCH] Added Punch to Player Options & Randomised Resources for Player --- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 17 ++++++++++++----- .../TurnBasedCombatV2/TurnBaseCombatV2.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 4892fad..aa27535 100644 --- a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -44,10 +44,10 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) HUD->AddToViewport(); EnemyActor = Enemy; - ProbertiumResource = 10; - EisResource = 10; - AzosResource = 10; - IroquoidResource = 10; + ProbertiumResource = FMath::RandRange(0, 10); + EisResource = FMath::RandRange(0, 10); + AzosResource = FMath::RandRange(0, 10); + IroquoidResource = FMath::RandRange(0, 10); EnemyProbertiumResource = FMath::RandRange(0, 10); EnemyEisResource = FMath::RandRange(0, 10); @@ -212,7 +212,14 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo) { case true: // Player Turn - DamageEnemy(*ValidCombos.Find(Combo), Combo); + if (Combo == "") + { + DamageEnemy(1, "Punch"); + } + else + { + DamageEnemy(*ValidCombos.Find(Combo), Combo); + } OnPlayerTurn.Broadcast(PlayerActor, EnemyActor); break; case false: diff --git a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h index a0f7462..90b512e 100644 --- a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -67,6 +67,7 @@ public: UPROPERTY(EditAnywhere) TMap ValidCombos = { + {"", 1}, {"P", 5}, {"PP", 15}, {"PPP", 20},