61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
using System.Collections.Generic;
|
||
using Continentis.MainGame;
|
||
using Continentis.MainGame.Card;
|
||
using Continentis.MainGame.Character;
|
||
using Continentis.MainGame.Combat;
|
||
using Continentis.MainGame.Commands;
|
||
using Continentis.Mods.Basic.Buffs;
|
||
using SLSUtilities.General;
|
||
|
||
namespace Continentis.Mods.Basic.Cards
|
||
{
|
||
/// <summary>
|
||
/// 链式闪电:对主目标造成雷(Storm)属性伤害。
|
||
/// 若任意敌方角色有感电(Shocked)Buff,则对这些角色额外执行一次伤害。
|
||
/// </summary>
|
||
public class ChainLightning : CardLogicBase
|
||
{
|
||
private AttackContext StormCtx => AttackContext.Default(card)
|
||
.WithDamageKeywords(CardKeywords.Storm);
|
||
|
||
public override void SetUpLogicComponents()
|
||
{
|
||
AddLogicComponent<CardLogicComponent_Attack>();
|
||
}
|
||
|
||
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
||
{
|
||
CharacterBase mainTarget = targetList[0];
|
||
|
||
// 获取所有敌方角色
|
||
List<CharacterBase> allEnemies = CombatMainManager.Instance.characterController.GetAllEnemies(user);
|
||
|
||
return Cmd.Sequential(
|
||
new Cmd_PlayAnimation(user.characterView, "Attack"),
|
||
Cmd.Do(() =>
|
||
{
|
||
// 对主目标造成雷属性伤害
|
||
AttackTarget(mainTarget, GetTargetedFinalDamage(mainTarget, StormCtx), StormCtx);
|
||
}),
|
||
Cmd.Do(() =>
|
||
{
|
||
// 检查所有敌人,对有Shocked buff的目标额外执行一次伤害
|
||
foreach (CharacterBase enemy in allEnemies)
|
||
{
|
||
if (enemy.combatBuffSubmodule.HasBuff<Shocked>())
|
||
{
|
||
// 使用相同的Storm context造成额外伤害
|
||
AttackTarget(enemy, GetTargetedFinalDamage(enemy, StormCtx), StormCtx);
|
||
}
|
||
}
|
||
})
|
||
);
|
||
}
|
||
|
||
public override void ApplyAttributeChangesByCard()
|
||
{
|
||
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic();
|
||
}
|
||
}
|
||
}
|