79 lines
3.0 KiB
C#
79 lines
3.0 KiB
C#
using System.Collections.Generic;
|
||
using Continentis.MainGame;
|
||
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>
|
||
/// 余烬打击:消耗一张手牌,对单体目标造成火焰伤害并施加灼烧 Buff。
|
||
/// 若手牌中没有其他牌可消耗,跳过所有后续效果。
|
||
/// </summary>
|
||
public class CinderStrike : CardLogicBase
|
||
{
|
||
private const string BUFF_BURN_STACK = "Buff_Burn_Stack";
|
||
|
||
private AttackContext FireCtx => AttackContext.Default(card)
|
||
.WithDamageKeywords(CardKeywords.Fire);
|
||
|
||
public override void SetUpLogicComponents()
|
||
{
|
||
AddLogicComponent<CardLogicComponent_Attack>();
|
||
AddLogicComponent<CardLogicComponent_SelectHandCards>()
|
||
.SetCondition(c => c != card)
|
||
.SetEffect(c => CommandQueueManager.Instance.AddCommand(
|
||
user.deckSubmodule.DiscardCard(c, true, 0f)));
|
||
}
|
||
|
||
/// <summary>选中目标时更新伤害预览。</summary>
|
||
public override void TargetingEffect(CharacterBase target)
|
||
{
|
||
card.SetAttribute("Display_Damage", GetTargetedFinalDamage(target, FireCtx));
|
||
}
|
||
|
||
/// <summary>取消选中时以无目标模式刷新预览。</summary>
|
||
public override void UntargetingEffect()
|
||
{
|
||
card.SetAttribute("Display_Damage", GetNoTargetFinalDamage(FireCtx));
|
||
}
|
||
|
||
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
||
{
|
||
// 手牌中(排除自身)没有可弃的牌,跳过所有后续效果
|
||
if (user.deckSubmodule.HandPile.Exclude(card).Count == 0)
|
||
{
|
||
return Cmd.Sequential(new Cmd_PlayAnimation(user.characterView, "Attack"));
|
||
}
|
||
|
||
CommandGroup mainGroup = Cmd.Sequential(
|
||
new Cmd_PlayAnimation(user.characterView, "Attack")
|
||
);
|
||
|
||
// 弹出手牌选择 UI,强制选择 1 张弃掉
|
||
LogicComponent<CardLogicComponent_SelectHandCards>()
|
||
.AddSelectionCommands(ref mainGroup, "Card_Basic_CinderStrike_SelectHandCards_Title".Localize(), 1, forceMax: true);
|
||
|
||
// 弃牌完成后再造成伤害和灼烧
|
||
mainGroup.AddCommand(Cmd.Do(() =>
|
||
{
|
||
foreach (CharacterBase target in targetList)
|
||
{
|
||
AttackContext ctx = FireCtx;
|
||
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
|
||
CreateCharacterBuff<Burn>(GetAttribute(BUFF_BURN_STACK)).Apply(target, user, this);
|
||
}
|
||
}));
|
||
|
||
return mainGroup;
|
||
}
|
||
|
||
public override void ApplyAttributeChangesByCard()
|
||
{
|
||
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic();
|
||
}
|
||
}
|
||
}
|