Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Terraria;
  3. using Terraria.ID;
  4. using Terraria.ModLoader;
  5.  
  6. namespace gnt.Items
  7. {
  8. public class StarNeonTetraSword : ModItem
  9. {
  10. public override void SetStaticDefaults()
  11. {
  12. Tooltip.SetDefault("Upgraded version of Neon Tetra Sword");
  13. DisplayName.SetDefault("Star Neon Tetra Sword");
  14. }
  15.  
  16. public override void SetDefaults()
  17. {
  18. item.damage = 480;
  19. item.melee = true;
  20. item.width = 50;
  21. item.height = 50;
  22. item.useTime = 8;
  23. item.useAnimation = 8;
  24. item.useStyle = 1;
  25. item.knockBack = 6;
  26. item.value = Item.buyPrice(gold: 23);
  27. item.rare = 9;
  28. item.UseSound = SoundID.Item1;
  29. item.autoReuse = true;
  30. item.shoot = mod.ProjectileType("NeonTetra");
  31. item.shootSpeed = 12f;
  32. }
  33.  
  34. public override void AddRecipes()
  35. {
  36. ModRecipe recipe = new ModRecipe(mod);
  37. recipe.AddIngredient(mod.ItemType("NeonTetraSword"), 1);
  38. recipe.AddIngredient(ItemID.FallenStar, 20);
  39. recipe.AddIngredient(ItemID.NeonTetra, 20);
  40. recipe.AddIngredient(ItemID.StarWrath, 1);
  41. recipe.AddTile(TileID.WorkBenches);
  42. recipe.SetResult(this);
  43. recipe.AddRecipe();
  44. }
  45.  
  46. public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
  47. {
  48. Vector2 target = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
  49. float ceilingLimit = target.Y;
  50. if (ceilingLimit > player.Center.Y - 200f)
  51. {
  52. ceilingLimit = player.Center.Y - 200f;
  53. }
  54. for (int i = 0; i < 3; i++)
  55. {
  56. position = player.Center + new Vector2((-(float)Main.rand.Next(0, 401) * player.direction), -600f);
  57. position.Y -= (100 * i);
  58. Vector2 heading = target - position;
  59. if (heading.Y < 0f)
  60. {
  61. heading.Y *= -1f;
  62. }
  63. if (heading.Y < 20f)
  64. {
  65. heading.Y = 20f;
  66. }
  67. heading.Normalize();
  68. heading *= new Vector2(speedX, speedY).Length();
  69. speedX = heading.X;
  70. speedY = heading.Y + Main.rand.Next(-40, 41) * 0.02f;
  71. Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage * 2, knockBack, player.whoAmI, 0f, ceilingLimit);
  72. }
  73. return false;
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement