Files
Continentis/Assets/Mods/Basic/Characters/CombatBuffs/General/Sharpness.cs

54 lines
2.0 KiB
C#
Raw Normal View History

2025-11-10 01:06:46 -06:00
using Continentis.MainGame;
using Continentis.MainGame.Character;
using SLSFramework.General;
2025-12-13 23:28:23 -05:00
using UnityEngine;
2025-11-10 01:06:46 -06:00
namespace Continentis.Mods.Basic.Buffs
{
public class Sharpness : CharacterCombatBuffBase, IBuffExtension_IntegerRange
{
public Sharpness(int stack)
{
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
2025-12-11 17:25:49 -05:00
this.contentSubmodule = new ContentSubmodule(this)
2025-11-10 01:06:46 -06:00
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack, true);
2025-12-11 17:25:49 -05:00
this.generalAttributeSubmodule = new GeneralAttributeSubmodule(this);
this.generalAttributeSubmodule.numericChange.Add("PhysicsDamageDealtOffset", stack);
2025-11-10 01:06:46 -06:00
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onDealAttack.Add("Sharpness", new PrioritizedAction<AttackResult>(atkRes =>
{
if (atkRes.attacker.combatBuffSubmodule.HasBuff<Sharpness>())
{
atkRes.attacker.combatBuffSubmodule.GetBuff<Sharpness>().Remove();
}
}));
(this as IBuffExtension_IntegerRange).Initialize(stack);
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText("Sharpness", attachedCharacter.characterView);
2025-12-13 23:28:23 -05:00
2025-11-10 01:06:46 -06:00
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount);
int newStack = existingBuff.unitedStackSubmodule.stackAmount;
2025-12-13 23:28:23 -05:00
Debug.Log($"[Sharpness] New Stack: {newStack}");
existingBuff.generalAttributeSubmodule.numericChange["PhysicsDamageDealtOffset"] = newStack;
2025-11-10 01:06:46 -06:00
return false;
}
2025-12-13 23:28:23 -05:00
2025-11-10 01:06:46 -06:00
return true;
}
}
}