48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
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
|
|
{
|
|
public sealed class Bleed : CharacterCombatBuffBase
|
|
{
|
|
public Bleed(int stack)
|
|
{
|
|
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);
|
|
this.eventSubmodule.onActionStart.Add("Bleed", new PrioritizedAction(OnActionStart));
|
|
this.eventSubmodule.onGetAttacked.Add("Bleed", new PrioritizedAction<AttackResult>(OnGetAttacked));
|
|
}
|
|
|
|
private void OnGetAttacked(AttackResult result)
|
|
{
|
|
int stackAmount = unitedStackSubmodule.stackAmount;
|
|
result.attacker.Attack(attachedCharacter, stackAmount, null, false, true);
|
|
}
|
|
|
|
private void OnActionStart()
|
|
{
|
|
int reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.5f));
|
|
unitedStackSubmodule.ReduceStack(reducedStack);
|
|
iconSubmodule.Update();
|
|
}
|
|
|
|
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
|
{
|
|
//TODO
|
|
existingBuff = this;
|
|
return true;
|
|
}
|
|
}
|
|
} |