Files
SoulliesOfficial ac98ec3aef 更新
2026-04-17 12:01:50 -04:00

44 lines
1.7 KiB
C#
Raw Permalink 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 Continentis.MainGame;
using Continentis.MainGame.Character;
using SLSUtilities.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public class CounterAttack : CharacterCombatBuffBase
{
public CounterAttack(int stack)
{
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, true);
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onGetAttacked.Add(this.GetType().FullName, new PrioritizedAction<AttackResult>(atkResult =>
{
// 将反击入队到 Reaction Lane确保反击动画/特效与主流程不穿插
int counterDamage = unitedStackSubmodule.stackAmount;
CharacterBase attacker = atkResult.attacker;
EnqueueReaction(Cmd.Do(() =>
{
attachedCharacter.Attack(attacker, counterDamage, null, false, true);
}));
}));
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText("Counter Attack", attachedCharacter.characterView);
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount);
return false;
}
return true;
}
}
}