Files
CalamityModPublic/Projectiles/Magic/MadAlchemistsCocktailBlue.cs
T

60 lines
2.1 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class MadAlchemistsCocktailBlue : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mad Alchemist's Cocktail Blue");
}
public override void SetDefaults()
{
projectile.width = 24;
projectile.height = 24;
projectile.friendly = true;
projectile.magic = true;
projectile.ignoreWater = true;
projectile.penetrate = 1;
}
public override void AI()
{
projectile.rotation += Math.Abs(projectile.velocity.X) * 0.04f * (float)projectile.direction;
projectile.ai[0] += 1f;
if (projectile.ai[0] >= 90f)
{
projectile.velocity.Y = projectile.velocity.Y + 0.4f;
projectile.velocity.X = projectile.velocity.X * 0.97f;
}
if (projectile.velocity.Y > 16f)
{
projectile.velocity.Y = 16f;
}
}
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item107, projectile.position);
Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f);
Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 705, 1f);
int num220 = Main.rand.Next(20, 31);
if (projectile.owner == Main.myPlayer)
{
for (int num221 = 0; num221 < num220; num221++)
{
Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
value17.Normalize();
value17 *= (float)Main.rand.Next(10, 201) * 0.01f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType<MadAlchemistsCocktailGasCloud>(), projectile.damage / 4, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1));
}
}
}
}
}