Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
KnockbackImmunity.cs
Go to the documentation of this file.
1 using Loot.Api.Core;
2 using Loot.Modifiers.Base;
3 using Terraria;
4 using Terraria.ID;
5 
6 namespace Loot.Modifiers.EquipModifiers.Defensive
7 {
9  {
11  {
12  return base.GetTooltip()
13  .WithPositive($"Knockback immunity");
14  }
15 
17  {
18  return base.GetModifierProperties(item)
19  .WithRollChance(0.333f)
20  .WithRarityLevel(3f)
21  .IsUniqueModifier(true);
22  }
23 
24  public override bool CanRoll(ModifierContext ctx)
25  {
26  // Don't roll on items that already provide knockback immunity
27  switch (ctx.Item.type)
28  {
29  default:
30  return base.CanRoll(ctx);
31  case (ItemID.CobaltShield):
32  case (ItemID.ObsidianShield):
33  case (ItemID.AnkhShield):
34  return false;
35  }
36  }
37 
38  public override void UpdateEquip(Item item, Player player)
39  {
40  player.noKnockback = true;
41  }
42  }
43 }
override ModifierTooltipLine.ModifierTooltipBuilder GetTooltip()
Defines a context in which a Modifier might be rolled Which fields are available (not null) depends o...
The ModifierPropertiesBuilder implements the builder pattern for ModifierProperties It provides a str...
override ModifierProperties.ModifierPropertiesBuilder GetModifierProperties(Item item)
Defines a modifier that can roll on an equip item (armor or accessory) These modifiers will have 60% ...
Defines the properties of a modifier
Defines a tooltip line of a modifier A modifier can have multiple lines
override bool CanRoll(ModifierContext ctx)
If this Modifier can roll at all in the given context Properties are available here, apart from magnitude and power
override void UpdateEquip(Item item, Player player)