120 lines
5.9 KiB
C#
120 lines
5.9 KiB
C#
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class MadAlchemistsCocktailRed : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Mad Alchemist's Red 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.Item20, projectile.Center);
|
|
Main.PlaySound(SoundID.Item107, projectile.Center);
|
|
Gore.NewGore(projectile.Center, -projectile.oldVelocity * 0.2f, 704, 1f);
|
|
Gore.NewGore(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;
|
|
}
|
|
}
|
|
}
|
|
}
|