83 lines
2.5 KiB
C#
83 lines
2.5 KiB
C#
using CalamityMod.CalPlayer;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Typeless
|
|
{
|
|
public class ReaverOrb : ModProjectile
|
|
{
|
|
public int dust = 3;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Reaver Orb");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 48;
|
|
Projectile.height = 50;
|
|
Projectile.netImportant = true;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.timeLeft = 18000;
|
|
Projectile.alpha = 50;
|
|
Projectile.penetrate = -1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.timeLeft *= 5;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
bool correctMinion = Projectile.type == ModContent.ProjectileType<ReaverOrb>();
|
|
Player player = Main.player[Projectile.owner];
|
|
CalamityPlayer modPlayer = player.Calamity();
|
|
if (!modPlayer.reaverExplore)
|
|
{
|
|
Projectile.active = false;
|
|
return;
|
|
}
|
|
if (correctMinion)
|
|
{
|
|
if (player.dead)
|
|
{
|
|
modPlayer.rOrb = false;
|
|
}
|
|
if (modPlayer.rOrb)
|
|
{
|
|
Projectile.timeLeft = 2;
|
|
}
|
|
}
|
|
dust--;
|
|
if (dust >= 0)
|
|
{
|
|
int dustAmt = 50;
|
|
for (int d = 0; d < dustAmt; d++)
|
|
{
|
|
int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, 157, 0f, 0f, 0, default, 1f);
|
|
Main.dust[idx].velocity *= 2f;
|
|
Main.dust[idx].scale *= 1.15f;
|
|
}
|
|
}
|
|
|
|
Lighting.AddLight(Projectile.Center, 0.5f, 2f, 0.5f);
|
|
|
|
Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f);
|
|
if (player.gravDir == -1f)
|
|
{
|
|
Projectile.position.Y += 120f;
|
|
Projectile.rotation = MathHelper.Pi;
|
|
}
|
|
else
|
|
{
|
|
Projectile.rotation = 0f;
|
|
}
|
|
Projectile.position.X = (int)Projectile.position.X;
|
|
Projectile.position.Y = (int)Projectile.position.Y;
|
|
}
|
|
|
|
public override bool? CanDamage() => false;
|
|
}
|
|
}
|