- all effects now properly scale with stats, making it possible to scale with multiple stats
90 lines
2.5 KiB
C#
90 lines
2.5 KiB
C#
using Photon.Pun;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DamageIncomeModifierEffectInstance : StatusEffectInstance
|
|
{
|
|
|
|
public float startingIncomeModifierPercent;
|
|
|
|
public float currentIncomeModifierPercent;
|
|
|
|
|
|
public float ModifyDamageIncome(float income)
|
|
{
|
|
return income = income * (1 + currentIncomeModifierPercent);
|
|
}
|
|
|
|
public float GetHighestAmount()
|
|
{
|
|
float highestAmount = 0;
|
|
for (int i = 0; i < activeStacks.Count; i++)
|
|
{
|
|
if (((DamageIncomeModifierEffect)activeStacks[i]).damageIncomeModifierPercentage > highestAmount)
|
|
highestAmount = ((DamageIncomeModifierEffect)activeStacks[i]).damageIncomeModifierPercentage;
|
|
}
|
|
|
|
return highestAmount;
|
|
}
|
|
|
|
[PunRPC]
|
|
public void RPC_ApplyDamageIncomeModifierEffect(int effectIndex, float value)
|
|
{
|
|
ApplyEffect(StatusEffectIndexer.Instance.StatusEffects[effectIndex], value);
|
|
}
|
|
|
|
public override void ApplyEffect(StatusEffect effect, float value)
|
|
{
|
|
base.ApplyEffect(effect, value);
|
|
}
|
|
|
|
protected override void AddStack(StatusEffect addedEffect, float value)
|
|
{
|
|
if (activeStacks.Count <= 0)
|
|
{
|
|
startingIncomeModifierPercent = ((DamageIncomeModifierEffect)addedEffect).damageIncomeModifierPercentage;
|
|
currentIncomeModifierPercent = startingIncomeModifierPercent;
|
|
}
|
|
else if (canStack && !activeStacks.Contains(addedEffect))
|
|
{
|
|
currentIncomeModifierPercent += ((DamageIncomeModifierEffect)addedEffect).damageIncomeModifierPercentage;
|
|
}
|
|
else
|
|
{
|
|
OnEffectStackAdded();
|
|
return;
|
|
}
|
|
|
|
base.AddStack(addedEffect, value);
|
|
}
|
|
|
|
protected override void RefreshEffect(StatusEffect effect, float value)
|
|
{
|
|
base.RefreshEffect(effect, value);
|
|
|
|
startingIncomeModifierPercent = GetHighestAmount();
|
|
currentIncomeModifierPercent = startingIncomeModifierPercent;
|
|
|
|
OnEffectStackAdded();
|
|
}
|
|
|
|
protected override IEnumerator EffectStateCoroutine()
|
|
{
|
|
return base.EffectStateCoroutine();
|
|
}
|
|
|
|
protected override void EffectStateStarted()
|
|
{
|
|
base.EffectStateStarted();
|
|
}
|
|
|
|
protected override void EffectStateEnded()
|
|
{
|
|
startingIncomeModifierPercent = 0;
|
|
currentIncomeModifierPercent = startingIncomeModifierPercent;
|
|
|
|
base.EffectStateEnded();
|
|
}
|
|
}
|