AzureAbyss/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.h

123 lines
2.3 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/Button.h"
#include "Components/ProgressBar.h"
#include "Components/TextBlock.h"
#include "GameFramework/GameStateBase.h"
#include "TurnBaseCombat.generated.h"
/**
*
*/
UCLASS()
class THE_TWILIGHT_ABYSS_API ATurnBaseCombat : public AGameStateBase
{
GENERATED_BODY()
public:
ATurnBaseCombat();
UPROPERTY(EditDefaultsOnly)
int PlayerHealth = 100;
UPROPERTY(EditDefaultsOnly)
int EnemyHealth = 100;
UPROPERTY(EditDefaultsOnly)
int DefaultActionPoints = 3;
UPROPERTY(EditDefaultsOnly)
int ActiveActionPoints = 0;
AActor* PlayerActor;
AActor* EnemyActor;
AActor* ActiveActor;
/*
TODO:
Reference Player Inventory
Reference Combat Logging System
*/
UPROPERTY(EditAnywhere)
TSubclassOf<UUserWidget> HUDWidget;
UPROPERTY(EditAnywhere)
TMap<FString, int32> ValidCombos =
{
{"F", 10},
{"W", 10},
{"FW", 20}
};
FString BattleLog;
protected:
virtual void BeginPlay() override;
void ExecuteCast(FString Combo);
void UseActionPoint();
void ReuseActionPoint();
void RevertActionPoints();
void DamagePlayer(int Damage);
void DamageEnemy(int Damage);
void UpdateProgressBars() const;
private:
bool IsValidCombo(FString Combo) const;
UPROPERTY(VisibleAnywhere)
bool bIsPlayerTurn = true;
UPROPERTY(VisibleAnywhere)
FString CurrentComboString = "";
void SwitchTurn();
UPROPERTY(VisibleAnywhere)
UTextBlock* TurnIndicatorTextBlock;
UPROPERTY(VisibleAnywhere)
UTextBlock* CurrentComboTextBlock;
UPROPERTY(VisibleAnywhere)
UTextBlock* BattleLogTextBlock;
UPROPERTY(VisibleAnywhere)
UTextBlock* ActionPointsTextBlock;
UPROPERTY(VisibleAnywhere)
UProgressBar* PlayerHealthBar;
UPROPERTY(VisibleAnywhere)
UProgressBar* EnemyHealthBar;
UPROPERTY(VisibleAnywhere)
UButton* CastButton;
UPROPERTY(VisibleAnywhere)
UButton* FButton;
UPROPERTY(VisibleAnywhere)
UButton* WButton;
UPROPERTY(VisibleAnywhere)
UButton* BackspaceButton;
UFUNCTION()
void CastButtonOnClick();
UFUNCTION()
void FButtonOnClick();
UFUNCTION()
void WButtonOnClick();
UFUNCTION()
void BackspaceButtonOnClick();
void UpdateComboString(FString NewCombo) const;
void UpdateActionPoints() const;
void AddBattleLogMessage(FString Message);
void ClearBattleLog();
void UpdateBattleLog();
};