2 using System.Collections.Generic;
13 namespace Loot.Modifiers.Base
17 public List<(int type, int time, float chance)> DebuffChances =
new List<(int type, int time, float chance)>();
21 DebuffChances =
new List<(int type, int time, float chance)>();
26 DebuffChances.Clear();
38 return base.GetTooltip()
39 .WithPositive($
"+{Properties.RoundedPower}% chance to inflict {GetBuffName()} for {RoundedBuffTime()}s");
44 return base.GetModifierProperties(item)
46 .WithMinMagnitude(10f)
47 .WithRoundPrecision(1);
52 return (
float) Math.Round((
double) BuffTime / 60f, Properties.RoundPrecision);
55 public abstract int BuffType {
get; }
56 public abstract int BuffTime {
get; }
57 public abstract float BuffInflictionChance {
get; }
61 if (BuffType >= BuffID.Count)
63 return BuffLoader.GetBuff(BuffType)?.DisplayName.GetTranslation(LanguageManager.Instance.ActiveCulture) ??
"null";
66 return Lang.GetBuffName(BuffType);
69 public override void OnHitNPC(Item item, Player player, NPC target,
int damage,
float knockBack,
bool crit)
71 if (Main.rand.NextFloat() < Properties.RoundedPower / 100f * BuffInflictionChance)
73 target.AddBuff(BuffType, BuffTime);
77 public override void OnHitPvp(Item item, Player player, Player target,
int damage,
bool crit)
79 if (Main.rand.NextFloat() < Properties.RoundedPower / 100f * BuffInflictionChance)
81 target.AddBuff(BuffType, BuffTime);
86 public override void HoldItem(Item item, Player player)
90 .Add((BuffType, BuffTime, Properties.RoundedPower / 100f * BuffInflictionChance));
override ModifierPropertiesBuilder GetModifierProperties(Item item)
ModifierEffect GetEffect(Type type)
A ModifierEffect signifies the effect of a modifier on a player It should house the implementation...
override void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
override void OnHitPvp(Item item, Player player, Player target, int damage, bool crit)
static ModifierDelegatorPlayer GetPlayer(Player player)
Defines a modifier that can roll on a weapon item You can use this class and add to CanRoll by callin...
override ModifierTooltipBuilder GetTooltip()
Defines the properties of a modifier
override void HoldItem(Item item, Player player)
Defines a modifier that can inflict a debuff, applicable for weapons
override void ResetEffects()
Automatically called when the ModPlayer does its ResetEffects Also automatically called when the dele...
Holds player-entity data and handles it
override void OnInitialize()
Called when the ModPlayer initializes the effect