Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.83 KB | None | 0 0
  1. using System;
  2.  
  3. using Microsoft.Xna.Framework;
  4. using Microsoft.Xna.Framework.Graphics;
  5. using Terraria;
  6. using Terraria.ID;
  7. using Terraria.ModLoader;
  8.  
  9. namespace Arkhalis.Projectiles
  10. {
  11. public class Pwnkhalis : ModProjectile
  12. {
  13. public override void SetStaticDefaults()
  14. {
  15. DisplayName.SetDefault("Pwnkhalis");
  16. Main.projFrames[projectile.type] = 9;
  17. }
  18. public override void SetDefaults()
  19. {
  20. projectile.width = 58;
  21. projectile.height = 58;
  22. projectile.friendly = true;
  23. projectile.penetrate = -1;
  24. projectile.tileCollide = false;
  25. projectile.melee = true;
  26. projectile.ignoreWater = true;
  27. projectile.ownerHitCheck = true;
  28. projectile.usesLocalNPCImmunity = true;
  29. projectile.localNPCHitCooldown = -1;
  30. }
  31.  
  32. public override bool PreAI()
  33. {
  34. Player player = Main.player[projectile.owner];
  35. Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true);
  36. if (Main.myPlayer == projectile.owner)
  37. {
  38. bool channeling = player.itemAnimation > 0 && !player.noItems && !player.CCed;
  39. /*if(channeling)
  40. {
  41. float scaleFactor6 = 1f;
  42. if (player.inventory[player.selectedItem].shoot == projectile.type)
  43. {
  44. scaleFactor6 = player.inventory[player.selectedItem].shootSpeed * projectile.scale;
  45. }
  46. Vector2 vector13 = Main.MouseWorld - vector;
  47. vector13.Normalize();
  48. if (vector13.HasNaNs())
  49. {
  50. vector13 = Vector2.UnitX * (float)player.direction;
  51. }
  52. vector13 *= scaleFactor6;
  53. if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y)
  54. {
  55. projectile.netUpdate = true;
  56. }
  57. projectile.velocity = vector13;
  58. }
  59. else
  60. {
  61. projectile.Kill();
  62. }*/
  63. if (!channeling)
  64. {
  65. projectile.Kill();
  66. }
  67. }
  68. if (player.itemAnimation > (int)(8 * (float)player.itemAnimationMax / 9))
  69. {
  70. projectile.frame = 0;
  71. }
  72. else if (player.itemAnimation > (int)(7 * (float)player.itemAnimationMax / 9))
  73. {
  74. projectile.frame = 1;
  75. }
  76. else if (player.itemAnimation > (int)(6 * (float)player.itemAnimationMax / 9))
  77. {
  78. projectile.frame = 2;
  79. }
  80. else if (player.itemAnimation > (int)(5 * (float)player.itemAnimationMax / 9))
  81. {
  82. projectile.frame = 3;
  83. }
  84. else if (player.itemAnimation > (int)(4 * (float)player.itemAnimationMax / 9))
  85. {
  86. projectile.frame = 4;
  87. }
  88. else if (player.itemAnimation > (int)(3 * (float)player.itemAnimationMax / 9))
  89. {
  90. projectile.frame = 5;
  91. }
  92. else if (player.itemAnimation > (int)(2 * (float)player.itemAnimationMax / 9))
  93. {
  94. projectile.frame = 6;
  95. }
  96. else if (player.itemAnimation > (int)((float)player.itemAnimationMax / 9))
  97. {
  98. projectile.frame = 7;
  99. }
  100. else
  101. {
  102. projectile.frame = 8;
  103. }
  104. projectile.position = (projectile.velocity + vector) - projectile.Size / 2f;
  105. projectile.rotation = projectile.velocity.ToRotation() + (projectile.direction == -1 ? 3.14f : 0);
  106. projectile.spriteDirection = projectile.direction;
  107. //player.ChangeDir(projectile.direction);
  108. player.heldProj = projectile.whoAmI;
  109. //player.itemTime = 10;
  110. //player.itemAnimation = 10;
  111. player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction));
  112. return false;
  113. }
  114. public override void OnHitNPC(NPC target, int damage, float knockBack, bool crit)
  115. {
  116. Player player = Main.player[projectile.owner];
  117. if (projectile.velocity.Y * player.gravDir > 0 && player.velocity.Y * player.gravDir > 0 && Math.Abs(projectile.velocity.X) < 2)
  118. {
  119. player.velocity.Y = Math.Abs(player.velocity.Y) < 5 ? -5 * player.gravDir : -player.velocity.Y;
  120. }
  121. }
  122. }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement