Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2.  
  3. using Terraria;
  4.  
  5. using Terraria.ID;
  6.  
  7.  
  8.  
  9. namespace ExampleMod.Projectiles.Minions
  10.  
  11. {
  12.  
  13. //ported from my tAPI mod because I'm lazy
  14.  
  15. public class shrabshark : HoverShooter
  16.  
  17. {
  18.  
  19. public override void SetStaticDefaults() {
  20.  
  21. Main.projFrames[projectile.type] = 3;
  22.  
  23. Main.projPet[projectile.type] = true;
  24.  
  25. ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
  26.  
  27. ProjectileID.Sets.Homing[projectile.type] = true;
  28.  
  29. ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; //This is necessary for right-click targeting
  30.  
  31. }
  32.  
  33.  
  34.  
  35. public override void SetDefaults() {
  36.  
  37. projectile.netImportant = true;
  38.  
  39. projectile.width = 24;
  40.  
  41. projectile.height = 32;
  42.  
  43. projectile.friendly = true;
  44.  
  45. projectile.minion = true;
  46.  
  47. projectile.minionSlots = 1;
  48.  
  49. projectile.penetrate = -1;
  50.  
  51. projectile.timeLeft = 18000;
  52.  
  53. projectile.tileCollide = false;
  54.  
  55. projectile.ignoreWater = true;
  56.  
  57. inertia = 20f;
  58.  
  59. shoot = mod.ProjectileType("shrabcrab");
  60.  
  61. shootSpeed = 20f;
  62.  
  63. }
  64.  
  65.  
  66.  
  67. public override void CheckActive() {
  68.  
  69. Player player = Main.player[projectile.owner];
  70.  
  71. ExamplePlayer modPlayer = player.GetModPlayer<ExamplePlayer>();
  72.  
  73. if (player.dead) {
  74.  
  75. modPlayer.purityMinion = false;
  76.  
  77. }
  78.  
  79. if (modPlayer.purityMinion) { // Make sure you are resetting this bool in ModPlayer.ResetEffects. See ExamplePlayer.ResetEffects
  80.  
  81. projectile.timeLeft = 2;
  82.  
  83. }
  84.  
  85. }
  86.  
  87.  
  88.  
  89. public override void CreateDust() {
  90.  
  91. if (projectile.ai[0] == 0f) {
  92.  
  93. if (Main.rand.NextBool(5)) {
  94.  
  95. int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height / 2, mod.DustType("PuriumFlame"));
  96.  
  97. Main.dust[dust].velocity.Y -= 1.2f;
  98.  
  99. }
  100.  
  101. }
  102.  
  103. else {
  104.  
  105. if (Main.rand.NextBool(3)) {
  106.  
  107. Vector2 dustVel = projectile.velocity;
  108.  
  109. if (dustVel != Vector2.Zero) {
  110.  
  111. dustVel.Normalize();
  112.  
  113. }
  114.  
  115. int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType("PuriumFlame"));
  116.  
  117. Main.dust[dust].velocity -= 1.2f * dustVel;
  118.  
  119. }
  120.  
  121. }
  122.  
  123. Lighting.AddLight((int)(projectile.Center.X / 16f), (int)(projectile.Center.Y / 16f), 0.6f, 0.9f, 0.3f);
  124.  
  125. }
  126.  
  127.  
  128.  
  129. public override void SelectFrame() {
  130.  
  131. projectile.frameCounter++;
  132.  
  133. if (projectile.frameCounter >= 8) {
  134.  
  135. projectile.frameCounter = 0;
  136.  
  137. projectile.frame = (projectile.frame + 1) % 3;
  138.  
  139. }
  140.  
  141. }
  142.  
  143. }
  144.  
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement