70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
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;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.Mods.Basic.Cards
|
|
{
|
|
/// <summary>
|
|
/// 炎枪术:先削减目标的格挡值,再对目标造成大量火焰伤害并施加灼烧 Buff。
|
|
/// 格挡削减不受伤害加成影响,直接扣减固定值。
|
|
/// </summary>
|
|
public class FlameSpear : CardLogicBase
|
|
{
|
|
private const string BLOCK_REDUCTION = "Block_Reduction";
|
|
private const string BUFF_BURN_STACK = "Buff_Burn_Stack";
|
|
|
|
private AttackContext FireCtx => AttackContext.Default(card)
|
|
.WithDamageKeywords("Fire");
|
|
|
|
public override void SetUpLogicComponents()
|
|
{
|
|
AddLogicComponent<CardLogicComponent_Attack>();
|
|
}
|
|
|
|
/// <summary>选中目标时更新伤害预览。</summary>
|
|
public override void TargetingEffect(CharacterBase target)
|
|
{
|
|
card.SetAttribute("Display_Damage", GetTargetedFinalDamage(target, FireCtx));
|
|
}
|
|
|
|
/// <summary>取消选中时以无目标模式刷新预览。</summary>
|
|
public override void UntargetingEffect()
|
|
{
|
|
card.SetAttribute("Display_Damage", GetNoTargetFinalDamage(FireCtx));
|
|
}
|
|
|
|
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
|
{
|
|
return ForEachTarget(targetList, target => Cmd.Sequential(
|
|
new Cmd_PlayAnimation(user.characterView, "Attack"),
|
|
Cmd.Do(() =>
|
|
{
|
|
// 削减格挡(直接扣减,不受任何加成影响)
|
|
int blockReduce = GetAttribute(BLOCK_REDUCTION);
|
|
int actualReduce = target.ModifyAndClampAttribute("Block", -blockReduce);
|
|
target.characterView.hudContainer.UpdateAllHUD();
|
|
//Debug.Log($"[FlameSpear] 削减 {target.data.displayName} 的格挡 {actualReduce} 点。");
|
|
|
|
// 火焰伤害
|
|
AttackContext ctx = FireCtx;
|
|
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
|
|
|
|
// 灼烧
|
|
int burnStacks = GetAttribute(BUFF_BURN_STACK);
|
|
CreateCharacterBuff<Burn>(burnStacks).Apply(target, user, this);
|
|
})
|
|
));
|
|
}
|
|
|
|
public override void ApplyAttributeChangesByCard()
|
|
{
|
|
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic();
|
|
}
|
|
}
|
|
}
|