72 lines
1.5 KiB
C++
72 lines
1.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.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;
|
|
int ActiveActionPoints = 0;
|
|
|
|
AActor* playerActor;
|
|
AActor* enemyActor;
|
|
AActor* activeActor;
|
|
|
|
/*
|
|
TODO:
|
|
Reference Action Library
|
|
Reference Player Inventory
|
|
Reference Combat Logging System
|
|
*/
|
|
UPROPERTY(EditAnywhere)
|
|
TSubclassOf<UUserWidget> HUDWidget;
|
|
UPROPERTY(EditAnywhere)
|
|
TMap<FString, int32> ValidCombos =
|
|
{
|
|
{"F", 10},
|
|
{"W", 10},
|
|
{"FW", 20}
|
|
};
|
|
|
|
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;
|
|
void SwitchTurn();
|
|
UPROPERTY(VisibleAnywhere)
|
|
UTextBlock* TurnIndicator;
|
|
UPROPERTY(VisibleAnywhere)
|
|
UProgressBar* PlayerHealthBar;
|
|
UPROPERTY(VisibleAnywhere)
|
|
UProgressBar* EnemyHealthBar;
|
|
};
|