using Continentis.MainGame; using Continentis.MainGame.Character; using SLSFramework.General; using UnityEngine; namespace Continentis.Mods.Basic.Buffs { public class CounterAttack : CharacterCombatBuffBase { public CounterAttack(int stack) { Initialize(BuffType.Positive, BuffDispelLevel.Strong); this.contentSubmodule = new ContentSubmodule(this) .AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString()); this.iconSubmodule = new IconSubmodule(this); this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, true); this.eventSubmodule = new EventSubmodule(this); this.eventSubmodule.onGetAttacked.Add(this.GetType().FullName, new PrioritizedAction(atkResult => { attachedCharacter.Attack(atkResult.attacker, unitedStackSubmodule.stackAmount, null, false, true); })); } public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff) { MainGameManager.Instance.basePrefabs.GenerateInfoText("Counter Attack", attachedCharacter.characterView); if (FindExistingSameBuff(out existingBuff)) { existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount); return false; } return true; } } }