Updated Status Effects to Add Damage Down for Enemy & Player
This commit is contained in:
parent
0064e9a003
commit
2f582cb507
BIN
Content/Blueprints/StatusEffects/BP_DamageDown.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/StatusEffects/BP_DamageDown.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/StatusEffects/BP_DamageDownPlayer.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/StatusEffects/BP_DamageDownPlayer.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DamageDown.h"
|
||||
|
||||
void UDamageDown::Invoke(AActor* Character, float TimeOfExpiry)
|
||||
{
|
||||
CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
|
||||
CombatSystem->EnemyBaseDamageMultiplier -= EnemyDamageMultiplierDecreaseAmount;
|
||||
}
|
||||
|
||||
void UDamageDown::OnExpiry(AActor* Character)
|
||||
{
|
||||
CombatSystem->EnemyBaseDamageMultiplier += EnemyDamageMultiplierDecreaseAmount;
|
||||
Super::OnExpiry(Character);
|
||||
}
|
||||
|
||||
void UDamageDown::OnEnemyTurn(AActor* Enemy, AActor* Character)
|
||||
{
|
||||
BaseDuration -= 1.0f;
|
||||
Super::OnEnemyTurn(Enemy, Character);
|
||||
if (BaseDuration <= 0.0f)
|
||||
{
|
||||
OnExpiry(Character);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "../StatusEffect.h"
|
||||
#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||
#include "DamageDown.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class THE_TWILIGHT_ABYSS_API UDamageDown : public UStatusEffect
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float EnemyDamageMultiplierDecreaseAmount = 0.2f;
|
||||
virtual void Invoke(AActor* Character, float TimeOfExpiry) override;
|
||||
virtual void OnExpiry(AActor* Character) override;
|
||||
virtual void OnEnemyTurn(AActor* Enemy, AActor* Character) override;
|
||||
|
||||
protected:
|
||||
ATurnBaseCombatV2* CombatSystem;
|
||||
};
|
@ -0,0 +1,26 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DamageDownPlayer.h"
|
||||
|
||||
void UDamageDownPlayer::Invoke(AActor* Character, float TimeOfExpiry)
|
||||
{
|
||||
CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
|
||||
CombatSystem->BaseDamageMultiplier -= PlayerDamageMultiplierDecreaseAmount;
|
||||
}
|
||||
|
||||
void UDamageDownPlayer::OnExpiry(AActor* Character)
|
||||
{
|
||||
Super::OnExpiry(Character);
|
||||
CombatSystem->BaseDamageMultiplier += PlayerDamageMultiplierDecreaseAmount;
|
||||
}
|
||||
|
||||
void UDamageDownPlayer::OnEnemyTurn(AActor* Enemy, AActor* Character)
|
||||
{
|
||||
BaseDuration -= 1.0f;
|
||||
Super::OnEnemyTurn(Enemy, Character);
|
||||
if (BaseDuration <= 0.0f)
|
||||
{
|
||||
OnExpiry(Character);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "../StatusEffect.h"
|
||||
#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||
#include "DamageDownPlayer.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class THE_TWILIGHT_ABYSS_API UDamageDownPlayer : public UStatusEffect
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float PlayerDamageMultiplierDecreaseAmount = 0.2f;
|
||||
virtual void Invoke(AActor* Character, float TimeOfExpiry) override;
|
||||
virtual void OnExpiry(AActor* Character) override;
|
||||
virtual void OnEnemyTurn(AActor* Enemy, AActor* Character) override;
|
||||
|
||||
protected:
|
||||
ATurnBaseCombatV2* CombatSystem;
|
||||
};
|
@ -23,10 +23,15 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
|
||||
{
|
||||
static ConstructorHelpers::FClassFinder<UUserWidget> HUDWidgetClass(TEXT("/Game/Blueprints/Combat_UI/Combat_UI"));
|
||||
HUDWidget = HUDWidgetClass.Class;
|
||||
|
||||
static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectThornsClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_Thorns"));
|
||||
ThornsStatusEffect = StatusEffectThornsClassFinder.Class;
|
||||
static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectDotClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_DamageOverTime"));
|
||||
DOTStatusEffect = StatusEffectDotClassFinder.Class;
|
||||
static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectDamageDownClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_DamageDown"));
|
||||
DamageDownStatusEffect = StatusEffectDamageDownClassFinder.Class;
|
||||
static ConstructorHelpers::FClassFinder<UStatusEffect> StatusEffectDamageDownPlayerClassFinder(TEXT("/Game/Blueprints/StatusEffects/BP_DamageDownPlayer"));
|
||||
DamageDownPlayerStatusEffect = StatusEffectDamageDownPlayerClassFinder.Class;
|
||||
|
||||
static ConstructorHelpers::FClassFinder<UUserWidget> DeathScreenWidgetClass(TEXT("/Game/Blueprints/Death_UI/Death_UI"));
|
||||
DeathScreenWidgetSubclass = DeathScreenWidgetClass.Class;
|
||||
@ -101,6 +106,7 @@ void ATurnBaseCombatV2::CombatCheck(const bool bWasShot)
|
||||
|
||||
ChainDamageMultiplier = 0;
|
||||
BaseDamageMultiplier = DefaultBaseDamageMultiplier;
|
||||
EnemyBaseDamageMultiplier = DefaultEnemyBaseDamageMultiplier;
|
||||
if (bIsBuffed) BaseDamageMultiplier += 1.0f;
|
||||
DamageMultiplierTextBlock->SetText(FText::FromString(""));
|
||||
|
||||
@ -302,6 +308,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
|
||||
}
|
||||
if (IsSpecialCombo(Combo))
|
||||
{
|
||||
FOutputDeviceNull AR;
|
||||
UStatusSystem* StatusSystem = Cast<UStatusSystem>(PlayerActor->GetComponentByClass(UStatusSystem::StaticClass()));
|
||||
if (Combo == "PA")
|
||||
{
|
||||
@ -309,6 +316,9 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
|
||||
StatusSystem->AddStatusEffect(TempThornsStatusEffect, 1, false);
|
||||
StatusEffects.Add(TempThornsStatusEffect);
|
||||
AddBattleLogMessage("Player Casted Thorns");
|
||||
StatusTextBlock->SetText(FText::FromString("Casted Thorns"));
|
||||
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
|
||||
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
}
|
||||
else if (Combo == "PI")
|
||||
{
|
||||
@ -316,6 +326,19 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
|
||||
StatusSystem->AddStatusEffect(TempDOTStatusEffect, 1, false);
|
||||
StatusEffects.Add(TempDOTStatusEffect);
|
||||
AddBattleLogMessage("Player Casted DOT");
|
||||
StatusTextBlock->SetText(FText::FromString("Casted DOT"));
|
||||
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
|
||||
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
}
|
||||
else if (Combo == "AI")
|
||||
{
|
||||
UStatusEffect* TempDamageDownStatusEffect = NewObject<UStatusEffect>(PlayerActor, DamageDownStatusEffect);
|
||||
StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1);
|
||||
StatusEffects.Add(TempDamageDownStatusEffect);
|
||||
AddBattleLogMessage("Player Casted DamageDown");
|
||||
StatusTextBlock->SetText(FText::FromString("Enemy Damage Down"));
|
||||
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
|
||||
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,12 +419,12 @@ void ATurnBaseCombatV2::RevertActionPoints()
|
||||
void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType)
|
||||
{
|
||||
FOutputDeviceNull AR;
|
||||
*PlayerHealth -= FMath::Clamp(Damage * BaseDefenseMultiplier, 0, 100);
|
||||
DamageAmountPlayerTextBlock->SetText(FText::FromString("-" + FString::FromInt(Damage * BaseDefenseMultiplier)));
|
||||
*PlayerHealth -= FMath::Clamp(Damage * EnemyBaseDamageMultiplier, 0, 100);
|
||||
DamageAmountPlayerTextBlock->SetText(FText::FromString("-" + FString::FromInt(Damage * EnemyBaseDamageMultiplier)));
|
||||
const FString Command3 = FString::Printf(TEXT("PlayDamagePlayerTextAnimation"));
|
||||
BookHUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
UpdateProgressBars();
|
||||
AddBattleLogMessage("Player was damaged for " + FString::FromInt(Damage * BaseDefenseMultiplier) + " HP by " + DamageType + ".");
|
||||
AddBattleLogMessage("Player was damaged for " + FString::FromInt(Damage * EnemyBaseDamageMultiplier) + " HP by " + DamageType + ".");
|
||||
if (*EnemyHealth <= 0)
|
||||
{
|
||||
EndCombat();
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
bool bIsInCombat = false;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UPROPERTY()
|
||||
float BaseDamageMultiplier = 1.0f;
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float BaseDefenseMultiplier = 1.0f;
|
||||
@ -41,6 +41,11 @@ public:
|
||||
UPROPERTY(EditAnywhere)
|
||||
float ChainDamageMultiplierIncrease = 0.2f;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float EnemyBaseDamageMultiplier = 1.0f;
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
float DefaultEnemyBaseDamageMultiplier = 1.0f;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
int DefaultActionPoints = 2;
|
||||
UPROPERTY()
|
||||
@ -99,7 +104,8 @@ public:
|
||||
TMap<FString, FString> SpecialCombos =
|
||||
{
|
||||
{"PA", "Thorns"},
|
||||
{"PI", "DamageOverTime"}
|
||||
{"PI", "DamageOverTime"},
|
||||
{"AI", "DamageDown"}
|
||||
};
|
||||
|
||||
FString BattleLog;
|
||||
@ -145,6 +151,10 @@ private:
|
||||
TSubclassOf<UStatusEffect> ThornsStatusEffect;
|
||||
UPROPERTY()
|
||||
TSubclassOf<UStatusEffect> DOTStatusEffect;
|
||||
UPROPERTY()
|
||||
TSubclassOf<UStatusEffect> DamageDownStatusEffect;
|
||||
UPROPERTY()
|
||||
TSubclassOf<UStatusEffect> DamageDownPlayerStatusEffect;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<UStatusEffect*> StatusEffects;
|
||||
|
Loading…
Reference in New Issue
Block a user