RiftMayhem/Assets/Scripts/EntityBroker/PassiveEffectsApplicator.cs

24 lines
771 B
C#

using UnityEngine;
public class PassiveEffectsApplicator : BrokerInterceptor
{
protected override void Awake()
{
base.Awake();
broker.OnOutgoingDamage.Subscribe(HandlePassiveAccumulatedAmplification, GameConstants.BrokerEventPriority.PassiveAmplificationApplicator);
broker.OnIncomingDamage.Subscribe(HandlePassiveAccumulatedMitigation, GameConstants.BrokerEventPriority.PassiveMitigationApplicator);
}
private void HandlePassiveAccumulatedAmplification(DamageArgs args)
{
args.currentValue = args.currentValue * (1 + args.outgoingAccumulator);
}
private void HandlePassiveAccumulatedMitigation(DamageArgs args)
{
args.currentValue = args.currentValue * (1 + args.incomingAccumulator);
}
}