r2mods/ilspy_dump/ror2_csproj/RoR2.Skills/LunarPrimaryReplacementSkil...

43 lines
1.2 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2.Skills;
public class LunarPrimaryReplacementSkill : SkillDef
{
private class InstanceData : BaseSkillInstanceData
{
public GenericSkill skillSlot;
public void OnInventoryChanged()
{
skillSlot.RecalculateValues();
}
}
public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
{
InstanceData instanceData = new InstanceData();
instanceData.skillSlot = skillSlot;
skillSlot.characterBody.onInventoryChanged += instanceData.OnInventoryChanged;
return instanceData;
}
public override void OnUnassigned(GenericSkill skillSlot)
{
skillSlot.characterBody.onInventoryChanged -= ((InstanceData)skillSlot.skillInstanceData).OnInventoryChanged;
}
public override int GetMaxStock(GenericSkill skillSlot)
{
return skillSlot.characterBody.inventory.GetItemCount(RoR2Content.Items.LunarPrimaryReplacement) * baseMaxStock;
}
public override float GetRechargeInterval(GenericSkill skillSlot)
{
return (float)skillSlot.characterBody.inventory.GetItemCount(RoR2Content.Items.LunarPrimaryReplacement) * baseRechargeInterval;
}
public override int GetRechargeStock(GenericSkill skillSlot)
{
return GetMaxStock(skillSlot);
}
}