Files
CalamityModPublic/Projectiles/Rogue/SupernovaSpike.cs
T
termigator1359 1b22071cf4 squash merge: Removed all unused textures
Removed nearly all unused textures in the entire mod, especially focusing on projectiles.
Apotheosis & the Death Valley Duster weapon line were ignored to prevent merge conflicts.
2020-11-15 14:25:46 -05:00

132 lines
4.9 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class SupernovaSpike : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/Rogue/BallisticPoisonBombSpike";
private Color currentColor = Color.Black;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Spike");
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.alpha = 255;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.penetrate = 3;
projectile.alpha = 255;
projectile.extraUpdates = 2;
projectile.aiStyle = 93;
aiType = ProjectileID.NailFriendly;
projectile.Calamity().rogue = true;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 5;
}
public override void AI()
{
projectile.alpha -= 10;
if (projectile.alpha < 0)
{
projectile.alpha = 0;
}
int num298 = Main.rand.NextBool(2) ? 107 : 234;
if (Main.rand.NextBool(4))
{
num298 = 269;
}
projectile.localAI[1] += 1f;
if (projectile.localAI[1] > 4f)
{
int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 0.75f);
Main.dust[num469].noGravity = true;
Main.dust[num469].velocity *= 0f;
}
if (currentColor == Color.Black)
{
int startPoint = Main.rand.Next(6);
projectile.localAI[0] = startPoint;
currentColor = GetStartingColor(startPoint);
}
Visuals(projectile, ref currentColor);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.ExoDebuffs();
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.ExoDebuffs();
}
internal static void Visuals(Projectile projectile, ref Color c)
{
CalamityUtils.IterateDisco(ref c, ref projectile.localAI[0], 15);
Vector3 compositeColor = 0.1f * Color.White.ToVector3() + 0.05f * c.ToVector3();
Lighting.AddLight(projectile.Center, compositeColor);
}
internal static Color GetStartingColor(int startPoint = 0)
{
switch (startPoint)
{
default: return new Color(1f, 0f, 0f, 0f); // Color.Red
case 1: return new Color(1f, 1f, 0f, 0f); // Color.Yellow
case 2: return new Color(0f, 1f, 0f, 0f); // Color.Green
case 3: return new Color(0f, 1f, 1f, 0f); // Color.Turquoise
case 4: return new Color(0f, 0f, 1f, 0f); // Color.Blue
case 5: return new Color(1f, 0f, 1f, 0f); // Color.Violet
}
}
// This projectile is always fullbright.
public override Color? GetAlpha(Color lightColor)
{
return currentColor;
}
public override void Kill(int timeLeft)
{
projectile.position = projectile.Center;
projectile.width = projectile.height = 32;
projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
int num298 = Main.rand.NextBool(2) ? 107 : 234;
if (Main.rand.NextBool(4))
{
num298 = 269;
}
for (int num621 = 0; num621 < 2; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num298, 0f, 0f, 100, default, 1.2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 2; num623++)
{
int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f);
Main.dust[num624].velocity *= 2f;
}
}
}
}