2025-10-31 10:02:30 -04:00
|
|
|
using Continentis.MainGame;
|
|
|
|
|
using Continentis.MainGame.Character;
|
|
|
|
|
using SLSFramework.General;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Continentis.Mods.Basic.Buffs
|
|
|
|
|
{
|
|
|
|
|
public class EstablishFormation : CharacterCombatBuffBase
|
|
|
|
|
{
|
|
|
|
|
public EstablishFormation(int stack, int count)
|
|
|
|
|
{
|
|
|
|
|
Initialize(BuffType.Positive, BuffDispelLevel.Basic);
|
|
|
|
|
|
|
|
|
|
this.contentSubmodule = new ContentSubmodule(this)
|
|
|
|
|
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString())
|
|
|
|
|
.AddParameterGetter("Count", () => actionCountSubmodule.remainingCount.ToString());
|
|
|
|
|
|
|
|
|
|
this.iconSubmodule = new IconSubmodule(this);
|
|
|
|
|
|
|
|
|
|
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
|
|
|
|
|
|
|
|
|
|
this.actionCountSubmodule = new CountSubmodule(this, count);
|
|
|
|
|
|
|
|
|
|
this.eventSubmodule = new EventSubmodule(this);
|
|
|
|
|
this.eventSubmodule.onGetAttacked.Add("EstablishFormation", new PrioritizedAction<AttackResult>(atkResult =>
|
|
|
|
|
{
|
2025-11-08 22:22:43 -05:00
|
|
|
attachedCharacter.Attack(atkResult.attacker, unitedStackSubmodule.stackAmount, null, false, true);
|
2025-10-31 10:02:30 -04:00
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
|
|
|
|
{
|
|
|
|
|
MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView);
|
|
|
|
|
|
|
|
|
|
if (FindExistingSameBuff(out existingBuff))
|
|
|
|
|
{
|
|
|
|
|
existingBuff.unitedStackSubmodule.PickHigherStack(this.unitedStackSubmodule);
|
|
|
|
|
existingBuff.actionCountSubmodule.PickHigherCount(this.actionCountSubmodule);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|