OnOtherBuffApply/Remove监听

This commit is contained in:
SoulliesOfficial
2025-11-10 12:57:04 -05:00
parent 41a0990600
commit 0e66d4d0dd
29 changed files with 321 additions and 27 deletions

View File

@@ -4,10 +4,12 @@ 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, IBuffExtension_IntegerRange
public class KnifeTrick : CharacterCombatBuffBase
{
private bool _canTrigger = false;
@@ -17,10 +19,21 @@ namespace Continentis.Mods.Basic.Buffs
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.onOtherBuffRemoved.Add("KnifeTrick_AddSharpness", new PrioritizedAction<BuffBase<CharacterBase>>((buff) =>
{
if (buff is Sharpness)
{
Debug.Log("Knife Trick observed Sharpness buff removal, adding new Sharpness buff.");
Debug.Log("Stack amount: " + unitedStackSubmodule.stackAmount);
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>())
@@ -37,8 +50,6 @@ namespace Continentis.Mods.Basic.Buffs
// _canTrigger = false;
// }
//}));
(this as IBuffExtension_IntegerRange).Initialize(stack);
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)

View File

@@ -156,11 +156,11 @@ MonoBehaviour:
index: 24
isKeyDuplicated: 0
- Key: DeckCapacity
Value: 10
Value: 15
index: 25
isKeyDuplicated: 0
- Key: DrawCardAmountPerAction
Value: 10
Value: 15
index: 26
isKeyDuplicated: 0
- Key: Awareness
@@ -212,5 +212,6 @@ MonoBehaviour:
- CardData_Basic_BladeOfFear
- CardData_Basic_Backstab
- CardData_Basic_FlashTerror
- CardData_Basic_Strike
hudDataRefs:
- HUDData_Basic_Default