Bugfix Crash on Boss Kill

This commit is contained in:
Philip W 2023-05-14 21:09:34 +01:00
parent 279c0dc7d8
commit 027a48bbec
5 changed files with 6 additions and 10 deletions

View File

@ -5,12 +5,13 @@
void UDamageDown::Invoke(AActor* Character, float TimeOfExpiry)
{
CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
CombatSystem->EnemyBaseDamageMultiplier -= EnemyDamageMultiplierDecreaseAmount;
}
void UDamageDown::OnExpiry(AActor* Character)
{
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
CombatSystem->EnemyBaseDamageMultiplier += EnemyDamageMultiplierDecreaseAmount;
Super::OnExpiry(Character);
}

View File

@ -21,7 +21,4 @@ public:
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;
};

View File

@ -5,12 +5,13 @@
void UDamageDownPlayer::Invoke(AActor* Character, float TimeOfExpiry)
{
CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
CombatSystem->BaseDamageMultiplier -= PlayerDamageMultiplierDecreaseAmount;
}
void UDamageDownPlayer::OnExpiry(AActor* Character)
{
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
CombatSystem->BaseDamageMultiplier += PlayerDamageMultiplierDecreaseAmount;
Super::OnExpiry(Character);
}

View File

@ -21,7 +21,4 @@ public:
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;
};

View File

@ -344,7 +344,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo)
else if (Combo == "AI")
{
UStatusEffect* TempDamageDownStatusEffect = NewObject<UStatusEffect>(PlayerActor, DamageDownStatusEffect);
StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1);
StatusSystem->AddStatusEffect(TempDamageDownStatusEffect, 1, true);
StatusEffects.Add(TempDamageDownStatusEffect);
AddBattleLogMessage("Player Casted DamageDown");
StatusTextBlock->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f)));
@ -789,7 +789,7 @@ void ATurnBaseCombatV2::EnemyTurn()
else ChanceToMiss = 30;
if (FMath::RandRange(1, 100) > ChanceToMiss)
{
if (IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor) && FMath::RandRange(1, 100) > 10)
if (IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor) && FMath::RandRange(1, 100) <= 10)
{
FOutputDeviceNull AR;
UStatusSystem* StatusSystem = Cast<UStatusSystem>(PlayerActor->GetComponentByClass(UStatusSystem::StaticClass()));