63 lines
2.3 KiB
C#
63 lines
2.3 KiB
C#
using System.Collections.Generic;
|
||
using Continentis.MainGame;
|
||
using Continentis.MainGame.Base;
|
||
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
|
||
{
|
||
/// <summary>
|
||
/// 强酸箭矢:对单体目标先减少格挡,然后造成魔法伤害并施加腐蚀 Buff。
|
||
/// </summary>
|
||
public class AcidArrow : CardLogicBase
|
||
{
|
||
private const string BLOCK_REDUCTION = "Block_Reduction";
|
||
private const string BUFF_CORROSION_STACK = "Buff_Corrosion_Stack";
|
||
|
||
private AttackContext PhysicsCtx => AttackContext.Default(card)
|
||
.WithDamageKeywords(CardKeywords.Physics);
|
||
|
||
public override void SetUpLogicComponents()
|
||
{
|
||
AddLogicComponent<CardLogicComponent_Attack>();
|
||
}
|
||
|
||
/// <summary>选中目标时更新伤害预览。</summary>
|
||
public override void TargetingEffect(CharacterBase target)
|
||
{
|
||
card.SetAttribute("Display_Damage", GetTargetedFinalDamage(target, PhysicsCtx));
|
||
}
|
||
|
||
/// <summary>取消选中时以无目标模式刷新预览。</summary>
|
||
public override void UntargetingEffect()
|
||
{
|
||
card.SetAttribute("Display_Damage", GetNoTargetFinalDamage(PhysicsCtx));
|
||
}
|
||
|
||
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
|
||
{
|
||
return ForEachTarget(targetList, target => Cmd.Sequential(
|
||
new Cmd_PlayAnimation(user.characterView, "Attack"),
|
||
Cmd.Do(() =>
|
||
{
|
||
// 第一步:减少目标格挡,Clamp 至 0
|
||
target.ModifyAndClampAttribute(CharacterAttributes.Block, -GetAttribute(BLOCK_REDUCTION));
|
||
|
||
// 第二步:造成伤害并施加腐蚀
|
||
AttackContext ctx = PhysicsCtx;
|
||
AttackTarget(target, GetTargetedFinalDamage(target, ctx), ctx);
|
||
CreateCharacterBuff<Corrosion>(GetAttribute(BUFF_CORROSION_STACK)).Apply(target, user, this);
|
||
})
|
||
));
|
||
}
|
||
|
||
public override void ApplyAttributeChangesByCard()
|
||
{
|
||
LogicComponent<CardLogicComponent_Attack>().SetDamage_Magic();
|
||
}
|
||
}
|
||
}
|