Bugfix Status Effects not Correctly Being Reset on Dupe
This commit is contained in:
parent
36834676e8
commit
4bba8fc1eb
@ -40,17 +40,19 @@ void UStatusSystem::TickComponent(float DeltaTime, ELevelTick TickType, FActorCo
|
||||
|
||||
void UStatusSystem::AddStatusEffect(UStatusEffect* StatusEffect, const float DurationMultiplier, const bool Invoke)
|
||||
{
|
||||
for (FActiveStatusEffect ActiveStatusEffect : ActiveStatusEffects)
|
||||
TArray<UStatusEffect*> ToExpire;
|
||||
for (const FActiveStatusEffect& ActiveStatusEffect : ActiveStatusEffects)
|
||||
{
|
||||
if (ActiveStatusEffect.StatusEffect->Name == StatusEffect->Name)
|
||||
{
|
||||
ActiveStatusEffect.TimeTillExpiry = StatusEffect->BaseDuration * DurationMultiplier;
|
||||
UTextBlock* StatusText = Cast<UTextBlock>(ActiveStatusEffect.StatusIcon->GetWidgetFromName(TEXT("DurationText")));
|
||||
StatusText->SetText(FText::FromString(FString::FromInt(ActiveStatusEffect.TimeTillExpiry)));
|
||||
if (Invoke) ActiveStatusEffect.StatusEffect->Invoke(GetOwner(), ActiveStatusEffect.TimeTillExpiry);
|
||||
return;
|
||||
ToExpire.Add(ActiveStatusEffect.StatusEffect);
|
||||
}
|
||||
}
|
||||
for (UStatusEffect* StatusEffectToExpire : ToExpire)
|
||||
{
|
||||
StatusEffectToExpire->OnExpiry(GetOwner());
|
||||
}
|
||||
ToExpire.Empty();
|
||||
FActiveStatusEffect NewStatusEffect;
|
||||
NewStatusEffect.StatusEffect = StatusEffect;
|
||||
NewStatusEffect.TimeInitiated = UGameplayStatics::GetRealTimeSeconds(GetWorld());
|
||||
|
Loading…
Reference in New Issue
Block a user