Files
Continentis/Assets/Mods/Basic/Cards/Scripts/General/Attack/Blizzard.cs

62 lines
2.4 KiB
C#
Raw Normal View History

2026-04-08 04:48:35 -04:00
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;
2026-04-17 12:01:50 -04:00
using SLSUtilities.General;
2026-04-08 04:48:35 -04:00
namespace Continentis.Mods.Basic.Cards
{
/// <summary>
/// 暴风雪:对全体敌人造成伤害并附加冻结 Buff同时对我方全体施加少量冻结 Buff。
/// 卡牌数据配置 targetCount = -1、TargetEnemiesLogic 层自行查找友方角色。
/// </summary>
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<CardLogicComponent_Attack>();
}
public override CommandGroup PlayEffect(List<CharacterBase> 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<Freeze>(freezeCountEnemy).Apply(target, user, this);
}
// 对我方全体施加少量冻结(不造成伤害)
int freezeCountAlly = GetAttribute(FREEZE_COUNT_ALLY);
List<CharacterBase> allies = CombatMainManager.Instance.characterController.characters
.Where(c => user.IsAlly(c)).ToList();
foreach (CharacterBase ally in allies)
{
CreateCharacterBuff<Freeze>(freezeCountAlly).Apply(ally, user, this);
}
})
);
}
public override void ApplyAttributeChangesByCard()
{
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic();
}
}
}