Advertisement
Guest User

Untitled

a guest
May 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.76 KB | None | 0 0
  1. using Microsoft.Xna.Framework;
  2. using Microsoft.Xna.Framework.Graphics;
  3. using Terraria.Graphics.Effects;
  4. using Terraria.Graphics.Shaders;
  5. using Terraria;
  6. using Terraria.ID;
  7. using Terraria.ModLoader;
  8. using Terraria.ObjectData;
  9. using System.Threading;
  10. using System;
  11. using System.Diagnostics;
  12. using Terraria.World.Generation;
  13. using System.Collections.Generic;
  14. using Terraria.GameContent.Generation;
  15. using System.Threading.Tasks;
  16.  
  17. namespace volarity.Projectiles
  18. {
  19.     public class KeliteYoYoProjectile : ModProjectile
  20.     {
  21.         public override void SetStaticDefaults()
  22.         {
  23.             // The following sets are only applicable to yoyo that use aiStyle 99.
  24.             // YoyosLifeTimeMultiplier is how long in seconds the yoyo will stay out before automatically returning to the player.
  25.             // Vanilla values range from 3f(Wood) to 16f(Chik), and defaults to -1f. Leaving as -1 will make the time infinite.
  26.             ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f;
  27.             // YoyosMaximumRange is the maximum distance the yoyo sleep away from the player.
  28.             // Vanilla values range from 130f(Wood) to 400f(Terrarian), and defaults to 200f
  29.             ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 3000f;
  30.             // YoyosTopSpeed is top speed of the yoyo projectile.
  31.             // Vanilla values range from 9f(Wood) to 17.5f(Terrarian), and defaults to 10f
  32.             ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f;
  33.         }
  34.  
  35.         public override void SetDefaults()
  36.         {
  37.             projectile.extraUpdates = 0;
  38.             projectile.width = 16;
  39.             projectile.height = 16;
  40.             // aiStyle 99 is used for all yoyos, and is Extremely suggested, as yoyo are extremely difficult without them
  41.             projectile.aiStyle = 99;
  42.             projectile.friendly = true;
  43.             projectile.penetrate = -1;
  44.             projectile.melee = true;
  45.  
  46.         }
  47.         public override void PostAI()
  48.         {
  49.             if (Main.rand.NextBool())
  50.             {
  51.                
  52.                 Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 53);
  53.                 dust.noGravity = false;
  54.                 dust.scale = 1.6f;
  55.                 Lighting.AddLight(projectile.position, 3f,3f,3f);
  56.  
  57.  
  58.                 Vector2 target = new Vector2(projectile.ai[0], projectile.ai[1]);
  59.  
  60.                 int numberProjectiles = 3 + Main.rand.Next(1);
  61.                 Vector2 perturbedSpeed = new Vector2(Main.rand.Next(30)-15, Main.rand.Next(30) - 15).RotatedByRandom(MathHelper.ToRadians(20));
  62.                 Projectile.NewProjectile(target, perturbedSpeed, ProjectileID.ChlorophyteBullet,123,4);
  63.                 }
  64.         }
  65.        
  66.  
  67.  
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement