Visual additions (still wip)

This commit is contained in:
IbanPlay committed 2022-06-04 05:29:20 +02:00
1 parent 2c54714311
commit 03350fcffa
6 files changed
+131 -36

No files matched your search

+6 -1
View File
@@ -16,7 +16,12 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Coral Spout");
Tooltip.SetDefault("Casts coral water spouts that lay on the ground and damage enemies");
Tooltip.SetDefault("Casts a shotgun-like blast of coral shards\n" +
"Keep the attack button held down to narrow the spread\n" +
"Fully charging the attack releases a single, bigger chunk of coral that sticks to enemies\n" +
"Grabbing the chunk of coral after it falls from the enemy replenishes 80 mana"
);
//Lore about stone tablets being used since paper couldn't be brought underwater.
//Maybe something something, the sea kingdom had to have a large amount of scribes to rewrite books into tablets
SacrificeTotal = 1;
+40
View File
@@ -0,0 +1,40 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class CuteManaStarParticle : Particle
{
public override string Texture => "CalamityMod/Particles/CuteStars";
public override bool UseCustomDraw => false;
public override bool SetLifetime => true;
public override int FrameVariants => 2;
public float Opacity;
public CuteManaStarParticle(Vector2 position, Vector2 speed, float scale = 1f, float opacity = 1f, int lifetime = 20)
{
Position = position;
Scale = scale;
Color = Color.White;
Opacity = opacity;
Velocity = speed;
Rotation = Main.rand.NextFloat(MathHelper.TwoPi);
Lifetime = lifetime;
Variant = Main.rand.Next(2);
}
public override void Update()
{
Opacity *= 0.96f;
Color = Color.White * Opacity;
Lighting.AddLight(Position, Color.DodgerBlue.ToVector3());
Velocity *= 0.9f;
if (Velocity.Length() <= 0.01f)
GeneralParticleHandler.RemoveParticle(this);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

+2 -1
View File
@@ -51,7 +51,8 @@ namespace CalamityMod.Projectiles.Magic
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Dig, Projectile.Center);
if (timeLeft != 0)
SoundEngine.PlaySound(SoundID.Dig with { Volume = SoundID.Dig.Volume * 0.4f}, Projectile.Center);
for (int i = 0; i < 3; i++)
{
+1 -1
View File
@@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Magic
}
Color pulseColor = Main.rand.NextBool() ? Color.Coral : Color.DeepSkyBlue;
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.02f, 0.1f, 30);
Particle pulse = new DirectionalPulseRing(Owner.Center + direction * 44f, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.04f, 0.2f, 30);
GeneralParticleHandler.SpawnParticle(pulse);
}
+82 -33
View File
@@ -19,8 +19,6 @@ namespace CalamityMod.Projectiles.Magic
public ref float DetachmentEffectsComplete => ref Projectile.localAI[0];
public bool Stuck => (StuckNPC != null && StuckNPC.active && ManaCharge < FullMana);
public bool HasStuck => (Projectile.numHits > 0);
public bool DroppedDown => (HasStuck && !Stuck);
Vector2 offsetFromStuckNPC;
float rotationFromStuckNPC;
@@ -68,6 +66,7 @@ namespace CalamityMod.Projectiles.Magic
if (Projectile.frame == 0)
Projectile.frame = Main.rand.Next(3) + 1;
//Stay anchored to the enemy it's stuck in and emit charge particles.
if (Stuck)
{
Projectile.Center = StuckNPC.Center + offsetFromStuckNPC.RotatedBy(StuckNPC.rotation) * StuckNPC.scale;
@@ -76,7 +75,12 @@ namespace CalamityMod.Projectiles.Magic
Projectile.tileCollide = false;
Projectile.timeLeft++;
ManaCharge++;
//Particles
if (Main.rand.NextBool(5))
{
Particle lilStar = new CuteManaStarParticle(Projectile.Center + Main.rand.NextVector2Circular(19f, 19f), Main.rand.NextVector2Circular(4f, 4f) - Vector2.UnitY * 6f * Main.rand.NextFloat(0.6f, 1.2f), Main.rand.NextFloat(0.8f, 1.8f), lifetime: Main.rand.Next(14) + 14);
GeneralParticleHandler.SpawnParticle(lilStar);
}
}
//Act as a magnetized collectible.
@@ -90,7 +94,6 @@ namespace CalamityMod.Projectiles.Magic
Projectile.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * -1 * (Main.rand.NextFloat(5f) + 5f);
}
float fallSpeed = Projectile.velocity.Y;
if (Projectile.velocity.X != 0)
Projectile.rotation += 0.02f * Math.Sign(Projectile.velocity.X) * Math.Clamp(Projectile.velocity.Length(), 0f, 5f);
@@ -107,9 +110,23 @@ namespace CalamityMod.Projectiles.Magic
if (distanceToOwner < 10f)
Projectile.Kill();
}
//particles
if (Main.rand.NextBool(2))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), 45, Vector2.UnitY * -7f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f));
dust.noGravity = true;
}
if (Main.rand.NextBool(5))
{
Particle lilStar = new CuteManaStarParticle(Projectile.Center + Main.rand.NextVector2Circular(19f, 19f), -Vector2.UnitY * 6f * Main.rand.NextFloat(0.6f, 1.2f), Main.rand.NextFloat(0.8f, 1.8f), lifetime: Main.rand.Next(14) + 14);
GeneralParticleHandler.SpawnParticle(lilStar);
}
}
//the flung state.
else
{
float fallSpeed = Projectile.velocity.Y;
@@ -123,6 +140,19 @@ namespace CalamityMod.Projectiles.Magic
if (Projectile.velocity.Y > 0)
Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed));
//Sharticles
if (Main.rand.NextBool(2))
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), 15, Projectile.velocity * 0.3f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f));
dust.noGravity = true;
}
if (Main.rand.NextBool(3))
{
Particle lilStar = new CuteManaStarParticle(Projectile.Center, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(5f, 5f) - Vector2.UnitY * 3f, Main.rand.NextFloat(0.8f, 1.8f), lifetime: Main.rand.Next(14) + 14);
GeneralParticleHandler.SpawnParticle(lilStar);
}
}
}
@@ -139,9 +169,11 @@ namespace CalamityMod.Projectiles.Magic
{
if ((Owner.Center - Projectile.Center).Length() < 10f && HasStuck)
{
Owner.statMana += 60;
SoundEngine.PlaySound(SoundID.Item28 with { Volume = SoundID.Item28.Volume * 0.8f }, Projectile.Center);
Owner.statMana += 80;
if (Main.myPlayer == Owner.whoAmI)
Owner.ManaEffect(60);
Owner.ManaEffect(80);
if (Owner.statMana > Owner.statManaMax2)
Owner.statMana = Owner.statManaMax2;
@@ -149,37 +181,53 @@ namespace CalamityMod.Projectiles.Magic
return;
}
SoundEngine.PlaySound(SoundID.Item171, Projectile.Center);
//Particles, with extra ones if it crashed chargeless
for (int i = 0; i < 8; i++)
//don't play the thuk sound & do the particles if it dies of natural causes
if (timeLeft != 0)
{
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
SoundEngine.PlaySound(SoundID.Item171, Projectile.Center);
Particle spike = new UrchinSpikeParticle(Projectile.Center + angle.ToRotationVector2() * 2f, angle.ToRotationVector2() * 6f, angle + MathHelper.PiOver2, Main.rand.NextFloat(1f, 1.3f), lifetime: Main.rand.Next(10) + 25);
GeneralParticleHandler.SpawnParticle(spike);
//Particles, with extra ones if it crashed chargeless
for (int i = 0; i < 8; i++)
{
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
Particle spike = new UrchinSpikeParticle(Projectile.Center + angle.ToRotationVector2() * 2f, angle.ToRotationVector2() * 6f, angle + MathHelper.PiOver2, Main.rand.NextFloat(1f, 1.3f), lifetime: Main.rand.Next(10) + 25);
GeneralParticleHandler.SpawnParticle(spike);
}
int dustCount = Main.rand.Next(7);
for (int i = 0; i < dustCount; i++)
{
int dustOpacity = (int)(200 * Main.rand.NextFloat(0.5f, 1f));
float dustScale = Main.rand.NextFloat(1f, 1.4f);
int dustType = CoralSpike.DustPick; //Epic reuse of static method babey
Vector2 dustVelocity = (dustType == 255 ? 1 : -1) * Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * 0.6f + Main.rand.NextVector2Circular(7f, 7f);
Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, dustVelocity, Alpha: dustOpacity, Scale: dustScale);
dust.noGravity = true;
}
int goreNumber = Main.rand.Next(4);
for (int i = 0; i < goreNumber; i++)
{
int goreID = Main.rand.NextBool() ? 266 : Main.rand.NextBool() ? 971 : 972;
Gore bone = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * -0.2f + Main.rand.NextVector2Circular(5f, 5f), goreID);
bone.scale = Main.rand.NextFloat(0.6f, 1f) * (goreID == 972 ? 0.7f : 1f); //Shrink the larger bones
bone.type = goreID; //Gotta do that or else itll spawn gores from the general pool :(
}
}
int dustCount = Main.rand.Next(7);
for (int i = 0; i < dustCount; i++)
else if (HasStuck)
{
int dustOpacity = (int)(200 * Main.rand.NextFloat(0.5f, 1f));
float dustScale = Main.rand.NextFloat(1f, 1.4f);
int dustType = CoralSpike.DustPick; //Epic reuse of static method babey
Vector2 dustVelocity = (dustType == 255 ? 1 : -1) * Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * 0.6f + Main.rand.NextVector2Circular(7f, 7f);
for (int i = 0; i < 14; i++)
{
Vector2 direction = Main.rand.NextVector2Circular(10f, 10f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + direction, 45, direction + Vector2.UnitY * -7f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f));
dust.noGravity = true;
}
Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, dustVelocity, Alpha: dustOpacity, Scale: dustScale);
dust.noGravity = true;
}
int goreNumber = Main.rand.Next(4);
for (int i = 0; i < goreNumber; i++)
{
int goreID = Main.rand.NextBool() ? 266 : Main.rand.NextBool() ? 971 : 972;
Gore bone = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * -0.2f + Main.rand.NextVector2Circular(5f, 5f), goreID);
bone.scale = Main.rand.NextFloat(0.6f, 1f) * (goreID == 972 ? 0.7f : 1f); //Shrink the larger bones
bone.type = goreID; //Gotta do that or else itll spawn gores from the general pool :(
SoundEngine.PlaySound(SoundID.Item29 with { Volume = SoundID.Item29.Volume * 0.4f, Pitch = -0.3f }, Projectile.Center);
}
}
@@ -204,11 +252,12 @@ namespace CalamityMod.Projectiles.Magic
float period = (int)(FullMana / 4f);
float pulseProgress = Main.GlobalTimeWrappedHourly % period / period;
float pulseProgress = Main.GlobalTimeWrappedHourly % period / period;
if (Stuck)
{
pulseProgress = (ManaCharge % period) / period;
}
float overimageSize = scale + (float)Math.Sqrt(pulseProgress) * 0.4f;
float overimageOpacity = (float)Math.Sin(pulseProgress * MathHelper.PiOver2 + MathHelper.PiOver2) * 0.7f;