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

84 lines
3.7 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 Continentis.MainGame;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using Continentis.MainGame.Commands;
using Continentis.Mods.Basic.Buffs;
using SLSUtilities.General;
namespace Continentis.Mods.Basic.Cards
{
/// <summary>
/// 火球术:对指定目标造成主伤害并附加大量灼烧,对其余所有敌人造成溅射伤害并附加少量灼烧。
/// targetList[0] 为主目标,其余为溅射目标(由卡牌数据目标配置决定)。
/// </summary>
public class FireBall : CardLogicBase
{
private const string DAMAGE_MAIN = "Damage_Main";
private const string DAMAGE_OTHERS = "Damage_Others";
private const string BURN_STACK_MAIN = "Buff_Burn_Stack_Main";
private const string BURN_STACK_OTHERS = "Buff_Burn_Stack_Others";
private const string DISPLAY_DAMAGE_MAIN = "Display_Damage_Main";
private const string DISPLAY_DAMAGE_OTHERS = "Display_Damage_Others";
private AttackContext MainCtx => AttackContext.Default(card)
.WithDamageKeywords("Fire")
.WithBaseDamageAttribute(DAMAGE_MAIN);
private AttackContext OthersCtx => AttackContext.Default(card)
.WithDamageKeywords("Fire")
.WithBaseDamageAttribute(DAMAGE_OTHERS);
public override void SetUpLogicComponents()
{
AddLogicComponent<CardLogicComponent_Attack>();
}
/// <summary>选中主目标时,更新主目标与溅射目标的伤害预览。</summary>
public override void TargetingEffect(CharacterBase target)
{
card.SetAttribute(DISPLAY_DAMAGE_MAIN, GetTargetedFinalDamage(target, MainCtx));
card.SetAttribute(DISPLAY_DAMAGE_OTHERS, GetNoTargetFinalDamage(OthersCtx));
}
/// <summary>取消选中时,以无目标模式刷新两套伤害预览。</summary>
public override void UntargetingEffect()
{
card.SetAttribute(DISPLAY_DAMAGE_MAIN, GetNoTargetFinalDamage(MainCtx));
card.SetAttribute(DISPLAY_DAMAGE_OTHERS, GetNoTargetFinalDamage(OthersCtx));
}
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
{
CharacterBase mainTarget = targetList[0];
return Cmd.Sequential(
new Cmd_PlayAnimation(user.characterView, "Attack"),
Cmd.Do(() =>
{
// 主目标:主伤害 + 大量灼烧
AttackContext mainCtx = MainCtx;
AttackTarget(mainTarget, GetTargetedFinalDamage(mainTarget, mainCtx), mainCtx);
CreateCharacterBuff<Burn>(GetAttribute(BURN_STACK_MAIN)).Apply(mainTarget, user, this);
// 溅射目标:溅射伤害 + 少量灼烧
AttackContext othersCtx = OthersCtx;
for (int i = 1; i < targetList.Count; i++)
{
CharacterBase other = targetList[i];
AttackTarget(other, GetTargetedFinalDamage(other, othersCtx), othersCtx);
CreateCharacterBuff<Burn>(GetAttribute(BURN_STACK_OTHERS)).Apply(other, user, this);
}
})
);
}
public override void ApplyAttributeChangesByCard()
{
// 主伤害:奥术加成写入 Damage_Main
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic(DAMAGE_MAIN);
// 溅射伤害:魔法加成写入 Damage_Others数值由卡牌数据配置
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic(DAMAGE_OTHERS);
}
}
}