Files
Continentis/Assets/Mods/Basic/Cards/Scripts/General/Attack/Blizzard.cs
SoulliesOfficial ac98ec3aef 更新
2026-04-17 12:01:50 -04:00

62 lines
2.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
{
/// <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();
}
}
}