36 lines
937 B
C#
36 lines
937 B
C#
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class DamageIncomeModifierRuntimeEffectInstance : RuntimeEffectInstance
|
|
{
|
|
public float damageIncomeModifierPercentage;
|
|
|
|
|
|
public override void OnEffectFirstApplied(int numberOfStacksApplied)
|
|
{
|
|
base.OnEffectFirstApplied(numberOfStacksApplied);
|
|
|
|
//apply damage amp buff
|
|
user.Broker.OnIncomingDamage.Subscribe(ModifyIncomingDamage, GameConstants.BrokerEventPriority.TemporaryMitigationMods);
|
|
}
|
|
|
|
public override void OnEffectRemoved()
|
|
{
|
|
base.OnEffectRemoved();
|
|
|
|
//remove damage amp buff
|
|
user.Broker.OnIncomingDamage.Unsubscribe(ModifyIncomingDamage);
|
|
}
|
|
|
|
private void ModifyIncomingDamage(DamageArgs args)
|
|
{
|
|
args.currentValue = args.currentValue * (1 + damageIncomeModifierPercentage);
|
|
}
|
|
|
|
|
|
public new void Reset()
|
|
{
|
|
base.Reset();
|
|
damageIncomeModifierPercentage = 0f;
|
|
}
|
|
} |