70 lines
2.6 KiB
C#
70 lines
2.6 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 Laceration : CardLogicBase
|
||
{
|
||
private const string BUFF_VULNERABLE_COUNT = "Buff_Vulnerable_Count";
|
||
|
||
private AttackContext PhysicsCtx => AttackContext.Default(card)
|
||
.WithDamageKeywords(CardKeywords.Physics);
|
||
|
||
public override void SetUpLogicComponents()
|
||
{
|
||
AddLogicComponent<CardLogicComponent_Attack>();
|
||
}
|
||
|
||
/// <summary>选中目标时更新伤害预览。</summary>
|
||
public override void TargetingEffect(CharacterBase target)
|
||
{
|
||
card.SetAttribute("Display_Damage", GetTargetedFinalDamage(target, PhysicsCtx));
|
||
}
|
||
|
||
/// <summary>取消选中时以无目标模式刷新预览。</summary>
|
||
public override void UntargetingEffect()
|
||
{
|
||
card.SetAttribute("Display_Damage", GetNoTargetFinalDamage(PhysicsCtx));
|
||
}
|
||
|
||
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
||
{
|
||
return ForEachTarget(targetList, target => Cmd.Sequential(
|
||
new Cmd_PlayAnimation(user.characterView, "Attack"),
|
||
Cmd.Do(() =>
|
||
{
|
||
AttackContext ctx = PhysicsCtx;
|
||
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
|
||
|
||
// 施加易伤
|
||
CreateCharacterBuff<Vulnerable>(GetAttribute(BUFF_VULNERABLE_COUNT)).Apply(target, user, this);
|
||
|
||
// 读取目标身上易伤的剩余回合数,以此作为流血层数
|
||
if (target.combatBuffSubmodule.TryGetBuff<Vulnerable>(out Vulnerable vulnerable))
|
||
{
|
||
int bleedStack = vulnerable.actionCountSubmodule.remainingCount;
|
||
if (bleedStack > 0)
|
||
{
|
||
CreateCharacterBuff<Bleed>(bleedStack).Apply(target, user, this);
|
||
}
|
||
}
|
||
})
|
||
));
|
||
}
|
||
|
||
public override void ApplyAttributeChangesByCard()
|
||
{
|
||
LogicComponent<CardLogicComponent_Attack>().SetDamage_Physics();
|
||
}
|
||
}
|
||
}
|