Files
CalamityModPublic/Projectiles/Boss/OldDukeToothBallSpike.cs
T
Ozzatron ba14da9cdd Initial tModPorter run. Almost all of this is Kill -> OnKill in every Projectile ever.
Profaned Soul Crystal's anti-whip-stack only works on vanilla whips at the moment.
2023-09-30 01:17:11 -04:00

63 lines
2.3 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class OldDukeToothBallSpike : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.hostile = true;
Projectile.timeLeft = 600;
Projectile.ignoreWater = true;
CooldownSlot = ImmunityCooldownID.Bosses;
}
public override void AI()
{
Lighting.AddLight((int)((Projectile.position.X + (Projectile.width / 2)) / 16f), (int)((Projectile.position.Y + (Projectile.height / 2)) / 16f), 0.45f, 0.35f, 0f);
float finalVelocity = new Vector2(Projectile.ai[0], Projectile.ai[1]).Length();
if (Projectile.velocity.Length() < finalVelocity)
Projectile.velocity *= 1.025f;
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
for (int i = 0; i < 2; i++)
{
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.6f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0.3f;
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (info.Damage <= 0)
return;
target.AddBuff(ModContent.BuffType<Irradiated>(), 120);
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i <= 2; i++)
{
int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 3f;
idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 3f;
}
}
}
}