继续
This commit is contained in:
41
Assets/Mods/Basic/Characters/CombatBuffs/General/Bleed.cs
Normal file
41
Assets/Mods/Basic/Characters/CombatBuffs/General/Bleed.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
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 EventUnit(OnActionStart));
|
||||
this.eventSubmodule.onGetAttacked.Add("Bleed", new EventUnit<AttackResult>(OnGetAttacked));
|
||||
}
|
||||
|
||||
private void OnGetAttacked(AttackResult result)
|
||||
{
|
||||
int stackAmount = unitedStackSubmodule.stackAmount;
|
||||
result.attacker.Attack(attachedCharacter, stackAmount, true);
|
||||
}
|
||||
|
||||
private void OnActionStart()
|
||||
{
|
||||
int reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.5f));
|
||||
unitedStackSubmodule.ReduceStack(reducedStack);
|
||||
iconSubmodule.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user