84 lines
2.2 KiB
C#
84 lines
2.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DamageOutputModifierEffectInstance : StatusEffectInstance
|
|
{
|
|
|
|
public float startingOutputModifierPercent;
|
|
|
|
public float currentOutputModifierPercent;
|
|
|
|
|
|
public float ModifyDamageOutput(float output)
|
|
{
|
|
return output = output * (1 + currentOutputModifierPercent);
|
|
}
|
|
|
|
public float GetHighestAmount(float value)
|
|
{
|
|
float highestAmount = value;
|
|
for (int i = 0; i < activeStacks.Count; i++)
|
|
{
|
|
if (((DamageOutputModifierEffect)activeStacks[i]).damageOutputModifierPercentage > highestAmount)
|
|
highestAmount = ((DamageOutputModifierEffect)activeStacks[i]).damageOutputModifierPercentage;
|
|
}
|
|
|
|
return highestAmount;
|
|
}
|
|
|
|
|
|
public override void ApplyEffect(StatusEffect effect, float value)
|
|
{
|
|
base.ApplyEffect(effect, value);
|
|
}
|
|
|
|
protected override void AddStack(StatusEffect addedEffect, float value)
|
|
{
|
|
if (activeStacks.Count <= 0)
|
|
{
|
|
startingOutputModifierPercent = value;
|
|
currentOutputModifierPercent = value;
|
|
}
|
|
else if (canStack && (!activeStacks.Contains(addedEffect) || addedEffect.canApplyMultipleInstances))
|
|
{
|
|
currentOutputModifierPercent += value;
|
|
}
|
|
else
|
|
{
|
|
OnEffectStackAdded();
|
|
return;
|
|
}
|
|
|
|
base.AddStack(addedEffect, value);
|
|
}
|
|
|
|
protected override void RefreshEffect(StatusEffect effect, float value)
|
|
{
|
|
base.RefreshEffect(effect, value);
|
|
|
|
startingOutputModifierPercent = GetHighestAmount(value);
|
|
currentOutputModifierPercent = startingOutputModifierPercent;
|
|
|
|
OnEffectStackAdded();
|
|
}
|
|
|
|
protected override IEnumerator EffectStateCoroutine()
|
|
{
|
|
return base.EffectStateCoroutine();
|
|
}
|
|
|
|
protected override void EffectStateStarted()
|
|
{
|
|
base.EffectStateStarted();
|
|
}
|
|
|
|
protected override void EffectStateEnded()
|
|
{
|
|
startingOutputModifierPercent = 0;
|
|
currentOutputModifierPercent = startingOutputModifierPercent;
|
|
|
|
base.EffectStateEnded();
|
|
}
|
|
}
|