54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using CalamityMod.CalPlayer;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Pets
|
|
{
|
|
public class SCalPet : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Supreme Calamitas");
|
|
Main.projFrames[Projectile.type] = 6;
|
|
Main.projPet[Projectile.type] = true;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.netImportant = true;
|
|
Projectile.width = 30;
|
|
Projectile.height = 30;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft *= 5;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Player player = Main.player[Projectile.owner];
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
if (!player.active)
|
|
{
|
|
Projectile.active = false;
|
|
return;
|
|
}
|
|
if (player.dead)
|
|
{
|
|
modPlayer.scalPet = false;
|
|
}
|
|
if (modPlayer.scalPet)
|
|
{
|
|
Projectile.timeLeft = 2;
|
|
}
|
|
Projectile.FloatingPetAI(false, 0.05f);
|
|
Projectile.rotation -= Projectile.spriteDirection * MathHelper.PiOver2;
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 6)
|
|
{
|
|
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type];
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|