Added DamageOverTime Status Effect for Combat

This commit is contained in:
Philip W 2023-03-02 15:06:31 +00:00
parent 0be235f6b1
commit c742abfce4
6 changed files with 59 additions and 0 deletions

View File

@ -1,10 +1,15 @@
{ {
"version": "1.0", "version": "1.0",
"components": [ "components": [
"Microsoft.Net.Component.4.6.2.TargetingPack",
"Microsoft.VisualStudio.Component.VC.14.33.17.3.ARM64",
"Microsoft.VisualStudio.Component.VC.14.33.17.3.x86.x64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64", "Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK", "Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Workload.CoreEditor", "Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.NativeCrossPlat",
"Microsoft.VisualStudio.Workload.NativeDesktop", "Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Workload.NativeGame", "Microsoft.VisualStudio.Workload.NativeGame",
"Microsoft.VisualStudio.Workload.Universal" "Microsoft.VisualStudio.Workload.Universal"

BIN
Content/Blueprints/StatusEffects/BP_DamageOverTime.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DamageOverTime.h"
#include <the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h>
void UDamageOverTime::OnEnemyTurn(AActor* Enemy, AActor* Character)
{
Super::OnEnemyTurn(Enemy, Character);
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
CombatSystem->DamageEnemy(DamagePerTurn, "DOT");
BaseDuration -= 1.0f;
if (BaseDuration <= 0.0f)
{
OnExpiry(Character);
}
}

View File

@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "../StatusEffect.h"
#include "DamageOverTime.generated.h"
/**
*
*/
UCLASS()
class THE_TWILIGHT_ABYSS_API UDamageOverTime : public UStatusEffect
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float DamagePerTurn = 6.0f;
//virtual void Invoke(AActor* Character, float TimeOfExpiry) override;
//virtual void OnExpiry(AActor* Character) override;
virtual void OnEnemyTurn(AActor* Enemy, AActor* Character) override;
};

View File

@ -22,6 +22,8 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
HUDWidget = HUDWidgetClass.Class; HUDWidget = HUDWidgetClass.Class;
static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectThornsClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_Thorns")); static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectThornsClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_Thorns"));
ThornsStatusEffect = StatusEffectThornsClassFinder.Class; ThornsStatusEffect = StatusEffectThornsClassFinder.Class;
static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectDOTClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_DamageOverTime"));
DOTStatusEffect = StatusEffectDOTClassFinder.Class;
} }
} }
@ -178,6 +180,13 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
StatusEffects.Add(TempThornsStatusEffect); StatusEffects.Add(TempThornsStatusEffect);
AddBattleLogMessage("Player Casted Thorns"); AddBattleLogMessage("Player Casted Thorns");
} }
else if (Combo == "PPI")
{
UStatusEffect* TempDOTStatusEffect = NewObject<UStatusEffect>(PlayerActor, DOTStatusEffect);
StatusSystem->AddStatusEffect(TempDOTStatusEffect, 1, false);
StatusEffects.Add(TempDOTStatusEffect);
AddBattleLogMessage("Player Casted DOT");
}
} }
if (GunEffect) if (GunEffect)

View File

@ -121,6 +121,8 @@ private:
UPROPERTY() UPROPERTY()
TSubclassOf<UStatusEffect> ThornsStatusEffect; TSubclassOf<UStatusEffect> ThornsStatusEffect;
UPROPERTY()
TSubclassOf<UStatusEffect> DOTStatusEffect;
UPROPERTY() UPROPERTY()
TArray<UStatusEffect*> StatusEffects; TArray<UStatusEffect*> StatusEffects;