using System.Collections.Generic; using Continentis.MainGame; using Continentis.MainGame.Card; using Continentis.MainGame.Character; using SLSFramework.General; using UnityEngine; namespace Continentis.Mods.Basic.Buffs { public sealed class Bleed : CharacterCombatBuffBase { public Bleed(int stack) { Initialize(BuffType.Negative, BuffDispelLevel.Basic); this.contentSubmodule = new ContentSubmodule(this) .AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString()); this.iconSubmodule = new IconSubmodule(this); this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack); this.eventSubmodule = new EventSubmodule(this); this.eventSubmodule.onActionStart.Add("Bleed", new EventUnit(OnActionStart)); this.eventSubmodule.onGetAttacked.Add("Bleed", new EventUnit(OnGetAttacked)); } private void OnGetAttacked(AttackResult result) { int stackAmount = unitedStackSubmodule.stackAmount; result.attacker.Attack(attachedCharacter, stackAmount, true); } private void OnActionStart() { int reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.5f)); unitedStackSubmodule.ReduceStack(reducedStack); iconSubmodule.Update(); } } }