61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class CraniumSmasherExplosive : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Explosive Cranium Smasher");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 50;
|
|
projectile.height = 50;
|
|
projectile.friendly = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 300;
|
|
projectile.localNPCHitCooldown = 15;
|
|
projectile.tileCollide = false;
|
|
projectile.Calamity().rogue = true;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
projectile.ai[0] += 1f;
|
|
if (projectile.ai[0] >= 5f)
|
|
{
|
|
projectile.tileCollide = true;
|
|
}
|
|
projectile.rotation += projectile.velocity.X * 0.02f;
|
|
projectile.velocity.Y = projectile.velocity.Y + 0.085f;
|
|
projectile.velocity.X = projectile.velocity.X * 0.99f;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
projectile.position = projectile.Center;
|
|
projectile.width = projectile.height = 192;
|
|
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();
|
|
Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y);
|
|
CalamityUtils.ExplosionGores(projectile.Center, 3);
|
|
for (int num194 = 0; num194 < 25; num194++)
|
|
{
|
|
int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default, 2f);
|
|
Main.dust[num195].noGravity = true;
|
|
Main.dust[num195].velocity *= 0f;
|
|
}
|
|
}
|
|
}
|
|
}
|