AmbushStance

This commit is contained in:
FrazeRIP
2025-11-10 23:56:25 -06:00
parent b8f3e47edf
commit 01f4f3c76d
12 changed files with 181 additions and 35 deletions

View File

@@ -0,0 +1,42 @@
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;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ea92fd3a2cd5a524db12d16fad06ab7b

View File

@@ -1,18 +1,12 @@
using Continentis.MainGame;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using Continentis.Mods.Basic.Buffs;
using SLSFramework.General;
using System.Collections.Generic;
using SLSFramework.UModAssistance;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public class KnifeTrick : CharacterCombatBuffBase
{
private bool _canTrigger = false;
public KnifeTrick(int stack)
{
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
@@ -21,7 +15,7 @@ namespace Continentis.Mods.Basic.Buffs
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onOtherBuffRemoved.Add("KnifeTrick_AddSharpness", new PrioritizedAction<BuffBase<CharacterBase>>((buff) =>
{
if (buff is Sharpness)
@@ -31,25 +25,6 @@ namespace Continentis.Mods.Basic.Buffs
CreateCharacterBuff<Sharpness>(unitedStackSubmodule.stackAmount).Apply(attachedCharacter, attachedCharacter);
}
}));
//TODO: Event listener for adding/removing buffs
//this.eventSubmodule.onPreAttack.Add("KnifeTrick", new PrioritizedAction<int>((damage) =>
//{
// if (this.attachedCharacter.combatBuffSubmodule.HasBuff<Sharpness>())
// {
// _canTrigger = true;
// }
//}));
//this.eventSubmodule.onDealAttack.Add("KnifeTrick", new PrioritizedAction<AttackResult>((result) =>
//{
// if (_canTrigger)
// {
// CreateCharacterBuff<Sharpness>(this.unitedStackSubmodule.stackAmount).Apply(this.attachedCharacter, this.attachedCharacter);
// _canTrigger = false;
// }
//}));
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)