49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using Continentis.MainGame;
|
|
using Continentis.MainGame.Card;
|
|
using Continentis.MainGame.Character;
|
|
using SLSUtilities.General;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.Mods.Basic.Buffs
|
|
{
|
|
public sealed class Basic_Hellfire : CharacterCombatBuffBase
|
|
{
|
|
public Basic_Hellfire(int stack)
|
|
{
|
|
Initialize(BuffType.Negative, BuffDispelLevel.Strong);
|
|
|
|
contentSubmodule = new ContentSubmodule(this)
|
|
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
|
|
|
|
iconSubmodule = new IconSubmodule(this);
|
|
|
|
unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
|
|
|
|
eventSubmodule = new EventSubmodule(this);
|
|
eventSubmodule.onAfterPlayCard.Add("Basic_Hellfire",
|
|
new PrioritizedAction<CardInstance, List<CharacterBase>>(OnAfterPlayCard));
|
|
}
|
|
|
|
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
|
{
|
|
MainGameManager.Instance.basePrefabs.GenerateInfoText("Hellfire", attachedCharacter.characterView);
|
|
|
|
if (FindExistingSameBuff(out existingBuff))
|
|
{
|
|
existingBuff.unitedStackSubmodule.AddStack(unitedStackSubmodule.stackAmount);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private void OnAfterPlayCard(CardInstance card, List<CharacterBase> targets)
|
|
{
|
|
var reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.2f));
|
|
sourceCharacter.Attack(attachedCharacter, reducedStack);
|
|
unitedStackSubmodule.ReduceStack(reducedStack);
|
|
iconSubmodule.Update();
|
|
}
|
|
}
|
|
} |