63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
using Continentis.MainGame;
|
|
using Continentis.MainGame.Card;
|
|
using Continentis.MainGame.Character;
|
|
using Continentis.MainGame.Commands;
|
|
using SLSFramework.General;
|
|
|
|
namespace Continentis.Mods.Basic.Cards
|
|
{
|
|
/// <summary>
|
|
/// 魔法飞弹:对单体敌人造成多段魔法伤害。
|
|
/// </summary>
|
|
public class ArcaneMissiles : CardLogicBase
|
|
{
|
|
private const string ATTACK_COUNT = "Attack_Count";
|
|
|
|
private AttackContext MagicCtx => AttackContext.Default(card)
|
|
.WithDamageKeywords(CardKeywords.Magic);
|
|
|
|
public override void SetUpLogicComponents()
|
|
{
|
|
AddLogicComponent<CardLogicComponent_Attack>();
|
|
}
|
|
|
|
/// <summary>选中目标时更新伤害预览。</summary>
|
|
public override void TargetingEffect(CharacterBase target)
|
|
{
|
|
card.SetAttribute("Display_Damage", GetTargetedFinalDamage(target, MagicCtx));
|
|
}
|
|
|
|
/// <summary>取消选中时以无目标模式刷新预览。</summary>
|
|
public override void UntargetingEffect()
|
|
{
|
|
card.SetAttribute("Display_Damage", GetNoTargetFinalDamage(MagicCtx));
|
|
}
|
|
|
|
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
|
{
|
|
return ForEachTarget(targetList, target =>
|
|
{
|
|
CommandGroup perTargetGroup = Cmd.Sequential(
|
|
new Cmd_PlayAnimation(user.characterView, "Attack"));
|
|
|
|
int attackCount = GetAttribute(ATTACK_COUNT);
|
|
for (int i = 0; i < attackCount; i++)
|
|
{
|
|
perTargetGroup.AddCommand(Cmd.After(0.4f, () =>
|
|
{
|
|
AttackContext ctx = MagicCtx;
|
|
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
|
|
}));
|
|
}
|
|
|
|
return perTargetGroup;
|
|
});
|
|
}
|
|
|
|
public override void ApplyAttributeChangesByCard()
|
|
{
|
|
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic();
|
|
}
|
|
}
|
|
} |