Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
LifeRegen.cs
Go to the documentation of this file.
1 using Loot.Api.Attributes;
2 using Loot.Api.Core;
3 using Loot.Api.Delegators;
4 using Loot.Modifiers.Base;
5 using Terraria;
6 
7 namespace Loot.Modifiers.EquipModifiers.Defensive
8 {
10  {
11  public int LifeRegen;
12 
13  public override void ResetEffects()
14  {
15  LifeRegen = 0;
16  }
17 
18  [AutoDelegation("OnUpdateLifeRegen")]
19  private void Regen()
20  {
21  player.lifeRegen += LifeRegen / 30;
22  LifeRegen %= 30;
23  }
24  }
25 
26  [UsesEffect(typeof(LifeRegenEffect))]
27  public class LifeRegen : EquipModifier
28  {
30  {
31  return base.GetTooltip()
32  .WithPositive($"+{Properties.RoundedPower} life regen/minute");
33  }
34 
36  {
37  return base.GetModifierProperties(item)
38  .WithMaxMagnitude(15f)
39  .WithRollChance(0.5f);
40  }
41 
42  public override void UpdateEquip(Item item, Player player)
43  {
44  ModifierDelegatorPlayer.GetPlayer(player).GetEffect<LifeRegenEffect>().LifeRegen += (int) Properties.RoundedPower;
45  }
46  }
47 }
The ModifierPropertiesBuilder implements the builder pattern for ModifierProperties It provides a str...
This attribute may be used to skip usage of AttachDelegations and DetachDelegations Which is a cumber...
A ModifierEffect signifies the effect of a modifier on a player It should house the implementation...
Defines a modifier that can roll on an equip item (armor or accessory) These modifiers will have 60% ...
static ModifierDelegatorPlayer GetPlayer(Player player)
override void ResetEffects()
Automatically called when the ModPlayer does its ResetEffects Also automatically called when the dele...
Definition: LifeRegen.cs:13
override ModifierProperties.ModifierPropertiesBuilder GetModifierProperties(Item item)
Definition: LifeRegen.cs:35
Defines the properties of a modifier
override ModifierTooltipLine.ModifierTooltipBuilder GetTooltip()
Definition: LifeRegen.cs:29
Defines a tooltip line of a modifier A modifier can have multiple lines
override void UpdateEquip(Item item, Player player)
Definition: LifeRegen.cs:42
Holds player-entity data and handles it