Files
CalamityModPublic/Projectiles/Magic/IceBlockIcicle.cs
T
Xyk 7aa44ad7d9 Changed all ~640 instances of Main.rand.NextBool(2) to remove the unnecessary 2
Also I forgot to push my reality rupture and ichor spear minor tweaks before hand so they're in here too.
Reality rupture stealth hit sound is louder.
Reality rupture stealth visual always has at least one big crack, cracks fade out.
There's more consistency in the spark particles on realty rupture stealth and ichor spear on hit sparks.
Reality Rupture stealth produces light.
2023-09-26 01:58:55 -07:00

63 lines
2.5 KiB
C#

using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class IceBlockIcicle : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override void SetDefaults()
{
Projectile.width = 18;
Projectile.height = 18;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.timeLeft = 600;
Projectile.coldDamage = true;
}
public override void AI()
{
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.Pi * 0.5f * Projectile.direction);
Projectile.velocity.Y += 0.25f;
if(Projectile.velocity.Y > 16f)
{
Projectile.velocity.Y = 16f;
}
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.ai[0] == 1f)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Magic/IceBlockIcicle2").Value;
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0);
return false;
}
return true;
}
public override void Kill(int timeLeft)
{
for (int i = 0; i < 20; i++)
{
int dustType = Main.rand.NextBool() ? 68 : 67;
if (Main.rand.NextBool(4))
{
dustType = 80;
}
Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f));
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, direction.X, direction.Y, 50, default, 1.1f);
Main.dust[dust].noGravity = true;
}
SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center);
}
}
}