Files
CalamityModPublic/Projectiles/Magic/MadAlchemistsCocktailBlue.cs
T

63 lines
2.3 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class MadAlchemistsCocktailBlue : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override void SetDefaults()
{
Projectile.width = 24;
Projectile.height = 24;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
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)
{
SoundEngine.PlaySound(SoundID.Item107, Projectile.position);
if (Main.netMode != NetmodeID.Server)
{
Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f);
Gore.NewGore(Projectile.GetSource_Death(), 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.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, v.X, v.Y, ModContent.ProjectileType<MadAlchemistsCocktailGasCloud>(), cloudDamage, 0f, Projectile.owner, 0f, (float)Main.rand.Next(-45, 1));
}
}
}
}
}