Final Updates

This commit is contained in:
Xyk committed 2024-06-03 14:05:50 -07:00
1 parent 74309abcaf
commit fd4467a213
7 files changed
+83 -25

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 609 B

@@ -10,8 +10,8 @@ AstralInfection2: "{0}'s skin was replaced by the astral virus."
AstralInfection3: "{0} succumbed to their spaceborne pustules."
AstralInjection1: "{0}'s blood vessels burst from drug overdose."
AstralInjection2: "{0} couldn't handle another cosmic mana transfer."
AuricRebuke1: "{0} learned that auric rejection comes with a 100% chance for paralysis."
AuricRebuke2: "{0} felt the power of 1000000000 volts."
AuricRebuke1: "{0}'s blood violently bounced off its own body."
AuricRebuke2: "{0}'s heart became a supercapacitor."
AuricRejection: "{0} was not worthy."
BloodBoiler1: "{0} collapsed from severe anemia."
BloodBoiler2: "{0} was unable to obtain a blood transfusion."
@@ -86,7 +86,7 @@ SearingLava1: "{0}'s soul was released by the lava."
SearingLava2: "{0} joined those forgotten by the accursed magma."
Shadowflame: "{0}'s spirit was ravaged by foul wizardry."
StaticDischarge1: "{0}'s body finally stopped jittering."
StaticDischarge2: "{0} was shocked."
StaticDischarge2: "{0} became ex-static."
SulphurMeter: "{0} bathed too long in acidic waters."
SulphuricPoisoning1: "{0} was melted by the toxic waste."
SulphuricPoisoning2: "{0} ingested too many caustic chemicals."
+1
View File
@@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = -1;
Projectile.extraUpdates = 1;
Projectile.timeLeft = Lifetime;
Projectile.tileCollide = false;
// Auric orbs never hit the same enemy more than once.
Projectile.usesLocalNPCImmunity = true;
+79 -22
View File
@@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -16,6 +17,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<TheOracle>();
public int AuraFrame;
private Player Owner => Main.player[Projectile.owner];
// projectile.localAI[1] is the Aura Charge of the red lightning aura
// Minimum value is zero. Maximum value is 200.
@@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
// Its size caps out at 100 charge.
public ref float AuraCharge => ref Projectile.localAI[1];
private const float MaxCharge = 200f;
private const float MaxCharge = 150f;
private const float MinAuraRadius = 20f;
private const float SuperchargeThreshold = 50f;
private const float MaxAuraRadius = 150f;
@@ -36,6 +38,11 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
private bool rotDirection = false;
private const int HitsPerOrbVolley = 2;
private int OrbCooldown = 0;
public bool cloneYoyo = false;
public int counter = 0;
public SlotId Hum { get; set; }
// The aura hits once per this many frames.
private const int AuraLocalIFrames = 12;
@@ -80,6 +87,24 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
public override void AI()
{
// Determine if the yoyo is a yoyo bag/yoyo glove clone
if (!cloneYoyo)
{
int MainYoyo = -1;
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile proj = Main.projectile[x];
if (proj.active && proj.type == Projectile.type && proj.owner == Projectile.owner)
{
MainYoyo = x;
break;
}
}
if (Projectile.whoAmI != MainYoyo)
cloneYoyo = true;
}
if (OrbCooldown > 0)
OrbCooldown--;
@@ -91,7 +116,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
}
if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks
{
Projectile.Kill();
}
// Only do stuff once per frame, despite the yoyo's extra updates.
if (!Projectile.FinalExtraUpdate())
@@ -129,12 +156,22 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
float auraRadius = AuraCharge > MaxAuraRadius ? MaxAuraRadius : AuraCharge;
DrawLightningAura(auraRadius);
if (Projectile.soundDelay == 0)
if (!cloneYoyo)
{
Projectile.soundDelay = 22;
SoundEngine.PlaySound(SoundID.Item93, Projectile.Center);
}
if (SoundEngine.TryGetActiveSound(Hum, out var hum) && hum.IsPlaying)
{
hum.Position = Projectile.Center;
hum.Pitch = MathHelper.Lerp(-0.4f, 0.2f, Utils.GetLerpValue(0f, MaxCharge, AuraCharge, true));
hum.Volume = MathHelper.Lerp(0f, 0.55f * 100, Utils.GetLerpValue(MinAuraRadius, MaxCharge / 2, AuraCharge, true));
}
else
{
SoundStyle charge = new("CalamityMod/Sounds/Item/OracleHum");
Hum = SoundEngine.PlaySound(charge with { Volume = 0.01f, IsLooped = true }, Projectile.Center);
}
}
if (AuraFrame % AuraLocalIFrames == 0)
{
// The aura's direct damage scales with its charge and with melee stats.
@@ -142,11 +179,33 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
int auraDamage = TheOracle.AuraBaseDamage + (int)(chargeRatio * (TheOracle.AuraMaxDamage - TheOracle.AuraBaseDamage));
DealAuraDamage(auraRadius, auraDamage);
}
// Experimental clone yoyo orbiting, could be implemented later
/*
if (cloneYoyo)
{
Vector2 cloneOffset = new Vector2(auraRadius, 0f);
cloneOffset = cloneOffset.RotatedBy(counter * 0.06f);
if (Owner.controlUseItem)
{
Projectile.Center = Main.MouseWorld + cloneOffset;
Projectile.velocity = Vector2.Zero;
}
}
*/
}
else
Projectile.soundDelay = 2;
{
if (SoundEngine.TryGetActiveSound(Hum, out var hum) && hum.IsPlaying && !cloneYoyo)
{
hum?.Stop();
}
}
AuraFrame = (AuraFrame + 1) % AuraLocalIFrames;
counter++;
}
public override bool PreDraw(ref Color lightColor)
@@ -192,16 +251,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
for (int i = 0; i < numDust; ++i)
{
dustOffset = dustOffset.RotatedBy(angleIncrement);
/*
int dustType = 260;
float scale = 1.6f + Main.rand.NextFloat(0.9f);
int idx = Dust.NewDust(Projectile.Center, 1, 1, dustType);
Main.dust[idx].position = Projectile.Center + dustOffset;
Main.dust[idx].noGravity = true;
Main.dust[idx].noLight = true;
Main.dust[idx].velocity *= 0.5f;
Main.dust[idx].scale = scale;
*/
Particle spark = new GlowOrbParticle(Projectile.Center + dustOffset, Vector2.One.RotatedByRandom(100), false, 2, Main.rand.NextFloat(0.65f, 1.1f), Main.rand.NextBool(11) ? Color.Lavender : Color.Cyan);
GeneralParticleHandler.SpawnParticle(spark);
@@ -249,10 +298,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
GeneralParticleHandler.SpawnParticle(spark);
}
}
// Make extra sound when these arcs happen
//SoundEngine.PlaySound(SoundID.NPCHit53 with { Volume = 0.2f }, Projectile.Center);
if (!cloneYoyo)
{
//SoundStyle arc = new("CalamityMod/Sounds/Item/AuricBulletHit");
//SoundEngine.PlaySound(arc with { Volume = 0.3f, Pitch = 0.5f, MaxInstances = -1 }, Projectile.Center);
}
}
}
@@ -292,9 +345,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
private void FireAuricOrbs()
{
// Play a sound when orbs are fired
SoundEngine.PlaySound(SoundID.Item92 with { Volume = 0.3f }, Projectile.Center);
int numOrbs = 3;
int orbID = ModContent.ProjectileType<Orbacle>();
int orbDamage = Projectile.damage * 2;
@@ -313,6 +363,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f);
}
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 60, targetHitbox);
public override void OnKill(int timeLeft)
{
if (SoundEngine.TryGetActiveSound(Hum, out var hum) && hum.IsPlaying && !cloneYoyo)
{
hum?.Stop();
}
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(/*(cloneYoyo ? Main.MouseWorld : Projectile.Center)*/ Projectile.Center, 60, targetHitbox);
}
}
Binary file not shown.