Files
CalamityModPublic/Projectiles/Magic/MadAlchemistsCocktailBlue.cs
T

62 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 Blue Cocktail");
}
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 numClouds = 9;
int cloudDamage = projectile.damage / 2;
if (projectile.owner == Main.myPlayer)
{
for (int i = 0; i < numClouds; i++)
{
Vector2 v = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
v.Normalize();
v *= (float)Main.rand.Next(10, 201) * 0.01f;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, v.X, v.Y, ModContent.ProjectileType<MadAlchemistsCocktailGasCloud>(), cloudDamage, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1));
}
}
}
}
}