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 SLSFramework.General; namespace Continentis.Mods.Basic.Cards { /// /// 火球术:对指定目标造成主伤害并附加大量灼烧,对其余所有敌人造成溅射伤害并附加少量灼烧。 /// targetList[0] 为主目标,其余为溅射目标(由卡牌数据目标配置决定)。 /// 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(); } /// 选中主目标时,更新主目标与溅射目标的伤害预览。 public override void TargetingEffect(CharacterBase target) { card.SetAttribute(DISPLAY_DAMAGE_MAIN, GetTargetedFinalDamage(target, MainCtx)); card.SetAttribute(DISPLAY_DAMAGE_OTHERS, GetNoTargetFinalDamage(OthersCtx)); } /// 取消选中时,以无目标模式刷新两套伤害预览。 public override void UntargetingEffect() { card.SetAttribute(DISPLAY_DAMAGE_MAIN, GetNoTargetFinalDamage(MainCtx)); card.SetAttribute(DISPLAY_DAMAGE_OTHERS, GetNoTargetFinalDamage(OthersCtx)); } public override CommandGroup PlayEffect(List 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(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(GetAttribute(BURN_STACK_OTHERS)).Apply(other, user, this); } }) ); } public override void ApplyAttributeChangesByCard() { // 主伤害:奥术加成写入 Damage_Main LogicComponent().SetDamage_Arcane(DAMAGE_MAIN); // 溅射伤害:奥术加成写入 Damage_Others(数值由卡牌数据配置) LogicComponent().SetDamage_Arcane(DAMAGE_OTHERS); } } }