Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Terraria.Graphics.Effects;
- using Terraria.Graphics.Shaders;
- using Terraria;
- using Terraria.ID;
- using Terraria.ModLoader;
- using Terraria.ObjectData;
- using System.Threading;
- using System;
- using System.Diagnostics;
- using Terraria.World.Generation;
- using System.Collections.Generic;
- using Terraria.GameContent.Generation;
- using System.Threading.Tasks;
- namespace volarity.Projectiles
- {
- public class KeliteYoYoProjectile : ModProjectile
- {
- public override void SetStaticDefaults()
- {
- // The following sets are only applicable to yoyo that use aiStyle 99.
- // YoyosLifeTimeMultiplier is how long in seconds the yoyo will stay out before automatically returning to the player.
- // Vanilla values range from 3f(Wood) to 16f(Chik), and defaults to -1f. Leaving as -1 will make the time infinite.
- ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f;
- // YoyosMaximumRange is the maximum distance the yoyo sleep away from the player.
- // Vanilla values range from 130f(Wood) to 400f(Terrarian), and defaults to 200f
- ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 3000f;
- // YoyosTopSpeed is top speed of the yoyo projectile.
- // Vanilla values range from 9f(Wood) to 17.5f(Terrarian), and defaults to 10f
- ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 20f;
- }
- public override void SetDefaults()
- {
- projectile.extraUpdates = 0;
- projectile.width = 16;
- projectile.height = 16;
- // aiStyle 99 is used for all yoyos, and is Extremely suggested, as yoyo are extremely difficult without them
- projectile.aiStyle = 99;
- projectile.friendly = true;
- projectile.penetrate = -1;
- projectile.melee = true;
- }
- public override void PostAI()
- {
- if (Main.rand.NextBool())
- {
- Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 53);
- dust.noGravity = false;
- dust.scale = 1.6f;
- Lighting.AddLight(projectile.position, 3f,3f,3f);
- Vector2 target = new Vector2(projectile.ai[0], projectile.ai[1]);
- int numberProjectiles = 3 + Main.rand.Next(1);
- Vector2 perturbedSpeed = new Vector2(Main.rand.Next(30)-15, Main.rand.Next(30) - 15).RotatedByRandom(MathHelper.ToRadians(20));
- Projectile.NewProjectile(target, perturbedSpeed, ProjectileID.ChlorophyteBullet,123,4);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement