67 lines
2.6 KiB
C#
67 lines
2.6 KiB
C#
using System;
|
|
using CalamityMod.Dusts;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class BrimstoneBoom : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Melee";
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 20;
|
|
Projectile.height = 20;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
Projectile.penetrate = -1;
|
|
Projectile.timeLeft = 5;
|
|
Projectile.usesIDStaticNPCImmunity = true;
|
|
Projectile.idStaticNPCHitCooldown = 10;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f);
|
|
float projTimer = 25f;
|
|
if (Projectile.ai[0] > 180f)
|
|
{
|
|
projTimer -= (Projectile.ai[0] - 180f) / 2f;
|
|
}
|
|
if (projTimer <= 0f)
|
|
{
|
|
projTimer = 0f;
|
|
Projectile.Kill();
|
|
}
|
|
projTimer *= 0.7f;
|
|
Projectile.ai[0] += 4f;
|
|
int timerCounter = 0;
|
|
while (timerCounter < projTimer)
|
|
{
|
|
float rando1 = Main.rand.Next(-10, 11);
|
|
float rando2 = Main.rand.Next(-10, 11);
|
|
float rando3 = Main.rand.Next(3, 9);
|
|
float randoAdjuster = (float)Math.Sqrt(rando1 * rando1 + rando2 * rando2);
|
|
randoAdjuster = rando3 / randoAdjuster;
|
|
rando1 *= randoAdjuster;
|
|
rando2 *= randoAdjuster;
|
|
int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f);
|
|
Main.dust[brimDust].noGravity = true;
|
|
Main.dust[brimDust].position.X = Projectile.Center.X;
|
|
Main.dust[brimDust].position.Y = Projectile.Center.Y;
|
|
Dust expr_149DF_cp_0 = Main.dust[brimDust];
|
|
expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11);
|
|
Dust expr_14A09_cp_0 = Main.dust[brimDust];
|
|
expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11);
|
|
Main.dust[brimDust].velocity.X = rando1;
|
|
Main.dust[brimDust].velocity.Y = rando2;
|
|
timerCounter++;
|
|
}
|
|
}
|
|
}
|
|
}
|