43 lines
1.8 KiB
C#
43 lines
1.8 KiB
C#
using Continentis.MainGame;
|
|
using Continentis.MainGame.Card;
|
|
using Continentis.MainGame.Character;
|
|
using SLSFramework.General;
|
|
using System.Collections.Generic;
|
|
using static UnityEngine.GraphicsBuffer;
|
|
|
|
namespace Continentis.Mods.Basic.Buffs
|
|
{
|
|
public class AmbushStance : CharacterCombatBuffBase
|
|
{
|
|
public AmbushStance(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, stack);
|
|
this.eventSubmodule = new EventSubmodule(this);
|
|
this.eventSubmodule.onBeforePlayCard.Add("AmbushStance", new PrioritizedAction<CardInstance, List<CharacterBase>>(((card, targets) =>
|
|
{
|
|
if (this.attachedCharacter is PlayerHero player)
|
|
{
|
|
CreateCharacterBuff<Buffs.Sharpness>(this.unitedStackSubmodule.stackAmount).Apply(attachedCharacter, attachedCharacter);
|
|
}
|
|
})));
|
|
}
|
|
|
|
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
|
{
|
|
MainGameManager.Instance.basePrefabs.GenerateInfoText("Ambush Stance", 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;
|
|
}
|
|
}
|
|
}
|