Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Terraria;
  8. using Terraria.ModLoader;
  9.  
  10. namespace QwertysRandomContent.NPCs.RuneSpectorBoss
  11. {
  12. class GreenRune : ModProjectile
  13. {
  14. public override void SetDefaults()
  15. {
  16. projectile.aiStyle = -1;
  17.  
  18. projectile.width = 200;
  19. projectile.height = 200;
  20. projectile.friendly = false;
  21. projectile.hostile = false;
  22. projectile.penetrate = -1;
  23. projectile.alpha = 255;
  24. projectile.tileCollide = false;
  25. projectile.timeLeft = 255 + 120 * 6;
  26.  
  27.  
  28. }
  29. public bool runOnce = true;
  30. public int runeTimer = -255;
  31. public Projectile leechRune;
  32.  
  33. public float startDistance = 100f;
  34. public override void AI()
  35. {
  36. Player player = Main.player[projectile.owner];
  37. projectile.velocity = new Vector2(0, 0);
  38. if (projectile.alpha > 0)
  39. projectile.alpha--;
  40. else
  41. {
  42. projectile.alpha = 0;
  43. }
  44.  
  45. runeTimer++;
  46.  
  47. if (runeTimer >=120)
  48. {
  49. if (Main.netMode != 1)
  50. {
  51. projectile.ai[1] = MathHelper.ToRadians(Main.rand.Next(0, 360));
  52. projectile.netUpdate = true;
  53. Projectile.NewProjectile(player.Center.X + (float)Math.Cos(projectile.ai[1]) * startDistance, player.Center.Y + (float)Math.Sin(projectile.ai[1]) * startDistance, 0, 0, mod.ProjectileType("LeechRune"), projectile.damage, 3f, Main.myPlayer);
  54. }
  55.  
  56. runeTimer = 0;
  57. }
  58.  
  59.  
  60.  
  61.  
  62. }
  63. }
  64. class LeechRune : ModProjectile
  65. {
  66. public override void SetDefaults()
  67. {
  68. projectile.aiStyle = -1;
  69.  
  70. projectile.width = 50;
  71. projectile.height = 50;
  72. projectile.friendly = false;
  73.  
  74. projectile.penetrate = -1;
  75. projectile.alpha = 255;
  76. projectile.tileCollide = false;
  77. projectile.timeLeft = 120;
  78. projectile.hostile = false;
  79.  
  80.  
  81. }
  82. public bool runOnce = true;
  83. public int runeTimer;
  84. public Projectile leechRune;
  85. public float attackAngle;
  86. public float attackSpeed = 10f;
  87. public override void AI()
  88. {
  89. Player player = Main.player[projectile.owner];
  90. projectile.velocity = new Vector2(0, 0);
  91. if (projectile.alpha > 0)
  92. {
  93. projectile.alpha -= 255 / 60;
  94.  
  95. projectile.hostile = false;
  96. }
  97. else
  98. {
  99.  
  100. projectile.alpha = 0;
  101. }
  102. runeTimer += 255 / 60;
  103. if (runeTimer >=255)
  104. {
  105. if (runOnce )
  106. {
  107.  
  108. attackAngle = (player.Center - projectile.Center).ToRotation();
  109.  
  110.  
  111. runOnce = false;
  112.  
  113.  
  114.  
  115. }
  116. projectile.rotation += MathHelper.ToRadians(3);
  117. projectile.hostile = true;
  118. projectile.velocity = new Vector2((float)Math.Cos(attackAngle) * attackSpeed, (float)Math.Sin(attackAngle) * attackSpeed);
  119.  
  120.  
  121. }
  122.  
  123.  
  124. }
  125. public NPC runeSpector;
  126. public override void OnHitPlayer(Player target, int damage, bool crit)
  127. {
  128. foreach (NPC npcSearch in Main.npc)
  129. {
  130. if (npcSearch.type == mod.NPCType("RuneSpector"))
  131. runeSpector = npcSearch;
  132. }
  133. if (runeSpector.active)
  134. {
  135. runeSpector.life += damage * 20;
  136. CombatText.NewText(runeSpector.getRect(), Color.Green, damage * 20, false, true);
  137. }
  138. }
  139. public override void Kill(int timeLeft)
  140. {
  141. Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("LeechRuneDeath"));
  142. }
  143. }
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement