using Continentis.MainGame; using Continentis.MainGame.Card; using Continentis.MainGame.Character; using Continentis.Mods.Basic.Buffs; using SLSFramework.General; using System.Collections.Generic; namespace Continentis.Mods.Basic.Buffs { public class KnifeTrick : CharacterCombatBuffBase, IBuffExtension_IntegerRange { private bool _canTrigger = false; public KnifeTrick(int stack) { Initialize(BuffType.Positive, BuffDispelLevel.Strong); this.contentSubmodule = new ContentSubmodule(this, false) .AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString()); this.iconSubmodule = new IconSubmodule(this); this.eventSubmodule = new EventSubmodule(this); //TODO: Event listener for adding/removing buffs //this.eventSubmodule.onPreAttack.Add("KnifeTrick", new PrioritizedAction((damage) => //{ // if (this.attachedCharacter.combatBuffSubmodule.HasBuff()) // { // _canTrigger = true; // } //})); //this.eventSubmodule.onDealAttack.Add("KnifeTrick", new PrioritizedAction((result) => //{ // if (_canTrigger) // { // CreateCharacterBuff(this.unitedStackSubmodule.stackAmount).Apply(this.attachedCharacter, this.attachedCharacter); // _canTrigger = false; // } //})); (this as IBuffExtension_IntegerRange).Initialize(stack); } public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff) { MainGameManager.Instance.basePrefabs.GenerateInfoText("Knife Trick", attachedCharacter.characterView); if (FindExistingSameBuff(out existingBuff)) { existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount); int newStack = existingBuff.unitedStackSubmodule.stackAmount; existingBuff.coreAttributeSubmodule.numericChange["DodgeChanceOffset"] = newStack; return false; } return true; } } }