From fdfe4a660c469941dfb8a5ddc89f04480a478b9a Mon Sep 17 00:00:00 2001
From: PHILIP White <PW259246@falmouth.ac.uk>
Date: Tue, 29 Nov 2022 00:33:34 +0000
Subject: [PATCH] Bugfix Movement Not being Reenabled on Combat End

---
 .../Blueprints/Combat_UI/CombatCharacter.uasset  |  4 ++--
 .../TurnBasedCombatV2/HoldToInitCombat.cpp       |  2 +-
 .../TurnBasedCombatV2/TurnBaseCombatV2.cpp       | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset
index 1bf0a8a..963ca34 100644
--- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset
+++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:8f66eb3eb1eaa1a58024f1991b62f89e67c76f1e90c731f37ad2c466920d53e0
-size 76230
+oid sha256:4bc0059d6237bd190e43bcbb12d3d0aea491b648bcff7fe4d7084b5e4f139bb8
+size 62850
diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp
index dda2b0b..c934c6d 100644
--- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp
+++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp
@@ -73,7 +73,7 @@ void UHoldToInitCombat::OnRightClickUp()
 AActor* UHoldToInitCombat::LookingAtEnemy() const
 {
 	FVector Start = GetOwner()->GetActorLocation();
-	FVector End = GetOwner()->GetActorForwardVector() * 3000.0f + Start;
+	FVector End = GetOwner()->GetActorForwardVector() * 1500.0f + Start;
 	FCollisionQueryParams CollisionParams;
 	CollisionParams.AddIgnoredActor(GetOwner());
 	if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams))
diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp
index 6a565ef..aa2a25c 100644
--- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp
+++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp
@@ -6,6 +6,7 @@
 #include "Blueprint/UserWidget.h"
 #include "Components/TextBlock.h"
 #include "Components/ProgressBar.h"
+#include "GameFramework/Character.h"
 #include "Kismet/GameplayStatics.h"
 
 // Sets default values
@@ -32,6 +33,16 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
 		PC->bEnableClickEvents = true;
 		PC->bEnableMouseOverEvents = true;
 	}
+	//Disable Character Movement
+	if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
+	{
+		PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
+	}
+	CurrentComboString = "";
+	UpdateComboString(CurrentComboString);
+	RevertActionPoints();
+	UpdateActionPoints();
+	UpdateResourceBars();
 }
 
 void ATurnBaseCombatV2::EndCombat()
@@ -41,6 +52,11 @@ void ATurnBaseCombatV2::EndCombat()
 	APawn* PlayerPawn = Cast<APawn>(GetWorld()->GetFirstPlayerController()->GetPawn());
 	PlayerPawn->bUseControllerRotationYaw = true;
 	PlayerPawn->bUseControllerRotationPitch = true;
+	//Enable Character Movement
+	if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
+	{
+		PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
+	}
 }
 
 void ATurnBaseCombatV2::FKeyPressed()