FGAActiveDuration::FGAActiveDuration(const FGAEffectContext& ContextIn, FGAEffectSpec& SpecIn, const FGAEffectHandle& HandleIn) // : Context(ContextIn) { AggregationType = SpecIn.Policy.Aggregation; Stacking = SpecIn.Policy.Stacking; EffectName = SpecIn.EffectName; Duration = SpecIn.EffectDuration.Duration; Period = SpecIn.EffectDuration.Period; MyHandle = HandleIn; Context = ContextIn; //OwnedTags = SpecIn.EffectTags; InitialAttribute = SpecIn.GetInitialAttribute(); DurationAttribute = SpecIn.GetDurationAttribute(); PeriodModifiers = SpecIn.GetPeriodAttribute(); //we probabaly want to recalculate it on every tick ////if effect. RemovedAttribute = SpecIn.GetRemovedAttribute(); ExpiredAttribute = SpecIn.GetExpiredAttribute(); }
FGAActiveDuration::FGAActiveDuration(const FGAEffectContext& ContextIn, FGAEffectSpec& SpecIn, const FGAEffectHandle& HandleIn) // : Context(ContextIn) { EffectSpec = SpecIn.EffectSpec; AggregationType = SpecIn.Policy.Aggregation; Stacking = SpecIn.Policy.Stacking; EffectName = SpecIn.EffectName; Duration = SpecIn.EffectDuration.Duration; Period = SpecIn.EffectDuration.Period; MyHandle = HandleIn; Context = ContextIn; CalculationType = SpecIn.EffectSpec->CalculationType; //OwnedTags = SpecIn.EffectTags; RemovedAttribute = SpecIn.GetRemovedAttribute(); ExpiredAttribute = SpecIn.GetExpiredAttribute(); }
FGAEffectHandle FGAActiveEffectContainer::AddActiveEffect(FGAEffectSpec& EffectIn, const FGAEffectContext& Ctx) { FGAEffectHandle handle = FGAEffectHandle::GenerateHandle(); TSharedPtr<FGAActiveDuration> tempPeriodic = MakeShareable(new FGAActiveDuration(Ctx, EffectIn, handle)); tempPeriodic->ActivateEffect(); FGAActiveEffect activeEffect(handle, EffectIn, Ctx.Target->GetWorld()->GetTimeSeconds(), EffectIn.EffectSpec->UIData, EffectIn.EffectSpec->EffectCue); activeEffect.Duration = EffectIn.EffectSpec->EffectDuration.Duration; activeEffect.Period = EffectIn.EffectSpec->EffectDuration.Period; RepActiveEffects.Add(activeEffect); for (const FGAEffectModifierSpec& ad : EffectIn.GetEffectModifiers()) { ModifierContainer.AddModifier(ad, EffectIn.EffectSpec->RequiredTags, handle, tempPeriodic); } ActiveEffects.Add(handle, tempPeriodic); return handle; }
FGAEffectHandle UGAAttributeComponent::ApplySelfEffect(AActor* Target, APawn* Instigator, UObject* Causer, FGAEffectSpec SpecIn) { UE_LOG(GameAttributesEffects, Log, TEXT("Apply effect to self: %f , Effect: %d"), *GetOwner()->GetName(), *SpecIn.GetNameAsString()); //this is bad btw. I need to change it. LAter. IIGAAttributes* targetAttr = Cast<IIGAAttributes>(Target); IIGAAttributes* instiAttr = Cast<IIGAAttributes>(Instigator); if (!targetAttr || !instiAttr) return FGAEffectHandle(); UGAAttributeComponent* targetComp = targetAttr->GetAttributeComponent(); UGAAttributeComponent* instiComp = instiAttr->GetAttributeComponent(); FGAEffectContext context(Target->GetActorLocation(), Target, Causer, Instigator, targetComp, instiComp); SpecIn.Context = context; //SpecIn.GetModifiers(); return FGAEffectHandle(); // ActiveEffects.ApplyEffect(SpecIn, context); }
FGAEffectInstant::FGAEffectInstant(FGAEffectSpec& SpecIn, const FGAEffectContext& ContextIn) { InitialAttribute = SpecIn.GetInitialAttribute(); Context = ContextIn; }