Files
Continentis/Assets/Mods/Basic/Characters/CombatBuffs/General/Bleed.cs

41 lines
1.5 KiB
C#
Raw Normal View History

2025-10-23 00:49:44 -04:00
using System.Collections.Generic;
using Continentis.MainGame;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
2025-10-24 09:11:22 -04:00
public sealed class Bleed : CharacterCombatBuffBase
2025-10-23 00:49:44 -04:00
{
2025-10-24 09:11:22 -04:00
public Bleed(int stack)
2025-10-23 00:49:44 -04:00
{
Initialize(BuffType.Negative, BuffDispelLevel.Basic);
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
this.eventSubmodule = new EventSubmodule(this);
2025-10-31 10:02:30 -04:00
this.eventSubmodule.onActionStart.Add("Bleed", new PrioritizedAction(OnActionStart));
this.eventSubmodule.onGetAttacked.Add("Bleed", new PrioritizedAction<AttackResult>(OnGetAttacked));
2025-10-23 00:49:44 -04:00
}
private void OnGetAttacked(AttackResult result)
{
int stackAmount = unitedStackSubmodule.stackAmount;
2025-10-31 10:02:30 -04:00
result.attacker.Attack(attachedCharacter, stackAmount, false, true);
2025-10-23 00:49:44 -04:00
}
private void OnActionStart()
{
int reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.5f));
unitedStackSubmodule.ReduceStack(reducedStack);
iconSubmodule.Update();
}
}
}