Profaned Soul Crystal's anti-whip-stack only works on vanilla whips at the moment.
63 lines
2.5 KiB
C#
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 OnKill(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);
|
|
}
|
|
}
|
|
}
|