Files
SoulliesOfficial ac98ec3aef 更新
2026-04-17 12:01:50 -04:00

52 lines
1.8 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Continentis.MainGame;
using Continentis.MainGame.Character;
using SLSUtilities.General;
namespace Continentis.Mods.Basic.Buffs
{
/// <summary>
/// 地缚Earth 元素):行动开始时固定减少 1 点体力(不随层数变化),然后层数 -1。
/// 层数决定持续时间(多少回合会减少体力),不决定每次削减量。
/// </summary>
public sealed class Earthbind : CharacterCombatBuffBase
{
public Earthbind(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("Earthbind", new PrioritizedAction(OnActionStart));
}
private void OnActionStart()
{
// 固定减少 1 体力Clamp 至 0
attachedCharacter.ModifyAndClampAttribute(CharacterAttributes.Stamina, -1);
unitedStackSubmodule.ReduceStack(1);
iconSubmodule.Update();
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText(
contentSubmodule.displayName, attachedCharacter.characterView);
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.unitedStackSubmodule.AddStack(this.unitedStackSubmodule.stackAmount);
return false;
}
return true;
}
}
}