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

63 lines
2.4 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 System.Collections.Generic;
using Continentis.MainGame;
using Continentis.MainGame.Character;
using Continentis.MainGame.Combat;
using SLSUtilities.General;
namespace Continentis.Mods.Basic.Buffs
{
/// <summary>
/// 祈雨(专注):每回合开始时对全体友方(包括自身)回复少量生命值,持续若干回合。
/// 属于专注类 Buff个数上限由 MaximumFocusingBuffAmount 决定;
/// 若已有相同 Buff 存在则直接替换,不叠加持续时间。
/// </summary>
public class PrayingForRain : CharacterCombatBuffBase
{
private readonly int healAmount;
public PrayingForRain(int healAmount, int duration)
{
this.healAmount = healAmount;
Initialize(BuffType.Focusing, BuffDispelLevel.Strong);
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("HealAmount", () => this.healAmount.ToString())
.AddParameterGetter("Count", () => roundCountSubmodule.remainingCount.ToString());
this.iconSubmodule = new IconSubmodule(this);
// 回合计数:框架每回合开始时自动 Update(),归零时移除 Buff
this.roundCountSubmodule = new CountSubmodule(this, duration);
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onRoundStart.Add("PrayingForRain_HealAllies", new PrioritizedAction(() =>
{
List<CharacterBase> allies = CombatMainManager.Instance.characterController
.GetAllAllies(attachedCharacter, includeSelf: true);
foreach (CharacterBase ally in allies)
{
ally.Heal(this.healAmount);
}
}));
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText(
contentSubmodule.displayName, attachedCharacter.characterView);
// 已有相同 Buff直接替换重置持续时间不进行层数处理
if (FocusingCheck(out existingBuff))
{
existingBuff.roundCountSubmodule.Refresh(
roundCountSubmodule.maximumCount, keepMaximal: false);
return false;
}
return true;
}
}
}