More visual improvements

This commit is contained in:
Nathanael Overton committed 2025-06-29 00:50:53 -04:00
1 parent 565a54deaa
commit 4ca96b128d
1 file changed
+124 -19
+124 -19
View File
@@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
Projectile.extraUpdates = 1;
Projectile.tileCollide = false;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.tileCollide = true;
            Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
@@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Ranged
}
Color trailColor = Color.PaleVioletRed;
Color trailColor = new Color(214, 51, 70);
for (int i = 0; i < 3; i++)
{
@@ -55,22 +55,22 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 sparkVelocity = -Projectile.velocity * 0.01f * Main.rand.NextFloat(0.5f, 1.5f);
Particle spark = new CustomSpark(
sparkPosition,
sparkVelocity,
"CalamityMod/Particles/BloomLineFade",
false,
6,
0.04f,
trailColor * 0.85f,
new Vector2(0.8f, 1), // Scaling for the end
shrinkSpeed: 0.4f);
sparkPosition,
sparkVelocity,
"CalamityMod/Particles/BloomLineFade",
false,
6,
0.04f,
trailColor * 0.85f,
new Vector2(0.8f, 1), // Scaling for the end
shrinkSpeed: 0.4f);
GeneralParticleHandler.SpawnParticle(spark);
}
if (Main.rand.NextBool(8))
{
Vector2 sparkPosition = Projectile.Center + Main.rand.NextVector2Circular(15, 15);
                Vector2 sparkVelocity = -Projectile.velocity * Main.rand.NextFloat(0.01f, 0.045f); // Backward velocity
Vector2 sparkVelocity = -Projectile.velocity * Main.rand.NextFloat(0.01f, 0.045f); // Backward velocity
                Particle subtleSpark = new CustomSpark(
sparkPosition,
@@ -85,10 +85,34 @@ namespace CalamityMod.Projectiles.Ranged
GeneralParticleHandler.SpawnParticle(subtleSpark);
}
// Falling particles to appear as lava droplets, similar to speed blaster's falling dust
if (Main.rand.NextBool(50))
{
Vector2 spawnHere = Projectile.position;
spawnHere.Y = Projectile.Bottom.Y + 3f; // A little down
Color coreSlagColor = new Color(247, 111, 77);
Color outerSlagColor = new Color(242, 157, 170);
Vector2 particleVelocity = new Vector2(Main.rand.Next(-1, 1), 3);
Color particleColor = Color.Lerp(coreSlagColor, outerSlagColor, Main.rand.NextFloat());
GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(
spawnHere,
particleVelocity,
true, // Affected by gravity
Main.rand.Next(30, 50),
Main.rand.NextFloat(0.4f, 0.65f),
particleColor
));
}
if (Projectile.localAI[1] >= 10f)
Projectile.velocity.Y += 0.2f;
        }
}
public override bool CanHitPlayer(Player target)
{
@@ -103,11 +127,92 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Color coreSlagColor = new Color(247, 111, 77);
Color outerSlagColor = new Color(242, 157, 170);
Vector2 collisionPoint = Projectile.position;
//These adjustments are made to look more embedded into tiles instead of them seemingly floating above where they landed
if (oldVelocity.Y != 0f) // Hitting a horizontal surface
{
if (oldVelocity.Y > 0f)
collisionPoint.Y = Projectile.Bottom.Y - 2f; // Spawn slightly inside bottom edge of projectile
else
collisionPoint.Y = Projectile.Top.Y + 2f; // Spawn slightly inside top edge of projectile
}
if (oldVelocity.X != 0f) // Hitting a vertical surface
{
if (oldVelocity.X > 0f)
collisionPoint.X = Projectile.Right.X - 2f; // Spawn slightly inside right edge of projectile
else
collisionPoint.X = Projectile.Left.X + 2f; // Spawn slightly inside left edge of projectile
}
for (int i = 0; i < 3; i++) // Original number of particles for tile collision
{
Vector2 spawnPosition = collisionPoint + Main.rand.NextVector2Circular(2f, 2f);
Vector2 particleVelocity = oldVelocity.SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.5f, 1.5f);
particleVelocity.Y += Main.rand.NextFloat(0.5f, 1.5f);
Color particleColor = Color.Lerp(coreSlagColor, outerSlagColor, Main.rand.NextFloat());
GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(
spawnPosition,
particleVelocity,
true, // Has gravity
Main.rand.Next(40, 70),
Main.rand.NextFloat(0.8f, 1.3f),
particleColor
));
}
Projectile.Kill();
return true;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damage)
{
Color coreSlagColor = new Color(247, 111, 77);
Color outerSlagColor = new Color(242, 157, 170);
Vector2 baseParticleDirection = new Vector2(Projectile.direction, 0).SafeNormalize(Vector2.UnitX * Projectile.direction);
Vector2 initialSpawnPosition = target.Center + new Vector2(target.width / 2f * Projectile.direction + 15f * Projectile.direction, Main.rand.NextFloat(-target.height / 2f, target.height / 2f));
for (int i = 0; i < 4; i++)
{
Vector2 finalSpawnPosition = initialSpawnPosition + Main.rand.NextVector2Circular(1f, 1f);
// This rotation makes it look like it's bursting out from a set point
Vector2 particleVelocity = baseParticleDirection.RotatedByRandom(MathHelper.ToRadians(50f)) * Main.rand.NextFloat(10f, 13f);
bool affectedByGravity = true;
int lifetime = Main.rand.Next(20, 45);
float scale = Main.rand.NextFloat(.3f, .7f);
// Simple way to get a similar effect to what I want
// Ideally I would want there to be an inner glow + outer glow effect like with the projectile particles
Color particleColor = Color.Lerp(coreSlagColor, outerSlagColor, Main.rand.NextFloat());
GeneralParticleHandler.SpawnParticle(new WaterFlavoredParticle(
finalSpawnPosition,
particleVelocity,
affectedByGravity,
lifetime,
scale,
particleColor
));
}
//WoF Spawning
if (target.type == NPCID.Guide)
{
if (target.life <= 0)
{
for (int i = 0; i < 20; i++)
@@ -117,13 +222,13 @@ namespace CalamityMod.Projectiles.Ranged
150, default, 2f).noGravity = true;
}
if (!NPC.AnyNPCs(NPCID.WallofFlesh)) // Don't spawn if Wall is already active
                    {
if (!NPC.AnyNPCs(NPCID.WallofFlesh))
{
int playerIndex = Projectile.owner;
if (playerIndex >= 0 && Main.player[playerIndex].active)
{
NPC.SpawnOnPlayer(playerIndex, NPCID.WallofFlesh); // The game handles spawning logic by itself from here
                        }
NPC.SpawnOnPlayer(playerIndex, NPCID.WallofFlesh);
}
}
}
}