52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using Continentis.MainGame;
|
|
using Continentis.MainGame.Character;
|
|
using SLSFramework.General;
|
|
|
|
namespace Continentis.Mods.Basic.Buffs
|
|
{
|
|
public class Sharpness : CharacterCombatBuffBase, IBuffExtension_IntegerRange
|
|
{
|
|
public Sharpness(int stack)
|
|
{
|
|
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
|
|
|
|
this.contentSubmodule = new ContentSubmodule(this)
|
|
.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("PhysicsDamageDealtOffset", stack);
|
|
|
|
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);
|
|
|
|
if (FindExistingSameBuff(out existingBuff))
|
|
{
|
|
existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount);
|
|
|
|
int newStack = existingBuff.unitedStackSubmodule.stackAmount;
|
|
existingBuff.coreAttributeSubmodule.numericChange["PhysicsDamageDealtOffset"] = newStack;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|