Files
CalamityModPublic/Projectiles/Ranged/FishronRPG.cs
T
CongratsIsTrash a93820a622 Ranged num murder
Intentionally did not touch BloodBoilerFire, CorossiveFlames, DrizzlefishFire, DrizzlefishFireSplit, DrizzlefishFireball, ElementalFire, EssenceFire, PristineFire, PristineSecondary, ShadeFire, and TerraFireGreen
2023-10-18 17:09:57 -04:00

119 lines
5.6 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class FishronRPG : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 95;
Projectile.DamageType = DamageClass.Ranged;
}
public override void AI()
{
if (Projectile.ai[1] == 0f)
{
for (int i = 0; i < 5; i++)
{
int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f);
Main.dust[dust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[dust].scale = 0.5f;
Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
Projectile.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item92, Projectile.position);
}
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
if (Projectile.owner == Main.myPlayer && Projectile.timeLeft <= 3)
{
Projectile.tileCollide = false;
Projectile.ai[1] = 0f;
Projectile.alpha = 255;
Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2);
Projectile.width = 200;
Projectile.height = 200;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
Projectile.knockBack = 10f;
}
else
{
if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f)
{
for (int j = 0; j < 2; j++)
{
float halfX = 0f;
float halfY = 0f;
if (j == 1)
{
halfX = Projectile.velocity.X * 0.5f;
halfY = Projectile.velocity.Y * 0.5f;
}
int fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 1f);
Main.dust[fishDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[fishDust].velocity *= 0.2f;
Main.dust[fishDust].noGravity = true;
fishDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 33, 0f, 0f, 100, default, 0.5f);
Main.dust[fishDust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[fishDust].velocity *= 0.05f;
}
}
}
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Dig, Projectile.position);
return true;
}
public override void OnKill(int timeLeft)
{
Projectile.position = Projectile.Center;
Projectile.width = Projectile.height = 48;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
Projectile.maxPenetrate = -1;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Damage();
SoundEngine.PlaySound(SoundID.Item92, Projectile.position);
for (int i = 0; i < 10; i++)
{
int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f);
Main.dust[dust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[dust].scale = 0.5f;
Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int i = 0; i < 20; i++)
{
int dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 3f);
Main.dust[dusty].noGravity = true;
Main.dust[dusty].velocity *= 5f;
dusty = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 2f);
Main.dust[dusty].velocity *= 2f;
}
}
}
}