Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
129 lines
4.6 KiB
C#
129 lines
4.6 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System.IO;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class InfernalFireballEruption : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Dragon Fireball");
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 30;
|
|
projectile.height = 30;
|
|
projectile.friendly = true;
|
|
projectile.alpha = 255;
|
|
projectile.penetrate = -1;
|
|
projectile.timeLeft = 3600;
|
|
projectile.Calamity().rogue = true;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 30;
|
|
}
|
|
|
|
public override void SendExtraAI(BinaryWriter writer)
|
|
{
|
|
writer.Write(projectile.localAI[0]);
|
|
writer.Write(projectile.localAI[1]);
|
|
}
|
|
|
|
public override void ReceiveExtraAI(BinaryReader reader)
|
|
{
|
|
projectile.localAI[0] = reader.ReadSingle();
|
|
projectile.localAI[1] = reader.ReadSingle();
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (projectile.velocity.Y < 0f)
|
|
{
|
|
projectile.velocity.Y *= 0.97f;
|
|
}
|
|
else
|
|
{
|
|
projectile.velocity.Y *= 1.03f;
|
|
if (projectile.velocity.Y > 16f)
|
|
{
|
|
projectile.velocity.Y = 16f;
|
|
}
|
|
}
|
|
if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f)
|
|
{
|
|
projectile.localAI[1] = 1f;
|
|
projectile.velocity.Y = 1f;
|
|
}
|
|
projectile.velocity.X *= 0.995f;
|
|
projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f;
|
|
if (projectile.localAI[0] == 0f)
|
|
{
|
|
projectile.localAI[0] = 1f;
|
|
Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center);
|
|
}
|
|
if (projectile.ai[0] >= 2f)
|
|
{
|
|
projectile.alpha -= 25;
|
|
if (projectile.alpha < 0)
|
|
{
|
|
projectile.alpha = 0;
|
|
}
|
|
}
|
|
if (Main.rand.NextBool(16))
|
|
{
|
|
Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default, 1f);
|
|
dust.scale *= 0.7f;
|
|
dust.velocity += projectile.velocity * 0.25f;
|
|
}
|
|
}
|
|
|
|
public override bool CanHitPlayer(Player target)
|
|
{
|
|
if (projectile.velocity.Y < -16f)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(255, Main.DiscoG, 53, projectile.alpha);
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14, 0.5f, 0f);
|
|
projectile.position = projectile.Center;
|
|
projectile.width = projectile.height = 144;
|
|
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
|
|
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
|
|
for (int num193 = 0; num193 < 2; num193++)
|
|
{
|
|
Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f);
|
|
}
|
|
for (int num194 = 0; num194 < 20; num194++)
|
|
{
|
|
int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default, 2.5f);
|
|
Main.dust[num195].noGravity = true;
|
|
Main.dust[num195].velocity *= 3f;
|
|
num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 100, default, 1.5f);
|
|
Main.dust[num195].velocity *= 2f;
|
|
Main.dust[num195].noGravity = true;
|
|
}
|
|
}
|
|
}
|
|
}
|