63 lines
2.3 KiB
C#
63 lines
2.3 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。
|
||
/// 卡牌数据需配置 targetCount(攻击次数),关键词需包含 AllowDuplicateTargets 和 TargetEnemies。
|
||
/// </summary>
|
||
public class FrenziedClawSlashes : CardLogicBase
|
||
{
|
||
private const string BUFF_BLEED_STACK = "Buff_Bleed_Stack";
|
||
|
||
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)
|
||
{
|
||
// targetList 由 SetRandomTargets + AllowDuplicateTargets 提供,可包含重复目标
|
||
return Cmd.Sequential(
|
||
new Cmd_PlayAnimation(user.characterView, "Attack"),
|
||
ForEachTarget(targetList, target => Cmd.Sequential(
|
||
Cmd.After(0.3f, () =>
|
||
{
|
||
AttackContext ctx = PhysicsCtx;
|
||
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
|
||
|
||
CreateCharacterBuff<Bleed>(GetAttribute(BUFF_BLEED_STACK)).Apply(target, user, this);
|
||
})
|
||
))
|
||
);
|
||
}
|
||
|
||
public override void ApplyAttributeChangesByCard()
|
||
{
|
||
LogicComponent<CardLogicComponent_Attack>().SetDamage_Physics();
|
||
}
|
||
}
|
||
}
|