Reactor4

Despacito

Feb 7th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.66 KB | None | 0 0
  1. using System;
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. using Terraria;
  5. using Terraria.ID;
  6. using Terraria.ModLoader;
  7.  
  8. namespace BadMod.Items
  9. {
  10.     public class PotionOStorm : ModItem
  11.     {
  12.         public override void SetStaticDefaults()
  13.         {
  14.             DisplayName.SetDefault("Potion O' Rain"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
  15.             Tooltip.SetDefault("Oh god nos");
  16.         }
  17.  
  18.         public override void SetDefaults()
  19.         {
  20.             item.melee = false;
  21.             item.width = 12;
  22.             item.height = 12;
  23.             item.useTime = 25;
  24.             item.useAnimation = 20;
  25.             item.useStyle = 2;
  26.             item.value = 150;
  27.             item.rare = 1;
  28.             item.UseSound = SoundID.Item1;
  29.             item.autoReuse = false;
  30.             item.consumable = true;
  31.  
  32.             item.shoot = 680;
  33.             item.shootSpeed = 20f;
  34.  
  35.             //The useStyle of the item.
  36.             //Use useStyle 1 for normal swinging or for throwing
  37.             //use useStyle 2 for an item that drinks such as a potion,
  38.             //use useStyle 3 to make the sword act like a shortsword
  39.             //use useStyle 4 for use like a life crystal,
  40.             //and use useStyle 5 for staffs or guns
  41.         }
  42.  
  43.         public override void AddRecipes()
  44.         {
  45.             ModRecipe recipe = new ModRecipe(mod);
  46.             recipe.AddIngredient(ItemID.DirtBlock, 5);
  47.             recipe.AddTile(TileID.WorkBenches);
  48.             recipe.SetResult(this);
  49.             recipe.AddRecipe();
  50.         }
  51.  
  52.         // Star Wrath/Starfury style weapon. Spawn projectiles from sky that aim towards mouse.
  53.         // See Source code for Star Wrath projectile to see how it passes through tiles.
  54.         //  The following changes to SetDefaults
  55.  
  56.         public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
  57.         {
  58.             Vector2 target = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
  59.             float ceilingLimit = target.Y;
  60.             if (ceilingLimit > player.Center.Y - 200f)
  61.             {
  62.                 ceilingLimit = player.Center.Y - 200f;
  63.             }
  64.             for (int i = 0; i < 15; i++)
  65.             {
  66.                 position = player.Center + new Vector2((-(float)Main.rand.Next(0, 401) * player.direction), -600f);
  67.                 position.Y -= (100 * i);
  68.                 Vector2 heading = target - position;
  69.                 if (heading.Y < 0f)
  70.                 {
  71.                     heading.Y *= -1f;
  72.                 }
  73.                 if (heading.Y < 20f)
  74.                 {
  75.                     heading.Y = 20f;
  76.                 }
  77.                 heading.Normalize();
  78.                 heading *= new Vector2(speedX, speedY).Length();
  79.                 speedX = heading.X;
  80.                 speedY = heading.Y + Main.rand.Next(-40, 41) * 0.02f;
  81.  
  82.                 Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage * 2, knockBack, player.whoAmI, 0f, ceilingLimit);
  83.  
  84.             }
  85.             return false;
  86.         }
  87.        
  88.     }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment