52 lines
1.8 KiB
C#
52 lines
1.8 KiB
C#
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|