Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
CritPlus.cs
Go to the documentation of this file.
1 using System;
2 using Loot.Api.Core;
3 using Loot.Modifiers.Base;
4 using Terraria;
5 
6 namespace Loot.Modifiers.WeaponModifiers
7 {
8  public class CritPlus : WeaponModifier
9  {
11  {
12  return base.GetTooltip()
13  .WithPositive($"+{Properties.RoundedPower}% crit chance");
14  }
15 
17  {
18  return base.GetModifierProperties(item)
19  .WithMaxMagnitude(10f);
20  }
21 
22  public override bool CanRoll(ModifierContext ctx)
23  {
24  return base.CanRoll(ctx) && !ctx.Item.summon;
25  }
26 
27  public override void GetWeaponCrit(Item item, Player player, ref int crit)
28  {
29  crit = (int) Math.Min(100, crit + Properties.RoundedPower);
30  }
31 
32  //public override ShaderEntity GetShaderEntity(Item item)
33  //{
34  // return new ShaderEntity(item,
35  // GameShaders.Armor.GetShaderIdFromItemId(ItemID.MirageDye),
36  // drawLayer: ShaderDrawLayer.Front,
37  // drawOffsetStyle: ShaderDrawOffsetStyle.Alternate,
38  // shaderDrawColor: Color.IndianRed);
39  //}
40 
41  //public override GlowmaskEntity GetGlowmaskEntity(Item item)
42  //{
43  // return new GlowmaskEntity(item);
44  //}
45  }
46 }
Defines a context in which a Modifier might be rolled Which fields are available (not null) depends o...
override ModifierTooltipLine.ModifierTooltipBuilder GetTooltip()
Definition: CritPlus.cs:10
The ModifierPropertiesBuilder implements the builder pattern for ModifierProperties It provides a str...
override void GetWeaponCrit(Item item, Player player, ref int crit)
Definition: CritPlus.cs:27
Defines a modifier that can roll on a weapon item You can use this class and add to CanRoll by callin...
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
Definition: CritPlus.cs:22
override ModifierProperties.ModifierPropertiesBuilder GetModifierProperties(Item item)
Definition: CritPlus.cs:16