Advertisement
Spazmatism101

This Accessory =/

Jul 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.86 KB | None | 0 0
  1. using Terraria;
  2. using Terraria.ModLoader;
  3.  
  4. namespace SingularityMod.Items
  5. {
  6.     public class TestydudeysNecklace : ModItem
  7.     {
  8.         public override void SetStaticDefaults()
  9.         {
  10.             Tooltip.SetDefault("10 tiers of stat boosts (all stack)"
  11.                 + "\nIf below 100% health, damage increased by 5%"
  12.                 + "\nIf below 90% health, crit chance increased by 5%"
  13.                 + "\nIf below 80% health, defense increased by 10"
  14.                 + "\nIf below 70% health, damage reduction increased by 5%"
  15.                 + "\nIf below 60% health, melee speed increased by 15%"
  16.                 + "\nIf below 50% health, mana increased by 100"
  17.                 + "\nIf below 40% health, damage increased by 10%"
  18.                 + "\nIf below 30% health, crit increased by 10%"
  19.                 + "\nIf below 20% health, damage reduction increased by 10%"
  20.                 + "\nIf below 10% health, regeneration increased by 10");
  21.         }
  22.         public override void SetDefaults()
  23.         {
  24.             item.width = 20;
  25.             item.height = 32;
  26.             item.accessory = true;
  27.             item.rare = 8;
  28.             item.value = 10000000;
  29.         }
  30.         public override void UpdateAccessory(Player player, bool hideVisual)
  31.         {
  32.             bool isBelow100HP = player.statLifeMax2 - player.statLife > player.statLifeMax2;
  33.             if (isBelow100HP)
  34.             {
  35.                 player.meleeDamage += 0.05f;
  36.                 player.rangedDamage += 0.05f;
  37.                 player.magicDamage += 0.05f;
  38.                 player.minionDamage += 0.05f;
  39.                 player.thrownDamage += 0.05f;
  40.             }
  41.             bool isBelow90HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.9;
  42.             if (isBelow90HP)
  43.             {
  44.                 player.meleeCrit += 5;
  45.                 player.rangedCrit += 5;
  46.                 player.magicCrit += 5;
  47.                 player.thrownCrit += 5;
  48.             }
  49.             bool isBelow80HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.8;
  50.             if (isBelow80HP)
  51.             {
  52.                 player.statDefense += 10;
  53.             }
  54.             bool isBelow70HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.7;
  55.             if (isBelow70HP)
  56.             {
  57.                 player.endurance += 0.15f;
  58.             }
  59.             bool isBelow60HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.6;
  60.             if (isBelow60HP)
  61.             {
  62.                 player.meleeSpeed += 15f;
  63.             }
  64.             bool isBelow50HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.5;
  65.             if (isBelow50HP)
  66.             {
  67.                 player.statManaMax2 += 100;
  68.             }
  69.             bool isBelow40HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.4;
  70.             if (isBelow40HP)
  71.             {
  72.                 player.meleeDamage += 0.1f;
  73.                 player.rangedDamage += 0.1f;
  74.                 player.magicDamage += 0.1f;
  75.                 player.minionDamage += 0.1f;
  76.                 player.thrownDamage += 0.1f;
  77.             }
  78.             bool isBelow30HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.3;
  79.             if (isBelow30HP)
  80.             {
  81.                 player.meleeCrit += 1;
  82.                 player.rangedCrit += 1;
  83.                 player.magicCrit += 1;
  84.                 player.thrownCrit += 1;
  85.             }
  86.             bool isBelow20HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.2;
  87.             if (isBelow20HP)
  88.             {
  89.                 player.endurance += 0.1f;
  90.             }
  91.             bool isBelow10HP = player.statLifeMax2 - player.statLife > player.statLifeMax2 * 0.1;
  92.             if (isBelow10HP)
  93.             {
  94.                 player.lifeRegen += 10;
  95.             }
  96.         }
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement