71 lines
2.6 KiB
C#
71 lines
2.6 KiB
C#
using Continentis.MainGame;
|
||
using Continentis.MainGame.Card;
|
||
using Continentis.MainGame.Character;
|
||
using SLSUtilities.General;
|
||
using UnityEngine;
|
||
|
||
namespace Continentis.Mods.Basic.Buffs
|
||
{
|
||
/// <summary>
|
||
/// 光耀印记:使目标的物理攻击卡每段伤害额外造成 {Stack} 点伤害。
|
||
/// 本回合结束时移除。
|
||
/// </summary>
|
||
public sealed class MarkOfRadiance : CharacterCombatBuffBase
|
||
{
|
||
public MarkOfRadiance(int stack)
|
||
{
|
||
Initialize(BuffType.Positive, BuffDispelLevel.Basic);
|
||
|
||
contentSubmodule = new ContentSubmodule(this)
|
||
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString())
|
||
.AddParameterGetter("Count", () => roundCountSubmodule.remainingCount.ToString());
|
||
|
||
iconSubmodule = new IconSubmodule(this);
|
||
|
||
unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
|
||
|
||
// 行动结束时移除(本回合 Buff)
|
||
roundCountSubmodule = new CountSubmodule(this, 1);
|
||
|
||
eventSubmodule = new EventSubmodule(this);
|
||
eventSubmodule.onDealAttack.Add("MarkOfRadiance", new PrioritizedAction<AttackResult>(OnDealAttack));
|
||
}
|
||
|
||
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
||
{
|
||
MainGameManager.Instance.basePrefabs.GenerateInfoText(
|
||
contentSubmodule.displayName, attachedCharacter.characterView);
|
||
|
||
if (FindExistingSameBuff(out existingBuff))
|
||
{
|
||
existingBuff.unitedStackSubmodule.AddStack(unitedStackSubmodule.stackAmount);
|
||
existingBuff.roundCountSubmodule.PickHigherCount(roundCountSubmodule);
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
private void OnDealAttack(AttackResult atkRes)
|
||
{
|
||
// 响应式/生命移除/反弹伤害不触发
|
||
if (atkRes.context.HasAnyTag(AttackTags.Reactive, AttackTags.HpRemoval, AttackTags.Reflected))
|
||
{
|
||
return;
|
||
}
|
||
|
||
// 仅对物理攻击卡生效
|
||
if (atkRes.attackCard == null) return;
|
||
if (atkRes.attackCard.contentSubmodule.cardType != CardType.Attack) return;
|
||
if (!atkRes.attackCard.HasKeyword("Physics")) return;
|
||
|
||
int bonusDamage = unitedStackSubmodule.stackAmount;
|
||
var ctx = AttackContext.Default(atkRes.attackCard).WithTag(AttackTags.Reactive);
|
||
|
||
EnqueueReaction(Cmd.Do(() => {
|
||
attachedCharacter.Attack(atkRes.target, bonusDamage, ctx);
|
||
}));
|
||
}
|
||
}
|
||
}
|