Files
CalamityModPublic/Projectiles/Ranged/ScorchedEarthClusterBomb.cs
T

51 lines
1.8 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Ranged
{
public class ScorchedEarthClusterBomb : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = -1;
Projectile.timeLeft = 120;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -2;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.velocity *= 0.95f;
if (Projectile.velocity.Length() < 0.5f && Projectile.timeLeft > 10)
Projectile.timeLeft = 10;
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
for (int i = 0; i < 10; i++)
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 0, default, 1f);
}
int projAmt = Main.rand.Next(2, 4);
if (Projectile.owner == Main.myPlayer)
{
for (int k = 0; k < projAmt; k++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<RocketFire>(), Projectile.damage, 0f, Projectile.owner);
}
}
}
}
}