96 lines
3.9 KiB
C#
96 lines
3.9 KiB
C#
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Ranged
|
|
{
|
|
public class DaemonsFlameArrow : ModProjectile
|
|
{
|
|
public int x;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Arrow");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 16;
|
|
projectile.height = 16;
|
|
projectile.friendly = true;
|
|
projectile.penetrate = 5;
|
|
projectile.tileCollide = false;
|
|
projectile.timeLeft = 300;
|
|
projectile.ranged = true;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 10;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
projectile.rotation += 0.15f;
|
|
Lighting.AddLight(projectile.Center, new Vector3(245, 124, 110) * (1.7f / 255));
|
|
x++;
|
|
projectile.localAI[0] += 1f;
|
|
if (projectile.localAI[0] > 30f)
|
|
{
|
|
projectile.velocity.Y = (float)(((double)projectile.ai[1]) * Math.Sin(x / 4));
|
|
}
|
|
for (int num151 = 0; num151 < 2; num151++)
|
|
{
|
|
int num154 = 14;
|
|
int num155 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 60, 0f, 0f, 100, default, 1.6f);
|
|
Main.dust[num155].noGravity = true;
|
|
Main.dust[num155].velocity *= 0.1f;
|
|
Main.dust[num155].velocity += projectile.velocity * 0.5f;
|
|
}
|
|
if (Main.rand.NextBool(13))
|
|
{
|
|
int num156 = 16;
|
|
int num157 = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 60, 0f, 0f, 100, default, 1f);
|
|
Main.dust[num157].velocity *= 0.25f;
|
|
Main.dust[num157].velocity += projectile.velocity * 0.5f;
|
|
}
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Main.PlaySound(SoundID.Item14, projectile.Center);
|
|
|
|
// Massively inflate the projectile's hitbox
|
|
projectile.position = projectile.Center;
|
|
projectile.width = projectile.height = 160;
|
|
projectile.position.X = projectile.position.X - projectile.width / 2;
|
|
projectile.position.Y = projectile.position.Y - projectile.height / 2;
|
|
|
|
// Allow infinite piercing and completely ignoring iframes for this one last hit
|
|
projectile.maxPenetrate = -1;
|
|
projectile.penetrate = -1;
|
|
projectile.usesLocalNPCImmunity = false;
|
|
projectile.usesIDStaticNPCImmunity = true;
|
|
projectile.idStaticNPCHitCooldown = 0;
|
|
projectile.Damage();
|
|
|
|
for (int num621 = 0; num621 < 10; num621++)
|
|
{
|
|
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.2f);
|
|
Main.dust[num622].velocity *= 3f;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
Main.dust[num622].scale = 0.5f;
|
|
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int num623 = 0; num623 < 20; num623++)
|
|
{
|
|
int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1.7f);
|
|
Main.dust[num624].noGravity = true;
|
|
Main.dust[num624].velocity *= 5f;
|
|
num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 60, 0f, 0f, 100, default, 1f);
|
|
Main.dust[num624].velocity *= 2f;
|
|
}
|
|
}
|
|
}
|
|
}
|