Bugfix If Buff Active and Boss Dead Crashes Game
This commit is contained in:
parent
81a306f7b0
commit
3a68c22449
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
BIN
Content/Levels/Build.umap
(Stored with Git LFS)
Binary file not shown.
@ -52,7 +52,8 @@ void UStatusEffect::TickDown(AActor* Character)
|
|||||||
|
|
||||||
void UStatusEffect::CheckForExpiry(const float TimeOfExpiry, AActor* Character)
|
void UStatusEffect::CheckForExpiry(const float TimeOfExpiry, AActor* Character)
|
||||||
{
|
{
|
||||||
if (IsValid(Character)) return;
|
if (!IsValid(this)) return;
|
||||||
|
if (!IsValid(Character)) return;
|
||||||
if (TimeOfExpiry <= UGameplayStatics::GetRealTimeSeconds(GetWorld())) OnExpiry(Character);
|
if (TimeOfExpiry <= UGameplayStatics::GetRealTimeSeconds(GetWorld())) OnExpiry(Character);
|
||||||
UStatusSystem* StatusSystem = Cast<UStatusSystem>(Character->GetComponentByClass(UStatusSystem::StaticClass()));
|
UStatusSystem* StatusSystem = Cast<UStatusSystem>(Character->GetComponentByClass(UStatusSystem::StaticClass()));
|
||||||
if (StatusSystem->GetActiveStatusEffect(this).StatusIcon == nullptr) return;
|
if (StatusSystem->GetActiveStatusEffect(this).StatusIcon == nullptr) return;
|
||||||
|
@ -459,6 +459,12 @@ void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType)
|
|||||||
{
|
{
|
||||||
const FString Command = FString::Printf(TEXT("TriggerDeathAnimation"));
|
const FString Command = FString::Printf(TEXT("TriggerDeathAnimation"));
|
||||||
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||||
|
for (UStatusEffect* StatusEffect : StatusEffects)
|
||||||
|
{
|
||||||
|
StatusEffect->OnExpiry(PlayerActor);
|
||||||
|
StatusEffect->BeginDestroy();
|
||||||
|
}
|
||||||
|
StatusEffects.Empty();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EndCombat();
|
EndCombat();
|
||||||
@ -512,6 +518,12 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, const FString& DamageType)
|
|||||||
{
|
{
|
||||||
const FString Command2 = FString::Printf(TEXT("TriggerDeathAnimation"));
|
const FString Command2 = FString::Printf(TEXT("TriggerDeathAnimation"));
|
||||||
EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true);
|
EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true);
|
||||||
|
for (UStatusEffect* StatusEffect : StatusEffects)
|
||||||
|
{
|
||||||
|
StatusEffect->OnExpiry(PlayerActor);
|
||||||
|
StatusEffect->BeginDestroy();
|
||||||
|
}
|
||||||
|
StatusEffects.Empty();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EndCombat();
|
EndCombat();
|
||||||
@ -799,6 +811,7 @@ void ATurnBaseCombatV2::EnableButtons() const
|
|||||||
void ATurnBaseCombatV2::EnemyTurn()
|
void ATurnBaseCombatV2::EnemyTurn()
|
||||||
{
|
{
|
||||||
if (!IsValid(EnemyActor)) return;
|
if (!IsValid(EnemyActor)) return;
|
||||||
|
if (EnemyHealth <= nullptr) return;
|
||||||
int ChanceToMiss;
|
int ChanceToMiss;
|
||||||
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
||||||
const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty);
|
const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty);
|
||||||
|
Loading…
Reference in New Issue
Block a user