58 lines
2.2 KiB
C#
58 lines
2.2 KiB
C#
using Continentis.MainGame;
|
||
using Continentis.MainGame.Character;
|
||
using SLSUtilities.General;
|
||
|
||
namespace Continentis.Mods.Basic.Buffs
|
||
{
|
||
/// <summary>
|
||
/// 蛊咒(Darkness 元素):被动削减承载者的治疗效果 33%(固定值,不随层数变化)。
|
||
/// 每回合结束时层数 -1,层数归零后自动移除,治疗倍率同时恢复正常。
|
||
/// 层数仅决定持续时间,不影响削减幅度。
|
||
/// </summary>
|
||
public sealed class Hex : CharacterCombatBuffBase
|
||
{
|
||
private const float HEALING_REDUCTION = -0.33f;
|
||
|
||
public Hex(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);
|
||
|
||
// 被动属性:治疗效果 -33%(通过 generalAttributeSubmodule 叠入角色属性系统)
|
||
this.generalAttributeSubmodule = new GeneralAttributeSubmodule(this);
|
||
this.generalAttributeSubmodule.numericChange[CharacterAttributes.HealingGainMultiplier]
|
||
= HEALING_REDUCTION;
|
||
|
||
this.eventSubmodule = new EventSubmodule(this);
|
||
this.eventSubmodule.onRoundEnd.Add("Hex_Decay", new PrioritizedAction(OnRoundEnd));
|
||
}
|
||
|
||
private void OnRoundEnd()
|
||
{
|
||
unitedStackSubmodule.ReduceStack(1);
|
||
iconSubmodule.Update();
|
||
}
|
||
|
||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||
{
|
||
MainGameManager.Instance.basePrefabs.GenerateInfoText(
|
||
contentSubmodule.displayName, attachedCharacter.characterView);
|
||
|
||
// 若已存在:叠加持续时间(治疗削减量不变,仍为固定 33%)
|
||
if (FindExistingSameBuff(out existingBuff))
|
||
{
|
||
existingBuff.unitedStackSubmodule.AddStack(this.unitedStackSubmodule.stackAmount);
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
}
|
||
}
|