Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
ModifierDelegatorPlayer.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using Loot.Api.Core;
5 using Loot.Api.Loaders;
6 using Loot.Caching;
7 using Microsoft.Xna.Framework;
8 using Terraria;
9 using Terraria.DataStructures;
10 using Terraria.GameInput;
11 using Terraria.ModLoader;
12 
13 namespace Loot.Api.Delegators
14 {
19  {
20  private IList<ModifierEffect> _modifierEffects;
21 
22  public bool HasEffect(Type type) => _modifierEffects.Any(x => x.GetType() == type);
23  public bool HasEffect<T>() where T : ModifierEffect => _modifierEffects.Any(x => x.GetType() == typeof(T));
24 
25  public ModifierEffect GetEffect(Type type)
26  {
27  return _modifierEffects.FirstOrDefault(x => x.GetType() == type);
28  }
29 
30  public T GetEffect<T>() where T : ModifierEffect
31  {
32  return (T)_modifierEffects.FirstOrDefault(x => x.GetType() == typeof(T));
33  }
34 
35  public static ModifierDelegatorPlayer GetPlayer(Player player) => player.GetModPlayer<ModifierDelegatorPlayer>();
36 
37  /*****************
38  *** OVERRIDES ***
39  *****************/
40  //public override void SetupStartInventory(IList<Item> items, bool mediumcoreDeath)
41  //{
42  // if (!mediumcoreDeath)
43  // {
44  // LootModWorld.WorldGenModifiersPass.GenerateModifiers(null, ModifierContextMethod.SetupStartInventory, items.Where(x => !x.IsAir && x.IsModifierRollableItem()), player);
45  // }
46  //}
47 
48  //public override void OnEnterWorld(Player player)
49  //{
50  // LootModWorld.WorldGenModifiersPass.GenerateModifiers(null, ModifierContextMethod.FirstLoad, player.inventory.Where(x => !x.IsAir && x.IsModifierRollableItem()).Concat(player.armor.Where(x => !x.IsAir && !x.IsModifierRollableItem())), player);
51  //}
52 
53  public event Action<Player> OnRespawnEvent;
54  public override void OnRespawn(Player player)
55  {
56  OnRespawnEvent?.Invoke(player);
57  }
58 
59  public event Func<Item[], int, int, bool> ShiftClickSlotEvent;
60  public override bool ShiftClickSlot(Item[] inventory, int context, int slot)
61  {
62  return ShiftClickSlotEvent?.Invoke(inventory, context, slot) ?? base.ShiftClickSlot(inventory, context, slot);
63  }
64 
65  public delegate bool ModifyNurseHealEventRaiser(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText);
66  public event ModifyNurseHealEventRaiser ModifyNurseHealEvent;
67  public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText)
68  {
69  return ModifyNurseHealEvent?.Invoke(nurse, ref health, ref removeDebuffs, ref chatText) ?? base.ModifyNurseHeal(nurse, ref health, ref removeDebuffs, ref chatText);
70  }
71 
72  public delegate void ModifyNursePriceEventRaiser(NPC nurse, int health, bool removeDebuffs, ref int price);
73  public event ModifyNursePriceEventRaiser ModifyNursePriceEvent;
74  public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price)
75  {
76  ModifyNursePriceEvent?.Invoke(nurse, health, removeDebuffs, ref price);
77  }
78 
79  public event Action<NPC, int, bool, int> PostNurseHealEvent;
80  public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price)
81  {
82  PostNurseHealEvent?.Invoke(nurse, health, removeDebuffs, price);
83  }
84 
85  public event Action InitializeEvent;
86  public override void Initialize()
87  {
88  // Initialize the effects list for this player
89  _modifierEffects = new List<ModifierEffect>();
90 
91  // Need to initialize with a fresh set of new effect instances
92  foreach (var effect in ContentLoader.ModifierEffect.Content.Select(x => x.Value))
93  {
94  var clone = (ModifierEffect)effect.Clone();
95  clone.DelegatorPlayer = this;
96  clone.OnInitialize();
97  _modifierEffects.Add(clone);
98  }
99 
100  InitializeEvent?.Invoke();
101  }
102 
103  public event Action UpdateAutopauseEvent;
104  public override void UpdateAutopause()
105  {
106  UpdateAutopauseEvent?.Invoke();
107  }
108 
109  public event Action PreUpdateEvent;
110  public override void PreUpdate()
111  {
112  PreUpdateEvent?.Invoke();
113  }
114 
115  public event Action<TriggersSet> ProcessTriggersEvent;
116  public override void ProcessTriggers(TriggersSet triggersSet)
117  {
118  ProcessTriggersEvent?.Invoke(triggersSet);
119  }
120 
121  public event Action SetControlsEvent;
122  public override void SetControls()
123  {
124  SetControlsEvent?.Invoke();
125  }
126 
127  public event Action PreUpdateBuffsEvent;
128  public override void PreUpdateBuffs()
129  {
130  PreUpdateBuffsEvent?.Invoke();
131  }
132 
133  public event Action PostUpdateBuffsEvent;
134  public override void PostUpdateBuffs()
135  {
136  PostUpdateBuffsEvent?.Invoke();
137  }
138 
139  public delegate void UpdateEquipsEventRaiser(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff);
140  public event UpdateEquipsEventRaiser UpdateEquipsEvent;
141  public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff)
142  {
143  UpdateEquipsEvent?.Invoke(ref wallSpeedBuff, ref tileSpeedBuff, ref tileRangeBuff);
144  }
145 
146  public event Action ResetEffectsEvent;
147  public override void ResetEffects()
148  {
149  if (player.GetModPlayer<ModifierCachePlayer>().Ready)
150  {
151  ResetEffectsEvent?.Invoke();
152  }
153  }
154 
155  public event Action UpdateDeadEvent;
156  public override void UpdateDead()
157  {
158  UpdateDeadEvent?.Invoke();
159  }
160 
161  public event Action UpdateLifeRegenEvent;
162  public override void UpdateLifeRegen()
163  {
164  UpdateLifeRegenEvent?.Invoke();
165  }
166 
167  public delegate void NaturalLifeRegenEventRaiser(ref float regen);
168  public event NaturalLifeRegenEventRaiser NaturalLifeRegenEvent;
169  public override void NaturalLifeRegen(ref float regen)
170  {
171  NaturalLifeRegenEvent?.Invoke(ref regen);
172  }
173 
174  public event Action<int, int, bool> SyncPlayerEvent;
175  public override void SyncPlayer(int toWho, int fromWho, bool newPlayer)
176  {
177  SyncPlayerEvent?.Invoke(toWho, fromWho, newPlayer);
178  }
179 
180  public event Action<ModPlayer> SendClientChangesEvent;
181  public override void SendClientChanges(ModPlayer clientPlayer)
182  {
183  SendClientChangesEvent?.Invoke(clientPlayer);
184  }
185 
186  public event Action UpdateBadLifeRegenEvent;
187  public override void UpdateBadLifeRegen()
188  {
189  UpdateBadLifeRegenEvent?.Invoke();
190  }
191 
192  public event Action PostUpdateEquipsEvent;
193  public override void PostUpdateEquips()
194  {
195  PostUpdateEquipsEvent?.Invoke();
196  }
197 
198  public event Action PostUpdateMiscEffectsEvent;
199  public override void PostUpdateMiscEffects()
200  {
201  PostUpdateMiscEffectsEvent?.Invoke();
202  }
203 
204  public event Action PostUpdateRunSpeedsEvent;
205  public override void PostUpdateRunSpeeds()
206  {
207  PostUpdateRunSpeedsEvent?.Invoke();
208  }
209 
210  public event Action PreUpdateMovementEvent;
211  public override void PreUpdateMovement()
212  {
213  PreUpdateMovementEvent?.Invoke();
214  }
215 
216  public event Action PostUpdateEvent;
217  public override void PostUpdate()
218  {
219  PostUpdateEvent?.Invoke();
220  }
221 
222  public event Action UpdateVanityAccessoriesEvent;
223  public override void UpdateVanityAccessories()
224  {
225  UpdateVanityAccessoriesEvent?.Invoke();
226  }
227 
228  public event Action FrameEffectsEvent;
229  public override void FrameEffects()
230  {
231  FrameEffectsEvent?.Invoke();
232  }
233 
234  public delegate bool PreHurtEventRaiser(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource);
235  public event PreHurtEventRaiser PreHurtEvent;
236  public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
237  {
238  return PreHurtEvent?.Invoke(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource)
239  ?? base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource);
240  }
241 
242  public event Action<bool, bool, double, int, bool> HurtEvent;
243  public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
244  {
245  HurtEvent?.Invoke(pvp, quiet, damage, hitDirection, crit);
246  }
247 
248  public event Action<bool, bool, double, int, bool> PostHurtEvent;
249  public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
250  {
251  PostHurtEvent?.Invoke(pvp, quiet, damage, hitDirection, crit);
252  }
253 
254  public event Func<Item, NPC, bool?> CanHitNPCEvent;
255  public override bool? CanHitNPC(Item item, NPC target)
256  {
257  return CanHitNPCEvent?.Invoke(item, target) ?? base.CanHitNPC(item, target);
258  }
259 
260  public delegate void ModifyHitNPCEventRaiser(Item item, NPC target, ref int damage, ref float knockback, ref bool crit);
261  public event ModifyHitNPCEventRaiser ModifyHitNPCEvent;
262  public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
263  {
264  ModifyHitNPCEvent?.Invoke(item, target, ref damage, ref knockback, ref crit);
265  }
266 
267  public event Func<Item, Player, bool> CanHitPvpEvent;
268  public override bool CanHitPvp(Item item, Player target)
269  {
270  return CanHitPvpEvent?.Invoke(item, target) ?? base.CanHitPvp(item, target);
271  }
272 
273  public delegate void ModifyHitPvpEventRaiser(Item item, Player target, ref int damage, ref bool crit);
274  public event ModifyHitPvpEventRaiser ModifyHitPvpEvent;
275  public override void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
276  {
277  ModifyHitPvpEvent?.Invoke(item, target, ref damage, ref crit);
278  }
279 
280  public event Action<Item, NPC, int, float, bool> OnHitNPCEvent;
281  public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
282  {
283  OnHitNPCEvent?.Invoke(item, target, damage, knockback, crit);
284  }
285 
286  public event Func<Projectile, NPC, bool?> CanHitNPCWithProjEvent;
287  public override bool? CanHitNPCWithProj(Projectile proj, NPC target)
288  {
289  return CanHitNPCWithProjEvent?.Invoke(proj, target) ?? base.CanHitNPCWithProj(proj, target);
290  }
291 
292  public delegate void ModifyHitNPCWithProjEventRaiser(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection);
293  public event ModifyHitNPCWithProjEventRaiser ModifyHitNPCWithProjEvent;
294  public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
295  {
296  ModifyHitNPCWithProjEvent?.Invoke(proj, target, ref damage, ref knockback, ref crit, ref hitDirection);
297  }
298 
299  public event Action<Projectile, NPC, int, float, bool> OnHitNPCWithProjEvent;
300  public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
301  {
302  OnHitNPCWithProjEvent?.Invoke(proj, target, damage, knockback, crit);
303  }
304 
305  public event Action<Item, Player, int, bool> OnHitPvpEvent;
306  public override void OnHitPvp(Item item, Player target, int damage, bool crit)
307  {
308  OnHitPvpEvent?.Invoke(item, target, damage, crit);
309  }
310 
311  public event Func<Projectile, Player, bool> CanHitPvpWithProjEvent;
312  public override bool CanHitPvpWithProj(Projectile proj, Player target)
313  {
314  return CanHitPvpWithProjEvent?.Invoke(proj, target) ?? base.CanHitPvpWithProj(proj, target);
315  }
316 
317  public delegate void ModifyHitPvpWithProjEventRaiser(Projectile proj, Player target, ref int damage, ref bool crit);
318  public event ModifyHitPvpWithProjEventRaiser ModifyHitPvpWithProjEvent;
319  public override void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
320  {
321  ModifyHitPvpWithProjEvent?.Invoke(proj, target, ref damage, ref crit);
322  }
323 
324  public event Action<Projectile, Player, int, bool> OnHitPvpWithProjEvent;
325  public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit)
326  {
327  OnHitPvpWithProjEvent?.Invoke(proj, target, damage, crit);
328  }
329 
330  public delegate bool CanBeHitByNPCEventRaiser(NPC npc, ref int cooldownSlot);
331  public event CanBeHitByNPCEventRaiser CanBeHitByNPCEvent;
332  public override bool CanBeHitByNPC(NPC npc, ref int cooldownSlot)
333  {
334  return CanBeHitByNPCEvent?.Invoke(npc, ref cooldownSlot) ?? base.CanBeHitByNPC(npc, ref cooldownSlot);
335  }
336 
337  public delegate void ModifyHitByNPCEventRaiser(NPC npc, ref int damage, ref bool crit);
338  public event ModifyHitByNPCEventRaiser ModifyHitByNPCEvent;
339  public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
340  {
341  ModifyHitByNPCEvent?.Invoke(npc, ref damage, ref crit);
342  }
343 
344  public delegate void ModifyWeaponDamageEventRaiser(Item item, ref float add, ref float mult, ref float flat);
345  public event ModifyWeaponDamageEventRaiser ModifyWeaponDamageEvent;
346  public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat)
347  {
348  ModifyWeaponDamageEvent?.Invoke(item, ref add, ref mult, ref flat);
349  }
350 
351  public delegate void ModifyManaCostEventRaiser(Item item, ref float reduce, ref float mult);
352  public event ModifyManaCostEventRaiser ModifyManaCostEvent;
353  public override void ModifyManaCost(Item item, ref float reduce, ref float mult)
354  {
355  ModifyManaCostEvent?.Invoke(item, ref reduce, ref mult);
356  }
357 
358  public event Action<NPC, int, bool> OnHitByNPCEvent;
359  public override void OnHitByNPC(NPC npc, int damage, bool crit)
360  {
361  OnHitByNPCEvent?.Invoke(npc, damage, crit);
362  }
363 
364  public event Func<Projectile, bool> CanBeHitByProjectileEvent;
365  public override bool CanBeHitByProjectile(Projectile proj)
366  {
367  return CanBeHitByProjectileEvent?.Invoke(proj) ?? base.CanBeHitByProjectile(proj);
368  }
369 
370  public delegate void ModifyHitByProjectileEventRaiser(Projectile projectile, ref int damage, ref bool crit);
371  public event ModifyHitByProjectileEventRaiser ModifyHitByProjectileEvent;
372  public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
373  {
374  ModifyHitByProjectileEvent?.Invoke(proj, ref damage, ref crit);
375  }
376 
377  public event Action<Projectile, int, bool> OnHitByProjectileEvent;
378  public override void OnHitByProjectile(Projectile proj, int damage, bool crit)
379  {
380  OnHitByProjectileEvent?.Invoke(proj, damage, crit);
381  }
382 
383  public delegate void CatchFishEventRaiser(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk);
384  public event CatchFishEventRaiser CatchFishEvent;
385  public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
386  {
387  CatchFishEvent?.Invoke(fishingRod, bait, power, liquidType, poolSize, worldLayer, questFish, ref caughtType, ref junk);
388  }
389 
390  public delegate void GetFishingLevelEventRaiser(Item fishingRod, Item bait, ref int fishingLevel);
391  public event GetFishingLevelEventRaiser GetFishingLevelEvent;
392  public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel)
393  {
394  GetFishingLevelEvent?.Invoke(fishingRod, bait, ref fishingLevel);
395  }
396 
397  public event Action<float, List<Item>> AnglerQuestRewardEvent;
398  public override void AnglerQuestReward(float rareMultiplier, List<Item> rewardItems)
399  {
400  AnglerQuestRewardEvent?.Invoke(rareMultiplier, rewardItems);
401  }
402 
403  public event Action<List<int>> GetDyeTraderRewardEvent;
404  public override void GetDyeTraderReward(List<int> rewardPool)
405  {
406  GetDyeTraderRewardEvent?.Invoke(rewardPool);
407  }
408 
409  public delegate void DrawEffectsEventRaiser(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright);
410  public event DrawEffectsEventRaiser DrawEffectsEvent;
411  public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
412  {
413  DrawEffectsEvent?.Invoke(drawInfo, ref r, ref g, ref b, ref a, ref fullBright);
414  }
415 
416  public delegate void ModifyDrawInfoEventRaiser(ref PlayerDrawInfo drawInfo);
417  public event ModifyDrawInfoEventRaiser ModifyDrawInfoEvent;
418  public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo)
419  {
420  ModifyDrawInfoEvent?.Invoke(ref drawInfo);
421  }
422 
423  public event Action<List<PlayerLayer>> ModifyDrawLayersEvent;
424  public override void ModifyDrawLayers(List<PlayerLayer> layers)
425  {
426  ModifyDrawLayersEvent?.Invoke(layers);
427  }
428 
429  public event Action<List<PlayerHeadLayer>> ModifyDrawHeadLayersEvent;
430  public override void ModifyDrawHeadLayers(List<PlayerHeadLayer> layers)
431  {
432  ModifyDrawHeadLayersEvent?.Invoke(layers);
433  }
434 
435  public event Action ModifyScreenPositionEvent;
436  public override void ModifyScreenPosition()
437  {
438  ModifyScreenPositionEvent?.Invoke();
439  }
440 
441  public delegate void ModifyZoomEventRaiser(ref float zoom);
442  public event ModifyZoomEventRaiser ModifyZoomEvent;
443  public override void ModifyZoom(ref float zoom)
444  {
445  ModifyZoomEvent?.Invoke(ref zoom);
446  }
447 
448  public delegate bool PreKillEventRaiser(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource);
449  public event PreKillEventRaiser PreKillEvent;
450  public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
451  {
452  return PreKillEvent?.Invoke(damage, hitDirection, pvp, ref playSound, ref genGore, ref damageSource)
453  ?? base.PreKill(damage, hitDirection, pvp, ref playSound, ref genGore, ref damageSource);
454  }
455 
456  public event Action<double, int, bool, PlayerDeathReason> KillEvent;
457  public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
458  {
459  KillEvent?.Invoke(damage, hitDirection, pvp, damageSource);
460  }
461 
462  public event Func<bool> PreItemCheckEvent;
463  public override bool PreItemCheck()
464  {
465  return PreItemCheckEvent?.Invoke() ?? base.PreItemCheck();
466  }
467 
468  public event Action PostItemCheckEvent;
469  public override void PostItemCheck()
470  {
471  PostItemCheckEvent?.Invoke();
472  }
473 
474  public event Func<Item, float> UseTimeMultiplierEvent;
475  public override float UseTimeMultiplier(Item item)
476  {
477  return UseTimeMultiplierEvent?.Invoke(item) ?? base.UseTimeMultiplier(item);
478  }
479 
480  public event Func<Item, float> MeleeSpeedMultiplierEvent;
481  public override float MeleeSpeedMultiplier(Item item)
482  {
483  return MeleeSpeedMultiplierEvent?.Invoke(item) ?? base.MeleeSpeedMultiplier(item);
484  }
485 
486  public delegate void GetHealLifeEventRaiser(Item item, bool quickHeal, ref int healValue);
487  public event GetHealLifeEventRaiser GetHealLifeEvent;
488  public override void GetHealLife(Item item, bool quickHeal, ref int healValue)
489  {
490  GetHealLifeEvent?.Invoke(item, quickHeal, ref healValue);
491  }
492 
493  public delegate void GetHealManaEventRaiser(Item item, bool quickHeal, ref int healValue);
494  public event GetHealManaEventRaiser GetHealManaEvent;
495  public override void GetHealMana(Item item, bool quickHeal, ref int healValue)
496  {
497  GetHealManaEvent?.Invoke(item, quickHeal, ref healValue);
498  }
499 
500  public delegate void GetWeaponKnockbackEventRaiser(Item item, ref float knockback);
501  public event GetWeaponKnockbackEventRaiser GetWeaponKnockbackEvent;
502  public override void GetWeaponKnockback(Item item, ref float knockback)
503  {
504  GetWeaponKnockbackEvent?.Invoke(item, ref knockback);
505  }
506 
507  public delegate void GetWeaponCritEventRaiser(Item item, ref int crit);
508  public event GetWeaponCritEventRaiser GetWeaponCritEvent;
509  public override void GetWeaponCrit(Item item, ref int crit)
510  {
511  GetWeaponCritEvent?.Invoke(item, ref crit);
512  }
513 
514  public event Func<Item, Item, bool> ConsumeAmmoEvent;
515  public override bool ConsumeAmmo(Item weapon, Item ammo)
516  {
517  return ConsumeAmmoEvent?.Invoke(weapon, ammo) ?? base.ConsumeAmmo(weapon, ammo);
518  }
519 
520  public event Action<Item, Item> OnConsumeAmmoEvent;
521  public override void OnConsumeAmmo(Item weapon, Item ammo)
522  {
523  OnConsumeAmmoEvent?.Invoke(weapon, ammo);
524  }
525 
526  public delegate bool ShootEventRaiser(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack);
527  public event ShootEventRaiser ShootEvent;
528  public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
529  {
530  return ShootEvent?.Invoke(item, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack)
531  ?? base.Shoot(item, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack);
532  }
533 
534  public event Action<Item, Rectangle> MeleeEffectsEvent;
535  public override void MeleeEffects(Item item, Rectangle hitbox)
536  {
537  MeleeEffectsEvent?.Invoke(item, hitbox);
538  }
539 
540  public event Action<float, float, Entity> OnHitAnythingEvent;
541  public override void OnHitAnything(float x, float y, Entity victim)
542  {
543  OnHitAnythingEvent?.Invoke(x, y, victim);
544  }
545  }
546 }
ModifyHitNPCWithProjEventRaiser ModifyHitNPCWithProjEvent
override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff)
override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright)
override bool CanBeHitByNPC(NPC npc, ref int cooldownSlot)
override void ModifyDrawHeadLayers(List< PlayerHeadLayer > layers)
override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel)
override void OnHitPvp(Item item, Player target, int damage, bool crit)
override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit)
Action< float, List< Item > > AnglerQuestRewardEvent
override void ModifyManaCost(Item item, ref float reduce, ref float mult)
override bool ConsumeAmmo(Item weapon, Item ammo)
Func< Projectile, Player, bool > CanHitPvpWithProjEvent
Action< double, int, bool, PlayerDeathReason > KillEvent
override void GetHealMana(Item item, bool quickHeal, ref int healValue)
override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo)
override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
override void GetDyeTraderReward(List< int > rewardPool)
A ModifierEffect signifies the effect of a modifier on a player It should house the implementation...
override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat)
GetWeaponKnockbackEventRaiser GetWeaponKnockbackEvent
override void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
override void SyncPlayer(int toWho, int fromWho, bool newPlayer)
override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
Action< bool, bool, double, int, bool > PostHurtEvent
override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
ModifyWeaponDamageEventRaiser ModifyWeaponDamageEvent
ModifyHitByProjectileEventRaiser ModifyHitByProjectileEvent
override bool CanHitNPCWithProj(Projectile proj, NPC target)
override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
Action< Projectile, Player, int, bool > OnHitPvpWithProjEvent
override void AnglerQuestReward(float rareMultiplier, List< Item > rewardItems)
override bool CanHitNPC(Item item, NPC target)
override void SendClientChanges(ModPlayer clientPlayer)
override void OnHitByProjectile(Projectile proj, int damage, bool crit)
override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText)
Action< bool, bool, double, int, bool > HurtEvent
override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
override void MeleeEffects(Item item, Rectangle hitbox)
override void GetWeaponKnockback(Item item, ref float knockback)
override void ProcessTriggers(TriggersSet triggersSet)
Caches the item held and items equipped by players. When equips and held items change, their respective modifiers&#39; effects are automatically called to detach and attach their delegations.
Action< Projectile, NPC, int, float, bool > OnHitNPCWithProjEvent
Func< Projectile, NPC, bool?> CanHitNPCWithProjEvent
override void OnConsumeAmmo(Item weapon, Item ammo)
override bool CanHitPvp(Item item, Player target)
override bool ShiftClickSlot(Item[] inventory, int context, int slot)
override void OnHitByNPC(NPC npc, int damage, bool crit)
Action< Projectile, int, bool > OnHitByProjectileEvent
static ModifierEffectContent ModifierEffect
override bool CanHitPvpWithProj(Projectile proj, Player target)
override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price)
override void ModifyDrawLayers(List< PlayerLayer > layers)
Action< Item, NPC, int, float, bool > OnHitNPCEvent
override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
override void OnHitAnything(float x, float y, Entity victim)
override void GetWeaponCrit(Item item, ref int crit)
override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
ModifyHitPvpWithProjEventRaiser ModifyHitPvpWithProjEvent
Func< Item[], int, int, bool > ShiftClickSlotEvent
This class holds all Content holders of this mod You can use this to access content loaded into the m...
Action< List< PlayerHeadLayer > > ModifyDrawHeadLayersEvent
override void ModifyHitPvp(Item item, Player target, ref int damage, ref bool crit)
override bool CanBeHitByProjectile(Projectile proj)
Holds player-entity data and handles it
override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price)
override void GetHealLife(Item item, bool quickHeal, ref int healValue)
Action< Item, Player, int, bool > OnHitPvpEvent