Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Terraria;
  9. using Terraria.ModLoader;
  10. using Terraria.ID;
  11. namespace HarryPotter.Projectiles
  12. {
  13. public class Inferno : ModProjectile
  14. {
  15. public override void SetDefaults()
  16. {
  17. projectile.width = 16;
  18. projectile.height = 16;
  19. projectile.friendly = true;
  20. projectile.magic = true;
  21. projectile.penetrate = 1;
  22. projectile.timeLeft = 600;
  23.  
  24. }
  25.  
  26. public override void AI()
  27. {
  28.  
  29. Player p = Main.player[projectile.owner];
  30.  
  31. double deg = (double)projectile.ai[1];
  32. double rad = deg * (Math.PI / 180);
  33. double dist = 64;
  34.  
  35. projectile.position.X = Player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2;
  36. projectile.position.Y = Player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2;
  37.  
  38. projectile.ai[1] += 1f;
  39. projectile.velocity.Y += projectile.ai[0];
  40. if (Main.rand.Next(3) == 0) ;
  41. projectile.light = .3f;
  42. Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("ConfringoDust"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
  43. }
  44.  
  45.  
  46. public override bool OnTileCollide(Vector2 oldVelocity)
  47. {
  48. projectile.penetrate--;
  49. if (projectile.penetrate <= 0)
  50. {
  51. projectile.Kill();
  52. }
  53. else
  54. {
  55. projectile.ai[0] += 0.0f;
  56. if (projectile.velocity.X != oldVelocity.X)
  57. {
  58. projectile.velocity.X = -oldVelocity.X;
  59. }
  60. if (projectile.velocity.Y != oldVelocity.Y)
  61. {
  62. projectile.velocity.Y = -oldVelocity.Y;
  63. }
  64. projectile.velocity *= 0.75f;
  65. Main.PlaySound(SoundID.Item10, projectile.position);
  66. }
  67. return false;
  68. }
  69.  
  70. public override void Kill(int timeLeft)
  71. {
  72. for (int k = 0; k < 5; k++)
  73. {
  74. Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("ConfringoDust"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
  75. }
  76.  
  77. Main.PlaySound(SoundID.Item25, projectile.position);
  78. }
  79.  
  80. public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
  81. {
  82. projectile.ai[0] += 0f;
  83. projectile.velocity *= 1f;
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement