Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Terraria;
- using Terraria.ModLoader;
- using Terraria.ID;
- namespace HarryPotter.Projectiles
- {
- public class Inferno : ModProjectile
- {
- public override void SetDefaults()
- {
- projectile.width = 16;
- projectile.height = 16;
- projectile.friendly = true;
- projectile.magic = true;
- projectile.penetrate = 1;
- projectile.timeLeft = 600;
- }
- public override void AI()
- {
- Player p = Main.player[projectile.owner];
- double deg = (double)projectile.ai[1];
- double rad = deg * (Math.PI / 180);
- double dist = 64;
- projectile.position.X = Player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2;
- projectile.position.Y = Player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2;
- projectile.ai[1] += 1f;
- projectile.velocity.Y += projectile.ai[0];
- if (Main.rand.Next(3) == 0) ;
- projectile.light = .3f;
- Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("ConfringoDust"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
- }
- public override bool OnTileCollide(Vector2 oldVelocity)
- {
- projectile.penetrate--;
- if (projectile.penetrate <= 0)
- {
- projectile.Kill();
- }
- else
- {
- projectile.ai[0] += 0.0f;
- if (projectile.velocity.X != oldVelocity.X)
- {
- projectile.velocity.X = -oldVelocity.X;
- }
- if (projectile.velocity.Y != oldVelocity.Y)
- {
- projectile.velocity.Y = -oldVelocity.Y;
- }
- projectile.velocity *= 0.75f;
- Main.PlaySound(SoundID.Item10, projectile.position);
- }
- return false;
- }
- public override void Kill(int timeLeft)
- {
- for (int k = 0; k < 5; k++)
- {
- Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("ConfringoDust"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
- }
- Main.PlaySound(SoundID.Item25, projectile.position);
- }
- public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
- {
- projectile.ai[0] += 0f;
- projectile.velocity *= 1f;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement