121 lines
6.0 KiB
C#
121 lines
6.0 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 MadAlchemistsCocktailRed : 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.Item20, Projectile.Center);
|
|
SoundEngine.PlaySound(SoundID.Item107, Projectile.Center);
|
|
|
|
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);
|
|
}
|
|
|
|
// This previously had a width of 480 pixels and did triple damage.
|
|
// It now has a width of 110 pixels and deals 1/2 damage.
|
|
int blastWidth = 110;
|
|
Projectile.position = Projectile.Center;
|
|
Projectile.width = Projectile.height = blastWidth;
|
|
Projectile.Center = Projectile.position;
|
|
Projectile.maxPenetrate = -1;
|
|
Projectile.penetrate = -1;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = -1;
|
|
Projectile.damage /= 2;
|
|
Projectile.Damage();
|
|
|
|
// I don't even know what this dust code does
|
|
float num50 = 3f;
|
|
float num51 = 2.4f;
|
|
float num52 = 3.8f;
|
|
Vector2 value3 = (0f - 1.57079637f).ToRotationVector2();
|
|
Vector2 value4 = value3 * Projectile.velocity.Length() * (float)Projectile.MaxUpdates;
|
|
int num3;
|
|
for (int num53 = 0; num53 < 60; num53 = num3 + 1)
|
|
{
|
|
int num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 200, default, num50);
|
|
Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f;
|
|
Main.dust[num54].noGravity = true;
|
|
Dust dust = Main.dust[num54];
|
|
dust.velocity *= 8f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity += value4 * Main.rand.NextFloat();
|
|
num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51);
|
|
Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity *= 6f;
|
|
Main.dust[num54].noGravity = true;
|
|
Main.dust[num54].fadeIn = 1f;
|
|
Main.dust[num54].color = Color.Crimson * 0.5f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity += value4 * Main.rand.NextFloat();
|
|
num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51);
|
|
Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity *= 4f;
|
|
Main.dust[num54].noGravity = true;
|
|
Main.dust[num54].fadeIn = 1f;
|
|
Main.dust[num54].color = Color.Crimson * 0.5f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity += value4 * Main.rand.NextFloat();
|
|
num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 100, default, num51);
|
|
Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)Projectile.width / 2f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity *= 2f;
|
|
Main.dust[num54].noGravity = true;
|
|
Main.dust[num54].fadeIn = 1f;
|
|
Main.dust[num54].color = Color.Crimson * 0.5f;
|
|
dust = Main.dust[num54];
|
|
dust.velocity += value4 * Main.rand.NextFloat();
|
|
num3 = num53;
|
|
}
|
|
for (int num55 = 0; num55 < 30; num55 = num3 + 1)
|
|
{
|
|
int num56 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 174, 0f, 0f, 0, default, num52);
|
|
Main.dust[num56].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)Projectile.velocity.ToRotation(), default) * (float)Projectile.width / 3f;
|
|
Main.dust[num56].noGravity = true;
|
|
Dust dust = Main.dust[num56];
|
|
dust.velocity *= 0.5f;
|
|
dust = Main.dust[num56];
|
|
dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat());
|
|
num3 = num55;
|
|
}
|
|
}
|
|
}
|
|
}
|