diff --git a/Content/Levels/Build.umap b/Content/Levels/Build.umap index 77b5f30..6630526 100644 --- a/Content/Levels/Build.umap +++ b/Content/Levels/Build.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:329ee864d819adfc479748456fcd9c39237eb2a81b684567a78cc6f39b67a120 +oid sha256:5ede46e78730fddc11f0f66363ef87e76e955dbbb7c35f27cdd0ba0b405d45bc size 5331476 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/StatusEffect.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/StatusEffect.cpp index 6f180ea..4bc6240 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/StatusEffect.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/StatusEffect.cpp @@ -52,7 +52,8 @@ void UStatusEffect::TickDown(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); UStatusSystem* StatusSystem = Cast(Character->GetComponentByClass(UStatusSystem::StaticClass())); if (StatusSystem->GetActiveStatusEffect(this).StatusIcon == nullptr) return; diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index a746440..6bd962f 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -459,6 +459,12 @@ void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType) { const FString Command = FString::Printf(TEXT("TriggerDeathAnimation")); EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true); + for (UStatusEffect* StatusEffect : StatusEffects) + { + StatusEffect->OnExpiry(PlayerActor); + StatusEffect->BeginDestroy(); + } + StatusEffects.Empty(); return; } EndCombat(); @@ -512,6 +518,12 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, const FString& DamageType) { const FString Command2 = FString::Printf(TEXT("TriggerDeathAnimation")); EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true); + for (UStatusEffect* StatusEffect : StatusEffects) + { + StatusEffect->OnExpiry(PlayerActor); + StatusEffect->BeginDestroy(); + } + StatusEffects.Empty(); return; } EndCombat(); @@ -799,6 +811,7 @@ void ATurnBaseCombatV2::EnableButtons() const void ATurnBaseCombatV2::EnemyTurn() { if (!IsValid(EnemyActor)) return; + if (EnemyHealth <= nullptr) return; int ChanceToMiss; FProperty* IsBossProperty = FindFieldChecked(EnemyActor->GetClass(), "IsBoss"); const FBoolProperty* IsBossBoolProperty = CastFieldChecked(IsBossProperty);