更新
This commit is contained in:
76
Assets/Mods/Basic/Cards/Scripts/Knight/Skill/Unyielding.cs
Normal file
76
Assets/Mods/Basic/Cards/Scripts/Knight/Skill/Unyielding.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Card;
|
||||
using Continentis.MainGame.Character;
|
||||
using Continentis.MainGame.Commands;
|
||||
using Continentis.Mods.Basic.Buffs;
|
||||
using SLSUtilities.General;
|
||||
|
||||
namespace Continentis.Mods.Basic.Cards
|
||||
{
|
||||
/// <summary>
|
||||
/// 不屈(Unyielding):
|
||||
/// 骑士技能牌。获得指定量的格挡和 1 层坚守(Firm)Buff。
|
||||
/// 如果使用者本回合已被攻击过,格挡翻倍。
|
||||
/// </summary>
|
||||
public class Unyielding : CardLogicBase
|
||||
{
|
||||
// 卡牌数据中配置的格挡基础值属性键
|
||||
private const string BUFF_FIRM_COUNT = "Buff_Firm_Count";
|
||||
|
||||
public override void SetUpLogicComponents()
|
||||
{
|
||||
AddLogicComponent<CardLogicComponent_Defense>();
|
||||
}
|
||||
|
||||
// ── 伤害预览 ──────────────────────────────────────────────────────────
|
||||
|
||||
public override void TargetingEffect(CharacterBase target)
|
||||
{
|
||||
// TargetingEffect 无目标意义(己方技能),复用 Untargeting 逻辑即可
|
||||
RefreshBlockPreview();
|
||||
}
|
||||
|
||||
public override void UntargetingEffect()
|
||||
{
|
||||
RefreshBlockPreview();
|
||||
}
|
||||
|
||||
// ── 出牌效果 ──────────────────────────────────────────────────────────
|
||||
|
||||
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
||||
{
|
||||
return SingleCommandGroup(
|
||||
new Cmd_PlayAnimation(user.characterView, "Skill"),
|
||||
Cmd.Do(() =>
|
||||
{
|
||||
int baseBlock = GetAttribute("Block");
|
||||
// 如果本回合已被攻击过,格挡翻倍
|
||||
bool isCounterReaction = user.recordSubmodule.WasAttackedThisRound;
|
||||
int finalBlock = isCounterReaction ? baseBlock * 2 : baseBlock;
|
||||
|
||||
user.AddBlock(finalBlock);
|
||||
|
||||
int firmStacks = GetAttribute(BUFF_FIRM_COUNT);
|
||||
CreateCharacterBuff<Firm>(firmStacks).Apply(user, user, this);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public override void ApplyAttributeChangesByCard()
|
||||
{
|
||||
LogicComponent<CardLogicComponent_Defense>().SetBlock();
|
||||
}
|
||||
|
||||
// ── 私有辅助 ──────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// 根据当前是否被攻击过刷新格挡预览属性。
|
||||
/// </summary>
|
||||
private void RefreshBlockPreview()
|
||||
{
|
||||
int baseBlock = GetAttribute("Block");
|
||||
bool isCounterReaction = user != null && user.recordSubmodule.WasAttackedThisRound;
|
||||
card.SetAttribute("Display_Block", isCounterReaction ? baseBlock * 2 : baseBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user