Supernova Spam
This commit is contained in:
1 parent
5a4537a8bf
commit
fd1a7aa246
7 files changed
+354
-153
No files matched your search
@@ -14,19 +14,19 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class Supernova : RogueWeapon
|
||||
{
|
||||
public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.8f };
|
||||
public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f };
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 34;
|
||||
Item.height = 36;
|
||||
Item.damage = 675;
|
||||
Item.damage = 375;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 24;
|
||||
Item.useAnimation = 48;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTime = 24;
|
||||
Item.knockBack = 8f;
|
||||
Item.UseSound = SoundID.Item15;
|
||||
Item.useTime = 70;
|
||||
Item.knockBack = 18f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
Item.shoot = ModContent.ProjectileType<SupernovaBomb>();
|
||||
@@ -46,7 +46,9 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Main.projectile[stealth].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
else
|
||||
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1020 B After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 233 KiB |
+201
-124
@@ -1,7 +1,11 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -13,7 +17,13 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova";
|
||||
|
||||
public Color variedColor = Color.White;
|
||||
public Color mainColor = Color.LawnGreen;
|
||||
public Color randomColor = Color.White;
|
||||
public int colorTimer = 0;
|
||||
public int time = 0;
|
||||
public bool homing = false;
|
||||
public bool returning = false;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
|
||||
@@ -22,163 +32,230 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 34;
|
||||
Projectile.height = 34;
|
||||
Projectile.width = 106;
|
||||
Projectile.height = 112;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 200;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//dust and lighting
|
||||
int dustType = Main.rand.NextBool() ? 107 : 234;
|
||||
if (Main.rand.NextBool(4))
|
||||
randomColor = Main.rand.Next(4) switch
|
||||
{
|
||||
dustType = 269;
|
||||
}
|
||||
if (Main.rand.NextBool(6))
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
|
||||
}
|
||||
Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f);
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
if (time == 0)
|
||||
mainColor = randomColor;
|
||||
|
||||
//velocity
|
||||
Projectile.ai[0] += 1f;
|
||||
if (Projectile.ai[0] > 10f)
|
||||
|
||||
if (time % 20 == 0)
|
||||
{
|
||||
Projectile.ai[0] = 10f;
|
||||
if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f)
|
||||
variedColor = colorTimer switch
|
||||
{
|
||||
Projectile.velocity.X *= 0.97f;
|
||||
if (Math.Abs(Projectile.velocity.X) < 0.01f)
|
||||
{
|
||||
Projectile.velocity.X = 0f;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
Projectile.velocity.Y += 0.2f;
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
colorTimer++;
|
||||
if (colorTimer >= 4)
|
||||
colorTimer = 0;
|
||||
}
|
||||
|
||||
//rotation
|
||||
Projectile.rotation += Projectile.velocity.X * 0.1f;
|
||||
Vector2 visualDirection = new Vector2(17, -17).RotatedBy(Projectile.rotation);
|
||||
Vector2 rotatedVisualDirection = new Vector2(17, -17).RotatedByRandom(0.5).RotatedBy(Projectile.rotation);
|
||||
PointParticle orb = new PointParticle(Projectile.Center + visualDirection, visualDirection * Main.rand.NextFloat(0.01f, 0.3f), false, 5, Main.rand.NextFloat(0.8f, 1f), Color.White * 0.7f * Utils.GetLerpValue(10, 45, time, true));
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
GlowOrbParticle orb2 = new GlowOrbParticle(Projectile.Center + rotatedVisualDirection * 0.7f, rotatedVisualDirection * Main.rand.NextFloat(0.01f, 0.15f), false, 13, Main.rand.NextFloat(0.55f, 0.9f), randomColor * Utils.GetLerpValue(10, 45, time, true));
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
|
||||
SparkParticle orb3 = new SparkParticle(Projectile.Center + rotatedVisualDirection * 0.7f, rotatedVisualDirection * Main.rand.NextFloat(0.01f, 0.5f), false, 17, Main.rand.NextFloat(0.2f, 0.6f), Color.Lerp(Color.White, randomColor, 0.5f) * Utils.GetLerpValue(10, 45, time, true));
|
||||
GeneralParticleHandler.SpawnParticle(orb3);
|
||||
}
|
||||
|
||||
mainColor = Color.Lerp(mainColor, variedColor, 0.07f);
|
||||
|
||||
Projectile.scale = 0.4f;
|
||||
|
||||
//dust and lighting
|
||||
|
||||
Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, randomColor, 0.5f).ToVector3());
|
||||
|
||||
if (!homing && !returning)
|
||||
Projectile.velocity *= 0.95f;
|
||||
else
|
||||
{
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() - MathHelper.PiOver4 * 3, 0.2f);
|
||||
if (homing)
|
||||
CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, MathHelper.Clamp(10 + time * 0.15f, 20, 35), 5);
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle orb3 = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(9, 9) - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 12, visualDirection * Main.rand.NextFloat(0.2f, 0.8f), false, 20, 1.5f, Color.Lerp(Color.White, randomColor, 0.5f) * Utils.GetLerpValue(100, 170, time, true));
|
||||
GeneralParticleHandler.SpawnParticle(orb3);
|
||||
}
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(12, 12) - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 12, 303, visualDirection * Main.rand.NextFloat(0.05f, 0.7f));
|
||||
dust2.scale = Main.rand.NextFloat(0.75f, 2.25f);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool() ? Color.White : Color.Lerp(Color.White, randomColor, 0.1f);
|
||||
dust2.alpha = 170;
|
||||
}
|
||||
}
|
||||
|
||||
if (time >= 60 && !homing && !returning)
|
||||
{
|
||||
NPC target = Projectile.Center.ClosestNPCAt(2000);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
returning = true;
|
||||
SoundStyle lockon = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection");
|
||||
SoundEngine.PlaySound(lockon with { Pitch = -0.7f }, Projectile.Center);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (time == 60)
|
||||
{
|
||||
SoundStyle lockon = new("CalamityMod/Sounds/Custom/ExoMechs/ApolloArtemisTargetSelection");
|
||||
SoundEngine.PlaySound(lockon with { Pitch = -0.3f }, Projectile.Center);
|
||||
|
||||
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.75f, 0.2f, 10);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
|
||||
Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, randomColor * 0.7f, "CalamityMod/Particles/BloomRing", new Vector2(1f, 1f), 0f, 0.6f, 0.2f, 10);
|
||||
GeneralParticleHandler.SpawnParticle(pulse2);
|
||||
}
|
||||
if (time > 62)
|
||||
{
|
||||
Projectile.penetrate = 1;
|
||||
homing = true;
|
||||
Projectile.extraUpdates = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (returning)
|
||||
{
|
||||
Projectile.penetrate = -1;
|
||||
float returnSpeed = MathHelper.Clamp(3 + time * 0.15f, 7, 28);
|
||||
float acceleration = 1.1f;
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
Vector2 playerCenter = owner.Center;
|
||||
float xDist = playerCenter.X - Projectile.Center.X;
|
||||
float yDist = playerCenter.Y - Projectile.Center.Y;
|
||||
float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist);
|
||||
dist = returnSpeed / dist;
|
||||
xDist *= dist;
|
||||
yDist *= dist;
|
||||
|
||||
if (Projectile.velocity.X < xDist)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X + acceleration;
|
||||
if (Projectile.velocity.X < 0f && xDist > 0f)
|
||||
Projectile.velocity.X += acceleration;
|
||||
}
|
||||
else if (Projectile.velocity.X > xDist)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X - acceleration;
|
||||
if (Projectile.velocity.X > 0f && xDist < 0f)
|
||||
Projectile.velocity.X -= acceleration;
|
||||
}
|
||||
if (Projectile.velocity.Y < yDist)
|
||||
{
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + acceleration;
|
||||
if (Projectile.velocity.Y < 0f && yDist > 0f)
|
||||
Projectile.velocity.Y += acceleration;
|
||||
}
|
||||
else if (Projectile.velocity.Y > yDist)
|
||||
{
|
||||
Projectile.velocity.Y = Projectile.velocity.Y - acceleration;
|
||||
if (Projectile.velocity.Y > 0f && yDist < 0f)
|
||||
Projectile.velocity.Y -= acceleration;
|
||||
}
|
||||
|
||||
if (Projectile.Hitbox.Intersects(owner.Hitbox))
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
//stealth strike
|
||||
if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY * 2f, ModContent.ProjectileType<SupernovaHoming>(), (int)(Projectile.damage * 0.48), Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 8 == 0 && Projectile.owner == Main.myPlayer && false)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitY * 2f, ModContent.ProjectileType<SupernovaHoming>(), (int)(Projectile.damage * 3), 0, Projectile.owner, 0f, 0f);
|
||||
|
||||
time++;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = 128;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
SoundEngine.PlaySound(Supernova.ExplosionSound, Projectile.Center);
|
||||
|
||||
//spawn projectiles
|
||||
int projAmt = Main.rand.Next(3, 5);
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
if (!returning)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<SupernovaBoom>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
for (int i = 0; i < projAmt; i++)
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = 128;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
SoundEngine.PlaySound(Supernova.ExplosionSound, Projectile.Center);
|
||||
|
||||
//spawn explosion
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<SupernovaSpike>(), (int)(Projectile.damage * 0.6), 0f, Projectile.owner, 0f, 0f);
|
||||
}
|
||||
float spread = MathHelper.Pi / 3f;
|
||||
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
|
||||
double deltaAngle = spread / 6f;
|
||||
double offsetAngle;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType<SupernovaHoming>(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType<SupernovaHoming>(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<SupernovaBoom>(), Projectile.damage * 5, 0, Projectile.owner, 0f, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f);
|
||||
}
|
||||
}
|
||||
|
||||
//dust effects
|
||||
int dustType = Main.rand.NextBool() ? 107 : 234;
|
||||
if (Main.rand.NextBool(4))
|
||||
else
|
||||
{
|
||||
dustType = 269;
|
||||
}
|
||||
for (int d = 0; d < 5; d++)
|
||||
{
|
||||
int exo = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[exo].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Main.dust[exo].scale = 0.5f;
|
||||
Main.dust[exo].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < 9; d++)
|
||||
{
|
||||
int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[fire].noGravity = true;
|
||||
Main.dust[fire].velocity *= 5f;
|
||||
fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[fire].velocity *= 2f;
|
||||
}
|
||||
|
||||
//gore cloud effects
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
Vector2 goreSource = Projectile.Center;
|
||||
int goreAmt = 3;
|
||||
Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f);
|
||||
for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++)
|
||||
{
|
||||
float velocityMult = 0.33f;
|
||||
if (goreIndex < (goreAmt / 3))
|
||||
randomColor = Main.rand.Next(4) switch
|
||||
{
|
||||
velocityMult = 0.66f;
|
||||
}
|
||||
if (goreIndex >= (2 * goreAmt / 3))
|
||||
{
|
||||
velocityMult = 1f;
|
||||
}
|
||||
Mod mod = ModContent.GetInstance<CalamityMod>();
|
||||
int type = Main.rand.Next(61, 64);
|
||||
int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
||||
Gore gore = Main.gore[smoke];
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X += 1f;
|
||||
gore.velocity.Y += 1f;
|
||||
type = Main.rand.Next(61, 64);
|
||||
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
||||
gore = Main.gore[smoke];
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X -= 1f;
|
||||
gore.velocity.Y += 1f;
|
||||
type = Main.rand.Next(61, 64);
|
||||
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
||||
gore = Main.gore[smoke];
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X += 1f;
|
||||
gore.velocity.Y -= 1f;
|
||||
type = Main.rand.Next(61, 64);
|
||||
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
||||
gore = Main.gore[smoke];
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X -= 1f;
|
||||
gore.velocity.Y -= 1f;
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 14 * Main.rand.NextFloat(0.05f, 1.2f);
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), 278, vel);
|
||||
dust2.scale = Main.rand.NextFloat(0.45f, 1.15f);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Color.Lerp(Color.White, randomColor, 0.3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<MiracleBlight>(), 300);
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 60);
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<MiracleBlight>(), 300);
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 5, targetHitbox);
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
||||
return false;
|
||||
Color auraColor = Projectile.GetAlpha(Color.Lerp(Color.White, randomColor, 0.3f)) * 0.25f;
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Rogue/Supernova").Value;
|
||||
Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 8f).ToRotationVector2();
|
||||
rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f);
|
||||
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale * 1.1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
if (!homing)
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(Color.White, randomColor, 0.3f), 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using static Humanizer.In;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class SupernovaBoom : ModProjectile, ILocalizedModType
|
||||
@@ -12,28 +17,68 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public int frameY = 0;
|
||||
private const int horizontalFrames = 5;
|
||||
private const int verticalFrames = 4;
|
||||
private const int frameLength = 4;
|
||||
private const float radius = 204.5f;
|
||||
private const int frameLength = 2;
|
||||
private const float radius = 304.5f;
|
||||
public bool damageFrame = false;
|
||||
|
||||
public Color variedColor = Color.White;
|
||||
public Color mainColor = Color.LawnGreen;
|
||||
public Color randomColor = Color.White;
|
||||
public int colorTimer = 0;
|
||||
public int time = 0;
|
||||
public int currentFrame = 1;
|
||||
|
||||
private Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 408;
|
||||
Projectile.height = 410;
|
||||
Projectile.scale = 2f;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = frameLength * horizontalFrames * verticalFrames / 5;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
randomColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
if (time == 0)
|
||||
mainColor = randomColor;
|
||||
|
||||
if (time % 20 == 0)
|
||||
{
|
||||
variedColor = colorTimer switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
colorTimer++;
|
||||
if (colorTimer >= 4)
|
||||
colorTimer = 0;
|
||||
}
|
||||
|
||||
mainColor = Color.Lerp(mainColor, variedColor, 0.07f);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, mainColor.ToVector3() * (currentFrame == 13 ? 5 : 2));
|
||||
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter % frameLength == frameLength - 1)
|
||||
{
|
||||
currentFrame++;
|
||||
|
||||
frameY++;
|
||||
if (frameY >= verticalFrames)
|
||||
{
|
||||
@@ -45,24 +90,91 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
if (currentFrame == 13)
|
||||
damageFrame = true;
|
||||
else
|
||||
damageFrame = false;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.5f / 255f, Main.DiscoG * 0.5f / 255f, Main.DiscoB * 0.5f / 255f);
|
||||
|
||||
/*float dustSpeed = (float)Main.rand.Next(12, 36);
|
||||
Vector2 dustVel = CalamityUtils.RandomVelocity(40f, dustSpeed, dustSpeed, 1f);
|
||||
int dustType = Utils.SelectRandom(Main.rand, new int[]
|
||||
if (currentFrame == 4)
|
||||
{
|
||||
107,
|
||||
234,
|
||||
269
|
||||
});
|
||||
int rainbow = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 2f);
|
||||
Dust dust = Main.dust[rainbow];
|
||||
dust.noGravity = true;
|
||||
dust.position = projectile.Center;
|
||||
dust.position.X += (float)Main.rand.Next(-10, 11);
|
||||
dust.position.Y += (float)Main.rand.Next(-10, 11);
|
||||
dust.velocity = dustVel;*/
|
||||
float numberOfDusts = 20f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
randomColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f);
|
||||
velOffset *= Main.rand.NextFloat(25, 45);
|
||||
SquishyLightParticle exoEnergy = new(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f), Main.rand.NextFloat(0.1f, 0.2f), randomColor, 9);
|
||||
GeneralParticleHandler.SpawnParticle(exoEnergy);
|
||||
}
|
||||
}
|
||||
if (currentFrame == 13)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 8.5f;
|
||||
|
||||
int points = 5;
|
||||
float radians = MathHelper.TwoPi / points;
|
||||
Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f));
|
||||
float rotRando = Main.rand.NextFloat(0.1f, 2.5f);
|
||||
for (int k = 0; k < points; k++)
|
||||
{
|
||||
Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f * rotRando);
|
||||
SparkParticle subTrail = new(Projectile.Center + velocity * 7.5f, velocity, false, 4, 1.65f, Color.White);
|
||||
GeneralParticleHandler.SpawnParticle(subTrail);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 45; i++)
|
||||
{
|
||||
Vector2 randVel = new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
|
||||
float numberOflines = 45;
|
||||
float rotFactorlines = 360f / numberOflines;
|
||||
for (int e = 0; e < numberOflines; e++)
|
||||
{
|
||||
randomColor = Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
|
||||
float rot = MathHelper.ToRadians(e * rotFactorlines);
|
||||
Vector2 offset = (Vector2.UnitX * Main.rand.NextFloat(0.2f, 3.1f)).RotatedBy(rot + Main.rand.NextFloat(0.1f, 5.1f));
|
||||
Vector2 velOffset = (Vector2.UnitX * Main.rand.NextFloat(0.2f, 3.1f)).RotatedBy(rot + Main.rand.NextFloat(0.1f, 5.1f));
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(15.5f, 25.5f), true, 95, Main.rand.NextFloat(0.3f, 1.1f), Color.Lerp(Color.White, randomColor, 0.3f));
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
}
|
||||
if (currentFrame < 13)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (!target.boss && target.IsAnEnemy(true, true))
|
||||
{
|
||||
if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses)
|
||||
{
|
||||
if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 600)
|
||||
target.velocity = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX) * 22;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
time++;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox);
|
||||
@@ -75,12 +187,22 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
|
||||
Rectangle frame = new Rectangle(frameX * length, frameY * height, length, height);
|
||||
Vector2 origin = new Vector2(length / 2f, height / 2f);
|
||||
Main.EntitySpriteDraw(texture, drawPos, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(texture, drawPos, frame, Color.White with { A = 0 }, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<MiracleBlight>(), 300);
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (!target.boss && target.IsAnEnemy(true, true) && !CalamityPlayer.areThereAnyDamnBosses)
|
||||
{
|
||||
Vector2 velToApply = target.Center.DirectionFrom(Projectile.Center).SafeNormalize(Vector2.UnitX) * 30;
|
||||
target.velocity = velToApply + (velToApply.Y <= 0 ? new Vector2(0, -5) : Vector2.Zero);
|
||||
}
|
||||
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 180);
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<MiracleBlight>(), 300);
|
||||
|
||||
public override bool? CanDamage() => damageFrame ? null : false;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 273 KiB |
Binary file not shown.
Reference in new issue
Block a user