Compare commits

...

27 Commits
v1.1 ... main

Author SHA1 Message Date
cf881a36cd Updated Coin & Item Notification for Better UX 2023-05-22 19:29:39 +01:00
38d3378c5a Updated Combat to Make Combos Reversible 2023-05-22 18:40:17 +01:00
eda89672b4 Bugfix Insta Kill if Two or More Goats Attacking at Once 2023-05-22 18:22:53 +01:00
9c747a96c2 Bugfix Soft Lock when Combat is Initialised on Dialogue or Merchant 2023-05-22 17:37:53 +01:00
ccb50a804e Bugfix Player Getting Damaged Once Boss was Dead 2023-05-22 17:12:08 +01:00
4bba8fc1eb Bugfix Status Effects not Correctly Being Reset on Dupe 2023-05-22 16:44:06 +01:00
36834676e8 Bugfix Unable Force Destroy UObjects 2023-05-22 16:14:22 +01:00
0c3831ad03 Bugfix Camera Being Reset in Wrong Positions and FOV 2023-05-22 01:03:13 +01:00
e947b67b36 Bugfix Able to Climb Large Structures by Teleporting 2023-05-21 22:10:23 +01:00
3a68c22449 Bugfix If Buff Active and Boss Dead Crashes Game 2023-05-21 22:07:19 +01:00
81a306f7b0 Bugfix Able to Open Dialogue in Merchant 2023-05-21 21:30:27 +01:00
276a0c5ff4 Renamed Boss to Crystal Mutant 2023-05-21 21:01:30 +01:00
6a5073f0e4 Updated Sprint SFX to Properly Loop 2023-05-21 20:47:11 +01:00
7e09a56e25 Bugfix Entrance to First Tunnel Causes Player to Clip
High Edge Lowered and Placed Blocking Volume
2023-05-21 20:26:19 +01:00
2157a3f264 Bugfix Main Menu Setting Drop Downs Not Working 2023-05-21 20:03:16 +01:00
b461f2e9c1 Bugfix Sometimes Getting Stuck on Starter Planks 2023-05-21 19:31:49 +01:00
a90b7da12f Updated Build for Additional Set Dressing 2023-05-21 19:20:51 +01:00
8b87098cf8 Updated Book & Gun to be Pickupable by Interact Key 2023-05-21 19:06:16 +01:00
d17ba9e064 Updated Cursor for Change when Hovering on Interactable Object 2023-05-21 18:55:22 +01:00
ba4e8bf07c Bugfix Janky Walking Up Stairs 2023-05-21 17:55:25 +01:00
e0e2286852 Bugfix Crash on Level Change if Player Still has Status Effects 2023-05-21 17:40:54 +01:00
b4b248b5e7 Bugfix Able to Shoot in Menus 2023-05-21 17:24:58 +01:00
8a8288fbff Bugfix Invisible Walls Breaking Line Trace 2023-05-21 16:34:33 +01:00
5104a21b2f Bugfix Initiating Combat with the Inventory Open Blocks Input 2023-05-21 15:20:11 +01:00
14f4ff4d35 Bugfix Focus Issues in Inventory & Able to Open Inventory in Shop
Able to consistently open & close the inventory without losing focus on root widget
2023-05-21 15:19:18 +01:00
89282de97c Organised Level Folder Structure 2023-05-21 12:57:55 +01:00
5573037266 Updated readme.md for Itch.io Page 2023-05-20 02:20:15 +01:00
52 changed files with 281 additions and 173 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/BlueprintAI/AI/AIBruh.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/BlueprintAI/AI/AIBruh_Boss.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Blueprints/Display_UI/InteracableIcon.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

BIN
Content/Music/Blue/SFX/Coins.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Music/Blue/SFX/Crystal_Buzz.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Music/Blue/SFX/Sprint.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Misc/Music Demo/Sound Effects/Sprint.wav (Stored with Git LFS)

Binary file not shown.

View File

@ -24,11 +24,13 @@ void UEatableItems::Use(ATempCharacter* Character)
{ {
Character->Health = FMath::Clamp(Character->Health + 20, 0, 100); Character->Health = FMath::Clamp(Character->Health + 20, 0, 100);
Character->Inventory->RemoveItem(this); Character->Inventory->RemoveItem(this);
return;
} }
else if (Character->Health >= 100) else if (Character->Health >= 100)
{ {
UE_LOG(LogTemp, Display, TEXT("Health is full")); UE_LOG(LogTemp, Display, TEXT("Health is full"));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Health is full")); GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Health is full"));
return;
} }
} }
@ -38,6 +40,7 @@ void UEatableItems::Use(ATempCharacter* Character)
StatusSystem->AddStatusEffect(NewObject<UStatusEffect>(Character, StrengthBuffStatusEffect)); StatusSystem->AddStatusEffect(NewObject<UStatusEffect>(Character, StrengthBuffStatusEffect));
UE_LOG(LogTemp, Display, TEXT("Damage Buffed")); UE_LOG(LogTemp, Display, TEXT("Damage Buffed"));
Character->Inventory->RemoveItem(this); Character->Inventory->RemoveItem(this);
return;
} }
if (isProbertiumType) if (isProbertiumType)
@ -49,6 +52,7 @@ void UEatableItems::Use(ATempCharacter* Character)
TurnBaseCombat->ProbertiumResource = FMath::Clamp(TurnBaseCombat->ProbertiumResource + 2, 0, 20); TurnBaseCombat->ProbertiumResource = FMath::Clamp(TurnBaseCombat->ProbertiumResource + 2, 0, 20);
Character->Inventory->RemoveItem(this); Character->Inventory->RemoveItem(this);
} }
return;
} }
if (isEisType) if (isEisType)
@ -60,6 +64,7 @@ void UEatableItems::Use(ATempCharacter* Character)
TurnBaseCombat->EisResource = FMath::Clamp(TurnBaseCombat->EisResource + 2, 0, 20); TurnBaseCombat->EisResource = FMath::Clamp(TurnBaseCombat->EisResource + 2, 0, 20);
Character->Inventory->RemoveItem(this); Character->Inventory->RemoveItem(this);
} }
return;
} }
if (isAzosType) if (isAzosType)
@ -71,6 +76,7 @@ void UEatableItems::Use(ATempCharacter* Character)
TurnBaseCombat->AzosResource = FMath::Clamp(TurnBaseCombat->AzosResource + 2, 0, 20); TurnBaseCombat->AzosResource = FMath::Clamp(TurnBaseCombat->AzosResource + 2, 0, 20);
Character->Inventory->RemoveItem(this); Character->Inventory->RemoveItem(this);
} }
return;
} }
if (isIroquoidType) if (isIroquoidType)

View File

@ -143,14 +143,17 @@ void UDialogueNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom
void UDialogueNPC::StartDialogue() void UDialogueNPC::StartDialogue()
{ {
Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->bIsInDialogue = true; Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->bIsInDialogue = true;
Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->InventoryWidget->SetVisibility(ESlateVisibility::Hidden); FOutputDeviceNull AR;
Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->EscapeMenuWidget->SetVisibility(ESlateVisibility::Hidden); const FString Command333 = FString::Printf(TEXT("CloseInventory"));
GetWorld()->GetFirstPlayerController()->GetPawn()->CallFunctionByNameWithArguments(*Command333, AR, nullptr, true);
const FString Command69 = FString::Printf(TEXT("CloseEscapeMenu"));
GetWorld()->GetFirstPlayerController()->GetPawn()->CallFunctionByNameWithArguments(*Command69, AR, nullptr, true);
Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CrossHairWidget->SetVisibility(ESlateVisibility::Hidden);
bIsInDialogue = true; bIsInDialogue = true;
Quests.Empty(); Quests.Empty();
BlueprintFunctions.Empty(); BlueprintFunctions.Empty();
ItemIndexes.Empty(); ItemIndexes.Empty();
QuestFlags.Empty(); QuestFlags.Empty();
FOutputDeviceNull AR;
const FString Command = FString::Printf(TEXT("SetRootDialoguePath")); const FString Command = FString::Printf(TEXT("SetRootDialoguePath"));
GetOwner()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true); GetOwner()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
if (IsValid(RootDialoguePath)) CurrentDialogueStringPath = RootDialoguePath->Dialogue; if (IsValid(RootDialoguePath)) CurrentDialogueStringPath = RootDialoguePath->Dialogue;
@ -195,6 +198,7 @@ void UDialogueNPC::EndDialogue()
PlayerController->SetIgnoreLookInput(false); PlayerController->SetIgnoreLookInput(false);
PlayerController->SetInputMode(FInputModeGameOnly()); PlayerController->SetInputMode(FInputModeGameOnly());
PlayerController->bShowMouseCursor = false; PlayerController->bShowMouseCursor = false;
Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CrossHairWidget->SetVisibility(ESlateVisibility::HitTestInvisible);
} }
} }

View File

@ -4,6 +4,7 @@
#include "InteractNPC.h" #include "InteractNPC.h"
#include "DialogueNPC.h" #include "DialogueNPC.h"
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "the_twilight_abyss/PlayerTemp/TempCharacter.h"
// Sets default values for this component's properties // Sets default values for this component's properties
@ -47,6 +48,8 @@ void UInteractNPC::Interact()
if (HitResult.GetActor()->Tags.Contains("NPC")) if (HitResult.GetActor()->Tags.Contains("NPC"))
{ {
//DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f); //DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f);
if (Cast<ATempCharacter>(GetOwner())->bShopKeeperText) return;
if (Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->bIsInCombat) return;
UDialogueNPC* DialogueNPC = HitResult.GetActor()->FindComponentByClass<UDialogueNPC>(); UDialogueNPC* DialogueNPC = HitResult.GetActor()->FindComponentByClass<UDialogueNPC>();
if (DialogueNPC->bIsInDialogue) if (DialogueNPC->bIsInDialogue)
{ {
@ -59,3 +62,22 @@ void UInteractNPC::Interact()
} }
} }
void UInteractNPC::EndInteract()
{
FVector Start = Cast<UCameraComponent>(GetOwner()->FindComponentByClass<UCameraComponent>())->GetComponentLocation();
FVector End = GetOwner()->GetActorForwardVector() * 300.0f + Start;
FCollisionQueryParams CollisionParams;
CollisionParams.AddIgnoredActor(GetOwner());
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams))
{
//UE_LOG(LogTemp, Warning, TEXT("Hit: %s"), *HitResult.GetActor()->GetName());
if (HitResult.GetActor()->Tags.Contains("NPC"))
{
//DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f);
UDialogueNPC* DialogueNPC = HitResult.GetActor()->FindComponentByClass<UDialogueNPC>();
DialogueNPC->EndDialogue();
}
//DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f);
}
}

View File

@ -26,4 +26,7 @@ public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void Interact(); void Interact();
UFUNCTION(BlueprintCallable)
void EndInteract();
}; };

View File

@ -3,11 +3,7 @@
#include "Interaction.h" #include "Interaction.h"
#include "NetworkMessage.h"
#include "Chaos/BoundingVolumeUtilities.h"
#include "Components/Button.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "Components/WidgetComponent.h"
#include "Kismet/KismetMathLibrary.h" #include "Kismet/KismetMathLibrary.h"
#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h"
#include "the_twilight_abyss/Quest/QuestSystem.h" #include "the_twilight_abyss/Quest/QuestSystem.h"
@ -82,7 +78,6 @@ void AInteraction::OnInteract()
// //handles the widget disappearing from the viewport // //handles the widget disappearing from the viewport
// FTimerHandle WidgetTimer; // FTimerHandle WidgetTimer;
// GetWorldTimerManager().SetTimer(WidgetTimer, this, &AInteraction::RemoveWidget, WaitTimer, false); // GetWorldTimerManager().SetTimer(WidgetTimer, this, &AInteraction::RemoveWidget, WaitTimer, false);
} }
void AInteraction::RemoveWidget() void AInteraction::RemoveWidget()
@ -90,18 +85,9 @@ void AInteraction::RemoveWidget()
//Character & Camera refs //Character & Camera refs
TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter()); TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter());
MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>()); MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>());
TempCharacterRef->bShopKeeperText = true;
bDisableShopDialMove = true; bDisableShopDialMove = true;
bisDisabled = true; bisDisabled = true;
//Setting ShopWidgetText back to hidden
// ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden);
// if (ShopDialogWidget->IsVisible())
// {
// return;
// }
// else
// {
// UE_LOG(LogTemp, Display, TEXT("You cant open this widget when this widget is open"));
// }
UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true")); UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true"));
Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden); Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
if (Property == nullptr) if (Property == nullptr)
@ -208,9 +194,10 @@ void AInteraction::ExitScreen()
} }
else else
{ {
TempCharacterRef->InputEnabler();
ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden); ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden);
Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::HitTestInvisible); Cast<UQuestSystem>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::HitTestInvisible);
TempCharacterRef->bShopKeeperText = false;
TempCharacterRef->InputEnabler();
} }
} }

View File

@ -45,7 +45,7 @@ public:
UPROPERTY() UPROPERTY()
UUserWidget* ShopDialogWidget; UUserWidget* ShopDialogWidget;
UPROPERTY() UPROPERTY(BlueprintReadOnly)
UUserWidget* ItemSelectorWidget; UUserWidget* ItemSelectorWidget;
UPROPERTY() UPROPERTY()

View File

@ -9,7 +9,9 @@
#include "the_twilight_abyss/MerchantInteraction/Interaction.h" #include "the_twilight_abyss/MerchantInteraction/Interaction.h"
#include <Runtime/Engine/Classes/Kismet/GameplayStatics.h> #include <Runtime/Engine/Classes/Kismet/GameplayStatics.h>
#include "Components/PawnNoiseEmitterComponent.h" #include "Components/PawnNoiseEmitterComponent.h"
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/KismetMathLibrary.h" #include "Kismet/KismetMathLibrary.h"
#include "Misc/OutputDeviceNull.h"
// CONSTRUCTOR // CONSTRUCTOR
@ -20,6 +22,11 @@ ATempCharacter::ATempCharacter()
Inventory = CreateDefaultSubobject<UInventoryComponent>("Inventory"); Inventory = CreateDefaultSubobject<UInventoryComponent>("Inventory");
Inventory->MaxItemSlots = 10; Inventory->MaxItemSlots = 10;
this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true; this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
if (static ConstructorHelpers::FObjectFinder<UTexture2D> CrossHairTexture(TEXT("Texture2D'/Game/Blueprints/Display_UI/InteracableIcon.InteracableIcon'")); IsValid(CrossHairTexture.Object))
{
InteractableCrossHair = CrossHairTexture.Object;
}
} }
// Called when the game starts or when spawned // Called when the game starts or when spawned
@ -48,6 +55,7 @@ void ATempCharacter::BeginPlay()
//Widget Refs //Widget Refs
CrossHairWidget = CreateWidget<UUserWidget>(GetWorld(), CrossHairSub); CrossHairWidget = CreateWidget<UUserWidget>(GetWorld(), CrossHairSub);
CrossHairWidget->SetVisibility(ESlateVisibility::Visible); CrossHairWidget->SetVisibility(ESlateVisibility::Visible);
CrossHair = Cast<UImage>(CrossHairWidget->GetWidgetFromName(TEXT("Crosshair")));
CrossHairWidget->AddToViewport(); CrossHairWidget->AddToViewport();
InventoryWidget = CreateWidget<UUserWidget>(GetWorld(), InventoryMenuSub); InventoryWidget = CreateWidget<UUserWidget>(GetWorld(), InventoryMenuSub);
@ -106,6 +114,40 @@ void ATempCharacter::Tick(float DeltaTime)
FVector WidgetLocation; FVector WidgetLocation;
FirstPlayerController->DeprojectMousePositionToWorld(WidgetLocation, VectorRotation); FirstPlayerController->DeprojectMousePositionToWorld(WidgetLocation, VectorRotation);
WidgetPointer->SetWorldLocationAndRotation(WidgetLocation, VectorRotation.Rotation().Quaternion()); WidgetPointer->SetWorldLocationAndRotation(WidgetLocation, VectorRotation.Rotation().Quaternion());
CrossHair->SetBrush(FSlateBrush());
CrossHair->SetDesiredSizeOverride(FVector2D(5, 5));
}
else
{
const FVector Start = ThisCamera->GetComponentLocation();
const FVector End = Start + TraceDistance * ThisCamera->GetForwardVector();
FCollisionQueryParams TraceParams;
TraceParams.AddIgnoredActor(this);
if (FHitResult OutResult = FHitResult(); GetWorld()->LineTraceSingleByChannel(OutResult, Start, End, ECC_Pawn, TraceParams))
{
if (!IsValid(OutResult.GetActor()))
{
CrossHair->SetBrush(FSlateBrush());
CrossHair->SetDesiredSizeOverride(FVector2D(5, 5));
return;
}
if (OutResult.GetActor()->ActorHasTag("Probertium") || OutResult.GetActor()->ActorHasTag("Iroquid")
|| OutResult.GetActor()->ActorHasTag("Azos") || OutResult.GetActor()->ActorHasTag("Eis")
|| OutResult.GetActor()->ActorHasTag("NPC") || OutResult.GetActor()->ActorHasTag("Interactable")
|| OutResult.GetActor()->FindComponentByClass<UInventoryComponent>())
{
CrossHair->SetBrush(UWidgetBlueprintLibrary::MakeBrushFromTexture(InteractableCrossHair));
CrossHair->SetDesiredSizeOverride(FVector2D(43.6, 51.3));
return;
}
CrossHair->SetBrush(FSlateBrush());
CrossHair->SetDesiredSizeOverride(FVector2D(5, 5));
}
else
{
CrossHair->SetBrush(FSlateBrush());
CrossHair->SetDesiredSizeOverride(FVector2D(5, 5));
}
} }
} }
@ -134,10 +176,10 @@ void ATempCharacter::KeyPressed()
void ATempCharacter::LineTraceLogic() void ATempCharacter::LineTraceLogic()
{ {
//UE_LOG(LogTemp, Display, TEXT("LineTraceLogic activated")); //UE_LOG(LogTemp, Display, TEXT("LineTraceLogic activated"));
float GlobalTrace = TraceDistance;
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>()); ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
FVector Start = ThisCamera->GetComponentLocation(); const float GlobalTrace = TraceDistance;
FVector End = Start + GlobalTrace * ThisCamera->GetForwardVector(); const FVector Start = ThisCamera->GetComponentLocation();
const FVector End = Start + GlobalTrace * ThisCamera->GetForwardVector();
FCollisionQueryParams TraceParams; FCollisionQueryParams TraceParams;
TraceParams.AddIgnoredActor(this); TraceParams.AddIgnoredActor(this);
bHit = GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, ECC_Pawn, TraceParams); bHit = GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, ECC_Pawn, TraceParams);
@ -147,12 +189,12 @@ void ATempCharacter::LineTraceLogic()
{ {
return; return;
} }
if(OutHit.GetActor()->ActorHasTag(TEXT("Probertium"))) if (OutHit.GetActor()->ActorHasTag(TEXT("Probertium")))
{ {
AddToInventory(); AddToInventory();
return; return;
} }
if(OutHit.GetActor()->ActorHasTag(TEXT("Iroquid"))) if (OutHit.GetActor()->ActorHasTag(TEXT("Iroquid")))
{ {
AddToInventory(); AddToInventory();
return; return;
@ -167,10 +209,17 @@ void ATempCharacter::LineTraceLogic()
AddToInventory(); AddToInventory();
return; return;
} }
if (OutHit.GetActor()->ActorHasTag(TEXT("Interactable")))
{
FOutputDeviceNull AR;
const FString Command = FString::Printf(TEXT("Interact"));
OutHit.GetActor()->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
return;
}
if (OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()) if (OutHit.GetActor()->FindComponentByClass<UInventoryComponent>())
{ {
UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0); const auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if (GoldBalance >= ItemArray->ItemCostPrice) if (GoldBalance >= ItemArray->ItemCostPrice)
{ {
GoldBalance -= ItemArray->ItemCostPrice; GoldBalance -= ItemArray->ItemCostPrice;
@ -184,38 +233,34 @@ void ATempCharacter::LineTraceLogic()
} }
// if the actor hit has the interaction component/script then it will activate the code // if the actor hit has the interaction component/script then it will activate the code
if (AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor())) if (const AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
{ {
if (MyInteractable->ShopDialogWidget->IsVisible()) if (MyInteractable->ShopDialogWidget->IsVisible())
{ {
UE_LOG(LogTemp, Display, TEXT("ShopKeeper text is visible")); UE_LOG(LogTemp, Display, TEXT("ShopKeeper text is visible"));
bShopKeeperText = true; bShopKeeperText = true;
return;
} }
//if there is no text on screen this triggers }
else }
}
void ATempCharacter::ExitMerchant()
{
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
const float GlobalTrace = TraceDistance;
const FVector Start = ThisCamera->GetComponentLocation();
const FVector End = Start + GlobalTrace * ThisCamera->GetForwardVector();
FCollisionQueryParams TraceParams;
TraceParams.AddIgnoredActor(this);
bHit = GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, ECC_Pawn, TraceParams);
if (bHit)
{
if (OutHit.GetActor() == nullptr) return;
if (AInteraction* MyInteractable = Cast<AInteraction>(OutHit.GetActor()))
{
if (MyInteractable->ShopDialogWidget->IsVisible())
{ {
if (MyInteractable->ItemSelectorWidget->IsVisible()) MyInteractable->ExitScreen();
{
return;
}
else
{
//DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f);
// MyInteractable->OnInteract();
// UE_LOG(LogTemp, Display, TEXT("OnInteract activated"));
// UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName());
//
// // While loop to check bisDisabled var until it changes to true
// while (MyInteractable->bisDisabled == false || MyInteractable->bDisableShopDialMove == false)
// {
// if (MyInteractable->bisDisabled == true || MyInteractable->bDisableShopDialMove == true)
// {
// InputDisabler();
// break;
// }
// }
}
} }
} }
} }
@ -226,7 +271,7 @@ void ATempCharacter::AddToInventory()
if (OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()) if (OutHit.GetActor()->FindComponentByClass<UInventoryComponent>())
{ {
UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); UE_LOG(LogTemp, Display, TEXT("Hit Merchant"));
auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0); const auto ItemArray = OutHit.GetActor()->FindComponentByClass<UInventoryComponent>()->GetItem(0);
if (GoldBalance >= ItemArray->ItemCostPrice) if (GoldBalance >= ItemArray->ItemCostPrice)
{ {
GoldBalance -= ItemArray->ItemCostPrice; GoldBalance -= ItemArray->ItemCostPrice;
@ -241,24 +286,19 @@ void ATempCharacter::AddToInventory()
} }
} }
void ATempCharacter::InputDisabler() void ATempCharacter::InputDisabler(const bool SetCamera)
{ {
//Disable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
}
//TURNING OFF CROSSHAIR
CrossHairWidget->SetVisibility(ESlateVisibility::Hidden); CrossHairWidget->SetVisibility(ESlateVisibility::Hidden);
//Set to UI Mode Only //Set to UI Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeUIOnly()); PlayerController->SetInputMode(FInputModeGameAndUI());
PlayerController->bShowMouseCursor = true; PlayerController->bShowMouseCursor = true;
PlayerController->SetIgnoreMoveInput(true);
PlayerController->SetIgnoreLookInput(true);
disableTab = true; disableTab = true;
if (ThisCamera != nullptr) if (ThisCamera != nullptr && SetCamera)
{ {
OriginalCameraLocation = ThisCamera->GetComponentLocation(); OriginalCameraLocation = ThisCamera->GetComponentLocation();
OriginalCameraRotation = ThisCamera->GetComponentRotation(); OriginalCameraRotation = ThisCamera->GetComponentRotation();
@ -267,24 +307,26 @@ void ATempCharacter::InputDisabler()
} }
} }
void ATempCharacter::InputEnabler() void ATempCharacter::InputEnabler(const bool SetCamera)
{ {
//Enable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
}
//Reset UI Mode //Reset UI Mode
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeGameOnly()); PlayerController->SetInputMode(FInputModeGameOnly());
PlayerController->bShowMouseCursor = false; PlayerController->bShowMouseCursor = false;
PlayerController->SetIgnoreMoveInput(false); PlayerController->SetIgnoreMoveInput(false);
PlayerController->SetIgnoreLookInput(false); PlayerController->SetIgnoreLookInput(false);
CrossHairWidget->SetVisibility(ESlateVisibility::HitTestInvisible);
//Enable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
}
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
disableTab = true; disableTab = true;
TraceDistance = 300; TraceDistance = 300;
if (ThisCamera != nullptr) if (ThisCamera != nullptr && SetCamera)
{ {
ThisCamera->SetWorldLocation(OriginalCameraLocation); ThisCamera->SetWorldLocation(OriginalCameraLocation);
ThisCamera->SetWorldRotation(OriginalCameraRotation); ThisCamera->SetWorldRotation(OriginalCameraRotation);
@ -326,5 +368,4 @@ void ATempCharacter::BuyItem(AActor* Item)
TraceDistance = 1000; TraceDistance = 1000;
LineTraceLogic(); LineTraceLogic();
} }
} }

View File

@ -9,6 +9,7 @@
#include "Engine/PostProcessVolume.h" #include "Engine/PostProcessVolume.h"
#include "Components/WidgetInteractionComponent.h" #include "Components/WidgetInteractionComponent.h"
#include "../TurnBasedCombatV2/TurnBaseCombatV2.h" #include "../TurnBasedCombatV2/TurnBaseCombatV2.h"
#include "Components/Image.h"
#include "TempCharacter.generated.h" #include "TempCharacter.generated.h"
UCLASS() UCLASS()
@ -24,6 +25,9 @@ public:
UPROPERTY(BlueprintReadOnly) UPROPERTY(BlueprintReadOnly)
bool bIsInDialogue = false; bool bIsInDialogue = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UTexture2D* InteractableCrossHair;
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;
@ -42,6 +46,9 @@ protected:
UPROPERTY() UPROPERTY()
ATurnBaseCombatV2* CombatSystem; ATurnBaseCombatV2* CombatSystem;
UPROPERTY()
UImage* CrossHair;
public: public:
// Called every frame // Called every frame
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
@ -49,7 +56,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true")) UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true"))
class UInventoryComponent* Inventory; //Using the InventoryComponent class class UInventoryComponent* Inventory; //Using the InventoryComponent class
// Called to bind functionality to input // Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
@ -59,10 +65,13 @@ public:
float TraceDistance = 200; float TraceDistance = 200;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InputDisabler(); void InputDisabler(bool SetCamera = true);
void LineTraceLogic(); void LineTraceLogic();
UFUNCTION(BlueprintCallable)
void ExitMerchant();
UPROPERTY() UPROPERTY()
class UPawnNoiseEmitterComponent* NoiseEmitter; class UPawnNoiseEmitterComponent* NoiseEmitter;
@ -80,7 +89,7 @@ public:
void UseItem(class UBaseItem* Item); // Overriding the BaseItem Class void UseItem(class UBaseItem* Item); // Overriding the BaseItem Class
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InputEnabler(); void InputEnabler(bool SetCamera = true);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
UCameraComponent* ThisCamera; UCameraComponent* ThisCamera;
@ -94,6 +103,7 @@ public:
UFUNCTION(BlueprintCallable, Category= "Items") UFUNCTION(BlueprintCallable, Category= "Items")
void BuyItem(AActor* Item); void BuyItem(AActor* Item);
UPROPERTY(BlueprintReadOnly)
bool bShopKeeperText = false; bool bShopKeeperText = false;
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)

View File

@ -67,6 +67,7 @@ void UHoldToInitCombat::OnClickDown()
{ {
if (!bHasBookAndGun) return; if (!bHasBookAndGun) return;
if (Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->bIsInCombat) return; if (Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->bIsInCombat) return;
if (Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->bIsInDialogue || Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->bShopKeeperText || Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->InventoryWidget->IsVisible()) return;
if (ReloadTimer > 0.0f) return; if (ReloadTimer > 0.0f) return;
if (GunEffect) if (GunEffect)
{ {

View File

@ -52,6 +52,8 @@ void UStatusEffect::TickDown(AActor* Character)
void UStatusEffect::CheckForExpiry(const float TimeOfExpiry, AActor* Character) void UStatusEffect::CheckForExpiry(const float TimeOfExpiry, AActor* Character)
{ {
if (!IsValid(this)) return;
if (!IsValid(Character)) return;
if (TimeOfExpiry <= UGameplayStatics::GetRealTimeSeconds(GetWorld())) OnExpiry(Character); if (TimeOfExpiry <= UGameplayStatics::GetRealTimeSeconds(GetWorld())) OnExpiry(Character);
UStatusSystem* StatusSystem = Cast<UStatusSystem>(Character->GetComponentByClass(UStatusSystem::StaticClass())); UStatusSystem* StatusSystem = Cast<UStatusSystem>(Character->GetComponentByClass(UStatusSystem::StaticClass()));
if (StatusSystem->GetActiveStatusEffect(this).StatusIcon == nullptr) return; if (StatusSystem->GetActiveStatusEffect(this).StatusIcon == nullptr) return;

View File

@ -40,17 +40,19 @@ void UStatusSystem::TickComponent(float DeltaTime, ELevelTick TickType, FActorCo
void UStatusSystem::AddStatusEffect(UStatusEffect* StatusEffect, const float DurationMultiplier, const bool Invoke) void UStatusSystem::AddStatusEffect(UStatusEffect* StatusEffect, const float DurationMultiplier, const bool Invoke)
{ {
for (FActiveStatusEffect ActiveStatusEffect : ActiveStatusEffects) TArray<UStatusEffect*> ToExpire;
for (const FActiveStatusEffect& ActiveStatusEffect : ActiveStatusEffects)
{ {
if (ActiveStatusEffect.StatusEffect->Name == StatusEffect->Name) if (ActiveStatusEffect.StatusEffect->Name == StatusEffect->Name)
{ {
ActiveStatusEffect.TimeTillExpiry = StatusEffect->BaseDuration * DurationMultiplier; ToExpire.Add(ActiveStatusEffect.StatusEffect);
UTextBlock* StatusText = Cast<UTextBlock>(ActiveStatusEffect.StatusIcon->GetWidgetFromName(TEXT("DurationText")));
StatusText->SetText(FText::FromString(FString::FromInt(ActiveStatusEffect.TimeTillExpiry)));
if (Invoke) ActiveStatusEffect.StatusEffect->Invoke(GetOwner(), ActiveStatusEffect.TimeTillExpiry);
return;
} }
} }
for (UStatusEffect* StatusEffectToExpire : ToExpire)
{
StatusEffectToExpire->OnExpiry(GetOwner());
}
ToExpire.Empty();
FActiveStatusEffect NewStatusEffect; FActiveStatusEffect NewStatusEffect;
NewStatusEffect.StatusEffect = StatusEffect; NewStatusEffect.StatusEffect = StatusEffect;
NewStatusEffect.TimeInitiated = UGameplayStatics::GetRealTimeSeconds(GetWorld()); NewStatusEffect.TimeInitiated = UGameplayStatics::GetRealTimeSeconds(GetWorld());

View File

@ -12,6 +12,7 @@
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "Kismet/KismetMathLibrary.h" #include "Kismet/KismetMathLibrary.h"
#include "Misc/OutputDeviceNull.h" #include "Misc/OutputDeviceNull.h"
#include "the_twilight_abyss/Dialogue/InteractNPC.h"
#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h"
#include "the_twilight_abyss/Quest/QuestSystem.h" #include "the_twilight_abyss/Quest/QuestSystem.h"
@ -48,17 +49,30 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot)
EnemyActor = Enemy; EnemyActor = Enemy;
StatusTextBlock->SetRenderOpacity(0.0f); StatusTextBlock->SetRenderOpacity(0.0f);
BookHUD->SetVisibility(ESlateVisibility::SelfHitTestInvisible); BookHUD->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
Cast<ATempCharacter>(PlayerActor)->InventoryWidget->SetVisibility(ESlateVisibility::Hidden);
Cast<ATempCharacter>(PlayerActor)->EscapeMenuWidget->SetVisibility(ESlateVisibility::Hidden);
HUD->AddToViewport(-1); HUD->AddToViewport(-1);
BookStaticMeshComponent->SetVisibility(true); BookStaticMeshComponent->SetVisibility(true);
EscapePercentage = CalculateEscapePercentage(); EscapePercentage = CalculateEscapePercentage();
EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%"))); EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%")));
bIsInCombat = true; bIsInCombat = true;
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent(); UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(EnemyActor->GetInstigatorController())->GetBlackboardComponent();
Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden); Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
HealingJellyAmountTextBlock->SetText(FText::FromString(FString::FromInt(FMath::Clamp(Cast<ATempCharacter>(PlayerActor)->Inventory->GetItemAmount(0), 0, 99)))); HealingJellyAmountTextBlock->SetText(FText::FromString(FString::FromInt(FMath::Clamp(Cast<ATempCharacter>(PlayerActor)->Inventory->GetItemAmount(0), 0, 99))));
if (Cast<ATempCharacter>(PlayerActor)->bIsInDialogue)
{
Cast<UInteractNPC>(PlayerActor->GetComponentByClass(UInteractNPC::StaticClass()))->EndInteract();
}
if (Cast<ATempCharacter>(PlayerActor)->bShopKeeperText)
{
Cast<ATempCharacter>(PlayerActor)->ExitMerchant();
}
FOutputDeviceNull AR;
const FString Command = FString::Printf(TEXT("CloseInventory"));
PlayerActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
const FString Command69 = FString::Printf(TEXT("CloseEscapeMenu"));
PlayerActor->CallFunctionByNameWithArguments(*Command69, AR, nullptr, true);
//Disable Character Movement //Disable Character Movement
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetIgnoreMoveInput(true); PlayerController->SetIgnoreMoveInput(true);
@ -66,7 +80,6 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot)
PlayerController->SetInputMode(FInputModeGameAndUI()); PlayerController->SetInputMode(FInputModeGameAndUI());
PlayerController->bShowMouseCursor = true; PlayerController->bShowMouseCursor = true;
if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return;
EnemyBlackboard->SetValueAsBool("IsInCombat", true); EnemyBlackboard->SetValueAsBool("IsInCombat", true);
const FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health")); const FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health"));
int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr<int32>(Enemy); int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr<int32>(Enemy);
@ -75,9 +88,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot)
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss"); FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
if (const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty); IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor)) if (const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty); IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor))
{ {
FOutputDeviceNull AR; const FString Command123 = FString::Printf(TEXT("TriggerCombatAnimation true"));
const FString Command = FString::Printf(TEXT("TriggerCombatAnimation true")); EnemyActor->CallFunctionByNameWithArguments(*Command123, AR, nullptr, true);
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
FVector Direction = EnemyActor->GetActorLocation() - PlayerActor->GetActorLocation(); FVector Direction = EnemyActor->GetActorLocation() - PlayerActor->GetActorLocation();
Direction.Normalize(); Direction.Normalize();
FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator(); FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator();
@ -145,6 +157,7 @@ void ATurnBaseCombatV2::CombatCheck(const bool bWasShot)
void ATurnBaseCombatV2::EndCombat() void ATurnBaseCombatV2::EndCombat()
{ {
GetWorldTimerManager().ClearTimer(EnemyTurnTimerHandle);
BookHUD->SetVisibility(ESlateVisibility::Hidden); BookHUD->SetVisibility(ESlateVisibility::Hidden);
HUD->RemoveFromParent(); HUD->RemoveFromParent();
BookStaticMeshComponent->SetVisibility(false); BookStaticMeshComponent->SetVisibility(false);
@ -169,11 +182,17 @@ void ATurnBaseCombatV2::EndCombat()
//Enable Character Movement //Enable Character Movement
//Set to Game Mode Only //Set to Game Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeGameOnly());
PlayerController->SetIgnoreMoveInput(false); PlayerController->SetIgnoreMoveInput(false);
PlayerController->SetIgnoreLookInput(false); PlayerController->SetIgnoreLookInput(false);
PlayerController->SetInputMode(FInputModeGameOnly());
PlayerController->bShowMouseCursor = false; PlayerController->bShowMouseCursor = false;
//Enable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
}
if (IsValid(EnemyActor)) if (IsValid(EnemyActor))
{ {
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss"); FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
@ -324,7 +343,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
{ {
FOutputDeviceNull AR; FOutputDeviceNull AR;
UStatusSystem* StatusSystem = Cast<UStatusSystem>(PlayerActor->GetComponentByClass(UStatusSystem::StaticClass())); UStatusSystem* StatusSystem = Cast<UStatusSystem>(PlayerActor->GetComponentByClass(UStatusSystem::StaticClass()));
if (Combo == "PA") if (Combo == "PA" || Combo == "AP")
{ {
UStatusEffect* TempThornsStatusEffect = NewObject<UStatusEffect>(PlayerActor, ThornsStatusEffect); UStatusEffect* TempThornsStatusEffect = NewObject<UStatusEffect>(PlayerActor, ThornsStatusEffect);
StatusSystem->AddStatusEffect(TempThornsStatusEffect, 1, false); StatusSystem->AddStatusEffect(TempThornsStatusEffect, 1, false);
@ -335,7 +354,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation")); const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true); HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
} }
else if (Combo == "PI") else if (Combo == "PI" || Combo == "IP")
{ {
UStatusEffect* TempDOTStatusEffect = NewObject<UStatusEffect>(PlayerActor, DOTStatusEffect); UStatusEffect* TempDOTStatusEffect = NewObject<UStatusEffect>(PlayerActor, DOTStatusEffect);
StatusSystem->AddStatusEffect(TempDOTStatusEffect, 1, false); StatusSystem->AddStatusEffect(TempDOTStatusEffect, 1, false);
@ -346,7 +365,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation")); const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true); HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
} }
else if (Combo == "AI") else if (Combo == "AI" || Combo == "IA")
{ {
UStatusEffect* TempDamageDownStatusEffect = NewObject<UStatusEffect>(PlayerActor, DamageDownStatusEffect); UStatusEffect* TempDamageDownStatusEffect = NewObject<UStatusEffect>(PlayerActor, DamageDownStatusEffect);
StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1, true); StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1, true);
@ -394,7 +413,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
{ {
case true: case true:
// Player Turn // Player Turn
DamageEnemy(*ValidCombos.Find(Combo)); DamageEnemy(ValidCombos.Contains(Combo) ? *ValidCombos.Find(Combo) : *ValidCombos.Find(Combo.Reverse()));
OnPlayerTurn.Broadcast(PlayerActor, EnemyActor); OnPlayerTurn.Broadcast(PlayerActor, EnemyActor);
break; break;
case false: case false:
@ -406,6 +425,9 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
if (!bPlayerHasExtraTurn) if (!bPlayerHasExtraTurn)
{ {
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty);
if (IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor) && EnemyHealth <= nullptr) return;
SwitchTurn(); SwitchTurn();
} }
else else
@ -450,6 +472,11 @@ void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType)
{ {
const FString Command = FString::Printf(TEXT("TriggerDeathAnimation")); const FString Command = FString::Printf(TEXT("TriggerDeathAnimation"));
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true); EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
for (UStatusEffect* StatusEffect : StatusEffects)
{
StatusEffect->OnExpiry(PlayerActor);
}
StatusEffects.Empty();
return; return;
} }
EndCombat(); EndCombat();
@ -503,6 +530,11 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, const FString& DamageType)
{ {
const FString Command2 = FString::Printf(TEXT("TriggerDeathAnimation")); const FString Command2 = FString::Printf(TEXT("TriggerDeathAnimation"));
EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true); EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true);
for (UStatusEffect* StatusEffect : StatusEffects)
{
StatusEffect->OnExpiry(PlayerActor);
}
StatusEffects.Empty();
return; return;
} }
EndCombat(); EndCombat();
@ -533,12 +565,14 @@ float ATurnBaseCombatV2::CalculateEscapePercentage() const
bool ATurnBaseCombatV2::IsValidCombo(const FString& Combo) 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 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() void ATurnBaseCombatV2::SwitchTurn()
@ -548,8 +582,7 @@ void ATurnBaseCombatV2::SwitchTurn()
TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn")); TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn"));
DisableButtons(); DisableButtons();
FTimerHandle UnusedHandle; GetWorldTimerManager().SetTimer(EnemyTurnTimerHandle, this, &ATurnBaseCombatV2::EnemyTurn, 2.0f, false);
GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATurnBaseCombatV2::EnemyTurn, 2.0f, false);
//activeActor = bIsPlayerTurn ? enemyActor : playerActor; //activeActor = bIsPlayerTurn ? enemyActor : playerActor;
} }
@ -790,6 +823,7 @@ void ATurnBaseCombatV2::EnableButtons() const
void ATurnBaseCombatV2::EnemyTurn() void ATurnBaseCombatV2::EnemyTurn()
{ {
if (!IsValid(EnemyActor)) return; if (!IsValid(EnemyActor)) return;
if (EnemyHealth <= nullptr) return;
int ChanceToMiss; int ChanceToMiss;
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss"); FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty); const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty);

View File

@ -146,6 +146,8 @@ protected:
private: private:
bool IsValidCombo(const FString& Combo) const; bool IsValidCombo(const FString& Combo) const;
bool IsSpecialCombo(const FString& Combo) const; bool IsSpecialCombo(const FString& Combo) const;
UPROPERTY()
FTimerHandle EnemyTurnTimerHandle;
UPROPERTY() UPROPERTY()
APostProcessVolume* PostProcessVolume; APostProcessVolume* PostProcessVolume;

BIN
UI designs/hand-pointer-icon.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,7 +1,11 @@
# The Twilight Abyss # Azure Abyss
## By Team 2:13 ## By Team 2:13
### Itch.io Page
https://null-cat.itch.io/azureabyss
### Trello ### Trello
https://trello.com/b/umw6SXsi/world-213 https://trello.com/b/umw6SXsi/world-213
@ -48,4 +52,5 @@ https://docs.google.com/document/d/1S7p4AEAINTd_0mP1dY58bypDfLhWICflUBiqRWZW8uc/
### Attributions ### Attributions
"Rock stairs" (https://skfb.ly/o6zVw) by Vítek Chalany is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). "Rock stairs" (https://skfb.ly/o6zVw) by Vítek Chalany is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).
Merchant, Sister, Boss Character Animations provided by Mixamo https://www.mixamo.com/ Merchant, Sister, Boss Character Animations provided by Mixamo https://www.mixamo.com/

View File

@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Azos/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Azos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Iroquid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Iroquoid/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Iroquoid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Probertium/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Probertium/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=UFUNCTION/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> <s:Boolean x:Key="/Default/UserDictionary/Words/=UFUNCTION/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>