Files
Continentis/Assets/Mods/Basic/Characters/CombatBuffs/General/Nimble.cs
SoulliesOfficial 76157e3cb1 继续
2025-10-24 09:11:22 -04:00

58 lines
2.1 KiB
C#

using System;
using Continentis.MainGame;
using Continentis.MainGame.Character;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public sealed class Nimble : CharacterCombatBuffBase, IBuffExtension_IntegerRange
{
public Nimble(int stack)
{
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
this.contentSubmodule = new ContentSubmodule(this,false)
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, true);
this.generalAttributeSubmodule = new GeneralAttributeSubmodule(this);
this.generalAttributeSubmodule.numericChange.Add("DodgeGainOffset", stack);
(this as IBuffExtension_IntegerRange).Initialize(stack);
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText("Nimble", attachedCharacter.characterView);
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount);
int newStack = existingBuff.unitedStackSubmodule.stackAmount;
existingBuff.generalAttributeSubmodule.numericChange["DodgeGainOffset"] = newStack;
return false;
}
return true;
}
public void OnBecomePositive()
{
contentSubmodule.originalFunctionText = "Buff_Basic_Nimble_FunctionTextPos".Localize();
buffType = BuffType.Positive;
iconSubmodule.Update();
}
public void OnBecomeNegative()
{
contentSubmodule.originalFunctionText = "Buff_Basic_Nimble_FunctionTextNeg".Localize();
buffType = BuffType.Negative;
iconSubmodule.Update();
}
}
}