using System; using Continentis.MainGame; using Continentis.MainGame.Character; using SLSFramework.General; using UnityEngine; namespace Continentis.Mods.Basic.Buffs { public sealed class Resonance : CharacterCombatBuffBase, IBuffExtension_IntegerRange { public Func GetDescription { get; set; } public Resonance(int stack) { Initialize(BuffType.Positive, BuffDispelLevel.Strong); this.contentSubmodule = new ContentSubmodule(this,false) .AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString()); this.iconSubmodule = new IconSubmodule(this); this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, true); this.generalAttributeSubmodule = new GeneralAttributeSubmodule(this); this.generalAttributeSubmodule.numericChange.Add("MagicDamageDealtOffset", stack); (this as IBuffExtension_IntegerRange).Initialize(stack); } public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff) { MainGameManager.Instance.basePrefabs.GenerateInfoText("Resonance", attachedCharacter.characterView); if (FindExistingSameBuff(out existingBuff)) { existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount); int newStack = existingBuff.unitedStackSubmodule.stackAmount; existingBuff.generalAttributeSubmodule.numericChange["MagicDamageDealtOffset"] = newStack; return false; } return true; } public void OnBecomePositive() { contentSubmodule.originalFunctionText = "Buff_Basic_Resonance_FunctionTextPos".Localize(); buffType = BuffType.Positive; iconSubmodule.Update(); } public void OnBecomeNegative() { contentSubmodule.originalFunctionText = "Buff_Basic_Resonance_FunctionTextNeg".Localize(); buffType = BuffType.Negative; iconSubmodule.Update(); } } }