// 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 "StatusEffect.h" #include "NiagaraComponent.h" #include "NiagaraFunctionLibrary.h" #include "GameFramework/GameStateBase.h" #include "StatusEffects/Thorns.h" #include "TurnBaseCombatV2.generated.h" class UNiagaraSystem; UCLASS() class THE_TWILIGHT_ABYSS_API ATurnBaseCombatV2 : public AGameStateBase { GENERATED_BODY() public: ATurnBaseCombatV2(); int* EnemyHealth = nullptr; float* PlayerHealth = nullptr; UPROPERTY(EditDefaultsOnly) int DefaultActionPoints = 3; UPROPERTY(EditDefaultsOnly) int ActiveActionPoints = 0; UPROPERTY(EditDefaultsOnly) int ProbertiumResource = 10; UPROPERTY(EditDefaultsOnly) int EisResource = 10; UPROPERTY(EditDefaultsOnly) int AzosResource = 10; UPROPERTY(EditDefaultsOnly) int IroquoidResource = 10; UPROPERTY(EditDefaultsOnly) UNiagaraSystem* GunEffect; UPROPERTY(VisibleAnywhere) AActor* PlayerActor; UPROPERTY(VisibleAnywhere) AActor* EnemyActor; // AActor* ActiveActor; UPROPERTY(BlueprintReadWrite) UUserWidget* HUD; /* TODO: Reference Player Inventory */ UPROPERTY(EditAnywhere) TSubclassOf HUDWidget; UPROPERTY(EditAnywhere) TMap ValidCombos = { {"P", 5}, {"PP", 15}, {"PPP", 20}, {"E", 5}, {"EE", 15}, {"EEE", 20}, {"A", 5}, {"AA", 15}, {"AAA", 20}, {"I", 5}, {"II", 15}, {"III", 20}, {"IA", 15}, {"IIA", 20}, {"EP", 15}, {"EEP", 20}, {"AE", 15}, {"AAE", 20}, {"PI", 15}, {"PPI", 20} }; UPROPERTY(EditAnywhere) TMap SpecialCombos = { //{"IIA", "ReduceActSpeed"}, //{"EEP", "AreaOfEffect"}, {"AAE", "Thorns"}, {"PPI", "DamageOverTime"} }; FString BattleLog; UFUNCTION(BlueprintCallable) void StartCombat(AActor* Enemy); UFUNCTION(BlueprintCallable) void EndCombat(); // UFUNCTION(BlueprintCallable) // void FKeyPressed(); // UFUNCTION(BlueprintCallable) // void WKeyPressed(); DECLARE_EVENT_TwoParams(ATurnBaseCombatV2, FOnPlayerTurn, AActor*, AActor*); DECLARE_EVENT_TwoParams(ATurnBaseCombatV2, FOnEnemyTurn, AActor*, AActor*); FOnPlayerTurn OnPlayerTurn; FOnEnemyTurn OnEnemyTurn; void DamagePlayer(int Damage, FString DamageType = "unknown"); void DamageEnemy(int Damage, FString DamageType = "unknown"); protected: virtual void BeginPlay() override; void ExecuteCast(FString Combo); void UseActionPoint(); void ReuseActionPoint(); void RevertActionPoints(); void UpdateProgressBars() const; private: bool IsValidCombo(FString Combo) const; bool IsSpecialCombo(FString Combo) const; UPROPERTY() TSubclassOf ThornsStatusEffect; UPROPERTY() TArray StatusEffects; 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) UProgressBar* ProbertiumResourceBar; UPROPERTY(VisibleAnywhere) UProgressBar* EisResourceBar; UPROPERTY(VisibleAnywhere) UProgressBar* AzosResourceBar; UPROPERTY(VisibleAnywhere) UProgressBar* IroquoidResourceBar; UPROPERTY(VisibleAnywhere) UButton* CastButton; UPROPERTY(VisibleAnywhere) UButton* PButton; UPROPERTY(VisibleAnywhere) UButton* EButton; UPROPERTY(VisibleAnywhere) UButton* AButton; UPROPERTY(VisibleAnywhere) UButton* IButton; UPROPERTY(VisibleAnywhere) UButton* BackspaceButton; UPROPERTY(VisibleAnywhere) UButton* RunButton; UFUNCTION() void CastButtonOnClick(); UFUNCTION() void PButtonOnClick(); UFUNCTION() void EButtonOnClick(); UFUNCTION() void AButtonOnClick(); UFUNCTION() void IButtonOnClick(); UFUNCTION() void BackspaceButtonOnClick(); UFUNCTION() void RunButtonOnClick(); void UpdateComboString(FString NewCombo) const; void UpdateActionPoints() const; void AddBattleLogMessage(FString Message); void ClearBattleLog(); void UpdateBattleLog(); void UpdateResourceBars() const; void ToggleButtons() const; void EnemyTurn(); };