2026-04-08 04:48:35 -04:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Continentis.MainGame;
|
|
|
|
|
|
using Continentis.MainGame.Character;
|
|
|
|
|
|
using Continentis.MainGame.Combat;
|
2026-04-17 12:01:50 -04:00
|
|
|
|
using SLSUtilities.General;
|
2026-04-08 04:48:35 -04:00
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|