Files
CalamityModPublic/Projectiles/Ranged/MiniRocket.cs
T
Andrew Marheine cb6b42f43f 1 - Highest tier accessory reforges now reforge into other highest tier accessory reforges.
2 - Nerfed Amalgam extra projectile damage values.
3 - Arma bags now only drop on first boss kills.
4 - Nerfed Conference Call extra bullet damage by 30%.
5 - Cal Clone dashes are no longer predictive.
6 - Old Duke looks in the direction he's about to dash instead of directly at the player, if he's going to dash.
7 - Updated pillar spawn code a bit more.
8 - Pulse Rifle now works like it should and doesn't hit 4 times on a single target.
9 - Adjusted HomeInOnNPC calls to use projectile.tileCollide to decide homing through tiles or not.
2021-04-13 00:19:56 -05:00

102 lines
3.7 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class MiniRocket : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rocket");
Main.projFrames[projectile.type] = 4;
}
public override void SetDefaults()
{
projectile.width = 14;
projectile.height = 14;
projectile.friendly = true;
projectile.penetrate = 1;
projectile.timeLeft = 95;
projectile.ranged = true;
}
public override void AI()
{
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90);
if (projectile.ai[0] == 0f)
{
Main.PlaySound(SoundID.Item11, (int)projectile.Center.X, (int)projectile.Center.Y);
projectile.ai[0] = 1f;
}
//Animation
projectile.frameCounter++;
if (projectile.frameCounter > 7)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame >= Main.projFrames[projectile.type])
{
projectile.frame = 0;
}
if (projectile.velocity.Length() >= 8f)
{
for (int num246 = 0; num246 < 2; num246++)
{
float num247 = 0f;
float num248 = 0f;
if (num246 == 1)
{
num247 = projectile.velocity.X * 0.5f;
num248 = projectile.velocity.Y * 0.5f;
}
int num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 6, 0f, 0f, 100, default, 1f);
Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[num249].velocity *= 0.2f;
Main.dust[num249].noGravity = true;
num249 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num247, projectile.position.Y + 3f + num248) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f);
Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[num249].velocity *= 0.05f;
}
}
CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f);
}
public override void Kill(int timeLeft)
{
CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32);
projectile.maxPenetrate = -1;
projectile.penetrate = -1;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 10;
projectile.Damage();
Main.PlaySound(SoundID.Item14, projectile.position);
for (int num621 = 0; num621 < 20; num621++)
{
int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default, 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 < 30; num623++)
{
int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
}
CalamityUtils.ExplosionGores(projectile.Center, 3);
}
}
}