using System.Collections.Generic;
using System.Linq;
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
{
///
/// 暴风雪:对全体敌人造成伤害并附加冻结 Buff,同时对我方全体施加少量冻结 Buff。
/// 卡牌数据配置 targetCount = -1、TargetEnemies,Logic 层自行查找友方角色。
///
public class Blizzard : CardLogicBase
{
private const string FREEZE_COUNT_ENEMY = "Freeze_Count_Enemy";
private const string FREEZE_COUNT_ALLY = "Freeze_Count_Ally";
private AttackContext IceCtx => AttackContext.Default(card).WithDamageKeywords(CardKeywords.Ice);
public override void SetUpLogicComponents()
{
AddLogicComponent();
}
public override CommandGroup PlayEffect(List targetList)
{
return Cmd.Sequential(
new Cmd_PlayAnimation(user.characterView, "Attack"),
Cmd.Do(() =>
{
// 对全体敌人造成伤害 + 冻结
AttackContext ctx = IceCtx;
int freezeCountEnemy = GetAttribute(FREEZE_COUNT_ENEMY);
foreach (CharacterBase target in targetList)
{
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
CreateCharacterBuff(freezeCountEnemy).Apply(target, user, this);
}
// 对我方全体施加少量冻结(不造成伤害)
int freezeCountAlly = GetAttribute(FREEZE_COUNT_ALLY);
List allies = CombatMainManager.Instance.characterController.characters
.Where(c => user.IsAlly(c)).ToList();
foreach (CharacterBase ally in allies)
{
CreateCharacterBuff(freezeCountAlly).Apply(ally, user, this);
}
})
);
}
public override void ApplyAttributeChangesByCard()
{
LogicComponent().SetDamage_Magic();
}
}
}