diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index e096f3fdfd..d464073728 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -3,26 +3,52 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using ReLogic.Content; +using Terraria.ID; namespace CalamityMod.Backgrounds { - internal static class SunkenSeaBurrowsBG + public class SunkenSeaBurrowsBG : ModSystem { - public static void Load() + public override void Load() { if (Main.dedServ) { return; } - On_Main.DrawBackgroundBlackFill += DrawBurrowsBG; + On_Main.DrawBackgroundBlackFill += On_Main_DrawBackgroundBlackFill; } - public static float Transparency; + /// + /// This code runs because there is a system in vanilla that causes backgrounds to not draw if lighting is too low. + /// That would be fine, the problem arises because sloped tiles still block light the same way normal tiles do. + /// Which means that the background will occasionally be blocked by slopes as though said slopes were full squares. + /// This is a hacky method that sets the light level of every sloped tile *AT LEAST* high enough to render the background while in the Burrows. + /// + /// ENNWAY's note: + /// if this doesn't get fixed in 1.4.5 i am throwing really big rocks at unsuspecting re logic employees + /// + public override void PreUpdatePlayers() + { + if (!Main.dedServ && Main.LocalPlayer.InModBiome()) + { + for (int i = 0; i < Main.screenWidth / 16; i++) + { + for (int j = 0; j < Main.screenWidth / 16; j++) + { + Point pos = (Main.screenPosition / 16).ToPoint() + new Point(i, j); - public static float TransitionSpeed => 0.02f; + if (Main.tile[pos.X, pos.Y].Slope != SlopeType.Solid) + { + Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.1f); + } + } + } + } + } - private static void DrawBurrowsBG(On_Main.orig_DrawBackgroundBlackFill orig, Main self) + private void On_Main_DrawBackgroundBlackFill(On_Main.orig_DrawBackgroundBlackFill orig, Main self) { if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < ((int)Main.worldSurface) * 16f) { @@ -33,6 +59,15 @@ namespace CalamityMod.Backgrounds orig(self); + DrawBurrowsBG(); + } + + public static float Transparency; + + public static float TransitionSpeed => 0.02f; + + private static void DrawBurrowsBG() + { if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) { Transparency += TransitionSpeed; @@ -75,54 +110,54 @@ namespace CalamityMod.Backgrounds switch (Layers) { case 0: - { - zero.Y += 800f; - break; - } + { + zero.Y += 800f; + break; + } case 1: - { - zero.Y += 200f; - break; - } + { + zero.Y += 200f; + break; + } case 2: - { - zero.Y += 450f; - break; - } + { + zero.Y += 450f; + break; + } case 3: - { - zero.Y += 45f; - break; - } + { + zero.Y += 45f; + break; + } case 4: - { - zero.Y += 45f; - break; - } + { + zero.Y += 45f; + break; + } } vector2 *= Scale; zero.Y -= num; float LoopWidth = Scale * rectangle.Width; - //float LoopHeight = Scale * rectangle.Height; + float LoopHeight = Scale * rectangle.Height; int LoopX = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / LoopWidth); - //int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth); + int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth); - //for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++) - //{ + for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++) + { for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++) { Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; var frame = rectangle; - var color = Color.MediumTurquoise * Transparency; + var color = Color.White * Transparency; Main.spriteBatch.Draw(BGTexture, drawPosition, frame, color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); } - //} + } } } } } -} \ No newline at end of file +} diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 1088cbea8e..a6b7bce540 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Linq; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; @@ -8,7 +7,6 @@ using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.DraedonsArsenal; @@ -19,6 +17,8 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using CalamityMod.Projectiles.Typeless; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,6 +60,9 @@ namespace CalamityMod.Balancing bool AotCThrowCombo(Projectile p) => p.type == ProjectileType() && (p.ai[0] == 2 || p.ai[0] == 3); + bool HiveBeeFilter(Projectile p) => + p.type == ProjectileType() && Main.player[p.owner].ActiveItem().type == ItemType(); + UniversalBalancingChanges = new List() { // Nerf Crystal bullet shards by 45% @@ -171,8 +174,8 @@ namespace CalamityMod.Balancing // 45% resist to Mounted Scanner. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); - // 40% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 30% resist to Meowthrower. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to SHPC. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); @@ -188,7 +191,7 @@ namespace CalamityMod.Balancing #region Duke Fishron // 20% vulnerability to The Hive's bees. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.2f, ProjectileType())))); + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileSpecificRequirementBalancingRule(1.2f, HiveBeeFilter)))); // 35% vulnerability to Resurrection Butterfly. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.DukeFishron, Do(new ProjectileResistBalancingRule(1.35f, ProjectileType(), ProjectileType())))); @@ -313,8 +316,8 @@ namespace CalamityMod.Balancing // 50% resist to Dazzling Stabber Staff. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Elemental Axe. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 50% resist to Legion of Celestia. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Pristine Fury's alt fire. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); @@ -338,8 +341,8 @@ namespace CalamityMod.Balancing // 50% resist to Eidolic Wail. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 35% resist to Venusian Trident's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); + // 25% resist to Corinth Prime's Grenades. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); @@ -354,9 +357,6 @@ namespace CalamityMod.Balancing #endregion #region Exo Mechs: Ares - // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(ResistTrueMelee(0.5f)))); - // 30% resist to Dynamic Pursuer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); @@ -501,11 +501,11 @@ namespace CalamityMod.Balancing #endregion #region Supreme Calamitas: Soul Seekers - // 85% resist to Chicken Cannon. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.15f, ProjectileType()))); + // 80% resist to Chicken Cannon. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); - // 50% resist to Subsuming Vortex. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType()))); + // 40% resist to Subsuming Vortex. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType(), ProjectileType()))); // 40% resist to Supernova. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType()))); @@ -515,15 +515,6 @@ namespace CalamityMod.Balancing // 25% resist to Yharim's Crystal. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.75f, ProjectileType()))); - - // 10% resist to Celestus. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType()))); - - // 10% resist to Executioner's Blade stealth strikes. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); - - // 10% resist to Surge Driver's alt click comets. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); #endregion } diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index a8239f952a..37acd3132c 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -65,6 +65,10 @@ namespace CalamityMod.Buffs player.pickSpeed += 0.05f; player.GetAttackSpeed() -= 0.1f; } + else if (type == BuffID.Weak) + { + player.GetAttackSpeed() += 0.051f; + } else if (type == BuffID.Shine) { player.Calamity().shine = true; diff --git a/Buffs/DamageOverTime/Daybroken.cs b/Buffs/DamageOverTime/Daybroken.cs new file mode 100644 index 0000000000..854ac4e535 --- /dev/null +++ b/Buffs/DamageOverTime/Daybroken.cs @@ -0,0 +1,46 @@ +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class Daybroken : ModBuff + { + public override LocalizedText DisplayName => Language.GetOrRegister("BuffName.Daybreak"); + public override LocalizedText Description => Language.GetOrRegister("BuffDescription.Daybreak"); + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().daybroken = true; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool reducedEffects) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.Next(reducedEffects ? 8 : 4) < 3) + { + Dust solarDust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.OrangeTorch, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, reducedEffects ? 175 : 100, default, reducedEffects ? 2f : 3f); + solarDust.noGravity = true; + solarDust.velocity *= 2.8f; + solarDust.velocity.Y -= 0.5f; + if (Main.rand.NextBool(4)) + { + solarDust.noGravity = false; + solarDust.scale *= 0.5f; + } + } + + Lighting.AddLight((int)(Player.position.X / 16f), (int)(Player.position.Y / 16f + 1f), 1f, 0.3f, 0.1f); + } + } +} diff --git a/ExtraTextures/VanillaBuffs/Daybroken.png b/Buffs/DamageOverTime/Daybroken.png similarity index 100% rename from ExtraTextures/VanillaBuffs/Daybroken.png rename to Buffs/DamageOverTime/Daybroken.png diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index eb50771d81..ca809682e8 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -30,24 +30,24 @@ namespace CalamityMod.Buffs.DamageOverTime buffIndex--; } - internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + internal static void DrawEffects(PlayerDrawSet drawInfo) { Player Player = drawInfo.drawPlayer; - if (Main.rand.NextBool(hasDebuffResistance ? 4 : 2)) + if (Main.rand.NextBool(2)) { Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); - CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Coral : Color.OrangeRed, Color.Orange, (hasDebuffResistance ? 0.4f : 0.8f), 15, 2f, 1.9f); + CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Coral : Color.OrangeRed, Color.Orange, 0.8f, 15, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); } - if (Main.rand.NextBool(hasDebuffResistance ? 4 : 2)) + if (Main.rand.NextBool(2)) { Vector2 dustCorner = Player.position - 2f * Vector2.One; Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-5f, -1f)); int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, DustID.GemTopaz, dustVel.X, dustVel.Y); Main.dust[d].noGravity = true; - Main.dust[d].scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.5f) : Main.rand.NextFloat(0.7f, 1.2f); + Main.dust[d].scale = Main.rand.NextFloat(0.7f, 1.2f); Main.dust[d].alpha = 235; } } diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index 553cfc013b..6b3db2fead 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -37,16 +37,16 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(hasDebuffResistance ? 4 : 2)) { Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); - CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, (hasDebuffResistance ? 0.4f : 0.8f), 15, 2f, 1.9f); + CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.Turquoise, Color.PaleTurquoise, (hasDebuffResistance ? 0.4f : 0.8f), 15, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < (hasDebuffResistance ? 1 : 2); i++) { Vector2 dustCorner = Player.position - 2f * Vector2.One; Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); - int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 160 : 206, dustVel.X, dustVel.Y); + int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 300 : 323, dustVel.X, dustVel.Y); Main.dust[d].noGravity = true; - Main.dust[d].scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.4f) : Main.rand.NextFloat(0.5f, 0.7f); + Main.dust[d].scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.3f) : Main.rand.NextFloat(0.5f, 0.5f); Main.dust[d].alpha = 235; } } @@ -57,16 +57,16 @@ namespace CalamityMod.Buffs.DamageOverTime if (Main.rand.NextBool(3)) { Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); - CritSpark spark = new CritSpark(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.8f, 15, 2f, 1.9f); + CritSpark spark = new CritSpark(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.Turquoise, Color.PaleTurquoise, 0.8f, 15, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); } for (int i = 0; i < 2; i++) { Vector2 dustCorner = npc.position - 2f * Vector2.One; Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); - int d = Dust.NewDust(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 160 : 206, dustVel.X, dustVel.Y); + int d = Dust.NewDust(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 300 : 323, dustVel.X, dustVel.Y); Main.dust[d].noGravity = true; - Main.dust[d].scale = Main.rand.NextFloat(0.6f, 0.8f); + Main.dust[d].scale = Main.rand.NextFloat(0.5f, 0.5f); Main.dust[d].alpha = 235; } } diff --git a/Buffs/DamageOverTime/Nightwither.png b/Buffs/DamageOverTime/Nightwither.png index 7a68497f9b..648834aa00 100644 Binary files a/Buffs/DamageOverTime/Nightwither.png and b/Buffs/DamageOverTime/Nightwither.png differ diff --git a/Buffs/DamageOverTime/RancorBurn.cs b/Buffs/DamageOverTime/RancorBurn.cs deleted file mode 100644 index cab69f7bf8..0000000000 --- a/Buffs/DamageOverTime/RancorBurn.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.DamageOverTime -{ - public class RancorBurn : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().RancorBurnTime < npc.buffTime[buffIndex]) - npc.Calamity().RancorBurnTime = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; - } - } -} diff --git a/Buffs/DamageOverTime/RancorBurn.png b/Buffs/DamageOverTime/RancorBurn.png deleted file mode 100644 index f7e99e7e26..0000000000 Binary files a/Buffs/DamageOverTime/RancorBurn.png and /dev/null differ diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs new file mode 100644 index 0000000000..ff9aeafec2 --- /dev/null +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -0,0 +1,79 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class TrueVulnerabilityHex : ModBuff + { + // The visual number displayed in ticks as the enemy takes damage. + public const int TickNumber = 666; + + // The exact amount True Vulnerability Hex reduces NPC life regen by. + public const int DPS = TickNumber * 6; // -3996 life regen, 1998 DPS + + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().trueVHex = true; + + public override void Update(NPC npc, ref int buffIndex) + { + CalamityGlobalNPC cgn = npc.Calamity(); + if (cgn.trueVulnerabilityHex < npc.buffTime[buffIndex]) + { + cgn.trueVulnerabilityHex = npc.buffTime[buffIndex]; + // Set the remaining time of the fire drawer to be exactly right. + if (cgn.VulnerabilityHexFireDrawer != null) + cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + cgn.trueVulnerabilityHex; + } + + // Apply immunity timer. + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) + cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.trueVulnerabilityHex; + + // Destroy the vanilla buff, we don't use it. + npc.DelBuff(buffIndex); + buffIndex--; + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + if (Main.rand.NextBool()) + { + Vector2 position = new(npc.position.X + Main.rand.NextFloat(npc.width), npc.position.Y + Main.rand.NextFloat(npc.height)); + VoidSparkParticle voidSpark = new(position, -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f) * Main.rand.NextFloat(10f, 18f), false, 20, Main.rand.NextFloat(0.02f, 0.05f), Main.rand.NextBool() ? Color.Black : Color.Lerp(Color.Red, Color.Magenta, 0.35f)); + GeneralParticleHandler.SpawnParticle(voidSpark); + } + } + + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool()) + { + VoidSparkParticle spark2 = new VoidSparkParticle(Player.Calamity().RandomDebuffVisualSpot, -Vector2.UnitY * Main.rand.NextFloat(6f, 10f), false, Main.rand.Next(18, 27), Main.rand.NextFloat(0.015f, 0.045f), Main.rand.NextBool() ? Color.Black : Color.Lerp(Color.Red, Color.Magenta, 0.65f)); + GeneralParticleHandler.SpawnParticle(spark2); + } + + Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 : (int)CalamityDusts.Brimstone); + dust.scale = Main.rand.NextFloat(0.6f, 0.7f); + dust.velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.5f, 2.5f); + if (dust.type == 261) + dust.color = Color.Lerp(Color.Orange, Color.White, Main.rand.NextFloat()); + + } + } +} diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.png b/Buffs/DamageOverTime/TrueVulnerabilityHex.png new file mode 100644 index 0000000000..2793cfdc04 Binary files /dev/null and b/Buffs/DamageOverTime/TrueVulnerabilityHex.png differ diff --git a/Buffs/DamageOverTime/Voidfrost.cs b/Buffs/DamageOverTime/Voidfrost.cs new file mode 100644 index 0000000000..fb3b694d61 --- /dev/null +++ b/Buffs/DamageOverTime/Voidfrost.cs @@ -0,0 +1,81 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class Voidfrost : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().voidfrost = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().voidfrost < npc.buffTime[buffIndex]) + npc.Calamity().voidfrost = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + { + Player Player = drawInfo.drawPlayer; + + if (Main.rand.NextBool(5)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + SnowflakeSparkle snowflake = new SnowflakeSparkle(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.4f, 15, 2f, 1.9f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + if (Main.rand.NextBool(40)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + MediumMistParticle mist = new MediumMistParticle(Player.Calamity().RandomDebuffVisualSpot, Vect, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(mist); + } + Vector2 dustCorner = Player.position - 2f * Vector2.One; + Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); + int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 20 : 113, dustVel.X, dustVel.Y); + Main.dust[d].noGravity = true; + Main.dust[d].scale = Main.rand.NextFloat(1f, 0.3f); + Main.dust[d].alpha = 10; + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + if (Main.rand.NextBool(5)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + SnowflakeSparkle snowflake = new SnowflakeSparkle(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.8f, 15, 2f, 1.9f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + if (Main.rand.NextBool(40)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + MediumMistParticle mist = new MediumMistParticle(npcSize, Vect, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(mist); + } + + Vector2 dustCorner = npc.position - 2f * Vector2.One; + Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); + int d = Dust.NewDust(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 20 : 113, dustVel.X, dustVel.Y); + Main.dust[d].noGravity = true; + Main.dust[d].scale = Main.rand.NextFloat(1f, 0.3f); + Main.dust[d].alpha = 10; + } + } +} diff --git a/Buffs/DamageOverTime/Voidfrost.png b/Buffs/DamageOverTime/Voidfrost.png new file mode 100644 index 0000000000..7a68497f9b Binary files /dev/null and b/Buffs/DamageOverTime/Voidfrost.png differ diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 6ea2f5c298..13cbad0a14 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,24 +1,23 @@ -using CalamityMod.NPCs; +using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using CalamityMod.Dusts; namespace CalamityMod.Buffs.DamageOverTime { public class VulnerabilityHex : ModBuff { - // This is the visual number displayed in ticks as the enemy takes damage from this debuff. + // The visual number displayed in ticks as the enemy takes damage. public const int TickNumber = 666; - // This is the exact DPS dealt by Vulnerability Hex to NPCs. - public const int DPS = TickNumber * 4; // 2664 DPS + // The exact amount Vulnerability Hex reduces NPC life regen by. + public const int DPS = TickNumber * 4; // -2664 life regen, 1332 DPS - public const int CalamityDuration = 24; + public const int CalamityDuration = 60; public const int AflameDuration = 120; public override void SetStaticDefaults() diff --git a/Buffs/DamageOverTime/VulnerabilityHex.png b/Buffs/DamageOverTime/VulnerabilityHex.png index 2793cfdc04..c547bc2e18 100644 Binary files a/Buffs/DamageOverTime/VulnerabilityHex.png and b/Buffs/DamageOverTime/VulnerabilityHex.png differ diff --git a/Buffs/Potions/ShadowBuff.cs b/Buffs/Potions/ShadowBuff.cs index 72ee6c1d8b..0244cb7c0b 100644 --- a/Buffs/Potions/ShadowBuff.cs +++ b/Buffs/Potions/ShadowBuff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Buffs.Potions public override void Update(Player player, ref int buffIndex) { player.Calamity().shadow = true; - if (player.yoraiz0rEye < 2 && CalamityConfig.Instance.StealthInvisibility) + if (player.yoraiz0rEye < 2 && CalamityClientConfig.Instance.StealthInvisibility) player.yoraiz0rEye = 2; } } diff --git a/Buffs/Potions/TeslaBuff.cs b/Buffs/Potions/TeslaBuff.cs deleted file mode 100644 index e5a8fac63b..0000000000 --- a/Buffs/Potions/TeslaBuff.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class TeslaBuff : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tesla = true; - } - } -} diff --git a/Buffs/StatBuffs/BossEffects.cs b/Buffs/StatBuffs/BossEffects.cs index 46022d0e27..e32088eaa6 100644 --- a/Buffs/StatBuffs/BossEffects.cs +++ b/Buffs/StatBuffs/BossEffects.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) { - if (CalamityConfig.Instance.BossZen) + if (CalamityServerConfig.Instance.BossZen) tip = tip.Replace(":", ":\n" + this.GetLocalizedValue("ZenDescription")); } } diff --git a/Buffs/StatDebuffs/PearlAura.cs b/Buffs/StatDebuffs/PearlAura.cs index b7b27ee3df..ed0232c4b2 100644 --- a/Buffs/StatDebuffs/PearlAura.cs +++ b/Buffs/StatDebuffs/PearlAura.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -19,5 +21,16 @@ namespace CalamityMod.Buffs.StatDebuffs npc.DelBuff(buffIndex); buffIndex--; } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + if (Main.rand.NextBool(4)) + { + int dustType = Main.rand.NextBool() ? DustID.GemSapphire : DustID.BlueCrystalShard; + Vector2 dustVelocity = Vector2.UnitX.RotatedBy(Main.rand.NextFloat(-MathHelper.Pi / 12f, 0f)) * (Main.rand.NextBool() ? -1f : 1f); + Dust theDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, dustType, dustVelocity.X, dustVelocity.Y); + theDust.noGravity = true; + } + } } } diff --git a/Buffs/Summon/ElementalAxeBuff.cs b/Buffs/Summon/LegionofCelestiaBuff.cs similarity index 91% rename from Buffs/Summon/ElementalAxeBuff.cs rename to Buffs/Summon/LegionofCelestiaBuff.cs index 1454140e20..9157620388 100644 --- a/Buffs/Summon/ElementalAxeBuff.cs +++ b/Buffs/Summon/LegionofCelestiaBuff.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ElementalAxeBuff : ModBuff + public class LegionofCelestiaBuff : ModBuff { public override void SetStaticDefaults() { @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.Summon public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { modPlayer.eAxe = true; } diff --git a/Buffs/Summon/ElementalAxeBuff.png b/Buffs/Summon/LegionofCelestiaBuff.png similarity index 100% rename from Buffs/Summon/ElementalAxeBuff.png rename to Buffs/Summon/LegionofCelestiaBuff.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fb8b456175..7efa1af247 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -85,9 +85,9 @@ namespace CalamityMod.CalPlayer public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; public const float projectileMeleeWeaponMeleeSpeedMultiplier = 0f; - public bool brimlashBusterBoost = false; public int evilSmasherBoost = 0; - public int hellbornBoost = 0; + public int burningSeaBurnOut = 0; + public int hellbornShots = 0; public int searedPanCounter = 0; public int searedPanTimer = 0; public int potionTimer = 0; @@ -95,7 +95,7 @@ namespace CalamityMod.CalPlayer public bool blockAllDashes = false; public bool resetHeightandWidth = false; public bool noLifeRegen = false; - public bool reducedHolyFlamesDamage = false; + public bool reducedDaybrokenDamage = false; public bool reducedNightwitherDamage = false; public float rangedAmmoCost = 1f; public float healingPotionMultiplier = 1f; @@ -179,6 +179,7 @@ namespace CalamityMod.CalPlayer #region Timer and Counter public int gaelSwipes = 0; + public int arsenalCooldown = 0; public int dragoonDrizzlefishGelBoost = 1; public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; @@ -488,6 +489,7 @@ namespace CalamityMod.CalPlayer public bool unstableGraniteCore = false; public bool regenator = false; public bool theBee = false; + public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; public bool alluringBait = false; public bool enchantedPearl = false; @@ -506,11 +508,14 @@ namespace CalamityMod.CalPlayer public bool evasionScarf = false; public bool badgeOfBravery = false; public bool warbannerOfTheSun = false; + public bool tesla = false; + public bool teslaVisuals = true; public bool cryogenSoul = false; public bool ascendantInsignia = false; public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; public bool ascendantTrail = false; + public bool frozenWingsCold = false; public bool magmaStoneVisuals = true; public bool eGauntlet = false; public bool eGauntletVisuals = true; // Used to control dust spawned when swinging @@ -549,7 +554,7 @@ namespace CalamityMod.CalPlayer public bool aBrain = false; public bool amalgam = false; public bool raiderTalisman = false; - public float raiderCritBonus = RaidersTalisman.RaiderBonus; + public float raiderCritLifespan = 0f; public int raiderSoundCooldown = 0; public bool gSabaton = false; public int gSabatonHotkeyHoldTime = 0; @@ -574,6 +579,7 @@ namespace CalamityMod.CalPlayer public bool alchFlask = false; public bool toxicHeart = false; public bool abaddon = false; + public bool aeroStone = false; public bool lifejelly = false; public bool cleansingjelly = false; @@ -638,6 +644,7 @@ namespace CalamityMod.CalPlayer public bool royalGel = false; public bool handWarmer = false; public bool ursaSergeant = false; + public bool ursaSergeantVisual = false; public bool scuttlersJewel = false; public int scuttlerCooldown = 0; public bool thiefsDime = false; @@ -804,6 +811,7 @@ namespace CalamityMod.CalPlayer public bool astralStarRain = false; public int astralStarRainCooldown = 0; public int AbaddonCooldown = 0; + public int ursaSergeantCooldown = 0; public int AlchFlaskCooldown = 0; public bool plagueReaper = false; public bool plaguebringerPatronSet = false; @@ -873,6 +881,7 @@ namespace CalamityMod.CalPlayer #region Debuff public bool alcoholPoisoning = false; public bool shadowflame = false; + public bool daybroken = false; public bool wDeath = false; public bool dragonFire = false; public bool vermillionFlux = false; @@ -897,6 +906,7 @@ namespace CalamityMod.CalPlayer public bool icarusFolly = false; public bool weakPetrification = false; public bool vHex = false; + public bool trueVHex = false; public bool DoGExtremeGravity = false; public bool warped = false; public bool cDepth = false; @@ -907,6 +917,7 @@ namespace CalamityMod.CalPlayer public bool absorberAffliction = false; public bool sulphurPoison = false; public bool nightwither = false; + public bool voidfrost = false; public bool eutrophication = false; public bool iCantBreathe = false; //Frozen Lungs debuff public bool cragsLava = false; @@ -962,7 +973,6 @@ namespace CalamityMod.CalPlayer public bool astralInjection = false; public bool gravityNormalizer = false; public bool flaskHoly = false; - public bool tesla = false; public bool galvanicCorrosion = false; public bool sulphurskin = false; public bool baguette = false; @@ -1171,8 +1181,7 @@ namespace CalamityMod.CalPlayer public bool omegaBlueTransformation; public bool omegaBlueTransformationForce; public bool omegaBlueTransformationPower; - public bool redBow; - public bool cocosFeather; + public bool ghostBracelet; #endregion #region Calamitas Enchant Effects @@ -1731,9 +1740,12 @@ namespace CalamityMod.CalPlayer evolution = false; nanotech = false; deadshotBrooch = false; + tesla = false; + teslaVisuals = true; cryogenSoul = false; ascendantInsignia = false; ascendantTrail = false; + frozenWingsCold = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; @@ -1803,6 +1815,7 @@ namespace CalamityMod.CalPlayer tracersElysian = false; tracersSeraph = false; ursaSergeant = false; + ursaSergeantVisual = false; scuttlersJewel = false; thiefsDime = false; dynamoStemCells = false; @@ -1825,7 +1838,7 @@ namespace CalamityMod.CalPlayer CryoStoneVanity = false; voidField = false; copyrightInfringementShield = false; - reducedHolyFlamesDamage = false; + reducedDaybrokenDamage = false; reducedNightwitherDamage = false; daedalusReflect = false; @@ -1953,6 +1966,7 @@ namespace CalamityMod.CalPlayer alcoholPoisoning = false; shadowflame = false; + daybroken = false; wDeath = false; dragonFire = false; vermillionFlux = false; @@ -1978,6 +1992,7 @@ namespace CalamityMod.CalPlayer elementalMix = false; icarusFolly = false; vHex = false; + trueVHex = false; DoGExtremeGravity = false; warped = false; cDepth = false; @@ -1989,6 +2004,7 @@ namespace CalamityMod.CalPlayer snowmanNoseless = false; sulphurPoison = false; nightwither = false; + voidfrost = false; eutrophication = false; iCantBreathe = false; cragsLava = false; @@ -2024,7 +2040,6 @@ namespace CalamityMod.CalPlayer astralInjection = false; gravityNormalizer = false; flaskHoly = false; - tesla = false; galvanicCorrosion = false; sulphurskin = false; baguette = false; @@ -2223,8 +2238,7 @@ namespace CalamityMod.CalPlayer omegaBlueTransformationPrevious = omegaBlueTransformation; omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false; - redBow = false; - cocosFeather = false; + ghostBracelet = false; rageModeActive = false; adrenalineModeActive = false; @@ -2273,13 +2287,13 @@ namespace CalamityMod.CalPlayer #region Screen Position Movements public override void ModifyScreenPosition() { - if (CalamityConfig.Instance.ScreenshakePower == 0) + if (CalamityClientConfig.Instance.ScreenshakePower == 0) return; if (GeneralScreenShakePower > 0f) { - Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityConfig.Instance.ScreenshakePower); - GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityConfig.Instance.ScreenshakePower); + Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower); + GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); } } #endregion @@ -2327,6 +2341,7 @@ namespace CalamityMod.CalPlayer #region Debuffs heldGaelsLastFrame = false; gaelSwipes = 0; + arsenalCooldown = 0; andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; galileoCooldown = 0; @@ -2346,7 +2361,7 @@ namespace CalamityMod.CalPlayer spiritOriginConvertedCrit = 0; rage = 0f; adrenaline = 0f; - raiderCritBonus = 0f; + raiderCritLifespan = 0f; raiderSoundCooldown = 0; gSabatonHotkeyHoldTime = 0; gSabatonFall = 0; @@ -2354,6 +2369,7 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; astralStarRainCooldown = 0; AbaddonCooldown = 0; + ursaSergeantCooldown = 0; AlchFlaskCooldown = 0; ascendantInsigniaCooldown = 0; silvaMageCooldown = 0; @@ -2383,6 +2399,7 @@ namespace CalamityMod.CalPlayer noLifeRegen = false; alcoholPoisoning = false; shadowflame = false; + daybroken = false; wDeath = false; dragonFire = false; vermillionFlux = false; @@ -2408,6 +2425,7 @@ namespace CalamityMod.CalPlayer elementalMix = false; icarusFolly = false; vHex = false; + trueVHex = false; DoGExtremeGravity = false; warped = false; cDepth = false; @@ -2419,6 +2437,7 @@ namespace CalamityMod.CalPlayer abyssalDivingSuitPlateHits = 0; sulphurPoison = false; nightwither = false; + voidfrost = false; eutrophication = false; iCantBreathe = false; cragsLava = false; @@ -2492,7 +2511,6 @@ namespace CalamityMod.CalPlayer astralInjection = false; gravityNormalizer = false; flaskHoly = false; - tesla = false; galvanicCorrosion = false; sulphurskin = false; baguette = false; @@ -2683,11 +2701,11 @@ namespace CalamityMod.CalPlayer #endregion KameiBladeUseDelay = 0; - brimlashBusterBoost = false; AdrenalineTrail = false; ascendantTrail = false; evilSmasherBoost = 0; - hellbornBoost = 0; + burningSeaBurnOut = 0; + hellbornShots = 0; searedPanCounter = 0; searedPanTimer = 0; potionTimer = 0; @@ -2711,7 +2729,7 @@ namespace CalamityMod.CalPlayer // Respawn the player faster // 3 seconds normally and configurable while a boss is alive between 15 and 60 seconds - int respawnTimerSet = areThereAnyDamnBosses ? (CalamityConfig.Instance.PlayerRespawnTime_BossAlive * 60) : 180; + int respawnTimerSet = areThereAnyDamnBosses ? (CalamityServerConfig.Instance.PlayerRespawnTime_BossAlive * 60) : 180; if (Player.respawnTimer > respawnTimerSet) Player.respawnTimer = respawnTimerSet; } @@ -2762,7 +2780,7 @@ namespace CalamityMod.CalPlayer if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { gSabatonHotkeyHoldTime++; - if (gSabatonHotkeyHoldTime < 60 && gSabatonHotkeyHoldTime % 3f == 0) + if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime % 3f == 0) { SpawnGravistarParticle(); } @@ -2835,16 +2853,15 @@ namespace CalamityMod.CalPlayer Player.statLife = Player.statLifeMax2; } } - if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && - wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(Cooldowns.SandCloak.ID)) + if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Cooldowns.SandCloak.ID)) { - Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(20)); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - rogueStealth -= rogueStealthMax * 0.1f; - int damage = Player.ApplyArmorAccDamageBonusesTo(7); + int damage = Player.ApplyArmorAccDamageBonusesTo(12); + float knockback = 2.5f; - int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 8, Player.whoAmI); + int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Player.whoAmI); Main.projectile[veil].Center = Player.Center; SoundEngine.PlaySound(SoundID.Item45, Player.Center); } @@ -3384,14 +3401,14 @@ namespace CalamityMod.CalPlayer public override void UpdateEquips() { // TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem - CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; + CalamityClientConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; // Putting this in GlobalItem will run multiple times for each slot, which this system already does, creating a slew of problems. VanillaArmorChangeManager.ApplyPotentialEffectsTo(Player); // If the config is enabled, vastly increase the player's base tile and wall placement speeds // This stacks with the Brick Layer and Portable Cement Mixer - if (CalamityConfig.Instance.FasterTilePlacement) + if (CalamityServerConfig.Instance.FasterTilePlacement) { Player.tileSpeed += 0.5f; Player.wallSpeed += 0.5f; @@ -3466,59 +3483,72 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), 60, true); } - if (gSabaton && Player.whoAmI == Main.myPlayer) + if (gSabaton) { - //While holding hotkey, but before slam, bring Y velocity closer to 0 - if (gSabatonHotkeyHoldTime < 60 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) + if (Player.whoAmI == Main.myPlayer) { - Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 4f)) / 60f; - } - //Play sound a bit early so it goes in time with the fall - if (gSabatonHotkeyHoldTime == 45 && !gSabatonFalling) - { - SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); - } - //1 second passed, falling time - if (gSabatonHotkeyHoldTime == 60) - { - gSabatonFalling = true; - } - //Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued - if (Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) - { - gSabatonFall = 0; - gSabatonFalling = false; - } - if (gSabatonFalling) - { - SpawnGravistarParticle(); - - //Cap time converted to damage at 2 seconds - if (gSabatonFall < 120) - gSabatonFall++; - - Player.maxFallSpeed = 40f; - Player.gravity = 1.3f; - //If the player can fly during the fall, the physics gets a bit funky - Player.controlJump = false; - - //Check if player hit some form of solid resistance (the ground) - if (Player.oldVelocity.Y == Player.velocity.Y) + // While holding hotkey, but before slam, bring Y velocity closer to 0 + if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) + { + Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 2f)) / 60f; + } + // Play sound a bit early so it goes in time with the fall + if (gSabatonHotkeyHoldTime == 15 && !gSabatonFalling) + { + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); + } + // 0.5 seconds passed, falling time + if (gSabatonHotkeyHoldTime == 30) + { + gSabatonFalling = true; + Player.velocity.Y = 0.01f; + } + // Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued + // Also cancel fall if the player has upwards Y velocity (Goodbye Inner Tube cheese) + if (Player.velocity.Y < 0f || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - //Spawn explosion. ai[0] is used for transferring the recorded falling time - - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(GravistarSabaton.SlamDamage)); - - Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); gSabatonFall = 0; gSabatonFalling = false; - //Temporary jump speed is granted for 40 frames - gSabatonTempJumpSpeed = 40; + } + if (gSabatonFalling) + { + SpawnGravistarParticle(); + + // Cap time converted to damage at 2 seconds + if (gSabatonFall < 120) + gSabatonFall++; + + Player.maxFallSpeed = 40f; + Player.gravity = 1.3f; + // If the player can fly during the fall, the physics gets a bit funky + Player.controlJump = false; + + // Check if player hit some form of solid resistance (the ground) + if (Player.oldVelocity.Y == Player.velocity.Y) + { + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + //Spawn explosion. ai[0] is used for transferring the recorded falling time + + int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(InterstellarStompers.SlamDamage)); + + Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); + gSabatonFall = 0; + gSabatonFalling = false; + // Temporary jump speed is granted for 40 frames + gSabatonTempJumpSpeed = 40; + } } } - } + else // Reset slam effect if the accessory is unequipped + { + gSabatonFall = 0; + gSabatonFalling = false; + } + + // Reset The Evolution's same projectile DR if unequipped or the cooldown ends + if (!evolution || !Player.HasCooldown(GlobalDodge.ID)) + projTypeJustHitBy = -1; } #endregion @@ -3641,7 +3671,7 @@ namespace CalamityMod.CalPlayer #region PostUpdateBuffs public override void PostUpdateBuffs() { - if (Player.whoAmI == Main.myPlayer && CalamityConfig.Instance.VanillaCooldownDisplay) + if (Player.whoAmI == Main.myPlayer && CalamityClientConfig.Instance.VanillaCooldownDisplay) { if (Player.whoAmI == Main.myPlayer && Player.potionDelay != 0) potionSick = true; @@ -3867,9 +3897,6 @@ namespace CalamityMod.CalPlayer #region Get Weapon Damage And KB public override void ModifyWeaponDamage(Item item, ref StatModifier damage) { - if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type)) - damage += 0.1f; - if (item.CountsAsClass()) { // Apply weapon modifier stealth strike damage bonus @@ -3957,7 +3984,7 @@ namespace CalamityMod.CalPlayer if (item.CountsAsClass()) { var source = Player.GetSource_ItemUse(item); - if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type) && Player.whoAmI == Main.myPlayer) + if (fungalSymbiote && Player.HasBuff(ModContent.BuffType()) && Player.whoAmI == Main.myPlayer) { if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1) || Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3) || @@ -4272,18 +4299,13 @@ namespace CalamityMod.CalPlayer profanedCrystalAnimCounter = new KeyValuePair(0, 10); } - if (redBow) + if (ghostBracelet) { - Player.legs = EquipLoader.GetEquipSlot(Mod, "RedBow", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "RedBow", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "RedBow", EquipType.Head); - } - if (cocosFeather) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "CocosFeather", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "CocosFeather", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "CocosFeather", EquipType.Head); + Player.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); } + if (snowRuffianSet) { Player.wings = EquipLoader.GetEquipSlot(Mod, "SnowRuffianMask", EquipType.Wings); @@ -4920,11 +4942,11 @@ namespace CalamityMod.CalPlayer // Enabling the config while a player is loaded will show the timer immediately. // But it won't start running until you save and quit and re-enter a world. - if (CalamityConfig.Instance.SpeedrunTimer) + if (CalamityClientConfig.Instance.SpeedrunTimer) CalamityMod.SpeedrunTimer.Restart(); - bool showWikiMessage = CalamityConfig.Instance.WikiStatusMessage; - bool showVCMMMessage = CalamityConfig.Instance.VCMMStatusMessage && !CalamityMod.Instance.VCMMAvailable; + bool showWikiMessage = CalamityClientConfig.Instance.WikiStatusMessage; + bool showVCMMMessage = CalamityClientConfig.Instance.VCMMStatusMessage && !CalamityMod.Instance.VCMMAvailable; bool showStartupMessages = showWikiMessage || showVCMMMessage; // Set a random delay between 12 and 20 seconds. When this delay hits zero, startup messages display diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 5c45619b75..1d37410d2e 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -21,7 +21,7 @@ namespace CalamityMod.CalPlayer { get { - return (String.IsNullOrEmpty(dashID) && Player.dashType == 0 && CalamityConfig.Instance.DefaultDashEnabled) ? DefaultDash.ID : dashID; //gives default dash ONLY if no custom or vanilla dash. + return (String.IsNullOrEmpty(dashID) && Player.dashType == 0 && CalamityServerConfig.Instance.DefaultDashEnabled) ? DefaultDash.ID : dashID; //gives default dash ONLY if no custom or vanilla dash. } set => dashID = value; } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 45fb5d0a21..88af62a2d8 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -110,7 +110,7 @@ namespace CalamityMod.CalPlayer } // TODO -- rogue stealth visuals are an utter catastrophe and should be fully destroyed on next stealth rework - if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility) + if (calamityPlayer.rogueStealth > 0f && calamityPlayer.rogueStealthMax > 0f && Player.townNPCs < 3f && CalamityClientConfig.Instance.StealthInvisibility) { // A translucent orchid color, the rogue class color float colorValue = calamityPlayer.rogueStealth / calamityPlayer.rogueStealthMax * 0.9f; //0 to 0.9 @@ -208,6 +208,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.astralInfection && drawInfo.shadow == 0f) AstralInfectionDebuff.DrawEffects(drawInfo); + if (calamityPlayer.auricRebuke && drawInfo.shadow == 0f) + AuricRebuke.DrawEffects(drawInfo); + if (calamityPlayer.bBlood && drawInfo.shadow == 0f) BurningBlood.DrawEffects(drawInfo); @@ -223,14 +226,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.cDepth && drawInfo.shadow == 0f) CrushDepth.DrawEffects(drawInfo); - if (calamityPlayer.vermillionFlux && drawInfo.shadow == 0f) - VermillionFlux.DrawEffects(drawInfo); - - if (calamityPlayer.auricRebuke && drawInfo.shadow == 0f) - AuricRebuke.DrawEffects(drawInfo); - - if (calamityPlayer.staticDischarge && drawInfo.shadow == 0f) - StaticDischarge.DrawEffects(drawInfo); + // Daybroken's visual effects are reduced if the player resists it + if (calamityPlayer.daybroken && drawInfo.shadow == 0f) + Daybroken.DrawEffects(drawInfo, reducedDaybrokenDamage); if (calamityPlayer.dragonFire && drawInfo.shadow == 0f) Dragonfire.DrawEffects(drawInfo); @@ -255,11 +253,7 @@ namespace CalamityMod.CalPlayer // Holy Flames, Holy Inferno and Banishing Fire share the same visual effects if (drawInfo.shadow == 0f && (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire)) - { - // You cannot "resist" Holy Inferno or Banishing Fire, so if you have either of those the visuals are always full strength - bool resistsHolyFlames = !calamityPlayer.hInferno && !calamityPlayer.banishingFire && reducedHolyFlamesDamage; - HolyFlames.DrawEffects(drawInfo, resistsHolyFlames); - } + HolyFlames.DrawEffects(drawInfo); // Icarus' Folly has visual effects but they are mutually exclusive with all Holy Flames variations to prevent visual clutter else if (calamityPlayer.icarusFolly && drawInfo.shadow == 0f) @@ -275,6 +269,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.nightwither && drawInfo.shadow == 0f) // Looks weaker if you have Moon Stone equipped Nightwither.DrawEffects(drawInfo, reducedNightwitherDamage); + if (calamityPlayer.voidfrost && drawInfo.shadow == 0f) + Voidfrost.DrawEffects(drawInfo); + if (calamityPlayer.pFlames && drawInfo.shadow == 0f) Plague.DrawEffects(drawInfo); @@ -284,6 +281,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.shadowflame && drawInfo.shadow == 0f) Shadowflame.DrawEffects(drawInfo); + if (calamityPlayer.staticDischarge && drawInfo.shadow == 0f) + StaticDischarge.DrawEffects(drawInfo); + if (calamityPlayer.sulphurPoison && drawInfo.shadow == 0f) SulphuricPoisoning.DrawEffects(drawInfo); @@ -291,9 +291,15 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.tRegen && drawInfo.shadow == 0f) TarraLifeRegen.DrawEffects(drawInfo); + if (calamityPlayer.trueVHex && drawInfo.shadow == 0f) + TrueVulnerabilityHex.DrawEffects(drawInfo); + if (calamityPlayer.vaporfied && drawInfo.shadow == 0f) Vaporfied.DrawEffects(drawInfo); + if (calamityPlayer.vermillionFlux && drawInfo.shadow == 0f) + VermillionFlux.DrawEffects(drawInfo); + if (calamityPlayer.vHex && drawInfo.shadow == 0f) VulnerabilityHex.DrawEffects(drawInfo); #endregion @@ -446,7 +452,7 @@ namespace CalamityMod.CalPlayer ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 73ddee1d2b..0b99c5dae4 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; @@ -19,10 +20,13 @@ using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Mounts; +using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; +using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.ProfanedGuardians; @@ -38,12 +42,11 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; -using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; -using Terraria.GameContent.Events; +using Terraria.Graphics.Renderers; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; @@ -442,6 +445,10 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Shadowflame").Format(Player.name)); } + if (daybroken) + { + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Daybroken").Format(Player.name)); + } if (bBlood) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BurningBlood" + Main.rand.Next(1, 2 + 1)).Format(Player.name)); @@ -490,10 +497,6 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaBurn").Format(Player.name)); } - if (bloodyMary || everclear || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine || Player.tipsy) - { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholSmall").Format(Player.name)); - } if (witheredDebuff) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").Format(Player.name)); @@ -508,7 +511,7 @@ namespace CalamityMod.CalPlayer if (Main.zenithWorld) SoundEngine.PlaySound(LeonDeathNoiseRE4_ForGFB, Player.Center); - if (NorfleetCounter >= 3 && NorfleetCounter < 1000) + if (NorfleetCounter > 3 && NorfleetCounter < 1000) damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Norfleet").Format(Player.name)); NorfleetCounter = 0; @@ -585,11 +588,45 @@ namespace CalamityMod.CalPlayer { float meleeBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, 1 - DistanceInterpolant); modifiers.SourceDamage += meleeBoost; + + if (meleeBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = meleeBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (meleeBoost > 0f) + { + int count = (int)(30f * meleeBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * meleeBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * meleeBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } else if (item.CountsAsClass()) { float rangedBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, DistanceInterpolant); modifiers.SourceDamage += rangedBoost; + + if (rangedBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = rangedBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (rangedBoost > 0f) + { + int count = (int)(30f * rangedBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * rangedBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * rangedBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } } } @@ -671,11 +708,45 @@ namespace CalamityMod.CalPlayer { float meleeBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, 1 - DistanceInterpolant); modifiers.SourceDamage += meleeBoost; + + if (meleeBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = meleeBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (meleeBoost > 0f) + { + int count = (int)(30f * meleeBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * meleeBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * meleeBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } else if (proj.CountsAsClass()) { float rangedBoost = MathHelper.Lerp(0f, FrostArmorSetChange.ProximityBoost, DistanceInterpolant); modifiers.SourceDamage += rangedBoost; + + if (rangedBoost >= FrostArmorSetChange.ProximityBoost * 0.5f) + { + float intensity = rangedBoost / FrostArmorSetChange.ProximityBoost; + SoundEngine.PlaySound(Cryogen.HitSound with { Volume = intensity - 0.2f }, Player.Center); + } + if (rangedBoost > 0f) + { + int count = (int)(30f * rangedBoost); + for (int i = 0; i < count; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (5f + 100f * rangedBoost); + float scale = Main.rand.NextFloat(0.5f, 1f) + 0.5f * rangedBoost / FrostArmorSetChange.ProximityBoost; + Particle sparkle = new CritSpark(target.Center, velocity, Color.White, Color.DodgerBlue, scale, 15, 0.1f, scale * 2f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } } } @@ -692,32 +763,8 @@ namespace CalamityMod.CalPlayer { Item heldItem = Player.ActiveItem(); - bool wearingForbiddenSet = Player.armor[0].type == ItemID.AncientBattleArmorHat && Player.armor[1].type == ItemID.AncientBattleArmorShirt && Player.armor[2].type == ItemID.AncientBattleArmorPants; - - bool forbiddenWithMagicWeapon = wearingForbiddenSet && heldItem.CountsAsClass(); - bool gemTechBlueGem = GemTechSet && GemTechState.IsBlueGemActive; - - bool crossClassNerfDisabled = forbiddenWithMagicWeapon || fearmongerSet || gemTechBlueGem || profanedCrystalBuffs || DD2Event.Ongoing; - crossClassNerfDisabled |= CalamityLists.DisabledSummonerNerfMinions.Contains(proj.type); - - // If this projectile is a summon, its owner is holding an item, and the cross class nerf isn't disabled from equipment: - if (isSummon && heldItem.type > ItemID.None && !crossClassNerfDisabled) - { - bool heldItemIsClassedWeapon = !heldItem.CountsAsClass() && ( - heldItem.CountsAsClass() || - heldItem.CountsAsClass() || - heldItem.CountsAsClass() || - heldItem.CountsAsClass() - ); - - bool heldItemIsTool = heldItem.pick > 0 || heldItem.axe > 0 || heldItem.hammer > 0; - bool heldItemCanBeUsed = heldItem.useStyle != ItemUseStyleID.None; - bool heldItemIsAccessoryOrAmmo = heldItem.accessory || heldItem.ammo != AmmoID.None; - bool heldItemIsExcludedByModCall = CalamityLists.DisabledSummonerNerfItems.Contains(heldItem.type); - - if (heldItemIsClassedWeapon && heldItemCanBeUsed && !heldItemIsTool && !heldItemIsAccessoryOrAmmo && !heldItemIsExcludedByModCall) - modifiers.FinalDamage *= BalancingConstants.SummonerCrossClassNerf; - } + if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !CalamityLists.DisabledSummonerNerfMinions.Contains(proj.type)) + modifiers.FinalDamage *= BalancingConstants.SummonerCrossClassNerf; } } #endregion @@ -801,6 +848,9 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= damageReductionFromWhisperingDeath; } + if (trueVHex) + modifiers.SourceDamage *= 1.15f; + // // At this point, the player is guaranteed to be hit if there is no dodge. // The amount of damage that will be dealt is yet to be determined. @@ -855,7 +905,7 @@ namespace CalamityMod.CalPlayer if (theBee && theBeeCooldown <= 0 && lifeAndShieldCondition) { contactDamageReduction += 0.5; - theBeeCooldown = 600; + shouldTriggerBeeCooldown = true; } // Apply Adrenaline DR if available @@ -950,6 +1000,7 @@ namespace CalamityMod.CalPlayer { proj.hostile = false; proj.friendly = true; + proj.damage *= 10; proj.velocity *= -2f; proj.extraUpdates += 1; proj.penetrate = 1; @@ -978,6 +1029,9 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.2; } + if (trueVHex) + modifiers.SourceDamage *= 1.15f; + if (auralisAuroraCounter >= 300) { modifiers.SourceDamage.Flat -= 100; @@ -1054,13 +1108,7 @@ namespace CalamityMod.CalPlayer if (evolution) { if (proj.type == projTypeJustHitBy) - projectileDamageReduction += 0.15; - } - - if (transformer) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) - projectileDamageReduction += 0.5; + projectileDamageReduction += 0.25; } if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) @@ -1094,7 +1142,7 @@ namespace CalamityMod.CalPlayer if (theBee && theBeeCooldown <= 0 && lifeAndShieldCondition) { projectileDamageReduction += 0.5; - theBeeCooldown = 600; + shouldTriggerBeeCooldown = true; } // Apply Adrenaline DR if available @@ -1255,21 +1303,7 @@ namespace CalamityMod.CalPlayer } } - if (alchFlask) - { - for (int i = 0; i < 9; i++) - { - int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); - seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); - - Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); - bee.ArmorPenetration = 35; - bee.penetrate = 6; - bee.extraUpdates = 2; - bee.timeLeft = 600; - } - Player.AddBuff(BuffID.Honey, 900); - } + OnHitByCombat(hurtInfo); } public override void OnHitByProjectile(Projectile proj, Player.HurtInfo hurtInfo) @@ -1285,20 +1319,36 @@ namespace CalamityMod.CalPlayer if (!hasIFrames && !Player.creativeGodMode) nextHitDealsDefenseDamage |= proj.Calamity().DealsDefenseDamage; - if (sulphurSet && !proj.friendly && hurtInfo.Damage > 0) + // CIT 22JUL2024: This entire code segment is bugged, so I'm disabling it. + // Very likely because it's trying to index into Main.npc using Projectile.owner. + /*if (!proj.friendly && hurtInfo.Damage > 0) { if (Main.player[proj.owner] is null) { if (!Main.npc[proj.owner].friendly) - Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 60); + { + if (sulphurSet) + Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 60); + if (aSpark) + { + if (transformer) + Main.npc[proj.owner].Calamity().transformerShocked = 120; + else + Main.npc[proj.owner].Calamity().shocked = 120; + } + } } else { Player p = Main.player[proj.owner]; if (p.hostile && Player.hostile && (Player.team != p.team || p.team == 0)) - p.AddBuff(BuffID.Poisoned, 60); + { + if (sulphurSet) + p.AddBuff(BuffID.Poisoned, 60); + } + } - } + }*/ if (proj.hostile && hurtInfo.Damage > 0) { @@ -1390,6 +1440,10 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(BuffID.Poisoned, 300); } + else if (proj.type == ProjectileID.CultistBossFireBall) + { + Player.AddBuff(ModContent.BuffType(), 120); + } else if (proj.type == ProjectileID.CultistBossIceMist) { if (!Player.frozen) @@ -1421,17 +1475,17 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), 300); } - else if (proj.type == ProjectileID.FairyQueenLance || proj.type == ProjectileID.HallowBossRainbowStreak || proj.type == ProjectileID.HallowBossSplitShotCore) + else if ((proj.type == ProjectileID.FairyQueenLance || proj.type == ProjectileID.HallowBossRainbowStreak || proj.type == ProjectileID.HallowBossSplitShotCore) && NPC.ShouldEmpressBeEnraged()) { - Player.AddBuff(NPC.ShouldEmpressBeEnraged() ? ModContent.BuffType() : ModContent.BuffType(), 60); + Player.AddBuff(ModContent.BuffType(), 60); } - else if (proj.type == ProjectileID.HallowBossLastingRainbow) + else if (proj.type == ProjectileID.HallowBossLastingRainbow && NPC.ShouldEmpressBeEnraged()) { - Player.AddBuff(NPC.ShouldEmpressBeEnraged() ? ModContent.BuffType() : ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), 120); } - else if (proj.type == ProjectileID.FairyQueenSunDance) + else if (proj.type == ProjectileID.FairyQueenSunDance && NPC.ShouldEmpressBeEnraged()) { - Player.AddBuff(NPC.ShouldEmpressBeEnraged() ? ModContent.BuffType() : ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), 180); } else if (proj.type == ProjectileID.BloodNautilusShot) { @@ -1450,23 +1504,6 @@ namespace CalamityMod.CalPlayer // As these reflects do not cancel damage, they need to be in OnHit rather than ModifyHit if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) { - // The Transformer can reflect bullets - if (transformer) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity *= -1f; - proj.damage = (int)Player.GetBestClassDamage().ApplyTo(proj.damage * 8); - proj.penetrate = 1; - - // 17APR2024: Ozzatron: The Transformer is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. - int transformerIFrames = Player.ComputeReflectIFrames(); - Player.GiveUniversalIFrames(transformerIFrames, true); - } - } - double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -1502,6 +1539,52 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), 15, true); } + + OnHitByCombat(hurtInfo); + } + + // Shortcut for applying hit effects when hit by either an NPC or projectile + // Reminder that external sources ie. forcefully called hurt functions, hazards (thorns, spikes, lava) are not valid + public void OnHitByCombat(Player.HurtInfo hurtInfo) + { + // Apply The Bee cooldown, must be applied here so that it does not apply on dodges + if (theBee && shouldTriggerBeeCooldown) + { + shouldTriggerBeeCooldown = false; + if (hurtInfo.Damage > 0) + theBeeCooldown = TheBee.CooldownLength; + } + + if (alchFlask) + { + for (int i = 0; i < 9; i++) + { + int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(15); + seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); + + Projectile bee = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f), ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + bee.ArmorPenetration = 35; + bee.penetrate = 6; + bee.extraUpdates = 2; + bee.timeLeft = 600; + } + Player.AddBuff(BuffID.Honey, 900); + } + + if (ursaSergeant) + { + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + Player.AddBuff(ModContent.BuffType(), 150); + for (int i = 0; i < 9; i++) + { + Particle spark2 = new LineParticle(Player.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 20, Main.rand.NextFloat(0.5f, 1.1f), Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust2 = Dust.NewDustPerfect(Player.Center, 267, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise; + } + } } #endregion @@ -1539,14 +1622,14 @@ namespace CalamityMod.CalPlayer Rectangle npcHitbox = n.getRect(); if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height))) { - int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(GravistarSabaton.PassthroughDamage)); + int damage = Player.ApplyArmorAccDamageBonusesTo(Player.CalcIntDamage(InterstellarStompers.PassthroughDamage)); Projectile.NewProjectile(Player.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Main.myPlayer); // 17APR2024: Ozzatron: Gravistar Sabaton gives iframes when passing through enemies for projectile safety. // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. n.Calamity().dashImmunityTime[Player.whoAmI] = 4; - Player.GiveUniversalIFrames(GravistarSabaton.PassthroughIFrames, false); + Player.GiveUniversalIFrames(InterstellarStompers.PassthroughIFrames, false); return true; } @@ -2054,11 +2137,12 @@ namespace CalamityMod.CalPlayer // If the player was just hit by something capable of dealing defense damage, then apply defense damage. // Bloodflare Core makes every hit deal defense damage (to enable its function). - // Defense damage is not applied if the player has iframes. - // This function will be ignored if the player is wearing Chalice, as it handles its defense damage elsewhere. + // Defense damage is not applied if the player has iframes or godmode. bool hitCanApplyDefenseDamage = nextHitDealsDefenseDamage || bloodflareCore; + bool defenseDamageShouldApply = hitCanApplyDefenseDamage && !hasIFrames && !Player.creativeGodMode; - if (hitCanApplyDefenseDamage && !hasIFrames && !Player.creativeGodMode) + // 15AUG2024: Ozzatron: External flag which completely disables defense damage. This overrides Bloodflare Core. + if (defenseDamageShouldApply && !CalamityMod.ExternalFlag_DisableDefenseDamage) { double halfDefense = Player.statDefense / 2.0; int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage; @@ -2210,8 +2294,6 @@ namespace CalamityMod.CalPlayer if (evilSmasherBoost > 0) evilSmasherBoost -= 1; - hellbornBoost = 0; - if (trinketOfChi) chiBuffTimer = 0; @@ -2385,15 +2467,15 @@ namespace CalamityMod.CalPlayer if (npcDist < range) { - float duration = Main.rand.Next(300 + (int)hurtInfo.Damage / 3, 480 + (int)hurtInfo.Damage / 2); - npc.AddBuff(BuffID.Confused, (int)duration, false); + int duration = Main.rand.Next(300 + hurtInfo.Damage / 3, 480 + hurtInfo.Damage / 2); + npc.AddBuff(BuffID.Confused, duration, false); if (amalgam) { - npc.AddBuff(BuffID.Venom, (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(BuffID.Venom, duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); } } } @@ -2459,6 +2541,10 @@ namespace CalamityMod.CalPlayer else Player.immuneTime += iFramesToAdd; + // Similar handle to 1.4 Star Cloak: these hits ie. spikes or lava cannot activate hit effects + if (hurtInfo.CooldownCounter != -1 && hurtInfo.CooldownCounter != 1) + return; + if (aeroSet && hurtInfo.Damage > 25) { // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list @@ -2508,55 +2594,40 @@ namespace CalamityMod.CalPlayer } if (aSpark) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - if (hurtInfo.Damage > 0) + SoundEngine.PlaySound(SoundID.Item93, Player.Center); + + // Only visual effects are done here + // The actual spark spawning is now handled with the shocked variable in CalamityGlobalNPC + + SeaFoamParticle boom = new(Player.Center, Vector2.Zero, new Color(89, 239, 247), new Color(56, 158, 209), 1f, 200f, Main.rand.NextBool() ? -1f : 1f); + GeneralParticleHandler.SpawnParticle(boom); + + for (int e = 0; e < 6; e++) { - SoundEngine.PlaySound(SoundID.Item93, Player.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - - // Start with base damage, then apply the best damage class you can - int sDamage = 6; + Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(4.5f, 5.25f); + Dust electric = Dust.NewDustPerfect(Player.Center, DustID.Electric, dustVel, Scale: 0.75f); + electric.noGravity = true; if (transformer) - sDamage += 42; - sDamage = (int)Player.GetBestClassDamage().ApplyTo(sDamage); - sDamage = Player.ApplyArmorAccDamageBonusesTo(sDamage); - - if (Player.whoAmI == Main.myPlayer) { - for (int i = 0; i < (transformer ? 5 : 4); i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int spark1 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI, 0f, 0f); - int spark2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI, 0f, 0f); - if (spark1.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark1].timeLeft = 120; - Main.projectile[spark1].DamageType = DamageClass.Generic; - if (transformer) - { - Main.projectile[spark1].timeLeft = 240; - Main.projectile[spark1].extraUpdates = 1; - Main.projectile[spark1].penetrate = 10; - } - } - if (spark2.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark2].timeLeft = 120; - Main.projectile[spark2].DamageType = DamageClass.Generic; - if (transformer) - { - Main.projectile[spark2].timeLeft = 240; - Main.projectile[spark2].extraUpdates = 1; - Main.projectile[spark2].penetrate = 10; - } - } - } + NanoParticle nano = new(Player.Center, dustVel, new Color(0, 186, 242), 1f, 20, true, true); + GeneralParticleHandler.SpawnParticle(nano); } } } + if (rBrain) + { + if (!CalamityUtils.AnyProjectiles(ModContent.ProjectileType())) + { + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + int effectStrength = amalgam ? 3 : aBrain ? 2 : 1; + int effectDamage = amalgam ? 300 : aBrain ? 50 : 15; + effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage); + effectDamage = Player.ApplyArmorAccDamageBonusesTo(effectDamage); + + Vector2 spawnerVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 40f) * 12.5f; + Projectile.NewProjectile(source, Player.Center, spawnerVelocity, ModContent.ProjectileType(), effectDamage, 0f, Player.whoAmI, 0f, 0f, effectStrength); + } + } if (inkBomb && !abyssalMirror && !eclipseMirror) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 8e810d1a4b..6b913f7cee 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -75,7 +75,7 @@ namespace CalamityMod.CalPlayer } // - // Calamity debuffs (Vanilla Shadowflame is added here) + // Calamity debuffs (Vanilla Shadowflame and Daybroken are added here) // void ApplyDoTDebuff(bool hasDebuff, int negativeLifeRegenToApply, bool immuneCondition = false) { @@ -104,9 +104,12 @@ namespace CalamityMod.CalPlayer int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1); ApplyDoTDebuff(staticDischarge, staticDoT, purity); ApplyDoTDebuff(bFlames, abaddon ? 10 : 30, purity); + ApplyDoTDebuff(daybroken, reducedDaybrokenDamage ? 20 : 40, purity); ApplyDoTDebuff(nightwither, reducedNightwitherDamage ? 20 : 40, purity); - ApplyDoTDebuff(hFlames, reducedHolyFlamesDamage ? 20 : 40, purity); + ApplyDoTDebuff(hFlames, 40, purity); + ApplyDoTDebuff(voidfrost, 40, purity); ApplyDoTDebuff(vHex, 35); + ApplyDoTDebuff(trueVHex, 50); ApplyDoTDebuff(cDepth, 18, purity); ApplyDoTDebuff(astralInfection, 24, infectedJewel || purity); ApplyDoTDebuff(pFlames, alchFlask ? 10 : 30, purity); @@ -653,29 +656,12 @@ namespace CalamityMod.CalPlayer if (trinketOfChi || chiRegen) Player.lifeRegen += 2; - if (ursaSergeant) - { - if (Player.statLife <= (int)(actualMaxLife * 0.15)) - { - Player.lifeRegen += 3; - Player.lifeRegenTime += 3; - } - else if (Player.statLife <= (int)(actualMaxLife * 0.25)) - { - Player.lifeRegen += 2; - Player.lifeRegenTime += 2; - } - else if (Player.statLife <= (int)(actualMaxLife * 0.5)) - { - Player.lifeRegen += 1; - Player.lifeRegenTime += 1; - } - } - + // Remember this is for 5 seconds after triggering a reflect with a long cooldown if (evolutionLifeRegenCounter > 0) { - Player.lifeRegenTime += 2; - Player.lifeRegen += 2; + Player.lifeRegen += 12; + if (Player.lifeRegenTime < 3600f) + Player.lifeRegenTime = 3600f; } if (darkSunRing) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index bcd4392897..e8f325b942 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -86,7 +86,7 @@ namespace CalamityMod.CalPlayer // Give the player a 24% jump speed boost while wings are equipped, otherwise grant 4% more jump speed so that players can jump 7 tiles high if (Player.wingsLogic > 0) Player.jumpSpeedBoost += 1.2f; - else if (CalamityConfig.Instance.FasterJumpSpeed) + else if (CalamityServerConfig.Instance.FasterJumpSpeed) Player.jumpSpeedBoost += 0.2f; // Decrease the counter on Fearmonger set turbo regeneration @@ -193,13 +193,12 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() = -spiritOriginConvertedCrit; } - if (Player.ActiveItem().type == ModContent.ItemType()) - heldGaelsLastFrame = true; - if (Player.ActiveItem().type != ModContent.ItemType()) saharaSlicersBolts = 0; // De-equipping Gael's Greatsword deletes all rage. + if (Player.ActiveItem().type == ModContent.ItemType()) + heldGaelsLastFrame = true; else if (heldGaelsLastFrame) { heldGaelsLastFrame = false; @@ -664,7 +663,7 @@ namespace CalamityMod.CalPlayer // Auric Ore causes an Auric Rejection unless you are wearing Auric Armor // Auric Rejection causes an electrical explosion that yeets the player a considerable distance - if ((tile.TileType == auricOreID && !(auricSet || tracersSeraph)) || tile.TileType == auricRepulserID) + if ((tile.TileType == auricOreID && !(auricSet || tracersSeraph || Player.creativeGodMode)) || tile.TileType == auricRepulserID) { // Cut grappling hooks so the player is surely thrown Player.RemoveAllGrapplingHooks(); @@ -691,18 +690,8 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(explode with { Pitch = 0.8f }, touchedTile.ToWorldCoordinates()); GenericSparkle sparker = new GenericSparkle(touchedTile.ToWorldCoordinates(), Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - //GeneralScreenShakePower = 200; Player.RemoveAllIFrames(); Projectile.NewProjectile(new EntitySource_TileInteraction(Player, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ModContent.ProjectileType(), 40000, 0f); - //for (int i = 0; i < 3; i++) - { - /* int p = Projectile.NewProjectile(new EntitySource_TileInteraction(Player, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ModContent.ProjectileType(), 0, 0f); - Projectile explosion = Main.projectile[p]; - explosion.ai[1] = 560f + 90f; - explosion.localAI[1] = 0.25f; - explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, 0.2f) + Main.rand.NextFloat(-0.08f, 0.08f); - explosion.netUpdate = true;*/ - } WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true); } } @@ -716,11 +705,6 @@ namespace CalamityMod.CalPlayer if (!blazingCursorDamage) return; - // miscCounter is used to limit Calamity's hit rate. - int framesPerHit = 5; - if (Player.miscCounter % framesPerHit != 1) - return; - Rectangle sigilHitbox = Utils.CenteredRectangle(Main.MouseWorld, new Vector2(35f, 62f)); int sigilDamage = (int)Player.GetBestClassDamage().ApplyTo(Calamity.BaseDamage); sigilDamage = Player.ApplyArmorAccDamageBonusesTo(sigilDamage); @@ -728,9 +712,39 @@ namespace CalamityMod.CalPlayer bool brightenedSigil = false; foreach (NPC target in Main.ActiveNPCs) { - if (!target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.townNPC || NPCID.Sets.ActsLikeTownNPC[target.type] || NPCID.Sets.CountsAsCritter[target.type]) + if (!target.Hitbox.Intersects(sigilHitbox) || target.immortal || target.dontTakeDamage || target.friendly || NPCID.Sets.CountsAsCritter[target.type]) continue; + // Increment the cursor focus counter. Note this actually has a net of increasing by 2 per frame, due to the 1 per frame falloff in GlobalNPC. + // If this counter reaches 300 (which takes 2.5 seconds without interruptions), True VHex is activated. + if (target.Calamity().cursorFocus < CalamityGlobalNPC.cursorFocusMax) + { + target.Calamity().cursorFocus += 3; + + // Draw an expanding orb effect on the cursor based on the cursor focus value. + float cursorFocusRatio = target.Calamity().cursorFocus / (float)CalamityGlobalNPC.cursorFocusMax; + StrongBloom indicator = new(Main.MouseWorld, Vector2.Zero, Color.Lerp(Color.Magenta, Color.Red, cursorFocusRatio), cursorFocusRatio * 0.7f, 2); + GeneralParticleHandler.SpawnParticle(indicator); + + if (target.Calamity().cursorFocus >= CalamityGlobalNPC.cursorFocusMax) + { + target.Calamity().trueVulnerabilityHex = target.Calamity().vulnerabilityHex >= 300 ? target.Calamity().vulnerabilityHex : 300; + target.Calamity().vulnerabilityHex = 0; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/WeaponEnchant"), target.Center); + + for (int i = 0; i < 18; i++) + { + Vector2 orbVel = new Vector2(15, 15).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.33f, 1f); + GlowOrbParticle orb = new(target.Center + orbVel, orbVel, false, 60, Main.rand.NextFloat(0.95f, 1.75f), Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GeneralParticleHandler.SpawnParticle(orb); + } + } + } + + // miscCounter is used to limit Calamity's hit rate. + if (Player.miscCounter % Calamity.FramesPerHit != 1) + return; + // Brighten the sigil because it is dealing damage. This can only happen once per hit event. if (!brightenedSigil) { @@ -740,13 +754,15 @@ namespace CalamityMod.CalPlayer // Create a direct strike to hit this specific NPC. var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, target.whoAmI); + Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, target.whoAmI, 1f); // Enable crits by setting the sigil's damage class to be whatever the player's strongest damage class is. sigilStrike.DamageType = Player.GetBestClass(); - // Incinerate the target with Vulnerability Hex. - target.AddBuff(ModContent.BuffType(), VulnerabilityHex.CalamityDuration); + // Incinerate the target with either Vulnerability Hex or True Vulnerability Hex, depending on current cursor focus. + // This adds 8 to the buff duration, which results in a net increase of 3 frames every time damage is dealt, due to damage occurring every 5 frames. + int buffToInflict = target.Calamity().trueVulnerabilityHex > 0 ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffToInflict, target.Calamity().trueVulnerabilityHex > 0 ? target.Calamity().trueVulnerabilityHex + 8 : target.Calamity().vulnerabilityHex < VulnerabilityHex.CalamityDuration ? VulnerabilityHex.CalamityDuration : target.Calamity().vulnerabilityHex + 8); // Make some fancy dust to indicate damage is being done. for (int j = 0; j < 12; j++) @@ -985,7 +1001,7 @@ namespace CalamityMod.CalPlayer { Player.buffImmune[ModContent.BuffType()] = true; } - if (CalamityConfig.Instance.ChilledWaterRework) + if (CalamityServerConfig.Instance.ChilledWaterRework) { if (Main.expertMode && Player.ZoneSnow && Player.wet && !Player.lavaWet && !Player.honeyWet) { @@ -1108,7 +1124,7 @@ namespace CalamityMod.CalPlayer Player.noFallDmg = true; } - if (CalamityConfig.Instance.FasterFallHotkey) + if (CalamityClientConfig.Instance.FasterFallHotkey) { // Allow the player to double their gravity (but NOT max fall speed!) by holding the down button while in midair. bool holdingDown = Player.controlDown && !Player.controlJump; @@ -1138,7 +1154,7 @@ namespace CalamityMod.CalPlayer } // Increase Rope climb velocities, if enabled - if (CalamityConfig.Instance.FasterRopeClimbSpeed) + if (CalamityServerConfig.Instance.FasterRopeClimbSpeed) { if (Player.pulley) { @@ -1424,6 +1440,8 @@ namespace CalamityMod.CalPlayer Player.buffImmune[ModContent.BuffType()] = true; } + if (arsenalCooldown > 0) + arsenalCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) ascendantInsigniaCooldown--; if (DragonsBreathAudioCooldown > 0) @@ -1456,14 +1474,16 @@ namespace CalamityMod.CalPlayer soundCooldown--; if (shadowPotCooldown > 0) shadowPotCooldown--; - if (raiderCritBonus > 0f) - raiderCritBonus -= RaidersTalisman.RaiderBonus / (float)CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); + if (raiderCritLifespan > 0f) + raiderCritLifespan--; if (raiderSoundCooldown > 0) raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; if (AbaddonCooldown > 0) AbaddonCooldown--; + if (ursaSergeantCooldown > 0) + ursaSergeantCooldown--; if (AlchFlaskCooldown > 0) AlchFlaskCooldown--; if (tarraRangedCooldown > 0) @@ -1522,8 +1542,17 @@ namespace CalamityMod.CalPlayer hideOfDeusTimer--; if (murasamaHitCooldown > 0) murasamaHitCooldown--; - if (hellbornBoost > 0) - hellbornBoost--; + if (burningSeaBurnOut > 0) + { + burningSeaBurnOut--; + if (Main.rand.NextBool()) + { + Vector2 dustSpawnPos = Player.position + new Vector2(Main.rand.NextFloat(Player.width), 0f); + Vector2 dustVelocity = -Vector2.UnitY * Main.rand.NextFloat(3f, 6f); + Dust burnOutDust = Dust.NewDustPerfect(dustSpawnPos, (int)CalamityDusts.Brimstone, dustVelocity); + burnOutDust.noGravity = true; + } + } if (persecutedEnchantSummonTimer < 1800) persecutedEnchantSummonTimer++; else @@ -1578,6 +1607,9 @@ namespace CalamityMod.CalPlayer FlameLickedShell.HandleParryCountdown(Player); } + if (!flameLickedShell && flameLickedShellParry > 0) + flameLickedShellParry--; + // Silver Armor "Medkit" effect if (silverMedkitTimer > 0) { @@ -1699,7 +1731,10 @@ namespace CalamityMod.CalPlayer Player.statLife = upperHealthLimit; if (necroReviveCounter >= NecroArmorSetChange.PostMortemDuration * 60) + { Player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.NecroRevive").Format(Player.name)), 1000, -1); + necroReviveCounter = -1; + } else if (necroReviveCounter % 60 == 59) SoundEngine.PlaySound(NecroArmorSetChange.TimerSound, Player.Center); } @@ -1836,8 +1871,8 @@ namespace CalamityMod.CalPlayer } // Raider Talisman bonus - if (raiderTalisman && !StealthStrikeAvailable()) - Player.GetCritChance() += raiderCritBonus; + if (raiderTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + Player.GetCritChance() += RaidersTalisman.RaiderBonus; if (kamiBoost) Player.GetDamage() += 0.15f; @@ -2274,11 +2309,12 @@ namespace CalamityMod.CalPlayer double breathLossMult = 1D - (Player.gills ? 0.2 : 0D) - // 0.8 (oceanCrest ? 0.2 : 0D) - // 0.8 + (victideSet ? 0.2 : 0D) - // 0.8 (Player.accDivingHelm ? 0.25 : 0D) - // 0.75 (Player.arcticDivingGear ? 0.25 : 0D) - // 0.75 (aquaticEmblem ? 0.25 : 0D) - // 0.75 (Player.accMerman ? 0.3 : 0D) - // 0.7 - (victideSet ? 0.2 : 0D) - // 0.85 + (reaverExplore ? 0.3 : 0D) - // 0.7 ((aquaticHeart && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7 (abyssalDivingSuit ? 0.3 : 0D); // 0.7 @@ -2366,7 +2402,7 @@ namespace CalamityMod.CalPlayer // Reduce breath if (Player.breath > 0) - Player.breath -= (int)(cDepth ? breathLoss + 1D : breathLoss); + Player.breath -= (int)(cDepth && !depthCharm ? breathLoss + 1D : breathLoss); } // If breath is greater than 0 and player has gills or is merfolk, balance out the effects by reducing breath @@ -2693,7 +2729,7 @@ namespace CalamityMod.CalPlayer { Player.statDefense += 30; Player.endurance += 0.1f; - Player.GetDamage() += 0.2f; + Player.GetDamage() += 0.15f; } if (brutalCarnage) @@ -2816,7 +2852,7 @@ namespace CalamityMod.CalPlayer // 50% movement speed bonus so that you don't feel like a snail in the early game // Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy - if (CalamityMod.Instance.overhaul is null && CalamityConfig.Instance.FasterBaseSpeed) + if (CalamityMod.Instance.overhaul is null && CalamityServerConfig.Instance.FasterBaseSpeed) Player.moveSpeed += BalancingConstants.DefaultMoveSpeedBoost; // Reduce how slow Chilled makes the player, because it's cancerous right now @@ -2919,7 +2955,7 @@ namespace CalamityMod.CalPlayer if (giantPearl) { - if (Main.netMode != NetmodeID.MultiplayerClient && !areThereAnyDamnBosses) + if (Main.netMode != NetmodeID.MultiplayerClient) { foreach (NPC npc in Main.ActiveNPCs) { @@ -3001,15 +3037,8 @@ namespace CalamityMod.CalPlayer Player.wingTimeMax = (int)(Player.wingTimeMax * flightTimeMult); if (vHex) - { Player.statDefense -= 20; - if (Player.wingTimeMax < 0) - Player.wingTimeMax = 0; - - Player.wingTimeMax = (int)(Player.wingTimeMax * 0.75); - } - if (icarusFolly) { if (Player.wingTimeMax < 0) @@ -3040,7 +3069,11 @@ namespace CalamityMod.CalPlayer } if (mushy) - Player.statDefense += 6; + { + Player.statDefense += 8; + if (fungalSymbiote) + Player.GetDamage() += 0.1f; + } if (omniscience) { @@ -3125,14 +3158,6 @@ namespace CalamityMod.CalPlayer if (manaOverloader) Player.GetDamage() += 0.06f; - if (rBrain) - { - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.75)) - Player.GetDamage() += 0.1f; - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.moveSpeed -= 0.05f; - } - if (bloodyWormTooth) { Player.GetDamage() += 0.1f; @@ -3224,6 +3249,25 @@ namespace CalamityMod.CalPlayer } } + if (silvaSummon && Player.whoAmI == Main.myPlayer) + { + var source = Player.GetSource_FromThis(SilvaHeadSummon.SilvaCrystalEntitySourceContext); + if (Player.FindBuffIndex(ModContent.BuffType()) == -1) + { + Player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + // 08DEC2023: Ozzatron: Silva Crystals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. + int baseDamage = Player.ApplyArmorAccDamageBonusesTo(600); + var damage = (int)Player.GetTotalDamage().ApplyTo(baseDamage); + + var p = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = baseDamage; + } + } + if (ascendantInsignia && ascendantInsigniaBuffTime > 0) { ascendantTrail = true; @@ -3239,9 +3283,6 @@ namespace CalamityMod.CalPlayer Player.moveSpeed -= moveSpeedLoss; } - if (ursaSergeant) - Player.moveSpeed -= 0.15f; - if (godSlayerThrowing) { if (Player.statLife >= Player.statLifeMax2) @@ -3309,13 +3350,9 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(10)) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); - if (spark.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark].DamageType = DamageClass.Generic; - Main.projectile[spark].localNPCHitCooldown = -2; - Main.projectile[spark].penetrate = 5; - } + Projectile spark = Projectile.NewProjectileDirect(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); + spark.localNPCHitCooldown = -2; + spark.timeLeft = 30; } } } @@ -3431,7 +3468,6 @@ namespace CalamityMod.CalPlayer Player.lavaImmune = true; Player.fireWalk = true; Player.buffImmune[ModContent.BuffType()] = Main.dayTime || empowered; - Player.buffImmune[ModContent.BuffType()] = !Main.dayTime || empowered; Player.buffImmune[BuffID.OnFire] = true; Player.buffImmune[BuffID.Burning] = true; Player.buffImmune[BuffID.Daybreak] = true; @@ -3528,11 +3564,24 @@ namespace CalamityMod.CalPlayer if (check) { // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list - var source = Player.GetSource_Buff(Player.FindBuffIndex(ModContent.BuffType())); - int damage = (int)Player.GetBestClassDamage().ApplyTo(10); + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + int damage = (int)Player.GetBestClassDamage().ApplyTo(12); if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } + + // Reduce duration of Static Discharge + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (Player.buffType[l] == ModContent.BuffType()) + { + if (Player.buffTime[l] > 2) + { + Player.buffTime[l]--; + break; + } + } + } } } else if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) @@ -4250,13 +4299,13 @@ namespace CalamityMod.CalPlayer { if (startMessageDisplayDelay == 0) { - if (CalamityConfig.Instance.WikiStatusMessage) + if (CalamityClientConfig.Instance.WikiStatusMessage) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus1"); CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus2"); } - if (CalamityConfig.Instance.VCMMStatusMessage && !CalamityMod.Instance.VCMMAvailable) + if (CalamityClientConfig.Instance.VCMMStatusMessage && !CalamityMod.Instance.VCMMAvailable) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.VCMMStatus"); } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index e5ab8c846f..6c4215c529 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -7,9 +7,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; -using CalamityMod.EntitySources; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Prismatic; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; @@ -27,7 +25,6 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using Microsoft.Xna.Framework; -using MonoMod.Cil; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -59,9 +56,10 @@ namespace CalamityMod.CalPlayer return; // Handle on-hit melee effects for the gem tech armor set. - GemTechState.MeleeOnHitEffects(target); + if (item.CountsAsClass()) + GemTechState.MeleeOnHitEffects(target); - // Handle on-hit melee effects for the mythril armor set. + // Handle on-hit melee effects for the mythril armor set. (all class inclusive) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); if (witheringWeaponEnchant) @@ -71,6 +69,7 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); target.Calamity().IncreasedColdEffects_EskimoSet = eskimoSet; + target.Calamity().IncreasedColdEffects_FrozenWings = frozenWingsCold; target.Calamity().IncreasedColdEffects_CryoStone = CryoStone; target.Calamity().IncreasedElectricityEffects_Transformer = transformer; @@ -181,6 +180,10 @@ namespace CalamityMod.CalPlayer if (rageModeActive && shatteredCommunity) Player.GetModPlayer().AccumulateRageDamage(damageDone); + + // Ursa Sergeant slash cooldown is reset on kill + if (ursaSergeant && target.life <= 0 && target.realLife == -1) + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); } #endregion @@ -197,17 +200,18 @@ namespace CalamityMod.CalPlayer GemTechState.MeleeOnHitEffects(target); // Handle on-hit ranged effects for the gem tech armor set. - if (proj.CountsAsClass() && proj.type != ModContent.ProjectileType()) + if (proj.CountsAsClass() && proj.type != ProjectileType()) GemTechState.RangedOnHitEffects(target, proj.damage); // Handle on-hit projectiles effects for the mythril armor set. - if (proj.type != ModContent.ProjectileType()) + if (proj.type != ProjectileType()) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); if (witheringWeaponEnchant) witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); cgn.IncreasedColdEffects_EskimoSet = eskimoSet; + cgn.IncreasedColdEffects_FrozenWings = frozenWingsCold; cgn.IncreasedColdEffects_CryoStone = CryoStone; cgn.IncreasedElectricityEffects_Transformer = transformer; @@ -286,6 +290,10 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 60); break; + case ProjectileID.LunarFlare: + target.AddBuff(BuffType(), 180); + break; + case ProjectileID.Cascade: target.AddBuff(BuffID.OnFire, 60); break; @@ -338,6 +346,10 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.OnFire3, 120); } + // Ursa Sergeant slash cooldown is reset on kill + if (ursaSergeant && target.life <= 0 && target.realLife == -1) + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + if (!proj.npcProj && !proj.trap && proj.friendly) { if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) @@ -487,7 +499,7 @@ namespace CalamityMod.CalPlayer if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); } if ((cgp.betterLifeBullet1 || cgp.betterLifeBullet2) && proj.numHits == 0) @@ -509,7 +521,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i <= 2; i++) { - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); } } @@ -615,13 +627,13 @@ namespace CalamityMod.CalPlayer if (!proj.CountsAsClass() && !proj.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); - if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ModContent.ProjectileType()) + if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ProjectileType()) { int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(10); seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); Vector2 seekerVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); - Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); bee.ArmorPenetration = 20; bee.penetrate = 2; bee.extraUpdates = 1; @@ -664,7 +676,17 @@ namespace CalamityMod.CalPlayer { AbaddonCooldown = 15; int AbaddonExploDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.03f, 25); - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); + } + + if (ursaSergeant && ursaSergeantCooldown <= 0) + { + ursaSergeantCooldown = 300; + + int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(333); + ursaSlashdamage = Player.ApplyArmorAccDamageBonusesTo(ursaSlashdamage); + + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), ursaSlashdamage, 0f, Player.whoAmI); } if (proj.CountsAsClass()) @@ -787,7 +809,7 @@ namespace CalamityMod.CalPlayer // Bloodflare Mage Explosion: 50%, softcap starts at 500 base damage to not overly punish slow weapons int bloodflareFireballDamage = Player.ApplyArmorAccDamageBonusesTo(CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250)); - int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); + int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); if (fire.WithinBounds(Main.maxProjectiles)) { Main.projectile[fire].DamageType = DamageClass.Generic; @@ -1075,11 +1097,11 @@ namespace CalamityMod.CalPlayer int damage = (int)Player.GetTotalDamage().ApplyTo(40); damage = Player.ApplyArmorAccDamageBonusesTo(damage); - Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), damage, proj.knockBack, proj.owner, 1f, 0f); + Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), damage, proj.knockBack, proj.owner, 1f, 0f); SoundEngine.PlaySound(SoundID.Item14, proj.Center); - for (int dustexplode = 0; dustexplode < 360; dustexplode++) + for (int dustexplode = 0; dustexplode < 180; dustexplode++) { - Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); + Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode * 2)); int d = Dust.NewDust(proj.Center, proj.width, proj.height, Main.rand.NextBool() ? DustType() : DustType(), dustd.X, dustd.Y, 100, default, 1f); Main.dust[d].noGravity = true; Main.dust[d].position = proj.Center; @@ -1134,7 +1156,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { - raiderCritBonus = RaidersTalisman.RaiderBonus; + raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1182,7 +1204,7 @@ namespace CalamityMod.CalPlayer { if (eGauntlet) { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } if (ataxiaFire) { @@ -1244,13 +1266,9 @@ namespace CalamityMod.CalPlayer if (pSoulArtifact && !profanedCrystal) target.AddBuff(BuffType(), 300); - if (profanedCrystalBuffs) + if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) { - bool empowered = pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; - if (empowered || Main.dayTime) - target.AddBuff(BuffType(), 600); - if (empowered || !Main.dayTime) - target.AddBuff(BuffType(), 600); + target.AddBuff(BuffType(), 600); } if (divineBless) @@ -1265,7 +1283,7 @@ namespace CalamityMod.CalPlayer //20% chance for Voltaic Jelly if (Main.rand.NextBool(starTaintedGenerator ? 1 : 5)) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); } } @@ -1283,6 +1301,11 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 180); if (sulphurSet) target.AddBuff(BuffID.Poisoned, 60); + if (aSpark && Player.IsUnderwater()) + { + int duration = transformer ? 120 : 60; + target.AddBuff(BuffType(), duration); + } if (abyssalAmulet) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); @@ -1324,7 +1347,7 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ProjectileType(), 0, 0f); } if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) @@ -1490,7 +1513,7 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0f); } if (reaverDefense) diff --git a/CalPlayer/DrawLayers/HatExtensionLayer.cs b/CalPlayer/DrawLayers/HatExtensionLayer.cs index b2231f0f0a..7b512ea262 100644 --- a/CalPlayer/DrawLayers/HatExtensionLayer.cs +++ b/CalPlayer/DrawLayers/HatExtensionLayer.cs @@ -23,9 +23,6 @@ namespace CalamityMod.CalPlayer.DrawLayers if (drawPlayer.armor[10].type > ItemID.None) headItem = drawPlayer.armor[10]; - if (drawPlayer.Calamity().cocosFeather) - headItem = new Item(ModContent.ItemType()); - if (ModContent.GetModItem(headItem.type) is IExtendedHat extendedHatDrawer) { string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.ModItem.Name; diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index bbe33b81dd..92ecc32019 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -81,7 +81,7 @@ namespace CalamityMod.CalPlayer.DrawLayers else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value; else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow").Value; + glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortexSmallGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow").Value; else if (itemType == ModContent.ItemType()) diff --git a/CalamityConditions.cs b/CalamityConditions.cs index 8cce78968e..0bba1b6e52 100644 --- a/CalamityConditions.cs +++ b/CalamityConditions.cs @@ -19,7 +19,7 @@ namespace CalamityMod // Config based conditions // - public static readonly Condition PotionSellingConfig = Create("PotionConfig", () => CalamityConfig.Instance.PotionSelling); + public static readonly Condition PotionSellingConfig = Create("PotionConfig", () => CalamityServerConfig.Instance.PotionSelling); // // Player conditions diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 9633a4a45b..6d19bd6f3e 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -5,25 +5,22 @@ using CalamityMod.UI.DraedonsArsenal; using CalamityMod.UI.Rippers; using CalamityMod.UI.SulphurousWaterMeter; using Terraria; +using Terraria.Localization; using Terraria.ModLoader.Config; namespace CalamityMod { [BackgroundColor(49, 32, 36, 216)] - public class CalamityConfig : ModConfig + public class CalamityClientConfig : ModConfig { - public static CalamityConfig Instance; + public static CalamityClientConfig Instance; - // TODO -- Not all Calamity config settings should be considered client side. - // There are many configs which are server side and should stay that way. public override ConfigScope Mode => ConfigScope.ClientSide; - public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref string message) => true; // Clamps values that would cause ugly problems if loaded directly without sanitization. [OnDeserialized] internal void ClampValues(StreamingContext context) { - BossHealthBoost = Utils.Clamp(BossHealthBoost, MinBossHealthBoost, MaxBossHealthBoost); RipperMeterShake = Utils.Clamp(RipperMeterShake, MinMeterShake, MaxMeterShake); ParticleLimit = (int)Utils.Clamp(ParticleLimit, MinParticleLimit, MaxParticleLimit); } @@ -48,10 +45,6 @@ namespace CalamityMod [DefaultValue(5000)] public int ParticleLimit { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - public bool BossesStopWeather { get; set; } - [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 10f)] @@ -106,6 +99,33 @@ namespace CalamityMod [DefaultValue(true)] public bool StealthMeter { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool ChargeMeter { get; set; } + + private const float MinMeterShake = 0f; + private const float MaxMeterShake = 4f; + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(MinMeterShake, MaxMeterShake)] + [Increment(1f)] + [DrawTicks] + [DefaultValue(2f)] + public float RipperMeterShake { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool SpeedrunTimer { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool FlightBar { get; set; } + #endregion + + #region Meter Positions + [Header("MeterPositions")] + [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 100f)] @@ -130,10 +150,6 @@ namespace CalamityMod [DefaultValue(SulphurousWaterMeterUI.DefaultPosY)] public float SulphuricWaterMeterPosY { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool ChargeMeter { get; set; } - [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 100f)] @@ -147,8 +163,28 @@ namespace CalamityMod public float ChargeMeterPosY { get; set; } [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - public bool SpeedrunTimer { get; set; } + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultRagePosX)] + public float RageMeterPosX { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultRagePosY)] + public float RageMeterPosY { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultAdrenPosX)] + public float AdrenalineMeterPosX { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 100f)] + [DefaultValue(RipperUI.DefaultAdrenPosY)] + public float AdrenalineMeterPosY { get; set; } [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] @@ -162,10 +198,6 @@ namespace CalamityMod [DefaultValue(SpeedrunTimerUI.DefaultTimerPosY)] public float SpeedrunTimerPosY { get; set; } - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool FlightBar { get; set; } - [BackgroundColor(192, 54, 64, 192)] [SliderColor(224, 165, 56, 128)] [Range(0f, 100f)] @@ -206,7 +238,37 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool FasterFallHotkey { get; set; } + #endregion + } + [BackgroundColor(49, 32, 36, 216)] + public class CalamityServerConfig : ModConfig + { + public static CalamityServerConfig Instance; + public override ConfigScope Mode => ConfigScope.ServerSide; + public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref NetworkText message) + { + if (whoAmI == 0) + { + return true; + } + if (whoAmI != 0) + { + message = CalamityUtils.GetText("Configs.CalamityServerConfig.Denied").ToNetworkText(); + return false; + } + return false; + } + + // Clamps values that would cause ugly problems if loaded directly without sanitization. + [OnDeserialized] + internal void ClampValues(StreamingContext context) + { + BossHealthBoost = Utils.Clamp(BossHealthBoost, MinBossHealthBoost, MaxBossHealthBoost); + } + + [Header("Gameplay")] + #region General Gameplay Changes [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool RemoveReforgeRNG { get; set; } @@ -257,6 +319,10 @@ namespace CalamityMod [DrawTicks] [DefaultValue(MinBossHealthBoost)] public float BossHealthBoost { get; set; } + + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool BossesStopWeather { get; set; } #endregion #region Default Player Stat Boosts @@ -306,44 +372,5 @@ namespace CalamityMod [DefaultValue(false)] public bool ForceTownSafety { get; set; } #endregion - - #region Revengeance Mode Changes - [Header("Revengeance")] - - private const float MinMeterShake = 0f; - private const float MaxMeterShake = 4f; - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(MinMeterShake, MaxMeterShake)] - [Increment(1f)] - [DrawTicks] - [DefaultValue(2f)] - public float RipperMeterShake { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultRagePosX)] - public float RageMeterPosX { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultRagePosY)] - public float RageMeterPosY { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultAdrenPosX)] - public float AdrenalineMeterPosX { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 100f)] - [DefaultValue(RipperUI.DefaultAdrenPosY)] - public float AdrenalineMeterPosY { get; set; } - #endregion } } diff --git a/CalamityLists.cs b/CalamityLists.cs index 4cd4d3d5f5..1d288f932b 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; @@ -63,6 +64,7 @@ using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; @@ -104,8 +106,7 @@ namespace CalamityMod public static List amalgamBuffList; public static List persistentBuffList; public static List MagicGunIDs; - public static List MushroomWeaponIDs; - public static List MushroomProjectileIDs; + public static List BlacklistedWeaponsWithToolPower; // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. public static List zombieList; @@ -281,7 +282,7 @@ namespace CalamityMod "cocodezi_", "Mendzey", "GameRDheAsianSandwich", - "Tobias", + "Chigbungus", "Streakist", "Eisaya", "Xenocrona", @@ -816,6 +817,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -837,6 +839,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -910,17 +913,17 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCID.EyeofCthulhu, + NPCType(), NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, - NPCID.EyeofCthulhu, - NPCType(), NPCID.QueenBee, + NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, - NPCID.Deerclops, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.PirateShipCannon, @@ -928,6 +931,7 @@ namespace CalamityMod NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, + NPCType(), NPCID.SkeletronPrime, NPCType(), NPCID.PrimeCannon, @@ -937,7 +941,6 @@ namespace CalamityMod NPCID.Plantera, NPCID.PlanterasTentacle, NPCType(), - NPCID.HallowBoss, NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, @@ -955,6 +958,7 @@ namespace CalamityMod NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, + NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, @@ -1562,6 +1566,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), + TileType(), TileID.LivingFire, TileID.LivingCursedFire, TileID.LivingDemonFire, @@ -1585,7 +1590,6 @@ namespace CalamityMod BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), @@ -1723,32 +1727,17 @@ namespace CalamityMod ItemID.ZapinatorOrange }; - MushroomWeaponIDs = new List() + // This list intentionally does not contain Grax. + BlacklistedWeaponsWithToolPower = new List() { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.Hammush, - ItemID.MushroomSpear, - ItemID.Shroomerang - }; - - MushroomProjectileIDs = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileID.TruffleSpore, - ProjectileID.MushroomSpear, - ProjectileID.Shroomerang + ItemID.ButchersChainsaw, + ItemID.LucyTheAxe, + ItemID.Rockfish, + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() }; zombieList = new List() @@ -1987,6 +1976,7 @@ namespace CalamityMod ProjectileID.PiercingStarlight, ProjectileID.Terragrim, ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -2005,6 +1995,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -2037,13 +2028,11 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), }; @@ -2556,6 +2545,7 @@ namespace CalamityMod { NPCID.Spazmatism, 150000 }, // 30 seconds { NPCID.Retinazer, 125000 }, + { NPCType(), 137500 }, { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start { NPCID.TheDestroyerBody, 250000 }, @@ -2603,20 +2593,20 @@ namespace CalamityMod BossValues = new SortedDictionary { - { NPCID.KingSlime, Item.buyPrice(0, 5)}, - { NPCID.EyeofCthulhu, Item.buyPrice(0, 10)}, - { NPCID.QueenBee, Item.buyPrice(0, 15)}, + { NPCID.KingSlime, Item.buyPrice(0, 5) }, + { NPCID.EyeofCthulhu, Item.buyPrice(0, 10) }, + { NPCID.QueenBee, Item.buyPrice(0, 15) }, { NPCID.SkeletronHead, Item.buyPrice(0, 20) }, { NPCID.Deerclops, Item.buyPrice(0, 20) }, - { NPCID.WallofFlesh, Item.buyPrice(0, 25)}, - { NPCID.QueenSlimeBoss, Item.buyPrice(0, 30)}, - { NPCID.Spazmatism, Item.buyPrice(0, 40)}, - { NPCID.Retinazer, Item.buyPrice(0, 40)}, - { NPCID.TheDestroyer, Item.buyPrice(0, 40)}, - { NPCID.SkeletronPrime, Item.buyPrice(0, 40)}, - { NPCID.Plantera, Item.buyPrice(0, 50)}, - { NPCID.HallowBoss, Item.buyPrice(0, 60)}, - { NPCID.Golem, Item.buyPrice(0, 60)}, + { NPCID.WallofFlesh, Item.buyPrice(0, 25) }, + { NPCID.QueenSlimeBoss, Item.buyPrice(0, 30) }, + { NPCID.Spazmatism, Item.buyPrice(0, 40) }, + { NPCID.Retinazer, Item.buyPrice(0, 40) }, + { NPCID.TheDestroyer, Item.buyPrice(0, 40) }, + { NPCID.SkeletronPrime, Item.buyPrice(0, 40) }, + { NPCID.Plantera, Item.buyPrice(0, 50) }, + { NPCID.HallowBoss, Item.buyPrice(0, 60) }, + { NPCID.Golem, Item.buyPrice(0, 60) }, { NPCID.DukeFishron, Item.buyPrice(0, 75) }, { NPCID.CultistBoss, Item.buyPrice(1) }, { NPCID.MoonLordCore, Item.buyPrice(1, 50) } @@ -2748,8 +2738,7 @@ namespace CalamityMod amalgamBuffList = null; persistentBuffList = null; MagicGunIDs = null; - MushroomWeaponIDs = null; - MushroomProjectileIDs = null; + BlacklistedWeaponsWithToolPower = null; zombieList = null; demonEyeList = null; diff --git a/CalamityMod.cs b/CalamityMod.cs index 6c24cae73b..fcf4eb3679 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -82,6 +82,9 @@ namespace CalamityMod public static int ghostKillCount = 0; public static int sharkKillCount = 0; + // Boss Head Icons + public static int chadPrimeIcon; + public static Asset carpetOriginal; // Astral Sky/BG @@ -108,6 +111,9 @@ namespace CalamityMod // Destroyer glowmasks public static Asset[] DestroyerGlowmasks = new Asset[3]; + // Probe glowmask + public static Asset ProbeGlowmask; + // Wall of Flesh glowmasks public static Asset WallOfFleshEyeGlowmask; public static Asset WallOfFleshDemonSickleTexture; @@ -129,6 +135,11 @@ namespace CalamityMod // This can be edited by other mods using reflection to prevent compatibility issues public static bool ExternalFlag_DisableNonRevBossAI = false; + // External flag to disable Defense Damage + // This can be edited by other mods using reflection if desired + // Note that this flag trumps Bloodflare Core and will stop that accessory from working properly. + public static bool ExternalFlag_DisableDefenseDamage = false; + internal static CalamityMod Instance; // TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker") @@ -286,6 +297,9 @@ namespace CalamityMod DestroyerGlowmasks[1] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); DestroyerGlowmasks[2] = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); + // Probe glowmask + ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad); + // Wall of Flesh glowmasks WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); @@ -368,6 +382,11 @@ namespace CalamityMod ThanatosBody2.LoadHeadIcons(); ThanatosTail.LoadHeadIcons(); + // All the head icon loading shit is done here, so I'm putting this here + string chadPrimeIconPath = "CalamityMod/ExtraTextures/ChadPrime_Head_Boss"; + CalamityMod.Instance.AddBossHeadTexture(chadPrimeIconPath, -1); + chadPrimeIcon = ModContent.GetModBossHeadSlot(chadPrimeIconPath); + // TODO -- Is this not possible to place in ModItem.Load or ModItem.SetStaticDefaults ? // Centralizing hair dye shaders like this seems absurdly stiff GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); @@ -433,6 +452,7 @@ namespace CalamityMod NPCStats.Unload(); CalamityGlobalItem.UnloadTweaks(); CalamityGlobalProjectile.UnloadTweaks(); + FramedGlowMask.UnloadTexCache(); PopupGUIManager.UnloadGUIs(); InvasionProgressUIManager.UnloadGUIs(); @@ -484,7 +504,7 @@ namespace CalamityMod #endregion Render Target Management #region Force ModConfig save (Reflection) - internal static void SaveConfig(CalamityConfig cfg) + internal static void SaveConfig(CalamityClientConfig cfg) { // There is no current way to manually save a mod configuration file in tModLoader. // The method which saves mod config files is private in ConfigManager, so reflection is used to invoke it. diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index c498f8c37c..60e108c2c2 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Providence; @@ -144,16 +145,28 @@ namespace CalamityMod } break; + case CalamityModMessageType.PlaceAltCritter: + { + int placerplayer = reader.ReadInt32(); + int posX = reader.ReadInt32(); + int posY = reader.ReadInt32(); + int type = reader.ReadInt32(); + int itemType = reader.ReadInt32(); + float color = reader.ReadInt32(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int n = NPC.NewNPC(Main.player[placerplayer].GetSource_ReleaseEntity(), posX, posY, type, ai1: color); + Main.npc[n].catchItem = itemType; + Main.npc[n].releaseOwner = (short)placerplayer; + } + } + break; + case CalamityModMessageType.ServersideSpawnOldDuke: byte playerIndex2 = reader.ReadByte(); CalamityUtils.SpawnOldDuke(playerIndex2); break; - case CalamityModMessageType.ArmoredDiggerCountdownSync: - int countdown5 = reader.ReadInt32(); - CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5; - break; - case CalamityModMessageType.ProvidenceDyeConditionSync: byte npcIndex3 = reader.ReadByte(); (Main.npc[npcIndex3].ModNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean(); @@ -312,6 +325,47 @@ namespace CalamityMod MusicEventSystem.ReceiveSyncResponse(reader); break; + // + // Bandit refund syncs + // + case CalamityModMessageType.SomeoneGotScammedByTinkerer: + int scammedOne = reader.ReadByte(); + int stolen = reader.Read7BitEncodedInt(); + + CalamityWorld.MoneyStolenByBandit += stolen; + CalamityWorld.Reforges++; + + // Broadcast back for tragic event + // WorldSync DO sync the MoneyStolenByBandit and Refores variable, But spamming SyncWorld is not a ideal action + if (Main.dedServ) + { + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.SomeoneGotScammedByTinkerer); + packet.Write((byte)scammedOne); + packet.Write7BitEncodedInt(stolen); + packet.Send(ignoreClient: scammedOne); + } + + break; + + case CalamityModMessageType.WantToRefundReforges: + int requester = reader.ReadByte(); + + // Only Server should handle this action! + if (!Main.dedServ) + break; + + int banditIdx = NPC.FindFirstNPC(ModContent.NPCType()); + if (banditIdx == -1) + break; + + NPC bandit = Main.npc[banditIdx]; + if (bandit == null || !bandit.active) + break; + + THIEF.DoRefund(bandit); + break; + // // Default case: with no idea how long the packet is, we can't safely read data. // Throw an exception now instead of allowing the network stream to corrupt. @@ -392,8 +446,8 @@ namespace CalamityMod SyncAndroombaSolution, SyncAndroombaAI, SyncSlabCrabAI, + PlaceAltCritter, ServersideSpawnOldDuke, - ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes. PSCChallengeSync, // TODO -- once you've failed the PSC challenge this packetstorms @@ -437,6 +491,10 @@ namespace CalamityMod // Music events MusicEventSyncRequest, - MusicEventSyncResponse + MusicEventSyncResponse, + + // Bandit Reforge Refund + SomeoneGotScammedByTinkerer, + WantToRefundReforges } } diff --git a/Cooldowns/ArsenalPower.cs b/Cooldowns/ArsenalPower.cs new file mode 100644 index 0000000000..d61c4bce55 --- /dev/null +++ b/Cooldowns/ArsenalPower.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Cooldowns +{ + public class ArsenalPower : CooldownHandler + { + public static new string ID => "ArsenalPower"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/ArsenalPower"; + public override Color OutlineColor => Color.White; + public override Color CooldownStartColor => Color.Sienna; + public override Color CooldownEndColor => Color.LightSlateGray; + + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/ArsenalOffCooldown"); + } +} diff --git a/Cooldowns/ArsenalPower.png b/Cooldowns/ArsenalPower.png new file mode 100644 index 0000000000..72e59d3de1 Binary files /dev/null and b/Cooldowns/ArsenalPower.png differ diff --git a/Cooldowns/ArsenalPowerOutline.png b/Cooldowns/ArsenalPowerOutline.png new file mode 100644 index 0000000000..2378fee32c Binary files /dev/null and b/Cooldowns/ArsenalPowerOutline.png differ diff --git a/Cooldowns/ArsenalPowerOverlay.png b/Cooldowns/ArsenalPowerOverlay.png new file mode 100644 index 0000000000..92655b1c94 Binary files /dev/null and b/Cooldowns/ArsenalPowerOverlay.png differ diff --git a/Cooldowns/ChaosState.cs b/Cooldowns/ChaosState.cs index 4759b9b42c..a049141f3d 100644 --- a/Cooldowns/ChaosState.cs +++ b/Cooldowns/ChaosState.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Cooldowns { public static new string ID => "ChaosState"; - public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.chaosState; + public override bool ShouldDisplay => CalamityClientConfig.Instance.VanillaCooldownDisplay && instance.player.chaosState; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); public override string Texture => "CalamityMod/Cooldowns/ChaosState" + skinTexture; public override Color OutlineColor => outlineColor; diff --git a/Cooldowns/PotionSickness.cs b/Cooldowns/PotionSickness.cs index 2127706e4e..d7a8708f80 100644 --- a/Cooldowns/PotionSickness.cs +++ b/Cooldowns/PotionSickness.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Cooldowns public class PotionSickness : CooldownHandler { public static new string ID => "PotionSickness"; - public override bool ShouldDisplay => CalamityConfig.Instance.VanillaCooldownDisplay && instance.player.potionDelay > 0; + public override bool ShouldDisplay => CalamityClientConfig.Instance.VanillaCooldownDisplay && instance.player.potionDelay > 0; public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); public override string Texture => "CalamityMod/Cooldowns/PotionSickness"; public override Color OutlineColor => new Color(255, 142, 165); diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index e6a6aa75a2..c1efad8a93 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -200,6 +200,7 @@ namespace CalamityMod { NPCID.Spazmatism, 0.85 }, { NPCID.Retinazer, 0.85 }, + { ModContent.NPCType(), 0.85 }, { ModContent.NPCType(), 1.1 }, { ModContent.NPCType(), 0.8 }, @@ -398,6 +399,12 @@ namespace CalamityMod 102, // 153 in phase 2 119, // 178 in phase 2 153 } }, // 229 in phase 2 + { ModContent.NPCType(), new int[] { + 62, // 93 in phase 2 + 94, // 141 in phase 2 + 110, // 165 in phase 2 + 128, // 192 in phase 2 + 178 } }, // 267 in phase 2 { ModContent.NPCType(), new int[] { 110, 176, 187, 198, 330 } }, { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 240 } }, @@ -636,6 +643,9 @@ namespace CalamityMod { new Tuple(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 120, 148, 176, 264 } }, { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 100, 128, 156, 234 } }, + /*{ new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 50, 108, 132, 156, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } },*/ { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 210 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 57410d7bf4..a8976ede23 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Effects // Scarlet Devil main spear glowing trail. BEWARE: Is reused by many other items! internal static Effect ScarletDevilShader; - // Yharon border suns (or flame pillars?) unsure. it's one or the other. maybe both + // Yharon border flame pillar trail. internal static Effect BordernadoFireShader; // Photon Ripper hardlight teeth trail shader @@ -99,13 +99,13 @@ namespace CalamityMod.Effects // Exoblade's melee slash trails. Also used by Terratomere internal static Effect ExobladeSlashShader; - // Exoblade's projectile on-hit "aniume slash marks". Also used by Terratomere + // Exoblade's projectile on-hit "anime slash marks". Also used by Terratomere internal static Effect ExobladePierceShader; - // Used by Subsuming Vortex's various vortices. Draws the main vortices + // Used by Subsuming Vortex's various vortices. Draws the main vortices. BEWARE: Reused by Burning Sea's fireball. internal static Effect ExoVortexShader; - // Used by Subsuming Vortex's side vortices. Draws the swirling energy tendrils. + // Used by Subsuming Vortex's small vortices. Draws the trailing energy tendrils. internal static Effect SideStreakTrailShader; // Used by Heavenly Gale's hardlight arrows. @@ -185,6 +185,8 @@ namespace CalamityMod.Effects #region Aqua's Shaders internal static Effect CircularGradientWithEdge; internal static Effect GaleforceArrowTrailShader; + internal static Effect WavyOpacity; + internal static Effect HellBall; #endregion // @@ -410,6 +412,12 @@ namespace CalamityMod.Effects GaleforceArrowTrailShader = LoadShader("GaleforceArrowTrail"); RegisterMiscShader(ArtAttackTrailShader, "TrailPass", "GaleforceArrowTrail"); + + WavyOpacity = LoadShader("WavyOpacity"); + RegisterMiscShader(WavyOpacity, "WavyOpacityPass", "WavyOpacity"); + + HellBall = LoadShader("HellBall"); + RegisterScreenShader(HellBall, "HellBallPass", "HellBall"); #endregion #region Loading Amber's Shaders diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index bb7c1160de..c702f6da53 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -212,7 +212,8 @@ namespace CalamityMod.Events { NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Spazmatism); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Retinazer); - }, permittedNPCs: NPCID.Retinazer), + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); + }, permittedNPCs: new int[] { NPCID.Retinazer, ModContent.NPCType() }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), diff --git a/ExtraTextures/ChadPrime_Head_Boss.png b/ExtraTextures/ChadPrime_Head_Boss.png new file mode 100644 index 0000000000..313edebc2c Binary files /dev/null and b/ExtraTextures/ChadPrime_Head_Boss.png differ diff --git a/ExtraTextures/Lasers/BirbAuraEnd.png b/ExtraTextures/Lasers/BirbAuraEnd.png deleted file mode 100644 index 4003d549d6..0000000000 Binary files a/ExtraTextures/Lasers/BirbAuraEnd.png and /dev/null differ diff --git a/ExtraTextures/Lasers/BirbAuraEndpoints.png b/ExtraTextures/Lasers/BirbAuraEndpoints.png new file mode 100644 index 0000000000..bf4bfa8594 Binary files /dev/null and b/ExtraTextures/Lasers/BirbAuraEndpoints.png differ diff --git a/ExtraTextures/Lasers/BirbAuraStart.png b/ExtraTextures/Lasers/BirbAuraStart.png deleted file mode 100644 index 1a999c374d..0000000000 Binary files a/ExtraTextures/Lasers/BirbAuraStart.png and /dev/null differ diff --git a/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png b/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png new file mode 100644 index 0000000000..c0105e82e4 Binary files /dev/null and b/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png differ diff --git a/Gores/Foveanator/Foveanator1.png b/Gores/Foveanator/Foveanator1.png new file mode 100644 index 0000000000..f83523374e Binary files /dev/null and b/Gores/Foveanator/Foveanator1.png differ diff --git a/Gores/Foveanator/Foveanator2.png b/Gores/Foveanator/Foveanator2.png new file mode 100644 index 0000000000..4f05c9202b Binary files /dev/null and b/Gores/Foveanator/Foveanator2.png differ diff --git a/Gores/HauntedChum/ChumBone1.png b/Gores/HauntedChum/ChumBone1.png new file mode 100644 index 0000000000..86bff0e329 Binary files /dev/null and b/Gores/HauntedChum/ChumBone1.png differ diff --git a/Gores/HauntedChum/ChumBone2.png b/Gores/HauntedChum/ChumBone2.png new file mode 100644 index 0000000000..58961d2094 Binary files /dev/null and b/Gores/HauntedChum/ChumBone2.png differ diff --git a/Gores/HauntedChum/HauntedChum.png b/Gores/HauntedChum/HauntedChum.png new file mode 100644 index 0000000000..11b9e1f220 Binary files /dev/null and b/Gores/HauntedChum/HauntedChum.png differ diff --git a/Gores/HauntedChum/HauntedChumMouth.png b/Gores/HauntedChum/HauntedChumMouth.png new file mode 100644 index 0000000000..6fa25c049e Binary files /dev/null and b/Gores/HauntedChum/HauntedChumMouth.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png b/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png new file mode 100644 index 0000000000..07f2e01333 Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png b/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png new file mode 100644 index 0000000000..303ac4ccde Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png new file mode 100644 index 0000000000..860fd8b8c2 Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png differ diff --git a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png new file mode 100644 index 0000000000..613ee6e5e1 Binary files /dev/null and b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png differ diff --git a/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs index 94905b59fc..ac4203ca1b 100644 --- a/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers public static NPC Deerclops => Main.npc[NPC.deerclopsBoss]; - //Should only draw if not in the main menu, deerclops is active or the border is fading post-death, - //it's rev+ and the boolean for drawing the border is true. + // Should only draw if not in the main menu, deerclops is active or the border is fading post-death, + // It's rev+ and the boolean for drawing the border is true. public override bool ShouldDraw => !Main.gameMenu && DeerclopsAI.borderScalar > 0f && DeerclopsAI.shouldDrawEnrageBorder; #endregion @@ -26,18 +26,21 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers bool shouldDraw; var deerclopsInactive = false; if (NPC.deerclopsBoss >= 0 && NPC.deerclopsBoss.WithinBounds(Main.npc.Length)) + { shouldDraw = Deerclops.HasValidTarget; + } else { shouldDraw = DeerclopsAI.borderScalar > 0f; deerclopsInactive = true; } + if (shouldDraw) { var minRadius = DeerclopsAI.innerBorder; var maxRadius = DeerclopsAI.outerBorder; - //Begin drawing the shadow + // Begin drawing the shadow var blackTile = TextureAssets.MagicPixel; var shader = GameShaders.Misc["CalamityMod:DeerclopsShadowShader"].Shader; @@ -48,16 +51,17 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2()); shader.Parameters["maxOpacity"].SetValue(DeerclopsAI.borderScalar); - spriteBatch.EnterShaderRegion(BlendState.NonPremultiplied, shader); Rectangle rekt = new(Main.screenWidth / 2, Main.screenHeight / 2, Main.screenWidth, Main.screenHeight); spriteBatch.Draw(blackTile.Value, rekt, null, default, 0f, blackTile.Value.Size() * 0.5f, 0, 0f); - //Shadow drawing complete + + // Shadow drawing complete spriteBatch.ExitShaderRegion(); } + if (deerclopsInactive) { - //Push the border away and fade out when deerclops is deadge + // Push the border away and fade out when deerclops is deadge DeerclopsAI.borderScalar = MathHelper.Clamp(DeerclopsAI.borderScalar - 0.015f, 0f, 1f); DeerclopsAI.innerBorder += 30f; DeerclopsAI.outerBorder += 30f; diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index ef06ec1d55..6dabd88c65 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -114,7 +114,7 @@ namespace CalamityMod.ILEditing cursor.Remove(); // Increase by 10% if the higher jump speed is enabled. - cursor.EmitDelegate>(() => CalamityConfig.Instance.HigherJumpHeight ? BalancingConstants.ConfigBoostedBaseJumpHeight : VanillaBaseJumpHeight); + cursor.EmitDelegate>(() => CalamityServerConfig.Instance.HigherJumpHeight ? BalancingConstants.ConfigBoostedBaseJumpHeight : VanillaBaseJumpHeight); } #endregion diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 80b5c69f15..3ed952106c 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -86,7 +86,10 @@ namespace CalamityMod.ILEditing On_Player.UpdateItemDye += FindCalamityItemDyeShader; On_AWorldListItem.GetDifficulty += GetDifficultyOverride; On_Item.GetShimmered += ShimmerEffectEdits; - Terraria.On_Player.Teleport += TPOverride; + On_Player.Teleport += TPOverride; + On_NPC.SpawnBoss += TripletsSpawnTextOverride; + On_NPC.DoDeathEvents_BeforeLoot += PreventFoveanatorDefeatMessageIfNotKilledLast; + On_NPC.DoDeathEvents_CelebrateBossDeath += TripletsDefeatTextOverride; // Mana Burn (Chaos Stone) and Chalice of the Blood God IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; @@ -157,6 +160,9 @@ namespace CalamityMod.ILEditing On_Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement; On_Player.GetAnglerReward += ImproveAnglerRewards; + On_Player.ItemCheck_CheckCanUse += RemoveCelestialSigilUseLock; + On_Player.ItemCheck_UseEventItems += ApplyCelestialSigilChanges; + // Fix vanilla bugs exposed by Calamity mechanics IL_NPC.NPCLoot += FixSplittingWormBannerDrops; On_NPC.PlayerInteraction += FixSplittingWormInteraction; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index d016539342..231b0affeb 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -16,6 +16,7 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Ravager; using CalamityMod.Particles; using CalamityMod.Projectiles; @@ -25,12 +26,14 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Walls; using CalamityMod.Waterfalls; using CalamityMod.Waters; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Mono.Cecil.Cil; using MonoMod.Cil; using ReLogic.Content; using Terraria; +using Terraria.Chat; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Achievements; @@ -342,7 +345,7 @@ namespace CalamityMod.ILEditing { // A cached delegate is used here instead of direct reflection for performance reasons // since UpdateTime is called every frame. - if (Main.dayTime || CalamityConfig.Instance.TownNPCsSpawnAtNight) + if (Main.dayTime || CalamityServerConfig.Instance.TownNPCsSpawnAtNight) VanillaSpawnTownNPCs(); }); @@ -358,7 +361,7 @@ namespace CalamityMod.ILEditing private static void AlterTownNPCSpawnRate(Terraria.On_Main.orig_UpdateTime_SpawnTownNPCs orig) { double oldWorldRate = Main.desiredWorldTilesUpdateRate; - Main.desiredWorldTilesUpdateRate *= CalamityConfig.Instance.TownNPCSpawnRateMultiplier; + Main.desiredWorldTilesUpdateRate *= CalamityServerConfig.Instance.TownNPCSpawnRateMultiplier; orig(); Main.desiredWorldTilesUpdateRate = oldWorldRate; } @@ -781,7 +784,7 @@ namespace CalamityMod.ILEditing private static void AdditiveDrawing(ILContext il) { ILCursor cursor = new(il); - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("DrawWhite"))) + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("Draw"))) return; cursor.EmitDelegate(() => @@ -1181,7 +1184,7 @@ namespace CalamityMod.ILEditing float wave6angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave6)); float bigwaveangle = 0.55f + 0.80f * (float)Math.Sin(MathHelper.ToRadians(bigwave)); outputColor = Vector3.Lerp(outputColor, Color.DarkSlateGray.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle); - outputColor *= brightness; + outputColor *= brightness * 6f; } } } @@ -1551,5 +1554,66 @@ namespace CalamityMod.ILEditing } } #endregion + + #region Revengeance Master Mode Twins Shenanigans + public static void TripletsSpawnTextOverride(Terraria.On_NPC.orig_SpawnBoss orig, int x, int y, int type, int targetPlayerIndex) + { + if (Main.masterMode && CalamityWorld.revenge && type == NPCID.Retinazer) + { + int retinazerIndex = NPC.NewNPC(NPC.GetBossSpawnSource(targetPlayerIndex), x, y, type, 1); + if (retinazerIndex == 200) + { + return; + } + Main.npc[retinazerIndex].target = targetPlayerIndex; + Main.npc[retinazerIndex].timeLeft *= 20; + + if (Main.netMode == NetmodeID.Server && retinazerIndex < 200) + { + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazerIndex); + } + + AchievementsHelper.CheckMechaMayhem(); + + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.TripletsBossText", new Color(175, 75, 255)); + return; + } + else + { + orig(x, y, type, targetPlayerIndex); + } + } + + public static void PreventFoveanatorDefeatMessageIfNotKilledLast(On_NPC.orig_DoDeathEvents_BeforeLoot orig, NPC self, Player closestPlayer) + { + if (Main.masterMode && CalamityWorld.revenge && self.type == ModContent.NPCType() && (NPC.AnyNPCs(NPCID.Spazmatism) || NPC.AnyNPCs(NPCID.Retinazer))) + { + self.value = 0f; + self.boss = false; + return; + } + else + { + orig(self, closestPlayer); + } + } + + public static void TripletsDefeatTextOverride(On_NPC.orig_DoDeathEvents_CelebrateBossDeath orig, NPC self, string typeName) + { + bool correctNPCType = self.type == NPCID.Retinazer || self.type == NPCID.Spazmatism || self.type == ModContent.NPCType(); + if (Main.masterMode && CalamityWorld.revenge && correctNPCType) + { + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", CalamityUtils.GetTextValue("Status.Boss.TripletsDefeatName")), 175, 75, 255); + else if (Main.dedServ) + ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", NetworkText.FromKey("Mods.CalamityMod.Status.Boss.TripletsDefeatName")), new Color(175, 75, 255)); + return; + } + else + { + orig(self, typeName); + } + } + #endregion } } diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 284d9c44f0..64b2461c1e 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using CalamityMod.Events; using CalamityMod.Items.Fishing; using CalamityMod.Items.Materials; using CalamityMod.Items.TreasureBags.MiscGrabBags; @@ -11,6 +12,7 @@ using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.Drawing; using Terraria.ID; @@ -121,7 +123,7 @@ namespace CalamityMod.ILEditing #region Prevention of Slime Rain Spawns When Near Bosses private static void PreventBossSlimeRainSpawns(Terraria.On_NPC.orig_SlimeRainSpawns orig, int plr) { - if (!Main.player[plr].Calamity().isNearbyBoss && CalamityConfig.Instance.BossZen) + if (!Main.player[plr].Calamity().isNearbyBoss && CalamityServerConfig.Instance.BossZen) orig(plr); } #endregion Prevention of Slime Rain Spawns When Near Bosses @@ -1002,6 +1004,35 @@ namespace CalamityMod.ILEditing #endregion Make Magma Stone & Fire Gauntlet Dust Toggleable + #region Celestial Sigil Non-Linearity Change + private static bool RemoveCelestialSigilUseLock(On_Player.orig_ItemCheck_CheckCanUse orig, Player self, Item sItem) + { + if (sItem.type == ItemID.CelestialSigil) + return !NPC.AnyNPCs(NPCID.MoonLordCore) && !BossRushEvent.BossRushActive; + + return orig(self, sItem); + } + + private static void ApplyCelestialSigilChanges(On_Player.orig_ItemCheck_UseEventItems orig, Player self, Item sItem) + { + if (self.ItemTimeIsZero && self.itemAnimation > 0 && sItem.type == ItemID.CelestialSigil) + { + if (NPC.AnyNPCs(NPCID.MoonLordCore) || BossRushEvent.BossRushActive) + return; + + SoundEngine.PlaySound(SoundID.Roar, self.Center); + self.ApplyItemTime(sItem); + + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.SpawnOnPlayer(self.whoAmI, NPCID.MoonLordCore); + else + NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, -1, -1, null, self.whoAmI, NPCID.MoonLordCore); + } + else + orig(self, sItem); + } + #endregion + // 02JUN2024: Ozzatron: The below code is being kept in its initial state for historic value. #region Store The Stupid Fucking Private Wind Map In Public Property private static void StoreWindGrid(On_TileDrawing.orig_Update orig, TileDrawing self) diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 345bb65fac..2347363be0 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -68,7 +68,7 @@ namespace CalamityMod.ILEditing #region Removal of Hardmode Ore Generation from Evil Altars private static void PreventSmashAltarCode(Terraria.On_WorldGen.orig_SmashAltar orig, int i, int j) { - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) return; orig(i, j); diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index e1c1a5f31e..a823f93126 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -8,7 +8,6 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - // TODO -- this item includes a dodge accessory, Brain of Cthulhu public class AmalgamatedBrain : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; @@ -24,29 +23,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.aBrain = true; player.brainOfConfusionItem = Item; - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(60); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } - player.GetDamage() += 0.1f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs deleted file mode 100644 index 12e0ce87ad..0000000000 --- a/Items/Accessories/AmidiasPendant.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class AmidiasPendant : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public const int ShardProjectiles = 2; - public const float ShardAngleSpread = 120; - public int ShardCountdown = 0; - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 46; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (ShardCountdown <= 0) - { - ShardCountdown = 140; - } - if (ShardCountdown > 0) - { - ShardCountdown -= Main.rand.Next(1, 4); - if (ShardCountdown <= 0) - { - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_Accessory(Item); - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - int spawnOffset = ShardProjectiles * 15; - float spread = -ShardAngleSpread / 2f; - for (int i = 0; i < ShardProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - spawnOffset; - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(spread + (ShardAngleSpread * i / (float)ShardProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int type = 0; - int damage = 0; - switch (Main.rand.Next(3)) - { - case 0: - type = ModContent.ProjectileType(); - damage = 15; - break; - case 1: - type = ModContent.ProjectileType(); - damage = 15; - break; - case 2: - type = ModContent.ProjectileType(); - damage = 30; - break; - } - - int finalDamage = (int)player.GetBestClassDamage().ApplyTo(damage); - finalDamage = player.ApplyArmorAccDamageBonusesTo(finalDamage); - Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, finalDamage, 5f, Main.myPlayer); - } - } - } - } - } - } -} diff --git a/Items/Accessories/AmidiasPendant.png b/Items/Accessories/AmidiasPendant.png deleted file mode 100644 index ff71e1fc5f..0000000000 Binary files a/Items/Accessories/AmidiasPendant.png and /dev/null differ diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index e15f15b358..e47f734736 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().transformer; + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index bc60e6071f..384231f977 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -80,9 +80,10 @@ namespace CalamityMod.Items.Accessories // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; // Immune to God Slayer Inferno itself player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 1b6e0c3011..5478959941 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 38; - Item.height = 44; + Item.width = 50; + Item.height = 48; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 8; // we buff Ankh Shield to 8 diff --git a/Items/Accessories/AsgardsValor.png b/Items/Accessories/AsgardsValor.png index 6a56bed385..316e59b4bd 100644 Binary files a/Items/Accessories/AsgardsValor.png and b/Items/Accessories/AsgardsValor.png differ diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index e8e0be61e7..a510018c8f 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories // This is ONLY the direct DPS of having the cursor over the enemy, not the damage from the flames debuff. // The debuff is VulnerabilityHex, check that file for its DPS. public const int BaseDamage = 320; - public const int HitsPerSecond = 12; + public const int FramesPerHit = 5; public override void SetStaticDefaults() { diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index e42faa21c3..030506fa76 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public bool HasFlavorTooltip => true; + public Color? TooltipExtensionColor => new(195, 223, 255); public override void SetStaticDefaults() { diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index c9c6108f35..61c6dbf9cc 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories public class ElysianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; - + public bool HasFlavorTooltip => true; public Color? TooltipExtensionColor => new(195, 223, 255); public const int ShieldSlamDamage = 500; @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.ShadowFlame] = true; player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; } } diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index e1e9e339a4..c80f33d6a8 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -1,10 +1,14 @@ using CalamityMod.CalPlayer; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("AmidiasPendant")] public class GiantPearl : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -22,6 +26,32 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.giantPearl = true; Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.45f, 0.8f, 0.8f); + + // Draw the aura visual + float npcDistCompare = 1000f; + foreach (NPC n in Main.ActiveNPCs) + { + if (n.friendly || n.dontTakeDamage) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, player.Center); + if (currentNPCDist < npcDistCompare) + npcDistCompare = currentNPCDist; + } + float opacity = Utils.Remap(npcDistCompare, 120f, 640f, 1f, 0f); + + if (opacity > 0.7f) + { + for (int d = 0; d < 3; d++) + { + Vector2 bubbleSpawn = player.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 120f; + GenericBubbleParticle bubble = new(bubbleSpawn, Main.rand.NextVector2CircularEdge(0.75f, 0.75f), 0.3f, Main.rand.NextFloat(MathHelper.TwoPi), 8); + GeneralParticleHandler.SpawnParticle(bubble); + } + } + + CustomPulse auraVisual = new(player.Center, Vector2.Zero, new Color(75, 164, 191), "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, 0f, 0.12f, 0.1175f, 3, true, opacity); + GeneralParticleHandler.SpawnParticle(auraVisual); } } } diff --git a/Items/Accessories/GravistarSabaton.cs b/Items/Accessories/InterstellarStompers.cs similarity index 87% rename from Items/Accessories/GravistarSabaton.cs rename to Items/Accessories/InterstellarStompers.cs index 93913e2744..992c2d701c 100644 --- a/Items/Accessories/GravistarSabaton.cs +++ b/Items/Accessories/InterstellarStompers.cs @@ -5,7 +5,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class GravistarSabaton : ModItem, ILocalizedModType + [LegacyName("GravistarSabaton")] + public class InterstellarStompers : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -27,6 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.noFallDmg = true; + player.moveSpeed += 0.06f; player.jumpSpeedBoost += 1f; player.Calamity().gSabaton = true; } diff --git a/Items/Accessories/GravistarSabaton.png b/Items/Accessories/InterstellarStompers.png similarity index 100% rename from Items/Accessories/GravistarSabaton.png rename to Items/Accessories/InterstellarStompers.png diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index 722a59065d..6786c4d73a 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -15,7 +15,7 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Back)] - //Its not like its a renamed version of the bayonet, but i put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. + //It's not like it's a renamed version of the bayonet, but I put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. [LegacyName("MarniteBayonet")] public class MarniteRepulsionShield : ModItem, ILocalizedModType { @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Blue; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; - Item.defense = 2; + Item.defense = 4; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), baseDamage, 10f, Main.myPlayer); + var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), baseDamage, 12f, Main.myPlayer); hitbox.originalDamage = baseDamage; } } @@ -91,6 +91,7 @@ namespace CalamityMod.Items.Accessories Projectile.penetrate = -1; Projectile.timeLeft = 700; Projectile.tileCollide = false; + Projectile.ArmorPenetration = 20; Projectile.netImportant = true; } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index a9ead56f4f..6c6c9be664 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; player.GetDamage() += 0.1f; - int damage = (int)player.GetBestClassDamage().ApplyTo(250); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - float knockBack = 3f; + + // Spawn nebula stars if (Main.rand.NextBool(15)) { + // Count the number of current active nebula stars; if this is at least 10, no more can spawn int numProj = 0; foreach (Projectile p in Main.ActiveProjectiles) { @@ -46,56 +46,32 @@ namespace CalamityMod.Items.Accessories numProj++; } } - var source = player.GetSource_Accessory(Item); if (Main.rand.Next(15) >= numProj && numProj < 10) { int spawnRadius = 24; - int backupSpawnRadius = 90; - for (int j = 0; j < 50; j++) + for (int j = 0; j < 50; j++) // Attempt to spawn the star randomly around the player { - int randomProjOffset = Main.rand.Next(200 - j * 2, 400 + j * 2); + float randomProjOffset = Main.rand.NextFloat(200 - j * 2, 400 + j * 2); Vector2 center = player.Center; - center.X += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1); - center.Y += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1); + center.X += Main.rand.NextFloat(-randomProjOffset, randomProjOffset + 1); + center.Y += Main.rand.NextFloat(-randomProjOffset, randomProjOffset + 1); + // Ensure we are not trying to spawn the star on top of a solid tile or liquid if (!Collision.SolidCollision(center, spawnRadius, spawnRadius) && !Collision.WetCollision(center, spawnRadius, spawnRadius)) { center.X += (float)(spawnRadius / 2); center.Y += (float)(spawnRadius / 2); - if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) + // Ensure the star's spawn point has line-of-sight with the player + if (Collision.CanHit(player.Center, 1, 1, center, 1, 1) || Collision.CanHit(player.Center - new Vector2(0f, 50f), 1, 1, center, 1, 1)) { - int projTileX = (int)center.X / 16; - int projTileY = (int)center.Y / 16; - bool canSpawnProj = false; - if (Main.rand.NextBool(3) && Main.tile[projTileX, projTileY] != null && Main.tile[projTileX, projTileY].WallType > 0) + if (Main.rand.NextBool(3) && Main.myPlayer == player.whoAmI) { - canSpawnProj = true; - } - else - { - center.X -= (float)(backupSpawnRadius / 2); - center.Y -= (float)(backupSpawnRadius / 2); - if (Collision.SolidCollision(center, backupSpawnRadius, backupSpawnRadius)) - { - center.X += (float)(backupSpawnRadius / 2); - center.Y += (float)(backupSpawnRadius / 2); - canSpawnProj = true; - } - } - if (canSpawnProj) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) - { - canSpawnProj = false; - break; - } - } - if (canSpawnProj && Main.myPlayer == player.whoAmI) - { - Projectile.NewProjectile(source, center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - return; - } + var source = player.GetSource_Accessory(Item); + int damage = (int)player.GetBestClassDamage().ApplyTo(250); + damage = player.ApplyArmorAccDamageBonusesTo(damage); + float knockBack = 3f; + + Projectile.NewProjectile(source, center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + return; } } } diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 9181a9e2ea..ced3c36784 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 12f; + public const float RaiderBonus = 10f; public const int RaiderCooldown = 5; public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 783cdf7762..f83fe3c9fe 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -20,28 +20,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(18); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } CalamityPlayer modPlayer = player.Calamity(); modPlayer.rBrain = true; + player.GetDamage() += 0.06f; } public override void AddRecipes() diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 4f7c014cc6..52d7328429 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddRecipeGroup("AnySilverBar", 10). + AddIngredient(3). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 9097563d19..4f69f242e0 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Items.Accessories { public class SandCloak : ModItem, ILocalizedModType { - public static float KnockbackStrength = 0.3f; - public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -17,7 +15,6 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; - Item.defense = 2; } public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SandCloakHotkey); diff --git a/Items/Accessories/TeslasAmulet.cs b/Items/Accessories/TeslasAmulet.cs new file mode 100644 index 0000000000..ee228c52b2 --- /dev/null +++ b/Items/Accessories/TeslasAmulet.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class TeslasAmulet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 14)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().tesla = true; + player.Calamity().teslaVisuals = !hideVisual; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(8). + AddIngredient(8). + AddIngredient(4). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Potions/TeslaPotion.png b/Items/Accessories/TeslasAmulet.png similarity index 100% rename from Items/Potions/TeslaPotion.png rename to Items/Accessories/TeslasAmulet.png diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 066b87b52e..62ec2bec08 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -34,28 +34,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.amalgam = true; player.brainOfConfusionItem = Item; player.GetDamage() += 0.15f; - - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(300); - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } } public override void AddRecipes() diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index 8d9aac1e0c..71dd921abe 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Items.Accessories { public class TheBee : ModItem, ILocalizedModType { + public static int CooldownLength = 600; public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 6504109afd..a744261963 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().aSpark; + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/Vanity/Apelusa_Body.png b/Items/Accessories/Vanity/Apelusa_Body.png deleted file mode 100644 index 501db51809..0000000000 Binary files a/Items/Accessories/Vanity/Apelusa_Body.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Apelusa_Head.png b/Items/Accessories/Vanity/Apelusa_Head.png deleted file mode 100644 index df7384ea15..0000000000 Binary files a/Items/Accessories/Vanity/Apelusa_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Apelusa_Legs.png b/Items/Accessories/Vanity/Apelusa_Legs.png deleted file mode 100644 index 0e6cf7a844..0000000000 Binary files a/Items/Accessories/Vanity/Apelusa_Legs.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Birds_Head.png b/Items/Accessories/Vanity/Birds_Head.png deleted file mode 100644 index e475326c77..0000000000 Binary files a/Items/Accessories/Vanity/Birds_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Birds_Head_Extension.png b/Items/Accessories/Vanity/Birds_Head_Extension.png deleted file mode 100644 index 99dd209e3e..0000000000 Binary files a/Items/Accessories/Vanity/Birds_Head_Extension.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Birds_Legs.png b/Items/Accessories/Vanity/Birds_Legs.png deleted file mode 100644 index 87cee93548..0000000000 Binary files a/Items/Accessories/Vanity/Birds_Legs.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Birds_Torso.png b/Items/Accessories/Vanity/Birds_Torso.png deleted file mode 100644 index 9a4ac6d766..0000000000 Binary files a/Items/Accessories/Vanity/Birds_Torso.png and /dev/null differ diff --git a/Items/Accessories/Vanity/CocosFeather.cs b/Items/Accessories/Vanity/CocosFeather.cs deleted file mode 100644 index 4e55c0074d..0000000000 --- a/Items/Accessories/Vanity/CocosFeather.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - - -namespace CalamityMod.Items.Accessories.Vanity -{ - public class CocosFeather : ModItem, IExtendedHat, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (Main.netMode != NetmodeID.Server) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Birds_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Birds_Torso", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Birds_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - - if (Main.netMode == NetmodeID.Server) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } - - public override void SetDefaults() - { - Item.width = 42; - Item.height = 38; - Item.accessory = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.vanity = true; - Item.Calamity().devItem = true; - } - - public override void UpdateVanity(Player player) - { - player.Calamity().cocosFeather = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.Calamity().cocosFeather = true; - } - } - public string ExtensionTexture => "CalamityMod/Items/Accessories/Vanity/Birds_Head_Extension"; - public Vector2 ExtensionSpriteOffset(PlayerDrawSet drawInfo) => new Vector2(0, -4f); - } -} diff --git a/Items/Accessories/Vanity/CocosFeather.png b/Items/Accessories/Vanity/CocosFeather.png deleted file mode 100644 index 3b69e78dca..0000000000 Binary files a/Items/Accessories/Vanity/CocosFeather.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Dandy_Body.png b/Items/Accessories/Vanity/Dandy_Body.png new file mode 100644 index 0000000000..d6778db86e Binary files /dev/null and b/Items/Accessories/Vanity/Dandy_Body.png differ diff --git a/Items/Accessories/Vanity/Dandy_Head.png b/Items/Accessories/Vanity/Dandy_Head.png new file mode 100644 index 0000000000..b107474d18 Binary files /dev/null and b/Items/Accessories/Vanity/Dandy_Head.png differ diff --git a/Items/Accessories/Vanity/Dandy_Legs.png b/Items/Accessories/Vanity/Dandy_Legs.png new file mode 100644 index 0000000000..364147d83b Binary files /dev/null and b/Items/Accessories/Vanity/Dandy_Legs.png differ diff --git a/Items/Accessories/Vanity/RedBow.cs b/Items/Accessories/Vanity/GhostBracelet.cs similarity index 79% rename from Items/Accessories/Vanity/RedBow.cs rename to Items/Accessories/Vanity/GhostBracelet.cs index a336b99bdf..b5087243a8 100644 --- a/Items/Accessories/Vanity/RedBow.cs +++ b/Items/Accessories/Vanity/GhostBracelet.cs @@ -4,23 +4,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class RedBow : ModItem, ILocalizedModType + [LegacyName("RedBow")] + public class GhostBracelet : ModItem, ILocalizedModType { - public new string LocalizationCategory => "Items.Accessories"; public override void Load() { if (Main.netMode != NetmodeID.Server) { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Apelusa_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Apelusa_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Apelusa_Legs", EquipType.Legs, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Legs", EquipType.Legs, this); } } public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) return; @@ -37,8 +36,8 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetDefaults() { - Item.width = 22; - Item.height = 30; + Item.width = 42; + Item.height = 38; Item.accessory = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; @@ -48,21 +47,21 @@ namespace CalamityMod.Items.Accessories.Vanity public override void UpdateVanity(Player player) { - player.Calamity().redBow = true; + player.Calamity().ghostBracelet = true; } public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) { - player.Calamity().redBow = true; + player.Calamity().ghostBracelet = true; } } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Silk, 20). AddTile(TileID.Loom). Register(); } diff --git a/Items/Accessories/Vanity/GhostBracelet.png b/Items/Accessories/Vanity/GhostBracelet.png new file mode 100644 index 0000000000..9ae96bca31 Binary files /dev/null and b/Items/Accessories/Vanity/GhostBracelet.png differ diff --git a/Items/Accessories/Vanity/RedBow.png b/Items/Accessories/Vanity/RedBow.png deleted file mode 100644 index 21ad13f679..0000000000 Binary files a/Items/Accessories/Vanity/RedBow.png and /dev/null differ diff --git a/Items/Accessories/Wings/ExodusWings.cs b/Items/Accessories/Wings/ExodusWings.cs index 549f1ae5e8..bb3548b316 100644 --- a/Items/Accessories/Wings/ExodusWings.cs +++ b/Items/Accessories/Wings/ExodusWings.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Armor.Empyrean; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -36,21 +37,34 @@ namespace CalamityMod.Items.Accessories.Wings player.GetCritChance() += 5; } - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { - float xOffset = 4f; - if (player.direction == 1) + Vector2 spawnPos = player.Center + new Vector2(-25 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + Vector2 spawnPos2 = player.Center + new Vector2(15 * player.direction, 0) + Main.rand.NextVector2Circular(20, 20); + + float partScale = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 partVel = new Vector2(0, 5).RotatedBy(0.5f * player.direction).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 0.8f); + + Particle smoke = new HeavySmokeParticle(spawnPos, partVel, Color.Black, 13, partScale * 0.9f, 0.7f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) { - xOffset = -40f; + Particle spark3 = new GlowOrbParticle(spawnPos, partVel, false, 19, partScale, Color.LightGreen, true, false, false); + GeneralParticleHandler.SpawnParticle(spark3); } - int index = Dust.NewDust(new Vector2(player.Center.X + xOffset, player.Center.Y - 15f), 30, 30, DustID.PurpleTorch, 0f, 0f, 100, default, 2.4f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity *= 0.3f; - if (Main.rand.NextBool(10)) + if (Main.rand.NextBool()) { - Main.dust[index].fadeIn = 2f; + Particle smoke2 = new HeavySmokeParticle(spawnPos2, partVel, Color.Black, 13, partScale * 0.6f, 0.7f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke2); + + if (Main.rand.NextBool((player.controlJump ? 2 : 4))) + { + Particle spark3 = new GlowOrbParticle(spawnPos2, partVel, false, 19, partScale * 0.7f, Color.LightGreen, true, false, false); + GeneralParticleHandler.SpawnParticle(spark3); + } } - Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } player.wingTimeMax = 180; player.noFallDmg = true; diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index ed6ec52e82..a922ea1698 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Items.Armor.Aerospec public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; } diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index 7fbb0f8dd4..b04b7bb6e6 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -53,21 +53,6 @@ namespace CalamityMod.Items.Armor.Auric player.crimsonRegen = true; player.GetDamage() += 0.75f; player.maxMinions += 6; - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_ItemUse(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - var damage = (int)player.GetTotalDamage().ApplyTo(750); - var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = 750; - } - } } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 4454c1f4c7..594b9b5626 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -58,11 +58,12 @@ namespace CalamityMod.Items.Armor.Fearmonger BuffID.Frostburn, BuffID.CursedInferno, BuffID.ShadowFlame, //doesn't do anything - BuffID.Daybreak, //doesn't do anything + ModContent.BuffType(), BuffID.Burning, ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType(), + ModContent.BuffType(), ModContent.BuffType(), BuffID.Chilled, BuffID.Frozen, diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index b2969b7498..682e64538b 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -13,6 +13,12 @@ namespace CalamityMod.Items.Armor public const int tornadoBaseDmg = 80; public const float tornadoBaseKB = 1f; + public override void SetStaticDefaults() + { + if (Main.netMode != NetmodeID.Server) + ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; + } + public override void SetDefaults() { Item.width = 18; diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index 006989a52d..1a7dd7e305 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -61,13 +61,13 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 14; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + return body.type == ItemType() && legs.type == ItemType(); } public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index 711995fa8f..34eb51bc23 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 0; + Item.defense = 1; } private void ActivateLift(Terraria.On_Player.orig_QuickMount orig, Player self) @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect orig(self); } - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType(); + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType(); public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType(); public bool IsPartOfSet(Item item) => item.type == ItemType() || item.type == ItemType(); @@ -155,12 +155,13 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; + Item.defense = 2; } public override void UpdateEquip(Player player) { player.tileSpeed += 0.5f; + player.wallSpeed += 0.5f; } public override void ModifyTooltips(List tooltips) => MarniteArchitectHeadgear.ModifySetTooltips(this, tooltips); @@ -204,7 +205,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override void PostUpdateMiscEffects() { - if (!setEquipped && Player.mount.Type == ModContent.MountType() && Player.mount.Active) + if (!setEquipped && Player.mount.Type == MountType() && Player.mount.Active) Player.mount.Dismount(Player); if (mounted) @@ -367,7 +368,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect //Sprites if (Main.netMode != NetmodeID.Server) { - MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); + MountData.frontTextureGlow = Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); } } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index bb67093e5b..4fb96d018e 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -41,8 +41,9 @@ namespace CalamityMod.Items.Armor.Reaver modPlayer.reaverExplore = true; modPlayer.wearingRogueArmor = true; player.findTreasure = true; - player.blockRange += 4; player.aggro -= 200; + if (player.IsUnderwater()) + player.gills = true; if (player.whoAmI == Main.myPlayer) { @@ -55,6 +56,10 @@ namespace CalamityMod.Items.Armor.Reaver { Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } + + // These are static variables. Awesome + Player.tileRangeX += 7; + Player.tileRangeY += 7; } } @@ -63,8 +68,8 @@ namespace CalamityMod.Items.Armor.Reaver player.ignoreWater = true; player.lavaImmune = true; player.pickSpeed -= 0.2f; - player.tileSpeed += 0.4f; - player.wallSpeed += 0.4f; + player.tileSpeed += 0.5f; + player.wallSpeed += 0.5f; } public override void AddRecipes() diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index f5c274ca52..5901af6fac 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Armor.Silva public class SilvaHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + internal static string SilvaCrystalEntitySourceContext => "SetBonus_Calamity_SilvaSummon"; public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/SilvaActivation"); public static readonly SoundStyle DispelSound = new("CalamityMod/Sounds/Custom/AbilitySounds/SilvaDispel"); @@ -47,24 +48,6 @@ namespace CalamityMod.Items.Armor.Silva modPlayer.silvaSummon = true; modPlayer.WearingPostMLSummonerSet = true; player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_ItemUse(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - // 08DEC2023: Ozzatron: Silva Crystals spawned with Old Fashioned active will retain their bonus damage indefinitely. Oops. Don't care. - int baseDamage = player.ApplyArmorAccDamageBonusesTo(600); - var damage = (int)player.GetTotalDamage().ApplyTo(baseDamage); - - var p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = 600; - } - } player.GetDamage() += 0.65f; player.maxMinions += 5; } diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 6d5858ea5e..0ed6f4412c 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -82,9 +82,9 @@ namespace CalamityMod.Items.Armor.Wulfrum } } - else if (player.HasItem(ModContent.ItemType())) + else if (player.HasItem(ItemType())) { - player.ConsumeItem(ModContent.ItemType()); + player.ConsumeItem(ItemType()); //I Thiiiinnnk there's no need to add mp syncing packets since cooldowns get auto synced right. player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime); //Though do i need to sync that or is the player inventory auto synced? @@ -234,7 +234,7 @@ namespace CalamityMod.Items.Armor.Wulfrum setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); tooltips.Insert(setBonusIndex + 1, setBonus1); - int AmmoItem = ModContent.ItemType(); + int AmmoItem = ItemType(); string AmmoDisplay = $"[i:{AmmoItem}] {CalamityUtils.GetItemName(AmmoItem)}"; TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", CalamityUtils.GetTextFromModItem("AbilityDescription").Format(AmmoDisplay)); setBonus2.OverrideColor = new Color(110, 192, 93); diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index c4fe0204bc..d9bd11290a 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -95,8 +95,8 @@ namespace CalamityMod.Items public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddRecipeGroup("IronBar", 10). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index fe63902cbe..9acc1ea443 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -20,6 +20,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; @@ -203,6 +204,10 @@ namespace CalamityMod.Items break; } + // Increase how much health Mushrooms heal. + if (item.type == ItemID.Mushroom && item.healLife == 15) + item.healLife = 25; + // Allow Beam Sword to change direction when it fires, because vanilla disables it for some reason. if (item.type == ItemID.BeamSword) item.ChangePlayerDirectionOnShoot = true; @@ -640,13 +645,6 @@ namespace CalamityMod.Items if (item.type == ItemID.Mushroom && player.Calamity().fungalSymbiote) player.AddBuff(ModContent.BuffType(), 3600); - // Moon Lord instantly spawns when Celestial Sigil is used. - if (item.type == ItemID.CelestialSigil) - { - NPC.MoonLordCountdown = 1; - NetMessage.SendData(MessageID.MoonlordHorror, -1, -1, null, NPC.MoonLordCountdown); - } - // Staff/Axe of Regrowth growing Calamity grass if (item.type == ItemID.StaffofRegrowth || item.type == ItemID.AcornAxe) { @@ -1205,10 +1203,10 @@ namespace CalamityMod.Items if (item.type == ItemID.MoonStone) modPlayer.reducedNightwitherDamage = true; if (item.type == ItemID.SunStone) - modPlayer.reducedHolyFlamesDamage = true; + modPlayer.reducedDaybrokenDamage = true; if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell) { - modPlayer.reducedHolyFlamesDamage = true; + modPlayer.reducedDaybrokenDamage = true; modPlayer.reducedNightwitherDamage = true; } @@ -1417,10 +1415,9 @@ namespace CalamityMod.Items player.noFallDmg = true; if (player.head == ArmorIDs.Head.FrostHelmet && player.body == ArmorIDs.Body.FrostBreastplate && player.legs == ArmorIDs.Legs.FrostLeggings) { - player.GetDamage() += 0.02f; - player.GetDamage() += 0.02f; - player.GetCritChance() += 1; - player.GetCritChance() += 1; + player.GetDamage() += 0.04f; + player.GetDamage() += 0.04f; + player.Calamity().frozenWingsCold = true; } } else if (item.type == ItemID.FlameWings) // Bonus to melee stats @@ -1629,9 +1626,10 @@ namespace CalamityMod.Items if (grabRangeMultiplier > 1f) grabRange = (int)(grabRangeMultiplier * grabRange); - // Then, if wearing the appropriate Reaver armor, add 20 flat item grab range. + // Then, if wearing the appropriate Reaver armor, add 246 flat item grab range. (2.625 + 15.375 = 18 tiles) + // For reference, Treasure Magnet adds 150 (2.625 + 9.375 = 12 tiles) if (player.Calamity().reaverExplore) - grabRange += 20; + grabRange += 246; } #endregion @@ -1766,10 +1764,19 @@ namespace CalamityMod.Items #endregion #region On Create + private static int cachedForgeID = -1; public override void OnCreated(Item item, ItemCreationContext context) { // ChoosePrefix also happens on craft so go reset it here too storedPrefix = -1; + + // 05JUL2024: Ozzatron: Register the usage of Draedon's Forge for the purposes of his dialogue. + // This was moved out of an On edit in the DraedonsForge item for Magic Storage compatibility. + Player p = Main.LocalPlayer; + if (cachedForgeID < 0) + cachedForgeID = ModContent.TileType(); + if (context is RecipeItemCreationContext && p.adjTile[cachedForgeID]) + p.Calamity().HasCraftedDraedonsForge = true; } #endregion @@ -1795,7 +1802,7 @@ namespace CalamityMod.Items return keepPrefix ? prefix : 0; } - if (!CalamityConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1) + if (!CalamityServerConfig.Instance.RemoveReforgeRNG || Main.gameMenu || storedPrefix == -1) return -1; // Pick a prefix using the new system. @@ -1814,11 +1821,21 @@ namespace CalamityMod.Items ItemLoader.ReforgePrice(item, ref value, ref p.discountAvailable); // Steal 20% of that money. - CalamityWorld.MoneyStolenByBandit += value / 5; + int stolen = value / 5; + CalamityWorld.MoneyStolenByBandit += stolen; // Increment the reforge counter to allow the Bandit to refund // Also triggers Tinkerer dialogue that hints to the player that money is being stolen CalamityWorld.Reforges++; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.SomeoneGotScammedByTinkerer); + packet.Write((byte)p.whoAmI); + packet.Write7BitEncodedInt(stolen); + packet.Send(); + } } } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 467d81963e..72dc5d99c3 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -319,7 +319,7 @@ namespace CalamityMod.Items nameLine.OverrideColor = new Color(220, 20, 60); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(207, 17, 117); - if (item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(227, 226, 180); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); @@ -488,7 +488,7 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text += ", including Mighty Wind"); // If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) EditTooltipByNum(0, (line) => line.Text += "\nDemon Altars now drop Souls of Night instead of generating ores when destroyed" + "\nHardmode ores now generate after defeating Mechanical Bosses for the first time"); @@ -826,7 +826,7 @@ namespace CalamityMod.Items //Flame Waker Boots buff. if (item.type == ItemID.FlameWakerBoots) { - EditTooltipByNum(0, (line) => line.Text = "Multiplies all fire-based debuff damage by 1.25\n" + + EditTooltipByNum(0, (line) => line.Text = "Multiplies all fire-based debuff damage by 1.25x\n" + "All attacks light enemies on fire\n" + "'Never get cold feet again'"); } @@ -835,7 +835,7 @@ namespace CalamityMod.Items if (item.type == ItemID.HellfireTreads) { EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); - EditTooltipByNum(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5, does not stack with downgrades\n" + + EditTooltipByNum(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5x, does not stack with downgrades\n" + "All attacks inflict Hellfire"); } @@ -845,7 +845,7 @@ namespace CalamityMod.Items "Nearby fairies grant +2 HP/s life regen, 10 defense and 10% movement speed\n" + "Fairies are immune to damage and will no longer flee"); - // Reduced Nightwither and Holy Flames damage, and melee speed removal. + // Reduced Nightwither and Daybroken damage, and melee speed removal. if (item.type == ItemID.MoonStone) { EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Nightwither debuff"); @@ -853,17 +853,17 @@ namespace CalamityMod.Items } if (item.type == ItemID.SunStone) { - EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Holy Flames debuff"); + EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Daybroken debuff"); EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("melee speed, ", "")); } if (item.type == ItemID.CelestialStone) { - EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Nightwither and Holy Flames debuffs"); + EditTooltipByNum(2, (line) => line.Text += "\nReduces the damage of the Nightwither and Daybroken debuffs"); EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" melee speed,", "")); } if (item.type == ItemID.CelestialShell) { - EditTooltipByNum(4, (line) => line.Text += "\nReduces the damage of the Nightwither and Holy Flames debuffs"); + EditTooltipByNum(4, (line) => line.Text += "\nReduces the damage of the Nightwither and Daybroken debuffs"); EditTooltipByNum(2, (line) => line.Text = line.Text.Replace(" melee speed,", "")); } @@ -1301,9 +1301,8 @@ namespace CalamityMod.Items AddWingStats(7.5f, 1f, 1, 160, "5% increased melee damage and critical strike chance"); if (item.type == ItemID.FrozenWings) - AddWingStats(6.75f, 1f, 1, 130, "2% increased melee and ranged damage\n" + - "and 1% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor"); + AddWingStats(6.75f, 1f, 1, 130, "4% increased melee and ranged damage\n" + + "and multiplies all cold debuff damage by 1.25x while wearing Frost armor"); if (item.type == ItemID.GhostWings) AddWingStats(7.5f, 1f, 1, 170, "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 4944179e5d..65eec140e7 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Items { ItemID.FalconBlade, Do(UseTurn, UseExact(15)) }, // For now, I think I will balance Celebration like a serious weapon. -CIT { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration - { ItemID.Flairon, Do(DamageExact(73)) }, + { ItemID.Flairon, Do(DamageExact(65)) }, { ItemID.Flamarang, Do(DamageExact(40)) }, { ItemID.Flamelash, Do(DamageExact(40)) }, { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, @@ -248,7 +248,7 @@ namespace CalamityMod.Items { ItemID.TerraBlade, Do(DamageExact(122)) }, // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, // Terrarian is extremely overpowered and requires a heavy nerf. - { ItemID.Terrarian, Do(AutoReuse, DamageExact(86)) }, + { ItemID.Terrarian, Do(AutoReuse, DamageExact(90)) }, { ItemID.TheEyeOfCthulhu, Do(AutoReuse, DamageExact(90)) }, { ItemID.TheRottedFork, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.TheUndertaker, Do(PointBlank, AutoReuse, DamageExact(15)) }, diff --git a/Items/Critters/AlphaSeaMinnowGoldItem.cs b/Items/Critters/AlphaSeaMinnowGoldItem.cs new file mode 100644 index 0000000000..5ac00ab9cb --- /dev/null +++ b/Items/Critters/AlphaSeaMinnowGoldItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class AlphaSeaMinnowGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 25, 0, 0); + Item.bait = 30; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/AlphaSeaMinnowGoldItem.png b/Items/Critters/AlphaSeaMinnowGoldItem.png new file mode 100644 index 0000000000..4fde55be43 Binary files /dev/null and b/Items/Critters/AlphaSeaMinnowGoldItem.png differ diff --git a/Items/Critters/AlphaSeaMinnowItem.cs b/Items/Critters/AlphaSeaMinnowItem.cs new file mode 100644 index 0000000000..fe1600f351 --- /dev/null +++ b/Items/Critters/AlphaSeaMinnowItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class AlphaSeaMinnowItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.bait = 30; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/AlphaSeaMinnowItem.png b/Items/Critters/AlphaSeaMinnowItem.png new file mode 100644 index 0000000000..6971e57df1 Binary files /dev/null and b/Items/Critters/AlphaSeaMinnowItem.png differ diff --git a/Items/Critters/BabyGhostBellGoldItem.cs b/Items/Critters/BabyGhostBellGoldItem.cs new file mode 100644 index 0000000000..e9ad87ad80 --- /dev/null +++ b/Items/Critters/BabyGhostBellGoldItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellGoldItem.png b/Items/Critters/BabyGhostBellGoldItem.png new file mode 100644 index 0000000000..a62694c074 Binary files /dev/null and b/Items/Critters/BabyGhostBellGoldItem.png differ diff --git a/Items/Critters/BabyGhostBellGreenItem.cs b/Items/Critters/BabyGhostBellGreenItem.cs new file mode 100644 index 0000000000..a35bcff419 --- /dev/null +++ b/Items/Critters/BabyGhostBellGreenItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellGreenItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellGreenItem.png b/Items/Critters/BabyGhostBellGreenItem.png new file mode 100644 index 0000000000..b4309e1033 Binary files /dev/null and b/Items/Critters/BabyGhostBellGreenItem.png differ diff --git a/Items/Critters/BabyGhostBellItem.cs b/Items/Critters/BabyGhostBellItem.cs index 0c24b987a1..6377f5f2d1 100644 --- a/Items/Critters/BabyGhostBellItem.cs +++ b/Items/Critters/BabyGhostBellItem.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Critters public new string LocalizationCategory => "Items.Misc"; public override void SetStaticDefaults() { + On_Player.ItemCheck_ReleaseCritter += ReleaseColoredGhostBell; Item.ResearchUnlockCount = 5; } @@ -30,5 +31,62 @@ namespace CalamityMod.Items.Critters Item.makeNPC = (short)ModContent.NPCType(); Item.rare = ItemRarityID.Green; } + + // Since all Baby Ghost Bell variants are a single NPC type, this needs to be done in order for each item to spawn the correct color + public static void ReleaseColoredGhostBell(On_Player.orig_ItemCheck_ReleaseCritter orig, Player player, Item item) + { + if (item.makeNPC == ModContent.NPCType()) + { + int mouseX = Main.mouseX + (int)Main.screenPosition.X; + int mouseY = Main.mouseY + (int)Main.screenPosition.Y; + int tileX = mouseX / 16; + int tileY = mouseY / 16; + if (!WorldGen.SolidTile(tileX, tileY)) + { + int colorType = (int)BabyGhostBell.JellyColor.Blue; + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Green; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Red; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Radiant; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)BabyGhostBell.JellyColor.Gold; + } + player.ApplyItemTime(item); + + if (Main.netMode == NetmodeID.SinglePlayer) + { + int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); + Main.npc[n].ai[1] = colorType; + Main.npc[n].catchItem = item.type; + Main.npc[n].releaseOwner = (short)player.whoAmI; + } + else + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.PlaceAltCritter); + netMessage.Write(player.whoAmI); + netMessage.Write(mouseX); + netMessage.Write(mouseY); + netMessage.Write(item.makeNPC); + netMessage.Write(item.type); + netMessage.Write(colorType); + netMessage.Send(); + } + } + } + else + { + orig(player, item); + } + } } } diff --git a/Items/Critters/BabyGhostBellItem.png b/Items/Critters/BabyGhostBellItem.png index 7e7e84c4f1..df7b9dc7ef 100644 Binary files a/Items/Critters/BabyGhostBellItem.png and b/Items/Critters/BabyGhostBellItem.png differ diff --git a/Items/Critters/BabyGhostBellRadiantItem.cs b/Items/Critters/BabyGhostBellRadiantItem.cs new file mode 100644 index 0000000000..b6ea0c75a2 --- /dev/null +++ b/Items/Critters/BabyGhostBellRadiantItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellRadiantItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 10, 0, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellRadiantItem.png b/Items/Critters/BabyGhostBellRadiantItem.png new file mode 100644 index 0000000000..1f6c79cebc Binary files /dev/null and b/Items/Critters/BabyGhostBellRadiantItem.png differ diff --git a/Items/Critters/BabyGhostBellRedItem.cs b/Items/Critters/BabyGhostBellRedItem.cs new file mode 100644 index 0000000000..d6ee57252d --- /dev/null +++ b/Items/Critters/BabyGhostBellRedItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class BabyGhostBellRedItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/BabyGhostBellRedItem.png b/Items/Critters/BabyGhostBellRedItem.png new file mode 100644 index 0000000000..9b414d1ab7 Binary files /dev/null and b/Items/Critters/BabyGhostBellRedItem.png differ diff --git a/Items/Critters/PearlpodBlackItem.cs b/Items/Critters/PearlpodBlackItem.cs new file mode 100644 index 0000000000..f0c2986e97 --- /dev/null +++ b/Items/Critters/PearlpodBlackItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodBlackItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodBlackItem.png b/Items/Critters/PearlpodBlackItem.png new file mode 100644 index 0000000000..e12ceb5a8a Binary files /dev/null and b/Items/Critters/PearlpodBlackItem.png differ diff --git a/Items/Critters/PearlpodGoldItem.cs b/Items/Critters/PearlpodGoldItem.cs new file mode 100644 index 0000000000..5ca6e8ab05 --- /dev/null +++ b/Items/Critters/PearlpodGoldItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 5, 0, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodGoldItem.png b/Items/Critters/PearlpodGoldItem.png new file mode 100644 index 0000000000..b4813c7bd3 Binary files /dev/null and b/Items/Critters/PearlpodGoldItem.png differ diff --git a/Items/Critters/PearlpodItem.cs b/Items/Critters/PearlpodItem.cs new file mode 100644 index 0000000000..be986ea769 --- /dev/null +++ b/Items/Critters/PearlpodItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodItem.png b/Items/Critters/PearlpodItem.png new file mode 100644 index 0000000000..abddeb22ff Binary files /dev/null and b/Items/Critters/PearlpodItem.png differ diff --git a/Items/Critters/PearlpodPinkItem.cs b/Items/Critters/PearlpodPinkItem.cs new file mode 100644 index 0000000000..bd784c01f0 --- /dev/null +++ b/Items/Critters/PearlpodPinkItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Critters +{ + public class PearlpodPinkItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PearlpodPinkItem.png b/Items/Critters/PearlpodPinkItem.png new file mode 100644 index 0000000000..20bf35cddd Binary files /dev/null and b/Items/Critters/PearlpodPinkItem.png differ diff --git a/Items/Critters/PolypPanaseaGoldItem.cs b/Items/Critters/PolypPanaseaGoldItem.cs new file mode 100644 index 0000000000..bab47ffd84 --- /dev/null +++ b/Items/Critters/PolypPanaseaGoldItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaGoldItem.png b/Items/Critters/PolypPanaseaGoldItem.png new file mode 100644 index 0000000000..b419186c46 Binary files /dev/null and b/Items/Critters/PolypPanaseaGoldItem.png differ diff --git a/Items/Critters/PolypPanaseaGreenItem.cs b/Items/Critters/PolypPanaseaGreenItem.cs new file mode 100644 index 0000000000..8b9305af4d --- /dev/null +++ b/Items/Critters/PolypPanaseaGreenItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaGreenItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaGreenItem.png b/Items/Critters/PolypPanaseaGreenItem.png new file mode 100644 index 0000000000..5348095c25 Binary files /dev/null and b/Items/Critters/PolypPanaseaGreenItem.png differ diff --git a/Items/Critters/PolypPanaseaItem.cs b/Items/Critters/PolypPanaseaItem.cs new file mode 100644 index 0000000000..2edefe3eb0 --- /dev/null +++ b/Items/Critters/PolypPanaseaItem.cs @@ -0,0 +1,95 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + On_Player.ItemCheck_ReleaseCritter += ReleaseColoredPanasea; + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + + // Since all Polyp Panasea variants are a single NPC type, this needs to be done in order for each item to spawn the correct color + public static void ReleaseColoredPanasea(On_Player.orig_ItemCheck_ReleaseCritter orig, Player player, Item item) + { + if (item.makeNPC == ModContent.NPCType()) + { + int mouseX = Main.mouseX + (int)Main.screenPosition.X; + int mouseY = Main.mouseY + (int)Main.screenPosition.Y; + int tileX = mouseX / 16; + int tileY = mouseY / 16; + if (!WorldGen.SolidTile(tileX, tileY)) + { + int colorType = (int)PolypPanasea.FishColor.Red; + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Green; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Turquoise; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Purple; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Radiant; + } + if (item.type == ModContent.ItemType()) + { + colorType = (int)PolypPanasea.FishColor.Gold; + } + player.ApplyItemTime(item); + + if (Main.netMode == NetmodeID.SinglePlayer) + { + int n = NPC.NewNPC(player.GetSource_ReleaseEntity(), mouseX, mouseY, item.makeNPC); + Main.npc[n].ai[1] = colorType; + Main.npc[n].catchItem = item.type; + Main.npc[n].releaseOwner = (short)player.whoAmI; + } + else + { + var netMessage = item.ModItem.Mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.PlaceAltCritter); + netMessage.Write(player.whoAmI); + netMessage.Write(mouseX); + netMessage.Write(mouseY); + netMessage.Write(item.makeNPC); + netMessage.Write(item.type); + netMessage.Write(colorType); + netMessage.Send(); + } + } + } + else + { + orig(player, item); + } + } + } +} diff --git a/Items/Critters/PolypPanaseaItem.png b/Items/Critters/PolypPanaseaItem.png new file mode 100644 index 0000000000..4b961ac2e2 Binary files /dev/null and b/Items/Critters/PolypPanaseaItem.png differ diff --git a/Items/Critters/PolypPanaseaPurpleItem.cs b/Items/Critters/PolypPanaseaPurpleItem.cs new file mode 100644 index 0000000000..33233155cb --- /dev/null +++ b/Items/Critters/PolypPanaseaPurpleItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaPurpleItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaPurpleItem.png b/Items/Critters/PolypPanaseaPurpleItem.png new file mode 100644 index 0000000000..9125ccacd5 Binary files /dev/null and b/Items/Critters/PolypPanaseaPurpleItem.png differ diff --git a/Items/Critters/PolypPanaseaRadiantItem.cs b/Items/Critters/PolypPanaseaRadiantItem.cs new file mode 100644 index 0000000000..8ac583b80f --- /dev/null +++ b/Items/Critters/PolypPanaseaRadiantItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaRadiantItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaRadiantItem.png b/Items/Critters/PolypPanaseaRadiantItem.png new file mode 100644 index 0000000000..112eed64a6 Binary files /dev/null and b/Items/Critters/PolypPanaseaRadiantItem.png differ diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.cs b/Items/Critters/PolypPanaseaTurquoiseItem.cs new file mode 100644 index 0000000000..cbcad52d70 --- /dev/null +++ b/Items/Critters/PolypPanaseaTurquoiseItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class PolypPanaseaTurquoiseItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 0, 30, 0); + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/PolypPanaseaTurquoiseItem.png b/Items/Critters/PolypPanaseaTurquoiseItem.png new file mode 100644 index 0000000000..7aba44f54a Binary files /dev/null and b/Items/Critters/PolypPanaseaTurquoiseItem.png differ diff --git a/Items/Critters/SeaMinnowGoldItem.cs b/Items/Critters/SeaMinnowGoldItem.cs new file mode 100644 index 0000000000..f8a629c18a --- /dev/null +++ b/Items/Critters/SeaMinnowGoldItem.cs @@ -0,0 +1,34 @@ +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Critters +{ + public class SeaMinnowGoldItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + } + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 24; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.useTurn = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.maxStack = 9999; + Item.consumable = true; + Item.noUseGraphic = true; + Item.value = Item.buyPrice(0, 1, 0, 0); + Item.bait = 20; + Item.makeNPC = (short)ModContent.NPCType(); + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Critters/SeaMinnowGoldItem.png b/Items/Critters/SeaMinnowGoldItem.png new file mode 100644 index 0000000000..95f0da795b Binary files /dev/null and b/Items/Critters/SeaMinnowGoldItem.png differ diff --git a/Items/Critters/SeaMinnowItem.png b/Items/Critters/SeaMinnowItem.png index b016fc2245..29da187797 100644 Binary files a/Items/Critters/SeaMinnowItem.png and b/Items/Critters/SeaMinnowItem.png differ diff --git a/Items/DraedonMisc/AdvancedDisplay.cs b/Items/DraedonMisc/AdvancedDisplay.cs index b0b9e79122..fddad17b75 100644 --- a/Items/DraedonMisc/AdvancedDisplay.cs +++ b/Items/DraedonMisc/AdvancedDisplay.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.DraedonMisc Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ItemRarityID.Yellow; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index 65bd24df8e..b752b5aa9e 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.DraedonMisc Item.maxStack = 9999; Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.rare = ModContent.RarityType(); } diff --git a/Items/DraedonMisc/DecryptionComputer.cs b/Items/DraedonMisc/DecryptionComputer.cs index 4fe0a20244..0359880964 100644 --- a/Items/DraedonMisc/DecryptionComputer.cs +++ b/Items/DraedonMisc/DecryptionComputer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.DraedonMisc Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ItemRarityID.Orange; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; diff --git a/Items/DraedonMisc/LongRangedSensorArray.cs b/Items/DraedonMisc/LongRangedSensorArray.cs index 3f0475db85..7fcb37eb7c 100644 --- a/Items/DraedonMisc/LongRangedSensorArray.cs +++ b/Items/DraedonMisc/LongRangedSensorArray.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.DraedonMisc Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ItemRarityID.Pink; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; diff --git a/Items/DraedonMisc/VoltageRegulationSystem.cs b/Items/DraedonMisc/VoltageRegulationSystem.cs index 54508adb22..3f597ca9ae 100644 --- a/Items/DraedonMisc/VoltageRegulationSystem.cs +++ b/Items/DraedonMisc/VoltageRegulationSystem.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.DraedonMisc Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.rare = ModContent.RarityType(); - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; } public override bool? UseItem(Player player) => true; diff --git a/Items/DummyTooltipItem/DummyTooltipItem.cs b/Items/DummyTooltipItem/DummyTooltipItem.cs new file mode 100644 index 0000000000..52811da4d3 --- /dev/null +++ b/Items/DummyTooltipItem/DummyTooltipItem.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + /* EXPLANATION: + These items are made to facilitate tooltip reading and serve no other functions + As such these items do not have ANY features beyond their texture + */ + public abstract class DummyTooltipItem : ModItem, ILocalizedModType + { + public override LocalizedText DisplayName => LocalizedText.Empty; + public override LocalizedText Tooltip => LocalizedText.Empty; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 0; + ItemID.Sets.ItemsThatShouldNotBeInInventory[Type] = true; + } + } +} diff --git a/Items/DummyTooltipItem/GemTechArmorGems.cs b/Items/DummyTooltipItem/GemTechArmorGems.cs new file mode 100644 index 0000000000..bfde665ff8 --- /dev/null +++ b/Items/DummyTooltipItem/GemTechArmorGems.cs @@ -0,0 +1,32 @@ +namespace CalamityMod.Items +{ + public class GemTechBlueGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechBlueGem"; + } + + public class GemTechGreenGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechGreenGem"; + } + + public class GemTechPinkGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechPinkGem"; + } + + public class GemTechPurpleGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechPurpleGem"; + } + + public class GemTechRedGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechRedGem"; + } + + public class GemTechYellowGem : DummyTooltipItem + { + public override string Texture => "CalamityMod/Projectiles/Typeless/GemTechYellowGem"; + } +} diff --git a/Items/ExhumedItem.cs b/Items/ExhumedItem.cs new file mode 100644 index 0000000000..219f77519d --- /dev/null +++ b/Items/ExhumedItem.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + // Note the lack of ILocalizedModType. + // Unfortunately, since all exhumed items do not use the same localization category, ILocalizedModType must be placed on each individual item file. + public abstract class ExhumedItem : ModItem, IHoldShiftTooltipItem + { + // All exhumed items use the same extension indicator tooltip. + // This is given a null color, as it is colored manually. + public string ExtensionIndicatorKey => "Items.Misc.ExhumeShortTooltip"; + public Color? ExtensionIndicatorColor => null; + + // All full flavor tooltips use the same localization key. + // All full tooltips also use the same color: #C61B40. This is the standard tooltip color for Calamitas text. + public string TooltipExtensionKey => "Calamitas"; + public Color? TooltipExtensionColor => new(198, 27, 64); + } +} diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index f9743d26be..592ca72692 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Fishing.AstralCatches { Item.width = 36; Item.height = 26; - Item.defense = 20; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; @@ -23,8 +22,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches { CalamityPlayer modPlayer = player.Calamity(); modPlayer.ursaSergeant = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Rabies] = true; //Feral Bite + if (!hideVisual) + modPlayer.ursaSergeantVisual = true; + else + modPlayer.ursaSergeantVisual = false; } } } diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index 1688295a81..488478e39d 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -21,21 +21,20 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches Item.width = 44; Item.height = 44; Item.damage = BaseDamage; - Item.noMelee = true; Item.DamageType = DamageClass.Magic; - Item.channel = true; //Channel so that you can hold the weapon [Important] - Item.rare = ItemRarityID.Green; Item.mana = 5; - Item.useTime = 20; - Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; - Item.shootSpeed = 14f; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; //Channel so that you can hold the weapon [Important] + Item.noMelee = true; + + Item.rare = ItemRarityID.Green; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } - - //Looks scuffed with the laser when there is offset - //public override Vector2? HoldoutOrigin() => new Vector2(10, 10); } } diff --git a/Items/LabFinders/CyanSeekingMechanism.cs b/Items/LabFinders/CyanSeekingMechanism.cs index d5103b32ab..f37e8d84cb 100644 --- a/Items/LabFinders/CyanSeekingMechanism.cs +++ b/Items/LabFinders/CyanSeekingMechanism.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; diff --git a/Items/LabFinders/GreenSeekingMechanism.cs b/Items/LabFinders/GreenSeekingMechanism.cs index 97aac930c6..47b7728999 100644 --- a/Items/LabFinders/GreenSeekingMechanism.cs +++ b/Items/LabFinders/GreenSeekingMechanism.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; diff --git a/Items/LabFinders/OnyxSeekingMechanism.cs b/Items/LabFinders/OnyxSeekingMechanism.cs index f07c064ebc..8e30cd31e1 100644 --- a/Items/LabFinders/OnyxSeekingMechanism.cs +++ b/Items/LabFinders/OnyxSeekingMechanism.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; diff --git a/Items/LabFinders/RedSeekingMechanism.cs b/Items/LabFinders/RedSeekingMechanism.cs index 0634c3d81c..98928ba1e7 100644 --- a/Items/LabFinders/RedSeekingMechanism.cs +++ b/Items/LabFinders/RedSeekingMechanism.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; diff --git a/Items/LabFinders/WhiteSeekingMechanism.cs b/Items/LabFinders/WhiteSeekingMechanism.cs index 10b2d4f39f..3bea74715c 100644 --- a/Items/LabFinders/WhiteSeekingMechanism.cs +++ b/Items/LabFinders/WhiteSeekingMechanism.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; diff --git a/Items/LabFinders/YellowSeekingMechanism.cs b/Items/LabFinders/YellowSeekingMechanism.cs index 42e6582111..101554b25b 100644 --- a/Items/LabFinders/YellowSeekingMechanism.cs +++ b/Items/LabFinders/YellowSeekingMechanism.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LabFinders Item.height = 26; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.shoot = ModContent.ProjectileType(); Item.Calamity().MaxCharge = 100; Item.Calamity().ChargePerUse = 10; diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs index 81ab3ccdc8..616251b73c 100644 --- a/Items/Materials/BloodSample.cs +++ b/Items/Materials/BloodSample.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Materials { Item.ResearchUnlockCount = 25; ItemID.Sets.SortingPriorityMaterials[Type] = 68; // Sturdy Fossil + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); } public override void SetDefaults() @@ -20,6 +22,8 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 50, 0); Item.rare = ItemRarityID.Orange; + + Item.MakeUsableWithChlorophyteExtractinator(); } } } diff --git a/Items/Materials/RottenMatter.cs b/Items/Materials/RottenMatter.cs index e47baf25b3..d2608cf3a3 100644 --- a/Items/Materials/RottenMatter.cs +++ b/Items/Materials/RottenMatter.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Materials { Item.ResearchUnlockCount = 25; ItemID.Sets.SortingPriorityMaterials[Type] = 65; // Crimtane Ore + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); } public override void SetDefaults() @@ -21,6 +23,8 @@ namespace CalamityMod.Items.Materials Item.maxStack = 9999; Item.value = Item.buyPrice(0, 0, 50, 0); Item.rare = ItemRarityID.Orange; + + Item.MakeUsableWithChlorophyteExtractinator(); } } } diff --git a/Items/MomentumCapacitor.cs b/Items/MomentumCapacitor.cs index 5f95ff78f8..047d0c2f01 100644 --- a/Items/MomentumCapacitor.cs +++ b/Items/MomentumCapacitor.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items Item.rare = ItemRarityID.Pink; Item.useStyle = ItemUseStyleID.HoldUp; - Item.useTime = Item.useAnimation = 2; + Item.useAnimation = Item.useTime = 2; Item.noMelee = true; Item.channel = true; Item.autoReuse = true; diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs index e88ceae633..853723fa38 100644 --- a/Items/Mounts/ExoThrone.cs +++ b/Items/Mounts/ExoThrone.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Mounts { Item.width = 32; Item.height = 34; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item94; Item.noMelee = true; diff --git a/Items/Pets/PineapplePet.cs b/Items/Pets/PineapplePet.cs index 5340c86a40..9951fb4ae7 100644 --- a/Items/Pets/PineapplePet.cs +++ b/Items/Pets/PineapplePet.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets Item.width = 32; Item.height = 34; Item.damage = 0; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); diff --git a/Items/Pets/RottingEyeball.cs b/Items/Pets/RottingEyeball.cs index 2764494b8a..1b282d44e7 100644 --- a/Items/Pets/RottingEyeball.cs +++ b/Items/Pets/RottingEyeball.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Pets Item.height = 30; Item.value = Item.buyPrice(0, 4, 0, 0); Item.damage = 0; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.NPCHit2; diff --git a/Items/Pets/TheEtomer.cs b/Items/Pets/TheEtomer.cs index 355db1054d..31cda6968b 100644 --- a/Items/Pets/TheEtomer.cs +++ b/Items/Pets/TheEtomer.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Pets Item.width = 30; Item.height = 34; Item.damage = 0; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.shoot = ModContent.ProjectileType(); Item.buffType = ModContent.BuffType(); diff --git a/Items/Placeables/AstralClay.cs b/Items/Placeables/AstralClay.cs index 3cb89b4062..0f3c7854ce 100644 --- a/Items/Placeables/AstralClay.cs +++ b/Items/Placeables/AstralClay.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables @@ -9,20 +10,9 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.ClayBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); } } diff --git a/Items/Placeables/AstralDirt.cs b/Items/Placeables/AstralDirt.cs index e182fd3bbf..dd7983486c 100644 --- a/Items/Placeables/AstralDirt.cs +++ b/Items/Placeables/AstralDirt.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,21 +11,10 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.DirtBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/AstralIce.cs b/Items/Placeables/AstralIce.cs index 608a38ae5d..c4e2600255 100644 --- a/Items/Placeables/AstralIce.cs +++ b/Items/Placeables/AstralIce.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,22 +11,11 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.IceBlock, 1); ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/AstralSand.cs b/Items/Placeables/AstralSand.cs index 2a2e4f9987..2798bc9f2d 100644 --- a/Items/Placeables/AstralSand.cs +++ b/Items/Placeables/AstralSand.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Typeless; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,7 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SandBlock, 1); // +5 flat damage, equal to other sand variants ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); diff --git a/Items/Placeables/AstralSandstone.cs b/Items/Placeables/AstralSandstone.cs index 2537e7510e..34d23c4896 100644 --- a/Items/Placeables/AstralSandstone.cs +++ b/Items/Placeables/AstralSandstone.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,22 +11,11 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.Sandstone, 1); ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/AstralSnow.cs b/Items/Placeables/AstralSnow.cs index 1da3544eb5..897c56199e 100644 --- a/Items/Placeables/AstralSnow.cs +++ b/Items/Placeables/AstralSnow.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,21 +11,10 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SnowBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/AstralStone.cs b/Items/Placeables/AstralStone.cs index 81e70c31ad..61813bd8c0 100644 --- a/Items/Placeables/AstralStone.cs +++ b/Items/Placeables/AstralStone.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,21 +11,10 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.StoneBlock, 1); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/CelestialRemains.cs b/Items/Placeables/CelestialRemains.cs index c597021aad..91bbe5daf6 100644 --- a/Items/Placeables/CelestialRemains.cs +++ b/Items/Placeables/CelestialRemains.cs @@ -132,22 +132,22 @@ namespace CalamityMod.Items.Placeables } else if (val < 85.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 87.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.78f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 89.53f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (DownedBossSystem.downedAstrumDeus) diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index 952ae9d7ad..7e8b25b434 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -7,21 +8,9 @@ namespace CalamityMod.Items.Placeables.Furniture public class CorruptionEffigy : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.width = 28; - Item.height = 32; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = Item.buyPrice(0, 9, 0, 0); - Item.rare = ItemRarityID.Orange; - Item.createTile = ModContent.TileType(); - } + public override void SetStaticDefaults() => ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index 60d8f1eb10..229205fecf 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -9,20 +9,6 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public class DraedonsForge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() - { - Terraria.On_Recipe.ConsumeForCraft += DraeforgeUnlockDetour; - } - - private static bool DraeforgeUnlockDetour(On_Recipe.orig_ConsumeForCraft orig, Recipe self, Item item, Item requiredItem, ref int stackRequired) - { - if (self.HasTile(ModContent.TileType())) - { - Main.LocalPlayer.Calamity().HasCraftedDraedonsForge = true; - } - return orig(self, item, requiredItem, ref stackRequired); - } - public override void SetDefaults() { Item.width = 58; diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index bcd700ffa9..ce481299e8 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -7,21 +8,9 @@ namespace CalamityMod.Items.Placeables.Furniture public class CrimsonEffigy : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.width = 22; - Item.height = 32; - Item.maxStack = 9999; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.value = Item.buyPrice(0, 9, 0, 0); - Item.rare = ItemRarityID.Orange; - Item.createTile = ModContent.TileType(); - } + public override void SetStaticDefaults() => ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 3c49f987a5..9590db7966 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -84,7 +84,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Mercutio 'Merkalto' Takle", "Mishiro Usui", "Moonburn", - "Mr.Small", "Nycro", "Ozzatron", "Piky", diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 662a70a79b..98e581a6a0 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddIngredient(10). + AddIngredient(2). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/SunkenIdol.cs b/Items/Placeables/Furniture/SunkenIdol.cs new file mode 100644 index 0000000000..69c165a051 --- /dev/null +++ b/Items/Placeables/Furniture/SunkenIdol.cs @@ -0,0 +1,25 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class SunkenIdol : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.width = 34; + Item.height = 38; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Placeables/Furniture/SunkenIdol.png b/Items/Placeables/Furniture/SunkenIdol.png new file mode 100644 index 0000000000..319fc574b4 Binary files /dev/null and b/Items/Placeables/Furniture/SunkenIdol.png differ diff --git a/Items/Placeables/HardenedAstralSand.cs b/Items/Placeables/HardenedAstralSand.cs index ba66ae62c3..6d58430974 100644 --- a/Items/Placeables/HardenedAstralSand.cs +++ b/Items/Placeables/HardenedAstralSand.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Placeables.Walls; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables @@ -9,22 +10,11 @@ namespace CalamityMod.Items.Placeables public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.HardenedSand, 1); ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.createTile = ModContent.TileType(); - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.autoReuse = true; - Item.consumable = true; - Item.maxStack = 9999; - } + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs b/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs new file mode 100644 index 0000000000..74c7b3f5a0 --- /dev/null +++ b/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.LivingFire; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.LivingFire +{ + public class LivingPlagueFireBlock : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 10; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0f, 1f, 0.2f); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(ItemID.LivingFireBlock, 20). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/LivingFire/LivingPlagueFireBlock.png b/Items/Placeables/LivingFire/LivingPlagueFireBlock.png new file mode 100644 index 0000000000..8b7b3dd14b Binary files /dev/null and b/Items/Placeables/LivingFire/LivingPlagueFireBlock.png differ diff --git a/Items/Placeables/NovaeSlag.cs b/Items/Placeables/NovaeSlag.cs index 78983dd0f0..14b3cdb79f 100644 --- a/Items/Placeables/NovaeSlag.cs +++ b/Items/Placeables/NovaeSlag.cs @@ -120,22 +120,22 @@ namespace CalamityMod.Items.Placeables } else if (val < 83.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 85.03f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 86.78f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.53f) { - resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; + resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (DownedBossSystem.downedAstrumDeus) diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index a0f4c67292..06a09a61b2 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -31,10 +31,9 @@ namespace CalamityMod.Items.Potions.Alcohol Item.value = Item.sellPrice(silver: 30); } - public override bool? UseItem(Player player) + public override void GetHealLife(Player player, bool quickHeal, ref int healValue) { - Item.healLife = player.Calamity().baguette ? 250 : 200; - return null; + healValue = player.Calamity().baguette ? 250 : 200; } public override void OnConsumeItem(Player player) diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index a75ba175dc..be17479df9 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Potions.Alcohol Item.value = Item.sellPrice(silver: 40); } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Potions.Alcohol } } player.AddBuff(Item.buffType, Item.buffTime); - return true; } } } diff --git a/Items/Potions/AureusCell.cs b/Items/Potions/AureusCell.cs index 2393b8088c..3249adefee 100644 --- a/Items/Potions/AureusCell.cs +++ b/Items/Potions/AureusCell.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Potions Item.buffTime = CalamityUtils.SecondsToFrames(360f); } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Potions } player.AddBuff(BuffID.MagicPower, Item.buffTime); player.AddBuff(BuffID.ManaRegeneration, Item.buffTime); - return true; } } } diff --git a/Items/Potions/HadalStew.cs b/Items/Potions/HadalStew.cs index a901b1bcab..1fbecce577 100644 --- a/Items/Potions/HadalStew.cs +++ b/Items/Potions/HadalStew.cs @@ -52,12 +52,11 @@ namespace CalamityMod.Items.Potions return player.potionDelay <= 0 && player.Calamity().potionTimer <= 0; } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { player.AddBuff(BuffType, BuffDuration); // fixes hardcoded potion sickness duration from quick heal (see CalamityPlayerMiscEffects.cs) player.Calamity().potionTimer = 2; - return true; } public override void AddRecipes() diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs deleted file mode 100644 index 1fa1a540b3..0000000000 --- a/Items/Potions/TeslaPotion.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Ores; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class TeslaPotion : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Potions"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 20; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 14)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 32; - Item.height = 32; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(5). - AddIngredient(ItemID.BottledWater). - AddIngredient(2). - AddIngredient(5). - AddIngredient(). - AddIngredient(). - AddTile(TileID.Bottles). - AddDecraftCondition(CalamityConditions.DownedHiveMindOrPerforator). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(10). - AddIngredient(). - AddTile(TileID.AlchemyTable). - Register() - .DisableDecraft(); - } - } -} diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 4ed4266d9f..8d433aca1a 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items { Item.width = 32; Item.height = 46; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.DD2_DarkMageCastHeal; Item.noMelee = true; diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 2de57c9d47..75deb7d52b 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -38,8 +38,13 @@ namespace CalamityMod.Items.SummonItems.Invasion public override bool? UseItem(Player player) { - CalamityNetcode.SyncWorld(); - AcidRainEvent.TryStartEvent(true); + // Only Single Player client and Server should call this! + if (Main.netMode != NetmodeID.MultiplayerClient) + { + AcidRainEvent.TryStartEvent(forceRain: true); + // TryStartEvent already syncs the world data + } + return true; } diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs index 965b1b0ff3..880a169570 100644 --- a/Items/SummonItems/Invasion/MartianDistressRemote.cs +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -35,11 +36,38 @@ namespace CalamityMod.Items.SummonItems.Invasion itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; } - public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; + public override bool CanUseItem(Player player) + { + // Do not start new invasion when it's already on going + if (Main.invasionType != InvasionID.None) + return false; + + // This is the requirement for StartInvasion for some reason + // If this part is missing MartianRemote will show DD2 invasion GUI without any enemy spawn on MP + if (!Main.player.Any(p => p.active && p.ConsumedLifeCrystals >= 5)) + return false; + + return true; + } public override bool? UseItem(Player player) { - Main.StartInvasion(InvasionID.MartianMadness); + // Single Player case + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.invasionDelay = 0; + Main.StartInvasion(InvasionID.MartianMadness); + return true; + } + + // MP case: only owner should send Spawn Message to Master + if (player.whoAmI == Main.myPlayer) + { + //-7.0 is hardcoded id for MartianMadness Event + NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, number: player.whoAmI, number2: -7.0f); + return true; + } + return true; } diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index ae2034fd96..36dd09a148 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.SummonItems SoundEngine.PlaySound(Providence.SpawnSound, player.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); + int npc = NPC.NewNPC(new EntitySource_BossSpawn(player), (int)player.position.X, (int)(player.position.Y - 100f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index f67d9f7fe3..34c55f4352 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Tools Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. Item.shoot = ProjectileType(); Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } } } diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 759f43754d..3e83a71ec6 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -1,8 +1,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; + +using SandstormEvent = Terraria.GameContent.Events.Sandstorm; + namespace CalamityMod.Items.Tools.ClimateChange { + + public class AridArtifact : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; @@ -27,13 +32,17 @@ namespace CalamityMod.Items.Tools.ClimateChange return DownedBossSystem.downedDesertScourge || Main.hardMode; } - // this is extremely ugly and has to be fully qualified because we add an item called Sandstorm public override bool? UseItem(Player player) { - if (Terraria.GameContent.Events.Sandstorm.Happening) + // Only SinglePlayer and Server need to sync those parameters + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (SandstormEvent.Happening) CalamityUtils.StopSandstorm(); else CalamityUtils.StartSandstorm(); + return true; } diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 70705a1e1a..b380c4f384 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -32,10 +32,13 @@ namespace CalamityMod.Items.Tools.ClimateChange itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; } - public override bool CanUseItem(Player player) + public override bool CanUseItem(Player player) => !CalamityPlayer.areThereAnyDamnBosses; + + public override bool? UseItem(Player player) { - if (CalamityPlayer.areThereAnyDamnBosses) - return false; + //Only SinglePlayer or DedServ should change time to prevent unwanted race condition + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; // Early Morning -> Noon if (Main.dayTime && Main.time < NoonCutoff) diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index fca095ca74..ed9eb51f0b 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -31,16 +31,19 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool? UseItem(Player player) { + // Only SinglePlayer and Server need to sync those parameters + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + if (!Main.raining) { - CalamityUtils.StartRain(true); + CalamityUtils.StartRain(torrentialTear: true, worldSync: true); } else { - Main.raining = false; + CalamityUtils.StopRain(clearWeather: false, worldSync: true); } - CalamityNetcode.SyncWorld(); return true; } diff --git a/Items/Tools/GenesisPickaxe.cs b/Items/Tools/GenesisPickaxe.cs index 731ed16653..907c036040 100644 --- a/Items/Tools/GenesisPickaxe.cs +++ b/Items/Tools/GenesisPickaxe.cs @@ -1,14 +1,20 @@ using CalamityMod.Items.Materials; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.Items.Tools { [LegacyName("GallantPickaxe")] public class GenesisPickaxe : ModItem, ILocalizedModType { + private int swordDirection; + public int time = 0; + public float swingRotation = 0; public new string LocalizationCategory => "Items.Tools"; public override void SetDefaults() { @@ -41,12 +47,57 @@ namespace CalamityMod.Items.Tools .Register(); } + public override void UseAnimation(Player player) + { + swordDirection = (player.Center - player.Calamity().mouseWorld).X > 1 ? -1 : 1; + time = 0; + swingRotation = 0; + + //float Rot = (player.direction == -1 ? 5.5f : -5.5f) * Main.rand.NextFloat(0.99f, 1.1f); + //Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, Color.LightGreen * 0.9f, Rot, Main.rand.NextFloat(1.7f, 1.83f), new Vector2(1, 1), 6, true, false, true); + //GeneralParticleHandler.SpawnParticle(Smear); + } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(5)) + player.itemRotation = swingRotation - 1.7f * swordDirection; + player.itemLocation = player.Center; + player.direction = swordDirection; + + swingRotation = Utils.Remap(time, 0, player.itemAnimationMax, 0, 2.88f * swordDirection); + + if (Main.rand.NextBool(4)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.PurpleTorch); + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); + dust.scale = Main.rand.NextFloat(0.5f, 0.75f); + dust.velocity = dustVel * 0.1f; + dust.color = Color.LightGreen; + dust.noGravity = true; } + if (Main.rand.NextBool(4)) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + + float partScale = Main.rand.NextFloat(0.6f, 1.2f); + Vector2 partVel = dustVel * Main.rand.NextFloat(0.1f, 0.3f); + Particle spark3 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale, Color.Black, false, false, false); + GeneralParticleHandler.SpawnParticle(spark3); + for (int i = 0; i < 2; i++) + { + Particle spark2 = new GlowOrbParticle(player.Center + dustVel * 7, partVel, false, 18, partScale * 0.5f, Color.LightGreen, true, false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + + float partScale2 = Main.rand.NextFloat(0.5f, 0.8f); + Vector2 partVel2 = dustVel2 * Main.rand.NextFloat(0.1f, 0.7f); + + Particle smoke = new HeavySmokeParticle(player.Center + dustVel2 * 12 + Main.rand.NextVector2Circular(8, 8), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, Color.Black, 13, partScale2, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + + time++; } } } diff --git a/Items/Tools/MarniteDeconstructor.cs b/Items/Tools/MarniteDeconstructor.cs index a457d1cf24..e1164777f5 100644 --- a/Items/Tools/MarniteDeconstructor.cs +++ b/Items/Tools/MarniteDeconstructor.cs @@ -16,31 +16,28 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 18; Item.damage = 6; - Item.ArmorPenetration = 10; - Item.knockBack = 0f; - Item.useTime = 7; - Item.useAnimation = 25; - Item.hammer = 40; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.channel = true; - Item.noUseGraphic = true; - Item.noMelee = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item23; - Item.autoReuse = true; + Item.ArmorPenetration = 10; + Item.hammer = 59; + Item.tileBoost = 7; + Item.useAnimation = 25; + Item.useTime = 4; + Item.knockBack = 0.5f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 40f; - Item.tileBoost = 7; - } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; + Item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void AddRecipes() { diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index f274cc24c1..05f6735a85 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -16,31 +16,28 @@ namespace CalamityMod.Items.Tools Item.width = 36; Item.height = 18; Item.damage = 7; - Item.ArmorPenetration = 5; - Item.knockBack = 0f; - Item.useTime = 6; - Item.useAnimation = 25; - Item.pick = 50; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; - Item.channel = true; - Item.noUseGraphic = true; - Item.noMelee = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item23; - Item.autoReuse = true; + Item.ArmorPenetration = 5; + Item.pick = 59; + Item.tileBoost = 7; + Item.useAnimation = 25; + Item.useTime = 3; + Item.knockBack = 0.5f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 40f; - Item.tileBoost = 7; - } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; + Item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void AddRecipes() { diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index f398ed1c3a..01a29ca84e 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Tools { Item.width = 30; Item.height = 38; - Item.useTime = Item.useAnimation = 8; + Item.useAnimation = Item.useTime = 8; Item.maxStack = 9999; Item.consumable = true; Item.shootSpeed = 20f; diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 1a5508fe6d..0d829fad72 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -15,29 +15,26 @@ namespace CalamityMod.Items.Tools Item.width = 46; Item.height = 38; Item.damage = 5; - Item.knockBack = 0f; - Item.useTime = 5; - Item.useAnimation = 16; + Item.DamageType = DamageClass.Melee; Item.pick = 35; Item.tileBoost += 1; - - Item.DamageType = DamageClass.Melee; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; - Item.UseSound = SoundID.Item23; - Item.autoReuse = true; + Item.useAnimation = 16; + Item.useTime = 5; + Item.knockBack = 0.5f; Item.shoot = ModContent.ProjectileType(); + Item.UseSound = SoundID.Item23; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.useStyle = ItemUseStyleID.Shoot; + + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; } - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; - } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void AddRecipes() { diff --git a/Items/Tools/WulfrumScaffoldKit.cs b/Items/Tools/WulfrumScaffoldKit.cs index 5214589d07..926cb59b7d 100644 --- a/Items/Tools/WulfrumScaffoldKit.cs +++ b/Items/Tools/WulfrumScaffoldKit.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Tools { Item.width = 52; Item.height = 42; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.autoReuse = false; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.HiddenAnimation; diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index 8ccbada62e..188192ffa2 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Tools { Item.width = 52; Item.height = 42; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.autoReuse = false; Item.holdStyle = 16; //Custom hold style Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/TreasureBags/AstrumAureusBag.cs b/Items/TreasureBags/AstrumAureusBag.cs index b94f45c744..0b3d7925d6 100644 --- a/Items/TreasureBags/AstrumAureusBag.cs +++ b/Items/TreasureBags/AstrumAureusBag.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.TreasureBags // Equipment itemLoot.Add(ModContent.ItemType()); - itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); itemLoot.AddRevBagAccessories(); // Vanity diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 54fe68cbde..03aabed864 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -90,15 +90,15 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags }; itemLoot.AddIf(getsHapuFruit, ModContent.ItemType()); - // Apelusa dev item - // Name specific: "Pelusa" - static bool getsRedBow(DropAttemptInfo info) + // Dandy dev item + // Name specific: "Dandy" + static bool getsGhostBracelet(DropAttemptInfo info) { string playerName = info.player.name; - return playerName == "Pelusa"; + return playerName == "Dandy"; } - itemLoot.AddIf(getsRedBow, ModContent.ItemType()); + itemLoot.AddIf(getsGhostBracelet, ModContent.ItemType()); // Mishiro dev vanity // Name specific: "Amber" or "Mishiro" @@ -110,16 +110,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags itemLoot.AddIf(getsOracleHeadphones, ModContent.ItemType()); - // Bird dev item - // Name specific: "bird" - static bool getsSakuraFeather(DropAttemptInfo info) - { - string playerName = info.player.name; - return playerName == "bird"; - } - - itemLoot.AddIf(getsSakuraFeather, ModContent.ItemType()); - // Fabsol dev item // Name specific: "Fabsol" or "Cirrus" static bool getsCrystalHeartVodka(DropAttemptInfo info) diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 9b81666b96..bcbca32ab3 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -67,11 +67,8 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] { ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/VanillaArmorChanges/FrostArmorSetChange.cs b/Items/VanillaArmorChanges/FrostArmorSetChange.cs index 3466dba90e..f84f8b0fa0 100644 --- a/Items/VanillaArmorChanges/FrostArmorSetChange.cs +++ b/Items/VanillaArmorChanges/FrostArmorSetChange.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Frost"; - public const float ProximityBoost = 0.15f; + public const float ProximityBoost = 0.2f; public const float MinDistance = 160f; public const float MaxDistance = 800f; diff --git a/Items/VanillaArmorChanges/NecroArmorSetChange.cs b/Items/VanillaArmorChanges/NecroArmorSetChange.cs index dc0b171ace..f4768a2092 100644 --- a/Items/VanillaArmorChanges/NecroArmorSetChange.cs +++ b/Items/VanillaArmorChanges/NecroArmorSetChange.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Necro"; - public const int PostMortemDuration = 7; + public const int PostMortemDuration = 10; public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer"); public override void UpdateSetBonusText(ref string setBonusText) diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index c914d5e12b..9d9f171a1a 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -6,7 +6,6 @@ using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -58,12 +57,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override Vector2? HoldoutOffset() => new Vector2(-20, 0); public override void AddRecipes() diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index 144e1db7c4..445df79e74 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.mana = 6; Item.damage = 150; Item.knockBack = 11f; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 7be5cf7369..a22932442c 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Ranged; Item.damage = 150; Item.knockBack = 30f; - Item.useTime = Item.useAnimation = 32; + Item.useAnimation = Item.useTime = 32; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index 67952028d0..004fcf0338 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.DamageType = DamageClass.Ranged; Item.damage = 100; Item.knockBack = 11f; - Item.useTime = Item.useAnimation = 33; + Item.useAnimation = Item.useTime = 33; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 526fc38224..f6a07d25f4 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.damage = 24; Item.knockBack = 2f; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 653ce53ecf..b3c7e03f97 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.useTurn = false; Item.knockBack = 7f; + Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 857a3d038e..f0acad0d57 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shootSpeed = 10f; Item.damage = 310; Item.mana = 12; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 8f; diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 9a68a38931..3d58c31b72 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -9,7 +9,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,32 +30,24 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 32; Item.DamageType = DamageClass.Ranged; Item.damage = BaseDamage; - Item.knockBack = 0f; - Item.useTime = 55; - Item.useAnimation = 55; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 55; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; - Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = FireSound; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - modItem.UsesCharge = true; modItem.MaxCharge = 250f; modItem.ChargePerUse = 0.24f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - - return false; - } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value); diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index 15ca250bb3..9c189c6369 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -20,24 +20,23 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 28; Item.height = 26; + Item.damage = 150; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.damage = 150; - Item.knockBack = 0f; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 24; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; - Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item15; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.autoReuse = true; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 1f; - modItem.UsesCharge = true; modItem.MaxCharge = 135f; modItem.ChargePerUse = 1f; diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 7e1b3d2566..fded511217 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 24; Item.damage = 200; Item.mana = 12; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index 6ae3f691fd..a38dc3a714 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.shootSpeed = 10f; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2.25f; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 53b5e7d0ee..1388f7623a 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -8,7 +8,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -49,19 +48,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.ChargePerUse = 0.75f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { if (velocity.Length() > 5f) { velocity.Normalize(); velocity *= 5f; } - - float SpeedX = velocity.X + (float)Main.rand.Next(-1, 2) * 0.02f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-1, 2) * 0.02f; - - Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 99fe8347cd..475c24e69e 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -31,12 +31,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.height = 44; Item.damage = 1675; Item.knockBack = 4.5f; - Item.useTime = Item.useAnimation = AnomalysNanogunHoldout.PlasmaFireTimer; + Item.useAnimation = Item.useTime = AnomalysNanogunHoldout.PlasmaFireTimer; Item.shootSpeed = 5f; Item.DamageType = DamageClass.Ranged; Item.useStyle = ItemUseStyleID.Shoot; Item.shoot = ModContent.ProjectileType(); Item.UseSound = null; + Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index f69d253b41..812c5471b7 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index 96a3b2e987..cd2d2ec4c1 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -20,25 +20,23 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { CalamityGlobalItem modItem = Item.Calamity(); - Item.damage = 75; - Item.DamageType = RogueDamageClass.Instance; - Item.noMelee = true; - Item.noUseGraphic = true; Item.width = 26; Item.height = 44; - Item.useTime = 56; - Item.useAnimation = 56; - Item.autoReuse = true; + Item.damage = 75; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 56; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + + Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 0f; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item1; - - Item.shootSpeed = 16f; - Item.shoot = ModContent.ProjectileType(); modItem.UsesCharge = true; modItem.MaxCharge = 190f; diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index 399ba5cb99..5fca24ab40 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -16,30 +16,24 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 86; Item.height = 32; Item.damage = 27; - Item.noMelee = true; Item.DamageType = DamageClass.Magic; - Item.channel = true; - Item.useTime = 19; - Item.useAnimation = 19; + Item.mana = 10; + Item.useAnimation = Item.useTime = 19; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; - Item.mana = 10; + Item.autoReuse = true; + Item.noMelee = true; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; - - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position + velocity * 4.5f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => position += velocity.SafeNormalize(Vector2.UnitX) * 56f; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 712bb487fe..9594e9d994 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 28; Item.DamageType = DamageClass.Magic; Item.mana = 9; - Item.useTime = Item.useAnimation = 45; + Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 782fffeba9..539b76b5c0 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 285; Item.DamageType = DamageClass.Magic; Item.mana = 7; - Item.useTime = Item.useAnimation = UseTime; + Item.useAnimation = Item.useTime = UseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Magic/AethersWhisper.cs b/Items/Weapons/Magic/AethersWhisper.cs index 84c70e6b73..f240be95f0 100644 --- a/Items/Weapons/Magic/AethersWhisper.cs +++ b/Items/Weapons/Magic/AethersWhisper.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 44; Item.damage = 504; Item.knockBack = 5.5f; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.mana = 30; diff --git a/Items/Weapons/Magic/Apathanull.cs b/Items/Weapons/Magic/Apathanull.cs new file mode 100644 index 0000000000..15fd4f2860 --- /dev/null +++ b/Items/Weapons/Magic/Apathanull.cs @@ -0,0 +1,55 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + [LegacyName("TomeofFates")] + public class Apathanull : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 30; + Item.damage = 51; + Item.DamageType = DamageClass.Magic; + Item.mana = 15; + Item.useTime = 8; + Item.useAnimation = 20; + Item.reuseDelay = 8; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/MeldBurn") with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.45f, -0.6f) }; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 12; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile proj = Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.7f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.SpellTome). + AddIngredient(9). + AddTile(TileID.Bookcases). + Register(); + } + } +} diff --git a/Items/Weapons/Magic/TomeofFates.png b/Items/Weapons/Magic/Apathanull.png similarity index 100% rename from Items/Weapons/Magic/TomeofFates.png rename to Items/Weapons/Magic/Apathanull.png diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 183b7f53cb..3cb104ca5a 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 230; Item.DamageType = DamageClass.Magic; Item.mana = 42; - Item.useTime = Item.useAnimation = 167; + Item.useAnimation = Item.useTime = 167; Item.useStyle = ItemUseStyleID.Shoot; Item.useTurn = false; Item.noMelee = true; diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index 1359f1b9fd..509e2dbefe 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -43,8 +43,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f; - int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 180; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/ArtAttack.cs b/Items/Weapons/Magic/ArtAttack.cs index 45d5c5bd1f..b16f045350 100644 --- a/Items/Weapons/Magic/ArtAttack.cs +++ b/Items/Weapons/Magic/ArtAttack.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/AuguroftheElements.cs b/Items/Weapons/Magic/AuguroftheVoid.cs similarity index 94% rename from Items/Weapons/Magic/AuguroftheElements.cs rename to Items/Weapons/Magic/AuguroftheVoid.cs index ab2d7c028d..d8d00fdbc0 100644 --- a/Items/Weapons/Magic/AuguroftheElements.cs +++ b/Items/Weapons/Magic/AuguroftheVoid.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class AuguroftheElements : ModItem, ILocalizedModType + [LegacyName("AuguroftheElements")] + public class AuguroftheVoid : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item103; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; } @@ -62,7 +63,6 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(ItemID.ShadowFlameHexDoll). AddIngredient(). AddIngredient(ItemID.LunarBar, 5). diff --git a/Items/Weapons/Magic/AuguroftheElements.png b/Items/Weapons/Magic/AuguroftheVoid.png similarity index 100% rename from Items/Weapons/Magic/AuguroftheElements.png rename to Items/Weapons/Magic/AuguroftheVoid.png diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index d08ab647d1..47b528c39f 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -9,26 +9,35 @@ namespace CalamityMod.Items.Weapons.Magic public class BurningSea : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public const float ChargeTime = 240f; + public const float BurnOutTime = 560f; + public const int BurnOutReuseDelay = 150; + public const float FizzleOutTime = 40f; + public override void SetDefaults() { Item.width = 28; Item.height = 30; - Item.damage = 68; + Item.damage = 69; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 8; Item.useTime = 20; Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; - Item.knockBack = 6.5f; + Item.channel = true; + Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item20; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.Calamity().burningSeaBurnOut <= 0; + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index 7c9c432dc1..deb6294b54 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -18,17 +18,18 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 105; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.useTime = 35; - Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item67; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 35; + Item.knockBack = 0.25f; Item.shoot = ProjectileID.RainbowFront; Item.shootSpeed = 18f; + + Item.UseSound = SoundID.Item67; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityRedBuyPrice; + Item.rare = ItemRarityID.Red; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index f9013dad83..a865c3c00a 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -25,29 +24,24 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.HoldUp; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.UseSound = SoundID.Item13; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; - Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0.0f, 0.0f); - return false; - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 5e340743dc..871d4a0bbe 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -1,7 +1,5 @@ using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -34,12 +32,5 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; } - - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); - return false; - } } } diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index 190e2321a1..ec95864417 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + Main.rand.Next(-25, 26) * 0.05f; float SpeedY = velocity.Y + Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 0c119bc4cd..cff0b56d52 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -28,20 +28,20 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = BaseDamage; Item.DamageType = DamageClass.Magic; Item.mana = 30; - Item.useTime = Item.useAnimation = 120; + Item.useAnimation = Item.useTime = 120; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; Item.noMelee = true; - Item.knockBack = 0f; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - - Item.autoReuse = true; - Item.noUseGraphic = true; - Item.shoot = ModContent.ProjectileType(); - Item.channel = true; - Item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void ModifyTooltips(List list) diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index bb80dcc498..028b914ecd 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.mana = 12; - Item.useTime = Item.useAnimation = 32; + Item.useAnimation = Item.useTime = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/Genesis.cs b/Items/Weapons/Magic/Genesis.cs index 44c82b67ff..f1be1b7b33 100644 --- a/Items/Weapons/Magic/Genesis.cs +++ b/Items/Weapons/Magic/Genesis.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = 4; - Item.useAnimation = 4; + + Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index 59db80cd1d..61de44955a 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 58; Item.damage = 120; Item.knockBack = 10f; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.mana = 20; Item.DamageType = DamageClass.Magic; Item.channel = true; diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index 684c53dd65..e4a64b95a0 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class GruesomeEminence : ModItem, ILocalizedModType + public class GruesomeEminence : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index 99191e7e68..cd7587c868 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { SoundEngine.PlaySound(SoundID.Item103 with { Volume = SoundID.Item103.Volume }, player.Center); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 12); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 12); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index bd5307fc53..5b46315649 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,10 +1,10 @@ -using System; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -14,92 +14,53 @@ namespace CalamityMod.Items.Weapons.Magic public class HeliumFlash : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - internal const float ExplosionDamageMultiplier = 0.125f; + internal const float ExplosionDamageMultiplier = 1.4f; + public static readonly SoundStyle Charge = new("CalamityMod/Sounds/Item/HeliumFlashCharge"); + public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/HeliumFlashFullChargeLoop"); + internal static readonly int ChargeLoopSoundFrames = 120; + public static readonly SoundStyle ChargeFire = new("CalamityMod/Sounds/Item/HeliumFlashFire") { Volume = 1f }; - public override void SetStaticDefaults() - { - Item.staff[Item.type] = true; - } + public static int AftershotCooldownFrames = 17; + public static int FullChargeFrames = 88; public override void SetDefaults() { Item.width = 112; Item.height = 112; Item.DamageType = DamageClass.Magic; - Item.damage = 1800; + Item.damage = 5000; Item.knockBack = 9.5f; - Item.mana = 40; - Item.useAnimation = 40; - Item.useTime = 40; + Item.mana = 80; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.autoReuse = true; Item.noMelee = true; - + Item.channel = true; + Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.Item73; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; } - // Creates dust at the tip of the staff when used. + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Vector2 dir = velocity; - double angle = Math.Atan2(velocity.Y, velocity.X) + MathHelper.PiOver4; - dir = dir.SafeNormalize(Vector2.Zero); - dir *= 80f * (float)Math.Sqrt(2); // distance to gleaming point on staff - Vector2 dustPos = position + dir; - - int dustType = 162; - int dustCount = 72; - float minSpeed = 4f; - float maxSpeed = 11f; - float minScale = 0.8f; - float maxScale = 1.4f; - Vector2 leftVec = new Vector2(-1f, 0f).RotatedBy(angle); - Vector2 rightVec = new Vector2(1f, 0f).RotatedBy(angle); - Vector2 upVec = new Vector2(0f, -1f).RotatedBy(angle); - Vector2 downVec = new Vector2(0f, 1f).RotatedBy(angle); - for (int i = 0; i < dustCount; i += 4) - { - int left = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[left].position = dustPos; - Main.dust[left].velocity = leftVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[left].noGravity = true; - - int right = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[right].position = dustPos; - Main.dust[right].velocity = rightVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[right].noGravity = true; - - int up = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[up].position = dustPos; - Main.dust[up].velocity = upVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[up].noGravity = true; - - int down = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f); - Main.dust[down].position = dustPos; - Main.dust[down].velocity = downVec * Main.rand.NextFloat(minSpeed, maxSpeed); - Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale); - Main.dust[down].noGravity = true; - } - return true; + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; } - - public override void AddRecipes() { Recipe r = CreateRecipe(); r.AddIngredient(); - r.AddIngredient(); r.AddIngredient(); - r.AddIngredient(ItemID.FragmentSolar, 20); + r.AddIngredient(ItemID.FragmentSolar, 10); r.AddIngredient(ItemID.FragmentNebula, 5); r.AddIngredient(5); r.AddTile(); diff --git a/Items/Weapons/Magic/HeliumFlash.png b/Items/Weapons/Magic/HeliumFlash.png index 721abc05ae..211a007067 100644 Binary files a/Items/Weapons/Magic/HeliumFlash.png and b/Items/Weapons/Magic/HeliumFlash.png differ diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 14d8c95b40..8615031997 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Magic mouseYDist *= mouseDistance; float speedX4 = mouseXDist + (float)Main.rand.Next(-40, 41) * 0.02f; float speedY5 = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 18c289a27f..48b331b19b 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Magic position = Main.MouseWorld; for (int x = 0; x < 10; x++) { - Projectile.NewProjectile(source, position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index 77c4af47e3..2349832e9d 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -23,20 +23,20 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 960; Item.DamageType = DamageClass.Magic; Item.mana = 15; - Item.useTime = Item.useAnimation = 120; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; + Item.useAnimation = Item.useTime = 120; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 0f; + Item.UseSound = SoundID.DD2_EtherianPortalDryadTouch; - Item.knockBack = 0f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.channel = true; + Item.noMelee = true; + Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); - - Item.autoReuse = true; - Item.noUseGraphic = true; - Item.shoot = ModContent.ProjectileType(); - Item.channel = true; - Item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 1d71b194b4..0e079e60fd 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 2250; Item.knockBack = 6f; - Item.useTime = Item.useAnimation = 300; + Item.useAnimation = Item.useTime = 300; Item.reuseDelay = 60; Item.useLimitPerAnimation = 1; Item.shoot = ModContent.ProjectileType(); @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); realPlayerPos.X = Main.mouseX + Main.screenPosition.X; realPlayerPos.Y = Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, realPlayerPos, Vector2.Zero, type, damage, knockback, player.whoAmI); CalamityGlobalItem.ConsumeAdditionalAmmo(player, Item, 2); diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index 0fcf0fc8d6..8938becc5b 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Magic Vector2 projVelocity = new Vector2(mouseXDist, mouseYDist).SafeNormalize(Vector2.UnitY) * projSpeed; projSpawnPos = projSpawnPos.SafeNormalize(projVelocity) * projSpeed; projSpawnPos = Vector2.Lerp(projSpawnPos, projVelocity, 0.25f); - Projectile.NewProjectile(source, projSpawnOffset, projSpawnPos, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, projSpawnOffset, projSpawnPos, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index a0ef23a3cb..1ab8bcc658 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 111; Item.DamageType = DamageClass.Magic; Item.mana = 6; - Item.useTime = Item.useAnimation = 4; + Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 5a24f1a067..dc7200d341 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 40; Item.DamageType = DamageClass.Magic; Item.mana = 16; - Item.useTime = Item.useAnimation = 27; + Item.useAnimation = Item.useTime = 27; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; diff --git a/Items/Weapons/Magic/NanoPurge.cs b/Items/Weapons/Magic/NanoPurge.cs index a0522394b9..f8b8229c06 100644 --- a/Items/Weapons/Magic/NanoPurge.cs +++ b/Items/Weapons/Magic/NanoPurge.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.useTime = Item.useAnimation = UseTime; + Item.useAnimation = Item.useTime = UseTime; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Magic/ElementalRay.cs b/Items/Weapons/Magic/Nucleosynthesis.cs similarity index 97% rename from Items/Weapons/Magic/ElementalRay.cs rename to Items/Weapons/Magic/Nucleosynthesis.cs index 8ef2de1e1c..90e3f5756d 100644 --- a/Items/Weapons/Magic/ElementalRay.cs +++ b/Items/Weapons/Magic/Nucleosynthesis.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class ElementalRay : ModItem, ILocalizedModType + [LegacyName("ElementalRay")] + public class Nucleosynthesis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/ElementalRay.png b/Items/Weapons/Magic/Nucleosynthesis.png similarity index 100% rename from Items/Weapons/Magic/ElementalRay.png rename to Items/Weapons/Magic/Nucleosynthesis.png diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 2f5274a96d..3eb1249adf 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 82; Item.DamageType = DamageClass.Magic; Item.mana = 8; - Item.useTime = Item.useAnimation = 4; + Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic holdout2.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); } - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 0, 0); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index a79fa58088..58da009461 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 12; Item.knockBack = 3f; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.autoReuse = true; Item.DamageType = DamageClass.Magic; Item.shootSpeed = 10f; @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Magic xVec *= speedMult; yVec *= speedMult; directionToShoot = new Vector2(xVec, yVec); - Projectile.NewProjectile(source, playerPos, directionToShoot, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, playerPos, directionToShoot, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index f50734ad0f..fe93d842ff 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -3,6 +3,8 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,23 +22,40 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 62; Item.height = 60; - Item.damage = 260; + Item.damage = 115; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 60; + Item.useTime = 3; + Item.useAnimation = 45; + Item.reuseDelay = 75; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; + Item.knockBack = 20f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.UseSound = SoundID.Item43; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/PhantasmalFuryShoot") with { Volume = 0.6f, PitchVariance = 0.15f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 6f; Item.rare = ModContent.RarityType(); } - + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectileDirect(source, position + velocity * 13, velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.8f, 1.1f), ModContent.ProjectileType(), damage, 0, player.whoAmI, 0f, 0f); + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectileDirect(source, position + velocity * 13, velocity.RotatedByRandom(0.4f), ModContent.ProjectileType(), damage / 2, 0, player.whoAmI, 0f, 0f); + } + for (int i = 0; i < 2; i++) + { + Dust chargefull = Dust.NewDustPerfect(position + velocity * 13, 267); + chargefull.velocity = velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(1f, 4); + chargefull.scale = Main.rand.NextFloat(0.5f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Color.Aqua, 0.3f); + } + return false; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index 24bb921c54..432207b5ff 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 150; Item.mana = 40; Item.DamageType = DamageClass.Magic; - Item.useTime = Item.useAnimation = 8; + Item.useAnimation = Item.useTime = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index d1de524308..305b14499d 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -1,7 +1,5 @@ using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,11 +27,5 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int typhoon = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } } } diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 6eddc1e9c8..b8883d9978 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.mana = 25; Item.crit += 4; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index 67dcea1045..f69ac44ac2 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic { - public class Rancor : ModItem, ILocalizedModType + public class Rancor : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; public override void SetDefaults() diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 0504374faf..2101b2da51 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 16; Item.DamageType = DamageClass.Magic; Item.mana = 20; - Item.useTime = Item.useAnimation = 7; + Item.useAnimation = Item.useTime = 7; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; @@ -77,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback * 0.5f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback * 0.5f, player.whoAmI); } return false; } @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.1), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.1), knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/SandstreamScepter.cs b/Items/Weapons/Magic/SandstreamScepter.cs index 942ba48deb..9f1680230f 100644 --- a/Items/Weapons/Magic/SandstreamScepter.cs +++ b/Items/Weapons/Magic/SandstreamScepter.cs @@ -36,10 +36,6 @@ namespace CalamityMod.Items.Weapons.Magic Item.shootSpeed = 11f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position + velocity * 5, velocity, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => position += velocity.SafeNormalize(Vector2.UnitX) * 55f; } } diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index ccb6632d8c..63aeac78ab 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Projectiles.Magic; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; @@ -11,37 +12,61 @@ namespace CalamityMod.Items.Weapons.Magic public class SeethingDischarge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public int DartTimer = 0; public override void SetDefaults() { Item.width = 28; Item.height = 32; - Item.damage = 52; + Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 20; + Item.useTime = 60; + Item.useAnimation = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.75f; - Item.UseSound = CommonCalamitySounds.FlareSound; + Item.UseSound = BrimstoneElemental.ShellFireSound; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 10f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + 10f * 0.05f; - float SpeedY = velocity.Y + 10f * 0.05f; - float SpeedX2 = velocity.X - 10f * 0.05f; - float SpeedY2 = velocity.Y - 10f * 0.05f; - float SpeedX3 = velocity.X + 0f * 0.05f; - float SpeedY3 = velocity.Y + 0f * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockback, player.whoAmI, 0f, 0f); + DartTimer++; + + // Spawn hellblasts + float diameter = 50f; + Vector2 projVelocity = velocity.SafeNormalize(Vector2.UnitY); + projVelocity *= diameter; + + int totalProjectiles = 5; + float offsetAngle = MathHelper.Pi * 0.2f; + + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = projVelocity.RotatedBy(offsetAngle * radians); + Projectile.NewProjectile(source, player.Center + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + } + + // Every 3rd attack, spawn a ring of homing darts + if (DartTimer == 3) + { + DartTimer = 0; + + totalProjectiles = 8; + Vector2 initialOffset = Vector2.UnitX.RotatedBy(Main.rand.NextFloat(0f, MathHelper.PiOver4)); + for (int k = 0; k < totalProjectiles; k++) + { + velocity = initialOffset.RotatedBy(MathHelper.TwoPi * (k / (float)totalProjectiles)) * Item.shootSpeed; + Projectile.NewProjectile(source, player.Center, velocity, type, damage, 0f, player.whoAmI, 0f, 1f); + } + } + return false; } } diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index 76e976a116..7fac680a1f 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -36,20 +36,20 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = Item.height = 42; Item.damage = 19; - Item.shootSpeed = 11f; - Item.useTime = Item.useAnimation = 34; - Item.mana = 10; - Item.knockBack = 0f; - - Item.shoot = ModContent.ProjectileType(); - Item.DamageType = DamageClass.Magic; - Item.useStyle = ItemUseStyleID.Shoot; + Item.mana = 10; + Item.useAnimation = Item.useTime = 34; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 11f; + Item.UseSound = SoundID.Item66; - Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; Item.noMelee = true; + + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index 593ac52488..0cd4425a84 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -20,19 +20,19 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 56; - Item.damage = 280; + Item.damage = 190; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 14; - Item.useAnimation = 14; + Item.mana = 10; + Item.useTime = 12; + Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 8f; + Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shootSpeed = 5f; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index ca5991c6f6..ad97b003f3 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = Item.height = 58; Item.damage = 76; Item.knockBack = 5f; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.mana = 20; Item.DamageType = DamageClass.Magic; Item.channel = true; diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index a0789ea6c9..6fcc104cb2 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 310; Item.DamageType = DamageClass.Magic; Item.mana = 19; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index debf53f5c6..59d732f8ad 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public class SubsumingVortex : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override string Texture => "CalamityMod/Items/Weapons/Magic/SubsumingVortexSmall"; public const int RightClickVortexCount = 3; public const int VortexReleaseRate = 27; @@ -47,9 +48,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 86; Item.height = 104; - Item.damage = 466; + Item.damage = 460; Item.DamageType = DamageClass.Magic; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.shootSpeed = 7f; Item.mana = 22; Item.knockBack = 5f; @@ -78,18 +79,16 @@ namespace CalamityMod.Items.Weapons.Magic public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.4f, - drawOffset: default - ); + Texture2D actualSprite = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortex").Value; + + spriteBatch.DrawNewInventorySprite(actualSprite, new Vector2(48f, 52f), position, drawColor, origin, scale, new Vector2(-6f, -6f)); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D actualSprite = ModContent.Request("CalamityMod/Items/Weapons/Magic/SubsumingVortex").Value; + spriteBatch.Draw(actualSprite, Item.Center - Main.screenPosition, null, lightColor, rotation, actualSprite.Size() / 2f, scale, 0, 0); return false; } @@ -120,7 +119,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Magic/SubsumingVortexSmall.png b/Items/Weapons/Magic/SubsumingVortexSmall.png new file mode 100644 index 0000000000..eb1ec7291e Binary files /dev/null and b/Items/Weapons/Magic/SubsumingVortexSmall.png differ diff --git a/Items/Weapons/Magic/SubsumingVortexSmallGlow.png b/Items/Weapons/Magic/SubsumingVortexSmallGlow.png new file mode 100644 index 0000000000..1164d9c886 Binary files /dev/null and b/Items/Weapons/Magic/SubsumingVortexSmallGlow.png differ diff --git a/Items/Weapons/Magic/TacticiansTrumpCard.cs b/Items/Weapons/Magic/TacticiansTrumpCard.cs index 59b23ff197..ecdf6fbeb6 100644 --- a/Items/Weapons/Magic/TacticiansTrumpCard.cs +++ b/Items/Weapons/Magic/TacticiansTrumpCard.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.CopperShortsword). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic Register(); CreateRecipe(). AddIngredient(ItemID.TinShortsword). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Magic/Teslastaff.cs b/Items/Weapons/Magic/Teslastaff.cs index 2611504952..c3435c626c 100644 --- a/Items/Weapons/Magic/Teslastaff.cs +++ b/Items/Weapons/Magic/Teslastaff.cs @@ -23,19 +23,20 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 166; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = 10; - Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 10; + Item.reuseDelay = 60; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.UseSound = CommonCalamitySounds.LightningSound with { Pitch = 1.1f }; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; - Item.knockBack = 0f; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; - Item.reuseDelay = 60; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/TheCauldron.cs b/Items/Weapons/Magic/TheCauldron.cs index c05c1dd41c..d3b57adcb1 100644 --- a/Items/Weapons/Magic/TheCauldron.cs +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 46); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 46); return false; } diff --git a/Items/Weapons/Magic/ThePrince.cs b/Items/Weapons/Magic/ThePrince.cs index d01a32eff6..5adda2791c 100644 --- a/Items/Weapons/Magic/ThePrince.cs +++ b/Items/Weapons/Magic/ThePrince.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.DamageType = DamageClass.Magic; Item.noMelee = true; Item.mana = 12; - Item.useTime = Item.useAnimation = 21; + Item.useAnimation = Item.useTime = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.autoReuse = true; Item.UseSound = SoundID.DD2_FlameburstTowerShot; diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index 35d5d257f3..665c7963e1 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ProjectileID.Wasp; Item.shootSpeed = 12f; + Item.knockBack = 0.25f; } public override Vector2? HoldoutOffset() => new Vector2(-15, -5); diff --git a/Items/Weapons/Magic/TomeofFates.cs b/Items/Weapons/Magic/TomeofFates.cs deleted file mode 100644 index b8e8d2c3de..0000000000 --- a/Items/Weapons/Magic/TomeofFates.cs +++ /dev/null @@ -1,84 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class TomeofFates : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetDefaults() - { - Item.width = 28; - Item.height = 30; - Item.damage = 110; - Item.DamageType = DamageClass.Magic; - Item.mana = 8; - Item.useTime = 5; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.RarityRedBuyPrice; - Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item103; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 17f; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 3; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - int i = Main.myPlayer; - float playerKnockback = knockback; - playerKnockback = player.GetWeaponKnockback(Item, playerKnockback); - player.itemTime = Item.useTime; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - Vector2 tentacleVelocity = new Vector2(mouseXDist, mouseYDist); - tentacleVelocity.Normalize(); - Vector2 tentacleRandVelocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - tentacleRandVelocity.Normalize(); - tentacleVelocity = tentacleVelocity * 4f + tentacleRandVelocity; - tentacleVelocity.Normalize(); - tentacleVelocity *= Item.shootSpeed; - int projChoice = Main.rand.Next(7); - float tentacleYDirection = (float)Main.rand.Next(10, 160) * 0.001f; - if (Main.rand.NextBool()) - { - tentacleYDirection *= -1f; - } - float tentacleXDirection = (float)Main.rand.Next(10, 160) * 0.001f; - if (Main.rand.NextBool()) - { - tentacleXDirection *= -1f; - } - if (projChoice == 0) - { - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, tentacleVelocity.X, tentacleVelocity.Y, ModContent.ProjectileType(), (int)((double)damage * 1.5f), playerKnockback, i, tentacleXDirection, tentacleYDirection); - } - else - { - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, tentacleVelocity.X, tentacleVelocity.Y, ModContent.ProjectileType(), damage, playerKnockback, i, tentacleXDirection, tentacleYDirection); - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.SpellTome). - AddIngredient(9). - AddTile(TileID.Bookcases). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index 7e3fc41370..2eb4625f80 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Magic Vector2 upperVelocityLimit = new Vector2(xVec, yVec).SafeNormalize(Vector2.UnitY) * speed; velocityReal = velocityReal.SafeNormalize(upperVelocityLimit) * speed; velocityReal = Vector2.Lerp(velocityReal, upperVelocityLimit, 0.25f); - Projectile.NewProjectile(projSource, source, velocityReal, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(projSource, source, velocityReal, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/VeeringWind.cs b/Items/Weapons/Magic/VeeringWind.cs index 7adc9d4a4d..0e4705aa56 100644 --- a/Items/Weapons/Magic/VeeringWind.cs +++ b/Items/Weapons/Magic/VeeringWind.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 19; Item.DamageType = DamageClass.Magic; Item.mana = 14; - Item.useTime = Item.useAnimation = 36; + Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 10f; diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index f5304189d4..f32aa8b0bf 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 6666; Item.DamageType = DamageClass.Magic; Item.mana = 41; - Item.useTime = Item.useAnimation = 43; + Item.useAnimation = Item.useTime = 43; Item.noUseGraphic = true; Item.channel = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index 275e0f2306..f4c89dbcc5 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -21,11 +21,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 68; - Item.damage = 256; + Item.damage = 2156; Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 25; - Item.useAnimation = 25; + Item.mana = 40; + Item.useTime = 65; + Item.useAnimation = 65; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item45; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 19f; + Item.shootSpeed = 13f; Item.rare = ModContent.RarityType(); } diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 45cc02fd5a..dffd45ed93 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -11,43 +11,37 @@ namespace CalamityMod.Items.Weapons.Magic public class VitriolicViper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Item.type] = true; - } public override void SetDefaults() { Item.width = 60; Item.height = 62; - Item.damage = 93; + Item.damage = 2893; Item.DamageType = DamageClass.Magic; - Item.mana = 15; + Item.mana = 45; Item.useTime = Item.useAnimation = 16; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 4f; - Item.UseSound = SoundID.Item46; + Item.noUseGraphic = true; + Item.channel = true; + Item.knockBack = 6.5f; + Item.UseSound = null; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = -4; i <= 4; i += 1) - { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed.X * 1.65f, perturbedSpeed.Y * 1.65f, type, (int)(damage * 0.7f), knockback * 0.7f, player.whoAmI, 0f, 0f); - } - for (int j = -2; j <= 2; j += 1) - { - Vector2 perturbedSpeed2 = velocity.RotatedBy(MathHelper.ToRadians(j)); - Projectile.NewProjectile(source, position.X, position.Y, perturbedSpeed2.X, perturbedSpeed2.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - } + Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true); + Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 0180a48fb2..d5f00474c2 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index c60e56b414..05b97f47e8 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -26,17 +26,18 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 210; Item.DamageType = DamageClass.Magic; Item.mana = 60; - Item.useTime = 49; - Item.useAnimation = 49; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.Item20; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 49; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; + + Item.UseSound = SoundID.Item20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index add4b132bf..a87fa9c177 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index e7a48dcdec..08bde482af 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index 359ed31119..08f1946933 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Items.Weapons.Magic Texture2D properSprite = RealSprite.Value; - spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); + spriteBatch.Draw(properSprite, Item.Center - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); return false; } diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index d91a6096e9..a7cee17813 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -21,15 +21,16 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 30f; + Item.UseSound = SoundID.Item13; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; - Item.knockBack = 0f; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index b2075df53f..7521476b79 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index da283e3c99..912b7417a7 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.6), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.6), knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index d02a6a5184..a39befb0d9 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee // Center projectile int centerID = ModContent.ProjectileType(); int centerDamage = (damage / 2); - Projectile.NewProjectile(source, position, velocity, centerID, centerDamage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, centerID, centerDamage, knockback, player.whoAmI); // Side projectiles (these deal 75% damage) int sideID = ModContent.ProjectileType(); @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee int trueMeleeID = ModContent.ProjectileType(); int trueMeleeDamage = (int)player.GetTotalDamage().ApplyTo(0.7f * Item.damage); var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, targetPos, Vector2.Zero, trueMeleeID, trueMeleeDamage, Item.knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, targetPos, Vector2.Zero, trueMeleeID, trueMeleeDamage, Item.knockBack, player.whoAmI); } diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 81bb2411b5..b1b41f3c1a 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 74; - Item.height = 86; + Item.width = 86; + Item.height = 98; Item.damage = 105; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/BalefulHarvester.png b/Items/Weapons/Melee/BalefulHarvester.png index 7b97d34b12..360c99acaf 100644 Binary files a/Items/Weapons/Melee/BalefulHarvester.png and b/Items/Weapons/Melee/BalefulHarvester.png differ diff --git a/Items/Weapons/Melee/BallOFugu.cs b/Items/Weapons/Melee/BallOFugu.cs index 23f0581be8..c0d446fcdf 100644 --- a/Items/Weapons/Melee/BallOFugu.cs +++ b/Items/Weapons/Melee/BallOFugu.cs @@ -1,5 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +9,15 @@ namespace CalamityMod.Items.Weapons.Melee public class BallOFugu : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public static readonly SoundStyle BlowSound = new("CalamityMod/Sounds/Item/FuguBlow") { PitchVariance = 0.1f }; + + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { Item.width = 30; Item.height = 10; - Item.damage = 40; + Item.damage = 28; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 20; Item.useAnimation = 20; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index f63ec86d3d..e050f25e6f 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -1,41 +1,41 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Basher : ModItem, ILocalizedModType + public class Basher : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { Item.width = 56; Item.height = 60; - Item.damage = 50; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 40; + Item.damage = 40; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.useTurn = true; + + Item.channel = true; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + Item.noMelee = true; + Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Poisoned, 60); - } - + public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). - AddIngredient(30). + AddIngredient(). AddIngredient(12). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 5e0f2ae32c..f27421e8d2 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); return false; } } diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index b7e5f75b48..e8e5ba8113 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(8). AddTile(). Register(); diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index 12654f8efb..9fcd169c8a 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); return false; } diff --git a/Items/Weapons/Melee/DeathsAscension.cs b/Items/Weapons/Melee/DeathsAscension.cs index f22376f9da..7ebd374b54 100644 --- a/Items/Weapons/Melee/DeathsAscension.cs +++ b/Items/Weapons/Melee/DeathsAscension.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 70; Item.damage = 1200; Item.knockBack = 9f; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.channel = true; @@ -84,15 +84,20 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = velocity.X + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); float SpeedY = velocity.Y + Main.rand.NextFloat(-spreadfactor, spreadfactor + 1); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.125f), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.125f), knockback, player.whoAmI); } } else { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } + + public override void UseItemFrame(Player player) + { + player.itemLocation = (Vector2)player.HandPosition; + } public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Devastation.cs b/Items/Weapons/Melee/Devastation.cs index e6179dfa09..4f26757aa1 100644 --- a/Items/Weapons/Melee/Devastation.cs +++ b/Items/Weapons/Melee/Devastation.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee default: break; } - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer); float projSpeed = Item.shootSpeed; Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 0631ea083b..a5a7a08866 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -53,7 +53,6 @@ namespace CalamityMod.Items.Weapons.Melee AddIngredient(ItemID.Flairon). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(4). AddIngredient(5). AddTile(). diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 4081665059..649a605bf3 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Melee knifeSpawnYPos *= mouseDistance; float x4 = realPlayerPos.X; float y4 = realPlayerPos.Y; - Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index a37ecdd797..ea2efddce5 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -1,7 +1,11 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; +using Steamworks; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,68 +15,101 @@ namespace CalamityMod.Items.Weapons.Melee [LegacyName("XerocsGreatsword")] public class EntropicClaymore : ModItem, ILocalizedModType { + private int swordDirection; + public int time = 0; + private float swingRotation = 0; public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { Item.width = 130; - Item.height = 106; - Item.damage = 90; + Item.height = 130; + Item.damage = 96; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 26; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 26; + Item.useTime = 30; Item.useTurn = true; Item.knockBack = 5.25f; - Item.UseSound = SoundID.Item1; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/SwingMid") with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - hitbox = CalamityUtils.FixSwingHitbox(118, 118); + //int hitX = (int)(player.itemLocation + (swingRotation + MathHelper.ToRadians(90f)).ToRotationVector2() * 90).X; + //int hitY = (int)(player.itemLocation + (swingRotation + MathHelper.ToRadians(90f)).ToRotationVector2() * 90).Y; + //hitbox = new Rectangle(hitX, hitY, Item.width / 3, Item.height / 3); + + //Particle spark2 = new GlowOrbParticle(new Vector2(hitX, hitY), Vector2.Zero, false, 5, 1, Color.Red); + //GeneralParticleHandler.SpawnParticle(spark2); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int projAmt = Main.rand.Next(4, 6); - for (int index = 0; index < projAmt; ++index) + for (int i = 0; i < 6; i++) { - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - float damageMult = 0.5f; - switch (index) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - damageMult = 0.65f; - break; - case 2: - type = ModContent.ProjectileType(); - damageMult = 0.8f; - break; - default: - break; - } - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.7f, 1.1f), type, damage / 2, knockback * 0.5f, player.whoAmI, 0f, 0f); } return false; } + public override void UseAnimation(Player player) + { + swordDirection = (player.Center - player.Calamity().mouseWorld).X > 1 ? -1 : 1; + time = 0; + swingRotation = 0; + } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Shadowflame); - } - } + player.itemRotation = swingRotation - 1.7f * swordDirection; + player.itemLocation = player.Center; + player.direction = swordDirection; + float val = MathF.Abs(time - player.itemAnimationMax * 0.75f) / player.itemAnimationMax; + + float goalRot = Utils.Remap(time, 0, player.itemAnimationMax, -0.5f, 4.9f * swordDirection); + float swingEasing = Utils.GetLerpValue(0, player.itemAnimationMax * 0.4f, time, true) * (0.5f - val); + if (time < player.itemAnimationMax) + { + swingRotation = MathHelper.Lerp(swingRotation, goalRot, swingEasing); + } + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, swingRotation + MathHelper.ToRadians(120f * swordDirection)); + + if (Main.rand.NextBool()) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 66); + dust.scale = Main.rand.NextFloat(0.5f, 0.75f); + dust.velocity = dustVel * 0.85f; + dust.color = Color.LightGreen; + dust.noGravity = true; + } + if (Main.rand.NextBool()) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + + float partScale = Main.rand.NextFloat(0.6f, 0.9f); + Vector2 partVel = (dustVel * Main.rand.NextFloat(0.2f, 0.3f)).RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedByRandom(-0.4) * -3; + Vector2 partPos = player.Center + dustVel * 25 + Main.rand.NextVector2Circular(12, 12); + + Particle spark3 = new AltSparkParticle(partPos, partVel, false, 24, partScale, Color.Black); + GeneralParticleHandler.SpawnParticle(spark3); + Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen); + GeneralParticleHandler.SpawnParticle(spark2); + } + Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); + + float partScale2 = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 partVel2 = dustVel2 * Main.rand.NextFloat(0.2f, 0.3f); + Particle smoke = new HeavySmokeParticle(player.Center + dustVel2 * 20 + Main.rand.NextVector2Circular(12, 12), partVel2.RotatedBy(MathHelper.ToRadians(90f * swordDirection)).RotatedBy(-0.3 * swordDirection) * -5, Color.Black, 19, partScale2, 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + time++; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 4aab4c5fdb..8c5022575a 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee type = ModContent.ProjectileType(); break; } - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 3b47ca0784..f531b3b86b 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/ExobladeGlow").Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request("CalamityMod/Items/Weapons/Melee/ExobladeGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index cf6602e1e3..67930b7773 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index c4d9e656db..54745229f2 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee //NOTE: GetWeaponDamage is in the CalamityPlayer file public override void SetDefaults() { - Item.width = 112; - Item.height = 102; + Item.width = 108; + Item.height = 100; Item.damage = BaseDamage; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 13; diff --git a/Items/Weapons/Melee/GaelsGreatsword.png b/Items/Weapons/Melee/GaelsGreatsword.png index 5af2cc305c..246cda9d6c 100644 Binary files a/Items/Weapons/Melee/GaelsGreatsword.png and b/Items/Weapons/Melee/GaelsGreatsword.png differ diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index b2ded44e87..f05cd26e61 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -1,31 +1,92 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Melee { public class GreatswordofJudgement : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + private float swingRoatation = 0; + private int time = 0; + private Color mainColor; + private int swordDirection; + private int useTime = 20; + private int opacityAdjust = 0; + private float smearOpacity = 0; + private bool smearGrowth = true; public override void SetDefaults() { Item.width = 78; Item.height = 78; - Item.damage = 85; + Item.damage = 155; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; + Item.useAnimation = Item.useTime = useTime; Item.useTurn = true; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; + Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; + Item.shootSpeed = 5f; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + float scale = 1.1f; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } + public override void UseAnimation(Player player) + { + swordDirection = player.direction; + time = 0; + swingRoatation = 0; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + opacityAdjust = 0; + smearOpacity = 0; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + opacityAdjust++; + if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) + smearOpacity += 0.1f; + else if (smearOpacity > 0) + smearOpacity -= 0.2f; + time++; + swingRoatation += swordDirection == 1 ? 0.13f : -0.13f; + + float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; + if (swordDirection != player.direction) + { + swingRoatation *= -1; + swordDirection = player.direction; + } + Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(1.95f, 2.2f), new Vector2(1, 1), 2, true, false, true, player.direction); + GeneralParticleHandler.SpawnParticle(Smear); + + if (Main.rand.NextBool(3)) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f); + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); + dust.scale = Main.rand.NextFloat(0.4f, 0.55f); + dust.velocity = dustVel * 0.55f; + dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + dust.noGravity = true; + } + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value); + } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Melee/GreatswordofJudgementGlow.png b/Items/Weapons/Melee/GreatswordofJudgementGlow.png index fde78a59ec..346b28b3a3 100644 Binary files a/Items/Weapons/Melee/GreatswordofJudgementGlow.png and b/Items/Weapons/Melee/GreatswordofJudgementGlow.png differ diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index bfe5859fd8..0cefd12175 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee default: break; } - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 9a42ae4f2e..abdee71ea0 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 124; Item.damage = 795; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useTime = Item.useAnimation = 71; + Item.useAnimation = Item.useTime = 71; Item.useTurn = true; Item.knockBack = 13f; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/HolyCollider.png b/Items/Weapons/Melee/HolyCollider.png index 713bd1e425..44fc67fa01 100644 Binary files a/Items/Weapons/Melee/HolyCollider.png and b/Items/Weapons/Melee/HolyCollider.png differ diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index 2b39aa7796..c4ab7a0c15 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee knifeSpawnYPos *= mouseDistance; float x4 = realPlayerPos.X; float y4 = realPlayerPos.Y; - Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 89be9745df..f127aea5dd 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -1,7 +1,9 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,21 +17,26 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 70; - Item.damage = 198; + Item.damage = 417; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 13; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 8f; + Item.knockBack = 12f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shootSpeed = 18f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, 0); + return false; + } } } diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index 5b06e0992b..0d1e6e1441 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2 && !player.HasCooldown(LionHeartShield.ID) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index 4c8cc3be64..e088461822 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -2,54 +2,42 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using CalamityMod.Items.BaseItems; using Terraria.ModLoader; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using CalamityMod.Balancing; +using Terraria.Audio; +using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Particles; namespace CalamityMod.Items.Weapons.Melee { - public class MantisClaws : ModItem, ILocalizedModType + public class MantisClaws : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { + base.SetDefaults(); Item.width = 26; Item.height = 20; - Item.damage = 144; + Item.damage = 111; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 8; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 8; - Item.useTurn = true; - Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; + Item.useAnimation = Item.useTime = 25; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + + Item.useStyle = ItemUseStyleID.HiddenAnimation; Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Water); - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - var source = player.GetSource_ItemUse(Item); - - //does no damage. Explosion is visual - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - target.AddBuff(BuffID.OnFire3, 300); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - - //does no damage. Explosion is visual - Projectile.NewProjectile(source, target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - target.AddBuff(BuffID.OnFire3, 300); - } + public override bool AltFunctionUse(Player player) => true; } } diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 68f155fd79..beda17aa01 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,8 +1,6 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -32,12 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int conDamage = target.damage + baseDamage; diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index a039ce5e46..6e282fc6a9 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -37,8 +37,8 @@ namespace CalamityMod.Items.Weapons.Melee { float ai3 = (Main.rand.NextFloat() - 0.75f) * 0.7853982f; //0.5 float ai3X = (Main.rand.NextFloat() - 0.25f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3X); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3X); return false; } diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 178e3f5df1..aec2123d1a 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -100,11 +100,5 @@ namespace CalamityMod.Items.Weapons.Melee return false; return IDUnlocked(player); } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } } } diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index 8e36c516f2..b6c96a6a50 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; //0.5 - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, ai3); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai3); return false; } } diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 01acc2a755..59958717aa 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -2,8 +2,17 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.Audio; using Terraria.ID; +using Microsoft.Xna.Framework; using Terraria.ModLoader; +using CalamityMod.Particles; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Basic.Reference.Assemblies; +using System; +using Mono.Cecil; namespace CalamityMod.Items.Weapons.Melee { @@ -11,23 +20,104 @@ namespace CalamityMod.Items.Weapons.Melee public class Orderbringer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + private float swingRoatation = 0; + private int time = 0; + private Color mainColor; + private int swordDirection; + private int useTime = 18; + private int opacityAdjust = 0; + private float smearOpacity = 0; + private bool smearGrowth = true; public override void SetDefaults() { Item.width = Item.height = 108; - Item.damage = 128; + Item.damage = 400; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 18; + Item.useAnimation = Item.useTime = useTime; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 18; Item.useTurn = true; - Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 8f; + Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5.5f; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f); + + for (int i = 0; i < 4; i++) + { + Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f); + Projectile.NewProjectile(source, Main.MouseWorld - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1); + } + return false; + } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + float scale = 1.2f; + Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; + hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + } + public override void UseAnimation(Player player) + { + swordDirection = player.direction; + time = 0; + swingRoatation = 0; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + opacityAdjust = 0; + smearOpacity = 0; + } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + opacityAdjust++; + if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) + smearOpacity += 0.1f; + else if (smearOpacity > 0) + smearOpacity -= 0.2f; + + time++; + swingRoatation += swordDirection == 1 ? 0.17f : -0.17f; + + float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; + if (swordDirection != player.direction) + { + swingRoatation *= -1; + swordDirection = player.direction; + } + Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(2.8f, 3.2f), new Vector2(1, 1), 2, true, false, true, player.direction); + GeneralParticleHandler.SpawnParticle(Smear); + + if (Main.rand.NextBool()) + { + Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; + Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); + dust.scale = Main.rand.NextFloat(0.5f, 0.75f); + dust.velocity = dustVel * 0.55f; + dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + dust.noGravity = true; + } + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + int beamDamage = player.CalcIntDamage(Item.damage); + for (int i = 0; i < 2; i++) + { + Vector2 targetPos = Main.MouseWorld; + NPC target2 = Main.MouseWorld.ClosestNPCAt(650); + if (target2 != null) + targetPos = target2.Center + target2.velocity * 14; + + Vector2 spawnPos = Main.MouseWorld + new Vector2(Main.rand.NextFloat(-300, 300), -900); + Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; + Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); + } + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Pandemic.cs b/Items/Weapons/Melee/Pandemic.cs index 074f44af79..794fbeedd3 100644 --- a/Items/Weapons/Melee/Pandemic.cs +++ b/Items/Weapons/Melee/Pandemic.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,5 +40,15 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Yellow; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.HiveFive). + AddIngredient(10). + AddIngredient(6). + AddTile(TileID.MythrilAnvil). + Register(); + } } } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index 81ad513f31..64c63a9c01 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.height = 50; Item.damage = 699; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 13; + Item.useAnimation = Item.useTime = 13; Item.useTurn = true; Item.DamageType = MeleeRangedHybridDamageClass.Instance; Item.knockBack = 7f; diff --git a/Items/Weapons/Melee/RemsRevenge.cs b/Items/Weapons/Melee/RemsRevenge.cs index be3714e311..27da6eb01b 100644 --- a/Items/Weapons/Melee/RemsRevenge.cs +++ b/Items/Weapons/Melee/RemsRevenge.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria.ID; using Terraria.ModLoader; @@ -8,11 +8,12 @@ namespace CalamityMod.Items.Weapons.Melee public class RemsRevenge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { Item.width = 44; Item.height = 34; - Item.damage = 375; + Item.damage = 188; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 15; Item.useAnimation = 15; diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index 57bdf30542..6b9de5cab9 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -35,11 +35,10 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 2; i++) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, (i == 0f).ToDirectionInt()); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, (i == 0f).ToDirectionInt()); // Create a third, final whip that does not swing around at all and instead simply flies towards the mouse. - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; + return true; } } } diff --git a/Items/Weapons/Melee/ElementalShiv.cs b/Items/Weapons/Melee/StarburstShiv.cs similarity index 88% rename from Items/Weapons/Melee/ElementalShiv.cs rename to Items/Weapons/Melee/StarburstShiv.cs index 364819f8b4..bc484097bc 100644 --- a/Items/Weapons/Melee/ElementalShiv.cs +++ b/Items/Weapons/Melee/StarburstShiv.cs @@ -6,8 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - [LegacyName("ElementalShortsword")] - public class ElementalShiv : ModItem, ILocalizedModType + [LegacyName("ElementalShortsword", "ElementalShiv")] + public class StarburstShiv : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.damage = 138; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 13; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2.4f; Item.knockBack = 8.5f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/ElementalShiv.png b/Items/Weapons/Melee/StarburstShiv.png similarity index 100% rename from Items/Weapons/Melee/ElementalShiv.png rename to Items/Weapons/Melee/StarburstShiv.png diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index 6e2e7945b2..740c81d44c 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -13,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 90; - Item.height = 100; + Item.width = 100; + Item.height = 118; Item.damage = 450; Item.DamageType = DamageClass.Melee; Item.useAnimation = 25; @@ -34,12 +35,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 300); if (player.whoAmI == Main.myPlayer) SpawnFlaresNPC(player, Item.knockBack, GetOnHitDamage(player), target); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { + target.AddBuff(ModContent.BuffType(), 300); if (player.whoAmI == Main.myPlayer) SpawnFlaresPvp(player, Item.knockBack, GetOnHitDamage(player), target); } diff --git a/Items/Weapons/Melee/StellarStriker.png b/Items/Weapons/Melee/StellarStriker.png index f8932765d9..766388eebb 100644 Binary files a/Items/Weapons/Melee/StellarStriker.png and b/Items/Weapons/Melee/StellarStriker.png differ diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index f155315a5f..406c384d6d 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * 0.8), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.8), knockback, player.whoAmI); Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); Vector2 targetPos = Main.MouseWorld + new Vector2(Main.rand.Next(-30, 31), Main.rand.Next(-30, 31)); diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 80d41b8d03..55e29d8ac4 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -59,8 +59,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(ItemID.TerraBlade). + AddIngredient(9). AddIngredient(7). AddTile(TileID.LunarCraftingStation). Register(); diff --git a/Items/Weapons/Melee/TheDarkMaster.cs b/Items/Weapons/Melee/TheDarkMaster.cs index e37cb358fb..fa651fd0a3 100644 --- a/Items/Weapons/Melee/TheDarkMaster.cs +++ b/Items/Weapons/Melee/TheDarkMaster.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee int baseMaxHealth = 400; int bonusHealth = player.statLifeMax2 - baseMaxHealth; float bonusDamage = DamagePerHealth * bonusHealth; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * (1 + bonusDamage)), knockback, player.whoAmI, 0, 0); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * (1 + bonusDamage)), knockback, player.whoAmI); } // still play the sound if the clones are out since they always fire beams else if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs similarity index 78% rename from Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs rename to Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs index e6a4b2eb9f..79c4d7031b 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs @@ -2,26 +2,28 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TriactisTruePaladinianMageHammerofMightMelee : ModItem, ILocalizedModType + [LegacyName("TriactisTruePaladinianMageHammerofMightMelee")] + public class TriactisTruePaladinianMageHammerofMight : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetDefaults() { - Item.width = 160; - Item.height = 160; - Item.damage = 2000; + Item.width = 168; + Item.height = 168; + Item.damage = 5000; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 36; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 10; - Item.knockBack = 50f; + Item.knockBack = 14f; Item.UseSound = SoundID.Item1; Item.DamageType = DamageClass.MeleeNoSpeed; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.png b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.png new file mode 100644 index 0000000000..25daefa6fc Binary files /dev/null and b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.png differ diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png deleted file mode 100644 index 60e00a746b..0000000000 Binary files a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index 01cd0c49bd..3b237302bb 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,11 +9,12 @@ namespace CalamityMod.Items.Weapons.Melee public class Tumbleweed : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { Item.width = 44; Item.height = 36; - Item.damage = 125; + Item.damage = 63; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useTime = 20; Item.useAnimation = 20; diff --git a/Items/Weapons/Melee/UrchinFlail.cs b/Items/Weapons/Melee/UrchinFlail.cs deleted file mode 100644 index 5be6cbaa01..0000000000 --- a/Items/Weapons/Melee/UrchinFlail.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class UrchinFlail : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetDefaults() - { - Item.width = 44; - Item.height = 36; - Item.damage = 20; - Item.DamageType = DamageClass.MeleeNoSpeed; - Item.useTime = 25; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.knockBack = 6f; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.channel = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; - } - } -} diff --git a/Items/Weapons/Melee/UrchinFlail.png b/Items/Weapons/Melee/UrchinFlail.png deleted file mode 100644 index 3079ad4adb..0000000000 Binary files a/Items/Weapons/Melee/UrchinFlail.png and /dev/null differ diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index abea666477..9947723237 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - [LegacyName("RedtideSword")] + [LegacyName("RedtideSword", "UrchinFlail")] public class UrchinMace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; diff --git a/Items/Weapons/Melee/Virulence.cs b/Items/Weapons/Melee/Virulence.cs index da76d26a24..0930f099b3 100644 --- a/Items/Weapons/Melee/Virulence.cs +++ b/Items/Weapons/Melee/Virulence.cs @@ -2,7 +2,6 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -31,11 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Yellow; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.85), knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => damage = (int)(damage * 0.85); public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index b6e7a31af2..4254bd8158 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using CalamityMod.Projectiles.Melee.Spears; using Microsoft.Xna.Framework; using Terraria; @@ -17,13 +17,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + // Flail already does half damage. No tooltip mutliplier required. } public override void SetDefaults() { Item.width = 42; Item.height = 62; - Item.damage = 30; // Spear is 20 damage, Flail is 30 damage + Item.damage = 30; Item.knockBack = 5f; Item.useAnimation = Item.useTime = 22; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Green; Item.Calamity().donorItem = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = ShootSpeed; } @@ -75,9 +76,9 @@ namespace CalamityMod.Items.Weapons.Melee { float speedMult = SpearSpeed / ShootSpeed; if (player.altFunctionUse == 2) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X * speedMult, velocity.Y * speedMult, ModContent.ProjectileType(), (int)(damage * 0.666666f), knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity * speedMult, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.5f), knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 72672b11ce..d0e2d11a52 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -5,7 +5,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -55,18 +54,15 @@ namespace CalamityMod.Items.Weapons.Ranged Register(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - int card = Utils.SelectRandom(Main.rand, new int[] + type = Utils.SelectRandom(Main.rand, new int[] { ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType() }); - - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, card, damage, knockback, player.whoAmI, 0f, 0f); - return false; } } } diff --git a/Items/Weapons/Ranged/AcidwoodBow.cs b/Items/Weapons/Ranged/AcidwoodBow.cs index f57096b36e..9d09a4d608 100644 --- a/Items/Weapons/Ranged/AcidwoodBow.cs +++ b/Items/Weapons/Ranged/AcidwoodBow.cs @@ -1,10 +1,7 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Placeables; namespace CalamityMod.Items.Weapons.Ranged { @@ -32,11 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; - } public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.cs b/Items/Weapons/Ranged/ArcNovaDiffuser.cs index 2ce192c482..18b34004c5 100644 --- a/Items/Weapons/Ranged/ArcNovaDiffuser.cs +++ b/Items/Weapons/Ranged/ArcNovaDiffuser.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 28; Item.damage = 172; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = AftershotCooldownFrames; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 72e9b8da2c..621e409326 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -40,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index b65b6d0d34..1d5ca3004e 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 695; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.knockBack = 10f; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index d258ec492c..12d468c942 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -36,9 +36,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 9b506a0690..5e3de62293 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 54; Item.height = 28; - Item.damage = 50; + Item.damage = 52; Item.channel = true; Item.DamageType = DamageClass.Ranged; Item.useTime = 20; diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index b17ee348e4..c01ff0e243 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -63,11 +63,11 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 3.15f), knockback * 60f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 3.15f), knockback * 60f, player.whoAmI); } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index a985c94a1d..4bee81bf6d 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -19,17 +19,18 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 64; Item.height = 24; Item.damage = 1; - Item.knockBack = 0f; - Item.useTime = Item.useAnimation = 75; Item.DamageType = DamageClass.Ranged; - Item.noMelee = true; - Item.autoReuse = true; - Item.useAmmo = AmmoID.Bullet; - Item.shootSpeed = 9f; + Item.useAnimation = Item.useTime = 75; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 9f; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item38; + Item.useStyle = ItemUseStyleID.Shoot; + Item.autoReuse = true; + Item.noMelee = true; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 5d4b85312a..943a5d6da8 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 126; Item.height = 42; - Item.damage = 290; + Item.damage = 277; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 33; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -27,58 +27,20 @@ namespace CalamityMod.Items.Weapons.Ranged // No use sound is intentional Item.autoReuse = true; Item.shootSpeed = 14.5f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Rocket; Item.channel = true; - } - - public override void HoldItem(Player player) - { - Item.channel = player.altFunctionUse != 2; - Item.noUseGraphic = player.altFunctionUse != 2; + Item.noUseGraphic = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); - public override bool AltFunctionUse(Player player) => true; - - // Right click doesn't use ammo because it's a detonation signal. - public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse != 2; - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 || player.altFunctionUse == 2; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Play a sound and detonate all in-flight rockets, but don't shoot anything. - if (player.altFunctionUse == 2) - { - SoundEngine.PlaySound(SoundID.Item110, position); - DetonateRockets(player); - return false; - } - - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 1); - // Otherwise just play a grenade launcher sound and fire a rocket. - //Main.PlaySound(SoundID.Item61, position); - //Projectile.NewProjectile(source, position, velocity, item.shoot, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, 0, 0f, player.whoAmI, 1); return false; } - - private void DetonateRockets(Player player) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner != player.whoAmI || p.type != Item.shoot) - continue; - - // All rockets will instantly explode on the next frame and send packets to indicate as such. - p.timeLeft = 1; - p.netUpdate = true; - p.netSpam = 0; - } - } - - // Right clicking to detonate all rockets is very fast. - public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; } } diff --git a/Items/Weapons/Ranged/ElementalEruption.cs b/Items/Weapons/Ranged/ChromaticEruption.cs similarity index 91% rename from Items/Weapons/Ranged/ElementalEruption.cs rename to Items/Weapons/Ranged/ChromaticEruption.cs index e282838825..e0184292d8 100644 --- a/Items/Weapons/Ranged/ElementalEruption.cs +++ b/Items/Weapons/Ranged/ChromaticEruption.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class ElementalEruption : ModItem, ILocalizedModType + [LegacyName("ElementalEruption")] + public class ChromaticEruption : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; Item.useAmmo = AmmoID.Gel; Item.channel = true; @@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); return false; } diff --git a/Items/Weapons/Ranged/ElementalEruption.png b/Items/Weapons/Ranged/ChromaticEruption.png similarity index 100% rename from Items/Weapons/Ranged/ElementalEruption.png rename to Items/Weapons/Ranged/ChromaticEruption.png diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index 70569df399..0e19d9b1a0 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -48,9 +48,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 64b5d58268..d2de85e06e 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 96; Item.damage = 770; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 8adb29a61a..e9397aeaca 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 42; Item.damage = 2130; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.channel = true; Item.noMelee = true; diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index f8fe958161..b17656f8cf 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 2413651e0e..8a79b82295 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 7fa53c9b10..0574340fcb 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 960908d2c8..960f51a999 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[index].noDropItem = true; } - int projectile = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); + int projectile = Projectile.NewProjectile(source, position, velocity, ProjectileID.CrystalDart, damage / 2, knockback, player.whoAmI); Main.projectile[projectile].penetrate = 3; return false; } diff --git a/Items/Weapons/Ranged/DeadSunsWind.cs b/Items/Weapons/Ranged/DeadSunsWind.cs index 8e81c00b99..c0d52dc602 100644 --- a/Items/Weapons/Ranged/DeadSunsWind.cs +++ b/Items/Weapons/Ranged/DeadSunsWind.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 24; Item.damage = 100; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 22; + Item.useAnimation = Item.useTime = 22; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index b1f059e43b..cd98650a7f 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.ArmorPenetration = 10; Item.DamageType = DamageClass.Ranged; Item.noMelee = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index e7d1ad1b07..da6ae6271a 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } return false; diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 5a17b2119f..6a6d5e6b82 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -40,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 79febc9ceb..3d8c6bff62 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 46; Item.damage = 239; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 6; + Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 707d82448f..8f81cd8cff 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -37,22 +37,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 152; + Item.height = 58; Item.damage = 124; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = OriginalUseTime; + Item.useAnimation = Item.useTime = OriginalUseTime; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.width = 152; - Item.height = 58; + Item.useAmmo = AmmoID.Rocket; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f }; + Item.useStyle = ItemUseStyleID.Shoot; + Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; - Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f }; } // Obviously we don't want multiple holdouts existing at the same time. diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index 78d2f57a2b..fc7d92f5ec 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -30,22 +30,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { + Item.width = 88; + Item.height = 28; Item.damage = 73; // Here you're modifying the shrapnel's damage. Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 44; + Item.useAnimation = Item.useTime = 44; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.width = 88; - Item.height = 28; + Item.useAmmo = AmmoID.Rocket; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.7f, PitchVariance = 0.1f }; + Item.useStyle = ItemUseStyleID.Shoot; + Item.channel = true; Item.noMelee = true; Item.noUseGraphic = true; - Item.channel = true; - Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.7f, PitchVariance = 0.1f }; } // Obviously we don't want multiple holdouts existing at the same time. diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index d2d1e03035..2505faba24 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -2,7 +2,6 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -42,11 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Spawning the holdout cannot consume ammo public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextBool() && player.ownedProjectileCounts[Item.shoot] > 0; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => type = Item.shoot; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index b7142eaa2b..830466446c 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -39,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index 9db3fecab5..175b7691be 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + (float)Main.rand.Next(-25, 26) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index f332f79ce0..45ca6ba331 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -4,7 +4,6 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -42,10 +41,10 @@ namespace CalamityMod.Items.Weapons.Ranged // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 15; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - Projectile.NewProjectile(source, position + player.DirectionTo(Main.MouseWorld) * 48f, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; + position += velocity.SafeNormalize(Vector2.UnitX) * 48f; + type = Item.shoot; } public override Vector2? HoldoutOffset() => new Vector2(-33, 0); diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index 6ec064fecf..42ce03ed24 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -10,121 +12,62 @@ namespace CalamityMod.Items.Weapons.Ranged public class Hellborn : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public const float ExplosionDamageMultiplier = 3f; + public override void SetStaticDefaults() => ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; public override void SetDefaults() { Item.width = 62; Item.height = 34; - Item.damage = 20; + Item.damage = 475; Item.DamageType = DamageClass.Ranged; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 2f; + Item.knockBack = 2.5f; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.UseSound = SoundID.Item11; + + Item.noMelee = true; + Item.UseSound = null; + Item.noUseGraphic = true; + Item.channel = true; Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; + + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } - - public override float UseTimeMultiplier(Player player) => 1f - 0.5f * (player.Calamity().hellbornBoost * (1f / 600f)); - - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage *= 1f + player.Calamity().hellbornBoost * (1f / 600f); - - public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback *= 1f + (player.Calamity().hellbornBoost * (1f / 600f)); - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - //Custom melee hitbox - public override bool? CanHitNPC(Player player, NPC target) + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) { - Rectangle targetHitbox = target.Hitbox; + if (player.whoAmI != Main.myPlayer) + return; - float collisionPoint = 0f; - float gunLength = 66f; - float gunHeight = 15; + // Right-click channeling + player.Calamity().rightClickListener = true; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), player.MountedCenter, player.MountedCenter + ((player.itemRotation + (player.direction < 0 ? MathHelper.Pi : 0f)).ToRotationVector2() * gunLength), gunHeight, ref collisionPoint) ? null : false; + if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse) + { + // Only one out at a time + if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) + return; + + var source = player.GetSource_ItemUse(player.ActiveItem()); + Projectile holdout = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, Item.shoot, player.ActiveItem().damage, 0f, player.whoAmI, 0, 0, 5); + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + } } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int index = 0; index < 3; index++) - { - float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; + // Only one out at a time + if (Main.projectile.Any(n => n.active && n.type == Item.shoot && n.owner == player.whoAmI)) + return false; - if (type == ProjectileID.Bullet) - { - int bullet = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockback, player.whoAmI); - Main.projectile[bullet].usesLocalNPCImmunity = true; - Main.projectile[bullet].localNPCHitCooldown = 10; - } - else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - } + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, 0); + + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - player.Calamity().hellbornBoost = 600; - modifiers.SourceDamage *= ExplosionDamageMultiplier; - int touchDamage = player.CalcIntDamage(Item.damage); - player.ApplyDamageToNPC(target, touchDamage, 0f, 0, false); - float firstDustScale = 3.4f; - float secondDustScale = 1.6f; - float thirdDustScale = 4f; - Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); - Vector2 dustVelocity = dustRotation * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - for (int i = 0; i < 80; i++) - { - int contactDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale); - Dust dust = Main.dust[contactDust]; - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * target.width / 2f; - dust.noGravity = true; - dust.velocity.Y -= 6f; - dust.velocity *= 3f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - contactDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale); - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * target.width / 2f; - dust.velocity.Y -= 6f; - dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - } - for (int j = 0; j < 40; j++) - { - int contactDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale); - Dust dust = Main.dust[contactDust2]; - dust.position = target.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(target.velocity.ToRotation()) * target.width / 3f; - dust.noGravity = true; - dust.velocity.Y -= 6f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - } - } - - public override void ModifyHitPvp(Player player, Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 10; - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire3, 360); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(BuffID.OnFire3, 360); - } } } diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 0dbfca56dd..dfb6c5bb78 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index c98cb01137..3532b9c371 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } diff --git a/Items/Weapons/Ranged/MagnaCannon.cs b/Items/Weapons/Ranged/MagnaCannon.cs index aa926fe2ab..11c969a986 100644 --- a/Items/Weapons/Ranged/MagnaCannon.cs +++ b/Items/Weapons/Ranged/MagnaCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 30; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = AftershotCooldownFrames; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index f23f2fe0e1..c329d10c8c 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -5,7 +5,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,11 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged return new Vector2(-30, -10); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => type = Item.shoot; public override bool CanConsumeAmmo(Item ammo, Player player) { diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index b436e97fcf..e9fe5a2b9f 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -48,5 +49,15 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BeesKnees). + AddIngredient(10). + AddIngredient(5). + AddTile(TileID.MythrilAnvil). + Register(); + } } } diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index 2b06fe3f35..65cb759423 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.damage = 85; Item.DamageType = DamageClass.Ranged; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 60; + Item.useAnimation = Item.useTime = 60; Item.shootSpeed = 25f; Item.knockBack = 20f; diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index 76e1a08c05..231d923c00 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/NitroExpressRifle.cs b/Items/Weapons/Ranged/NitroExpressRifle.cs index c7111ac95b..ff238ab26a 100644 --- a/Items/Weapons/Ranged/NitroExpressRifle.cs +++ b/Items/Weapons/Ranged/NitroExpressRifle.cs @@ -8,7 +8,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -63,15 +62,11 @@ namespace CalamityMod.Items.Weapons.Ranged Register(); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - Vector2 recoilVelocity = velocity; - recoilVelocity.Normalize(); - player.velocity += -recoilVelocity * 7f; + player.velocity += velocity.SafeNormalize(Vector2.UnitX) * -7f; if (type == ProjectileID.Bullet) type = ModContent.ProjectileType(); - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f); - return false; } public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; diff --git a/Items/Weapons/Ranged/NullificationPistol.cs b/Items/Weapons/Ranged/NullificationPistol.cs index cca4e3d8c1..782617b3cb 100644 --- a/Items/Weapons/Ranged/NullificationPistol.cs +++ b/Items/Weapons/Ranged/NullificationPistol.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 590aa09ec2..4dddf0b7fd 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -42,13 +42,13 @@ namespace CalamityMod.Items.Weapons.Ranged int shardDamage = (int)(2.5f * damage); float shardKB = 2f * knockback; Vector2 offset = new Vector2(Main.rand.Next(-25, 26) * 0.05f, Main.rand.Next(-25, 26) * 0.05f); - Projectile shard = Projectile.NewProjectileDirect(source, position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Projectile shard = Projectile.NewProjectileDirect(source, position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI); shard.timeLeft = (int)(shard.timeLeft * 1.25f); for (int i = 0; i < 4; i++) { offset = new Vector2(Main.rand.Next(-45, 46) * 0.05f, Main.rand.Next(-45, 46) * 0.05f); - Projectile.NewProjectile(source, position, velocity + offset, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity + offset, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index dd8f167c67..175f3a44a0 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 90; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged // The shard deals 145% damage and double knockback int shardDamage = (int)(1.45f * damage); float shardKB = 2f * knockback; - Projectile shard = Projectile.NewProjectileDirect(source, position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + Projectile shard = Projectile.NewProjectileDirect(source, position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI); shard.timeLeft = (int)(shard.timeLeft * 1.4f); // Fire three symmetric pairs of bullets alongside it @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Weapons.Ranged float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); Vector2 ccwVelocity = velocity.RotatedBy(-randAngle) * randVelMultiplier; Vector2 cwVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; - Projectile.NewProjectile(source, position, ccwVelocity, type, damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position, cwVelocity, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, ccwVelocity, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, cwVelocity, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index 2367059962..44645c6aa9 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 24; Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = AftershotCooldownFrames; + Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index 0ffc14bb2c..c5874559cb 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 28; Item.damage = 5; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 2; + Item.useAnimation = Item.useTime = 2; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (fireShot) - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.03f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.03f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); fireShot = !fireShot; return false; } diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index 7abf74ebcb..4f43ec9828 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -39,12 +40,22 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(12). + AddIngredient(7). + AddTile(TileID.MythrilAnvil). + Register(); + } } } diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 7a8aab8725..5e21eea385 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index b65537e9bf..5448aaed46 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.damage = 495; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = LightBombCooldown; + Item.useAnimation = Item.useTime = LightBombCooldown; Item.shootSpeed = 6f; Item.knockBack = 2f; Item.shoot = ModContent.ProjectileType(); @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Ranged/PlagueTaintedSMG.cs b/Items/Weapons/Ranged/PlagueTaintedSMG.cs index 1eb3e132a5..52362ce453 100644 --- a/Items/Weapons/Ranged/PlagueTaintedSMG.cs +++ b/Items/Weapons/Ranged/PlagueTaintedSMG.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 50; Item.damage = 78; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 12; + Item.useAnimation = Item.useTime = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index 7427e49ab6..2deeabc7b3 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -1,18 +1,12 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using CalamityMod.NPCs.NormalNPCs; +using System.Collections.Generic; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.Items.Weapons.Ranged { @@ -37,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 38; Item.height = 34; - Item.damage = 35; + Item.damage = 41; Item.DamageType = DamageClass.Ranged; Item.useTime = SetUseTime; diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index 01025b4751..365e5ce5f2 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -4,7 +4,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.shoot = ProjectileID.PurificationPowder; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; @@ -41,12 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => type = Item.shoot; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index 0a5727550b..c6054acec0 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Scorpio.cs b/Items/Weapons/Ranged/Scorpio.cs index 3f01345339..250db8b8fa 100644 --- a/Items/Weapons/Ranged/Scorpio.cs +++ b/Items/Weapons/Ranged/Scorpio.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 33; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = OriginalUseTime; + Item.useAnimation = Item.useTime = OriginalUseTime; Item.shoot = ProjectileType(); Item.shootSpeed = 15f; Item.knockBack = 6.5f; diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index c714e4e168..37e48e4060 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -70,11 +70,11 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(damage * 1.22f), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), (int)(damage * 1.22f), knockback, player.whoAmI); } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f, 0f); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 1f); } return false; } diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index 739a0214ff..ba2b78ccf3 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -1,40 +1,105 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Boss; +using Terraria.Audio; namespace CalamityMod.Items.Weapons.Ranged { public class SepticSkewer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - + public bool pulled = false; public override void SetStaticDefaults() { ItemID.Sets.IsRangedSpecialistWeapon[Item.type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; } public override void SetDefaults() { Item.width = 46; Item.height = 24; - Item.damage = 272; + Item.damage = 1272; Item.DamageType = DamageClass.Ranged; - Item.useTime = 12; - Item.useAnimation = 12; + Item.useTime = 30; + Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 7.5f; - Item.UseSound = SoundID.Item10; + Item.knockBack = 3.5f; + Item.UseSound = null; Item.autoReuse = true; - Item.shootSpeed = 20f; + Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; + } + public override bool AltFunctionUse(Player player) => true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + pulled = false; + if (player.altFunctionUse == 2) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.type == type) + { + projectile.ai[2] = 5; + pulled = true; + } + } + + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotMid"); + SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = Main.rand.NextFloat(0.7f, 0.8f) }, position); + if (pulled) + player.Calamity().GeneralScreenShakePower = 5.5f; + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotHeavy"); + SoundEngine.PlaySound(fire with { Volume = 0.45f, Pitch = Main.rand.NextFloat(0.4f, 0.65f) }, position); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, 0); + } + return false; + } + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + float pullback = 7f; + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(46, 24); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += (player.altFunctionUse == 2 ? -0.25f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index bca4b94f92..45d07acc99 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (CalamityUtils.CheckWoodenAmmo(type, player)) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 4005da80e6..e3a71d7dfb 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -39,9 +39,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 95ac291e2e..f9ebdfcb3a 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 34; Item.damage = 400; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 5; + Item.useAnimation = Item.useTime = 5; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index a146ae3b32..aca243757d 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 30; Item.damage = 40; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index b121ad2ba7..f8c21806ff 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged counter++; if (counter == 10) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 0.8f, velocity.Y * 0.8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position, velocity * 0.8f, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI); } if (counter >= 12) counter = 0; diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index b70b3820c5..f7009e12de 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 15f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = Item.useAnimation = 27; + Item.useAnimation = Item.useTime = 27; Item.UseSound = SoundID.Item92; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Starmageddon.cs b/Items/Weapons/Ranged/Starmageddon.cs index 0b704e77ac..217daa7cfd 100644 --- a/Items/Weapons/Ranged/Starmageddon.cs +++ b/Items/Weapons/Ranged/Starmageddon.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 4f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.UseSound = null; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 9e9c0301dc..3ba81cc223 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 5dc40527ab..2f824d95de 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 58; Item.damage = 140; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 28; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 89e585472d..5acf4b8106 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.damage = 92; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = OriginalUseTime; + Item.useAnimation = Item.useTime = OriginalUseTime; Item.shoot = ProjectileType(); Item.shootSpeed = 13f; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 7cb4df516e..79bdaba8f6 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 70; Item.damage = 235; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 28; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index 97cbdb97e5..07210144aa 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/TheSevensStriker.cs b/Items/Weapons/Ranged/TheSevensStriker.cs index 745e017d1c..8c404d042e 100644 --- a/Items/Weapons/Ranged/TheSevensStriker.cs +++ b/Items/Weapons/Ranged/TheSevensStriker.cs @@ -10,15 +10,18 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class TheSevensStriker : ModItem, ILocalizedModType + public class TheSevensStriker : ModItem, ILocalizedModType, IHoldShiftTooltipItem { + public bool ShowExtensionIndicator => false; public new string LocalizationCategory => "Items.Weapons.Ranged"; public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest }; public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f }; public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust"); + public static readonly SoundStyle BustGFB = new("CalamityMod/Sounds/Item/SevensStrikerBustGFB"); public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles"); public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples"); public static readonly SoundStyle JackpotSound = new("CalamityMod/Sounds/Item/SevensStrikerJackpot"); + public static readonly SoundStyle JackpotGFB = new("CalamityMod/Sounds/Item/SevensStrikerJackpotGFB"); public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f }; public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier @@ -30,7 +33,8 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly float TriplesCherryMultiplier = 1f; public static readonly float TriplesCherrySplitMultiplier = 0.333f; public static readonly float TriplesGrapeMultiplier = 0.333f; // fixed the grapes interfering with each other's iframes - public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow + public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow... + public static readonly float JackpotMultiplierGFB = 7f; // ...Unless you simply cannot stop winning public override void SetStaticDefaults() { diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index a9c20c62dc..66afabba19 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 54; Item.damage = 15; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 28; + Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). + AddIngredient(). AddIngredient(15). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 0565b2e6e6..7e03a54bcc 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 58; Item.damage = 150; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 8; + Item.useAnimation = Item.useTime = 8; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 0526d67ad4..bed3fa48e4 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 60; Item.damage = 192; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.knockBack = 6.5f; Item.useAmmo = AmmoID.Bullet; Item.shoot = ProjectileID.Bullet; diff --git a/Items/Weapons/Ranged/Voidragon.cs b/Items/Weapons/Ranged/Voidragon.cs index d1077a7bd5..eda5bdb7ad 100644 --- a/Items/Weapons/Ranged/Voidragon.cs +++ b/Items/Weapons/Ranged/Voidragon.cs @@ -58,9 +58,9 @@ namespace CalamityMod.Items.Weapons.Ranged shotType = 1; if (shotType == 1) - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); shotType++; diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 69d9acf480..5d72c5c385 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 direction = nuzzleDir.RotatedByRandom(spread); Vector2 nuzzlePos = player.MountedCenter + direction * 15f; - Projectile.NewProjectile(player.GetSource_ItemUse_WithPotentialAmmo(Item, Item.useAmmo), nuzzlePos, direction * Item.shootSpeed * Main.rand.NextFloat(1.5f, 2f), type, damage, (int)Item.knockBack, player.whoAmI, 0, 0); + Projectile.NewProjectile(player.GetSource_ItemUse_WithPotentialAmmo(Item, Item.useAmmo), nuzzlePos, direction * Item.shootSpeed * Main.rand.NextFloat(1.5f, 2f), type, damage, (int)Item.knockBack, player.whoAmI); } return false; diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index 136298988c..1c89bd0c34 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, Item.shootSpeed, 0f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, Item.shootSpeed, 0f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index 1e646c10bb..ca48244c5f 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index 50d0e9b31b..38d580285a 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = 36; - Item.height = 34; + Item.height = 36; Item.damage = 37; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/AshenStalactite.png b/Items/Weapons/Rogue/AshenStalactite.png index aafd03c7af..7eda8b46b2 100644 Binary files a/Items/Weapons/Rogue/AshenStalactite.png and b/Items/Weapons/Rogue/AshenStalactite.png differ diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index 8ccc7e6781..0da66baf7a 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Green; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.DamageType = RogueDamageClass.Instance; + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index 592522b026..e4bda23aad 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -13,21 +13,21 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 16; Item.height = 28; + Item.damage = 96; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 25; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 8f; + Item.UseSound = SoundID.Item1; Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.autoReuse = true; - Item.noUseGraphic = true; - Item.noMelee = true; - - Item.useAnimation = 25; - Item.useTime = 25; - Item.damage = 96; - Item.shootSpeed = 8f; - Item.shoot = ModContent.ProjectileType(); - - Item.DamageType = RogueDamageClass.Instance; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index 41d9c078e2..c7de2c3c34 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = 48; - Item.height = 48; + Item.width = 50; + Item.height = 50; Item.damage = 16; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/Crystalline.png b/Items/Weapons/Rogue/Crystalline.png index 14a0bd0c4b..f4fe70d74e 100644 Binary files a/Items/Weapons/Rogue/Crystalline.png and b/Items/Weapons/Rogue/Crystalline.png differ diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index aba7223a7a..d9a4719ab1 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -86,13 +86,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; } + return false; } - else - { - //Does this even need to exist? Can't you just return true for this? - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - } - return false; + return true; } } } diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index b1dfd66b28..926ce17a5a 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index d4f014dab9..e2cc9738b5 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index d05c0a4635..ac93f66c53 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 0ae4de8476..8800eb5c2f 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 1f, damage); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0.25f, damage); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0.25f, damage); } return false; } diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index b111c30627..a83905ca76 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 0677be07ca..6e8efee10d 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index 2efc3a1ecd..f5da2f4637 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index ff90a931cc..9199dc887f 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index d0edf28472..31f155d8bc 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 46d509b1ad..16a3c08fb4 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 64; Item.DamageType = RogueDamageClass.Instance; Item.knockBack = 3f; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 8d692e8cb1..73a34dda76 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 45; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 26; + Item.useAnimation = Item.useTime = 26; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index a39f6910b3..f55470e5ac 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Rogue randYOffset *= mouseDistance; float x4 = realPlayerPos.X; float y4 = realPlayerPos.Y; - int stealth = Projectile.NewProjectile(source, x4, y4, randXOffset, randYOffset, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(source, x4, y4, randXOffset, randYOffset, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) Main.projectile[stealth].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 30060d64a7..9c6d8c5165 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 52; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1.25f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 72bfad6516..7adee86c42 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 4b05fd1732..6382ebf405 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index 7a4119a894..071bfd4f5c 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Rogue } else { - int pIndex = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int pIndex = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); int pID = Main.projectile[pIndex].identity; CreateOrbs(source, position, orbDamage, knockback, pID, player, false); diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 80f0d86737..698346355d 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index 84486e2e08..a7ad94ff3b 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index c39e7906bd..ff44eeb6a7 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.knockBack = 3.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index 411e55ba23..b7cc902959 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.reuseDelay = 1; Item.useLimitPerAnimation = 1; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/ShardofAntumbra.cs b/Items/Weapons/Rogue/ShardofAntumbra.cs index fae8820a7f..ffc7347d05 100644 --- a/Items/Weapons/Rogue/ShardofAntumbra.cs +++ b/Items/Weapons/Rogue/ShardofAntumbra.cs @@ -11,34 +11,27 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("XerocPitchfork")] public class ShardofAntumbra : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 48; Item.height = 48; - Item.damage = 240; + Item.damage = 97; Item.noMelee = true; - Item.consumable = true; Item.noUseGraphic = true; - Item.useAnimation = 20; + Item.useAnimation = 17; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 20; + Item.useTime = 17; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 9999; - Item.value = 10000; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 24f; + Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { @@ -46,15 +39,18 @@ namespace CalamityMod.Items.Weapons.Rogue { int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) + { Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].extraUpdates = 4; + } } return !player.Calamity().StealthStrikeAvailable(); } public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(). + CreateRecipe(). + AddIngredient(12). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/ShardofAntumbraGhost.png b/Items/Weapons/Rogue/ShardofAntumbraGhost.png new file mode 100644 index 0000000000..eb909f5372 Binary files /dev/null and b/Items/Weapons/Rogue/ShardofAntumbraGhost.png differ diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index ea2e50ca8e..76c4f95444 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using CalamityMod.UI; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,39 +14,62 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 94; - Item.damage = 150; + Item.damage = 475; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 40; + Item.useAnimation = Item.useTime = 100; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.8f; + public override float StealthDamageMultiplier => 0.3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; + bool spawner = true; + for (int t = 0; t < 4; t++) + { + for (int i = 0; i < 5; i++) + { + float rot = MathHelper.ToRadians(-36f) + MathHelper.ToRadians(18f) * i; + Vector2 vel = velocity.RotatedBy(rot) * (i == 0 ? 0.7f : i == 4 ? 0.7f : i == 1 ? 0.85f : i == 3 ? 0.85f : 1); + int proj = Projectile.NewProjectile(source, position, vel, type, damage, knockback, player.whoAmI, 0f, i); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].ai[2] = 1; // This counts as a stealth strike in this case + if (spawner && i == 4) + { + Main.projectile[proj].ai[2] = 15; + spawner = false; + } + } + velocity = velocity.RotatedBy(MathHelper.ToRadians(90f)); + } } - return true; + else + { + for (int i = 0; i < 5; i++) + { + float rot = -0.8f + 0.4f * i; + Vector2 vel = velocity.RotatedBy(rot) * (i == 0 ? 0.7f : i == 4 ? 0.7f : i == 1 ? 0.85f : i == 3 ? 0.85f : 1); + int proj = Projectile.NewProjectile(source, position, vel, type, damage, knockback, player.whoAmI, 0f, i); + } + } + return false; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(18). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Rogue/StarofDestructionGhost.png b/Items/Weapons/Rogue/StarofDestructionGhost.png new file mode 100644 index 0000000000..3c924fe8db Binary files /dev/null and b/Items/Weapons/Rogue/StarofDestructionGhost.png differ diff --git a/Items/Weapons/Rogue/TheFinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs index 45f45c9fe6..beb247c99c 100644 --- a/Items/Weapons/Rogue/TheFinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 2500; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; Item.autoReuse = false; diff --git a/Items/Weapons/Rogue/TheOldReaper.cs b/Items/Weapons/Rogue/TheOldReaper.cs index dffec98bbb..6cb3f9b9b3 100644 --- a/Items/Weapons/Rogue/TheOldReaper.cs +++ b/Items/Weapons/Rogue/TheOldReaper.cs @@ -15,17 +15,16 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 106; Item.height = 104; - Item.damage = 180; + Item.damage = 1280; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 20; - Item.useTime = 20; + Item.useAnimation = 53; + Item.useTime = 53; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 4f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 16f; + Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; @@ -39,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 15; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 1; i++) { Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, (int)(damage * 0.45), knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 03869d928a..3d1f61c9c4 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 14; Item.shootSpeed = 15f; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; Item.value = Item.buyPrice(0, 0, 0, 50); @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 1); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 35937393a0..01e0d615bc 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index d5dce99ce1..5eb869a46b 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -14,34 +14,50 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 46; - Item.damage = 333; + Item.damage = 150; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 20; + Item.useAnimation = Item.useTime = 50; Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 5f; + Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 18f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.3f; + public override float StealthDamageMultiplier => 0.4f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + float angle1 = MathHelper.ToRadians(20f); if (player.Calamity().StealthStrikeAvailable()) { - int boomer = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (boomer.WithinBounds(Main.maxProjectiles)) - Main.projectile[boomer].Calamity().stealthStrike = true; - return false; + for (int i = 0; i < 2; i++) + { + int proj = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle1), type, damage, knockback, player.whoAmI, 0, 0, 0 + i); + int proj2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle1 * 0.5f) * 0.9f, type, damage, knockback, player.whoAmI, 0, 0, 2 + i); + angle1 *= -1; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; + if (proj2.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj2].Calamity().stealthStrike = true; + } } - return true; + else + { + for (int i = 0; i < 2; i++) + { + int proj = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle1), type, damage, knockback, player.whoAmI, 0, 0, 0 + i); + int proj2 = Projectile.NewProjectile(source, position, velocity.RotatedBy(angle1 * 0.5f) * 0.9f, type, damage, knockback, player.whoAmI, 0, 0, 2 + i); + angle1 *= -1; + } + } + return false; } } } diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index 07622f7198..26ba6a0bea 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (player.Calamity().StealthStrikeAvailable()) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index b6b8276719..b74226f9f3 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index f8f71d8eb5..1e974a818b 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 13; + Item.useAnimation = Item.useTime = 13; Item.autoReuse = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int proj = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 5240e09f86..82b73bb53b 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 40; Item.damage = 56; Item.knockBack = 3f; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int slime = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI); + int slime = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * damageMult), knockback, player.whoAmI); Main.projectile[slime].originalDamage = (int)(Item.damage * damageMult); Main.projectile[slime].minionSlots = slimeSlots; return false; diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 9554bd8e42..70b3cac8c0 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index 25c8513ee5..ebf42d1ca9 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 625; Item.useStyle = ItemUseStyleID.HoldUp; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index 118a21ec6c..deefde23b3 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 38; Item.damage = 200; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.75f; diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 43e4bb72cc..3feeafde1a 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 9900da3a9b..0e212d9636 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 40; Item.damage = 25; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index ae8716c368..d91e61997f 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 56; Item.damage = 35; Item.mana = 10; - Item.useTime = Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, Main.myPlayer); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/BrittleStarStaff.cs b/Items/Weapons/Summon/BrittleStarStaff.cs index 8a2b3ed5f5..fc1033d1ca 100644 --- a/Items/Weapons/Summon/BrittleStarStaff.cs +++ b/Items/Weapons/Summon/BrittleStarStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 44; Item.damage = 10; Item.mana = 10; - Item.useTime = Item.useAnimation = 32; + Item.useAnimation = Item.useTime = 32; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = Knockback; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity = Vector2.Zero; int SummonNumber = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 6ae7b901f7..e2ff231070 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index c477f89bdc..5423a12cbb 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -41,20 +41,20 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 88; Item.height = 108; Item.damage = 110; - Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; - - Item.useTime = Item.useAnimation = 10; Item.mana = 10; - Item.noMelee = true; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 1f; // This does nothing, it's just here so it's able to act like a staff. + Item.UseSound = SoundID.Item85; Item.useStyle = ItemUseStyleID.Shoot; - Item.rare = ModContent.RarityType(); - Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.autoReuse = true; + Item.noMelee = true; - // This does nothing, it's just here so it's able to act like a staff. - Item.shootSpeed = 1f; + Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 4a4e8c1f0b..f9fc88fab2 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -15,19 +15,21 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 36; Item.height = 42; Item.damage = 8; + Item.DamageType = DamageClass.Summon; + Item.sentry = true; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; + Item.useAnimation = Item.useTime = 35; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.sentry = true; - Item.DamageType = DamageClass.Summon; + + Item.UseSound = SoundID.Item44; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index 0c5b883154..f048621794 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 2f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 44d8fc9f3c..9e10aeadf9 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -8,33 +8,36 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class CindersOfLament : ModItem, ILocalizedModType + public class CindersOfLament : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetDefaults() - { - Item.width = 86; - Item.height = 92; - Item.mana = 10; - Item.damage = 1666; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 80; // 79 because of useStyle 1 - Item.autoReuse = true; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); - Item.UseSound = SoundID.DD2_BetsySummon; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; - } public override void SetStaticDefaults() { ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } + public override void SetDefaults() + { + Item.width = 86; + Item.height = 92; + Item.damage = 1666; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.useAnimation = Item.useTime = 80; // 79 because of useStyle 1 + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + + Item.UseSound = SoundID.DD2_BetsySummon; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ModContent.RarityType(); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 836c151c26..01f80f495b 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.channel = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ProjectileType(); Item.shootSpeed = 10f; Item.rare = ItemRarityID.Green; @@ -124,7 +124,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; + Texture2D properSprite = Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.DrawNewInventorySprite(properSprite, new Vector2(42f, 34), position, drawColor, origin, scale); return false; @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; + Texture2D properSprite = Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); return false; diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 81c6b7689f..afab2ce826 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 54; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index edb6f0390c..aedfb0014f 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 114; Item.knockBack = 2f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index d7d6ac4aa8..8a687bbb46 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -19,17 +19,19 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 170; Item.height = 164; - Item.mana = 10; Item.damage = 560; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 10; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.UseSound = SoundID.Item60; + Item.DamageType = DamageClass.Summon; + Item.mana = 10; + Item.useAnimation = Item.useTime = 10; + Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; + + Item.UseSound = SoundID.Item60; + Item.useStyle = ItemUseStyleID.Swing; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); } @@ -38,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; @@ -52,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index 535ad630a2..ce0fd4f2de 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 28; Item.damage = 321; Item.mana = 10; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 6f; diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index 13dc9b4d22..39955f8966 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 60; Item.damage = 127; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 65ef4d76a8..21a70f0f06 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 52; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 3d189ee3b0..f1043a176f 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 57461c8924..8ac62eb209 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 70; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index ad9e9a42a6..82d990e57c 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 58; Item.damage = 14; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2.25f; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 3759fa322b..79afed4b59 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 127; Item.knockBack = 2f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 2d1c16e302..8bd0029774 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 46; Item.damage = 20; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 86b85473b1..c66c813752 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 44; Item.damage = 40; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 33371abda8..1dbc591245 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 42; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; @@ -41,13 +41,13 @@ namespace CalamityMod.Items.Weapons.Summon } if (totalSlots < player.maxMinions) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0f) { - int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage * 2; } diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index cd4ee73ef3..77b6556268 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 62; Item.damage = 215; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index a2aa36d7e8..a60e17693d 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 44; Item.damage = 60; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4.5f; diff --git a/Items/Weapons/Summon/EnchantedConch.cs b/Items/Weapons/Summon/EnchantedConch.cs index 422f7c7233..0136a8d714 100644 --- a/Items/Weapons/Summon/EnchantedConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 6e96ca55f3..3b64d117d0 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 232; Item.knockBack = 3f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 0cface095a..46f1f7eb7e 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 1300; Item.knockBack = 4f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index dd0c9287de..b71b6ba3ff 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 9abf615c95..c5a5c460db 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 009e3325a1..def86283ee 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 36; Item.damage = 24; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index 697ee14482..e25a657073 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 200; Item.damage = 1999; Item.useStyle = ItemUseStyleID.HoldUp; - Item.useTime = Item.useAnimation = 9; + Item.useAnimation = Item.useTime = 9; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 1373817513..fae2871577 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index e40bf2ed65..2eeb08887d 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 72; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 5; i++) { - Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); blossom.ai[0] = MathHelper.TwoPi * i / 5f; blossom.rotation = blossom.ai[0]; blossom.originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 63625ec5e3..4fb966f134 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.mana = 10; Item.damage = 28; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); vector2.X = Main.mouseX + Main.screenPosition.X; vector2.Y = Main.mouseY + Main.screenPosition.Y; - int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 928fbdfa4b..852b6cd188 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 24; Item.damage = 10; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; return false; diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 1083ecfd3b..6e0f725d93 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 25; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index aafe020881..6ab12f05c7 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 85; Item.knockBack = 3f; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 6566d75dab..4d2796f9cd 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 70; Item.damage = 60; Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index 466e2ceb5e..a8ff856589 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 48; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 4.5f; diff --git a/Items/Weapons/Summon/GuidelightofOblivion.cs b/Items/Weapons/Summon/GuidelightofOblivion.cs index 6525ba6f3e..554c3b6f8a 100644 --- a/Items/Weapons/Summon/GuidelightofOblivion.cs +++ b/Items/Weapons/Summon/GuidelightofOblivion.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Summon/HarvestStaff.cs b/Items/Weapons/Summon/HarvestStaff.cs index 96da01b29c..fad959fad4 100644 --- a/Items/Weapons/Summon/HarvestStaff.cs +++ b/Items/Weapons/Summon/HarvestStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 5f; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.mana = 10; Item.width = 44; Item.height = 46; diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index ae22914112..a8a5bb8a06 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 48; Item.damage = 25; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3f; @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 30f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index ba118cfcf5..8b2772c2e2 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item21; diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 849e2cdda0..8fdf65c7a8 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.autoReuse = true; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index b00537081a..12ca3a20af 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 34; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 080093f247..e4b8c63b6c 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 28; Item.damage = 50; Item.mana = 10; - Item.useTime = Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/LegionofCelestia.cs similarity index 87% rename from Items/Weapons/Summon/ElementalAxe.cs rename to Items/Weapons/Summon/LegionofCelestia.cs index 50fb9ea940..76e3f857a6 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class ElementalAxe : ModItem, ILocalizedModType + [LegacyName("ElementalAxe")] + public class LegionofCelestia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 57; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 5f; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/ElementalAxe.png b/Items/Weapons/Summon/LegionofCelestia.png similarity index 100% rename from Items/Weapons/Summon/ElementalAxe.png rename to Items/Weapons/Summon/LegionofCelestia.png diff --git a/Items/Weapons/Summon/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs index 7e441ab524..e33c5b02e3 100644 --- a/Items/Weapons/Summon/LiliesOfFinality.cs +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 5f; Item.mana = 10; - Item.useTime = Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.width = 36; Item.height = 50; Item.noMelee = true; diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index 6f8e1fbdf2..4d9e90ff7a 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class Metastasis : ModItem, ILocalizedModType + public class Metastasis : ExhumedItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; public override void SetDefaults() @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 78; Item.damage = 400; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index bce9216ba8..431dfd4d0f 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { Item.width = Item.height = 32; - Item.damage = 150; + Item.damage = 176; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index be74192042..764c1af28f 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 58; Item.height = 50; Item.damage = 317; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index 8284dd30e0..c66a5e0099 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 5f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.noMelee = true; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index 0642fb536b..be58cba6f0 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 34; Item.damage = 53; Item.mana = 10; - Item.useTime = Item.useAnimation = 24; + Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index a6129eab11..a25798a78f 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 4f; - Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1. + Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1. Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 2fff600df2..b7a85aadd4 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index 662d30304d..dd22edc4cd 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -15,19 +15,21 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 26; Item.height = 56; Item.damage = 12; - Item.mana = 10; - Item.useTime = Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 0f; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.sentry = true; + Item.mana = 10; + Item.useAnimation = Item.useTime = 35; + Item.knockBack = 0.25f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; + + Item.UseSound = SoundID.Item44; + Item.useStyle = ItemUseStyleID.Swing; + Item.autoReuse = true; + Item.noMelee = true; + + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/PuffShroom.cs b/Items/Weapons/Summon/PuffShroom.cs index bee58b18d1..b2163f8e88 100644 --- a/Items/Weapons/Summon/PuffShroom.cs +++ b/Items/Weapons/Summon/PuffShroom.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 32; Item.damage = 14; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 67a1b45685..951e0ff7c9 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 46; Item.damage = 66; // clueless Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1f; diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index e17e158a74..7568c46903 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 20; Item.mana = 10; Item.damage = 8; - Item.useTime = Item.useAnimation = 34; + Item.useAnimation = Item.useTime = 34; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; @@ -48,8 +48,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). AddRecipeGroup("AnySilverBar", 10). + AddIngredient(3). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/SanctifiedSpark.cs b/Items/Weapons/Summon/SanctifiedSpark.cs index c1d0f28176..b7c19db16a 100644 --- a/Items/Weapons/Summon/SanctifiedSpark.cs +++ b/Items/Weapons/Summon/SanctifiedSpark.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.sentry = true; Item.mana = 10; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index ff780b7dd0..a7da28d070 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 8d6dbc6405..4f42ccce99 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_BetsyFlameBreath; diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index d83cf2574e..8a8c992ec4 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 70; Item.damage = 16; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 0.5f; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index 2487b3034c..1abaa418da 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 70; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 3a178abe56..1ce98ef7c5 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = Item.height = 62; Item.damage = 600; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.knockBack = 10f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index c00379c4e0..1e5a20341c 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 34; Item.damage = 10; Item.mana = 10; - Item.useTime = Item.useAnimation = 29; + Item.useAnimation = Item.useTime = 29; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 3.6f; diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 53691dfcaf..d9eb1fdafa 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index 2917782ac7..1db1b3dde0 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -10,44 +10,47 @@ namespace CalamityMod.Items.Weapons.Summon public class SquirrelSquireStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + + public static float ProjectileVelocity = 20f; + public static int TimeBeforeFalling = 30; + public static float DistanceToMortarShoot = 240f; + public static int ProjectileTimeAlive = 180; + public static float ProjectileGravity = 0.5f; + public static int ProjectileAoERadiusSize = 24; + + public override void SetStaticDefaults() => Item.staff[Type] = true; + public override void SetDefaults() { - Item.width = 52; - Item.height = 52; Item.damage = 8; - Item.mana = 10; - Item.useTime = Item.useAnimation = 35; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); Item.knockBack = 0.5f; + + Item.useAnimation = Item.useTime = 15; + Item.mana = 10; + Item.width = 46; + Item.height = 52; + Item.noMelee = true; + Item.sentry = true; + Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityWhiteBuyPrice; Item.rare = ItemRarityID.White; + Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; - Item.sentry = true; + + // This doesn't do anything relevant, it's just so it can be held like a staff. + Item.shootSpeed = 1f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); - YOffset += 6; - position = new Vector2((float)XPosition, (float)(YPosition - YOffset)); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 30f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - - player.UpdateMaxTurrets(); - //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks - } + player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset); + Projectile.NewProjectileDirect(source, new(XPosition, YPosition - YOffset), Vector2.Zero, type, damage, knockback, player.whoAmI); + player.UpdateMaxTurrets(); return false; } - //in case you lose it and want another for some bizzare reason public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.png b/Items/Weapons/Summon/SquirrelSquireStaff.png index fb60c84a32..b613e40fb1 100644 Binary files a/Items/Weapons/Summon/SquirrelSquireStaff.png and b/Items/Weapons/Summon/SquirrelSquireStaff.png differ diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 5c08cfc5bc..8de6f7b1af 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 54; Item.damage = 31; Item.mana = 10; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3.5f; diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 5a9a3a858f..aebe5b1a37 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 68; Item.damage = 100; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; // 9 because of useStyle 1 + Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index ac6e306dcd..3d8c9f3def 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.shoot = ModContent.ProjectileType(); - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 07741b3cad..5a6a9827e2 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = 42; Item.height = 42; Item.damage = 142; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.knockBack = 4f; Item.mana = 10; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 99f5a062b4..ab76bab5f6 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 32; Item.damage = 11; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 0c2c0315e1..fa04a52417 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 48; Item.damage = 12; Item.mana = 10; - Item.useTime = Item.useAnimation = 35; + Item.useAnimation = Item.useTime = 35; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.15f; diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 0f24df1f31..f29284f1c7 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 20; Item.damage = 140; Item.mana = 10; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 165a7abad0..78f850a6cf 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 193; Item.knockBack = 1f; Item.mana = 99; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; Item.shootSpeed = 0f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 8695293f73..dcf2926b9a 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 60; Item.damage = 40; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 3; i++) { - Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); blossom.ai[1] = (int)(MathHelper.TwoPi / 3f * i * 32f); blossom.originalDamage = Item.damage; } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 51fe340cc5..15932b763a 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.mana = 300; - Item.damage = 15000; + Item.damage = 9600; Item.knockBack = 7f; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.noUseGraphic = true; @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (!player.HasCooldown(Cooldowns.UniverseSplitter.ID)) { - player.AddCooldown(Cooldowns.UniverseSplitter.ID, CalamityUtils.SecondsToFrames(45)); + player.AddCooldown(Cooldowns.UniverseSplitter.ID, CalamityUtils.SecondsToFrames(30)); int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/VengefulSunStaff.cs b/Items/Weapons/Summon/VengefulSunStaff.cs index 1638072b13..fc5250bf6d 100644 --- a/Items/Weapons/Summon/VengefulSunStaff.cs +++ b/Items/Weapons/Summon/VengefulSunStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 72; Item.damage = 60; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 1.25f; diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 2ed2a9261d..916edd6388 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 32; Item.damage = 115; Item.mana = 10; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index 7e02720664..d3e5445a27 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.knockBack = 0.5f; - Item.useTime = Item.useAnimation = 30; + Item.useAnimation = Item.useTime = 30; Item.mana = 10; Item.noMelee = true; Item.autoReuse = true; diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index a15b2b4211..54ebb7c65e 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 56; Item.damage = 30; Item.mana = 10; - Item.useTime = Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 2e30e7403b..70a121b995 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 73; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.useTime = Item.useAnimation = 14; + Item.useAnimation = Item.useTime = 14; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 4d0ecae6ad..07c45ad056 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 105; Item.knockBack = 4f; - Item.useTime = Item.useAnimation = 15; // 14 because of useStyle 1 + Item.useAnimation = Item.useTime = 15; // 14 because of useStyle 1 Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index d1b4234ac0..acf57bc377 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 450; Item.mana = 10; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index e7a264c7cc..94ec6fab88 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 60; Item.damage = 50; Item.mana = 10; - Item.useTime = Item.useAnimation = 20; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 3f; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 4; i++) { - Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); blossom.ai[0] = MathHelper.TwoPi * i / 4f; blossom.rotation = blossom.ai[0]; blossom.originalDamage = Item.damage; diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 82f79133b8..5f1337603a 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 20; Item.damage = 16; Item.mana = 10; - Item.useTime = Item.useAnimation = 34; + Item.useAnimation = Item.useTime = 34; Item.useStyle = ItemUseStyleID.HoldUp; Item.noMelee = true; Item.knockBack = 0.5f; diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index 577f76f719..35ddfb45f2 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 80; Item.height = 74; - Item.damage = 300; + Item.damage = 325; Item.mana = 10; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = Item.useAnimation = 10; + Item.useAnimation = Item.useTime = 10; Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index b03b538f9a..9bd743083b 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -2,9 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -39,12 +37,6 @@ namespace CalamityMod.Items.Weapons.Typeless itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 18fa4a63c8..b7eaf469db 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Typeless Item.width = 32; Item.height = 46; Item.damage = 1350; - Item.useTime = Item.useAnimation = 25; + Item.useAnimation = Item.useTime = 25; Item.reuseDelay = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item46; diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs index a2b5adafcb..0e975a0ab3 100644 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Typeless } } else if (shardTypes.All(proj => player.ownedProjectileCounts[proj] == 0)) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); return false; } } diff --git a/Items/Weapons/Typeless/Skynamite.cs b/Items/Weapons/Typeless/Skynamite.cs index 351f6072f8..289b56d692 100644 --- a/Items/Weapons/Typeless/Skynamite.cs +++ b/Items/Weapons/Typeless/Skynamite.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Typeless { Item.width = 8; Item.height = 28; - Item.useTime = Item.useAnimation = 40; + Item.useAnimation = Item.useTime = 40; Item.maxStack = 9999; Item.consumable = true; Item.shootSpeed = 5f; diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs index 42b934e108..ea0c8786df 100644 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -3,7 +3,6 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -49,12 +48,7 @@ namespace CalamityMod.Items.Weapons.Typeless return base.CanUseItem(player); } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - player.Calamity().KameiBladeUseDelay = 180; - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); - return false; - } + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => player.Calamity().KameiBladeUseDelay = 180; public override void AddRecipes() { diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 5161cb086c..a31139fa47 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -243,6 +243,11 @@ SulphuricPoisoning: { Description: The acidic water burns away your flesh } +TrueVulnerabilityHex: { + DisplayName: True Vulnerability Hex + Description: The end has come +} + Vaporfied: { DisplayName: Vaporfied Description: Vape @@ -597,11 +602,6 @@ SulphurskinBuff: { Description: The sulphuric waters have a lesser effect on you } -TeslaBuff: { - DisplayName: Tesla's Electricity - Description: Summons an aura of electricity -} - WeaponImbueBrimstone: { DisplayName: Weapon Imbue: Brimstone Description: Melee, Whip, and Rogue attacks ignite enemies with brimstone flames @@ -627,11 +627,6 @@ Zerg: { Description: Spawn rates are greatly boosted } -RancorBurn: { - DisplayName: Rancor Burn - Description: Burning -} - AbyssalDivingSuitBuff: { DisplayName: Abyssal Diving Suit Description: You are made of metal @@ -785,7 +780,7 @@ KamiBuff: { Mushy: { DisplayName: Mushy - Description: Increased defense by 6 and life regen by 1HP/s + Description: Increased defense by 8 and life regen by 1HP/s } PhantomicEmpowerment: { @@ -1160,9 +1155,9 @@ DemonshadeSetDevilBuff: { Description: The red devil will protect you } -ElementalAxeBuff: { - DisplayName: Elemental Axe - Description: The elemental axe will protect you +LegionofCelestiaBuff: { + DisplayName: Celestial Axe + Description: If only it was this good at chopping trees... } EndoCooperBuff: { @@ -1562,3 +1557,8 @@ AeolianEarthBuff: { Damage reduction increased by 8%, damage increased by 18% ''' } + +Voidfrost: { + DisplayName: Voidfrost + Description: The emptiness of space devours all warmth and life +} diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index fa96db8c5d..fef37e28d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -41,16 +41,6 @@ Drops: { DownedT2AR: After defeating the second tier of Acid Rain FirstKill: Drops only on the first kill MechBoss: Drops on the first kill of the final Mechanical Boss - ProvidenceHallow: - ''' - Drops if Providence was summoned in the Hallow - or if Providence is only attacked during nighttime - ''' - ProvidenceUnderworld: - ''' - Drops if Providence was summoned in the Underworld - or if Providence is only attacked during nighttime - ''' ProvidenceNight: Drops if Providence is only attacked during nighttime ProvidenceChallenge: ''' @@ -70,7 +60,7 @@ InCrag: In the Brimstone Crags InSulph: In the Sulphurous Sea InSunken: In the Sunken Sea InRev: In Revengeance Mode -IsRevOrMM: In Revengeance Mode or in Master Mode +InRevOrMM: In Revengeance Mode or in Master Mode AlcoholPoison: While inflicted with Alcohol Poisoning PostCal: After defeating Calamitas Clone PostAureus: After defeating Astrum Aureus diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 821007ffbc..cdc61f30bc 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -1,14 +1,12 @@ -CalamityConfig: { - DisplayName: Main Config +CalamityClientConfig: { + DisplayName: Client Config Headers: { - ExpertMaster: Expert and Master Mode Changes Gameplay: General Gameplay Changes Graphics: Graphics Changes - Revengeance: Revengeance Mode Changes UI: UI Changes - BaseBoosts: Base Stat Boosts - MusicEvents: Music Events + MeterPositions: Meter Positions + MusicEvents: In-Game Music Events } AdrenalineMeterPosX: { @@ -38,15 +36,6 @@ CalamityConfig: { ''' } - BossesStopWeather: { - Label: "[i:CalamityMod/TorrentialTear] Bosses Stop Weather" - Tooltip: - ''' - When enabled, many late game bosses will stop all rain and related weather when spawned. - Enable if you have performance issues during late game boss fights. - ''' - } - BossHealthBarExtraInfo: { Label: "[i:CalamityMod/EncryptedSchematicPlanetoid] Boss Health Bar Extra Info" Tooltip: @@ -56,35 +45,6 @@ CalamityConfig: { ''' } - BossHealthBoost: { - Label: "[i:LifeCrystal] Boss Health Boost Percentage" - Tooltip: - ''' - Globally boosts the health of all bosses by the specified percentage. - This stacks with multiplayer boss health boosts. - Does not affect bosses that are already spawned. - ''' - } - - DefaultDashEnabled: { - Label: "[i:Tabi] Default Dash" - Tooltip: - ''' - Gives the player a very weak dash by default that requires no equipment or items to use. - This dash will be replaced by any other available dash, including those from other mods. - ''' - } - - BossZen: { - Label: "[i:CalamityMod/ZenPotion] Bosses Drastically Reduce Spawn Rates" - Tooltip: - ''' - All living bosses will drastically reduce the spawn rates of regular enemies. - This also prevents Slime Rain from occurring while a boss is alive. - Calamity is balanced around this setting being enabled. - ''' - } - ChargeMeter: { Label: "[i:CalamityMod/DraedonPowerCell] Display Charge Meter" Tooltip: @@ -112,11 +72,6 @@ CalamityConfig: { ''' } - ChilledWaterRework: { - Label: "[i:ArcticDivingGear] Chilled Water Rework" - Tooltip: When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled. - } - CooldownDisplay: { Label: "[i:CalamityMod/NebulousCore] Cooldown Rack Display Mode" Tooltip: @@ -136,37 +91,6 @@ CalamityConfig: { Tooltip: Plays Calamity Mod OST - "Scourge of the Universe (Eulogy for the Ego)", after the Devourer of Gods has been defeated. } - EarlyHardmodeProgressionRework: { - Label: "[i:Pwnhammer] Early Hardmode Progression Rework" - Tooltip: - ''' - Demon Altars no longer spawn ores and crimson/corruption blocks when broken. - Wall of Flesh spawns Cobalt and Palladium ore on first kill. - The first mech boss you fight has 20% (10% in Expert and Master) less HP and damage and spawns Mythril and Orichalcum ore on first kill. - The second mech boss you fight has 10% (5% in Expert and Master) less HP and damage and spawns Adamantite and Titanium ore on first kill. - The third mech boss spawns Hallowed Ore on first kill. - ''' - } - - FasterBaseSpeed: { - Label: "[i:HermesBoots] Increase Base Movement Speed" - Tooltip: - ''' - Increases the player's base movement speed substantially by always giving them +50% movement speed. - This setting does nothing if the mod Terraria Overhaul is loaded. - Calamity is balanced around this setting being enabled. - ''' - } - - FasterRopeClimbSpeed: { - Label: "[i:Rope] Increase Rope Climb Speed" - Tooltip: - ''' - Increases the player's rope climb speed substantially by increasing acceleration and deceleration while on a rope. - Calamity is balanced around this setting being enabled. - ''' - } - FasterFallHotkey: { Label: "[i:CalamityMod/BallAndChain] Enable Fast Falling" Tooltip: @@ -177,24 +101,6 @@ CalamityConfig: { ''' } - FasterJumpSpeed: { - Label: "[i:FrogLeg] Increase Base Jump Speed" - Tooltip: - ''' - Slightly increases the player's base jump speed. - Calamity is balanced around this setting being enabled. - ''' - } - - FasterTilePlacement: { - Label: "[i:ArchitectGizmoPack] Increase Base Building Speed" - Tooltip: - ''' - Substantially increases how rapidly the player can place tiles and walls. - This config stacks with the Brick Layer, Portable Cement Mixer and other accessories. - ''' - } - FlightBar: { Label: "[i:CalamityMod/DrewsWings] Display Flight Bar" Tooltip: @@ -223,24 +129,6 @@ CalamityConfig: { ''' } - ForceTownSafety: { - Label: "[i:Sunflower] Force Town Safety" - Tooltip: - ''' - Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates. - This can have unintended side effects such as making critters difficult to find. - ''' - } - - HigherJumpHeight: { - Label: "[i:ShinyRedBalloon] Increase Base Jump Height" - Tooltip: - ''' - Increases the player's base jump height by 10% so that they can jump 7 tiles. - Calamity is balanced around this setting being enabled. - ''' - } - Interlude1: { Label: "[i:CalamityModMusic/Interlude1MusicBox] Interlude 1" Tooltip: Plays Calamity Mod OST - "Silence before the storms", after Calamitas Clone has been defeated. @@ -265,24 +153,6 @@ CalamityConfig: { ''' } - MusicModReminderMessage: { - Label: "[i:MusicBoxMartians] Music Mod Reminder Message" - Tooltip: - ''' - Enable or disable the status message which reminds users to install the Calamity Music Mod. - This message plays on world entry. - ''' - } - - NerfExpertDebuffs: { - Label: "[i:AnkhCharm] Remove Increased Debuff Duration" - Tooltip: - ''' - Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player. - Calamity is balanced around this setting being enabled. - ''' - } - NewVanillaTextures: { Label: "[i:Paintbrush] New Vanilla Textures" Tooltip: @@ -321,20 +191,6 @@ CalamityConfig: { ''' } - RemoveLavaDropsFromLavaSlimes: { - Label: "[i:LavaWaders] Remove Lava Drops From Lava Slimes" - Tooltip: When enabled, Lava Slimes will be replaced with a new Lava Slime that no longer drops lava. - } - - RemoveReforgeRNG: { - Label: "[i:TinHammer] Remove Reforge RNG" - Tooltip: - ''' - Removes randomness from the Goblin Tinkerer's reforges for both weapons and accessories. - Disable this if using mods that change reforging on their own to prevent conflicts. - ''' - } - RipperMeterShake: { Label: "[i:CalamityMod/RedLightningContainer] Rage and Adrenaline Meter Shake" Tooltip: @@ -442,6 +298,169 @@ CalamityConfig: { ''' } + VanillaCooldownDisplay: { + Label: "[i:HealingPotion] Display Vanilla Cooldowns" + Tooltip: + ''' + Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack. + The debuffs will still appear in the buffs array, but this may help make them more visible. + ''' + } + + VCMMStatusMessage: { + Label: "[i:MusicBoxMartians] VCMM Status Message" + Tooltip: Enable or disable the status message promoting the Vanilla Calamity Music Mod that plays on world entry. + } + + WikiStatusMessage: { + Label: "[i:Book] Wiki Status Message" + Tooltip: Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry. + } +} + +CalamityServerConfig: { + DisplayName: Server Config + Denied: You have no permission to change this config + + Headers: { + ExpertMaster: Expert and Master Mode Changes + Gameplay: General Gameplay Changes + BaseBoosts: Base Stat Boosts + } + + BossesStopWeather: { + Label: "[i:CalamityMod/TorrentialTear] Bosses Stop Weather" + Tooltip: + ''' + When enabled, many late game bosses will stop all rain and related weather when spawned. + Enable if you have performance issues during late game boss fights. + ''' + } + + BossHealthBoost: { + Label: "[i:LifeCrystal] Boss Health Boost Percentage" + Tooltip: + ''' + Globally boosts the health of all bosses by the specified percentage. + This stacks with multiplayer boss health boosts. + Does not affect bosses that are already spawned. + ''' + } + + DefaultDashEnabled: { + Label: "[i:Tabi] Default Dash" + Tooltip: + ''' + Gives the player a very weak dash by default that requires no equipment or items to use. + This dash will be replaced by any other available dash, including those from other mods. + ''' + } + + BossZen: { + Label: "[i:CalamityMod/ZenPotion] Bosses Drastically Reduce Spawn Rates" + Tooltip: + ''' + All living bosses will drastically reduce the spawn rates of regular enemies. + This also prevents Slime Rain from occurring while a boss is alive. + Calamity is balanced around this setting being enabled. + ''' + } + + ChilledWaterRework: { + Label: "[i:ArcticDivingGear] Chilled Water Rework" + Tooltip: When enabled, water in the Snow and Ice biomes will rapidly drain the player's breath instead of inflicting Chilled. + } + + EarlyHardmodeProgressionRework: { + Label: "[i:Pwnhammer] Early Hardmode Progression Rework" + Tooltip: + ''' + Demon Altars no longer spawn ores and crimson/corruption blocks when broken. + Wall of Flesh spawns Cobalt and Palladium ore on first kill. + The first mech boss you fight has 20% (10% in Expert and Master) less HP and damage and spawns Mythril and Orichalcum ore on first kill. + The second mech boss you fight has 10% (5% in Expert and Master) less HP and damage and spawns Adamantite and Titanium ore on first kill. + The third mech boss spawns Hallowed Ore on first kill. + ''' + } + + FasterBaseSpeed: { + Label: "[i:HermesBoots] Increase Base Movement Speed" + Tooltip: + ''' + Increases the player's base movement speed substantially by always giving them +50% movement speed. + This setting does nothing if the mod Terraria Overhaul is loaded. + Calamity is balanced around this setting being enabled. + ''' + } + + FasterRopeClimbSpeed: { + Label: "[i:Rope] Increase Rope Climb Speed" + Tooltip: + ''' + Increases the player's rope climb speed substantially by increasing acceleration and deceleration while on a rope. + Calamity is balanced around this setting being enabled. + ''' + } + + FasterJumpSpeed: { + Label: "[i:FrogLeg] Increase Base Jump Speed" + Tooltip: + ''' + Slightly increases the player's base jump speed. + Calamity is balanced around this setting being enabled. + ''' + } + + FasterTilePlacement: { + Label: "[i:ArchitectGizmoPack] Increase Base Building Speed" + Tooltip: + ''' + Substantially increases how rapidly the player can place tiles and walls. + This config stacks with the Brick Layer, Portable Cement Mixer and other accessories. + ''' + } + + ForceTownSafety: { + Label: "[i:Sunflower] Force Town Safety" + Tooltip: + ''' + Counteracts Expert and Master Mode allowing enemies to spawn near towns by vastly decreasing spawn rates. + This can have unintended side effects such as making critters difficult to find. + ''' + } + + HigherJumpHeight: { + Label: "[i:ShinyRedBalloon] Increase Base Jump Height" + Tooltip: + ''' + Increases the player's base jump height by 10% so that they can jump 7 tiles. + Calamity is balanced around this setting being enabled. + ''' + } + + NerfExpertDebuffs: { + Label: "[i:AnkhCharm] Remove Increased Debuff Duration" + Tooltip: + ''' + Disables Expert Mode doubling (and Master Mode tripling) the duration of debuffs on the player. + Calamity is balanced around this setting being enabled. + ''' + } + + RemoveLavaDropsFromLavaSlimes: { + Label: "[i:LavaWaders] Remove Lava Drops From Lava Slimes" + Tooltip: When enabled, Lava Slimes will be replaced with a new Lava Slime that no longer drops lava. + } + + RemoveReforgeRNG: { + Label: "[i:TinHammer] Remove Reforge RNG" + Tooltip: + ''' + Removes randomness from the Goblin Tinkerer's reforges for both weapons and accessories. + Disable this if using mods that change reforging on their own to prevent conflicts. + ''' + } + PotionSelling: { Label: "[i:SpelunkerPotion] Town NPC Potion Selling" Tooltip: @@ -477,23 +496,4 @@ CalamityConfig: { This includes the Old Man. ''' } - - VanillaCooldownDisplay: { - Label: "[i:HealingPotion] Display Vanilla Cooldowns" - Tooltip: - ''' - Adds the vanilla debuffs Potion Sickness and Chaos State to the Cooldown Rack. - The debuffs will still appear in the buffs array, but this may help make them more visible. - ''' - } - - VCMMStatusMessage: { - Label: "[i:MusicBoxMartians] VCMM Status Message" - Tooltip: Enable or disable the status message promoting the Vanilla Calamity Music Mod that plays on world entry. - } - - WikiStatusMessage: { - Label: "[i:Book] Wiki Status Message" - Tooltip: Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry. - } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index bd9fd2d3e7..adedcb5598 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -42,7 +42,7 @@ AbyssalDivingSuit: { Grants the ability to swim, extends underwater breathing, emits light underwater, and improves mobility on ice Provides a moderate amount of light and reduces breath loss in the abyss Abyss creatures are less likely to see you, mitigates the abyss' defense reduction, and lets you sink faster in liquids - Grants immunity to the sulphurous waters + Grants immunity to the sulphurous waters and Crush Depth's increased breath loss ''' } @@ -103,10 +103,11 @@ AmalgamatedBrain: { DisplayName: Amalgamated Brain Tooltip: ''' - 10% increased damage - Shade rains down and enemies are confused when hit, - and summon damage and crit chance are boosted by 10% + 5% increased damage + Taking damage confuses nearby enemies and spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks + After dodging, summon damage and crit chance are boosted by 10% ''' HoldShiftTooltip: ''' @@ -129,14 +130,14 @@ AmbrosialAmpoule: { ''' } -AmidiasPendant: { - DisplayName: Amidias' Pendant - Tooltip: Periodically rains down prism shards that briefly stun enemies -} - AmidiasSpark: { DisplayName: Amidias' Spark - Tooltip: Taking damage releases a blast of sparks + Tooltip: + ''' + Attacks inflict Static Discharge while underwater + Taking damage causes the enemy to be shocked + Shocked enemies constantly release sparks + ''' } AncientFossil: { @@ -245,7 +246,7 @@ AsgardianAegis: { Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, Blackout, Brain Rot, Burning Blood, Cursed Inferno, Brimstone Flames, - Shadowflame, Daybroken, Nightwither, Holy Flames, God Slayer Inferno, Burning + Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno, Burning ''' } @@ -359,7 +360,7 @@ BlunderBooster: { 12% increased rogue damage and 15% increased rogue projectile velocity Stealth generates 10% faster Summons a red lightning aura around the player that electrifies nearby enemies - The aura's appearance can be toggled with visibility + The aura has reduced opacity if visibility is disabled Press [KEY] to consume 25% of your maximum stealth to perform a swift upwards diagonal dash This dash leaves a trail of red lightning bolts This effect has a 1 second cooldown before it can be used again @@ -372,6 +373,9 @@ Calamity: { ''' Lights your cursor ablaze with the Witch's flames, engulfing it in a blazing aura Enemies touching the blaze take immense damage and are inflicted with Vulnerability Hex + Focusing an enemy for 2.5 seconds curses them, ascending Vulnerability Hex to its True form + Foes afflicted with True Vulnerability Hex take 1.15x damage from all sources + This effect is increased to 2.5x for the blazing cursor itself Equip in a vanity slot to change the cursor without dealing damage These changes work in conjunction with the Rainbow Cursor ''' @@ -573,6 +577,7 @@ DepthCharm: { ''' Reduces the damage caused by drowning in the abyss Removes the bleed effect caused by the upper layers of the abyss + Removes the increased breath loss of Crush Depth ''' } @@ -689,13 +694,13 @@ ElysianAegis: { Allows the ability to dash, empowered by holy fire This dash can ram through enemies without taking damage Grants immunity to knockback, fire blocks, as well as multiple debuffs - Blessed by the Profaned Flame ''' HoldShiftTooltip: ''' On Fire!, Hellfire, Cursed Inferno, Shadowflame, Daybroken, Holy Flames, Brimstone Flames, Burning ''' + FlavorTooltip: "'Blessed by the Profaned Flame'" } EnchantedPearl: { @@ -808,8 +813,8 @@ FungalSymbiote: { Tooltip: ''' You grow mushrooms on the grass beneath you - Consuming mushrooms provides the Mushy buff, granting 6 defense and +1 HP/s life regen - All mushroom-based weapons deal 10% more damage and emit harmless mushrooms + Consuming mushrooms provides the Mushy buff, granting 8 defense and +1 HP/s life regen + 10% increased damage while you have the Mushy buff ''' } @@ -819,7 +824,7 @@ GiantPearl: { ''' You have a light aura around you Enemies within the aura are slowed down - Does not work while a boss is alive + You release homing prism shards while an enemy is slowed Provides a small amount of light in the abyss ''' } @@ -877,20 +882,6 @@ GrandGelatin: { ''' } -GravistarSabaton: { - DisplayName: Gravistar Sabaton - Tooltip: - ''' - 20% increased jump speed and negates fall damage - Hold DOWN to increase your maximum fall speed - Hold [KEY] for 1 second while midair to charge up a superspeed slam - While falling, you ram through enemies and don't take contact damage - Once you hit the ground, you create an explosion at your feet - The explosion scales in both damage and size the longer you slam for - Temporary 40% increased jump speed after slamming into the ground - ''' -} - HallowedRune: { DisplayName: Hallowed Rune Tooltip: @@ -981,6 +972,20 @@ InkBomb: { ''' } +InterstellarStompers: { + DisplayName: Interstellar Stompers + Tooltip: + ''' + 6% increased movement speed, 20% increased jump speed, and negates fall damage + Hold DOWN to increase your maximum fall speed + Hold [KEY] for 0.5 seconds while midair to charge up a superspeed slam + While falling, you ram through enemies and don't take contact damage + Once you hit the ground, you create an explosion at your feet + The explosion scales in both damage and size the longer you slam for + Temporary 40% increased jump speed after slamming into the ground + ''' +} + IronBoots: { DisplayName: Iron Boots Tooltip: Allows you to sink faster through liquids @@ -1101,8 +1106,7 @@ Nanotech: { Stealth strikes summon nanobeams and sparks on enemy hits Stealth strikes have +15 armor penetration, deal 5% more damage, and heal for 2 HP 15% increased rogue damage and 15% increased rogue velocity - Landing a stealth strike grants a 12% crit bonus to non-stealth strikes - This crit bonus slowly decays + Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds ''' } @@ -1199,8 +1203,8 @@ OldDukeScales: { [c/c3dfff: Stamina will gradually restore after not dashing for 1 second] [c/c3dfff: Stamina recovers faster when you are stationary] [c/c3dfff: If your stamina reaches 0%, you become exhausted] - [c/CE0E18: While exhausted, this item's damage reduction and movement bonuses are negated] - [c/CE0E18: Being exhausted reduces movement speed by 30% and dash velocity by 50%] + [c/e3545c: While exhausted, this item's damage reduction and movement bonuses are negated] + [c/e3545c: Being exhausted reduces movement speed by 30% and dash velocity by 50%] [c/c3dfff: This debuff lasts until your stamina reaches 100% again] ''' } @@ -1356,11 +1360,7 @@ RadiantOoze: { RaidersTalisman: { DisplayName: Raider's Talisman - Tooltip: - ''' - Stealth strikes grant 12% crit bonus to non-stealth strikes - This crit bonus slowly decays - ''' + Tooltip: Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds } RampartofDeities: { @@ -1410,9 +1410,9 @@ RottenBrain: { DisplayName: Rotten Brain Tooltip: ''' - 10% increased damage when below 75% life - 5% decreased movement speed when below 50% life - Shade rains down when you are hit + 6% increased damage + Taking damage spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds ''' } @@ -1430,7 +1430,6 @@ RoverDrive: { If depleted, the barrier's health regenerates after not receiving damage for 10 seconds Getting hit resets the timer Can also be scrapped at an extractinator - ''' ShieldAdren: Halved Adrenaline loss if all damage is absorbed } @@ -1458,9 +1457,9 @@ SandCloak: { Tooltip: ''' 5% increased movement speed - Press [KEY] to consume 10% of your maximum stealth to create a protective dust veil - While inside the veil, you gain 6 defense and +1 HP/s life regen - This effect has a 30 second cooldown before it can be used again + Press [KEY] to create a protective sand veil which damages enemies inside it + While inside the veil, you gain 6 defense and 3% critical strike chance + This effect has a 20 second cooldown before it can be used again ''' } @@ -1754,6 +1753,16 @@ SupremeBaitTackleBoxFishingStation: { ''' } +TeslasAmulet: { + DisplayName: Tesla's Amulet + Tooltip: + ''' + Generates an electrifying field that slows enemies + The field has reduced opacity if visibility is disabled + Reduces the duration of the Static Discharge debuff + ''' +} + TheAbsorber: { DisplayName: The Absorber Tooltip: @@ -1772,8 +1781,11 @@ TheAmalgam: { Tooltip: ''' 15% increased damage - Shade rains down when you are hit + Most buffs last twice as long, and persist after dying + Taking damage inflicts several debuffs on nearby enemies and spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks + After dodging, summon damage and crit chance are boosted by 10% ''' HoldShiftTooltip: ''' @@ -1828,12 +1840,12 @@ TheEvolution: { DisplayName: The Evolution Tooltip: ''' - Reflects projectiles that hit you, making them harmless to you but 10x more harmful to enemies + Reflects projectiles that hit you, reducing their damage to 1 and dealing 10x damage to enemies Projectiles that deal less than 5% of your max life in damage will not be reflected The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage This cooldown is shared with all other dodges and reflects - Reflecting a projectile grants +1 HP/s life regen and accelerated life regen for 5 seconds - If the same enemy projectile type hits you again you will resist its damage by 15% + Reflecting a projectile grants +6 HP/s life regen for 5 seconds and grants maximum natural life regen + Getting hit by the same enemy projectile type during cooldown will resist its damage by 25% ''' } @@ -1863,10 +1875,11 @@ TheTransformer: { DisplayName: The Transformer Tooltip: ''' - Multiplies all electric debuff damage by 1.5 - Taking damage releases a blast of sparks - Complete immunity to Electrified and all electric attacks - You take halved damage from enemy bullets and reflect them for 800% damage + Multiplies all electricity debuff damage by 1.5x + Attacks inflict Static Discharge while underwater + Reduces the damage of all electricity debuffs by 50% + Taking damage causes the enemy to be shocked + Shocked enemies constantly release sparks ''' } @@ -2027,9 +2040,9 @@ CrystalHeartVodka: { Tooltip: "'Tastes like strawberry cream liqueur (and estrogen)'" } -CocosFeather: { - DisplayName: Coco's Feather - Tooltip: "" +GhostBracelet: { + DisplayName: Ghost Bracelet + Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity } HapuFruit: { @@ -2050,8 +2063,3 @@ Popo: { 'Don't let the demons steal your nose' ''' } - -RedBow: { - DisplayName: Red Bow - Tooltip: "'Pelusa's favorite bow'" -} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 675c64e604..eb17975d7f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -460,17 +460,17 @@ ReaverHeadExplore: { DisplayName: Reaver Headgear Tooltip: ''' - 20% increased mining speed and block/wall placement speed + 20% increased mining speed + 50% increased block & wall placement speed Grants immunity to lava and can move freely through liquids ''' SetBonus: ''' - Highlights all treasure nearby - Increased item grab range and block placement range - Mining tiles restores breath while underwater - Summons a reaver orb to light up the area around you - Reduces enemy aggression, even in the abyss - Provides a small amount of light in the abyss + Summons an orb which highlights nearby treasure and provides light + Grants underwater breathing and reduced enemy aggression + These have a moderate effect while in the Abyss + Increased block placement & tool range by 7 + Increases pickup range for items ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index ab21fcb087..438e31c223 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -96,7 +96,7 @@ MarniteArchitectHeadgear: { MarniteArchitectToga: { DisplayName: Marnite Architect Toga - Tooltip: Increases tile placement speed by 50% + Tooltip: Increases block & wall placement speed by 50% } SnowRuffianChestplate: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 433e0e4d83..d3c1dfc482 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -43,9 +43,10 @@ UrsaSergeant: { DisplayName: Ursa Sergeant Tooltip: ''' - Decreased movement speed by 15% - Immune to Astral Infection and Feral Bite - Increased regeneration at lower health + Attacks maul enemies with astral claw swipes + Taking damage reduces the cooldown, but inflicts you with Astral Infection + Enemy kills also reduce the cooldown + Swipes will be translucent and silent if visibility is disabled ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index fad6ef1784..c148a105c5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -466,7 +466,7 @@ LorePerforators: { These creatures were unique. They wielded the slain Gods' power as purely as possible, veins flowing with spilt ichor. All that exists in the Crimson is truly the divine turned inside out; their gore now glistens with perverse treachery for all to bear witness. The mire reeks of centuries of vile manipulation and callous domination of the hapless. - Judgment has long passed and only extinction is left waiting. + Judgement has long passed and only extinction is left waiting. ''' Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 0c302fbb07..09d62b1f95 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -1,4 +1,14 @@ // Critters +AlphaSeaMinnowItem: { + DisplayName: Alpha Sea Minnow + Tooltip: "" +} + +AlphaSeaMinnowGoldItem: { + DisplayName: Gold Alpha Sea Minnow + Tooltip: "" +} + AndroombaItem: { DisplayName: "{$Mods.CalamityMod.NPCs.Androomba.DisplayName}" Tooltip: @@ -19,7 +29,27 @@ BabyFlakCrabItem: { } BabyGhostBellItem: { - DisplayName: "{$Mods.CalamityMod.NPCs.BabyGhostBell.DisplayName}" + DisplayName: Blue Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellGoldItem: { + DisplayName: Gold Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellGreenItem: { + DisplayName: Green Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellRadiantItem: { + DisplayName: Radiant Baby Ghost Bell + Tooltip: "" +} + +BabyGhostBellRedItem: { + DisplayName: Red Baby Ghost Bell Tooltip: "" } @@ -43,6 +73,56 @@ NanodroidPlagueRedItem: { Tooltip: "" } +PearlpodBlackItem: { + DisplayName: Black Pearlpod + Tooltip: "" +} + +PearlpodItem: { + DisplayName: White Pearlpod + Tooltip: "" +} + +PearlpodGoldItem: { + DisplayName: Gold Pearlpod + Tooltip: "" +} + +PearlpodPinkItem: { + DisplayName: Pink Pearlpod + Tooltip: "" +} + +PolypPanaseaGoldItem: { + DisplayName: Gold Polyp Panasea + Tooltip: "" +} + +PolypPanaseaGreenItem: { + DisplayName: Green Polyp Panasea + Tooltip: "" +} + +PolypPanaseaItem: { + DisplayName: Red Polyp Panasea + Tooltip: "" +} + +PolypPanaseaPurpleItem: { + DisplayName: Purple Polyp Panasea + Tooltip: "" +} + +PolypPanaseaRadiantItem: { + DisplayName: Radiant Polyp Panasea + Tooltip: "" +} + +PolypPanaseaTurquoiseItem: { + DisplayName: Turquoise Polyp Panasea + Tooltip: "" +} + PiggyItem: { DisplayName: "{$Mods.CalamityMod.NPCs.Piggy.DisplayName}" Tooltip: "" @@ -58,6 +138,11 @@ SeaMinnowItem: { Tooltip: "" } +SeaMinnowGoldItem: { + DisplayName: Gold Sea Minnow + Tooltip: "" +} + TwinklerItem: { DisplayName: "{$Mods.CalamityMod.NPCs.Twinkler.DisplayName}" Tooltip: "" @@ -236,6 +321,12 @@ VoodooDemonVoodooDoll: { } // Uncategorized +ExhumeShortTooltip: + ''' + [c/C61B40:'Ah, are you curious what I saw within this item?'] + [c/BABABA:Press "Left Shift" to listen] + ''' + AlicornonaStick: { DisplayName: Alicorn on a Stick Tooltip: "'Congratulations, you're winner! Here's my head on a stick.'" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 4a904bb8a6..12b54a62da 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -762,6 +762,11 @@ SulphurousTorch: { Tooltip: Can be placed in water } +SunkenIdol: { + DisplayName: Sunken Idol + Tooltip: "" +} + ThaumaticChair: { DisplayName: Thaumatic Chair Tooltip: One of Chloe's finest creations @@ -3095,6 +3100,11 @@ LivingHolyFireBlock: { Tooltip: "" } +LivingPlagueFireBlock: { + DisplayName: Living Plague Fire Block + Tooltip: "" +} + DraedonExoSelectMusicBox: { DisplayName: Music Box (Exo Mech Selection) Tooltip: Plays 'Signal Received' by CDMusic diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 295ba11731..bcbcf33076 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -155,15 +155,6 @@ SupremeManaPotion: { Tooltip: "" } -TeslaPotion: { - DisplayName: Tesla Potion - Tooltip: - ''' - Summons an aura of electricity that electrifies and slows enemies - Aura damage is reduced on bosses - ''' -} - ZenPotion: { DisplayName: Zen Potion Tooltip: Vastly decreases enemy spawn rate diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 7bbae07534..fc4392598f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -131,7 +131,7 @@ Grax: { DisplayName: Grax Tooltip: ''' - Hitting an enemy will greatly boost your defense, melee damage and melee crit for a short time + Hitting an enemy will greatly boost your damage, defense, and damage reduction for a short time Press to use without hammering down walls or chopping down trees ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 0350b8ad7c..226ca84086 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -158,7 +158,8 @@ PulseTurretRemote: { DisplayName: Pulse Turret Remote Tooltip: ''' - Summons a pulse turret which eradicates nearby foes with focused energy blasts + {$CommonItemTooltip.Sentry} + Summons a turret to fire explosive pulse blasts at your enemies Only one pulse turret may exist at a time ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 43e6ee551c..9e1fa68771 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -47,6 +47,15 @@ AnahitasArpeggio: { ''' } +Apathanull: { + DisplayName: Apathanull + Tooltip: + ''' + Casts a spread of dark cosmic tentacles to skewer your enemies + Tentacles will aim at your cursor and lash out three times before disappearing + ''' +} + ApoctosisArray: { DisplayName: Apoctosis Array Tooltip: @@ -118,8 +127,8 @@ Atlantis: { TooltipGFBDoG: Take good care of my weapon, or else... -CIT } -AuguroftheElements: { - DisplayName: Augur of the Elements +AuguroftheVoid: { + DisplayName: Augur of the Void Tooltip: Casts a burst of elemental tentacles to spear your enemies } @@ -156,8 +165,9 @@ BurningSea: { DisplayName: Burning Sea Tooltip: ''' - Fires a bouncing brimstone fireball that splits into homing fireballs upon collision with liquid - Enemies inflicted with a water debuff also spawn homing fireballs on hit + Conjures a massive brimstone fireball that hovers near you and incinerates foes + Holding the fireball for too long causes it to burn out + This burns you with Brimstone Flames and gives a long delay before another can be cast ''' } @@ -281,18 +291,6 @@ EldritchTome: { Tooltip: Casts eldritch tentacles to spear your enemies } -ElementalRay: { - DisplayName: Elemental Ray - Tooltip: - ''' - Casts four celestial beams near the player - Solar beams explode into fire on enemy hits - Nebula beams sweep a little bit over time - Vortex beams act like fast lightning and electrify enemies on hit - Stardust beams release small stars that home on enemy hits - ''' -} - Eternity: { DisplayName: Eternity // Color changes at the second line of tooltip via ModifyTooltips. @@ -394,11 +392,14 @@ GruesomeEminence: { DisplayName: Gruesome Eminence Tooltip: ''' - Summons a gaseous conglomeration of spirits near the cursor - At first, the spirits will fly wildly. This can hurt enemies and players - However, over time they will begin to accumulate to create a single, controllable monstrosity - [c/C61B40:'The spirits of the amalgam could never pass on to their desired afterlife,] - [c/C61B40:Tainted and melded by rage as they were.'] + Summons a gaseous conglomeration of spirits near the cursor that fly around wildly + Over time, the spirits accumulate to create a single, controllable monstrosity + ''' + Calamitas: + ''' + 'Many will tell you that Yharim fell from grace as his Crusade went on, but that's far from the truth. + Sure, he was a good man when he was killing assassins drunk on power, but even as he dethroned dictators, entire kingdoms were leveled alongside. + I wish more people could bear witness to this "Polterghast". Maybe then, they would understand the pain he caused for the world.' ''' } @@ -569,6 +570,18 @@ NuclearFury: { Tooltip: Casts a torrent of cosmic typhoons } +Nucleosynthesis: { + DisplayName: Nucleosynthesis + Tooltip: + ''' + Casts four celestial beams near the player + Solar beams explode into fire on enemy hits + Nebula beams sweep a little bit over time + Vortex beams act like fast lightning and electrify enemies on hit + Stardust beams release small stars that home on enemy hits + ''' +} + Omicron: { DisplayName: Omicron Tooltip: @@ -587,7 +600,7 @@ ParasiticSceptor: { PhantasmalFury: { DisplayName: Phantasmal Fury - Tooltip: Casts a phantasmal bolt that explodes into more bolts + Tooltip: Casts a vortex of homing souls around you that repels enemies and will fly towards your cursor after a few seconds } PhoenixFlameBarrage: { @@ -673,9 +686,13 @@ Rancor: { Tooltip: ''' Casts a magic circle that charges energy and eventually releases a powerful laser burst of controlled maleficent magic - The laser causes arms and searing lava to appear on surfaces it touches which harm both you and enemies - [c/C61B40:'Forgiveness can only heal so much,] - [c/C61B40:If the recipient has not yet forgiven themselves.'] + The laser causes arms and searing lava to appear on surfaces it touches + ''' + Calamitas: + ''' + 'Yharim told me it was Otonilou who unleashed the Brimstone Elemental unto Azafure. + I believed him at the time, being a child looking for someone to blame for all her woes. + So I unleashed upon them all the fury and scorn I thought they deserved, and only once it was too late did I see through his lies.' ''' } @@ -714,7 +731,11 @@ SanguineFlare: { SeethingDischarge: { DisplayName: Seething Discharge - Tooltip: Fires a barrage of brimstone blasts + Tooltip: + ''' + Fires an accelerating arc of brimstone hellblasts + Every third attack spawns a brimstone dart ring which chases after foes + ''' } Serpentine: { @@ -738,7 +759,7 @@ ShaderainStaff: { ShadowboltStaff: { DisplayName: Shadowbolt Staff - Tooltip: The more tiles and enemies the beam bounces off of or travels through the more damage the beam does + Tooltip: Fires a shadow beam that creates a platform to redirect itself back at enemies for increased damage } ShiftingSands: { @@ -887,15 +908,6 @@ Thunderstorm: { ''' } -TomeofFates: { - DisplayName: Tome of Fates - Tooltip: - ''' - Casts cosmic tentacles to spear your enemies - Can randomly fire a red tentacle for immense damage - ''' -} - Tradewinds: { DisplayName: Tradewinds Tooltip: Casts fast moving sunlight feathers @@ -956,7 +968,11 @@ Viscera: { VitriolicViper: { DisplayName: Vitriolic Viper - Tooltip: Releases a volley of venomous fangs and spit + Tooltip: + ''' + Charges up and fires a slithering beam of radiation + If fully charged, instead fires a huge spread of short range fangs which quickly vanish + ''' } VividClarity: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 093d0689e4..970d8177e7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -164,7 +164,12 @@ BalefulHarvester: { BallOFugu: { DisplayName: Ball O' Fugu - Tooltip: Throws a fish that spews homing spikes + Tooltip: + ''' + Throws a flailing abyssal pufferfish + Builds up poisonous spikes as it spins + Spikes blow out of the fish as it retracts + ''' } BansheeHook: { @@ -174,7 +179,11 @@ BansheeHook: { Basher: { DisplayName: Basher - Tooltip: Swings a rotten club that poisons and irradiates enemies on hit + Tooltip: + ''' + Swings a rotten club that poisons and irradiates enemies on hit + Holding while swinging will increase the club's damage, but will also knock you back on hit + ''' } BladecrestOathsword: { @@ -434,11 +443,6 @@ ElementalLance: { ''' } -ElementalShiv: { - DisplayName: Elemental Shiv - Tooltip: Shoots a rainbow shiv that spawns additional shivs on hit -} - EmpyreanKnives: { DisplayName: Empyrean Knives Tooltip: Throws a flurry of bouncing knives that can heal the user @@ -446,7 +450,12 @@ EmpyreanKnives: { EntropicClaymore: { DisplayName: Entropic Claymore - Tooltip: Fires a spread of homing plasma balls + Tooltip: + ''' + Fires a spread of living plasma that swims though the air + Plasma will track your cursor or enemies near it, prioritizing which is closest + The plasma pierces, but will stop tracking after hitting the first enemy + ''' } EssenceFlayer: { @@ -665,14 +674,7 @@ GrandGuardian: { GreatswordofJudgement: { DisplayName: Greatsword of Judgement - Tooltip: - ''' - Fires a white orb that emits white rain from where it dissipates for a time - A pale white sword from a forgotten land - You can hear faint yet comforting whispers emanating from the blade - 'No matter where you may be you are never alone - I shall always be at your side, my lord' - ''' + Tooltip: Fires a piercing energy wave that releases homing stars as it flies } Greentide: { @@ -727,7 +729,11 @@ IllustriousKnives: { InsidiousImpaler: { DisplayName: Insidious Impaler - Tooltip: Fires infected harpoons that stick to enemies and explode + Tooltip: + ''' + Throws self-propelling radioactive harpoons which chase foes + Harpoons ricochet at close range for additional hits + ''' } IridescentExcalibur: { @@ -789,7 +795,9 @@ MantisClaws: { DisplayName: Mantis Claws Tooltip: ''' - Explodes on enemy hits + Rapidly swing a mantis claw which slashes foes in short range + Press to form a pressurized bubble in front of you + Once fully formed, the bubble is instantly snapped down on, blasting foes with a water jet 'It's just that shrimple' ''' } @@ -906,11 +914,10 @@ Orderbringer: { DisplayName: Orderbringer Tooltip: ''' - Fires a rainbow blade that emits rainbow rain from where it dissipated for a time - A pale white sword from a forgotten land - You can hear faint yet comforting whispers emanating from the blade - 'No matter where you may be you are never alone - I shall always be at your side, my lord' + Fires piercing energy waves and summons four homing stars near your cursor + Energy waves deal more damage with each consecutive hit + Hits with the blade summon two beams from the sky + 'No matter where you may be you are never alone' ''' } @@ -1008,7 +1015,7 @@ RemsRevenge: { Tooltip: ''' Summons blood explosions and lowers enemy defense on hit - Wielded by the most powerful fighter + 'A deadly morning star befitting its demonic owner' ''' } @@ -1117,6 +1124,11 @@ SpineOfThanatos: { ''' } +StarburstShiv: { + DisplayName: Starburst Shiv + Tooltip: Shoots a rainbow shiv that spawns additional shivs on hit +} + StarnightLance: { DisplayName: Starnight Lance Tooltip: Shoots a frigid starnight beam @@ -1254,11 +1266,11 @@ TheDarkMaster: { DisplayName: The Dark Master Tooltip: ''' - Fires red echo slash projectiles at full health - Projectile damage increases for every point of HP above 400 + Fires red echo slash projectiles when above 75% health + Projectile damage increases for every HP above 400 Press to spawn three shadow clones in a Delta formation The clones will mirror your sword swings and release projectiles - The clones will always fire projectiles regardless of your own HP + Projectiles are fired regardless of your own HP, but deal less damage The clones may only exist while holding this weapon 'The blade by which the shadows levy their foes with a terrible fate' ''' @@ -1333,9 +1345,15 @@ TitanArm: { ''' } -TriactisTruePaladinianMageHammerofMightMelee: { +TriactisTruePaladinianMageHammerofMight: { DisplayName: Triactis' True Paladinian Mage-Hammer of Might - Tooltip: Explodes on enemy hits + Tooltip: + ''' + Throws a heavy, gravity-affected hammer that will return to you after striking an enemy + Enemy hits release prismatic light flares which orbit around the struck foe + Instead of returning, the fourth hit transforms flares into hardlight hammers + These hammers converge and form a universe-collapsing explosion + ''' } TrueArkoftheAncients: { @@ -1384,7 +1402,12 @@ TrueCausticEdge: { Tumbleweed: { DisplayName: Tumbleweed - Tooltip: Releases a rolling tumbleweed on hit + Tooltip: + ''' + Throws a tumbleweed flail + Spinning tumbleweeds brew a localized dust storm + Launched tumbleweeds detach from their chain upon striking an enemy and roll forwards + ''' } TyphonsGreed: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 8c93d08451..0f076074cf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -239,10 +239,16 @@ Buzzkill: { ChickenCannon: { DisplayName: Chicken Cannon + Tooltip: Fires chicken flares which create enormous incendiary explosions +} + +ChromaticEruption: { + DisplayName: Chromatic Eruption Tooltip: ''' - Fires chicken flares which create enormous incendiary explosions - Press to detonate all airborne rockets + Charges up to spew rainbow flames and pairs of homing chromatic flares + Uses gel for ammo + 70% chance to save ammo ''' } @@ -455,16 +461,6 @@ DriftwoodBow: { Tooltip: This bow is stronger while you are wet } -ElementalEruption: { - DisplayName: Elemental Eruption - Tooltip: - ''' - Charges up to spew rainbow flames and pairs of homing elemental flares - Uses gel for ammo - 70% chance to save ammo - ''' -} - EternalBlizzard: { DisplayName: Eternal Blizzard Tooltip: Fires an additional icicle arrow that freezes into a falling icicle @@ -626,11 +622,11 @@ Hellborn: { DisplayName: Hellborn Tooltip: ''' - Fires a spread of 3 bullets - Enemies that touch the gun while it's being fired trigger a massive explosion - After the explosion, this gun gains a massive boost to damage, fire rate and knockback for 10 seconds - These stat bonuses slowly decay over time - Converts musket balls into explosive bullets + An ornate firearm created during the Draconic Era by Azafure's finest forgemaster + Hold to twirl the gun in your hand, rapidly hitting nearby enemies + Hits with the gun itself add rounds to the gun, up to a max of 8 + At the cost of one round, hold to fire a giant energy sphere with potent recoil + [c/E1B65F:'Know the grace of a gun forged through beauteous inspiration'] ''' } @@ -1091,8 +1087,12 @@ SepticSkewer: { DisplayName: Septic Skewer Tooltip: ''' - Launches a spiky harpoon infested with toxins - Releases bacteria when returning to the player + Launches a vile chained harpoon infested with toxins + Harpoons stick into enemies and inflict Sulphuric Poisoning for a long time + After being impaled for one second, harpoons rip themselves back out and spray damaging gores + Press to manually rip out all harpoons, dealing bonus damage + Enemies close to death are dragged back with returning harpoons and executed when they reach you + Executions heal you for 25 health and launch an additional harpoon automatically ''' } @@ -1339,6 +1339,7 @@ TheSevensStriker: { 'A gun given to a great gunslinger Forged by the arms of a man given no name' ''' + HoldShiftTooltip: "[c/ADD8E6:'LET'S GO GAMBLING!']" } TheStorm: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 7d3b12e80a..da591d6c91 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -348,7 +348,7 @@ EclipsesFall: { ''' Summons spears from the sky on hit Stealth strikes impale enemies and summon a constant barrage of spears over time - 'When the sun goes dark, you will know judgment' + 'When the sun goes dark, you will know judgement' ''' } @@ -588,7 +588,11 @@ Hypothermia: { Icebreaker: { DisplayName: Icebreaker - Tooltip: Stealth strikes spawn a cosmic explosion and freeze nearby enemies on enemy hits + Tooltip: + ''' + Throws an icy hammer that magically returns to the player + Stealth strikes spawn a cosmic explosion and freeze nearby enemies on hit + ''' } IceStar: { @@ -1058,7 +1062,12 @@ Seraphim: { ShardofAntumbra: { DisplayName: Shard of Antumbra - Tooltip: Stealth strikes leave homing stars in their wake + Tooltip: + ''' + Throws a cosmic javelin that sticks into enemies and tiles, creating a small rift nearby on enemy hits + After hitting a target, it will charge with energy and teleport to the rift, aiming itself at the nearest target + Stealth strikes create a multitude of rifts to spawn additional javelins upon teleporting + ''' } ShatteredSun: { @@ -1167,9 +1176,10 @@ StarofDestruction: { DisplayName: Star of Destruction Tooltip: ''' - Fires a huge destructive mine that explodes into destruction bolts - Amount of bolts scales with enemies hit, up to 16 - Stealth strikes always explode into the max amount of bolts + Throws a fan of cosmic bolts that meld together into a star of destruction + The explosive star will slowly follow your cursor until it expires or hits an enemy + Stealth strikes throw additional bolts that converge into faster star that can pierce, exploding on every hit + Upon running out of time, the star will burst into a huge explosion that deals increased damage ''' } @@ -1265,9 +1275,10 @@ TheOldReaper: { DisplayName: The Old Reaper Tooltip: ''' - Throws a homing reaper scythe that shreds enemies - Stealth strikes throw three at once - 'Slice 'n dice' + Throws an irradiated scythe that cuts through enemies + Deposits unstable isotopes on hit, which create delayed nuclear explosions when they decay + Stealth strikes are thrown into the sky and fall upon enemies a few seconds later + On hit, stealth strikes create a focused deluge of acid rain ''' } @@ -1326,9 +1337,8 @@ ToxicantTwister: { DisplayName: Toxicant Twister Tooltip: ''' - Throws a slow moving boomerang - After a few moments, the boomerang chooses a target and rapidly homes in - Stealth strikes home in faster and rapidly release sand + Throws a fan of four spinning disks that swirl around your cursor + Stealth strikes swirl in a wider range and create a vortex of toxic raindrops that home in on enemies ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index e970c71f54..f60e9dc57e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -24,7 +24,8 @@ AquasScepter: { DisplayName: Aqua's Scepter Tooltip: ''' - Summons a giant storm cloud sentry to rain down on your foes, and strike nearby enemies with overloading tesla energy + {$CommonItemTooltip.Sentry} + Summons a giant storm cloud to rain down on your foes, and strike nearby enemies with overloading tesla energy 'Captain! I think- we've got a risk of rain!' ''' } @@ -44,6 +45,7 @@ AtlasMunitionsBeacon: { DisplayName: Atlas Munitions Beacon Tooltip: ''' + [c/F2B629:{$CommonItemTooltip.Sentry}] [c/F2B629:Brings forth an exo-powered, stationary cannon] [c/F2B629:The cannon will fire at enemies within its range] [c/F27049:If an enemy is in close proximity, it will enter Overdrive] @@ -90,13 +92,17 @@ BrittleStarStaff: { Summons a small brittle starfish that will dash through enemies until it shatters Starfish will quickly regenerate after shattering Holding right click will swap starfish between dashing and circling you - When the starfish are circling, each one provides you with 3 defense + When the starfish are circling, each one provides you with 4 defense ''' } CadaverousCarrion: { DisplayName: Cadaverous Carrion - Tooltip: Summons a gross, shark-puking Old Duke head on the ground + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a gross, shark-puking Old Duke head on the ground + ''' } CalamarisLament: { @@ -115,7 +121,11 @@ CalamarisLament: { CausticCroakerStaff: { DisplayName: Caustic Croaker Staff - Tooltip: Summons a toad that explodes if enemies are nearby + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a toad that explodes if enemies are nearby + ''' } CausticStaff: { @@ -144,8 +154,12 @@ CindersOfLament: { Summons either Cataclysm or Catastrophe at the mouse position They will look at you for a moment before charging at you They can do damage to both you and enemies - [c/C61B40:'The Witch, a sinner of her own making,] - [c/C61B40:Within her mind her demon lies, ever patient, until the end of time.'] + ''' + Calamitas: + ''' + 'My brothers perished in Azafure. I found their bodies near the center of the city, after they left for an expedition. + Before my power was what it is now, they were always alongside me and didn't allow anyone to harm me. It may have been a problem sometimes, but they were surprisingly obedient. + And even after all that's happened, and even in death, they still look out for me. Isn't that sweet of them?' ''' } @@ -214,7 +228,8 @@ CryogenicStaff: { DisplayName: Cryogenic Staff Tooltip: ''' - Summons an animated ice construct to protect you + {$CommonItemTooltip.Sentry} + Summons an ice construct to unleash the cold upon your enemies Fire rate and range increase the longer it targets an enemy ''' } @@ -277,12 +292,11 @@ DragonbloodDisgorger: { DreadmineStaff: { DisplayName: Dreadmine Staff - Tooltip: Summons a dreadmine turret to fight for you -} - -ElementalAxe: { - DisplayName: Elemental Axe - Tooltip: Summons an elemental axe to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a turret that swarms your enemies with sea mines + ''' } EnchantedConch: { @@ -420,7 +434,8 @@ GuidelightofOblivion: { DisplayName: Guidelight of Oblivion Tooltip: ''' - Summons a lantern turret to fight for you + {$CommonItemTooltip.Sentry} + Summons a lantern that swarms your enemies with flames 'Shadows dream of endless fire, flames devour and embers swoop' ''' } @@ -429,6 +444,7 @@ HarvestStaff: { DisplayName: Harvest Staff Tooltip: ''' + {$CommonItemTooltip.Sentry} Grows a pumpkin patch that sprouts pumpkins nearby Pumpkins will hop out when approached by nearby creatures or players Once out, they will aggressively tackle enemies, exploding on hit @@ -448,7 +464,11 @@ HerringStaff: { HivePod: { DisplayName: Hive Pod - Tooltip: Summons an astraglomerate to protect you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons an astraglomerate to spawn glomerings at your enemies + ''' } IgneousExaltation: { @@ -483,6 +503,11 @@ KingofConstellationsTenryu: { ''' } +LegionofCelestia: { + DisplayName: Legion of Celestia + Tooltip: Summons a possessed, celestial axe to fight for you +} + LiliesOfFinality: { DisplayName: Lilies of Finality Tooltip: @@ -498,12 +523,16 @@ Metastasis: { Tooltip: ''' Summons a Sepulcher to fight for you - While the Sepulcher is active brimstone hearts will begin to appear and orbit you - It will attempt to attack you more and more frequently depending on how many hearts are present - It takes up 4 minion slots and it can only be summoned once - [c/C61B40:A contemplated possible future of the cosmic serpent,] - [c/C61B40:A gruesome warning for those blinded by the hunger for power.] - + While the Sepulcher is active, brimstone hearts will begin to appear and orbit you + When too many hearts are present, it will interrupt attacking to attack the hearts instead + This happens more frequently depending on how many hearts are present + Requires 4 minion slots to use and can only be summoned once + ''' + Calamitas: + ''' + 'When I joined Yharim's ranks, the Devourer was one of the first to greet me. He seemed kind at first, but that mask did not last long. + He was arrogant, disrespectful and shady. If you hadn't killed him, I would've. + I made my Sepulcher as a mockery of his arrogance, but it seems the insult fell flat. You can add "slime-brained" to his list of fabricated titles.' ''' } @@ -540,7 +569,11 @@ MutatedTruffle: { OrthoceraShell: { DisplayName: Orthocera Shell - Tooltip: Summons a flying orthocera sentry at the mouse position + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a flying orthocera to spit acid streams at your enemies + ''' } Perdition: { @@ -564,7 +597,11 @@ PlantationStaff: { PolypLauncher: { DisplayName: Polyp Launcher - Tooltip: Summons a polyp bunch that launches coral chunks at nearby enemies + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a polyp bunch that launches coral chunks at nearby enemies + ''' } PuffShroom: { @@ -586,14 +623,18 @@ RustyBeaconPrototype: { DisplayName: Rusty Beacon Prototype Tooltip: ''' - Summons a long-abandoned drone to support you - The drone hovers in place and releases toxic waves that irradiate hit enemies + {$CommonItemTooltip.Sentry} + Summons a long-abandoned drone that passively emits irradiated waves ''' } SanctifiedSpark: { DisplayName: Sanctified Spark - Tooltip: Summons a profaned energy turret to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a friendly immolator to fire holy sparks at your enemies + ''' } SandSharknadoStaff: { @@ -649,17 +690,26 @@ SlimePuppetStaff: { SpikecragStaff: { DisplayName: Spikecrag Staff Tooltip: "[GFB]" - TooltipNormal: Summons a spikecrag to protect you + TooltipNormal: + ''' + {$CommonItemTooltip.Sentry} + Summons a bed of stalagmites to spray spikes at your enemies + ''' TooltipGFB: ''' - Summons a spikecrag to protect you" + {$CommonItemTooltip.Sentry} + Summons a bed of stalagmites to spray spikes at your enemies Defeating the Profaned Goddess unlocks its true power ''' } SquirrelSquireStaff: { DisplayName: Squirrel Squire Staff - Tooltip: Summons a squirrel squire to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a squirrel to throw acorns at your enemies + ''' } StaffOfNecrosteocytes: { @@ -744,7 +794,7 @@ UniverseSplitter: { Summons an energy field at the mouse cursor After the field has been deployed, it begins to summon multiple small beams After several seconds have passed, an enormous laser beam appears at the field's position - This effect has a cooldown + This effect has a 30 second cooldown Attempting to use this item during the cooldown will cause it to short circuit and do damage to you [c/BB57FF:'An ancient artifact from a previous age, it waits for your command.] [c/BB57FF:This is a terrible idea, but it isn't yours anyways... right?'] diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 5bee99dffd..ca72be5b6f 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -40,6 +40,7 @@ CragmawVibeCheck: Vibe check. AutocannonHot: OUCH! HOT! NoComputer: No decryption computer installed ArkParry: Parry! +BurningSeaBurn: It burns... LightsWarning: I've gotta give you a flashing lights warning on this one ClockworkTick: Tick ClockworkTock: Tock diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index afa6174a38..bd6922c696 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -165,6 +165,7 @@ CryoSlime.DisplayName: Cryo Slime EbonianBlightSlime.DisplayName: Ebonian Blight Slime Eidolist.DisplayName: Eidolist FearlessGoldfishWarrior.DisplayName: Fearless Goldfish Warrior +Foveanator.DisplayName: Foveanator Frogfish.DisplayName: Frogfish Horse.DisplayName: Earth Elemental IceClasper.DisplayName: Ice Clasper @@ -258,18 +259,33 @@ MicrobialCluster.DisplayName: Microbial Cluster Sulflounder.DisplayName: Sulflounder Toxicatfish.DisplayName: Toxicatfish Trasher.DisplayName: Trasher +AlphaSeaMinnow.DisplayName: Alpha Sea Minnow +AlphaSeaMinnowGold.DisplayName: Gold Alpha Sea Minnow +MinnowPrime: Minnow Prime BabyGhostBell.DisplayName: Baby Ghost Bell BlindedAngler.DisplayName: Blinded Angler Clam.DisplayName: Clam EutrophicRay.DisplayName: Eutrophic Ray +FesteringRemains.DisplayName: Festering Remains GhostBell.DisplayName: Ghost Bell GiantClam.DisplayName: Giant Clam Clamitas: Clamitas SupremeClamitas: Supreme Clamitas +HauntedChum.DisplayName: Haunted Chum +KelpieSeadragon.DisplayName: Kelpie Seadragon +LostShoal.DisplayName: Lost Shoal +PearlpodBlack.DisplayName: Pearlpod +PearlpodGold.DisplayName: Gold Pearlpod +PearlpodPink.DisplayName: Pearlpod +PearlpodWhite.DisplayName: Pearlpod +PolypPanasea.DisplayName: Polyp Panasea PrismBack.DisplayName: Prism-Back +SandProwler.DisplayName: Sand Prowler +SandProwlerNested.DisplayName: Sand Prowler SeaFloaty.DisplayName: Sea Floaty SeaMinnow.DisplayName: Sea Minnow -SeaSerpent1.DisplayName: Sea Serpent +SeaMinnowGold.DisplayName: Gold Sea Minnow +Sharkoon.DisplayName: Sharkoon BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker @@ -578,7 +594,7 @@ THIEF: { LikeNPC: "{NPCName} doesn't only keep spiky balls in his pockets, he keeps a ton of cash! He's too absentminded to notice I'm stealing from him too! I like that a lot!" DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! - Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how she does it!" + Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" } } @@ -623,3 +639,6 @@ WITCH: { Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!" } } + +Probesnout.DisplayName: Probesnout +ProbesnoutGold.DisplayName: Probesnout Gold diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index bfc7b09788..a457e9850c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -81,7 +81,7 @@ HolyFlare.DisplayName: Holy Flare HolyLight.DisplayName: Holy Light HolySpear.DisplayName: Holy Spear HomingGasBulb.DisplayName: Homing Gas Bulb -HomingGasBulbSporeGas.DisplayName: Homing Gas Bulb Spore Gas +HomingGasBulbSporeGas.DisplayName: Spore Bulb Gas IceBlast.DisplayName: Ice Blast IceBomb.DisplayName: Ice Bomb IceRain.DisplayName: Ice Rain diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 1972f5913e..64453c156d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -15,6 +15,7 @@ FlameBurstHostile.DisplayName: Burst GammaAcid.DisplayName: Acid GammaBeam.DisplayName: Gamma Ray GammaRayBurst.DisplayName: G-FUEL BEAM +HorsPoisonBlast.DisplayName: Poisonous Spit HorsWaterBlast.DisplayName: Water IceClasperEnemyProjectile.DisplayName: Ice Shard InkBombHostile.DisplayName: Ink Bomb @@ -30,6 +31,7 @@ OrthoceraStream.DisplayName: Acid Stream PearlBurst.DisplayName: Pearl Burst PearlRain.DisplayName: Pearl Rain PufferExplosion.DisplayName: Explosion +SharkoonExplosion.DisplayName: Sharkoon Explosion StormMarkHostile.DisplayName: Mark SulphuricAcidBubble.DisplayName: Acid Bubble SulphuricAcidMist.DisplayName: Acid Mist diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index acbd83c5b3..c2d1a9da29 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -19,7 +19,7 @@ AstralCrystal.DisplayName: Astral Crystal AstralCrystalInvisibleExplosion.DisplayName: Astral Crystal Invisible Explosion AstralStarMagic.DisplayName: Astral Star AtlantisSpear.DisplayName: Atlantis Spear -AuraRain.DisplayName: Aura Rain +AugurTentacle.DisplayName: Elemental Tentacle AuroraAustralis.DisplayName: Aurora Australis BeamingBolt.DisplayName: Beaming Bolt BeamingBolt2.DisplayName: Beaming Bolt @@ -34,10 +34,7 @@ BloodRay.DisplayName: Blood Ray BlueBubble.DisplayName: Bubble BlushieStaffProj.DisplayName: Staff of Blushie BrimroseBeam.DisplayName: Brimrose Beam -BrimstoneFireball.DisplayName: Brimstone Fireball BrimstoneHellfireballFriendly.DisplayName: Hellfireball -BrimstoneHomer.DisplayName: Brimstone Homer -BrimstoneTentacle.DisplayName: Brimstone Tentacle CauldronProj.DisplayName: Smauldron CauldronProjSmall.DisplayName: Smaullerdron ChronoIcicleLarge.DisplayName: Chrono Icicle @@ -58,7 +55,6 @@ DivineRetributionSpear.DisplayName: Divine Retribution EelDrop.DisplayName: Acid Eel Drop EidolicWailSoundwave.DisplayName: Eidolic Wail EldritchTentacle.DisplayName: Eldritch Tentacle -ElementTentacle.DisplayName: Elemental Tentacle EnormousConsumingVortex.DisplayName: Subsuming Vortex EternityCircle.DisplayName: Eternity EternityCrystal.DisplayName: Crystal @@ -104,6 +100,7 @@ IceBlockIcicle.DisplayName: Ice Barrage IceCluster.DisplayName: Ice Cluster Icicle.DisplayName: Icicle IcicleStaffProj.DisplayName: Furious Icicle +IncineratingFireball.DisplayName: Incinerating Fireball InfernadoFriendly.DisplayName: Infernado InfernadoMarkFriendly.DisplayName: Infernado Mark InfernalBlade.DisplayName: Infernal Blade @@ -195,7 +192,6 @@ SerpentineBody.DisplayName: Serpentine SerpentineHead.DisplayName: Serpentine SerpentineTail.DisplayName: Serpentine ShadecrystalProjectile.DisplayName: Shadecrystal -ShadeNimbus.DisplayName: Shade Nimbus ShadeNimbusCloud.DisplayName: Shade Nimbus Shaderain.DisplayName: Shaderain Shadowbolt.DisplayName: Shadowbolt diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index b9efe7fb5d..2286355f2b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -29,7 +29,6 @@ AtaraxiaMain.DisplayName: Not Exoblade AtaraxiaSide.DisplayName: Also Not Exoblade AtaraxiaSplit.DisplayName: Still Not Exoblade BalefulHarvesterProjectile.DisplayName: Pumpkin Skull -BallOFuguProj.DisplayName: Ball O Fugu BansheeHookBoom.DisplayName: Banshee Boom BansheeHookScythe.DisplayName: Banshee Scythe BiomeBladeHoldout.DisplayName: Mended Biome Blade @@ -39,7 +38,6 @@ BlazingPhantomBlade.DisplayName: Blazing Phantom Blade Blood.DisplayName: Carnage Blood Blood2.DisplayName: Blood BloodBall.DisplayName: Blood Ball -BloodExplosion.DisplayName: Blood BloodScythe.DisplayName: Blood Scythe BonebreakerFragment1.DisplayName: Bone Crunching Shrapnel BonebreakerProjectile.DisplayName: Bonebreaker @@ -103,16 +101,12 @@ EarthBoom.DisplayName: Earth's Judgement EarthMeteor.DisplayName: Gaia Meteor ElementalGlassStar.DisplayName: Glass Star ElementBall.DisplayName: Elemental Ball -ElementBallShiv.DisplayName: Shiv EmpyreanKnife.DisplayName: Empyrean Knife EntropicFlechette.DisplayName: Entropic Flechette -EntropicFlechetteLarge.DisplayName: Entropic Flechette -EntropicFlechetteSmall.DisplayName: Entropic Flechette EonBolt.DisplayName: Eon Bolt EssenceFlame2.DisplayName: Essence Flame EssenceScythe.DisplayName: Essence Scythe EutrophicScimitarProj.DisplayName: Scimitar Zap -EutrophicSpark.DisplayName: Eutrophic Spark ExcelsusBlue.DisplayName: Excelsus ExcelsusMain.DisplayName: Excelsus ExcelsusPink.DisplayName: Excelsus @@ -174,6 +168,9 @@ LifeScythe.DisplayName: Lifehunt Scythe LightBeam.DisplayName: Light Beam LightningThing.DisplayName: Lightning LuxorsGiftMelee.DisplayName: Luxor's Melee +MantisClawHoldout.DisplayName: Mantis Claw +MantisClawJet.DisplayName: Mantis Claw Jet +MantisClawSlash.DisplayName: Mantis Claw Slash MercurialTides.DisplayName: Mercurial Tides MercurialTidesBlast.DisplayName: Mercurial Blast MercurialTidesMonolith.DisplayName: Mercurial Monolith @@ -191,10 +188,8 @@ NeptunesBountySplitProjectile.DisplayName: Neptune's Bounty Jet Oathblade.DisplayName: Oathblade OathswordFlame.DisplayName: Oathsword Flame Orbacle.DisplayName: Auric Orb -OrderbringerAura.DisplayName: Aura OrderbringerBeam.DisplayName: Orderbringer Beam -OrderbringerRain.DisplayName: Rain -OrderbringerWhiteOrb.DisplayName: Orderbringer Orb +OrderbringerWaveProj.DisplayName: Order-bringing Wave PhoenixsPride.DisplayName: Phoenix's Pride PhosphorescentGauntletPunches.DisplayName: Gauntlet Punch PhotonRipperProjectile.DisplayName: Extraordinarily Cost-Inefficient Chainsaw @@ -215,7 +210,7 @@ PwnagehammerProj.DisplayName: Pwnagehammer RainbowBoom.DisplayName: Boom Razorwind.DisplayName: Razorwind RedtideWhirlpool.DisplayName: Whirlpool -RemsRevengeProj.DisplayName: Rem's Revenge +RemsRevengeExplosion.DisplayName: Blood Explosion RendingNeedle.DisplayName: Rending Needle RespiteblockBlood.DisplayName: Respiteblock Blood RespiteblockHoldout.DisplayName: Respiteblock @@ -231,18 +226,19 @@ SanguineFuryWheel.DisplayName: Sanguine Bladewheel ScourgeoftheCosmosMini.DisplayName: Miniature Cosmic Scourge ScourgeoftheCosmosProj.DisplayName: Cosmic Scourge SeashineSwordProj.DisplayName: Seashine Beam -SHIV.DisplayName: Shiv SolarNeedle.DisplayName: Solar Needle SolsticeBeam.DisplayName: Solstice Beam SoulScythe.DisplayName: Soul Scythe SoulScytheExplosion.DisplayName: Soul Explosion -Spark.DisplayName: Spark SpatialSpear.DisplayName: Elemental Spear SpatialSpear2.DisplayName: Elemental Spear SpatialSpear3.DisplayName: Elemental Spear SpatialSpear4.DisplayName: Elemental Spear SpineOfThanatosProjectile.DisplayName: Spine of Thanatos +StarburstBeam.DisplayName: Star Shiv +StarburstSHIV.DisplayName: SHIV StarnightBeam.DisplayName: Starnight Beam +StarofJudgement.DisplayName: Star of Judgement StellarContemptBlast.DisplayName: Stellar Blast StellarContemptEcho.DisplayName: Echoes of Contempt StellarContemptHammer.DisplayName: Stellar Contempt @@ -277,6 +273,8 @@ ThornBase.DisplayName: Thorn TinyCrystal.DisplayName: Crystal TinyFlare.DisplayName: Flare Tornado.DisplayName: Tornado +TriactisHammerExplosion.DisplayName: The Great Collapse +TriactisHammerFlare.DisplayName: Prismatic Light Flare TriactisHammerProj.DisplayName: Triactis' True Paladinian Mage-Hammer of Might TrueAncientBeam.DisplayName: True Ancient Beam TrueAncientBlast.DisplayName: Ancient Energy Blast @@ -289,12 +287,9 @@ TrueBitingEmbrace.DisplayName: Biting Embrace TrueDecaysRetort.DisplayName: Decay's Retort TrueGrovetendersTouch.DisplayName: Grovetender's Touch TruePurityProjection.DisplayName: Purity Projection -TumbleweedFlail.DisplayName: Tumbleweed -TumbleweedRolling.DisplayName: Tumbleweed +TumbleweedRolling.DisplayName: Rolling Tumbleweed TyphonsGreedBubble.DisplayName: Typhon's Greed UltimusCleaverDust.DisplayName: Ultimus Flame -UrchinBall.DisplayName: Urchin Ball -UrchinBallSpike.DisplayName: Urchin Ball Spike UrchinMaceProjectile.DisplayName: Urchin Mace UrchinSpikeFugu.DisplayName: Urchin Spike VirulentBeeWave.DisplayName: Virulent Bee Wave @@ -304,11 +299,7 @@ VoidTentacle.DisplayName: Void Tentacle VolcanicFireball.DisplayName: Volcanic Fireball VolcanicFireballLarge.DisplayName: Volcanic Fireball Waterfall.DisplayName: Waterfall Beam -WhiteBoltAura.DisplayName: White Aura -WhiteOrb.DisplayName: White Orb -Whiterain.DisplayName: White Rain WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver -YateveoBloomProj.DisplayName: Yateveo Bloom YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 310422979b..768e7fdcd3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -43,6 +43,8 @@ ChargedBlast.DisplayName: Blast ChargedBlastSplit.DisplayName: Charged Blast Split ChickenExplosion.DisplayName: Kentucky Fried Explosion ChickenRocket.DisplayName: Chicken Rocket +ChromaticFire.DisplayName: Chromatic Fire +ChromaticFlare.DisplayName: Chromatic Flare CinderArrowProj.DisplayName: Cinder Arrow ClamorRifleProj.DisplayName: Clamor Bolt ClamorRifleProjSplit.DisplayName: Clamor Bolt @@ -68,8 +70,6 @@ DrizzlefishFireSplit.DisplayName: Drizzlefish Flames DryadsTearMain.DisplayName: Dryad's Tear DryadsTearSplit.DisplayName: Dryad's Tear DWArrow.DisplayName: Death's Arrow -ElementalFire.DisplayName: Elemental Fire -ElementalFlare.DisplayName: Elemental Flare ElysianArrowProj.DisplayName: Elysian Arrow ElysianArrowRain.DisplayName: Elysian Light EmesisGore.DisplayName: Rotten Gore @@ -183,7 +183,7 @@ SeaDragonRocket.DisplayName: Seadragon RPG SeasSearingBubble.DisplayName: Searing Bubble SeasSearingSecondary.DisplayName: Hydroshower SeasSearingSpout.DisplayName: Spout -SepticSkewerBacteria.DisplayName: Bacteria +SepticSkewerBacteria.DisplayName: Septic Gore SepticSkewerHarpoon.DisplayName: Septic Skewer SevensStrikerBrick.DisplayName: Brick SevensStrikerCherry.DisplayName: Cherry @@ -245,3 +245,5 @@ WaterSpout.DisplayName: Spout WildfireBloomFire.DisplayName: Wildfire Fire WildfireBloomFlare.DisplayName: Wildfire Flare WulfrumScrapBullet.DisplayName: High Speed Scrap +HellbornProj.DisplayName: Hell-born Gunblast +HellbornShell.DisplayName: Hell's Shell diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index d6752422df..ab2a36b632 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -76,6 +76,7 @@ DeepWounderWater.DisplayName: Water Droplet DesecratedBubble.DisplayName: Desecrated Bubble DesecratedWaterProj.DisplayName: Desecrated Water DestructionBolt.DisplayName: Destruction Bolt +DestructionExplosion.DisplayName: Destruction Explosion DestructionStar.DisplayName: Star of Destruction DragonScalesInfernado.DisplayName: Infernado DragonShit.DisplayName: Fire @@ -310,8 +311,8 @@ TotalityFire.DisplayName: Totality Fire TotalityFlask.DisplayName: Totality Flask TotalityTar.DisplayName: Totality Tar TotalMeltdown.DisplayName: Explosion -ToxicantTwisterDust.DisplayName: Toxicant Dust -ToxicantTwisterTwoPointZero.DisplayName: Toxicant Twister +ToxicantTwisterDust.DisplayName: Toxicant Raindrop +ToxicantTwisterProj.DisplayName: Toxicant Twister TurbulanceProjectile.DisplayName: Turbulance TurbulanceWindSlash.DisplayName: Wind Slash TwistingThunderProj.DisplayName: Twisting Thunder @@ -328,3 +329,5 @@ WrathwingCinder.DisplayName: Wrathwing Eruption WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing WulfrumKnifeProj.DisplayName: Wulfrum Knife +RadiationBurst.DisplayName: Radiation Burst +RadiationRain.DisplayName: Radiation Rain diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index 2d4249fdc1..7ae4b8d809 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -56,6 +56,7 @@ Catastromini.DisplayName: Catastromini CatastropheSummon.DisplayName: Catastrophe CausticStaffProjectile.DisplayName: Thorn CausticStaffSummon.DisplayName: Caustic Dragon +CelestialAxeMinion.DisplayName: Celestial Axe Cinder.DisplayName: Cinder CinderBlossom.DisplayName: Cinder Blossom CloudElementalMinion.DisplayName: Cloudy Waifu @@ -89,15 +90,14 @@ DormantBrimseekerBab.DisplayName: Dormant Brimseeker DormantBrimseekerSummoner.DisplayName: Dormant Brimseeker Dreadmine.DisplayName: Dreadmine DreadmineTurret.DisplayName: Dreadmine Turret -ElementalAxeMinion.DisplayName: Elemental Axe EndoBeam.DisplayName: Endo Beam EndoCooperBody.DisplayName: Ascened Cooper EndoCooperLimbs.DisplayName: Ascened Cooper EndoFire.DisplayName: Endo Fire EndoHydraBody.DisplayName: Hydra Body EndoHydraHead.DisplayName: Hydra Head +EndoHydraRay.DisplayName: Endo Ray EndoIceShard.DisplayName: Endo Ice Shard -EndoRay.DisplayName: Endo Ray EnergyOrb.DisplayName: Energy Orb EXPLODINGFROG.DisplayName: A not frog of the explosive variety EyeOfNightCell.DisplayName: Night Cell diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 213f9653d6..25cee1b8e7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -59,6 +59,7 @@ FlameLickedHellblast.DisplayName: Flame Licked Hellblast FuckYou.DisplayName: Explosion FungalClumpMinion.DisplayName: Fungal Clump GemTechArmorGem.DisplayName: Trireme's Gem +GenericElectricSpark.DisplayName: Electric Spark GhostlyBolt.DisplayName: Bolt GodKiller.DisplayName: God Killer GodSlayerShrapnel.DisplayName: Flame @@ -75,7 +76,6 @@ JewelSpike.DisplayName: Spike KelvinCatalystStar.DisplayName: Kelvin Catalyst Star LeviAmberDash.DisplayName: Riptide Slam LunicBeam.DisplayName: Beam -MageHammerBoom.DisplayName: Explosion MagnusBeam.DisplayName: Beam MythrilFlare.DisplayName: Mythril Flare NanoFlare.DisplayName: Nano Flare @@ -88,9 +88,7 @@ OmegaBlueTentacle.DisplayName: Omega Blue Tentacle OnyxLabSeeker.DisplayName: Seeking Mechanism PauldronDash.DisplayName: Pauldron Dash PauldronExplosion.DisplayName: Pauldron Explosion -PendantProjectile1.DisplayName: Prism Shard -PendantProjectile2.DisplayName: Prism Shard -PendantProjectile3.DisplayName: Prism Shard +PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater PscTransformAnimation.DisplayName: Psc Transform Animation @@ -99,13 +97,14 @@ ReaverOrb.DisplayName: Reaver Orb ReaverThornBase.DisplayName: Thorn RedLabSeeker.DisplayName: Seeking Mechanism RiftReelerBobber.DisplayName: Chaotic Bobber -SabatonBoom.DisplayName: Sabaton Boom -SabatonSlam.DisplayName: Sabaton Slam SandCloakVeil.DisplayName: Dust Veil SandExplosion.DisplayName: Sand Seashell.DisplayName: Seashell SepulcherSoul.DisplayName: Tormented Soul SerpentsBiteHook.DisplayName: Serpent's Bite +ShadeNimbus.DisplayName: Shade Nimbus +ShadeNimbusRain.DisplayName: Shade Rain +ShadeNimbusSpawner.DisplayName: Dank Creeper ShadowflameExplosion.DisplayName: Shadowflame Explosion ShadowflameExplosionBig.DisplayName: Shadowflame Explosion SkyFlareFriendly.DisplayName: Flare @@ -115,12 +114,15 @@ SpiritOriginBullseye.DisplayName: Spirit Origin Bullseye StandingFire.DisplayName: Flame StarStruckWaterBottle.DisplayName: Bottle StickyFeatherAero.DisplayName: Feather +StomperSlam.DisplayName: Stomper Slam SuicideBomberDemon.DisplayName: Demon SulphuricAcidBubbleFriendly.DisplayName: Acid Bubble SulphurousSandBallGun.DisplayName: Sulphurous Sand TarraEnergy.DisplayName: Tarra Energy TarragonAura.DisplayName: Tarragon Aura TeslaAura.DisplayName: Tesla's Electricity +TitanHeartBoom.DisplayName: Titan Heart Boom +UrsaSlash.DisplayName: Ursa Slash VerstaltiteBobber.DisplayName: Verstaltite Bobber VoidFieldGenerator.DisplayName: Void Field Generator WaterConvertor.DisplayName: Water Convertor diff --git a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson index c138308068..05300a04a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson @@ -3,6 +3,9 @@ SlimeGodRun: The Slime God flees to fight another day... // Cryogen CryogenBossText: Cryogen is derping out! PyrogenBossText: Pyrogen is derping out! +// Triplets +TripletsBossText: The Triplets have awoken! +TripletsDefeatName: The Triplets // Calamitas Clone CalamitasBossText: You underestimate my power... CalamitasBossText2: Rise again, my siblings. diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 2559accc78..f6dc2c8748 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -3,7 +3,6 @@ AbyssDrown2: Oxygen failed to reach {0} from the depths of the Abyss. AbyssDrown3: "{0} faded away, lost in the dark waters." AlcoholBig1: "{0} downed too many shots." AlcoholBig2: "{0}'s liver failed." -AlcoholSmall: "{0} succumbed to alcohol sickness." Armageddon: "{0} failed the challenge at hand." AstralInfection1: "{0}'s infection spread too far." AstralInfection2: "{0}'s skin was replaced by the astral virus." @@ -53,8 +52,7 @@ CorpusAvertor: "{0} became the blood god's sacrifice." CrushDepth1: "{0} was crushed by the pressure." CrushDepth2: "{0}'s lungs collapsed." CrushDepth3: "{0}'s bones crunched under the deep pressure." -Riptide1: "{0} was swept away by the tides." -Riptide2: "{0} was ripped apart by the current." +Daybroken: "{0} was incinerated by solar rays." Dragonfire1: "{0}'s ashes scatter in the wind." Dragonfire2: "{0}'s embers fade away in a warm glow." Dragonfire3: "{0} can no longer feel the heat of the dragonfire." @@ -86,6 +84,9 @@ Plague2: "{0} couldn't vaccinate against the plague." Plague3: "{0} was reduced to nutrient rich sludge." ProfanedSoulCrystal: "{0} was summoned too soon." ProvidenceAntiHealing: "{0} was purged of their unworthy existence." +Rebecca: "{0} was once again exploded by CIT." +Riptide1: "{0} was swept away by the tides." +Riptide2: "{0} was ripped apart by the current." 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." diff --git a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson index ab3f2729d1..3501e19e70 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Progression.hjson @@ -28,7 +28,7 @@ AureusBossText2: A faint ethereal click can be heard from the dungeon. // Golem BabyBossText: A plague has befallen the Jungle. // Astrum Deus -AstralBossText: The seal of the stars has been broken! You can now mine Astral Ore. +AstralBossText: The seal of the stars has been broken! You can now harvest Astral Ore. // Moon Lord MoonBossText: The profaned flame blazes fiercely! FutureOreText: A cold and dark energy has materialized in space. diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 190c786713..4511d4cfa3 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -80,6 +80,7 @@ ExtensionName: { // Cooldowns Cooldowns: { AquaticHeartIceShield: Ice Shield Cooldown + ArsenalPower: Arsenal Cooldown AscendEffect: Ascension Cooldown BloodflareFrenzy: Blood Frenzy Cooldown BloodflareRangedSet: Bloodflare Soul Cooldown @@ -615,6 +616,7 @@ DraedonFacility: Other minor research projects Abyss: Disposing of Silva's remains SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock +AuricLandMines: Setting god killing traps // Hold Shift tooltip default HoldShiftTooltipExtensionIndicator: Hold "Left Shift" for more HoldShiftTooltipReplacementIndicator: Hold "Left Shift" for details diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index 3e221f5442..e7a5ceade6 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -37,7 +37,7 @@ SetBonus: { ''' Eskimo: ''' - Multiplies all cold-based debuff damage by 1.25 + Multiplies all cold-based debuff damage by 1.25x Cold enemies will deal reduced contact damage to the player Provides immunity to the Chilled, Frozen, Frostburn and Glacial State debuffs ''' diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index a5a69d421a..7857a0df85 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -2180,7 +2180,7 @@ namespace CalamityMod case "GetBossHealthBoost": case "BossHealthMultiplier": case "GetBossHealthMultiplier": - return CalamityConfig.Instance.BossHealthBoost; + return CalamityServerConfig.Instance.BossHealthBoost; case "HasPermanentPowerup": case "GetPermanentPowerup": diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index cef6c31959..1ec0ce7533 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1074,8 +1074,8 @@ namespace CalamityMod double Damage(DamageClass damageClass) => Math.Round(Main.LocalPlayer.GetTotalDamage(damageClass).Additive * Main.LocalPlayer.GetTotalDamage(damageClass).Multiplicative * 100 - 100); int Crit(DamageClass damageClass) => (int)Main.LocalPlayer.GetTotalCritChance(damageClass); - int rogueItem = ModContent.ItemType(); - DamageClass rogueDamageClass = ModContent.GetInstance(); + int rogueItem = ItemType(); + DamageClass rogueDamageClass = GetInstance(); Func rogueDamage = () => $"Rogue Damage: {Damage(rogueDamageClass)}%"; Func rogueCrit = () => $"Rogue Critical: {Crit(rogueDamageClass)}%"; fargos.Call("AddStat", rogueItem, rogueDamage); @@ -1156,7 +1156,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index e1a0033532..443f800147 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 74; NPC.height = 94; NPC.defense = 100; - NPC.lifeMax = 7200; + NPC.lifeMax = 9000; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 30, 0); diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index ce50cbf3a2..17c0ade294 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Abyss NPC.height = 40; NPC.defense = 50; NPC.DR_NERD(0.25f); - NPC.lifeMax = 6000; + NPC.lifeMax = 7500; NPC.knockBackResist = 0f; AIType = -1; NPC.noGravity = true; diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index c0a59b59c8..6019c96bf4 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 30; NPC.height = 33; NPC.defense = 5; - NPC.lifeMax = 90; + NPC.lifeMax = 115; NPC.alpha = 20; NPC.aiStyle = -1; AIType = -1; diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index 772500e4be..d8d03e3d06 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 54; NPC.height = 76; NPC.defense = 0; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.knockBackResist = 0f; NPC.alpha = 100; NPC.value = Item.buyPrice(0, 0, 1, 5); diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index e508bee9e5..30908f86b4 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 78; NPC.height = 78; NPC.defense = 50; - NPC.lifeMax = 5600; + NPC.lifeMax = 7000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index fe588479a6..58f61f9a7b 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 58; NPC.height = 30; NPC.defense = 8; - NPC.lifeMax = 110; + NPC.lifeMax = 140; NPC.aiStyle = -1; AIType = -1; NPC.alpha = 150; diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index d8bb936e3b..343826c270 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 62; NPC.defense = 999999; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 607e863a20..6219dbd31e 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 62; NPC.defense = 999999; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index c6e40661f5..5447f78ee1 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 62; NPC.height = 226; NPC.defense = 18; - NPC.lifeMax = 800; + NPC.lifeMax = 1000; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 2550cd0e7d..9e492a9e95 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 58; NPC.height = 32; NPC.defense = 15; - NPC.lifeMax = 480; + NPC.lifeMax = 600; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index a729bdce48..b4e434120d 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 68; NPC.height = 58; NPC.defense = 12; - NPC.lifeMax = 800; + NPC.lifeMax = 1000; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index c57b37a7d0..c6f9f4720e 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 78; NPC.height = 170; NPC.defense = 10; - NPC.lifeMax = 6000; + NPC.lifeMax = 7500; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 7da581930d..a014782a44 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 40; NPC.defense = 8; - NPC.lifeMax = 360; + NPC.lifeMax = 450; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Venom, 90, true); + target.AddBuff(BuffID.Venom, 30, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 2849ab2efa..4eed3b93b0 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 16; //28 NPC.height = 16; //28 NPC.defense = 20; - NPC.lifeMax = 4000; + NPC.lifeMax = 5000; NPC.aiStyle = -1; //new AIType = -1; //new NPC.knockBackResist = 0f; diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 9459276e5a..87cec98b06 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 59; NPC.height = 38; NPC.defense = 10; - NPC.lifeMax = 4000; + NPC.lifeMax = 5000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index eb0ce07f93..3cad7a666d 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 14; //28 NPC.height = 16; //28 NPC.defense = 30; - NPC.lifeMax = 4000; + NPC.lifeMax = 5000; NPC.aiStyle = -1; //new AIType = -1; //new NPC.knockBackResist = 0f; diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 14a0dbf9f7..16962f9714 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.Abyss NPC.height = 30; NPC.damage = BaseAttack; - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.aiStyle = AIType = -1; @@ -91,8 +91,8 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { - writer.Write(NPC.localAI[0]); writer.Write(playerCrossed); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 02efa40f7b..7528545986 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 80; NPC.height = 40; NPC.defense = 20; - NPC.lifeMax = 240; + NPC.lifeMax = 300; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index c81ad502c2..935c1a319f 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 76; NPC.height = 36; NPC.defense = 10; - NPC.lifeMax = 320; + NPC.lifeMax = 400; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index cff8b1674b..758275f73c 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.AcidRain public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ModContent.ItemType(), 20); + npcLoot.Add(ModContent.ItemType(), 10); LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast); postPolter.Add(ModContent.ItemType(), 15, 1, 3, !DownedBossSystem.downedPolterghast); postPolter.AddFail(ModContent.ItemType(), 3, 1, 3, DownedBossSystem.downedPolterghast); diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index c3455067f5..40ebfeb51d 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -156,8 +156,8 @@ namespace CalamityMod.NPCs.AcidRain hasDoneDeathray = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); DelayTime = reader.ReadInt32(); - DeathrayTime = reader.ReadInt32(); JumpTimer = reader.ReadSingle(); + DeathrayTime = reader.ReadInt32(); ShootPosition = reader.ReadVector2(); } diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 1ea110d392..852856f9a0 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = NPCAIStyleID.Herpling; NPC.defense = 14; NPC.DR_NERD(0.15f); - NPC.lifeMax = 300; + NPC.lifeMax = 380; NPC.knockBackResist = 0.6f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 85; NPC.defense = 24; NPC.knockBackResist = 0.5f; - NPC.lifeMax = 450; + NPC.lifeMax = 570; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Astraglomerate.cs b/NPCs/Astral/Astraglomerate.cs index 5144e7a287..966f68d4bb 100644 --- a/NPCs/Astral/Astraglomerate.cs +++ b/NPCs/Astral/Astraglomerate.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 0; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 480; + NPC.lifeMax = 600; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 0, 15, 0); @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.Astral { NPC.damage = 90; NPC.defense = 25; - NPC.lifeMax = 700; + NPC.lifeMax = 900; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 22dcb4d65a..5e5c41adb1 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Astral NPC.height = 30; //216 NPC.defense = 10; NPC.DR_NERD(0.15f); - NPC.lifeMax = 50; + NPC.lifeMax = 70; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.95f; @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 30; NPC.defense = 20; NPC.knockBackResist = 0.85f; - NPC.lifeMax = 70; + NPC.lifeMax = 105; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 9959c22d91..0a38518883 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Astral NPC.height = 31; NPC.aiStyle = NPCAIStyleID.Slime; NPC.defense = 8; - NPC.lifeMax = 200; + NPC.lifeMax = 250; NPC.knockBackResist = 0.6f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.alpha = 60; @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Astral { NPC.damage = 65; NPC.defense = 18; - NPC.lifeMax = 300; + NPC.lifeMax = 375; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 6037b4ad46..b4e40aaa10 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 55; NPC.defense = 20; NPC.DR_NERD(0.15f); - NPC.lifeMax = 500; + NPC.lifeMax = 630; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.38f; NPC.value = Item.buyPrice(0, 0, 20, 0); @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 90; NPC.defense = 30; NPC.knockBackResist = 0.28f; - NPC.lifeMax = 750; + NPC.lifeMax = 945; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index ab3c5fc0d1..1065ea7cbd 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 55; NPC.defense = 20; NPC.DR_NERD(0.15f); - NPC.lifeMax = 500; + NPC.lifeMax = 630; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; NPC.noGravity = true; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral { NPC.damage = 90; NPC.defense = 30; - NPC.lifeMax = 750; + NPC.lifeMax = 945; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index d3fc6d6641..d6d491ebeb 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 100; NPC.defense = 50; NPC.knockBackResist = 0.04f; - NPC.lifeMax = 1600; + NPC.lifeMax = 1800; } if (CalamityWorld.revenge) { diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 9df2efe204..406820aab2 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.Astral NPC.height = 48; NPC.damage = 45; NPC.aiStyle = -1; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.defense = 12; NPC.DR_NERD(0.15f); NPC.value = Item.buyPrice(0, 0, 20, 0); @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 65; NPC.defense = 22; NPC.knockBackResist = 0.7f; - NPC.lifeMax = 600; + NPC.lifeMax = 750; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Glomerling.cs b/NPCs/Astral/Glomerling.cs index 17d72cc3a0..c4e6452b53 100644 --- a/NPCs/Astral/Glomerling.cs +++ b/NPCs/Astral/Glomerling.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; NPC.damage = 30; NPC.defense = 0; - NPC.lifeMax = 150; + NPC.lifeMax = 190; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.5f; NPC.noGravity = true; @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.defense = 8; NPC.knockBackResist = 0.4f; - NPC.lifeMax = 220; + NPC.lifeMax = 285; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 8882cf68c8..93322f19d4 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.defense = 8; NPC.DR_NERD(0.15f); - NPC.lifeMax = 330; + NPC.lifeMax = 420; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.75f; NPC.value = Item.buyPrice(0, 0, 15, 0); @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 80; NPC.defense = 18; NPC.knockBackResist = 0.65f; - NPC.lifeMax = 500; + NPC.lifeMax = 630; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index f4416a41f4..4b12252a70 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; NPC.defense = 6; NPC.DR_NERD(0.15f); - NPC.lifeMax = 340; + NPC.lifeMax = 430; NPC.knockBackResist = 0.2f; NPC.value = Item.buyPrice(0, 0, 15, 0); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 85; NPC.defense = 16; NPC.knockBackResist = 0.1f; - NPC.lifeMax = 510; + NPC.lifeMax = 645; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 19ad010c55..fc429af3d4 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 45; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 230; + NPC.lifeMax = 290; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.5f; @@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 75; NPC.defense = 25; NPC.knockBackResist = 0.4f; - NPC.lifeMax = 350; + NPC.lifeMax = 435; } if (CalamityWorld.revenge) { diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index 5b0a72f09c..38729a4407 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 38; NPC.defense = 16; NPC.DR_NERD(0.15f); - NPC.lifeMax = 310; + NPC.lifeMax = 390; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.58f; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 58; NPC.defense = 26; NPC.knockBackResist = 0.48f; - NPC.lifeMax = 460; + NPC.lifeMax = 585; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 18a292029b..e50f779b27 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.defense = 20; NPC.DR_NERD(0.15f); - NPC.lifeMax = 430; + NPC.lifeMax = 540; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.8f; @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 85; NPC.defense = 30; NPC.knockBackResist = 0.7f; - NPC.lifeMax = 640; + NPC.lifeMax = 810; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 979055f748..4dfd6193e5 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.Astral NPC.defense = 18; NPC.DR_NERD(0.15f); NPC.knockBackResist = 0.65f; - NPC.lifeMax = 210; + NPC.lifeMax = 270; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; AnimationType = NPCID.GiantFlyingFox; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 90; NPC.defense = 28; NPC.knockBackResist = 0.55f; - NPC.lifeMax = 320; + NPC.lifeMax = 405; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 976dfca1e7..a4bdeaa7b9 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.AstrumAureus if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -349,7 +349,7 @@ namespace CalamityMod.NPCs.AstrumAureus attackingColor = slimePhase == 0 ? Color.Violet : Color.Yellow; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -399,7 +399,7 @@ namespace CalamityMod.NPCs.AstrumAureus normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Other normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 9, 12)); diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 97f8fea0ce..eaecff22bf 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -244,7 +244,7 @@ namespace CalamityMod.NPCs.AstrumAureus Color whiteColor = Color.White; int afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -267,7 +267,7 @@ namespace CalamityMod.NPCs.AstrumAureus texture2D15 = GlowTexture.Value; Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 1b37667f0d..89f96d85b8 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.defense = 15; NPC.value = Item.buyPrice(0, 40, 0, 0); NPC.LifeMaxNERB(41000, 49200, 780000); - NPC.DR_NERD(0.15f); + NPC.DR_NERD(0.2f); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; @@ -112,8 +112,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ReceiveExtraAI(BinaryReader reader) { - NPC.chaseable = reader.ReadBoolean(); currentMode = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 9ef4b90ec1..02f6ab223d 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -280,7 +280,7 @@ namespace CalamityMod.NPCs.Bumblebirb color = altColor; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { @@ -333,7 +333,7 @@ namespace CalamityMod.NPCs.Bumblebirb } } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 0; j < extraAfterimageAmt; j++) { @@ -375,7 +375,7 @@ namespace CalamityMod.NPCs.Bumblebirb glowmaskColor *= glowmaskDampener; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index a42507bd10..b3db2d2a5e 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.Bumblebirb Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 6d40ea4a90..4ab499038a 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.CalClone float colorLerpAmt = 0.5f; int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.CalClone color = Color.CornflowerBlue; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i++) { diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index ab7be72dab..b9b30e4821 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.CalClone Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -145,7 +145,7 @@ namespace CalamityMod.NPCs.CalClone texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 79ea1ef840..6c37e6c00b 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -116,7 +116,7 @@ namespace CalamityMod.NPCs.CalClone Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.CalClone texture2D15 = GlowTexture.Value; Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 2896c962f3..42fc4b91c2 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -130,6 +130,7 @@ namespace CalamityMod.NPCs.CalClone double dist = death ? 180 : 150; NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.velocity = Vector2.Zero; NPC.ai[1] += death ? 0.5f : 2f; return false; } @@ -193,7 +194,7 @@ namespace CalamityMod.NPCs.CalClone float colorLerpAmt = 0.5f; int afterImageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int a = 1; a < afterImageAmt; a += 2) { @@ -216,7 +217,7 @@ namespace CalamityMod.NPCs.CalClone texture = GlowTexture.Value; Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int a = 1; a < afterImageAmt; a++) { diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 3eda2702e2..6af4cb2a2e 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 5f : 4f; + float projSpeed = bossRush ? 4.5f : 4f; if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) { float distance = Main.rand.NextBool() ? -1000f : 1000f; @@ -740,9 +740,26 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); + if (npc.alpha < 255) + { + npc.velocity *= 0.9f; + npc.alpha += 2; + if (npc.alpha > 255) + npc.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + npc.active = false; + + npc.active = false; return; } @@ -1058,9 +1075,25 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); + if (npc.alpha < 255) + { + npc.velocity *= 0.9f; + npc.alpha += 2; + if (npc.alpha > 255) + npc.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + npc.active = false; + return; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs index 203ecf35ff..e183bfe89f 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs @@ -391,7 +391,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Destroy all Dark Energies if their total HP is below 20% int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; //These are still needed so that CV Dark energy despawn works properly - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index 214a023c11..a4b0716412 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -47,11 +47,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - float exhaustionGateValue = 300f; + float exhaustionGateValue = 360f; if (Main.getGoodWorld) exhaustionGateValue *= 0.5f; - float exhaustionIncreasePerAttack = exhaustionGateValue * 0.1f; + float numberOfAttacksBeforeExhaustion = 12f; + float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); bool exhausted = calamityGlobalNPC.newAI[1] == 1f; bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; @@ -68,7 +69,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); else if (!Main.raining && !BossRushEvent.BossRushActive) CalamityUtils.StartRain(); diff --git a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs index 0d84546947..b14ea8a213 100644 --- a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs +++ b/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs @@ -521,19 +521,18 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.noGravity = true; if (npc.direction == 0) - { - npc.TargetClosest(true); - } + npc.TargetClosest(); + Player target = Main.player[npc.target]; if (npc.justHit && passiveness != 3) - { npc.chaseable = true; - } + if (npc.wet) { bool hasWetTarget = npc.chaseable; npc.TargetClosest(false); target = Main.player[npc.target]; + // Player detection behavior if (passiveness != 2) { @@ -542,50 +541,49 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs if (target.wet && !target.dead) { hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + npc.chaseable = true; // Once the enemy has detected the player, let minions fuck it up } } + if (npc.type == ModContent.NPCType()) { if (!target.dead) { hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + npc.chaseable = true; // Once the enemy has detected the player, let minions fuck it up } } - else if (target.wet && !target.dead && (target.Center - npc.Center).Length() < detectRange && - Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + else if (target.wet && !target.dead && (target.Center - npc.Center).Length() < detectRange && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { hasWetTarget = true; - npc.chaseable = true; //once the enemy has detected the player, let minions fuck it up + npc.chaseable = true; // Once the enemy has detected the player, let minions fuck it up } else { if (passiveness == 1) - { hasWetTarget = false; - } } } + if ((target.dead || !Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) && hasWetTarget) - { hasWetTarget = false; - } // Swim back and forth if (!hasWetTarget || passiveness == 2) { if (passiveness == 0) { - npc.TargetClosest(true); + npc.TargetClosest(false); target = Main.player[npc.target]; } + if (npc.collideX) { - npc.velocity.X = npc.velocity.X * -1f; + npc.velocity.X *= -1f; npc.direction *= -1; npc.netUpdate = true; } + if (npc.collideY) { npc.netUpdate = true; @@ -606,8 +604,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs if (hasWetTarget && passiveness != 2) { - npc.TargetClosest(true); + npc.TargetClosest(); target = Main.player[npc.target]; + // Swim away from the player if (passiveness == 3) { @@ -620,6 +619,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); } + float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityCapX, velocityCapX); @@ -679,72 +679,60 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } // Sea Minnows face away from the player - if (npc.type == ModContent.NPCType()) - { + if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) npc.direction *= -1; - } } else { // No target behavior npc.velocity.X += (float)npc.direction * 0.1f; if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) - { npc.velocity.X *= 0.95f; - } + if (npc.ai[0] == -1f) { npc.velocity.Y -= 0.01f; if (npc.velocity.Y < -0.3f) - { npc.ai[0] = 1f; - } } else { npc.velocity.Y += 0.01f; if (npc.velocity.Y > 0.3f) - { npc.ai[0] = -1f; - } } } + int npcTileX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; int npcTileY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) { if (Main.tile[npcTileX, npcTileY + 1].HasTile) - { npc.ai[0] = -1f; - } else if (Main.tile[npcTileX, npcTileY + 2].HasTile) - { npc.ai[0] = -1f; - } } + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } + npc.velocity.Y *= 0.95f; } else { // Out of water behavior if (npc.velocity.Y == 0f) { - npc.velocity.X = npc.velocity.X * 0.94f; + npc.velocity.X *= 0.94f; if (npc.velocity.X > -0.2f && npc.velocity.X < 0.2f) - { npc.velocity.X = 0f; - } } - npc.velocity.Y = npc.velocity.Y + 0.4f; + + npc.velocity.Y += 0.4f; if (npc.velocity.Y > 12f) - { npc.velocity.Y = 12f; - } + npc.ai[0] = 1f; } + npc.rotation = npc.velocity.Y * (float)npc.direction * rotation; float rotationLimit = 2f * rotation; npc.rotation = MathHelper.Clamp(npc.rotation, -rotationLimit, rotationLimit); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a5776e577f..1ae7b0bb99 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3,14 +3,15 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using CalamityMod.Balancing; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Tools; @@ -71,12 +72,13 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; using Terraria.GameContent.Achievements; +using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; -using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; +using Terraria.UI.Chat; using Terraria.Utilities; using static Terraria.ModLoader.ModContent; @@ -117,14 +119,15 @@ namespace CalamityMod.NPCs public const double VulnerableToDoTDamageMult = 2D; public const double VulnerableToDoTDamageMult_Worms_SlimeGod = 1.5; - // Eskimo Set and Cryo Stone effects + // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; + public bool IncreasedColdEffects_FrozenWings = false; public bool IncreasedColdEffects_CryoStone = false; // Transformer effect public bool IncreasedElectricityEffects_Transformer = false; - // Fireball, Cinnamon Roll and Hellfire Treads effects + // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; public bool IncreasedHeatEffects_FlameWakerBoots = false; @@ -171,7 +174,7 @@ namespace CalamityMod.NPCs private const double DesertEnemyStatMultiplier = 0.75; // Used to nerf Master Mode boss HP (base is 27.5% more than Expert) - public const double MasterModeBossHPMultiplier = 0.9; + public const double MasterModeBossHPMultiplier = 0.85; // Used to nerf Master Mode enemies public const double MasterModeEnemyHPMultiplier = 0.75; @@ -245,6 +248,7 @@ namespace CalamityMod.NPCs public int slowed = 0; public int electrified = 0; public int pearlAura = 0; + public int pearlAuraCounter = 0; public int bBlood = 0; public int brainRot = 0; public int laceration = 0; @@ -262,6 +266,8 @@ namespace CalamityMod.NPCs public int veriumDoomTimer = 0; public int veriumDoomStacks = 0; public bool veriumDoomMarked = false; + public int cursorFocus = 0; + public const int cursorFocusMax = 300; // Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage // It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently @@ -281,6 +287,9 @@ namespace CalamityMod.NPCs public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; + public int shocked = 0; + public int transformerShocked = 0; + public int voidfrost = 0; public int shellfishVore = 0; public int clamDebuff = 0; public int sulphurPoison = 0; @@ -292,9 +301,10 @@ namespace CalamityMod.NPCs public int sagePoisonTime = 0; public int sagePoisonDamage = 0; public int vulnerabilityHex = 0; + public int trueVulnerabilityHex = 0; public int banishingFire = 0; public int wither = 0; - public int RancorBurnTime = 0; + public int ashesOnDeath = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -411,6 +421,7 @@ namespace CalamityMod.NPCs myClone.VulnerableToWater = VulnerableToWater; myClone.IncreasedColdEffects_EskimoSet = IncreasedColdEffects_EskimoSet; + myClone.IncreasedColdEffects_FrozenWings = IncreasedColdEffects_FrozenWings; myClone.IncreasedColdEffects_CryoStone = IncreasedColdEffects_CryoStone; myClone.IncreasedElectricityEffects_Transformer = IncreasedElectricityEffects_Transformer; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; @@ -468,6 +479,7 @@ namespace CalamityMod.NPCs myClone.slowed = slowed; myClone.electrified = electrified; myClone.pearlAura = pearlAura; + myClone.pearlAuraCounter = pearlAuraCounter; myClone.bBlood = bBlood; myClone.brainRot = brainRot; myClone.laceration = laceration; @@ -484,6 +496,7 @@ namespace CalamityMod.NPCs myClone.veriumDoomTimer = veriumDoomTimer; myClone.veriumDoomStacks = veriumDoomStacks; myClone.veriumDoomMarked = veriumDoomMarked; + myClone.cursorFocus = cursorFocus; myClone.somaShredStacks = somaShredStacks; myClone.somaShredApplicator = somaShredApplicator; @@ -500,6 +513,9 @@ namespace CalamityMod.NPCs myClone.astralInfection = astralInfection; myClone.wDeath = wDeath; myClone.nightwither = nightwither; + myClone.shocked = shocked; + myClone.transformerShocked = transformerShocked; + myClone.voidfrost = voidfrost; myClone.shellfishVore = shellfishVore; myClone.clamDebuff = clamDebuff; myClone.sulphurPoison = sulphurPoison; @@ -511,9 +527,10 @@ namespace CalamityMod.NPCs myClone.sagePoisonTime = sagePoisonTime; myClone.sagePoisonDamage = sagePoisonDamage; myClone.vulnerabilityHex = vulnerabilityHex; + myClone.trueVulnerabilityHex = trueVulnerabilityHex; myClone.banishingFire = banishingFire; myClone.wither = wither; - myClone.RancorBurnTime = RancorBurnTime; + myClone.ashesOnDeath = ashesOnDeath; // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; @@ -703,23 +720,9 @@ namespace CalamityMod.NPCs Item heldItem = Main.player[owner].ActiveItem(); int totalDamage = (int)Main.player[owner].GetTotalDamage().ApplyTo(150f); - bool forbidden = Main.player[owner].head == ArmorIDs.Head.AncientBattleArmor && Main.player[owner].body == ArmorIDs.Body.AncientBattleArmor && Main.player[owner].legs == ArmorIDs.Legs.AncientBattleArmor; - bool negateNerf = Main.player[owner].Calamity().fearmongerSet || (forbidden && heldItem.CountsAsClass()); - double summonNerfMult = negateNerf ? 1 : 0.75; - if (!Main.player[owner].Calamity().profanedCrystalBuffs) - { - if (heldItem.type > ItemID.None) - { - if (!heldItem.CountsAsClass() && - (heldItem.CountsAsClass() || heldItem.CountsAsClass() || heldItem.CountsAsClass() || heldItem.CountsAsClass()) && - heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != ItemUseStyleID.None && - !heldItem.accessory && heldItem.ammo == AmmoID.None) - { - totalDamage = (int)(totalDamage * summonNerfMult); - } - } - } + if (CalamityUtils.ShouldTriggerSummonPenalty(Main.player[owner], heldItem)) + totalDamage = (int)(totalDamage * BalancingConstants.SummonerCrossClassNerf); int totalDisplayedDamage = totalDamage / 5; ApplyDPSDebuff(projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); @@ -856,6 +859,8 @@ namespace CalamityMod.NPCs if (IncreasedColdEffects_EskimoSet) coldDamageMult += 0.25; + if (IncreasedColdEffects_FrozenWings) + coldDamageMult += 0.25; if (IncreasedColdEffects_CryoStone) coldDamageMult += 0.5; @@ -974,27 +979,6 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); } - // Vermillion Flux - if (vermillionFlux > 0) - { - int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets - ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); - } - - // Auric Rebuke - if (auricRebuke > 0) - { - int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets - ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); - } - - // Static Discharge - if (staticDischarge > 0) - { - int baseStaticDischargeDoTValue = (int)(6 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets - ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); - } - // Banishing Fire if (banishingFire > 0) { @@ -1009,6 +993,13 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseVulnerabilityHexDoTValue, VulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); } + // True Vulnerability Hex + if (trueVulnerabilityHex > 0) + { + int baseTrueVHexDoTValue = (int)(TrueVulnerabilityHex.DPS * heatDamageMult); + ApplyDPSDebuff(baseTrueVHexDoTValue, TrueVulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); + } + // Frostburn if (npc.onFrostBurn) { @@ -1054,6 +1045,13 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseNightwitherDoTValue, baseNightwitherDoTValue / 5, ref npc.lifeRegen, ref damage); } + // Voidfrost + if (voidfrost > 0) + { + int baseVoidfrostDoTValue = (int)(300 * coldDamageMult); + ApplyDPSDebuff(baseVoidfrostDoTValue, baseVoidfrostDoTValue / 5, ref npc.lifeRegen, ref damage); + } + // Plague if (pFlames > 0) { @@ -1123,6 +1121,27 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseElectrifiedDoTValue, baseElectrifiedDoTValue / 22, ref npc.lifeRegen, ref damage); } + // Vermillion Flux + if (vermillionFlux > 0) + { + int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets + ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); + } + + // Auric Rebuke + if (auricRebuke > 0) + { + int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets + ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); + } + + // Static Discharge + if (staticDischarge > 0) + { + int baseStaticDischargeDoTValue = (int)(6 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets + ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); + } + // Crush Depth if (cDepth > 0) { @@ -1137,6 +1156,43 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseRiptideDoTValue, baseRiptideDoTValue / 3, ref npc.lifeRegen, ref damage); } + if (npc.dryadBane) + { + // Buffs match 1:1 with Town NPC buffs + // See CalamityGlobalTownNPC: BuffTownNPC + float buffedDryadsBaneMult = 0f + + (NPC.downedMoonlord ? 0.6f : 0f) + + (DownedBossSystem.downedProvidence ? 0.2f : 0f) + + (DownedBossSystem.downedPolterghast ? 0.2f : 0f) + + (DownedBossSystem.downedDoG ? 0.2f : 0f) + + (DownedBossSystem.downedYharon ? 0.2f : 0f) + + (DownedBossSystem.downedExoMechs ? 0.6f : 0f) + + (DownedBossSystem.downedCalamitas ? 0.6f : 0f); + if (Main.expertMode) + buffedDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int buffedDryadsBaneDoTValue = 2 * (int)(4 * buffedDryadsBaneMult); + npc.lifeRegen -= buffedDryadsBaneDoTValue; + + // Scales damage tick if greater than the vanilla amount + float vanillaDryadsBaneMult = 1f + + (NPC.downedBoss1 ? 0.1f : 0f) + + (NPC.downedBoss2 ? 0.1f : 0f) + + (NPC.downedBoss3 ? 0.1f : 0f) + + (NPC.downedQueenBee ? 0.1f : 0f) + + (Main.hardMode ? 0.4f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedPlantBoss ? 0.15f : 0f) + + (NPC.downedGolemBoss ? 0.15f : 0f) + + (NPC.downedAncientCultist ? 0.15f : 0f); + if (Main.expertMode) + vanillaDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int totalDryadsBaneDoTValue = 2 * (int)(4 * vanillaDryadsBaneMult) + buffedDryadsBaneDoTValue; + if (damage < totalDryadsBaneDoTValue / 6) + damage = totalDryadsBaneDoTValue / 6; + } + // Debuffs that aren't affected by weaknesses or resistances. if (vaporfied > 0) ApplyDPSDebuff(30, 6, ref npc.lifeRegen, ref damage); @@ -1151,7 +1207,7 @@ namespace CalamityMod.NPCs if (elementalMix > 0) ApplyDPSDebuff(400, 80, ref npc.lifeRegen, ref damage); if (miracleBlight > 0) - ApplyDPSDebuff(2500, 500, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(3000, 500, ref npc.lifeRegen, ref damage); // Reduce DoT on worm bosses and Creepers by 75%. if ((wormBoss || npc.type == NPCID.Creeper) && npc.lifeRegen < 0) @@ -1184,6 +1240,10 @@ namespace CalamityMod.NPCs // Set Plantera to be able to update oldPos[x] // This is only used for her Rev+ AI charge attacks NPCID.Sets.TrailingMode[NPCID.Plantera] = 1; + + // Allow Moon Lord to directly be summoned in Multiplayer. + // This is used for the modified Celestial Sigil without Impending Doom. + NPCID.Sets.MPAllowedEnemies[NPCID.MoonLordCore] = true; } public override void SetDefaults(NPC npc) @@ -1423,7 +1483,6 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.GolemHeadFree) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.7); npc.dontTakeDamage = false; } else if (npc.type == NPCID.HallowBoss) @@ -1449,7 +1508,7 @@ namespace CalamityMod.NPCs npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; } - else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { // HP boosted in Master Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar) npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.masterMode ? 1.7 : 1.2)); @@ -1457,10 +1516,9 @@ namespace CalamityMod.NPCs } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65); - npc.scale = 1.2f; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.55); } - else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) + else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == NPCType()) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 10f; @@ -2266,7 +2324,7 @@ namespace CalamityMod.NPCs } if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || CalamityLists.bossHPScaleList.Contains(npc.type)) { - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)Math.Round(npc.lifeMax * HPBoost); } @@ -2469,11 +2527,11 @@ namespace CalamityMod.NPCs } // Reduce mech boss HP and damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { if (!NPC.downedMechBossAny) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2483,7 +2541,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -3169,7 +3227,7 @@ namespace CalamityMod.NPCs Texture2D npcTexture = texture ?? TextureAssets.Npc[npc.type].Value; Vector2 screenOffset = npc.IsABestiaryIconDummy ? Vector2.Zero : Main.screenPosition; int afterimageCounter = 1; - while (afterimageCounter < NPCID.Sets.TrailCacheLength[npc.type] && CalamityConfig.Instance.Afterimages) + while (afterimageCounter < NPCID.Sets.TrailCacheLength[npc.type] && CalamityClientConfig.Instance.Afterimages) { Color colorToDraw = Color.Lerp(drawColor, endingColor, afterimageCounter / (float)NPCID.Sets.TrailCacheLength[npc.type]); colorToDraw *= afterimageCounter / (float)NPCID.Sets.TrailCacheLength[npc.type]; @@ -3419,11 +3477,14 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { + if (npc.type == NPCID.SkeletronPrime && (Main.masterMode || BossRushEvent.BossRushActive)) + index = CalamityMod.chadPrimeIcon; + if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive)) { float lifeRatio = npc.life / (float)npc.lifeMax; float mapIconVanishValue = Main.masterMode ? 0.3f : 0.4f; - if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && Main.masterMode)) + if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && (Main.masterMode || BossRushEvent.BossRushActive))) index = -1; } } @@ -3434,7 +3495,7 @@ namespace CalamityMod.NPCs public override bool PreAI(NPC npc) { // Change Spaz and Ret weaknesses and resistances when phase 2 starts. - if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { if (npc.ai[0] >= 2f) { @@ -5144,6 +5205,9 @@ namespace CalamityMod.NPCs npc.ai[3] = 0f; } + // Incremement Giant Pearl's pearl shard counter + pearlAuraCounter++; + // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; @@ -5181,6 +5245,13 @@ namespace CalamityMod.NPCs laceration--; if (elementalMix > 0) elementalMix--; + if (trueVulnerabilityHex > 0) + { + vulnerabilityHex = 0; // You cannot stack True VHex with its lesser counterpart. + trueVulnerabilityHex--; + if (trueVulnerabilityHex == 0) + cursorFocus = 0; + } if (vulnerabilityHex > 0) vulnerabilityHex--; if (marked > 0) @@ -5222,6 +5293,12 @@ namespace CalamityMod.NPCs wDeath--; if (nightwither > 0) nightwither--; + if (shocked > 0) + shocked--; + if (transformerShocked > 0) + transformerShocked--; + if (voidfrost > 0) + voidfrost--; if (shellfishVore > 0) shellfishVore--; if (clamDebuff > 0) @@ -5230,8 +5307,6 @@ namespace CalamityMod.NPCs sulphurPoison--; if (sagePoisonTime > 0) sagePoisonTime--; - if (kamiFlu > 0) - kamiFlu--; if (relicOfResilienceCooldown > 0) relicOfResilienceCooldown--; if (relicOfResilienceWeakness > 0) @@ -5240,20 +5315,19 @@ namespace CalamityMod.NPCs GaussFluxTimer--; if (ladHearts > 0) ladHearts--; - if (vulnerabilityHex > 0) - vulnerabilityHex--; if (banishingFire > 0) banishingFire--; if (wither > 0) wither--; - if (RancorBurnTime > 0) - RancorBurnTime--; + if (ashesOnDeath > 0) + ashesOnDeath--; if (cobaltNerfTimer > 0) cobaltNerfTimer--; if (mythrilNerfTimer > 0) mythrilNerfTimer--; - + if (cursorFocus > 0 && cursorFocus < cursorFocusMax) + cursorFocus--; if (veriumDoomTimer > 0) veriumDoomTimer--; if (veriumDoomTimer == 0 && veriumDoomMarked) @@ -5263,11 +5337,9 @@ namespace CalamityMod.NPCs Particle sparks = new LineParticle(npc.Center, new Vector2(Main.rand.NextFloat(-9f, 9f), Main.rand.NextFloat(-9f, 9f)), false, 45, 0.9f, Main.rand.NextBool() ? Color.Cyan : Color.SkyBlue); GeneralParticleHandler.SpawnParticle(sparks); } - //Particle boop = new CustomPulse(npc.Center, Vector2.Zero, new Color(233, 95, 212), "CalamityMod/Particles/Sparkle2", Vector2.One, Main.rand.NextFloat(-5f, 5f), 0.8f + (float)(0.04 * veriumDoomStacks), 1.6f + (float)(0.08 * veriumDoomStacks), 40); - //GeneralParticleHandler.SpawnParticle(boop); SoundEngine.PlaySound(new("CalamityMod/Sounds/NPCHit/CryogenHit", 3) { Volume = 0.6f }, npc.Center); - Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), 100 + (15 * veriumDoomStacks), 0, Main.myPlayer, 200f); + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), 100 + (15 * veriumDoomStacks), 0, Main.myPlayer, 200f); veriumDoomMarked = false; veriumDoomStacks = 0; @@ -5323,17 +5395,52 @@ namespace CalamityMod.NPCs } } - if (!CalamityPlayer.areThereAnyDamnBosses && !CalamityLists.enemyImmunityList.Contains(npc.type)) + if (pearlAura > 0) { - if (pearlAura > 0) - npc.velocity *= 0.9f; + // Slow the enemy + npc.velocity *= 0.9f; + + // Spawn pearl shards on a counter + if (pearlAuraCounter % 12 == 0) + { + SoundEngine.PlaySound(SoundID.Item49, Main.LocalPlayer.Center); + Vector2 shardVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 7.5f; + int damage = Main.LocalPlayer.ApplyArmorAccDamageBonusesTo(20); + Projectile.NewProjectile(npc.GetSource_FromThis(), Main.LocalPlayer.Center, shardVel, ProjectileType(), damage, 5f, Main.myPlayer); + } } - // Auric Ore/Repulsers reject Town NPCs and dummies + if (shocked > 0 || transformerShocked > 0) + { + var player = Main.LocalPlayer; + bool strongerShock = transformerShocked > 0; + + int frequency = strongerShock ? 10 : 12; + + // Spawn sparks from the enemy + if (player.miscCounter % frequency == 0) + { + int sDamage = strongerShock ? 50 : 10; + sDamage = player.ApplyArmorAccDamageBonusesTo(sDamage); + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 5f; + Projectile spark = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, velocity, ProjectileType(), sDamage, 0f, player.whoAmI, 0f, 1f); + spark.timeLeft = 120; + spark.penetrate = 3; + if (strongerShock) + { + spark.timeLeft = 240; + spark.extraUpdates = 1; + spark.penetrate = 10; + } + } + } + + // Auric Ore/Repulsers reject Town NPCs and dummies (Auric Land Mines work on them too) if ((NPCID.Sets.ActsLikeTownNPC[npc.type] || npc.townNPC) && !npc.dontTakeDamage || npc.type == NPCType()) { int auricOreID = TileType(); int auricRepulserID = TileType(); + int auricLandMineID = TileType(); // Get a list of tiles near the npc // This is just Collision.GetEntityTiles but with a larger detection square because the sheer speed from auric boosts causes the detection to fail at higher speeds @@ -5383,6 +5490,18 @@ namespace CalamityMod.NPCs Tile tile = Framing.GetTileSafely(touchedTile); if (!tile.HasTile || !tile.HasUnactuatedTile) continue; + + if (tile.TileType == auricLandMineID) + { + SoundStyle explode = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(explode with { Pitch = 0.8f }, touchedTile.ToWorldCoordinates()); + GenericSparkle sparker = new GenericSparkle(touchedTile.ToWorldCoordinates(), Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); + GeneralParticleHandler.SpawnParticle(sparker); + Projectile.NewProjectile(new EntitySource_TileInteraction(npc, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ProjectileType(), 40000, 0f); + WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true); + continue; + } + if (tile.TileType != auricOreID && tile.TileType != auricRepulserID) continue; @@ -5400,7 +5519,7 @@ namespace CalamityMod.NPCs if (tile.TileType == auricOreID) { npc.SimpleStrikeNPC((int)(npc.lifeMax * 0.2f), 0); - npc.AddBuff(ModContent.BuffType(), 120); + npc.AddBuff(BuffType(), 120); } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), npc.Center); break; @@ -5418,6 +5537,14 @@ namespace CalamityMod.NPCs if (target.Calamity().sulphurSet) npc.AddBuff(BuffID.Poisoned, 60); + if (target.Calamity().aSpark) + { + if (target.Calamity().transformer) + transformerShocked = 120; + else + shocked = 120; + } + if (target.Calamity().snowman) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) @@ -5494,11 +5621,12 @@ namespace CalamityMod.NPCs break; case NPCID.AncientLight: - target.AddBuff(BuffType(), 120); + target.AddBuff(BuffType(), 120); break; case NPCID.HallowBoss: - target.AddBuff(NPC.ShouldEmpressBeEnraged() ? BuffType() : BuffType(), 240); + if (NPC.ShouldEmpressBeEnraged()) + target.AddBuff(BuffType(), 240); break; case NPCID.BloodNautilus: @@ -5581,6 +5709,27 @@ namespace CalamityMod.NPCs #endregion #region Modify Hit + public override void ModifyHitPlayer(NPC npc, Player target, ref Player.HurtModifiers modifiers) + { + // Kaguya hair boom GIF + if (npc.type == NPCID.Shark && target.name == "Rebecca" && Main.zenithWorld) + { + SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, target.Center); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 12f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 12f; + + target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Rebecca").Format(target.name)), 1000.0, 0); + modifiers.SourceDamage *= target.statLifeMax2 * Main.rand.NextFloat(3f, 6f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile explosion = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 9999, 0f, Main.myPlayer, ItemID.MiniNukeII, 0.01f); + explosion.friendly = false; + explosion.hostile = true; + explosion.timeLeft = 5; + } + } + } + public override void ModifyHitByItem(NPC npc, Player player, Item item, ref NPC.HitModifiers modifiers) { CalamityPlayer modPlayer = player.Calamity(); @@ -5707,11 +5856,15 @@ namespace CalamityMod.NPCs modifiers.CritDamage += bonus; } - // Plague Reaper deals 1.1x damage to Plagued enemies if (!projectile.npcProj && !projectile.trap) { + // Plague Reaper deals 1.1x damage to Plagued enemies if (projectile.CountsAsClass() && modPlayer.plagueReaper && pFlames > 0) modifiers.SourceDamage *= 1.1f; + + // True Vulnerability Hex causes enemies to take 1.15x damage, 2.5x from Calamity itself + if (trueVulnerabilityHex > 0) + modifiers.SourceDamage *= (projectile.type == ProjectileType() && projectile.ai[1] == 1f) ? 2.5f : 1.15f; } // Any weapons that shoot projectiles from anywhere other than the player's center aren't affected by point-blank shot damage boost. @@ -5835,7 +5988,7 @@ namespace CalamityMod.NPCs modifiers.ScalingBonusDamage += (empowered ? 0.4f : 0.2f) * TagDamageMult; if (Main.netMode != NetmodeID.Server) { - var color = ProvUtils.GetProjectileColor((int)(Main.dayTime ? Providence.Providence.BossMode.Day : Providence.Providence.BossMode.Night), 0); + var color = ProvUtils.GetDayNightColor(!Main.dayTime, 0); float power = Math.Min(npc.height / 100f, 3f); var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); @@ -5856,7 +6009,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) + if (nPC.active && nPC.type == NPCType() && nPC.life > 0) { nPC.life = 0; nPC.HitEffect(); @@ -5900,7 +6053,7 @@ namespace CalamityMod.NPCs #region Hit Effect public override void HitEffect(NPC npc, NPC.HitInfo hit) { - if (npc.life <= 0 && npc.Organic() && RancorBurnTime > 0) + if (npc.life <= 0 && npc.Organic() && ashesOnDeath > 0) DeathAshParticle.CreateAshesFromNPC(npc); // Cultist shield flicker @@ -5921,7 +6074,7 @@ namespace CalamityMod.NPCs if (npc.life <= 0) { if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType()); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), NPCType()); } break; @@ -5983,7 +6136,7 @@ namespace CalamityMod.NPCs } // Plague debuff on kill effect - if (pFlames > 0 && npc.life <= 0) + if (pFlames > 0 && npc.life <= 0 && npc.realLife == -1) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6148,12 +6301,12 @@ namespace CalamityMod.NPCs spawnRate = (int)(spawnRate * 1.4); maxSpawns = (int)(maxSpawns * 0.4f); } - if (player.Calamity().zen || (CalamityConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) + if (player.Calamity().zen || (CalamityServerConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) { spawnRate = (int)(spawnRate * 2.5); maxSpawns = (int)(maxSpawns * 0.3f); } - if (player.Calamity().isNearbyBoss && CalamityConfig.Instance.BossZen) + if (player.Calamity().isNearbyBoss && CalamityServerConfig.Instance.BossZen) { spawnRate *= 5; maxSpawns = (int)(maxSpawns * 0.001f); @@ -6271,7 +6424,7 @@ namespace CalamityMod.NPCs } // Replace vanilla Lava Slimes with Calamity Lava Slimes to avoid annoying lava drops - if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) + if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityServerConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) { pool.Add(NPCType(), SpawnCondition.Underworld.Chance); pool.Remove(NPCID.LavaSlime); @@ -6463,7 +6616,7 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) npc.frameCounter = 0D; } } @@ -6474,6 +6627,20 @@ namespace CalamityMod.NPCs if (absorberAffliction > 0) AbsorberAffliction.DrawEffects(npc, ref drawColor); + // Rancor's burn effect + if (ashesOnDeath > 0) + { + if (Main.rand.NextBool(4)) + { + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Main.rand.NextVector2Circular(2.75f, 6.5f), ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0.475f); + } + if (Main.rand.NextBool(6)) + { + Vector2 randomPosition = new(npc.position.X + Main.rand.NextFloat(-10f, npc.width + 10f), npc.position.Y + Main.rand.NextFloat(-10f, npc.height + 10f)); + RancorLavaMetaball.SpawnParticle(randomPosition, Main.rand.NextFloat(30f, 37f)); + } + } + if (astralInfection > 0) AstralInfectionDebuff.DrawEffects(npc, ref drawColor); @@ -6527,6 +6694,9 @@ namespace CalamityMod.NPCs if (nightwither > 0) Nightwither.DrawEffects(npc, ref drawColor); + if (pearlAura > 0) + PearlAura.DrawEffects(npc, ref drawColor); + if (pFlames > 0) // Plague debuff Plague.DrawEffects(npc, ref drawColor); @@ -6539,6 +6709,9 @@ namespace CalamityMod.NPCs if (sulphurPoison > 0) SulphuricPoisoning.DrawEffects(npc, ref drawColor); + if (trueVulnerabilityHex > 0) + TrueVulnerabilityHex.DrawEffects(npc, ref drawColor); + if (vaporfied > 0) Vaporfied.DrawEffects(npc, ref drawColor); @@ -6554,6 +6727,9 @@ namespace CalamityMod.NPCs } } + if (voidfrost > 0) + Voidfrost.DrawEffects(npc, ref drawColor); + // TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs if (electrified > 0) { @@ -6650,22 +6826,20 @@ namespace CalamityMod.NPCs if (gState > 0) drawColor = Color.Cyan; - else if (electrified > 0) + else if (auricRebuke > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); - drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; + drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; } - else if (vermillionFlux > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkRed, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } - - else if (auricRebuke > 0) + else if (electrified > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); - drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; + drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } else if (absorberAffliction > 0) @@ -6675,7 +6849,7 @@ namespace CalamityMod.NPCs drawColor = Color.Fuchsia; else if (pearlAura > 0) - drawColor = Color.White; + drawColor = new Color(185, 185, 255); else if (timeSlow > 0 || tesla > 0) drawColor = Color.Aquamarine; @@ -6691,7 +6865,7 @@ namespace CalamityMod.NPCs return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (npc.type == NPCID.KingSlime && Main.masterMode && CalamityWorld.revenge) - return NPC.AnyNPCs(ModContent.NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; + return NPC.AnyNPCs(NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; if (npc.type == NPCID.QueenBee && Main.zenithWorld) { @@ -6734,7 +6908,6 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight > 0), ("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither > 0), ("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().pFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/RancorBurn", NPC => NPC.Calamity().RancorBurnTime > 0), ("CalamityMod/Buffs/DamageOverTime/RiptideDebuff", NPC => NPC.Calamity().rTide > 0), ("CalamityMod/Buffs/DamageOverTime/SagePoison", NPC => NPC.Calamity().sagePoisonTime > 0), ("CalamityMod/Buffs/DamageOverTime/ShellfishClaps", NPC => NPC.Calamity().shellfishVore > 0), @@ -6742,8 +6915,10 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff", NPC => NPC.Calamity().clamDebuff > 0), ("CalamityMod/Buffs/DamageOverTime/StaticDischarge", NPC => NPC.Calamity().staticDischarge > 0), ("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning", NPC => NPC.Calamity().sulphurPoison > 0), + ("CalamityMod/Buffs/DamageOverTime/TrueVulnerabilityHex", NPC => NPC.Calamity().trueVulnerabilityHex > 0), ("CalamityMod/Buffs/DamageOverTime/Vaporfied", NPC => NPC.Calamity().vaporfied > 0), ("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux > 0), + ("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost > 0), ("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex > 0), // All other important Calamity debuffs, in alphabetical order @@ -6768,7 +6943,7 @@ namespace CalamityMod.NPCs { if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { - if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) + if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) { List currentDebuffs = new List() { }; @@ -6800,7 +6975,7 @@ namespace CalamityMod.NPCs if (npc.javelined) currentDebuffs.Add(TextureAssets.Buff[BuffID.BoneJavelin].Value); if (npc.daybreak) - currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Daybroken").Value); + currentDebuffs.Add(Request("CalamityMod/Buffs/DamageOverTime/Daybroken").Value); if (npc.celled) currentDebuffs.Add(Request("CalamityMod/ExtraTextures/VanillaBuffs/Celled").Value); if (npc.dryadBane) @@ -6880,7 +7055,9 @@ namespace CalamityMod.NPCs var tex = currentDebuffs[i]; spriteBatch.Draw(tex, npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset), null, Color.White, 0f, default, 0.5f, SpriteEffects.None, 0f); - // TODO -- Show number of Shred stacks (how?) + // Shred stack display + if (currentDebuffs[i] == TextureAssets.Buff[ModContent.BuffType()].Value) + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } } } @@ -6889,11 +7066,11 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) return false; } - if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid) + if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || npc.type == NPCID.Probe || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f)) { Texture2D texture = TextureAssets.Npc[npc.type].Value; @@ -7055,7 +7232,7 @@ namespace CalamityMod.NPCs else { // VHex and Miracle Blight visuals do not appear if Odd Mushroom is in use for sanity reasons - if (npc.Calamity().vulnerabilityHex > 0) + if (npc.Calamity().vulnerabilityHex > 0 || npc.Calamity().trueVulnerabilityHex > 0) { float compactness = npc.width * 0.6f; if (compactness < 10f) @@ -7064,7 +7241,7 @@ namespace CalamityMod.NPCs if (power > 2.75f) power = 2.75f; if (VulnerabilityHexFireDrawer is null || VulnerabilityHexFireDrawer.LocalTimer >= VulnerabilityHexFireDrawer.SetLifetime) - VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); + VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().trueVulnerabilityHex > 0 ? npc.Calamity().trueVulnerabilityHex : npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); else VulnerabilityHexFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY)); } @@ -7076,31 +7253,6 @@ namespace CalamityMod.NPCs return MiracleBlightRenderer.ActuallyDoPreDraw; } - // Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event. - if (npc.type == NPCID.DD2EterniaCrystal) - { - float animationTime = 120f - npc.ai[3]; - animationTime /= 120f; - - if (!Main.dedServ) - { - if (!Filters.Scene["CrystalDestructionColor"].IsActive()) - Filters.Scene.Activate("CrystalDestructionColor"); - - Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity((float)Math.Sin(animationTime * MathHelper.Pi) * 0.4f); - } - - Vector2 drawPosition = npc.Center - screenPos + Vector2.UnitY * 60f; - for (int i = 0; i < 4; i++) - { - float intensity = MathHelper.Clamp(animationTime * 2f - i / 3f, 0f, 1f); - Vector2 origin = new Vector2(TextureAssets.MagicPixel.Value.Width / 2f, TextureAssets.MagicPixel.Value.Height); - Vector2 scale = new Vector2((float)Math.Sqrt(intensity) * 50f, intensity * 4f); - Color beamColor = new Color(0.4f, 0.17f, 0.4f, 0f) * (intensity * (1f - MathHelper.Clamp((animationTime - 0.8f) / 0.2f, 0f, 1f))) * 0.5f; - spriteBatch.Draw(TextureAssets.MagicPixel.Value, drawPosition, null, beamColor, 0f, origin, scale, SpriteEffects.None, 0f); - } - } - if (Main.zenithWorld) { if (NPC.AnyNPCs(NPCType())) @@ -7307,7 +7459,7 @@ namespace CalamityMod.NPCs } } - Texture2D glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[0].Value : TextureAssets.Dest[0].Value; + Texture2D glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[0].Value : TextureAssets.Dest[0].Value; switch (npc.type) { default: @@ -7315,11 +7467,11 @@ namespace CalamityMod.NPCs break; case NPCID.TheDestroyerBody: - glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[1].Value : TextureAssets.Dest[1].Value; + glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[1].Value : TextureAssets.Dest[1].Value; break; case NPCID.TheDestroyerTail: - glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[2].Value : TextureAssets.Dest[2].Value; + glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.DestroyerGlowmasks[2].Value : TextureAssets.Dest[2].Value; break; } @@ -7328,6 +7480,25 @@ namespace CalamityMod.NPCs } } + // Laser telegraph + else if (npc.type == NPCID.Probe && CalamityClientConfig.Instance.NewVanillaTextures) + { + float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : BossRushEvent.BossRushActive ? DestroyerAI.ProbeLaserGateValue_BossRush : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime; + Texture2D glowTexture = CalamityMod.ProbeGlowmask.Value; + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + float colorScale = MathHelper.Clamp((npc.localAI[0] - eyeTelegraphGateValue) / DestroyerAI.ProbeLaserTelegraphTime, 0f, 1f); + Color drawColor2 = Color.Lerp(new Color(150, 0, 0, 192), new Color(255, 100, 150, 192), colorScale); + for (int i = 0; i < 2; i++) + { + spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + if (revenge) { // Create additional afterimages in the cardinal directions in Rev+ @@ -7624,7 +7795,7 @@ namespace CalamityMod.NPCs float eyeTelegraphGateValue = WallOfFleshAI.LaserShootGateValue - WallOfFleshAI.LaserShootTelegraphTime; if (npc.localAI[1] > eyeTelegraphGateValue || npc.localAI[2] > 0f || enraged) { - Texture2D glowTexture = CalamityConfig.Instance.NewVanillaTextures ? CalamityMod.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value; + Texture2D glowTexture = CalamityClientConfig.Instance.NewVanillaTextures ? CalamityMod.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value; Vector2 halfSize = npc.frame.Size() / 2; SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) @@ -7644,7 +7815,7 @@ namespace CalamityMod.NPCs } // His afterimages I can't get to work, so fuck it - else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? CalamityMod.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; @@ -7776,7 +7947,7 @@ namespace CalamityMod.NPCs float telegraphScalar = MathHelper.Clamp((Math.Abs(PlanteraAI.StopChargeGateValue) - telegraphTimer) / Math.Abs(PlanteraAI.StopChargeGateValue), 0f, 1f); Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { int afterimageAmount = 10; int afterImageIncrement = 2; @@ -8777,6 +8948,18 @@ namespace CalamityMod.NPCs // Insert the debuff info into the NPC's bestiary entry bestiaryEntry.Info.Insert(0, new BestiaryDebuffInfo(elements)); + + // Add the Astral Infection to the Enchanted Nightcrawler's entry as it spawns there now + if (npc.type == NPCID.EnchantedNightcrawler) + { + bestiaryEntry.AddTags(GetInstance().ModBiomeBestiaryInfoElement); + } + + // Add the Surface Mushroom biome to the Truffle Worm's entry as it spawns there now + if (npc.type == NPCID.TruffleWorm) + { + bestiaryEntry.AddTags(BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.SurfaceMushroom); + } } public static string NPCDebuffResistText(bool? effectiveness, string name) diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 93b4914cb2..96db52e4c2 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -103,11 +103,9 @@ namespace CalamityMod.NPCs #region Sky / Space // Harpy - // Coco's Feather (bird dev item) @ 0.1% // Sky Glaze @ 3.33% IF Eye of Cthulhu dead // Essence of Sunlight @ 50% IF Hardmode and not statue spawned case NPCID.Harpy: - npcLoot.Add(ModContent.ItemType(), 1000); postEoC.Add(ModContent.ItemType(), 30); hardmode.AddIf(() => !npc.SpawnedFromStatue, ModContent.ItemType(), 2); break; @@ -467,6 +465,11 @@ namespace CalamityMod.NPCs case NPCID.TheGroom: npcLoot.Add(ModContent.ItemType(), 10); break; + + // Ghost Bracelet @ 10% (Dandy requests this drops at a "high chance" but inventory clutter is real so) + case NPCID.Ghost: + npcLoot.Add(ModContent.ItemType(), 10); + break; #endregion #region Blood Moon @@ -1813,7 +1816,7 @@ DukeEditFailed: if (!Main.hardMode && !BossRushEvent.BossRushActive) { // Increase altar count to allow natural mech boss spawning. - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) WorldGen.altarCount++; string key2 = "Mods.CalamityMod.Status.Progression.UglyBossText"; @@ -1837,7 +1840,7 @@ DukeEditFailed: SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); - if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (!NPC.downedMechBoss1 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) SpawnMechBossHardmodeOres(); break; @@ -1849,7 +1852,7 @@ DukeEditFailed: SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); - if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (!NPC.downedMechBoss2 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) SpawnMechBossHardmodeOres(); } break; @@ -1859,7 +1862,7 @@ DukeEditFailed: SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); SetNewBossJustDowned(npc); - if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (!NPC.downedMechBoss3 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) SpawnMechBossHardmodeOres(); break; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index abf91440b3..fe1b6ba5a6 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -159,6 +159,7 @@ namespace CalamityMod.NPCs private static readonly string[] PainterNames = { "Picasso", // <@!353316526306361347> (sconicboom -- for the late picassosbean2819) + "Bew", // <@!232291351167893505> (dmshi) }; private static readonly string[] PartyGirlNames = { @@ -170,6 +171,7 @@ namespace CalamityMod.NPCs "Cap'n Deek", // "Alex N" on Patreon (No discord account) "Captain Billy Bones", // <@!699589229507772416> (djackv) "Captain J. Crackers", // <@!233232602994049024> (qyuuno) + "Gol D. Roger", // <@!256228859110752257> (xtra3678) }; private static readonly string[] PrincessNames = { @@ -179,6 +181,7 @@ namespace CalamityMod.NPCs "Nyavi Aceso", // <@!270260920888852480> (navigator.) "everquartz", // <@!451343554451865611> (everquartz) "Gwynevere", // <@!142752927348424704> (nuclearchaosazathoth) + "Hael", // <@!641747280944431156> (kalebtull) }; private static readonly string[] SantaClausNames = { @@ -195,6 +198,7 @@ namespace CalamityMod.NPCs "Vorbis", "Angel", "Mòrag Ladair", // <@!161893929485074432> (jalapeno9) + "Linn", // <@!277983612383526913> (duckycolors) }; private static readonly string[] StylistNames = { @@ -677,7 +681,7 @@ namespace CalamityMod.NPCs public void TownNPCAlertSystem(NPC npc, Mod mod, SpriteBatch spriteBatch) { - if (CalamityConfig.Instance.ShopNewAlert && npc.townNPC) + if (CalamityClientConfig.Instance.ShopNewAlert && npc.townNPC) { for (int i = 0; i < npcAlertList.Count; i++) { @@ -1000,7 +1004,7 @@ namespace CalamityMod.NPCs break; case NPCID.Wizard: - if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ModContent.ItemType()) && !Main.LocalPlayer.ZoneHallow) + if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ItemType()) && !Main.LocalPlayer.ZoneHallow) chat = CalamityUtils.GetTextValue("Vanilla.WizardChat.MentionRoD"); if (Main.rand.NextBool(10) && Main.hardMode) chat = CalamityUtils.GetTextValue("Vanilla.WizardChat.Hardmode"); @@ -1028,6 +1032,8 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 2f; } + // Does not affect Dryad's Bane + // See CalamityGlobalNPC: UpdateLifeRegen public override void BuffTownNPC(ref float damageMult, ref int defense) { if (NPC.downedMoonlord) @@ -1070,7 +1076,7 @@ namespace CalamityMod.NPCs public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) { //Not an axe but close enough - if (npc.type == NPCID.TaxCollector && projectile.type == ModContent.ProjectileType()) + if (npc.type == NPCID.TaxCollector && projectile.type == ProjectileType()) return true; return base.CanBeHitByProjectile(npc, projectile); } @@ -1115,7 +1121,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Demolitionist) { - shop.Add(ModContent.ItemType(), Condition.DownedMechBossAny); + shop.Add(ItemType(), Condition.DownedMechBossAny); } if (type == NPCID.ArmsDealer) diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 929abfba7b..06e39a1b66 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -94,11 +94,11 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.dontTakeDamage); + writer.Write(playedbuildsound); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); - writer.Write(playedbuildsound); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.CeaselessVoid texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 591887a1cc..0d9e18a7a9 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.CeaselessVoid drawPos -= new Vector2(mainTexture.Width, mainTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < trailCount; i += 2) { @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Texture2D glowTexture = GlowTexture.Value; Color glowColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f) * NPC.Opacity; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < trailCount; i++) { diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index b34cac0c65..5f145cb61e 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -833,6 +833,21 @@ namespace CalamityMod.NPCs.Crabulon return false; } + // GFB removes map icon, hover text, and health bar + public override void BossHeadSlot(ref int index) + { + if (Main.zenithWorld) + index = -1; + } + + public override void ModifyHoverBoundingBox(ref Rectangle boundingBox) + { + if (Main.zenithWorld) + boundingBox = Rectangle.Empty; + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => Main.zenithWorld ? false : base.DrawHealthBar(hbPosition, ref scale, ref position); + public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 5ee0f09e36..ae45a2ad6d 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 30; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 140; + NPC.lifeMax = 80; NPC.knockBackResist = 0.75f; AnimationType = NPCID.DemonEye; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index b26c85bc46..5b5a0367bd 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 72; NPC.defense = 38; NPC.DR_NERD(0.35f); - NPC.lifeMax = 120; + NPC.lifeMax = 180; NPC.knockBackResist = 0.1f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit41; diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index 984dc9505e..fb675d20dc 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 40; NPC.height = 30; NPC.defense = 10; - NPC.lifeMax = 250; + NPC.lifeMax = 380; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Crags/RenegadeWarlock.cs b/NPCs/Crags/RenegadeWarlock.cs index 3e8ae54d4c..9621c3a4b5 100644 --- a/NPCs/Crags/RenegadeWarlock.cs +++ b/NPCs/Crags/RenegadeWarlock.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 18; NPC.height = 40; NPC.defense = 16; - NPC.lifeMax = 80; + NPC.lifeMax = 100; NPC.knockBackResist = 0.5f; AnimationType = NPCID.ZombieXmas; AIType = NPCID.ChaosElemental; diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 779cc3ccd6..65acb40774 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 80; NPC.height = 80; NPC.defense = 18; - NPC.lifeMax = 90; + NPC.lifeMax = 120; NPC.alpha = 100; NPC.knockBackResist = 0.7f; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 6fa5a79a6f..ab6c7a8cf1 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 80; NPC.height = 80; NPC.defense = 10; - NPC.lifeMax = 50; + NPC.lifeMax = 75; NPC.alpha = 100; NPC.knockBackResist = 0.9f; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 7c12cf4ae5..3497368010 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.Crags NPC.height = 40; NPC.defense = 30; NPC.DR_NERD(0.15f); - NPC.lifeMax = 60; + NPC.lifeMax = 80; NPC.knockBackResist = 0.65f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.noGravity = true; @@ -252,7 +252,7 @@ namespace CalamityMod.NPCs.Crags Vector2 halfSizeTexture = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.Crags texture = GlowTexture.Value; Color redGlow = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 1624bed812..90eb0bb145 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -155,6 +155,7 @@ namespace CalamityMod.NPCs.Cryogen writer.Write(biomeEnrageTimer); writer.Write(teleportLocationX); writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[1]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -164,6 +165,7 @@ namespace CalamityMod.NPCs.Cryogen biomeEnrageTimer = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[1] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -236,15 +238,18 @@ namespace CalamityMod.NPCs.Cryogen if ((int)NPC.ai[0] + 1 > currentPhase) HandlePhaseTransition((int)NPC.ai[0] + 1); - if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || bossRush || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 + if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f) { + NPC.localAI[1] = 1f; SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); - int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - NPC.ai[2] = shieldSpawn + 1; - NPC.localAI[1] = -1f; - NPC.netUpdate = true; - Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; - Main.npc[shieldSpawn].netUpdate = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + NPC.netUpdate = true; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } int shieldTracker = (int)NPC.ai[2] - 1; @@ -256,14 +261,9 @@ namespace CalamityMod.NPCs.Cryogen { NPC.dontTakeDamage = false; NPC.ai[2] = 0f; - - if (NPC.localAI[1] == -1f) - NPC.localAI[1] = death ? 540f : expertMode ? 720f : 1080f; - if (NPC.localAI[1] > 0f) - NPC.localAI[1] -= 1f; } - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); else if (!Main.raining && !BossRushEvent.BossRushActive) CalamityUtils.StartRain(); @@ -428,6 +428,15 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[0] = 1f; NPC.localAI[0] = 0f; NPC.netUpdate = true; + + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } } else if (NPC.ai[0] == 1f) @@ -617,6 +626,15 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; + + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } } else if (NPC.ai[0] == 2f) @@ -968,6 +986,18 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; + if (death) + { + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } + } + int chance = 100; if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) chance = 20; @@ -1433,7 +1463,7 @@ namespace CalamityMod.NPCs.Cryogen { string key = "Mods.CalamityMod.Status.Progression.IceOreText"; Color messageColor = Color.LightSkyBlue; - CalamityUtils.SpawnOre(ModContent.TileType(), 15E-05, 0.45f, 0.7f, 3, 8, TileID.SnowBlock, TileID.IceBlock, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, ModContent.TileType(), ModContent.TileType()); + CalamityUtils.SpawnOre(ModContent.TileType(), 16E-05, 0.45f, 0.7f, 6, 11, TileID.SnowBlock, TileID.IceBlock, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, ModContent.TileType(), ModContent.TileType()); CalamityUtils.DisplayLocalizedText(key, messageColor); } diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 19e69bdb32..f1fd71ba5d 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -32,11 +32,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.height = 216; NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; NPC.DR_NERD(0.4f); - NPC.lifeMax = CalamityWorld.death ? 700 : 1400; - if (BossRushEvent.BossRushActive) - { - NPC.lifeMax = 10000; - } + NPC.LifeMaxNERB(2800, 3360, 33600); NPC.Opacity = 0f; NPC.HitSound = Cryogen.HitSound; NPC.DeathSound = BreakSound; diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index cd5c8feaf7..f8581b7ad9 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -259,14 +259,14 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - // Fire lasers from every 15th (20th in normal mode) body segment if not in laser barrage phase + // Fire lasers from every 20th (25th in normal mode) body segment if not in laser barrage phase float laserBarrageGateValue = bossRush ? 780f : death ? 900f : 960f; float laserBarrageShootGateValue = bossRush ? 160f : 240f; float laserBarragePhaseGateValue = laserBarrageGateValue - laserBarrageShootGateValue * 1.5f; if (Main.npc[(int)NPC.ai[2]].Calamity().newAI[1] < laserBarragePhaseGateValue) { NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 15f : 20f) == 0f) + if (NPC.localAI[0] >= laserBarrageGateValue * (Main.getGoodWorld ? 0.1f : 0.2f) && NPC.ai[0] % (expertMode ? 20f : 25f) == 0f) { NPC.TargetClosest(); SoundEngine.PlaySound(SoundID.Item12, player.Center); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index d314df271a..77d1994073 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -82,9 +82,9 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser spread variables - private const int shotSpacingMax = 1470; + private const int shotSpacingMax = 1440; private int shotSpacing = shotSpacingMax; - private const int totalShots = 14; + private const int totalShots = 10; private const int spacingVar = shotSpacingMax / totalShots * 2; private int laserWallType = 0; private const float laserWallSpacingOffset = 16f; @@ -125,11 +125,11 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser wall variables - private const int shotSpacingMax_Phase2 = 1470; + private const int shotSpacingMax_Phase2 = 1440; private int[] shotSpacing_Phase2 = new int[4] { shotSpacingMax_Phase2, shotSpacingMax_Phase2, shotSpacingMax_Phase2, shotSpacingMax_Phase2 }; - private const int spacingVar_Phase2 = 105; - private const int totalShots_Phase2 = 28; - private const int totalDiagonalShots = 8; + private const int spacingVar_Phase2 = 120; + private const int totalShots_Phase2 = 24; + private const int totalDiagonalShots = 6; private const int diagonalSpacingVar = shotSpacingMax_Phase2 / totalDiagonalShots * 2; private int laserWallType_Phase2 = 0; public int laserWallPhase = 0; @@ -353,7 +353,7 @@ namespace CalamityMod.NPCs.DevourerofGods CalamityGlobalNPC.DoGP2 = -1; // Stop rain - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); // Get a target (time is checked in the second check to ensure a new target isn't being set constantly) @@ -950,7 +950,7 @@ namespace CalamityMod.NPCs.DevourerofGods Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - spawnOffset, targetPosY + shotSpacing_Phase2[3], laserVelocity, 0f, type, damage, 0f, Main.myPlayer); } - shotSpacing_Phase2[3] -= Main.rand.NextBool() ? 180 : 200; + shotSpacing_Phase2[3] -= Main.rand.NextBool() ? 215 : 235; } if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 92b9bf0991..67238d32a2 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1529,7 +1529,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // This is created to allow easy duplication of them when drawing the charge. void drawInstance(Vector2 drawOffset, Color baseColor) { - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1600,7 +1600,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } texture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index ea1654d11d..560d082ee9 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1242,7 +1242,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 vector = new Vector2(NPC.width / 2, NPC.height / 2); int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1262,7 +1262,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares texture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 25711cd7e6..e6290d2bf7 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -552,7 +552,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -593,7 +593,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -660,7 +660,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares for (int k = 0; k < 3; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 255, 255), 1f); - if (NPC.soundDelay == 1) + if (NPC.soundDelay == 0) { NPC.soundDelay = 3; SoundEngine.PlaySound(CommonCalamitySounds.ExoHitSound, NPC.Center); diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index e3cae35c3b..50e90dd8ee 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -600,7 +600,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -639,7 +639,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 92d41aaa67..3cd116c063 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -551,7 +551,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -591,7 +591,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index ad5752378b..f98d292391 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -546,7 +546,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Color afterimageBaseColor = Main.npc[(int)NPC.ai[2]].localAI[1] == (float)AresBody.Enraged.Yes ? Color.Red : Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { @@ -585,7 +585,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Texture2D glowTexture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index e1b8f140a2..70737fc4e4 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -1424,7 +1424,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // This is created to allow easy duplication of them when drawing the charge. void drawInstance(Vector2 drawOffset, Color baseColor) { - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { @@ -1495,7 +1495,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } texture = GlowTexture.Value; - if (CalamityConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) + if (CalamityClientConfig.Instance.Afterimages && !NPC.IsABestiaryIconDummy) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 3d1673db94..c0d7469cc5 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -609,7 +609,7 @@ namespace CalamityMod.NPCs.GreatSandShark int eightConst = 8; int afterimageInc = 2; int afterimageCounter = 1; - while (((afterimageInc > 0 && afterimageCounter < eightConst) || (afterimageInc < 0 && afterimageCounter > eightConst)) && CalamityConfig.Instance.Afterimages) + while (((afterimageInc > 0 && afterimageCounter < eightConst) || (afterimageInc < 0 && afterimageCounter > eightConst)) && CalamityClientConfig.Instance.Afterimages) { Color alphaAfterimageColor = NPC.GetAlpha(extraAfterimageColor); { diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 19bd36f3e3..67d2544e02 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.HiveMind Color afterimageBaseColor = Color.White; int numAfterimages = 5; - if (CalamityConfig.Instance.Afterimages && state != 0) + if (CalamityClientConfig.Instance.Afterimages && state != 0) { for (int i = 1; i < numAfterimages; i += 2) { diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 45ce3a6124..9658663e8e 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 6; - NPC.lifeMax = 50; + NPC.lifeMax = 75; NPC.knockBackResist = 0.8f; AnimationType = NPCID.Slimer; NPC.value = Item.buyPrice(0, 0, 1, 0); diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 1fc942cfb8..7ba9f71d66 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; @@ -429,6 +430,21 @@ namespace CalamityMod.NPCs.NormalNPCs } } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + Player player = spawnInfo.Player; + bool gfbCondition = Main.zenithWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; + if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle)) && !player.ZoneDungeon && !player.Calamity().ZoneSunkenSea && !player.Calamity().ZoneAbyss) + { + if (!CalamityPlayer.areThereAnyDamnBosses && NPC.downedPlantBoss && !NPC.AnyNPCs(ModContent.NPCType())) + { + float spawnRateDivisor = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 125f : CalamityWorld.revenge ? 425f : 500f; + return 1 / spawnRateDivisor; + } + } + return 0f; + } + public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.GreaterHealingPotion; diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index 8052c470be..f6c88947ad 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 24; NPC.defense = 8; NPC.alpha = 100; - NPC.lifeMax = 50; + NPC.lifeMax = 65; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.knockBackResist = 0f; NPC.HitSound = SoundID.NPCHit5; diff --git a/NPCs/NormalNPCs/BloodlettingServant.cs b/NPCs/NormalNPCs/BloodlettingServant.cs index 7111f3a916..8a13965c80 100644 --- a/NPCs/NormalNPCs/BloodlettingServant.cs +++ b/NPCs/NormalNPCs/BloodlettingServant.cs @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.NormalNPCs float telegraphScalar = MathHelper.Clamp((NPC.ai[0] - ChargeTelegraphGateValue) / ChargeTelegraphGateValue, 0f, 1f); Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); - if (CalamityConfig.Instance.Afterimages && NPC.ai[1] > 0f) + if (CalamityClientConfig.Instance.Afterimages && NPC.ai[1] > 0f) { int afterimageAmount = 10; int afterImageIncrement = 2; diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index 881bde1018..12357273e6 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -6,6 +6,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class BloomSlime : ModNPC @@ -23,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 25; - NPC.lifeMax = 1000; + NPC.lifeMax = 1500; NPC.knockBackResist = 0.3f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 25, 0); diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index 68c3582f54..222b7849e5 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 18; - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.knockBackResist = 0.95f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit7; diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index a2ac0b57eb..ca9d7305f2 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 10; - NPC.lifeMax = 90; + NPC.lifeMax = 115; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 0, 80); NPC.HitSound = SoundID.NPCHit33; diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 6a432d29cf..b484f96a8d 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 4; - NPC.lifeMax = 60; + NPC.lifeMax = 75; NPC.knockBackResist = 0.75f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 30); @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index aa32b01389..3c630b003a 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 12; - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.knockBackResist = 0.15f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundHallow, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index a53c26e4a7..5902721f89 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 8; - NPC.lifeMax = 150; + NPC.lifeMax = 190; NPC.knockBackResist = 0.35f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 2, 0); @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 187e18bbe4..4ceefe2d42 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 6; - NPC.lifeMax = 105; + NPC.lifeMax = 135; NPC.knockBackResist = 0.55f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 7a70aadd97..dff707be44 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 8; - NPC.lifeMax = 135; + NPC.lifeMax = 170; NPC.knockBackResist = 0.45f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 67894c8546..f0071d1840 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 6; - NPC.lifeMax = 90; + NPC.lifeMax = 115; NPC.knockBackResist = 0.65f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 36752b68e0..9feae56882 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 4; - NPC.lifeMax = 45; + NPC.lifeMax = 60; NPC.knockBackResist = 0.85f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 30); @@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs { bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert, + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground, new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.GemCrawler") }); } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 17442a18d1..e1aa62dd99 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 42; NPC.defense = 8; - NPC.lifeMax = 130; + NPC.lifeMax = 165; NPC.knockBackResist = 0.3f; AnimationType = NPCID.RainbowSlime; NPC.value = Item.buyPrice(0, 0, 2, 0); diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 7c5c2a66ed..43798e6ba2 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -5,6 +5,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class CryoSlime : ModNPC @@ -22,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 8; - NPC.lifeMax = 120; + NPC.lifeMax = 180; NPC.knockBackResist = 0.6f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 28a4efa960..a8dd2fb9ff 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 64; NPC.defense = 10; NPC.DR_NERD(0.1f); - NPC.lifeMax = 300; + NPC.lifeMax = 375; NPC.knockBackResist = 0.4f; NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.HitSound = SoundID.NPCHit5; diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 1cda527552..6f781aef23 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 42; NPC.defense = 8; - NPC.lifeMax = 130; + NPC.lifeMax = 165; NPC.knockBackResist = 0.3f; AnimationType = NPCID.RainbowSlime; NPC.value = Item.buyPrice(0, 0, 2, 0); diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 6b730dc634..65cf22f33e 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 36; NPC.height = 32; NPC.defense = Main.hardMode ? 10 : 2; - NPC.lifeMax = Main.hardMode ? 150 : 50; + NPC.lifeMax = Main.hardMode ? 190 : 65; NPC.knockBackResist = Main.hardMode ? 0.2f : 0.5f; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit1; diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs new file mode 100644 index 0000000000..52c801fef7 --- /dev/null +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -0,0 +1,904 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Chat; +using Terraria.GameContent; +using Terraria.GameContent.Achievements; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.NormalNPCs +{ + [AutoloadBossHead] + public class Foveanator : ModNPC + { + public static int phase1IconIndex; + public static int phase2IconIndex; + + internal static void LoadHeadIcons() + { + string phase1IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Head_Boss"; + string phase2IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss"; + + CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); + + CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); + phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; + NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + } + + public override void SetDefaults() + { + NPC.Calamity().canBreakPlayerDefense = true; + NPC.aiStyle = NPCAIStyleID.Retinazer; + NPC.GetNPCDamage(); + NPC.DR_NERD(0.2f); + + NPC.width = 100; + NPC.height = 100; + if (Main.tenthAnniversaryWorld) + NPC.scale *= 0.5f; + if (Main.getGoodWorld) + NPC.scale *= 0.8f; + + NPC.defense = 10; + NPC.lifeMax = 24000; + NPC.knockBackResist = 0f; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.boss = true; + NPC.SpawnWithHigherTime(30); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath14; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = true; + AnimationType = NPCID.Retinazer; + Music = MusicID.Boss2; + + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void BossHeadSlot(ref int index) => index = NPC.ai[0] >= 3f ? phase2IconIndex : phase1IconIndex; + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + CalamityUtils.CalamityTargeting(NPC, default); + + float enrageScale = bossRush ? 0.5f : 0.3f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Check for Retinazer + bool retAlive = false; + if (CalamityGlobalNPC.laserEye != -1) + retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; + + // Check for Spazmatism or Retinazer + bool spazAlive = false; + if (CalamityGlobalNPC.fireEye != -1) + spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; + + // Explode if ret and spaz are dead + if (!retAlive && !spazAlive) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.active = false; + NPC.netUpdate = true; + return; + } + + float foveanatorHoverXDest = NPC.Center.X - Main.player[NPC.target].position.X - (Main.player[NPC.target].width / 2); + float foveanatorHoverYDest = NPC.position.Y + NPC.height - 59f - Main.player[NPC.target].position.Y - (Main.player[NPC.target].height / 2); + + float foveanatorHoverRotation = (float)Math.Atan2(foveanatorHoverYDest, foveanatorHoverXDest) + MathHelper.PiOver2; + if (foveanatorHoverRotation < 0f) + foveanatorHoverRotation += MathHelper.TwoPi; + else if (foveanatorHoverRotation > MathHelper.TwoPi) + foveanatorHoverRotation -= MathHelper.TwoPi; + + float foveanatorRotationSpeed = 0.1f; + if (NPC.rotation < foveanatorHoverRotation) + { + if ((foveanatorHoverRotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= foveanatorRotationSpeed; + else + NPC.rotation += foveanatorRotationSpeed; + } + else if (NPC.rotation > foveanatorHoverRotation) + { + if ((NPC.rotation - foveanatorHoverRotation) > MathHelper.Pi) + NPC.rotation += foveanatorRotationSpeed; + else + NPC.rotation -= foveanatorRotationSpeed; + } + + if (NPC.rotation > foveanatorHoverRotation - foveanatorRotationSpeed && NPC.rotation < foveanatorHoverRotation + foveanatorRotationSpeed) + NPC.rotation = foveanatorHoverRotation; + + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + + if (NPC.rotation > foveanatorHoverRotation - foveanatorRotationSpeed && NPC.rotation < foveanatorHoverRotation + foveanatorRotationSpeed) + NPC.rotation = foveanatorHoverRotation; + + if (Main.rand.NextBool(5)) + { + int foveaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f), NPC.width, (int)(NPC.height * 0.5f), DustID.Blood, NPC.velocity.X, 2f, 0, default, 1f); + Dust dust = Main.dust[foveaDust]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[NPC.target].dead && NPC.timeLeft < 10) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != NPC.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == NPC.type) && Main.npc[i].timeLeft - 1 > NPC.timeLeft) + NPC.timeLeft = Main.npc[i].timeLeft - 1; + } + } + + // Phase HP ratios + float phase2LifeRatio = 0.85f; + float finalPhaseLifeRatio = 0.4f; + + // Movement variables + float phase1MaxSpeedIncrease = 2f; + float phase1MaxAccelerationIncrease = 0.025f; + float phase1MaxChargeSpeedIncrease = 3f; + + // Phase duration variables + float phase1MaxLaserPhaseDurationDecrease = 120f; + + // Go to phase 2 early if Spaz and Ret health total goes below 50% + // Go to final phase early if Spaz and Ret health total goes below 20% + float retAndSpazHPRatio = 0f; + if (CalamityGlobalNPC.fireEye != -1) + { + if (Main.npc[CalamityGlobalNPC.fireEye].active) + retAndSpazHPRatio += Main.npc[CalamityGlobalNPC.fireEye].life / (float)Main.npc[CalamityGlobalNPC.fireEye].lifeMax; + } + if (CalamityGlobalNPC.laserEye != -1) + { + if (Main.npc[CalamityGlobalNPC.laserEye].active) + retAndSpazHPRatio += Main.npc[CalamityGlobalNPC.laserEye].life / (float)Main.npc[CalamityGlobalNPC.laserEye].lifeMax; + } + + // Phase checks + bool phase2 = lifeRatio < phase2LifeRatio || retAndSpazHPRatio < 0.5f; + bool finalPhase = lifeRatio < finalPhaseLifeRatio || retAndSpazHPRatio < 0.2f; + + Vector2 mechQueenSpacing = Vector2.Zero; + if (NPC.IsMechQueenUp) + { + NPC NPC = Main.npc[NPC.mechQueen]; + Vector2 mechQueenCenter = NPC.GetMechQueenCenter(); + Vector2 eyePosition = new Vector2(0f, -300f); + eyePosition *= 0.75f; + float mechdusaRotation = NPC.velocity.X * 0.025f; + mechQueenSpacing = mechQueenCenter + eyePosition; + mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaRotation, mechQueenCenter); + } + + NPC.reflectsProjectiles = false; + + // Despawn + if (Main.player[NPC.target].dead) + { + NPC.velocity.Y -= 0.04f; + if (NPC.timeLeft > 10) + { + NPC.timeLeft = 10; + return; + } + } + + else if (NPC.ai[0] == 0f) + { + if (NPC.ai[1] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + float foveanatorPhase1MaxSpeed = 8.25f; + float foveanatorPhase1Acceleration = 0.115f; + foveanatorPhase1MaxSpeed += 4f * enrageScale; + foveanatorPhase1Acceleration += 0.05f * enrageScale; + + if (death) + { + foveanatorPhase1MaxSpeed += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + foveanatorPhase1Acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + } + + if (Main.getGoodWorld) + { + foveanatorPhase1MaxSpeed *= 1.15f; + foveanatorPhase1Acceleration *= 1.15f; + } + + int foveanatorFaceDirection = 1; + if (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) + foveanatorFaceDirection = -1; + + // Foveanator stays further away from the player than Retinazer (Retinazer distance is 300, Foveanator distance is 450) + Vector2 foveanatorPosition = NPC.Center; + float distanceFromTarget = 450f; + float foveanatorTargetX = Main.player[NPC.target].Center.X + (foveanatorFaceDirection * distanceFromTarget) - foveanatorPosition.X; + float foveanatorTargetY = Main.player[NPC.target].Center.Y - distanceFromTarget - foveanatorPosition.Y; + + if (NPC.IsMechQueenUp) + { + foveanatorPhase1MaxSpeed = 14f; + foveanatorTargetX = mechQueenSpacing.X; + foveanatorTargetY = mechQueenSpacing.Y; + foveanatorTargetX -= foveanatorPosition.X; + foveanatorTargetY -= foveanatorPosition.Y; + } + + float foveanatorTargetDist = (float)Math.Sqrt(foveanatorTargetX * foveanatorTargetX + foveanatorTargetY * foveanatorTargetY); + float foveanatorTargetDistCopy = foveanatorTargetDist; + + if (NPC.IsMechQueenUp) + { + if (foveanatorTargetDist > foveanatorPhase1MaxSpeed) + { + foveanatorTargetDist = foveanatorPhase1MaxSpeed / foveanatorTargetDist; + foveanatorTargetX *= foveanatorTargetDist; + foveanatorTargetY *= foveanatorTargetDist; + } + + NPC.velocity.X = (NPC.velocity.X * 59f + foveanatorTargetX) / 60f; + NPC.velocity.Y = (NPC.velocity.Y * 59f + foveanatorTargetY) / 60f; + } + else + { + foveanatorTargetDist = foveanatorPhase1MaxSpeed / foveanatorTargetDist; + foveanatorTargetX *= foveanatorTargetDist; + foveanatorTargetY *= foveanatorTargetDist; + + if (NPC.velocity.X < foveanatorTargetX) + { + NPC.velocity.X += foveanatorPhase1Acceleration; + if (NPC.velocity.X < 0f && foveanatorTargetX > 0f) + NPC.velocity.X += foveanatorPhase1Acceleration; + } + else if (NPC.velocity.X > foveanatorTargetX) + { + NPC.velocity.X -= foveanatorPhase1Acceleration; + if (NPC.velocity.X > 0f && foveanatorTargetX < 0f) + NPC.velocity.X -= foveanatorPhase1Acceleration; + } + if (NPC.velocity.Y < foveanatorTargetY) + { + NPC.velocity.Y += foveanatorPhase1Acceleration; + if (NPC.velocity.Y < 0f && foveanatorTargetY > 0f) + NPC.velocity.Y += foveanatorPhase1Acceleration; + } + else if (NPC.velocity.Y > foveanatorTargetY) + { + NPC.velocity.Y -= foveanatorPhase1Acceleration; + if (NPC.velocity.Y > 0f && foveanatorTargetY < 0f) + NPC.velocity.Y -= foveanatorPhase1Acceleration; + } + } + + // Foveanator stays in this phase longer than Retinazer (Foveanator time is 450, Retinazer time is 300) + // Foveanator has longer cooldown between firing projectiles than Retinazer (Foveanator cooldown is 60, Retinazer cooldown is 30) + NPC.ai[2] += 1f; + float phaseGateValue = 450f - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float laserGateValue = 60f; + if (NPC.IsMechQueenUp) + { + phaseGateValue = 1350f; + laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 120f : 180f); + } + if (NPC.ai[2] >= phaseGateValue) + { + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + + CalamityUtils.CalamityTargeting(NPC, default); + + NPC.netUpdate = true; + } + else if (foveanatorTargetDistCopy < (death ? 960f : 800f)) + { + if (!Main.player[NPC.target].dead) + { + NPC.ai[3] += 1f; + if (Main.getGoodWorld) + NPC.ai[3] += 0.5f; + } + + if (NPC.ai[3] >= laserGateValue) + { + NPC.ai[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float foveanatorLaserSpeed = 12f; + foveanatorLaserSpeed += 4f * enrageScale; + + // TODO - Change this to Foveanator's laser when it's implemented + int type = ProjectileID.EyeLaser; + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 laserVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorLaserSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), foveanatorPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + + else if (NPC.ai[1] == 1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.rotation = foveanatorHoverRotation; + float foveanatorChargeSpeed = 8f; + foveanatorChargeSpeed += 5f * enrageScale; + if (death) + foveanatorChargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + if (Main.getGoodWorld) + foveanatorChargeSpeed += 1f; + + Vector2 chargeVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorChargeSpeed; + NPC.velocity = chargeVelocity; + NPC.ai[1] = 2f; + } + else if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[2] += 1f; + float decelerateGateValue = 72f + (death ? 12f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (NPC.ai[2] >= decelerateGateValue) + { + // Avoid cheap bullshit + NPC.damage = 0; + + float decelerationMultiplier = 0.8f - (death ? 0.2f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + NPC.velocity *= decelerationMultiplier; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + { + // Accelerative charge + NPC.velocity *= 1.015f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + } + + float delayBeforeChargingAgain = 96f - (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + if (NPC.ai[2] >= delayBeforeChargingAgain) + { + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.rotation = foveanatorHoverRotation; + float totalCharges = death ? 3f : 2f; + if (NPC.ai[3] >= totalCharges) + { + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + + CalamityUtils.CalamityTargeting(NPC, default); + } + else + NPC.ai[1] = 1f; + } + } + + // Enter phase 2 + if (phase2) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + + CalamityUtils.CalamityTargeting(NPC, default); + + NPC.netUpdate = true; + } + } + + else if (NPC.ai[0] == 1f || NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.IsMechQueenUp) + NPC.reflectsProjectiles = true; + + if (NPC.ai[0] == 1f) + { + NPC.ai[2] += 0.005f; + if (NPC.ai[2] > 0.5) + NPC.ai[2] = 0.5f; + } + else + { + NPC.ai[2] -= 0.005f; + if (NPC.ai[2] < 0f) + NPC.ai[2] = 0f; + } + + NPC.rotation += NPC.ai[2]; + + NPC.ai[1] += 1f; + if (NPC.ai[2] >= 0.2f) + { + if (NPC.ai[1] % 10f == 0f) + { + SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool shootLaser = NPC.ai[1] % 20f == 0f; + + // TODO - Change this to Foveanator's lasers and energy bombs when they're implemented + int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 7f; + int numProj = shootLaser ? 4 : 2; + int spread = shootLaser ? 15 : 30; + float rotation = MathHelper.ToRadians(spread); + float offset = shootLaser ? 150f : 100f; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + + if (NPC.ai[1] == 100f) + { + NPC.ai[0] += 1f; + NPC.ai[1] = 0f; + if (NPC.ai[0] == 3f) + { + NPC.ai[2] = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.NPCHit1, NPC.Center); + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 2; i++) + { + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator1").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, NPC.scale); + } + } + + for (int j = 0; j < 20; j++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + } + } + + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); + + NPC.velocity *= 0.98f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + { + // If in phase 2 but Spaz or Ret aren't + bool spazOrRetInPhase1 = false; + if (CalamityGlobalNPC.fireEye != -1) + { + if (Main.npc[CalamityGlobalNPC.fireEye].active) + spazOrRetInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; + } + if (CalamityGlobalNPC.laserEye != -1) + { + if (Main.npc[CalamityGlobalNPC.laserEye].active) + spazOrRetInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; + } + + NPC.chaseable = !spazOrRetInPhase1; + + int setDamage = (int)Math.Round(NPC.defDamage * 1.5); + NPC.defense = NPC.defDefense + 14; + calamityGlobalNPC.DR = spazOrRetInPhase1 ? 0.9999f : 0.2f; + calamityGlobalNPC.unbreakableDR = spazOrRetInPhase1; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = spazOrRetInPhase1; + + NPC.HitSound = SoundID.NPCHit4; + + if (NPC.ai[1] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + float foveanatorFlamethrowerMaxSpeed = 4f + (death ? 1.2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float foveanatorFlamethrowerAccel = 0.06f + (death ? 0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + foveanatorFlamethrowerMaxSpeed += 2f * enrageScale; + foveanatorFlamethrowerAccel += 0.04f * enrageScale; + + int foveanatorFlamethrowerFaceDirection = 1; + if (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) + foveanatorFlamethrowerFaceDirection = -1; + + Vector2 foveanatorFlamethrowerPos = NPC.Center; + int flamethrowerDistance = 360; + float foveanatorFlamethrowerTargetX = Main.player[NPC.target].Center.X + (foveanatorFlamethrowerFaceDirection * flamethrowerDistance) - foveanatorFlamethrowerPos.X; + float foveanatorFlamethrowerTargetY = Main.player[NPC.target].Center.Y - foveanatorFlamethrowerPos.Y; + float foveanatorFlamethrowerTargetDist = (float)Math.Sqrt(foveanatorFlamethrowerTargetX * foveanatorFlamethrowerTargetX + foveanatorFlamethrowerTargetY * foveanatorFlamethrowerTargetY); + + if (!NPC.IsMechQueenUp) + { + // Boost speed if too far from target + if (foveanatorFlamethrowerTargetDist > flamethrowerDistance) + foveanatorFlamethrowerMaxSpeed += MathHelper.Lerp(0f, 12f, MathHelper.Clamp((foveanatorFlamethrowerTargetDist - flamethrowerDistance) / 1000f, 0f, 1f)); + + if (Main.getGoodWorld) + { + foveanatorFlamethrowerMaxSpeed *= 1.15f; + foveanatorFlamethrowerAccel *= 1.15f; + } + + foveanatorFlamethrowerTargetDist = foveanatorFlamethrowerMaxSpeed / foveanatorFlamethrowerTargetDist; + foveanatorFlamethrowerTargetX *= foveanatorFlamethrowerTargetDist; + foveanatorFlamethrowerTargetY *= foveanatorFlamethrowerTargetDist; + + if (NPC.velocity.X < foveanatorFlamethrowerTargetX) + { + NPC.velocity.X += foveanatorFlamethrowerAccel; + if (NPC.velocity.X < 0f && foveanatorFlamethrowerTargetX > 0f) + NPC.velocity.X += foveanatorFlamethrowerAccel; + } + else if (NPC.velocity.X > foveanatorFlamethrowerTargetX) + { + NPC.velocity.X -= foveanatorFlamethrowerAccel; + if (NPC.velocity.X > 0f && foveanatorFlamethrowerTargetX < 0f) + NPC.velocity.X -= foveanatorFlamethrowerAccel; + } + if (NPC.velocity.Y < foveanatorFlamethrowerTargetY) + { + NPC.velocity.Y += foveanatorFlamethrowerAccel; + if (NPC.velocity.Y < 0f && foveanatorFlamethrowerTargetY > 0f) + NPC.velocity.Y += foveanatorFlamethrowerAccel; + } + else if (NPC.velocity.Y > foveanatorFlamethrowerTargetY) + { + NPC.velocity.Y -= foveanatorFlamethrowerAccel; + if (NPC.velocity.Y > 0f && foveanatorFlamethrowerTargetY < 0f) + NPC.velocity.Y -= foveanatorFlamethrowerAccel; + } + } + + // Fire flamethrower for x seconds + NPC.ai[2] += (retAlive && spazAlive) ? 1f : 2f; + float phaseGateValue = NPC.IsMechQueenUp ? 1350f : 270f - (death ? 90f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + if (NPC.ai[2] >= phaseGateValue) + { + // Go to charge phase or fire large barrage of lasers and energy bombs if in final phase + NPC.ai[1] = finalPhase ? 3f : 1f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + // Fire fireballs and flamethrower + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) + { + // Play flame sound on timer + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 22f) + { + NPC.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, NPC.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (NPC.localAI[1] > 4f) + { + NPC.localAI[1] = 0f; + + float foveanatorFlamethrowerSpeed = 4f; + foveanatorFlamethrowerSpeed += 2f * enrageScale; + float timeForFlamethrowerToReachMaxVelocity = 60f; + float flamethrowerSpeedScalar = MathHelper.Clamp(NPC.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); + foveanatorFlamethrowerSpeed = MathHelper.Lerp(0.1f, foveanatorFlamethrowerSpeed, flamethrowerSpeedScalar); + + // TODO - Change this to Foveanator's flamethrower when it's done + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + + Vector2 flamethrowerVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f; + + if (NPC.IsMechQueenUp) + { + Vector2 mechdusaFoveanatorShadowFireballPos = (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f; + foveanatorFlamethrowerTargetX = mechdusaFoveanatorShadowFireballPos.X; + foveanatorFlamethrowerTargetY = mechdusaFoveanatorShadowFireballPos.Y; + foveanatorFlamethrowerPos = NPC.Center - mechdusaFoveanatorShadowFireballPos * 3f; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), foveanatorFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + } + } + } + + if (NPC.IsMechQueenUp) + { + foveanatorFlamethrowerMaxSpeed = 14f; + Vector2 mechdusaFoveanatorFlamethrowerPos = mechQueenSpacing - foveanatorFlamethrowerPos; + Vector2 idealVelocity = new Vector2(foveanatorFlamethrowerTargetX, foveanatorFlamethrowerTargetY); + if (mechdusaFoveanatorFlamethrowerPos.Length() > foveanatorFlamethrowerMaxSpeed) + idealVelocity *= foveanatorFlamethrowerMaxSpeed / mechdusaFoveanatorFlamethrowerPos.Length(); + + float inertia = 60f; + NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia; + } + } + + // Charge + else if (NPC.ai[1] == 1f) + { + // Set damage + NPC.damage = setDamage; + + // Play charge sound + SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); + + // Set rotation and velocity + NPC.rotation = foveanatorHoverRotation; + float foveanatorPhase2ChargeSpeed = 9f + (death ? 2.5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + foveanatorPhase2ChargeSpeed += 8f * enrageScale; + if (Main.getGoodWorld) + foveanatorPhase2ChargeSpeed *= 1.2f; + + Vector2 chargeVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorPhase2ChargeSpeed; + NPC.velocity = chargeVelocity; + + NPC.ai[1] = 2f; + } + + // Maintain charge velocity until deceleration + else if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = setDamage; + + NPC.ai[2] += (retAlive || spazAlive) ? 1f : 1.25f; + + float chargeTime = 60f - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + + // Slow down + if (NPC.ai[2] >= chargeTime) + { + // Avoid cheap bullshit + NPC.damage = 0; + + float deceleration = 0.8f - (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + NPC.velocity *= deceleration; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + { + // Accelerative charge + // TODO - Make the charge leave behind energy bomb projectiles when the projectiles are done + NPC.velocity *= 1.015f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + } + + // Charge 2 times + if (NPC.ai[2] >= chargeTime * 1.3f) + { + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + + NPC.rotation = foveanatorHoverRotation; + + float maxCharges = 2f; + if (NPC.ai[3] >= maxCharges) + { + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + } + else + NPC.ai[1] = 1f; + } + } + + // Laser and energy bomb barrage + else if (NPC.ai[1] == 3f) + { + + } + } + } + + public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion; + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.75f * balance * bossAdjustment); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f); + + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + if (NPC.life > 0) + { + for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 100D; i++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f); + + return; + } + + for (int i = 0; i < 150; i++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2 * hit.HitDirection, -2f); + + if (Main.netMode != NetmodeID.Server) + { + for (int i = 0; i < 2; i++) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator2").Type, NPC.scale); + } + } + + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 1.4f; + } + + for (int i = 0; i < 5; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, 0f, 0f, 100, default, 2.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1.5f); + Main.dust[dust].velocity *= 3f; + } + + if (Main.netMode != NetmodeID.Server) + { + int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y += 1f; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y += 1f; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y -= 1f; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y -= 1f; + } + } + } +} diff --git a/NPCs/NormalNPCs/Foveanator_Head_Boss.png b/NPCs/NormalNPCs/Foveanator_Head_Boss.png new file mode 100644 index 0000000000..7c93efb49e Binary files /dev/null and b/NPCs/NormalNPCs/Foveanator_Head_Boss.png differ diff --git a/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss.png b/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss.png new file mode 100644 index 0000000000..6a6b7c7532 Binary files /dev/null and b/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss.png differ diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 2cabc312e1..76f580d016 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 50; NPC.defense = 10; - NPC.lifeMax = 80; + NPC.lifeMax = 100; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 80); diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index fca3afe2b1..ff467680b6 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 50; NPC.height = 50; NPC.defense = 12; - NPC.lifeMax = 500; + NPC.lifeMax = 625; NPC.knockBackResist = 0.25f; NPC.noTileCollide = true; NPC.aiStyle = -1; @@ -342,7 +342,7 @@ namespace CalamityMod.NPCs.NormalNPCs (MathHelper.Clamp(AITimer, 0f, TimeBeforeDash) / TimeBeforeDash); float AfterimageFade = MathHelper.Lerp(0f, 1f, interpolant); - if (CurrentState == IceClasperAIState.Dashing && CalamityConfig.Instance.Afterimages) + if (CurrentState == IceClasperAIState.Dashing && CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < NPC.oldPos.Length; i++) { diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 15eb09e912..befc565936 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 24; NPC.defense = 10; NPC.DR_NERD(0.1f); - NPC.lifeMax = 30; + NPC.lifeMax = 50; NPC.aiStyle = NPCAIStyleID.Fighter; AIType = NPCID.Crab; NPC.value = Item.buyPrice(0, 0, 1, 0); diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 0c9fe9bb28..bb1ec40ec3 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 40; NPC.defense = 18; NPC.DR_NERD(0.15f); - NPC.lifeMax = NPC.downedMoonlord ? 1350 : 135; + NPC.lifeMax = NPC.downedMoonlord ? 1700 : 170; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 2, 0); NPC.HitSound = SoundID.NPCHit2; diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index a4027c898b..3377be4600 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -5,6 +5,7 @@ using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.NormalNPCs { public class PerennialSlime : ModNPC @@ -22,7 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 150; + NPC.lifeMax = 225; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 9f81e50f1d..8572ab6c32 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 16; NPC.height = 16; NPC.defense = 10; - NPC.lifeMax = 1000; + NPC.lifeMax = 1250; NPC.knockBackResist = 0.2f; AnimationType = NPCID.DungeonSpirit; AIType = -1; diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index b6edcf000f..b9680816b4 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.scale *= 1.2f; NPC.defense = 30; - NPC.lifeMax = 3000; + NPC.lifeMax = 3750; NPC.knockBackResist = 0.1f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 60, 0); diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index a018061991..d0f6151698 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.scale *= 1.1f; NPC.defense = 25; - NPC.lifeMax = 2000; + NPC.lifeMax = 2500; NPC.knockBackResist = 0.15f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 40, 0); diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 7d375805c5..997044d162 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 32; NPC.height = 80; NPC.defense = 20; - NPC.lifeMax = 1500; + NPC.lifeMax = 1875; NPC.knockBackResist = 0.2f; AIType = -1; NPC.value = Item.buyPrice(0, 0, 30, 0); diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 62242cd86d..443827534c 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -38,12 +38,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 56; NPC.height = 56; NPC.defense = 4; - NPC.lifeMax = 50; + NPC.lifeMax = 65; if (DownedBossSystem.downedCryogen) { NPC.damage = 60; NPC.defense = 10; - NPC.lifeMax = 1000; + NPC.lifeMax = 1250; } NPC.knockBackResist = 0.3f; AnimationType = NPCID.Hellhound; diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 4e800c0d76..3338f6c5b4 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 46; NPC.height = 30; NPC.defense = 4; - NPC.lifeMax = 60; + NPC.lifeMax = 75; NPC.knockBackResist = 0.3f; AIType = NPCID.Wolf; NPC.value = Item.buyPrice(0, 0, 2, 0); diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index b031da27b0..e6185182d2 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -19,7 +19,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 10; - NPC.lifeMax = 30; + NPC.lifeMax = 40; NPC.knockBackResist = 0.8f; NPC.value = Item.buyPrice(0, 0, 0, 80); NPC.HitSound = SoundID.NPCHit1; diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 6c011593df..bd28e4214c 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 38; NPC.defense = 15; NPC.DR_NERD(0.15f); - NPC.lifeMax = 150; + NPC.lifeMax = 190; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.5f; diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index 3762db3f12..69040e26ec 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { + [AutoloadBossHead] public class SkeletronPrime2 : ModNPC { public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18"; @@ -136,6 +137,9 @@ namespace CalamityMod.NPCs.NormalNPCs } else { + // Set direction to the other head's direction + NPC.direction = Main.npc[(int)NPC.ai[0]].direction; + // Link the HP of both heads if (NPC.life > Main.npc[(int)NPC.ai[0]].life) NPC.life = Main.npc[(int)NPC.ai[0]].life; @@ -287,7 +291,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[2] += phase3 ? 1.2f : 0.8f; if (NPC.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || phase3) && canUseAttackInMaster) { - bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 400f && + bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 320f && Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 400f; bool shouldCharge = !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; @@ -316,22 +320,22 @@ namespace CalamityMod.NPCs.NormalNPCs else NPC.rotation = NPC.velocity.X / 15f; - float acceleration = (bossRush ? 0.2f : 0.125f) + (death ? 0.05f * (1f - lifeRatio) : 0f); + float acceleration = (bossRush ? 0.16f : 0.12f) + (death ? 0.05f * (1f - lifeRatio) : 0f); float accelerationMult = 1f; if (!cannonAlive) { - acceleration += 0.025f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!laserAlive) { - acceleration += 0.025f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!viceAlive) - acceleration += 0.025f; + acceleration += 0.0125f; if (!sawAlive) - acceleration += 0.025f; + acceleration += 0.0125f; acceleration *= accelerationMult; float topVelocity = acceleration * 100f; @@ -348,7 +352,7 @@ namespace CalamityMod.NPCs.NormalNPCs headDecelerationDownDist = 50f; } - if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (400f + headDecelerationUpDist)) + if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (320f + headDecelerationUpDist)) { if (NPC.velocity.Y > 0f) NPC.velocity.Y *= deceleration; @@ -358,7 +362,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.velocity.Y > topVelocity) NPC.velocity.Y = topVelocity; } - else if (NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (450f + headDecelerationDownDist)) + else if (NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (360f + headDecelerationDownDist)) { if (NPC.velocity.Y < 0f) NPC.velocity.Y *= deceleration; @@ -414,7 +418,7 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -679,7 +683,7 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -722,10 +726,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.rotation = NPC.velocity.X / 15f; - float flightVelocity = bossRush ? 32f : death ? 28f : 24f; - float flightAcceleration = bossRush ? 1.28f : death ? 1.12f : 0.96f; + float flightVelocity = bossRush ? 28f : death ? 25f : 22f; + float flightAcceleration = bossRush ? 1.16f : death ? 0.96f : 0.76f; - Vector2 destination = new Vector2(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X, Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - 500f); + Vector2 destination = new Vector2(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X, Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - 420f); NPC.SimpleFlyMovement((destination - NPC.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); // Spit bombs and then go to floating phase @@ -747,7 +751,7 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -874,50 +878,44 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.netMode != NetmodeID.Server) { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, 149); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, 150); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_1").Type, NPC.scale); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_2").Type, NPC.scale); - int num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - Gore gore2 = Main.gore[num802]; - gore2.velocity *= 0.4f; - Main.gore[num802].velocity.X += 1f; - Main.gore[num802].velocity.Y += 1f; + int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y += 1f; - num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - gore2 = Main.gore[num802]; - gore2.velocity *= 0.4f; - Main.gore[num802].velocity.X -= 1f; - Main.gore[num802].velocity.Y += 1f; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y += 1f; - num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - gore2 = Main.gore[num802]; - gore2.velocity *= 0.4f; - Main.gore[num802].velocity.X += 1f; - Main.gore[num802].velocity.Y -= 1f; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X += 1f; + Main.gore[gore].velocity.Y -= 1f; - num802 = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - gore2 = Main.gore[num802]; - gore2.velocity *= 0.4f; - Main.gore[num802].velocity.X -= 1f; - Main.gore[num802].velocity.Y -= 1f; + gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); + Main.gore[gore].velocity *= 0.4f; + Main.gore[gore].velocity.X -= 1f; + Main.gore[gore].velocity.Y -= 1f; } - for (int num798 = 0; num798 < 10; num798++) + for (int i = 0; i < 10; i++) { - int num799 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); - Dust dust = Main.dust[num799]; - dust.velocity *= 1.4f; + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[dust].velocity *= 1.4f; } - for (int num800 = 0; num800 < 5; num800++) + for (int i = 0; i < 5; i++) { - int num801 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[num801].noGravity = true; - Dust dust = Main.dust[num801]; - dust.velocity *= 5f; - num801 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); - dust = Main.dust[num801]; - dust.velocity *= 3f; + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[dust].velocity *= 3f; } } } diff --git a/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png b/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png new file mode 100644 index 0000000000..38362cb253 Binary files /dev/null and b/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png differ diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 0026459784..d66dede29c 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 33; NPC.height = 31; NPC.defense = 8; - NPC.lifeMax = 80; + NPC.lifeMax = 100; NPC.knockBackResist = 0.2f; AnimationType = NPCID.WalkingAntlion; NPC.value = Item.buyPrice(0, 0, 2, 0); @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 90, true); + target.AddBuff(ModContent.BuffType(), 60, true); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index d2a8b38629..f200b43453 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 58; NPC.height = 22; NPC.defense = 4; - NPC.lifeMax = 100; + NPC.lifeMax = 125; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 5, 0); @@ -247,6 +247,8 @@ namespace CalamityMod.NPCs.NormalNPCs target.AddBuff(BuffID.Burning, 60); if (Main.rand.NextBool(3)) target.AddBuff(ModContent.BuffType(), 120); + if (Main.rand.NextBool(3)) + target.AddBuff(ModContent.BuffType(), 120); if (Main.rand.NextBool(3)) target.AddBuff(ModContent.BuffType(), 120); if (Main.rand.NextBool(3)) diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs index 8421f495ff..95f5122d35 100644 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ b/NPCs/NormalNPCs/WildBumblefuck.cs @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index 316dc14574..fba16b1bb2 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 44; NPC.defense = 4; - NPC.lifeMax = Main.zenithWorld ? 72 : 46; + NPC.lifeMax = Main.zenithWorld ? 90 : 58; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 0, 1, 50); NPC.noGravity = false; @@ -217,9 +217,9 @@ namespace CalamityMod.NPCs.NormalNPCs // Spawn less frequently in the inner third of the world. if (spawnInfo.PlayerFloorX > Main.maxTilesX * 0.333f && spawnInfo.PlayerFloorX < Main.maxTilesX - Main.maxTilesX * 0.333f) - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.01f : 0.06f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.015f : 0.06f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.033f : 0.15f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.0375f : 0.15f) * (!NPC.AnyNPCs(NPC.type) ? 1.3f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 8131fe0a1e..faa24fb261 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 32; NPC.height = 32; NPC.defense = 4; - NPC.lifeMax = 21; + NPC.lifeMax = 27; NPC.knockBackResist = 0.35f; NPC.value = Item.buyPrice(0, 0, 1, 20); NPC.noGravity = true; @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index adb4b9b685..668d1438db 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 5; - NPC.lifeMax = 18; + NPC.lifeMax = 23; NPC.knockBackResist = 0.15f; NPC.value = Item.buyPrice(0, 0, 1, 15); NPC.HitSound = SoundID.NPCHit4; @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index 38fdb46dda..16a03a6fee 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 38; NPC.defense = 4; - NPC.lifeMax = 20; + NPC.lifeMax = 25; NPC.value = Item.buyPrice(0, 0, 1, 50); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index bbaee7f27e..4352bad89f 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 4; - NPC.lifeMax = 32; + NPC.lifeMax = 40; NPC.knockBackResist = Main.zenithWorld ? 0f : 0.15f; NPC.value = Item.buyPrice(0, 0, 1, 15); NPC.HitSound = SoundID.NPCHit4; @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (spawnInfo.PlayerSafe || spawnInfo.Player.Calamity().ZoneSulphur || (!spawnInfo.Player.ZoneOverworldHeight && !Main.remixWorld) || (!spawnInfo.Player.ZoneNormalCaverns && spawnInfo.Player.ZoneGlowshroom && Main.remixWorld)) return 0f; - return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.010f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); + return (Main.remixWorld ? SpawnCondition.Cavern.Chance : SpawnCondition.OverworldDaySlime.Chance) * (Main.hardMode ? 0.055f : 0.135f) * (NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 6a35998d40..43851176ba 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -259,7 +259,7 @@ namespace CalamityMod.NPCs.OldDuke color = drawColor; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.OldDuke afterimageScale = 20f; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 0; j < secondAfterimageAmt; j++) { @@ -366,7 +366,7 @@ namespace CalamityMod.NPCs.OldDuke yellowLerpColor *= ai2Opacity; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index f49346796a..8058d64f08 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -243,7 +243,7 @@ namespace CalamityMod.NPCs.OldDuke Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index 3816d66fed..d92df384c7 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -45,8 +45,6 @@ namespace CalamityMod.NPCs.Other NPC.Calamity().VulnerableToWater = true; } - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) => NPC.lifeMax = 50000; - public override void AI() { NPC.Opacity = Utils.GetLerpValue(0f, 25f, Time, true); diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index bd097cbde3..8539add457 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 38; NPC.height = 34; NPC.defense = 15; - NPC.lifeMax = 500; + NPC.lifeMax = 630; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit1; diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index e59ceb3545..7d3bb8889e 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 40; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 350; + NPC.lifeMax = 440; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; NPC.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 1f79c757cc..052ba40201 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 30; NPC.defense = 20; NPC.scale *= 0.5f; - NPC.lifeMax = 200; + NPC.lifeMax = 250; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0.4f; @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.PlagueEnemies Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.PlagueEnemies texture2D15 = GlowTexture.Value; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index c6b4e66b75..20c01a8a90 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.height = 30; NPC.defense = 25; NPC.scale *= 0.75f; - NPC.lifeMax = 300; + NPC.lifeMax = 380; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0.3f; @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.PlagueEnemies Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.PlagueEnemies texture2D15 = ModContent.Request("CalamityMod/NPCs/PlagueEnemies/PlagueChargerGlow").Value; Color redEyeColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index d8abae06ac..959a9b51c0 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -81,42 +81,56 @@ namespace CalamityMod.NPCs.PlagueEnemies { Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0.1f, 0.3f, 0f); - bool outsideJungle = false; - if (!Main.player[NPC.target].ZoneJungle) - { - outsideJungle = true; - if (NPC.timeLeft > 150) - NPC.timeLeft = 150; - } - else - { - if (NPC.timeLeft < 750) - NPC.timeLeft = 750; - } - - int playerAmt = Main.CurrentFrameFlags.ActivePlayersCount; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - bool dead4 = Main.player[NPC.target].dead; - if (dead4 && Main.expertMode) + // Despawn + float distanceFromTarget = Vector2.Distance(NPC.Center, Main.player[NPC.target].Center); + if (NPC.ai[0] != 6f) + { + if (NPC.timeLeft < 60) + NPC.timeLeft = 60; + if (distanceFromTarget > 3000f) + NPC.ai[0] = 4f; + } + if (Main.player[NPC.target].dead || !Main.player[NPC.target].ZoneJungle) + NPC.ai[0] = 6f; + + if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; - if ((double)NPC.position.Y < Main.worldSurface * 16D + 2000D) - NPC.velocity.Y += 0.04f; + NPC.velocity.Y *= 0.98f; - if (NPC.position.X < (float)(Main.maxTilesX * 8)) - NPC.velocity.X -= 0.04f; + if (NPC.velocity.X < 0f) + NPC.direction = -1; else - NPC.velocity.X += 0.04f; + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + if (NPC.position.X < (Main.maxTilesX * 8)) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X *= 0.98f; + else + NPC.localAI[0] = 1f; + + NPC.velocity.X -= 0.08f; + } + else + { + if (NPC.velocity.X < 0f) + NPC.velocity.X *= 0.98f; + else + NPC.localAI[0] = 1f; + + NPC.velocity.X += 0.08f; + } if (NPC.timeLeft > 10) - { NPC.timeLeft = 10; - return; - } } else if (NPC.ai[0] == -1f) { @@ -135,9 +149,9 @@ namespace CalamityMod.NPCs.PlagueEnemies else if (NPC.ai[0] == 0f) { // Charging distance from player - int chargeDistanceX = (outsideJungle ? 500 : 750) - (CalamityWorld.death ? 100 : CalamityWorld.revenge ? 75 : Main.expertMode ? 50 : 0); + int chargeDistanceX = 750 - (CalamityWorld.death ? 100 : CalamityWorld.revenge ? 75 : Main.expertMode ? 50 : 0); - int chargeDelay = outsideJungle ? 4 : 2; + int chargeDelay = 2; if (NPC.ai[1] > (float)(2 * chargeDelay) && NPC.ai[1] % 2f == 0f) { NPC.ai[0] = -1f; @@ -152,7 +166,7 @@ namespace CalamityMod.NPCs.PlagueEnemies // Avoid cheap bullshit NPC.damage = 0; - NPC.TargetClosest(true); + NPC.TargetClosest(); float chargeDistanceY = 20f; float distanceFromTargetX = Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X); @@ -165,7 +179,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.localAI[0] = 1f; NPC.ai[1] += 1f; NPC.ai[2] = 0f; - float chargeSpeed = outsideJungle ? 36f : 24f; + float chargeSpeed = 16f; Vector2 chargeBeePos = NPC.Center; float chargeTargetX = Main.player[NPC.target].Center.X - chargeBeePos.X; float chargeTargetY = Main.player[NPC.target].Center.Y - chargeBeePos.Y; @@ -173,46 +187,53 @@ namespace CalamityMod.NPCs.PlagueEnemies chargeTargetDist = chargeSpeed / chargeTargetDist; NPC.velocity.X = chargeTargetX * chargeTargetDist; NPC.velocity.Y = chargeTargetY * chargeTargetDist; + + // Direction + float playerLocation = NPC.Center.X - Main.player[NPC.target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + return; } // Velocity variables NPC.localAI[0] = 0f; - float chargeVelocityX = 16f; - float chargeVelocityY = outsideJungle ? 16f : 12f; - float chargeAccelerationX = 0.15f; - float chargeAccelerationY = outsideJungle ? 0.24f : 0.16f; + float chargeVelocity = 12f; + float chargeAcceleration = 0.15f; // Velocity calculations if (NPC.Center.Y < Main.player[NPC.target].Center.Y - chargeDistanceY) - NPC.velocity.Y += chargeAccelerationY; + NPC.velocity.Y += chargeAcceleration; else if (NPC.Center.Y > Main.player[NPC.target].Center.Y + chargeDistanceY) - NPC.velocity.Y -= chargeAccelerationY; + NPC.velocity.Y -= chargeAcceleration; else NPC.velocity.Y *= 0.7f; - if (NPC.velocity.Y < -chargeVelocityY) - NPC.velocity.Y = -chargeVelocityY; - if (NPC.velocity.Y > chargeVelocityY) - NPC.velocity.Y = chargeVelocityY; + if (NPC.velocity.Y < -chargeVelocity) + NPC.velocity.Y = -chargeVelocity; + if (NPC.velocity.Y > chargeVelocity) + NPC.velocity.Y = chargeVelocity; float distanceXMax = 100f; float distanceXMin = 20f; if (distanceFromTargetX > chargeDistanceX + distanceXMax) - NPC.velocity.X += chargeAccelerationX * NPC.direction; + NPC.velocity.X += chargeAcceleration * NPC.direction; else if (distanceFromTargetX < chargeDistanceX + distanceXMin) - NPC.velocity.X -= chargeAccelerationX * NPC.direction; + NPC.velocity.X -= chargeAcceleration * NPC.direction; else - NPC.velocity.X *= 0.8f; + NPC.velocity.X *= 0.7f; // Limit velocity - if (NPC.velocity.X < -chargeVelocityX) - NPC.velocity.X = -chargeVelocityX; - if (NPC.velocity.X > chargeVelocityX) - NPC.velocity.X = chargeVelocityX; + if (NPC.velocity.X < -chargeVelocity) + NPC.velocity.X = -chargeVelocity; + if (NPC.velocity.X > chargeVelocity) + NPC.velocity.X = chargeVelocity; + // Direction + float playerLocation2 = NPC.Center.X - Main.player[NPC.target].Center.X; + NPC.direction = playerLocation2 < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; } else @@ -245,19 +266,17 @@ namespace CalamityMod.NPCs.PlagueEnemies // Avoid cheap bullshit NPC.damage = 0; - NPC.TargetClosest(true); + // Direction + float playerLocation = NPC.Center.X - Main.player[NPC.target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; + NPC.TargetClosest(); + NPC.localAI[0] = 0f; - NPC.velocity *= 0.9f; - float chargeDeceleration = 0.12f; - if (outsideJungle) - { - NPC.velocity *= 0.9f; - chargeDeceleration += 0.08f; - } - + NPC.velocity *= 0.92f; + float chargeDeceleration = 0.08f; if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < chargeDeceleration) { NPC.ai[2] = 0f; @@ -270,9 +289,14 @@ namespace CalamityMod.NPCs.PlagueEnemies // Avoid cheap bullshit NPC.damage = 0; - float stingerAttackSpeed = outsideJungle ? 24f : 16f; - float stingerAttackAccel = outsideJungle ? 0.4f : 0.3f; - Vector2 stingerSpawnPos = new Vector2(NPC.Center.X + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); + // Direction + float playerLocation = NPC.Center.X - Main.player[NPC.target].Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.spriteDirection = NPC.direction; + + float stingerAttackSpeed = 12f; + float stingerAttackAccel = 0.12f; + Vector2 stingerSpawnPos = new Vector2(NPC.Center.X + (float)(40 * NPC.direction), NPC.Bottom.Y + 30f); Vector2 stingerAttackPos = NPC.Center; float stingerAttackTargetX = Main.player[NPC.target].Center.X - stingerAttackPos.X; float stingerAttackTargetY = Main.player[NPC.target].Center.Y - 300f - stingerAttackPos.Y; @@ -293,7 +317,7 @@ namespace CalamityMod.NPCs.PlagueEnemies SoundEngine.PlaySound(SoundID.Item42, stingerSpawnPos); if (Main.netMode != NetmodeID.MultiplayerClient) { - float stingerSpeed = outsideJungle ? 8f : 6f; + float stingerSpeed = 6f; float stingerTargetX = Main.player[NPC.target].Center.X - stingerSpawnPos.X; float stingerTargetY = Main.player[NPC.target].Center.Y - stingerSpawnPos.Y; float stingerTargetDist = (float)Math.Sqrt((double)(stingerTargetX * stingerTargetX + stingerTargetY * stingerTargetY)); @@ -320,6 +344,31 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.netUpdate = true; } } + else if (NPC.ai[0] == 4f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.localAI[0] = 1f; + float despawnVelMult = 14f; + + Vector2 despawnTargetDist = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY); + despawnTargetDist *= 14f; + + NPC.velocity = (NPC.velocity * despawnVelMult + despawnTargetDist) / (despawnVelMult + 1f); + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + if (distanceFromTarget < 2000f) + { + NPC.ai[0] = -1f; + NPC.localAI[0] = 0f; + } + } if (Main.netMode == NetmodeID.Server) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); @@ -333,22 +382,23 @@ namespace CalamityMod.NPCs.PlagueEnemies Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - int afterimageAmt = 7; - if (NPC.ai[0] != 0f) - afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { - for (int i = 1; i < afterimageAmt; i += 2) + if (NPC.ai[0] == 0f && NPC.localAI[0] == 1f) { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (float)(afterimageAmt - i) / 15f; - Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + int chargeAfterimageAmount = 6; + for (int i = 1; i < chargeAfterimageAmount; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(chargeAfterimageAmount - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } } } diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 122ac2e63b..077d41c411 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 46; NPC.height = 32; NPC.defense = 32; - NPC.lifeMax = 800; + NPC.lifeMax = 1000; NPC.knockBackResist = 0.2f; AnimationType = NPCID.GiantTortoise; NPC.value = Item.buyPrice(0, 0, 20, 0); diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index 47819df894..2047db9df4 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 58; NPC.height = 44; NPC.defense = 18; - NPC.lifeMax = 400; + NPC.lifeMax = 500; NPC.knockBackResist = 0.3f; NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.HitSound = SoundID.NPCHit22; diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 4fd355c97a..a229e8f164 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -164,11 +164,19 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + Vector2 drawLocation = NPC.Center - screenPos; + Color backAfterimageColor = PlaguebringerGoliath.BackglowColor * NPC.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4f; + spriteBatch.Draw(texture, drawLocation + drawOffset, NPC.frame, backAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -177,21 +185,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath afterimageColor = NPC.GetAlpha(afterimageColor); afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - texture2D15 = GlowTexture.Value; + texture = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -199,13 +206,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath secondAfterimageColor = Color.Lerp(secondAfterimageColor, Color.White, 0.5f); secondAfterimageColor *= (float)(afterimageAmt - j) / 15f; Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - secondAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + secondAfterimagePos -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 79ab47cdae..6d3571c909 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -58,6 +58,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Lighting.AddLight(NPC.Center, 0.03f, 0.2f, 0f); + NPC.rotation = NPC.velocity.X * 0.04f; + Player player = Main.player[NPC.target]; if (!player.active || player.dead) { @@ -121,18 +123,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; + Texture2D texture = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + Color backAfterimageColor = PlaguebringerGoliath.BackglowColor * NPC.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 4f; + spriteBatch.Draw(texture, drawLocation + drawOffset, NPC.frame, backAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } - texture2D15 = GlowTexture.Value; + spriteBatch.Draw(texture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + texture = GlowTexture.Value; Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index cd088e7c7c..22d6fefa56 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -36,6 +36,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath [AutoloadBossHead] public class PlaguebringerGoliath : ModNPC { + // Use for all projectiles and spawned enemies. + public static Color BackglowColor => new Color(255, 100, 24, 80); + private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private const float MissileAngleSpread = 60; private const int MissileProjectiles = 8; @@ -464,8 +467,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeed = revenge ? 25f : 20f; - float lineUpAccel = revenge ? 0.75f : 0.6f; + float maxLineUpSpeed = revenge ? 20f : 16f; + float lineUpAccel = revenge ? 0.4f : 0.3f; if (phase2) { maxLineUpSpeed += 3f; @@ -628,9 +631,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer bool canHitTarget = Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height); float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -711,9 +714,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -800,9 +803,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -892,9 +895,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Move closer float distanceAboveTarget = !canHitTarget ? 0f : 400f; - float distanceAwayFromTargetX = !canHitTarget ? 36f : 144f; + float distanceAwayFromTargetX = !canHitTarget ? 80f : 240f; float distanceAwayFromTargetY = player.Center.Y - NPC.Center.Y; - float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 48f; + float distanceAwayFromTargetYLeeway = !canHitTarget ? 16f : 80f; bool tooFarX = Math.Abs(player.Center.X - NPC.Center.X) > distanceAwayFromTargetX; bool tooFarY = distanceAwayFromTargetY > distanceAboveTarget + distanceAwayFromTargetYLeeway || distanceAwayFromTargetY < distanceAboveTarget - distanceAwayFromTargetYLeeway; bool tooFar = tooFarX || tooFarY; @@ -1039,8 +1042,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.rotation = NPC.velocity.X * 0.02f; charging = false; - float maxLineUpSpeed = revenge ? 31f : 26f; - float lineUpAccel = revenge ? 1.05f : 0.9f; + float maxLineUpSpeed = revenge ? 26f : 22f; + float lineUpAccel = revenge ? 0.7f : 0.6f; maxLineUpSpeed += 7f * enrageScale; lineUpAccel += 0.35f * enrageScale; @@ -1164,8 +1167,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath private void Movement(float distanceAboveTarget, Player player, float enrageScale) { - float acceleration = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 0.24f : 0.48f; // Reduce acceleration while spawning minions - float velocity = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 12f : (NPC.ai[0] == 2f ? 18f : 24f); // Reduce velocity while preparing to spawn minions and spawning minions + float acceleration = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 0.12f : (NPC.ai[0] == 2f ? 0.15f : 0.18f); // Reduce acceleration while spawning minions + float velocity = (NPC.ai[0] == 1f || NPC.ai[0] == 5f) ? 12f : (NPC.ai[0] == 2f ? 15f : 18f); // Reduce velocity while preparing to spawn minions and spawning minions acceleration *= 0.5f * enrageScale + 1f; velocity *= 1f + enrageScale * 0.5f; Vector2 hoverDestination = player.Center - Vector2.UnitY * distanceAboveTarget; @@ -1262,22 +1265,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Rectangle rectangle = new Rectangle(NPC.frame.X, NPC.frame.Y, texture.Width / 2, texture.Height / frameCount); Vector2 halfSizeTexture = rectangle.Size() / 2f; Vector2 posOffset = new Vector2(charging ? 175 : 125, 0); - int afterimageAmt = 10; - if (NPC.ai[0] != 0f && NPC.ai[0] != 4f) - afterimageAmt = 7; + int chargeAfterimageAmount = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { - for (int j = 1; j < afterimageAmt; j += 2) + if ((NPC.ai[0] == 0f || NPC.ai[0] == 4f) && charging) { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (afterimageAmt - j) / 15f; - Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; - afterimagePos += halfSizeTexture * NPC.scale + posOffset; - spriteBatch.Draw(texture, afterimagePos, new Rectangle?(rectangle), afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + for (int j = 1; j < chargeAfterimageAmount; j += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (chargeAfterimageAmount - j) / 15f; + Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(texture, afterimagePos, new Rectangle?(rectangle), afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } } } @@ -1288,17 +1292,20 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { - for (int k = 1; k < afterimageAmt; k++) + if ((NPC.ai[0] == 0f || NPC.ai[0] == 4f) && charging) { - Color otherAfterimageColor = redLerpColor; - otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); - otherAfterimageColor *= (afterimageAmt - k) / 15f; - Vector2 otherAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - otherAfterimagePos -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; - otherAfterimagePos += halfSizeTexture * NPC.scale + posOffset; - spriteBatch.Draw(glowTexture, otherAfterimagePos, new Rectangle?(rectangle), otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + for (int k = 1; k < chargeAfterimageAmount; k++) + { + Color otherAfterimageColor = redLerpColor; + otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); + otherAfterimageColor *= (chargeAfterimageAmount - k) / 15f; + Vector2 otherAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + otherAfterimagePos -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; + otherAfterimagePos += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(glowTexture, otherAfterimagePos, new Rectangle?(rectangle), otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } } } @@ -1357,9 +1364,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index f1920158ab..7f7cc5a745 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index e8796595e5..d8246eedc2 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -455,7 +455,7 @@ namespace CalamityMod.NPCs.Polterghast Color lightRed = new Color(255, 100, 100, 255) * NPC.Opacity; int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -490,7 +490,7 @@ namespace CalamityMod.NPCs.Polterghast Color blackWhiteLerp = Color.Lerp(Color.White, c, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 695428ba63..20138b1ba8 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -307,7 +307,7 @@ namespace CalamityMod.NPCs.Polterghast } // Stop rain - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); // Set time left @@ -1169,7 +1169,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 7; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -1213,7 +1213,7 @@ namespace CalamityMod.NPCs.Polterghast Color veinColor = Color.Lerp(Color.White, (NPC.ai[2] >= changeColorGateValue || NPC.Calamity().newAI[0] > changeColorGateValue) ? Color.Red : Color.Black, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index 50c6039a49..be8e568245 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -375,7 +375,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -401,7 +401,7 @@ namespace CalamityMod.NPCs.Polterghast if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue) cyanLerp2 = Color.Lerp(cyanLerp2, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - changeColorGateValue) / timeToReachFullColor, 0f, 1f)); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 9e0f1118b9..a6e87d6042 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; @@ -1016,7 +1017,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] == 2f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -1054,7 +1055,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (colorOverride != null) timeBasedColorLerp = colorOverride.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -1072,7 +1073,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedColorLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png index 2eca7f5a61..ebb165bb65 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png and b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index e3c251eba4..aa680b5966 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -736,7 +737,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] == 2f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -774,7 +775,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (colorOverride != null) timeBasedGlowColor = colorOverride.Value; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -792,7 +793,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedGlowColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; + if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; + + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png index fc376c8f91..7a5a231e59 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png and b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 1a431ca882..2688f01f1c 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; +using CalamityMod.NPCs.Providence; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -441,7 +442,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -483,7 +484,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians overrideColor = colorOverride.Value; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -510,7 +511,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, timeBasedDrawColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; + if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; + + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, overrideColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png index c793ba7e51..9e5f5ea74d 100644 Binary files a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png and b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.png differ diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 424fa991ee..6a8c0f70ef 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -325,8 +325,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); + Color col = Color.Orange; + + if (!Main.dayTime) col = Color.LightBlue; + if (!NPC.dontTakeDamage) - NPC.DrawBackglow(Color.Orange, 4f, SpriteEffects.None, frame, screenPos, texture); + NPC.DrawBackglow(col.MultiplyRGBA(new Color(255, 255, 255, 0)), 4f, SpriteEffects.None, frame, screenPos, texture); spriteBatch.Draw(texture, drawPos, frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, SpriteEffects.None, 0f); diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index fa20dda140..15f6e2eae4 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Providence Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -141,7 +141,7 @@ namespace CalamityMod.NPCs.Providence texture2D15 = ProfanedGuardianDefender.Texture_Glow.Value; Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -156,7 +156,9 @@ namespace CalamityMod.NPCs.Providence } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, yellowLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, vector43, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 7304ea3029..1cc6651765 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Providence Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.Providence Color yellowLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); Color violetLerp = Color.Lerp(Color.White, Color.Violet, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -163,7 +163,9 @@ namespace CalamityMod.NPCs.Providence } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, violetLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 4cf657f7f5..e430b70422 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.ai[0] == 2f) afterimageAmt = 10; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.Providence texture2D15 = ProfanedGuardianCommander.Texture_Glow.Value; Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { @@ -158,7 +158,9 @@ namespace CalamityMod.NPCs.Providence } } - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 66c3a7bb2f..7f44eb2afb 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; @@ -22,6 +24,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -30,6 +33,7 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics.PackedVector; using ReLogic.Content; using ReLogic.Utilities; using Terraria; @@ -38,9 +42,11 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Projectiles.Rogue.FinalDawnFlame; using Filters = Terraria.Graphics.Effects.Filters; namespace CalamityMod.NPCs.Providence @@ -71,14 +77,11 @@ namespace CalamityMod.NPCs.Providence { Night = -1, Day = 0, - Red = 1, - Orange = 2, - Yellow = 3, - Green = 4, - Blue = 5, - Violet = 6 + Rainbow = 1, } - public int colorShiftTimer = -1; + + Color HighFireColor = new Color(255, 191, 73); + Color LowFireColor = new Color(116, 45, 23); private bool text = false; private bool useDefenseFrames = false; @@ -88,25 +91,27 @@ namespace CalamityMod.NPCs.Providence private int phaseChange = 0; private int frameUsed = 0; private int healTimer = 0; - internal bool challenge = Main.expertMode; //Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. + internal bool challenge = Main.expertMode; // Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. internal bool hasTakenDaytimeDamage = false; - public static bool shouldDrawInfernoBorder = true; //This is only here for other mods to disable it if they don't want it drawing. + public static bool shouldDrawInfernoBorder = true; // This is only here for other mods to disable it if they don't want it drawing. public bool Dying = false; public int DeathAnimationTimer; public static float borderRadius = 3000f; - //Sounds + // Sounds public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSpawn") { Volume = 1.2f }; - public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay") { Volume = 1.25f }; //note : Volume gets clamped between 0 and 1. I don't think this does anything, but it was in the original ModSound so im keeping it just in case + public static readonly SoundStyle HolyRaySound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyRay") { Volume = 1.25f }; // NOTE : Volume gets clamped between 0 and 1. I don't think this does anything, but it was in the original ModSound so im keeping it just in case public static readonly SoundStyle HurtSound = new("CalamityMod/Sounds/NPCHit/ProvidenceHurt"); public static readonly SoundStyle DeathAnimationSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceDeathAnimation"); public static readonly SoundStyle NearBurnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSizzle"); public static readonly SoundStyle BurnStartSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceBurn"); public static readonly SoundStyle BurnLoopSound = new SoundStyle("CalamityMod/Sounds/Custom/Providence/ProvidenceBurnLoop") with { IsLooped = true }; - //Sound slot for the burning damage over time effect + + // Sound slot for the burning damage over time effect public SlotId BurningSoundSlot; - //Level of sound playing + + // Level of sound playing public float SoundWarningLevel = -1f; public static float normalDR = 0.3f; @@ -155,6 +160,11 @@ namespace CalamityMod.NPCs.Providence public static Asset TextureNight_Glow_2; #endregion + public override void OnSpawn(IEntitySource source) + { + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, -1); + } + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 3; @@ -220,6 +230,20 @@ namespace CalamityMod.NPCs.Providence #endregion } + public override void ModifyHoverBoundingBox(ref Rectangle boundingBox) + { + // Is in spawning animation + float spawnAnimationTime = 180f; + bool spawnAnimation = NPC.Calamity().newAI[3] < spawnAnimationTime; + + if (spawnAnimation) + { + boundingBox = new Rectangle(0, 0, 0, 0); + } + + base.ModifyHoverBoundingBox(ref boundingBox); + } + public override void SetDefaults() { NPC.npcSlots = 36f; @@ -266,7 +290,6 @@ namespace CalamityMod.NPCs.Providence writer.Write(text); writer.Write(useDefenseFrames); writer.Write(biomeType); - writer.Write(colorShiftTimer); writer.Write(phaseChange); writer.Write(frameUsed); writer.Write(healTimer); @@ -292,7 +315,6 @@ namespace CalamityMod.NPCs.Providence text = reader.ReadBoolean(); useDefenseFrames = reader.ReadBoolean(); biomeType = reader.ReadInt32(); - colorShiftTimer = reader.ReadInt32(); phaseChange = reader.ReadInt32(); frameUsed = reader.ReadInt32(); healTimer = reader.ReadInt32(); @@ -332,7 +354,7 @@ namespace CalamityMod.NPCs.Providence CalamityGlobalNPC.holyBoss = NPC.whoAmI; // Rotation - NPC.rotation = NPC.velocity.X * 0.004f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.X * 0.006f, 0.1f); // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -349,30 +371,14 @@ namespace CalamityMod.NPCs.Providence bool bossRush = BossRushEvent.BossRushActive; bool getFuckedAI = Main.zenithWorld; - int timeToShift = 30; //Switches color every half-second if (getFuckedAI) - { - colorShiftTimer++; - - if (colorShiftTimer == -1) //Initiate - { - NPC.localAI[1] = (float)BossMode.Red; - colorShiftTimer = 0; - } - else if (colorShiftTimer >= timeToShift) - { - NPC.localAI[1]++; - if (NPC.localAI[1] > (float)BossMode.Violet) - NPC.localAI[1] = (float)BossMode.Red; - colorShiftTimer = 0; - } - } - else if ((!Main.dayTime && !Main.remixWorld) || bossRush) //Normal Night time activity + NPC.localAI[1] = (float)BossMode.Rainbow; + else if (!ProvUtils.DayAI()) // Normal Night time activity NPC.localAI[1] = (float)BossMode.Night; else NPC.localAI[1] = (float)BossMode.Day; - //Has Night AI if it's any color except day + // Has Night AI if it's any color except day bool nightAI = NPC.localAI[1] != (float)BossMode.Day; // Difficulty bools @@ -391,6 +397,11 @@ namespace CalamityMod.NPCs.Providence float spawnAnimationTime = 180f; bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime; + if (!spawnAnimation) + { + NPC.Opacity = 1f; + } + // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -413,7 +424,9 @@ namespace CalamityMod.NPCs.Providence // Increase all projectile damage at night, but reduce to 0 for Zenith int projectileDamageMult = 1; - if (nightAI) + if (getFuckedAI) + projectileDamageMult = 0; + else if (nightAI) projectileDamageMult = 2; NPC.Calamity().CurrentlyEnraged = !bossRush && nightAI; @@ -429,7 +442,7 @@ namespace CalamityMod.NPCs.Providence int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; // Change dust type at night - int dustType = ProvUtils.GetDustID(NPC.localAI[1]); + int dustType = ProvUtils.GetDustID(); // Phase times float phaseTime = nightAI ? (240f - 60f * (1f - lifeRatio)) : 300f; @@ -470,40 +483,45 @@ namespace CalamityMod.NPCs.Providence // Inflict Holy Inferno if target is too far away float burnIntensity = CalculateBurnIntensity(attackDelayAfterCocoon); + // Color determination + Color hiColor = ProvUtils.GetProjectileColor(0); + Color medColor = ProvUtils.GetProjectileColor(255); + Color loColor = ProvUtils.GetProjectileColor(255, true); + if (!player.dead && player.active && !player.creativeGodMode && !Dying) { - //The debuff applies + // The debuff applies if (burnIntensity >= 1f) { if (SoundWarningLevel < 2f) { - //Initialize sound + // Initialize sound SoundEngine.PlaySound(BurnStartSound, player.Center); BurningSoundSlot = SoundEngine.PlaySound(BurnLoopSound, player.Center); SoundWarningLevel = 2f; } player.AddBuff(ModContent.BuffType(), 2); } - //If the sound is still playing, make it go slowly kinda + // If the sound is still playing, make it go slowly kinda else if (SoundWarningLevel > 1f) { SoundWarningLevel -= 1 / 100f; if (SoundWarningLevel < 1f) SoundWarningLevel = 1f; } - //The player starts to get fire particles + // The player starts to get fire particles else if (burnIntensity > 0.45f) { - //If the player goes from 0 to 1, then play the sound. Doesn't play when descending. + // If the player goes from 0 to 1, then play the sound. Doesn't play when descending. if (SoundWarningLevel < 1f) SoundEngine.PlaySound(NearBurnSound, player.Center); SoundWarningLevel = 1f; } - //The player has sparks if intensity is above 0, otherwise nothing happens + // The player has sparks if intensity is above 0, otherwise nothing happens else if (burnIntensity <= 0f) { - //Reset the sound + // Reset the sound SoundWarningLevel = 0f; } } @@ -614,7 +632,7 @@ namespace CalamityMod.NPCs.Providence NPC.chaseable = normalAttackRate; // Prevent lag by stopping rain - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); // Set target biome type @@ -804,17 +822,16 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon || AIState == (int)Phase.Laser || spawnAnimation; + // Providence fires predictive holy/molten blasts if she is ahead of her target's movement + bool predictiveShots = false; + // Movement if (getFuckedAI || (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon)) { // Slowly drift down when spawning if (spawnAnimation) { - colorShiftTimer++; // Also double the shift speed in the mean time :) - float minSpawnVelocity = 0.4f; - float maxSpawnVelocity = 4f; - float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime); - NPC.velocity = new Vector2(0f, velocityY); + NPC.velocity = Vector2.Zero; } else { @@ -854,6 +871,10 @@ namespace CalamityMod.NPCs.Providence if (NPC.Center.X > player.Center.X && flightPath > 0 && distanceX > changeDirectionThreshold) flightPath = 0; + // Predictive shot checks + if ((NPC.velocity.X > 0f && (NPC.Center.X - player.Center.X) > 0f && player.velocity.X > 0f) || (NPC.velocity.X < 0f && (NPC.Center.X - player.Center.X) < 0f && player.velocity.X < 0f)) + predictiveShots = true; + // Velocity and acceleration float speedIncreaseTimer = nightAI ? 75f : death ? 120f : 150f; bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || bossRush; @@ -1063,54 +1084,66 @@ namespace CalamityMod.NPCs.Providence if (spawnAnimation) { - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[3] == 0f) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + new Vector2(0f, -80f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, biomeType, 0f); + CalamityUtils.AddScreenshakeAt(NPC.Center, MathHelper.Lerp(0f, 0.25f, calamityGlobalNPC.newAI[3] / spawnAnimationTime), 2000); + + NPC.dontTakeDamage = true; + + if (calamityGlobalNPC.newAI[3] == spawnAnimationTime - 1) + { + NPC.dontTakeDamage = false; + + CalamityUtils.AddScreenshakeAt(NPC.Center, 8, 2000); - if (calamityGlobalNPC.newAI[3] == 10f) SoundEngine.PlaySound(HolyRaySound, NPC.Center); - if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < 150f) - { - int dustAmt = (int)MathHelper.Lerp(4f, 8f, calamityGlobalNPC.newAI[3] / spawnAnimationTime); - for (int m = 0; m < dustAmt; m++) + for (int i = 0; i < 30; i++) { - float fade = MathHelper.Lerp(1.3f, 0.7f, NPC.Opacity) * Utils.GetLerpValue(0f, 120f, calamityGlobalNPC.newAI[3], clamped: true); - Color newColor = Main.hslToRgb(calamityGlobalNPC.newAI[3] / 180f, 1f, 0.5f); + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(1f, 1.6f), Main.rand.NextFloat(2f, 5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(2.5f, 5.5f), 2f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + CalamityUtils.AddScreenshakeAt(NPC.Center, 10, 2000); - if (!nightAI) - { - newColor.R = 255; - if (biomeType == 2) - newColor.B = 0; - } - else - { - newColor.B = 255; - if (biomeType == 2) - newColor.G = 0; - else - newColor.R = 0; - } + Color hColor = ProvUtils.GetProjectileColor(255, false); + Color lColor = ProvUtils.GetProjectileColor(0, true); - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.RainbowMk2, 0f, 0f, 0, newColor); - Main.dust[dust].position = NPC.Center + Main.rand.NextVector2Circular(NPC.width * 2f, NPC.height * 2f) + new Vector2(0f, -150f); - Main.dust[dust].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 0.6f + Main.rand.NextFloat() * 0.7f * fade; - Main.dust[dust].velocity += Vector2.UnitY * 3f; - Main.dust[dust].scale = 1.2f; + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hColor, lColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } - if (dust != 6000) - { - Dust dust2 = Dust.CloneDust(dust); - dust2.scale /= 2f; - dust2.fadeIn *= 0.85f; - dust2.color = new Color(255, 255, 0, 255); - } + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + for (float i = 0; i < 3; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.35f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.475f, 25)); } } - NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); + float sc = calamityGlobalNPC.newAI[3] / spawnAnimationTime; + + if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < spawnAnimationTime) + { + if (calamityGlobalNPC.newAI[3] % 10f == 0) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, Color.Lerp(new Color(25, 25, 25, 0), medColor, sc), "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1.5f, 1f), Main.rand.NextBool(2) ? 0f : MathHelper.Pi, sc * 0.5f, sc * 0.1f, 20)); + + SoundStyle SpawnFlareSound = SoundID.Item74; + + SpawnFlareSound.MaxInstances = 10; + + SoundEngine.PlaySound(SpawnFlareSound.WithVolumeScale(calamityGlobalNPC.newAI[3] / spawnAnimationTime).WithPitchOffset(-1 + (calamityGlobalNPC.newAI[3] / spawnAnimationTime)), NPC.Center); + } + + Vector2 startPos = NPC.Center + (new Vector2(Main.rand.NextFloat(80, 300) * (sc * 1.6f), 0).RotatedByRandom(Main.rand.NextFloat(MathHelper.TwoPi)) * new Vector2(1.5f, 1f)); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(startPos, startPos.DirectionTo(NPC.Center) * (startPos.Distance(NPC.Center) / 10), false, 10, Main.rand.NextFloat(0.2f, 0.5f) * (sc * 2), medColor)); + } calamityGlobalNPC.newAI[3] += 1f; @@ -1141,23 +1174,13 @@ namespace CalamityMod.NPCs.Providence if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 npcCenter = NPC.Center; - npcCenter.X += NPC.velocity.X * 7f; - float playerXDist = player.position.X + player.width * 0.5f - npcCenter.X; - float playerYDist = player.Center.Y - npcCenter.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - + Vector2 projectileFirePosition = new Vector2(NPC.Center.X + NPC.velocity.SafeNormalize(Vector2.UnitX).X * 120f, NPC.Center.Y); float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); - float projSpeed = (expertMode ? 10.25f : 9f) + velocityBoost; - - if (revenge) - projSpeed *= 1.15f; - - playerDistance = projSpeed / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, playerXDist, playerYDist, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + float projSpeed = (revenge ? 12f : expertMode ? 10.5f : 9f) + velocityBoost; + Vector2 predictionAmount = player.velocity * 100f; + Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; + Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); } } else if (NPC.ai[3] < 0f) @@ -1222,6 +1245,7 @@ namespace CalamityMod.NPCs.Providence case (int)Phase.FlameCocoon: + Vector2 fireSparklesFrom = fireFrom + new Vector2(0, -30); if (!targetDead && !getFuckedAI) { if (NPC.velocity.Length() <= 2f) @@ -1263,29 +1287,10 @@ namespace CalamityMod.NPCs.Providence projectileType = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); - - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); - dustColor.A = 255; - int maxDust = 3; - for (int j = 0; j < maxDust; j++) - { - int dust = Dust.NewDust(fireFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); - Main.dust[dust].position = fireFrom; - Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1f + j; - Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); - Dust dust3 = dust2; - dust3.scale /= 2f; - dust3 = dust2; - dust3.fadeIn /= 2f; - dust2.color = new Color(255, 255, 255, 255); - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } // Radial offset @@ -1323,29 +1328,10 @@ namespace CalamityMod.NPCs.Providence projectileType = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); - - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : (projectileType == ModContent.ProjectileType() ? Color.Orange : Color.Green)).X, 1f, 0.5f); - dustColor.A = 255; - int maxDust = 3; - for (int j = 0; j < maxDust; j++) - { - int dust = Dust.NewDust(fireFrom, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); - Main.dust[dust].position = fireFrom; - Main.dust[dust].velocity = vector2 * cocoonProjVelocity * (j * 0.5f + 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1f + j; - Main.dust[dust].fadeIn = Main.rand.NextFloat() * 2f; - Dust dust2 = Dust.CloneDust(dust); - Dust dust3 = dust2; - dust3.scale /= 2f; - dust3 = dust2; - dust3.fadeIn /= 2f; - dust2.color = new Color(255, 255, 255, 255); - } + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); } } } @@ -1364,10 +1350,10 @@ namespace CalamityMod.NPCs.Providence } foreach (int t in targets) { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireSparklesFrom) * cocoonProjVelocity * 1.5f; int type = ModContent.ProjectileType(); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); dustColor.A = 255; @@ -1477,25 +1463,13 @@ namespace CalamityMod.NPCs.Providence if (NPC.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 npcCenter = NPC.Center; - npcCenter.X += NPC.velocity.X * 7f; - float playerXDist = player.position.X + player.width * 0.5f - npcCenter.X; - float playerYDist = player.Center.Y - npcCenter.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - float shootBoost2 = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); - float projSpeed = (expertMode ? 10.25f : 9f) + shootBoost2; - if (bossRush) - projSpeed = 12.75f; - - if (revenge) - projSpeed *= 1.15f; - - playerDistance = projSpeed / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcCenter.X, npcCenter.Y, playerXDist * 0.1f, playerYDist, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Vector2 projectileFirePosition = new Vector2(NPC.Center.X + NPC.velocity.SafeNormalize(Vector2.UnitX).X * 120f, NPC.Center.Y); + float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); + float projSpeed = (revenge ? 12f : expertMode ? 10.5f : 9f) + velocityBoost; + Vector2 predictionAmount = player.velocity * 100f; + Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; + Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); } } else if (NPC.ai[3] < 0f) @@ -1735,7 +1709,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustPosOffset = new Vector2(27f, 59f); - float rotation = (nightAI ? 435f : 450f) + (guardianAmt * 5); + float rotation = (nightAI ? 445f : 460f) + (guardianAmt * 5); NPC.ai[2] += 1f; if (NPC.ai[2] < 120f) @@ -1780,20 +1754,20 @@ namespace CalamityMod.NPCs.Providence // 60 degrees offset velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); // -60 degrees offset if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); if (nightAI && lifeRatio < 0.5f) { rotation *= 0.33f; velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); } NPC.netUpdate = true; @@ -1852,9 +1826,28 @@ namespace CalamityMod.NPCs.Providence // above defeat scene sound. if (DeathAnimationTimer == 92f) { + CalamityUtils.AddScreenshakeAt(NPC.Center, 5, 2000); + + Color hiColor = ProvUtils.GetProjectileColor( 255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + for (float i = 0; i < 3; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.25f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.175f, 25)); + } + SoundEngine.PlaySound(HolyBlast.ImpactSound, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); } // Explode as an enormous holy star before dying and dropping loot. @@ -1865,17 +1858,22 @@ namespace CalamityMod.NPCs.Providence Vector2 sparkleVelocity = Main.rand.NextVector2Circular(23f, 23f); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, sparkleVelocity, ModContent.ProjectileType(), 0, 0f); } - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, 255); } // Idly release harmless cindiers. - int shootRate = (int)MathHelper.Lerp(12f, 5f, Utils.GetLerpValue(0f, 250f, DeathAnimationTimer, true)); - if (DeathAnimationTimer % shootRate == shootRate - 1f) + if (DeathAnimationTimer >= 92f) { - for (int i = 0; i < 3; i++) + CalamityUtils.AddScreenshakeAt(NPC.Center, MathHelper.Lerp(0, 0.6f, ((float)DeathAnimationTimer - 92f) / 300f), 1000); + + int shootRate = (int)MathHelper.Lerp(12f, 5f, Utils.GetLerpValue(0f, 250f, DeathAnimationTimer, true)); + if (DeathAnimationTimer % shootRate == shootRate - 1f) { - Vector2 shootVelocity = Main.rand.NextVector2CircularEdge(13f, 13f) * Main.rand.NextFloat(0.7f, 1.3f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, 255); + for (int i = 0; i < 3; i++) + { + Vector2 shootVelocity = Main.rand.NextVector2CircularEdge(13f, 13f) * Main.rand.NextFloat(1.4f, 2.3f); + Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), NPC.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, 255, ai1: (int)NPC.localAI[1]); + proj.ai[2] = MathHelper.Lerp(0.5f, 2.5f, (float)DeathAnimationTimer / 300f); + } } } @@ -1935,8 +1933,8 @@ namespace CalamityMod.NPCs.Providence // This shave-off does not happen when guardians are present. float shorterDistanceFade = Utils.GetLerpValue(0f, 120f, aiTimer, true); - //Distance does not get shorter if in GFB / Guardians are alive - if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Red) + // Distance does not get shorter if in GFB / Guardians are alive + if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Rainbow) { maxDistance = baseDistance; if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) @@ -1948,6 +1946,7 @@ namespace CalamityMod.NPCs.Providence float drawFireDistanceStart = maxDistance - 800f; float previousBorderEnd = borderRadius; float clampedDistance = MathHelper.Clamp(maxDistance, previousBorderEnd - 10, previousBorderEnd + 10); + // Only set the border distance if it's not called from playermisceffects, that way it has mod compatability borderRadius = clampedDistance; return Utils.GetLerpValue(drawFireDistanceStart, clampedDistance, distanceToTarget, true); @@ -2000,15 +1999,33 @@ namespace CalamityMod.NPCs.Providence public override void OnKill() { + CalamityUtils.AddScreenshakeAt(NPC.Center, 10, 2000); + + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(NPC.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + for (float i = 0; i < 3; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.35f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.275f, 25)); + } + // Don't bother running any of this in Boss Rush. if (BossRushEvent.BossRushActive) return; CalamityGlobalNPC.SetNewBossJustDowned(NPC); - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.Top.Y >= (Main.maxTilesY - 240f) * 16f) - SpawnLootBox(); - // If Providence has not been killed, notify players of Uelibloom Ore if (!DownedBossSystem.downedProvidence) { @@ -2043,26 +2060,22 @@ namespace CalamityMod.NPCs.Providence // Drops Mark of Providence on first kill npcLoot.AddIf(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); - npcLoot.AddConditionalPerPlayer(info => - { - Providence prov = info.npc.ModNPC(); - return prov.biomeType != 2 || !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), desc: DropHelper.ProvidenceHallowText); - npcLoot.AddConditionalPerPlayer(info => - { - Providence prov = info.npc.ModNPC(); - return prov.biomeType == 2 || !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), desc: DropHelper.ProvidenceUnderworldText); + // Elysian Wings and Elysian Aegis drop outside of the Treasure Bag, for all players + npcLoot.Add(DropHelper.PerPlayer(ModContent.ItemType())); + npcLoot.Add(DropHelper.PerPlayer(ModContent.ItemType())); + npcLoot.DefineConditionalDropSet(DropHelper.If((info) => { Providence prov = info.npc.ModNPC(); return prov.challenge; }, () => Main.expertMode, DropHelper.ProvidenceChallengeText)).Add(ModContent.ItemType()); + npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); return !prov.hasTakenDaytimeDamage; }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceNightText); + npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); @@ -2107,39 +2120,13 @@ namespace CalamityMod.NPCs.Providence var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); { GFBOnly.Add(ModContent.ItemType(), 1, 1, 99, true); - GFBOnly.Add(ModContent.ItemType(), 1, 1117, 2201, true); // reference to the versions the guards were added and got their latest resprites + GFBOnly.Add(ModContent.ItemType(), 1, 1117, 2201, true); // Reference to the versions the guards were added and got their latest resprites } // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); } - private void SpawnLootBox() - { - int tileCenterX = (int)NPC.Center.X / 16; - int tileCenterY = (int)NPC.Center.Y / 16; - int halfBox = 5; - for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) - { - for (int y = tileCenterY - halfBox; y <= tileCenterY + halfBox; y++) - { - if ((x == tileCenterX - halfBox || x == tileCenterX + halfBox || y == tileCenterY - halfBox || y == tileCenterY + halfBox) - && !Main.tile[x, y].HasTile) - { - Main.tile[x, y].TileType = (ushort)ModContent.TileType(); - Main.tile[x, y].Get().HasTile = true; - } - Main.tile[x, y].Get().LiquidType = LiquidID.Water; - Main.tile[x, y].LiquidAmount = 0; - - if (Main.netMode == NetmodeID.Server) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - else - WorldGen.SquareTileFrame(x, y, true); - } - } - } - public override void BossLoot(ref string name, ref int potionType) { potionType = ModContent.ItemType(); @@ -2147,163 +2134,205 @@ namespace CalamityMod.NPCs.Providence public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + bool offColor = NPC.localAI[1] != (float)BossMode.Day; + + Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; + Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; + Texture2D textureGlow2 = offColor ? TextureNight_Glow_2.Value : Texture_Glow_2.Value; + void drawProvidenceInstance(Vector2 drawOffset, Color? colorOverride) { // This night bool is used for any off-color activity - bool offColor = NPC.localAI[1] != (float)BossMode.Day; string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; - Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; - Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; - Texture2D textureGlow2 = offColor ? TextureNight_Glow_2.Value : Texture_Glow_2.Value; - if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) + float spawnAnimationTime = 180f; + bool spawnAnimation = NPC.Calamity().newAI[3] < spawnAnimationTime; + + if (spawnAnimation) { - if (!useDefenseFrames) + Asset orbTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + Asset flareTex = ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlast"); + + float sc = CalamityUtils.CircInEasing((float)NPC.Calamity().newAI[3] / (float)spawnAnimationTime, 1); + + for (int i = 0; i < 3; i++) { - texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; - textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; - textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; + int frameY = (int)(NPC.Calamity().newAI[3] / 4) % 4; + float sc1 = MathHelper.Lerp(1, 0, sc); + Main.EntitySpriteDraw(orbTex.Value, NPC.Center - Main.screenPosition + new Vector2(Main.rand.NextFloat(MathHelper.Lerp(0f, 10f, sc)), 0).RotatedByRandom(MathHelper.TwoPi), orbTex.Frame(), ProvUtils.GetProjectileColor(0, false).MultiplyRGBA(new Color(sc * 45f, sc * 11f, sc * 22f, 0f)), 0f, orbTex.Frame().Center(), (sc * 4.4f) + (float)(Math.Cos((float)NPC.Calamity().newAI[3] / 10) * sc), SpriteEffects.None); + } + } + + { + if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) + { + if (!useDefenseFrames) + { + texture = offColor ? TextureDefenseNight.Value : TextureDefense.Value; + textureGlow = offColor ? TextureDefenseNight_Glow.Value : TextureDefense_Glow.Value; + textureGlow2 = offColor ? TextureDefenseNight_Glow_2.Value : TextureDefense_Glow_2.Value; + } + else + { + texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; + textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; + textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; + } } else { - texture = offColor ? TextureDefenseAltNight.Value : TextureDefenseAlt.Value; - textureGlow = offColor ? TextureDefenseAltNight_Glow.Value : TextureDefenseAlt_Glow.Value; - textureGlow2 = offColor ? TextureDefenseAltNight_Glow_2.Value : TextureDefenseAlt_Glow_2.Value; + switch (frameUsed) + { + case 1: + texture = offColor ? TextureAltNight.Value : TextureAlt.Value; + textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; + textureGlow2 = offColor ? TextureAltNight_Glow_2.Value : TextureAlt_Glow_2.Value; + break; + + case 2: + texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; + textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; + textureGlow2 = offColor ? TextureAttackNight_Glow_2.Value : TextureAttack_Glow_2.Value; + break; + + case 3: + texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; + textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; + textureGlow2 = offColor ? TextureAttackAltNight_Glow_2.Value : TextureAttackAlt_Glow_2.Value; + break; + + default: + break; + } } - } - else - { - switch (frameUsed) + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + // Draw the main boss texture + its afterimages + Vector2 RotationCenter = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color BaseColor = Color.White; + float Brightness = 0.5f; // Ranges from 0 (full vibrance) to 1 (pure white) + int maxAfterimages = 5; + + if (CalamityClientConfig.Instance.Afterimages) { - case 1: - texture = offColor ? TextureAltNight.Value : TextureAlt.Value; - textureGlow = offColor ? TextureAltNight_Glow.Value : TextureAlt_Glow.Value; - textureGlow2 = offColor ? TextureAltNight_Glow_2.Value : TextureAlt_Glow_2.Value; - break; + for (int i = 1; i < maxAfterimages; i += 2) + { + Color AfterimageColor = drawColor; + AfterimageColor = Color.Lerp(AfterimageColor, BaseColor, Brightness); + AfterimageColor = NPC.GetAlpha(AfterimageColor); + AfterimageColor *= (maxAfterimages - i) / 15f; + if (colorOverride != null) + AfterimageColor = colorOverride.Value; - case 2: - texture = offColor ? TextureAttackNight.Value : TextureAttack.Value; - textureGlow = offColor ? TextureAttackNight_Glow.Value : TextureAttack_Glow.Value; - textureGlow2 = offColor ? TextureAttackNight_Glow_2.Value : TextureAttack_Glow_2.Value; - break; - - case 3: - texture = offColor ? TextureAttackAltNight.Value : TextureAttackAlt.Value; - textureGlow = offColor ? TextureAttackAltNight_Glow.Value : TextureAttackAlt_Glow.Value; - textureGlow2 = offColor ? TextureAttackAltNight_Glow_2.Value : TextureAttackAlt_Glow_2.Value; - break; - - default: - break; + Vector2 AfterimageBodyPosition = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + AfterimageBodyPosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + AfterimageBodyPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(texture, AfterimageBodyPosition, NPC.frame, AfterimageColor.MultiplyRGBA(Lighting.GetColor((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16)), NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + } } - } - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; + Vector2 BasePosition = NPC.Center - screenPos; + BasePosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + BasePosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + Color finalDrawColor = NPC.IsABestiaryIconDummy ? Color.White : (colorOverride ?? Lighting.GetColor((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16)) * NPC.Opacity; + spriteBatch.Draw(texture, BasePosition, NPC.frame, finalDrawColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - // Draw the main boss texture + its afterimages - Vector2 RotationCenter = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color BaseColor = Color.White; - float Brightness = 0.5f; // Ranges from 0 (full vibrance) to 1 (pure white) - int maxAfterimages = 5; + // Draw the glowmask textures + their afterimages + // These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. + Color WingColor = ProvUtils.GetProjectileColor(0); // Default to day + Color CrystalColor = Color.Violet; - if (CalamityConfig.Instance.Afterimages) - { - for (int i = 1; i < maxAfterimages; i += 2) + if (NPC.localAI[1] == (float)BossMode.Rainbow) { - Color AfterimageColor = drawColor; - AfterimageColor = Color.Lerp(AfterimageColor, BaseColor, Brightness); - AfterimageColor = NPC.GetAlpha(AfterimageColor); - AfterimageColor *= (maxAfterimages - i) / 15f; - if (colorOverride != null) - AfterimageColor = colorOverride.Value; - - Vector2 AfterimageBodyPosition = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - AfterimageBodyPosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - AfterimageBodyPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, AfterimageBodyPosition, NPC.frame, AfterimageColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + { + WingColor = Color.Magenta; + CrystalColor = Color.GreenYellow; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + { + WingColor = Color.Cyan; + CrystalColor = Color.BlueViolet; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + { + WingColor = Color.Green; + CrystalColor = Color.Gold; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + CrystalColor = Color.Violet; + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + { + WingColor = Color.Orange; + CrystalColor = Color.HotPink; + } + else // Red + { + WingColor = Color.Red; + CrystalColor = Color.BlueViolet; + } } - } - - Vector2 BasePosition = NPC.Center - screenPos; - BasePosition -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - BasePosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(texture, BasePosition, NPC.frame, colorOverride ?? NPC.GetAlpha(drawColor), NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - - // Draw the glowmask textures + their afterimages - // These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. - Color WingColor = Color.Yellow; //Default to day - Color CrystalColor = Color.Violet; - switch (NPC.localAI[1]) - { - case (float)BossMode.Red: - WingColor = Color.Red; - CrystalColor = Color.BlueViolet; - break; - case (float)BossMode.Orange: - WingColor = Color.Orange; - CrystalColor = Color.HotPink; - break; - case (float)BossMode.Yellow: // Same as day - break; - case (float)BossMode.Green: - WingColor = Color.Green; - CrystalColor = Color.Gold; - break; - case (float)BossMode.Blue: // Same as night - case (float)BossMode.Night: + else if (NPC.localAI[1] == (float)BossMode.Night) + { WingColor = Color.Cyan; CrystalColor = Color.BlueViolet; - break; - case (float)BossMode.Violet: - WingColor = Color.Magenta; - CrystalColor = Color.GreenYellow; - break; - default: - break; - } + } - Color BaseWingColor = Color.Lerp(WingColor, BaseColor, Brightness) * NPC.Opacity; - Color BaseCrystalColor = Color.Lerp(CrystalColor, BaseColor, Brightness) * NPC.Opacity; - if (colorOverride != null) - { - BaseWingColor = colorOverride.Value; - BaseCrystalColor = colorOverride.Value; - } - - if (CalamityConfig.Instance.Afterimages) - { - for (int j = 1; j < maxAfterimages; j++) + Color BaseWingColor = Color.Lerp(WingColor, BaseColor, Brightness) * NPC.Opacity; + Color BaseCrystalColor = Color.Lerp(CrystalColor, BaseColor, Brightness) * NPC.Opacity; + if (colorOverride != null) { - Color AfterimageWingColor = BaseWingColor; - AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); - AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); - AfterimageWingColor *= (maxAfterimages - j) / 15f; - if (colorOverride != null) - AfterimageWingColor = colorOverride.Value; + BaseWingColor = colorOverride.Value; + BaseCrystalColor = colorOverride.Value; + } - Vector2 AfterimageGlowPosition = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - AfterimageGlowPosition -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - AfterimageGlowPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; - spriteBatch.Draw(textureGlow, AfterimageGlowPosition, NPC.frame, AfterimageWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + Color GlowWingColor = ProvUtils.GetProjectileColor(NPC.GetAlpha(drawColor), true); - Color AfterimageCrystalColor = BaseCrystalColor; - AfterimageCrystalColor = Color.Lerp(AfterimageCrystalColor, BaseColor, Brightness); - AfterimageCrystalColor = NPC.GetAlpha(AfterimageCrystalColor); - AfterimageCrystalColor *= (maxAfterimages - j) / 15f; - if (colorOverride != null) - AfterimageCrystalColor = colorOverride.Value; - spriteBatch.Draw(textureGlow2, AfterimageGlowPosition, NPC.frame, AfterimageCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + if (CalamityClientConfig.Instance.Afterimages) + { + for (int j = 1; j < maxAfterimages; j++) + { + Color AfterimageWingColor = ProvUtils.GetProjectileColor(0, true); + AfterimageWingColor = Color.Lerp(AfterimageWingColor, BaseColor, Brightness); + AfterimageWingColor = NPC.GetAlpha(AfterimageWingColor); + AfterimageWingColor *= (maxAfterimages - j) / 15f; + + if (colorOverride != null) + AfterimageWingColor = colorOverride.Value; + + Vector2 AfterimageGlowPosition = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + AfterimageGlowPosition -= new Vector2(textureGlow.Width, textureGlow.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + AfterimageGlowPosition += RotationCenter * NPC.scale + new Vector2(0f, NPC.gfxOffY) + drawOffset; + spriteBatch.Draw(textureGlow, AfterimageGlowPosition, NPC.frame, AfterimageWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + + Color AfterimageCrystalColor = BaseCrystalColor; + AfterimageCrystalColor = Color.Lerp(AfterimageCrystalColor, BaseColor, Brightness); + AfterimageCrystalColor = NPC.GetAlpha(AfterimageCrystalColor); + AfterimageCrystalColor *= (maxAfterimages - j) / 15f; + + if (colorOverride != null) + AfterimageCrystalColor = colorOverride.Value; + + spriteBatch.Draw(textureGlow2, AfterimageGlowPosition, NPC.frame, AfterimageCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + } + } + + if (!Dying) + { + NPC.DrawBackglow(GlowWingColor, 4f, SpriteEffects.None, NPC.frame, Main.screenPosition, textureGlow); + + spriteBatch.Draw(textureGlow, BasePosition, NPC.frame, BaseWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); + + spriteBatch.Draw(textureGlow2, BasePosition, NPC.frame, BaseCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } } - - spriteBatch.Draw(textureGlow, BasePosition, NPC.frame, BaseWingColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); - - spriteBatch.Draw(textureGlow2, BasePosition, NPC.frame, BaseCrystalColor, NPC.rotation, RotationCenter, NPC.scale, spriteEffects, 0f); } float burnIntensity = Utils.GetLerpValue(0f, 45f, DeathAnimationTimer, true); @@ -2329,7 +2358,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.localAI[0] > 0f && NPC.localAI[0] < TimeForStarDespawn) { float lerpMult = MathHelper.Lerp(0.5f, 1.5f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) / 2f + 1f); - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; + Texture2D tex = ModContent.Request("CalamityMod/Projectiles/StarProj").Value; float drawOffsetAmt = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) ? 20f : 64f; Vector2 drawPos = NPC.Center + Vector2.UnitY * drawOffsetAmt * NPC.scale - Main.screenPosition; Color baseColor = Color.Lerp(Color.Yellow, Color.OrangeRed, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 1f); @@ -2343,20 +2372,20 @@ namespace CalamityMod.NPCs.Providence float colorScale = MathHelper.Lerp(0f, lerpMult, opacityScaleDuringStarDespawn); colorA *= colorScale; colorB *= colorScale; - Vector2 origin = texture.Size() / 2f; + Vector2 origin = tex.Size() / 2f; Vector2 scale = new Vector2(1.5f + scaleDuringStarDespawn, 2.5f + scaleDuringStarDespawn) * lerpMult; float upRight = MathHelper.PiOver4 + NPC.rotation; float up = MathHelper.PiOver2 + NPC.rotation; float upLeft = 3f * MathHelper.PiOver4 + NPC.rotation; float left = MathHelper.Pi + NPC.rotation; - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, upLeft, origin, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, upRight, origin, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, upLeft, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, upRight, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, up, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorA, left, origin, scale * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, up, origin, scale * 0.36f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, drawPos, null, colorB, left, origin, scale * 0.36f, SpriteEffects.None, 0); } // Draw shields while defender is alive @@ -2435,6 +2464,44 @@ namespace CalamityMod.NPCs.Providence return false; } + public override Color? GetAlpha(Color drawColor) + { + return ProvUtils.GetProjectileColor(drawColor) * NPC.Opacity; + } + + public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D tex = ModContent.Request("CalamityMod/NPCs/Providence/Providence_DeathSilhouette").Value; + + if (Dying) + { + if (DeathAnimationTimer > 91f) + { + // Without these four lines there is this weird overlap in the center over darker backgrounds + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 10) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 15) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 20) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex, NPC.Center + new Vector2(0, 25) - Main.screenPosition, new Rectangle(0, 0, tex.Width, tex.Height), Color.White, 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + + Vector2 vec = new Vector2(Main.rand.NextFloat(-2, 2), Main.rand.NextFloat(-2, 2)); + + float progress = MathHelper.Clamp(((float)DeathAnimationTimer - 200f) / 300f, 0f, 1f); + + for (int i = 0; i < NPC.frame.Height / 2; i++) + { + int outset = ((i - NPC.frame.Height / 4) * 2); + + int pr = (int)(progress * 30f); + + Color col = ProvUtils.GetProjectileColor(Color.DarkGray, true); + col.A = 255; + + Main.EntitySpriteDraw(tex, NPC.Center + vec + new Vector2(0, 310) - Main.screenPosition + new Vector2(Main.rand.Next(-pr, pr) * 2, outset), new Rectangle(0, i * 2, tex.Width, 2), Color.Lerp(col, Color.White, progress * 2f).MultiplyRGBA(new Color(255, 255, 255, MathHelper.Lerp(progress, 1f, 0.2f) * 2f)), 0f, tex.Size() / 2f, 1f, SpriteEffects.None); + } + } + } + } + public override void FindFrame(int frameHeight) { if (NPC.IsABestiaryIconDummy) @@ -2545,8 +2612,10 @@ namespace CalamityMod.NPCs.Providence bool allowedClass = projectile.CountsAsClass() || (!projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass() && !projectile.CountsAsClass()); - bool allowedDamage = allowedClass && hit.Damage <= 75; //Flat 75 regardless of difficulty. - //Absorber on-hit effects likely won't proc this but Deific Amulet and Astral Bulwark stars will proc this. + + bool allowedDamage = allowedClass && hit.Damage <= 75; // Flat 75 regardless of difficulty. + + // Absorber on-hit effects likely won't proc this but Deific Amulet and Astral Bulwark stars will proc this. bool allowedBabs = Main.player[projectile.owner].Calamity().pSoulArtifact && !Main.player[projectile.owner].Calamity().profanedCrystalBuffs; if ((exceptionList.TrueForAll(x => projectile.type != x) && !allowedDamage) || !allowedBabs) @@ -2610,7 +2679,7 @@ namespace CalamityMod.NPCs.Providence SoundEngine.PlaySound(HurtSound, NPC.Center); } - int dustType = ProvUtils.GetDustID(NPC.localAI[1]); + int dustType = ProvUtils.GetDustID(); for (int k = 0; k < 15; k++) { int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); @@ -2627,10 +2696,12 @@ namespace CalamityMod.NPCs.Providence Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence3").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence4").Type, NPC.scale); } + NPC.position = NPC.Center; NPC.width = (int)(400 * NPC.scale); NPC.height = (int)(350 * NPC.scale); NPC.position -= NPC.Size * 0.5f; + for (int d = 0; d < 60; d++) { int fire = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 2f); @@ -2655,35 +2726,188 @@ namespace CalamityMod.NPCs.Providence } } - //These will be used for almost every single one of her projectiles, so it's useful to have. + /// + /// Handles the holy flame effect on items just dropped by Providence in Hell. + /// + public class ProvItemFloating : GlobalItem + { + public override void Load() + { + On_CommonCode.ModifyItemDropFromNPC += On_CommonCode_ModifyItemDropFromNPC; + } + + public override void Unload() + { + On_CommonCode.ModifyItemDropFromNPC -= On_CommonCode_ModifyItemDropFromNPC; + } + + private void On_CommonCode_ModifyItemDropFromNPC(On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex) + { + if (npc.type == ModContent.NPCType()) + { + Main.item[itemIndex].GetGlobalItem().HolyFlame = 2f; + } + else + { + orig(npc, itemIndex); + } + } + + public override bool InstancePerEntity => true; + + public float HolyFlame = 0f; + public float FlameTimer = 0f; + + public override void Update(Item item, ref float gravity, ref float maxFallSpeed) + { + float clp = MathHelper.Clamp(HolyFlame, 0f, 1f); + + maxFallSpeed *= MathHelper.Lerp(1, 0f, clp); + + if (maxFallSpeed > 0.3f) + { + HolyFlame *= 0.95f; + } + + HolyFlame *= 0.9975f; + HolyFlame = MathHelper.Clamp(HolyFlame, 0f, 2f); + + if (item.beingGrabbed) + { + HolyFlame = 0f; + } + } + + public override void UpdateInventory(Item item, Player player) + { + HolyFlame = 0f; + } + + public override bool PreDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + FlameTimer++; + + if (HolyFlame > 0f) + { + Color lColor = lightColor * MathHelper.Lerp(1f, 0f, MathHelper.Clamp(HolyFlame - 1f, 0f, 1f)); + lColor.A = 255; + + Color alph = new Color(255f * (HolyFlame / 2f), 255f * (HolyFlame / 2f), 0f, 0f); + Color alph2 = new Color(155f * (HolyFlame / 2f), 0f, 0f, 0f); + + if (!Main.dayTime) + { + lColor.B = 255; + + alph = new Color(0f, 255f * (HolyFlame / 2f), 255f * (HolyFlame / 2f), 0f); + alph2 = new Color(0f, 0f, 155f * (HolyFlame / 2f), 0f); + } + + Rectangle frame = Item.GetDrawHitbox(item.type, Main.LocalPlayer); + + if (HolyFlame > 0) + { + for (float i = 0f; i < 360f; i += 90f) + { + Main.EntitySpriteDraw(TextureAssets.Item[item.type].Value, item.Center - Main.screenPosition + new Vector2(4 * MathHelper.Clamp(HolyFlame, 0f, 1f), 0).RotatedBy(MathHelper.ToRadians(i)), frame, alph, rotation, frame.Size() / 2, scale, SpriteEffects.None); + } + } + + float maxIterations = 20; + + for (float i = 0; i < maxIterations; i++) + { + Main.EntitySpriteDraw(TextureAssets.Item[item.type].Value, item.Center - Main.screenPosition + (new Vector2((float)Math.Sin((FlameTimer / 20) + (item.whoAmI * 13098.125f) - (i / 5)) * i, -i * 1.5f) * (HolyFlame)), frame, Color.Lerp(alph, alph2, i / maxIterations), rotation, frame.Size() / 2, MathHelper.Lerp(scale, 0f, (float)(i / maxIterations) * (HolyFlame / 2)), SpriteEffects.None); + } + + Main.EntitySpriteDraw(TextureAssets.Item[item.type].Value, item.Center - Main.screenPosition, frame, lColor, rotation, frame.Size() / 2, scale, SpriteEffects.None); + + return false; + } + + return base.PreDrawInWorld(item, spriteBatch, lightColor, alphaColor, ref rotation, ref scale, whoAmI); + } + } + + // These will be used for almost every single one of her projectiles, so it's useful to have. public static class ProvUtils { - public static Color GetProjectileColor(int Mode, int Alpha, bool Outline = false) + public static bool DayAI() => (Main.IsItDay() || Main.remixWorld) && !Main.zenithWorld && !BossRushEvent.BossRushActive; + + // Simplified to day/night only. For PSC and Profaned Guardians + public static Color GetDayNightColor(int Alpha, bool Outline = false) => GetDayNightColor(!Main.IsItDay() && !Main.remixWorld, Alpha, Outline); + public static Color GetDayNightColor(bool Night, int Alpha, bool Outline = false) { - Color FinalColor = new Color(250, Outline ? 0 : 150, 0, Alpha); //Default to day - switch (Mode) + Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day + + if (Night) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + + return FinalColor; + } + + public static Color GetProjectileColor(Color givenLightColor, bool Outline = false) + { + int alpha = 0; + + // Custom set alpha for GFB Yellow Mode + if (!Outline && Main.zenithWorld && Main.GlobalTimeWrappedHourly % 6f >= 2f && Main.GlobalTimeWrappedHourly % 6f < 3f) { - case (int)Providence.BossMode.Red: - FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); - break; - case (int)Providence.BossMode.Orange: - FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); - break; - case (int)Providence.BossMode.Yellow: //Same as day - break; - case (int)Providence.BossMode.Green: - FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); - break; - case (int)Providence.BossMode.Violet: - FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, Alpha); - break; - default: - break; + float colorBrightness = (givenLightColor.R + givenLightColor.G + givenLightColor.B / 3) / 255f; + alpha = (int)MathHelper.Lerp(0f, 155f, colorBrightness); } + else + { + alpha = 100; + } + + Color FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); // Default to day + + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + FinalColor = new Color(Outline ? 200 : 100, 250, 100, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + FinalColor = new Color(250, 150, Outline ? 150 : 100, alpha); + else // Red + FinalColor = new Color(250, 100, Outline ? 200 : 100, alpha); + } + else if (!DayAI()) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); + + if (Outline) + FinalColor *= 0.1f; + + return FinalColor; + } + + public static Color GetProjectileColor(int Alpha, bool Outline = false) + { + Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day + + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + FinalColor = new Color(Outline ? 100 : 150, Outline ? 150 : 100, 250, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + FinalColor = new Color(Outline ? 200 : 100, 250, 100, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + FinalColor = new Color(250, 150, Outline ? 150 : 100, Alpha); + else // Red + FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); + } + else if (!DayAI()) + FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); if (Outline) FinalColor *= 0.1f; @@ -2691,77 +2915,94 @@ namespace CalamityMod.NPCs.Providence return FinalColor; } - public static int GetDustID(float Mode) + // Assign the night bool to turn it into a binary day/night state without accounting for GFB + public static int GetDustID(bool? Night = null) { - int DustType = (int)CalamityDusts.ProfanedFire; //Default to day - switch (Mode) + int DustType = (int)CalamityDusts.ProfanedFire; // Default to day + + if (Night.HasValue) { - case (float)Providence.BossMode.Red: - DustType = DustID.RedTorch; - break; - case (float)Providence.BossMode.Orange: - DustType = DustID.OrangeTorch; - break; - case (float)Providence.BossMode.Yellow: //Same as day - break; - case (float)Providence.BossMode.Green: - DustType = DustID.GreenTorch; - break; - case (float)Providence.BossMode.Blue: //Same as night - case (float)Providence.BossMode.Night: + if (Night.Value) DustType = (int)CalamityDusts.Nightwither; - break; - case (float)Providence.BossMode.Violet: - DustType = DustID.PurpleTorch; - break; - default: - break; } + else if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + DustType = DustID.PurpleTorch; + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + DustType = (int)CalamityDusts.Nightwither; + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + DustType = DustID.GreenTorch; + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + DustType = (int)CalamityDusts.ProfanedFire; + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + DustType = DustID.OrangeTorch; + else // Red + DustType = DustID.RedTorch; + } + else if (!DayAI()) + DustType = (int)CalamityDusts.Nightwither; + return DustType; } - //Include debuffs inflicted by Providence's projectiles for all her forms - //In the GFB seed, also includes negative healing - public static void ApplyHitEffects(Player Target, int Mode, int BaseDuration, int NegativeHealValue) + // Shortcut function for applying Burden Breaker-like negative healing to GFB Providence + public static void ApplyGFBDamage(Projectile proj, int BaseDuration, int NegativeHealValue) { - int BuffType = ModContent.BuffType(); //Default to day - float Multiplier = 1f; //Used to counterbalance Cursed Inferno and Shadowflame + int index = Player.FindClosest(proj.position, proj.width, proj.height); + Player player = Main.player[index]; + if (player is null) + return; + if (proj.Colliding(proj.Hitbox, player.Hitbox)) + ApplyDebuffs(player, BaseDuration, NegativeHealValue); + } - //Day and Night Providence inflicts 16-80 damage of debuffs depending on attacks - //GFB Providence inflicts 24-120 damage (+50%) for half the colors, 26-130 (+62.5%) for another half - switch (Mode) + // Include debuffs inflicted by Providence's projectiles for all her forms + // In the GFB seed, also includes negative healing + public static void ApplyDebuffs(Player Target, int BaseDuration, int NegativeHealValue = 0) + { + int BuffType = ModContent.BuffType(); // Default to non-GFB + + // All debuffs are adjusted to be 50% more powerful in GFB + float Multiplier = 1f; + if (Main.zenithWorld) { - case (int)Providence.BossMode.Red: - BuffType = ModContent.BuffType(); - break; - case (int)Providence.BossMode.Orange: - BuffType = ModContent.BuffType(); - Multiplier = 0.5f; - break; - case (int)Providence.BossMode.Yellow: //Same as day - break; - case (int)Providence.BossMode.Green: - BuffType = BuffID.CursedInferno; - Multiplier = 0.75f; - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - BuffType = ModContent.BuffType(); - break; - case (int)Providence.BossMode.Violet: + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + { BuffType = ModContent.BuffType(); - Multiplier = 0.60f; - break; - default: - break; + Multiplier = 2f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + { + BuffType = ModContent.BuffType(); + Multiplier = 1.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + { + BuffType = BuffID.CursedInferno; + Multiplier = 2.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + { + BuffType = ModContent.BuffType(); + Multiplier = 1.5f; + } + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + BuffType = ModContent.BuffType(); + else // Red + { + BuffType = ModContent.BuffType(); + Multiplier = 2f; + } } + Target.AddBuff(BuffType, (int)(BaseDuration * Multiplier)); - //A. Specifically inflicts Vaporfied in quirky RGB Mode because it's a colorful debuff - //B. Apply the negative healing - if (Mode >= (int)Providence.BossMode.Red) + // A. Specifically inflicts Vaporfied in quirky RGB Mode because it's a colorful debuff + // B. Apply the negative healing + if (Main.zenithWorld) { - //Obligatory offensive guardian boosting negative heals + // Obligatory offensive guardian boosting negative heals if (CalamityGlobalNPC.holyBossAttacker != -1) { if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) @@ -2775,6 +3016,7 @@ namespace CalamityMod.NPCs.Providence PlayerDeathReason CustomSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Target.name)); Target.KillMe(CustomSource, NegativeHealValue, 0); } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, Target.whoAmI, NegativeHealValue); Target.AddBuff(ModContent.BuffType(), (int)(BaseDuration * Multiplier)); diff --git a/NPCs/Providence/Providence.png b/NPCs/Providence/Providence.png index 78d9e24a29..7e0d01db1b 100644 Binary files a/NPCs/Providence/Providence.png and b/NPCs/Providence/Providence.png differ diff --git a/NPCs/Providence/ProvidenceAlt.png b/NPCs/Providence/ProvidenceAlt.png index 967c031428..a8e3aff0fe 100644 Binary files a/NPCs/Providence/ProvidenceAlt.png and b/NPCs/Providence/ProvidenceAlt.png differ diff --git a/NPCs/Providence/Providence_DeathSilhouette.png b/NPCs/Providence/Providence_DeathSilhouette.png new file mode 100644 index 0000000000..642e510c75 Binary files /dev/null and b/NPCs/Providence/Providence_DeathSilhouette.png differ diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 9fc04d2558..1fe444ffe1 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.Signus Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -154,7 +154,7 @@ namespace CalamityMod.NPCs.Signus texture2D15 = GlowTexture.Value; Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index 72c7f2a6e0..b61fb27b14 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.Signus Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); int afterimageAmt = 5; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index a213b3dfff..21fe2459d0 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -852,7 +852,7 @@ namespace CalamityMod.NPCs.Signus transparency = (100 - (stealthTimer - 300)) * 0.01f; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -878,7 +878,7 @@ namespace CalamityMod.NPCs.Signus eyeGlowColor = Color.MediumBlue; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index a0e8754706..4da12c3fb8 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -596,7 +596,7 @@ namespace CalamityMod.NPCs.SlimeGod spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0); } if (!Main.zenithWorld) - while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityConfig.Instance.Afterimages) + while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityClientConfig.Instance.Afterimages) { Color colorLightingAlpha = NPC.GetAlpha(colorLightingArea); { diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 732303ca07..47dfaf2b44 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.StormWeaver bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); else if (!Main.raining && !bossRush) CalamityUtils.StartRain(); diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 74d4d56dad..7ad530b9af 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 56; NPC.height = 42; NPC.defense = 22; - NPC.lifeMax = 900; + NPC.lifeMax = 1130; NPC.aiStyle = AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); NPC.HitSound = SoundID.NPCHit38; diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index 57b90345a5..1e8dddfb61 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 20; NPC.height = 20; NPC.defense = 10; - NPC.lifeMax = Main.hardMode ? 300 : 50; + NPC.lifeMax = Main.hardMode ? 380 : 70; NPC.knockBackResist = 0.8f; NPC.value = Item.buyPrice(0, 0, 0, 80); NPC.HitSound = SoundID.NPCHit1; diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index bc8cf816d8..b025b43844 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 54; NPC.height = 42; NPC.defense = 25; - NPC.lifeMax = 1000; + NPC.lifeMax = 1250; NPC.aiStyle = AIType = -1; NPC.value = Item.buyPrice(0, 0, 3, 50); NPC.HitSound = SoundID.NPCHit42; diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index f892ce143d..9ebd137f18 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -1,7 +1,10 @@ -using CalamityMod.BiomeManagers; +using System.IO; +using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -23,19 +26,21 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { + NPC.noGravity = true; NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 25; NPC.width = 50; NPC.height = 36; NPC.defense = 30; NPC.DR_NERD(0.15f); - NPC.lifeMax = 35; + NPC.lifeMax = 50; NPC.knockBackResist = 0.25f; - NPC.aiStyle = NPCAIStyleID.Fighter; - AIType = NPCID.Crab; + NPC.aiStyle = -1; + AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 60); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = SoundID.NPCDeath54; + NPC.chaseable = false; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -57,53 +62,93 @@ namespace CalamityMod.NPCs.SulphurousSea }); } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + public override void AI() { - NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; - float targetDist = (Main.player[NPC.target].Center - NPC.Center).Length(); - targetDist *= 0.0025f; - if ((double)targetDist > 1.5) + float detectRange = Main.player[NPC.target].Calamity().GetAbyssAggro(120f); + + if (NPC.wet) { - targetDist = 1.5f; - } - float maxVelocity; - if (Main.expertMode) - { - maxVelocity = 2.5f - targetDist; + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 0, detectRange, 0.15f, 0.1f, 6f, 4f, 0.1f, false); } else { - maxVelocity = 2.25f - targetDist; - } - maxVelocity *= (CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1f : 0.8f); - if (NPC.velocity.X < -maxVelocity || NPC.velocity.X > maxVelocity) - { - if (NPC.velocity.Y == 0f) + NPC.noGravity = false; + + if (NPC.justHit || (!Main.player[NPC.target].dead && (Main.player[NPC.target].Center - NPC.Center).Length() < detectRange && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height))) + NPC.chaseable = true; + + float deceleration = 0.8f; + + if (NPC.chaseable && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && !Main.player[NPC.target].dead) { - NPC.velocity *= 0.8f; + NPC.TargetClosest(); + + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + + float distanceFromTarget = MathHelper.Clamp((Main.player[NPC.target].Center - NPC.Center).Length() * 0.0025f, 0f, 1.5f); + float velocityMultiplier = CalamityWorld.death ? 1.2f : CalamityWorld.revenge ? 1f : 0.8f; + float maxVelocity = ((Main.expertMode ? 2.5f : 2.25f) - distanceFromTarget) * velocityMultiplier; + float accelerationX = CalamityWorld.death ? 0.7f : CalamityWorld.revenge ? 0.6f : 0.5f; + + if (NPC.velocity.X < -maxVelocity || NPC.velocity.X > maxVelocity) + { + if (NPC.velocity.Y == 0f) + NPC.velocity *= deceleration; + } + else if (NPC.velocity.X < maxVelocity && NPC.direction == 1) + { + NPC.velocity.X += accelerationX; + if (NPC.velocity.X > maxVelocity) + NPC.velocity.X = maxVelocity; + } + else if (NPC.velocity.X > -maxVelocity && NPC.direction == -1) + { + NPC.velocity.X -= accelerationX; + if (NPC.velocity.X < -maxVelocity) + NPC.velocity.X = -maxVelocity; + } } - } - else if (NPC.velocity.X < maxVelocity && NPC.direction == 1) - { - NPC.velocity.X = NPC.velocity.X + 1f; - if (NPC.velocity.X > maxVelocity) + else { - NPC.velocity.X = maxVelocity; - } - } - else if (NPC.velocity.X > -maxVelocity && NPC.direction == -1) - { - NPC.velocity.X = NPC.velocity.X - 1f; - if (NPC.velocity.X < -maxVelocity) - { - NPC.velocity.X = -maxVelocity; + NPC.TargetClosest(false); + + if (NPC.velocity != Vector2.Zero) + { + NPC.velocity *= deceleration; + if (NPC.velocity.Length() < 0.1f) + NPC.velocity = Vector2.Zero; + } } } } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + return NPC.chaseable; + + return null; + } + public override void FindFrame(int frameHeight) { - NPC.frameCounter += 0.15f; + if (NPC.velocity == Vector2.Zero) + { + NPC.frame.Y = 0; + return; + } + + NPC.frameCounter += NPC.chaseable ? 0.15f : 0.075f; NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; @@ -118,13 +163,11 @@ namespace CalamityMod.NPCs.SulphurousSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.PlayerSafe) - { return 0f; - } - if (spawnInfo.Player.Calamity().ZoneSulphur) - { + + if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water) return 0.2f; - } + return 0f; } @@ -133,15 +176,13 @@ namespace CalamityMod.NPCs.SulphurousSea public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (NPC.life <= 0) { for (int k = 0; k < 15; k++) - { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - } + if (Main.netMode != NetmodeID.Server) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Gnasher").Type, 1f); diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index 6a2ccd8613..ab9a4ac6da 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 42; NPC.height = 32; NPC.defense = 15; - NPC.lifeMax = 40; + NPC.lifeMax = 50; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 0, 80); diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index 675f63a5cb..93de02fe43 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 98; NPC.height = 40; NPC.defense = 12; - NPC.lifeMax = 120; + NPC.lifeMax = 150; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 1, 0); diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index dd1c4000d4..fb4afc37b8 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 150; NPC.height = 40; NPC.defense = 22; - NPC.lifeMax = 200; + NPC.lifeMax = 250; NPC.aiStyle = -1; AIType = -1; NPC.value = Item.buyPrice(0, 0, 3, 0); diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs new file mode 100644 index 0000000000..dd4fca62ae --- /dev/null +++ b/NPCs/SunkenSea/AlphaSeaMinnow.cs @@ -0,0 +1,239 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.DataStructures; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class AlphaSeaMinnow : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 8; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + } + + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 40; + NPC.height = 32; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.AlphaSeaMinnow") + }); + } + + public override void OnSpawn(IEntitySource source) + { + // Alphas released by the player do not spawn a shoal of minnows + if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) + { + return; + } + // Spawn a shoal of minnows + int fishCount = Main.rand.Next(5, 10); + for (int i = 0; i < fishCount; i++) + { + int goldchance = NPC.type == ModContent.NPCType() ? 20 : 50; + int minnowtype = Main.rand.NextBool(goldchance) ? ModContent.NPCType() : ModContent.NPCType(); + int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, minnowtype); + Main.npc[n].ai[2] = NPC.whoAmI; // makes the spawned minnow recognize this one as the alpha + } + } + + public override void AI() + { + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 2, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + NPC.noGravity = true; + if (NPC.direction == 0) + { + NPC.TargetClosest(true); + } + if (NPC.wet) + { + NPC.TargetClosest(false); + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) + { + NPC.velocity.X = NPC.velocity.X * 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) + { + NPC.ai[0] = 1f; + } + } + else + { + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) + { + NPC.ai[0] = -1f; + } + } + int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; + if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) + { + if (Main.tile[npcTileX, npcTileY + 1].HasTile) + { + NPC.ai[0] = -1f; + } + else if (Main.tile[npcTileX, npcTileY + 2].HasTile) + { + NPC.ai[0] = -1f; + } + } + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) + { + NPC.velocity.Y = NPC.velocity.Y * 0.95f; + } + } + else + { + if (NPC.velocity.Y == 0f) + { + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) + { + NPC.velocity.X = 0f; + } + } + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) + { + NPC.velocity.Y = 10f; + } + NPC.ai[0] = 1f; + } + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) + { + NPC.rotation = -0.1f; + } + if ((double)NPC.rotation > 0.1) + { + NPC.rotation = 0.1f; + } + if (NPC.type == ModContent.NPCType()) + { + NPC.ProduceGoldCritterDust(); + } + } + + public override void ModifyTypeName(ref string typeName) + { + // Holy mackerel is that an Ultrakill reference!?!? + // (I have barely played the game as of writing this _ YuH) + if (Main.zenithWorld) + { + typeName = CalamityUtils.GetTextValue("NPCs.MinnowPrime"); + } + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + { + NPC.frameCounter = 0.0; + return; + } + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, 68, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + public class AlphaSeaMinnowGold : AlphaSeaMinnow + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 8; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + this.HideFromBestiary(); + } + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 40; + NPC.height = 32; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.rarity = 3; + NPC.catchItem = ModContent.ItemType(); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.03f; + } + return 0f; + } + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.png b/NPCs/SunkenSea/AlphaSeaMinnow.png new file mode 100644 index 0000000000..46d9558e2f Binary files /dev/null and b/NPCs/SunkenSea/AlphaSeaMinnow.png differ diff --git a/NPCs/SunkenSea/AlphaSeaMinnowGold.png b/NPCs/SunkenSea/AlphaSeaMinnowGold.png new file mode 100644 index 0000000000..97bcba564f Binary files /dev/null and b/NPCs/SunkenSea/AlphaSeaMinnowGold.png differ diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 812fa36cc2..4e4e07ada1 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -1,34 +1,59 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.BiomeManagers; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Critters; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; + namespace CalamityMod.NPCs.SunkenSea { public class BabyGhostBell : ModNPC { public bool hasBeenHit = false; + public static Texture2D RadiantTexture; + public static Texture2D VoltaicTexture; + public static Texture2D RedTexture; + public static Texture2D GreenTexture; + public static Texture2D GoldTexture; + public ref float Variant => ref NPC.ai[1]; + public enum JellyColor + { + Blue = 0, + Green = 1, + Red = 2, + Radiant = 3, + Voltaic = 4, + Gold = 5 + } public static Asset GlowTexture; public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; - Main.npcCatchable[NPC.type] = true; - NPCID.Sets.CountsAsCritter[NPC.type] = true; if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRadiant", AssetRequestMode.ImmediateLoad).Value; + VoltaicTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellVoltaic", AssetRequestMode.ImmediateLoad).Value; + GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGreen", AssetRequestMode.ImmediateLoad).Value; + RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRed", AssetRequestMode.ImmediateLoad).Value; + GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGold", AssetRequestMode.ImmediateLoad).Value; } + Main.npcFrameCount[NPC.type] = 6; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; } public override void SetDefaults() @@ -73,6 +98,58 @@ namespace CalamityMod.NPCs.SunkenSea hasBeenHit = reader.ReadBoolean(); } + public override void OnSpawn(IEntitySource source) + { + // Bells released by the player do not randomize when spawned + if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) + { + return; + } + Variant = Main.rand.Next(1, 4); + if (Main.rand.NextBool(30)) + { + Variant = (int)JellyColor.Radiant; + } + if (Main.rand.NextBool(15)) + { + Variant = (int)JellyColor.Voltaic; + } + if (Main.rand.NextBool(50)) + { + Variant = (int)JellyColor.Gold; + } + switch (Variant) + { + case (int)JellyColor.Blue: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)JellyColor.Green: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)JellyColor.Red: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)JellyColor.Radiant: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + case (int)JellyColor.Gold: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + case (int)JellyColor.Voltaic: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + } + } + public override void AI() { if (NPC.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -96,22 +173,63 @@ namespace CalamityMod.NPCs.SunkenSea Main.dust[dust].scale *= 0.5f; } } - Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1f / 255f, (255 - NPC.alpha) * 1f / 255f); + // Quick lil hops in random directions for movement if (NPC.wet) { - NPC.noGravity = true; - if (NPC.velocity.Y < 0f) + NPC.height = (int)(36 * NPC.scale); + if (NPC.velocity.Length() < 1f) { - NPC.velocity.Y += 0.1f; - } - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = 0f; + NPC.velocity = Main.rand.NextVector2CircularEdge(8, 8); } + NPC.velocity *= 0.95f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.velocity.ToRotation() + MathHelper.PiOver2, 0.5f); } else { - NPC.noGravity = false; + // Height is changed so that the jelly looks like it's actually laying on the ground when rotated + NPC.height = (int)(24 * NPC.scale); + // Gravy + if (NPC.velocity.Y < 10) + { + NPC.velocity.Y += 0.5f; + } + // Once it has hit the ground, fall over + if (Math.Abs(NPC.velocity.Y) < 1 && NPC.collideY) + { + // Splat + if (NPC.ai[2] == 0) + { + SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, NPC.Center); + NPC.ai[2] = 1; + } + NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.7f); + } + // Reset the splat sound + else + { + NPC.ai[2] = 0; + } + } + // Lite + Color lightColor = Color.LightBlue; // Voltaic uses the same light blue + switch (Variant) + { + case (int)JellyColor.Red: + lightColor = Color.Pink; + break; + case (int)JellyColor.Green: + lightColor = Color.LightGreen; + break; + case (int)JellyColor.Radiant: + lightColor = Color.LightBlue * 1.1f; // Radiant glows brighter + break; + } + Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); + + if (Variant == (int)JellyColor.Gold) + { + NPC.ProduceGoldCritterDust(); + NPC.rarity = 3; } } @@ -141,36 +259,65 @@ namespace CalamityMod.NPCs.SunkenSea return 0f; } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(GlowTexture.Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); - } - public override void HitEffect(NPC.HitInfo hit) { + int dustType = DustID.BlueCrystalShard; + switch (Variant) + { + case (int)JellyColor.Red: + dustType = DustID.RedTorch; + break; + case (int)JellyColor.Green: + dustType = DustID.GemEmerald; + break; + case (int)JellyColor.Gold: + dustType = DustID.GoldCritter; + break; + } for (int k = 0; k < 2; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { for (int k = 0; k < 10; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, hit.HitDirection, -1f, 0, default, 1f); } } } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + switch (Variant) + { + case (int)JellyColor.Red: + texture = RedTexture; + break; + case (int)JellyColor.Green: + texture = GreenTexture; + break; + case (int)JellyColor.Radiant: + texture = RadiantTexture; + break; + case (int)JellyColor.Voltaic: + texture = VoltaicTexture; + break; + case (int)JellyColor.Gold: + texture = GoldTexture; + break; + } + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[NPC.type] / 2); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } } } diff --git a/NPCs/SunkenSea/BabyGhostBell.png b/NPCs/SunkenSea/BabyGhostBell.png index ee927c6bed..083f1c0909 100644 Binary files a/NPCs/SunkenSea/BabyGhostBell.png and b/NPCs/SunkenSea/BabyGhostBell.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGlow.png b/NPCs/SunkenSea/BabyGhostBellGlow.png deleted file mode 100644 index ee927c6bed..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellGold.png b/NPCs/SunkenSea/BabyGhostBellGold.png new file mode 100644 index 0000000000..6a1935feff Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellGold.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGreen.png b/NPCs/SunkenSea/BabyGhostBellGreen.png new file mode 100644 index 0000000000..c2d4a7604e Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellGreen.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellRadiant.png b/NPCs/SunkenSea/BabyGhostBellRadiant.png new file mode 100644 index 0000000000..932587a820 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellRadiant.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellRed.png b/NPCs/SunkenSea/BabyGhostBellRed.png new file mode 100644 index 0000000000..2e4dd1d457 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellRed.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellVoltaic.png b/NPCs/SunkenSea/BabyGhostBellVoltaic.png new file mode 100644 index 0000000000..f714e78a35 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellVoltaic.png differ diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs new file mode 100644 index 0000000000..79ed3911fb --- /dev/null +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -0,0 +1,183 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Particles; +using CalamityMod.Items.Placeables.Banners; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using System.IO; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class FesteringRemains : ModNPC + { + public List bones = new List(); + public override void SetDefaults() + { + NPC.width = 52; + NPC.height = 36; + NPC.defense = 0; + NPC.lifeMax = 200; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.HauntedChum") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + // Spawn some bones around the remains + if (NPC.localAI[0] == 0) + { + int boneCount = Main.rand.Next(5, 8); + for (int i = 0; i < boneCount; i++) + { + int extraDistX = 120; + int extraDistY = 40; + Vector2 bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); + // If the bone spawns inside a tile, try to make it not spawn in a tile + for (int j = 0; j < 50; j++) + { + Tile tilePos = CalamityUtils.ParanoidTileRetrieval((int)bonePos.X / 16, (int)bonePos.Y / 16); + if (tilePos.HasTile) + { + bonePos = NPC.Center + new Vector2(Main.rand.Next(-extraDistX, extraDistX + 1), Main.rand.Next(-extraDistY, extraDistY + 1)); + } + } + Particle bone = new ChumBone(bonePos, Vector2.Zero, NPC.GetAlpha(Color.White), Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4), Main.rand.NextFloat(0.8f, 1.6f), 4, Main.rand.NextBool(), Main.rand.NextBool()); + GeneralParticleHandler.SpawnParticle(bone); + // Add to a list of bones + bones.Add(bone); + } + NPC.TargetClosest(); + NPC.localAI[0] = 1; + } + + // Enables expert scaling + NPC.damage = 0; + NPC.TargetClosest(); + int aggroRange = 80; + int spawnTime = 60; + Player target = Main.player[NPC.target]; + if (NPC.ai[1] == 0) + { + if (target != null && target.active && target.Distance(NPC.Center) < aggroRange) + { + NPC.ai[0]++; + if (NPC.ai[0] > spawnTime) + { + int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); + NPC.ai[1] = 1; + NPC.ai[2] = head; + SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); + Main.npc[head].localAI[0] = -MathHelper.PiOver4; + } + } + else + { + if (NPC.ai[0] > 0) + { + NPC.ai[0]--; + } + } + } + NPC spawnedHead = Main.npc[(int)NPC.ai[2]]; + // If the head has already been spawned but there is no more head (no head?) start a countdown, once the countdown reaches full, the head respawns + if (NPC.ai[1] == 1) + { + if (spawnedHead == null || !spawnedHead.active || spawnedHead.type != ModContent.NPCType()) + { + if (NPC.ai[3] == 180) + { + // Spawn the head and reset ai3 back to 0 + int head = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y - 48, ModContent.NPCType(), ai3: NPC.whoAmI); + NPC.ai[2] = head; + NPC.ai[3] = 0; + SoundEngine.PlaySound(SoundID.Item4 with { Pitch = -0.8f }, NPC.Center); + Main.npc[head].localAI[0] = -MathHelper.PiOver4; + } + NPC.ai[3]++; + } + if (NPC.ai[0] > 0) + { + NPC.ai[0]--; + } + } + // Keep the bones alive + for (int i = 0; i < bones.Count; i++) + { + bones[i].Time = 2; + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.Cavern.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt with { Volume = 0.8f, Pitch = 1.2f }, NPC.position); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + // Spooky glowey aura effect + if (NPC.ai[0] > 0) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color glowColor = Color.Red; + int xOffset = NPC.spriteDirection == 1 ? 16 : 22; + spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * (NPC.ai[0] / 120), 0f, bloom.Size() / 2f, 1f, SpriteEffects.None, 0); + foreach (ChumBone bone in bones) + { + spriteBatch.Draw(bloom, bone.Position - Main.screenPosition, null, glowColor * (NPC.ai[0] / 210), 0f, bloom.Size() / 2f, 0.4f * bone.Scale, SpriteEffects.None, 0); + } + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + return true; + } + } +} diff --git a/NPCs/SunkenSea/FesteringRemains.png b/NPCs/SunkenSea/FesteringRemains.png new file mode 100644 index 0000000000..75b78502a4 Binary files /dev/null and b/NPCs/SunkenSea/FesteringRemains.png differ diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 6e520e527b..77ca318ef2 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -574,7 +574,6 @@ namespace CalamityMod.NPCs.SunkenSea // Equipment npcLoot.Add(ModContent.ItemType(), 3); - npcLoot.Add(ModContent.ItemType(), 3); // Trophy npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs new file mode 100644 index 0000000000..68ee6f28cc --- /dev/null +++ b/NPCs/SunkenSea/HauntedChum.cs @@ -0,0 +1,315 @@ +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class HauntedChum : ModNPC + { + public static Texture2D jawTexture; + public List Segments; + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + if (!Main.dedServ) + { + jawTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/HauntedChumMouth", AssetRequestMode.ImmediateLoad).Value; + } + } + public override void SetDefaults() + { + NPC.width = 36; + NPC.height = 50; + NPC.defense = 5; + NPC.lifeMax = 60; + NPC.damage = 20; + NPC.aiStyle = -1; + NPC.alpha = 255; + AIType = -1; + NPC.HitSound = SoundID.DD2_SkeletonHurt; + NPC.DeathSound = SoundID.DD2_SkeletonDeath; + NPC.noGravity = true; + NPC.noTileCollide = true; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void AI() + { + int aggroRange = 600; + if (NPC.direction == 0) + { + NPC.TargetClosest(); + } + Player target = Main.player[NPC.target]; + NPC body = Main.npc[(int)NPC.ai[3]]; + // Create a chain + if (Segments == null || Segments.Count < 10) + { + Segments = new List(10); + for (int i = 0; i < 10; i++) + { + VerletSimulatedSegment segment = new VerletSimulatedSegment(body.Center + Vector2.UnitY * i * 10); + Segments.Add(segment); + } + + Segments[0].locked = true; + Segments[Segments.Count - 1].locked = true; + } + if (body == null || !body.active || body.type != ModContent.NPCType()) + { + NPC.StrikeInstantKill(); + } + switch (NPC.ai[0]) + { + case 0: + NPC.velocity.Y = -1; + NPC.ai[1]++; + if (NPC.alpha > 0) + { + NPC.alpha -= 25; + } + if (NPC.ai[1] > 30) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + } + break; + case 1: + if (target != null && target.active && target.Distance(body.Center) < aggroRange) + { + NPC.ai[0] = 2; + NPC.ai[1] = 0; + NPC.TargetClosest(); + SoundEngine.PlaySound(SoundID.Zombie7, NPC.Center); + } + NPC.TargetClosest(); + NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.05f); + if (NPC.velocity.Length() < 0.25f) + { + if (NPC.Distance(body.Center) > 320) + { + Vector2 direction = NPC.DirectionTo(body.Center); + direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 4; + } + else + { + Vector2 direction = Main.rand.NextVector2Circular(30, 30); + direction = direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 4; + } + } + // Lose brightness + if (NPC.ai[1] < 30) + { + NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.01f, 0); + } + NPC.velocity *= 0.98f; + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + break; + case 2: + if (target == null || !target.active || target.Distance(body.Center) >= aggroRange) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + } + else + { + NPC.ai[1]++; + float dist = target.Distance(NPC.Center); + if (dist < 32 || NPC.ai[1] > 50) + { + NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], -MathHelper.PiOver4, 0.3f); + } + else + { + NPC.localAI[0] = MathHelper.Lerp(NPC.localAI[0], 0, 0.1f); + } + // Lose brightness + if (NPC.ai[1] < 30) + { + NPC.localAI[1] = MathHelper.Max(NPC.localAI[1] - 0.02f, 0); + } + // Gain brightness + else if (NPC.ai[1] > 60) + { + NPC.localAI[1] = MathHelper.Min(NPC.localAI[1] + 0.06f, 0.6f); + } + if (NPC.ai[1] > 70) + { + NPC.TargetClosest(); + Vector2 direction = NPC.DirectionTo(target.Center); + direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 7; + SoundEngine.PlaySound(SoundID.DD2_PhantomPhoenixShot with { Pitch = 0.8f, Volume = 0.8f }, NPC.Center); + NPC.ai[1] = 0; + } + else + { + NPC.velocity.X *= 0.99f; + NPC.velocity.Y *= 0.999f; + } + } + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + break; + } + NPC.spriteDirection = NPC.direction; + if (NPC.localAI[1] > 0) + { + Lighting.AddLight(NPC.Center, 1 * NPC.localAI[1], 0, 0); + } + for (int i = 0; i < 2; i++) + { + int dustPos = NPC.spriteDirection == 1 ? -10 : 0; + if (ChildSafety.Disabled) + { + Dust.NewDust(new Vector2(NPC.Center.X + dustPos, NPC.position.Y + NPC.height / 4), 0, NPC.height / 2, DustID.Blood, -NPC.spriteDirection * Main.rand.NextFloat(4f, 5f), Main.rand.NextFloat(-3, 3), Scale: Main.rand.NextFloat(0.6f, 1f)); + } + } + + // Update the chain + Segments[0].oldPosition = Segments[0].position; + Segments[0].position = body.Center + new Vector2(body.spriteDirection * 20, 8); + + Segments[Segments.Count - 1].oldPosition = Segments[Segments.Count - 1].position; + Segments[Segments.Count - 1].position = body.active ? NPC.Center : body.Center; + + Segments = VerletSimulatedSegment.SimpleSimulation(Segments, 10, loops: 1, gravity: 0.3f); + + NPC.netUpdate = true; + NPC.netSpam = 0; + } + + internal float WidthFunction(float completionRatio) + { + return MathHelper.Clamp(((float)Math.Cos(completionRatio * 60)) + 2, 1, 2) / 2; + } + + internal Color ColorFunction(float completionRatio) + { + return (int)(completionRatio * 100) % 2 == 0 ? new Color(69, 52, 0) : new Color(); + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 3f; + + internal Color BackgroundColorFunction(float completionRatio) + { + return Color.Black; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sandnado, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + // Drop a bone gore for each bone + if (Segments != null && Segments.Count > 0) + { + for (int i = 0; i < Segments.Count; i++) + { + VerletSimulatedSegment v = Segments[i]; + int goreType = i < Segments.Count / 2 ? Mod.Find("ChumBone2").Type : Mod.Find("ChumBone1").Type; + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGorePerfect(NPC.GetSource_Death(), v.position, new Vector2(Main.rand.NextFloat(-2, 2), -6), goreType); + } + } + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChum").Type, 1f); + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChumMouth").Type, 1f); + } + } + } + + public override bool CheckActive() + { + return !(Main.npc[(int)NPC.ai[3]].active && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + List points = new List(); + if (Segments != null && Segments.Count > 0) + { + for (int i = 0; i < Segments.Count; i++) + { + points.Add(Segments[i].position); + } + } + + PrimitiveRenderer.RenderTrail(points, new(BackgroundWidthFunction, BackgroundColorFunction), 75); + PrimitiveRenderer.RenderTrail(points, new(WidthFunction, ColorFunction), 75); + + NPC body = Main.npc[(int)NPC.ai[3]]; + // Draw a chain of bones + if (body != null && body.active && body.type == ModContent.NPCType()) + { + if (Segments == null || Segments.Count <= 0) + { + return true; + } + for (int i = 0; i < Segments.Count - 1; i++) + { + VerletSimulatedSegment seg = Segments[i]; + float dist = i > 0 ? Vector2.Distance(seg.position, Segments[i - 1].position) : 0; + if (dist <= 2) + dist = 2; + dist += 2; + if (i == Segments.Count - 1) + { + dist = Vector2.Distance(seg.position, body.Center) + 2; + } + float rot = 0f; + if (i > 0) + rot = seg.position.DirectionTo(Segments[i - 1].position).ToRotation(); + SpriteEffects dir = NPC.Center.X > body.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; + Texture2D bone = i < Segments.Count / 2 ? ModContent.Request(ChumBone.Texture2).Value : ModContent.Request("CalamityMod/Particles/ChumBone1").Value; + spriteBatch.Draw(bone, seg.position - Main.screenPosition, null, Lighting.GetColor((int)(seg.position.X / 16), (int)(seg.position.Y / 16)) * NPC.Opacity, rot, bone.Size() / 2, 1f, dir, 0); + } + } + + // Spooky glowey aura effect + if (NPC.ai[0] == 2 && NPC.ai[1] < 50) + { + spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color glowColor = Color.Red; + int xOffset = NPC.spriteDirection == 1 ? 16 : 22; + spriteBatch.Draw(bloom, NPC.position - Main.screenPosition + new Vector2(xOffset, 28), null, glowColor * NPC.localAI[1], 0f, bloom.Size() / 2f, 0.8f, SpriteEffects.None, 0); + spriteBatch.ExitShaderRegion(); + } + + // Draw the chum itself and its jaw, rotated by localai[0] + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + Vector2 origin = new Vector2(texture.Width / 2, texture.Height / 2); + Vector2 jawOrigin = new Vector2(NPC.spriteDirection == 1 ? jawTexture.Width - 22 : 22, 4); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(jawTexture, npcOffset + new Vector2(16 * -NPC.spriteDirection, 4), null, NPC.GetAlpha(drawColor), NPC.localAI[0] * NPC.spriteDirection, jawOrigin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, npcOffset, null, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + } +} diff --git a/NPCs/SunkenSea/HauntedChum.png b/NPCs/SunkenSea/HauntedChum.png new file mode 100644 index 0000000000..11b9e1f220 Binary files /dev/null and b/NPCs/SunkenSea/HauntedChum.png differ diff --git a/NPCs/SunkenSea/HauntedChumMouth.png b/NPCs/SunkenSea/HauntedChumMouth.png new file mode 100644 index 0000000000..6fa25c049e Binary files /dev/null and b/NPCs/SunkenSea/HauntedChumMouth.png differ diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs new file mode 100644 index 0000000000..10b9e74b71 --- /dev/null +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -0,0 +1,267 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.World; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class KelpieSeadragon : ModNPC + { + public ref float SquishX => ref NPC.localAI[0]; + public ref float SquishY => ref NPC.localAI[1]; + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 13; + } + + public override void SetDefaults() + { + NPC.noGravity = true; + NPC.damage = 20; + NPC.width = 20; + NPC.height = 58; + NPC.defense = 5; + NPC.lifeMax = 350; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.15f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.KelpieSeadragon") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); + } + + public override void AI() + { + if (NPC.direction == 0) + { + NPC.TargetClosest(); + } + Player target = Main.player[NPC.target]; + // Fall and be useless if out of water + if (!NPC.wet) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + NPC.velocity.X *= 0.98f; + NPC.noGravity = false; + NPC.rotation = MathHelper.Lerp(NPC.rotation, MathHelper.PiOver2, 0.1f); + NPC.gfxOffY += 5; + return; + } + NPC.noGravity = true; + switch (NPC.ai[0]) + { + // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. + case 0: + NPC.chaseable = false; + if (target != null && target.active && target.Distance(NPC.Center) < 400 && Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + NPC.ai[0] = 1; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + SquishX = 0.9f; + SquishY = 1.05f; + NPC.TargetClosest(); + } + if (NPC.velocity.Length() < 0.1f) + { + NPC.ai[1]++; + // Randomly switch direction + if (Main.rand.NextBool(120)) + { + NPC.direction *= -1; + } + // Move in a random direction towards the direction the horse is facing + if (NPC.ai[1] > 120 || Main.rand.NextBool(90)) + { + Vector2 direction = new Vector2(NPC.direction * 30, Main.rand.Next(-30, 30)); + direction = direction.SafeNormalize(Vector2.Zero); + NPC.velocity = direction * 2; + NPC.ai[1] = 0; + } + } + // Reset any rotation from aggressive AI + NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); + NPC.velocity *= 0.99f; + break; + case 1: + if (target == null || !target.active || target.Distance(NPC.Center) > 600) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + SquishX = 0; + SquishY = 0; + } + NPC.chaseable = true; + // If the target is too far from its shooting range or a tile is in the way, move closer + if (target.Distance(NPC.Center) > 300 || !Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1)) + { + NPC.ai[1] = 0; + NPC.ai[2]++; + NPC.velocity = NPC.DirectionTo(target.Center).SafeNormalize(Vector2.Zero) * 3f; + NPC.rotation = MathHelper.Lerp(NPC.rotation, NPC.direction * MathHelper.PiOver4 / 2, 0.05f); + // Loose interest if it can't reach the player for a few seconds + if (!Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && NPC.ai[2] > 180) + { + NPC.ai[0] = 0; + NPC.ai[1] = 0; + NPC.ai[2] = 0; + SquishX = 0; + SquishY = 0; + } + } + else + { + // Otherwise sit at a distance and fire projectiles + NPC.velocity *= 0.9f; + NPC.ai[1]++; + int fireRate = 30; // Do not change this without adjusting the frame rate as well + float currentTime = NPC.ai[1] % 36; + if (currentTime == fireRate) + { + SoundEngine.PlaySound(Sounds.CommonCalamitySounds.ExoPlasmaShootSound with { Volume = 0.2f, Pitch = 1.8f }, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 spawnPos = new Vector2(NPC.Center.X + NPC.direction * 18, NPC.position.Y + 22); + Vector2 projSpeed = spawnPos.DirectionTo(target.Center).SafeNormalize(Vector2.Zero) * 6; + Projectile.NewProjectile(NPC.GetSource_FromThis(), spawnPos, projSpeed, ModContent.ProjectileType(), NPC.damage, 0f); + } + } + // Squash and stretch + int shotTime = 24; // When to squash + if (currentTime < 24) + { + SquishX = MathHelper.Lerp(SquishX, 0.9f, currentTime / shotTime); + SquishY = MathHelper.Lerp(SquishY, 1.05f, currentTime / shotTime); + } + else + { + SquishX = MathHelper.Lerp(SquishX, 1.35f, (currentTime - shotTime) / (fireRate - shotTime)); + SquishY = MathHelper.Lerp(SquishY, 0.85f, (currentTime - shotTime) / (fireRate - shotTime)); + } + + NPC.rotation = MathHelper.Lerp(NPC.rotation, 0, 0.1f); + } + if (Math.Abs(NPC.velocity.X) > 0) + { + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + } + else + { + NPC.direction = NPC.Center.X > target.Center.X ? -1 : 1; + } + break; + } + NPC.spriteDirection = NPC.direction; + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + return; + NPC.frameCounter++; + if (NPC.frameCounter > 5) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + // Anger + if (NPC.ai[0] == 1 && NPC.ai[1] > 0) + { + if (NPC.frame.Y > 12 * frameHeight || NPC.frame.Y < frameHeight * 7) + { + NPC.frame.Y = frameHeight * 7; + } + } + // Idle + else + { + if (NPC.frame.Y > 6 * frameHeight) + { + NPC.frame.Y = 0; + } + } + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + return null; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Asset tex = TextureAssets.Npc[Type]; + SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 stretch = NPC.ai[0] == 1 && NPC.ai[1] > 0 ? new Vector2(SquishX, SquishY): Vector2.One; + spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColor, NPC.rotation, new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]), NPC.scale * stretch, fx, 0); + return false; + } + } +} diff --git a/NPCs/SunkenSea/KelpieSeadragon.png b/NPCs/SunkenSea/KelpieSeadragon.png new file mode 100644 index 0000000000..c42bfe0083 Binary files /dev/null and b/NPCs/SunkenSea/KelpieSeadragon.png differ diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs new file mode 100644 index 0000000000..00765eb533 --- /dev/null +++ b/NPCs/SunkenSea/LostShoal.cs @@ -0,0 +1,434 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; +using Terraria.DataStructures; +using CalamityMod.Particles; +using Terraria.ModLoader.Utilities; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class LostShoal : ModNPC + { + public static Texture2D RedTexture; + public static Texture2D BlueTexture; + public static Texture2D GoldTexture; + + public float RandomOpacityOffset; + public ref float Variant => ref NPC.ai[1]; + public ref float Leader => ref NPC.ai[2]; + public ref float Role => ref NPC.ai[3]; + + public enum ShoalColor + { + Red = 0, + Blue = 1, + Green = 2, + Gold = 3 + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 8; + NPCID.Sets.TrailingMode[NPC.type] = 1; + if (!Main.dedServ) + { + RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalRed", AssetRequestMode.ImmediateLoad).Value; + BlueTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalBlue", AssetRequestMode.ImmediateLoad).Value; + GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/LostShoalGold", AssetRequestMode.ImmediateLoad).Value; + } + NPCID.Sets.CountsAsCritter[NPC.type] = true; + } + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 1; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = null; + NPC.DeathSound = SoundID.NPCDeath6; + NPC.noTileCollide = true; + NPC.alpha = 120; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = ItemID.AshBlock; // yeah this is intentional + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LostShoal") + }); + } + + public override void OnSpawn(IEntitySource source) + { + // Randomize the color of the fish + Variant = Main.rand.Next(0, 3); + if (Main.rand.NextBool(50)) + { + Variant = (int)ShoalColor.Gold; + NPC.catchItem = ItemID.GoldCoin; + } + + RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); + NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); + } + + public override void AI() + { + // swim normally if the fish is the leader of the shoal + if (Role != 1) + { + LeaderMovement(); + if (NPC.direction == 0) + { + NPC.direction = Main.rand.NextBool(2) ? 1 : -1; + } + if (Main.rand.NextBool(1200)) + { + NPC.direction *= -1; + } + } + else + { + NPC owner = Main.npc[(int)Leader]; + // if the owner of the shoal isn't a lost shoal or is dead, find a new shoal to attach to + if (!owner.active || owner.type != ModContent.NPCType()) + { + bool anyShoals = false; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC n = Main.npc[k]; + if (!n.active) + continue; + if (owner.type == ModContent.NPCType()) + { + // if a nearby shoal leader is found, go follow it + if (Role != 1 && n.Distance(NPC.position) < 1200) + { + anyShoals = true; + Leader = n.whoAmI; + } + } + } + // if no leaders are found nearby, a new leader is picked + if (!anyShoals) + { + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC n = Main.npc[k]; + if (!n.active) + continue; + if (owner.type == ModContent.NPCType()) + { + if (n.Distance(NPC.position) < 1200) + { + // the found fish becomes the new leader, and this fish becomes a member of its school + n.ai[3] = 2; + Leader = n.whoAmI; + } + } + } + } + } + NPC.velocity = owner.velocity; + NPC.direction = owner.direction; + NPC.spriteDirection = owner.spriteDirection; + // gather behind the leader + // basically a pet + // if we want to make the fish scared of players or other predators, then set enemyClose to true. For now this is commented out. + //NPC.TargetClosest(false); + //bool enemyClose = Main.player[NPC.target] != null && Main.player[NPC.target].active && Main.player[NPC.target].Distance(NPC.position) < 128; + bool enemyClose = false; + float SAImovement = enemyClose ? 0.02f : 0.1f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherFish = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherFish.active || k == NPC.whoAmI || owner.type != ModContent.NPCType()) + continue; + + float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); + if (taxicabDist < NPC.width) + { + if (NPC.position.X < otherFish.position.X) + NPC.velocity.X -= SAImovement; + else + NPC.velocity.X += SAImovement; + + if (NPC.position.Y < otherFish.position.Y) + NPC.velocity.Y -= SAImovement; + else + NPC.velocity.Y += SAImovement; + } + } + } + NPC.noGravity = true; + // leaders will naturally spawn a school of followers upon spawning + if (Role == 0) + { + // the amount of fish to spawn + int fishCount = 5; + for (int i = 0; i < fishCount; i++) + { + int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); + Main.npc[n].ai[3] = 1; // the 1 means that the spawned fish will not be a leader, and will not spawn even more fish + Main.npc[n].ai[2] = NPC.whoAmI; // marks this fish as the owner of the spawned fish + } + Role = 2; // don't spawn any more fish + } + // leaders are a tiny bit more brighter + float intensity = Role == 1 ? 0.002f : 0.004f; + Color glowColor = new(0.983f, 1f, 0.78f); + switch (Variant) + { + case (int)ShoalColor.Blue: + glowColor = new(0.78f, 0.77f, 0.988f); + break; + case (int)ShoalColor.Red: + glowColor = new(1f, 0.83f, 0.819f); + break; + case (int)ShoalColor.Gold: + glowColor = new(1f, 1f, 0.678f); + break; + } + Lighting.AddLight(NPC.Center, glowColor.R * intensity, glowColor.G * intensity, glowColor.B * intensity); + // Sprinkle down ash particles + // Trail glowing dust as they move + if (Main.rand.NextBool(120)) + { + //Color ashColor = new(40, 48, 41); + int dustid = DustID.CoralTorch; + switch (Variant) + { + case (int)ShoalColor.Blue: + //ashColor = new(44, 63, 66); + dustid = DustID.BoneTorch; + break; + case (int)ShoalColor.Red: + //ashColor = new(79, 41, 42); + dustid = DustID.CrimsonTorch; + break; + case (int)ShoalColor.Gold: + //ashColor = Color.Yellow; + dustid = DustID.IchorTorch; + break; + } + //Particle ash = new SquareAshParticle(NPC.Center, new Vector2(0, 4), 150, Main.rand.NextFloat(0.85f, 1f), ashColor); + //GeneralParticleHandler.SpawnParticle(ash); + + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, dustid, Scale: 1.5f); + dust.noGravity = true; + dust.velocity = Vector2.Zero; + } + if (Variant == (int)ShoalColor.Gold) + { + NPC.ProduceGoldCritterDust(); + } + } + + public void LeaderMovement() + { + // This is just usual swimmer ai with some modifications + NPC.spriteDirection = (NPC.direction > 0) ? -1 : 1; + + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.2f; + NPC.noGravity = true; + if (NPC.collideX) + { + NPC.velocity.X = NPC.velocity.X * -1f; + NPC.direction *= -1; + NPC.netUpdate = true; + } + if (NPC.collideY) + { + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -1f; + NPC.directionY = -1; + NPC.ai[0] = -1f; + } + else if (NPC.velocity.Y < 0f) + { + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; + } + } + // No target behavior + NPC.velocity.X += (float)NPC.direction * 0.05f; + if (NPC.velocity.X < -2f || NPC.velocity.X > 2f) + { + NPC.velocity.X *= 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y -= 0.01f; + if (NPC.velocity.Y < -0.3f) + { + NPC.ai[0] = 1f; + } + } + else + { + NPC.velocity.Y += 0.01f; + if (NPC.velocity.Y > 0.3f) + { + NPC.ai[0] = -1f; + } + } + int NPCTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int NPCTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; + if (Main.tile[NPCTileX, NPCTileY - 1].LiquidAmount > 128) + { + if (Main.tile[NPCTileX, NPCTileY + 1].HasTile) + { + NPC.ai[0] = -1f; + } + else if (Main.tile[NPCTileX, NPCTileY + 2].HasTile) + { + NPC.ai[0] = -1f; + } + } + if (NPC.velocity.Y > 0.4f || NPC.velocity.Y < -0.4f) + { + NPC.velocity.Y = NPC.velocity.Y * 0.95f; + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += 0.2f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && !NPC.AnyNPCs(Type)) + { + return 0.125f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + int goreType = Main.rand.Next(11, 14); + Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-10, 11) * 0.2f, Main.rand.Next(-10, 11) * 0.2f), goreType, 0.2f); + } + } + + public override void OnCaughtBy(Player player, Item item, bool failed) + { + // Gold shoals drop Gold Coins instead of ash when caught + // The shoal drops 1 coin by default while the extra coins are spawned here in a spread + if (!failed) + { + if (Variant == (int)ShoalColor.Gold) + { + for (int i = 0; i < Main.rand.Next(0, 5); i++) + { + Item.NewItem(NPC.GetSource_CatchEntity(NPC), NPC.getRect(), ItemID.GoldCoin); + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + // Spooky glowey aura effect + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + Color glowColor = Color.SeaGreen; + switch (Variant) + { + case (int)ShoalColor.Blue: + glowColor = Color.Cyan; + break; + case (int)ShoalColor.Red: + glowColor = Color.Pink; + break; + case (int)ShoalColor.Gold: + glowColor = Color.Yellow; + break; + } + + spriteBatch.Draw(bloom, NPC.Center - Main.screenPosition, null, glowColor * 0.45f, 0f, bloom.Size() / 2f, 0.3f, SpriteEffects.None, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + // Regular stuff for drawing the actual fish and its afterimages + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + switch (Variant) + { + case (int)ShoalColor.Blue: + texture = BlueTexture; + break; + case (int)ShoalColor.Red: + texture = RedTexture; + break; + case (int)ShoalColor.Gold: + texture = GoldTexture; + break; + } + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Color white = Color.White; + float colorLerpAmt = 0.5f; + int afterimageAmt = 7; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + } + } + + float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 3f + RandomOpacityOffset) / 2f + 0.5f; + + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture, npcOffset, NPC.frame, drawColor * MathHelper.Lerp(0.4f, 0.8f, sine), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + } +} diff --git a/NPCs/SunkenSea/LostShoal.png b/NPCs/SunkenSea/LostShoal.png new file mode 100644 index 0000000000..00bfd5303b Binary files /dev/null and b/NPCs/SunkenSea/LostShoal.png differ diff --git a/NPCs/SunkenSea/LostShoalBlue.png b/NPCs/SunkenSea/LostShoalBlue.png new file mode 100644 index 0000000000..8d9eaecff9 Binary files /dev/null and b/NPCs/SunkenSea/LostShoalBlue.png differ diff --git a/NPCs/SunkenSea/LostShoalGold.png b/NPCs/SunkenSea/LostShoalGold.png new file mode 100644 index 0000000000..e868c21047 Binary files /dev/null and b/NPCs/SunkenSea/LostShoalGold.png differ diff --git a/NPCs/SunkenSea/LostShoalRed.png b/NPCs/SunkenSea/LostShoalRed.png new file mode 100644 index 0000000000..9a759540c3 Binary files /dev/null and b/NPCs/SunkenSea/LostShoalRed.png differ diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs new file mode 100644 index 0000000000..21ee8886d4 --- /dev/null +++ b/NPCs/SunkenSea/Pearlpod.cs @@ -0,0 +1,227 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.GameContent.Bestiary; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.Audio; + +namespace CalamityMod.NPCs.SunkenSea +{ + public abstract class Pearlpod : ModNPC + { + public abstract int PearlType { get; } + public abstract float SpawnRate { get; } + public abstract int ItemType { get; } + + public override void SetDefaults() + { + NPC.aiStyle = NPCAIStyleID.Snail; + NPC.damage = 0; + NPC.width = 24; + NPC.height = 24; + NPC.defense = 0; + NPC.lifeMax = 20; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.GravityIgnoresLiquid = true; + AIType = NPCID.Snail; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.catchItem = ItemType; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + for (int i = 0; i < 2; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 2; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Pearlpod") + }); + } + + public override void AI() + { + Tile vine = Main.tile[(int)NPC.position.X / 16, (int)NPC.position.Y / 16]; + // Set newAI[0] to 1 if the Pearlpod is inside of a vine + if (vine.TileType == ModContent.TileType() && !NPC.justHit) + { + NPC.Calamity().newAI[0] = 1; + } + // Otherwise reset eating-related variables + else + { + NPC.Calamity().newAI[1] = 0; + NPC.Calamity().newAI[0] = 0; + } + // Eating behavior + if (NPC.Calamity().newAI[0] == 1) + { + NPC.velocity.X *= 0.1f; + // Play a crunch sound and spawn some grass dust randomly + if (Main.rand.NextBool(20)) + { + SoundEngine.PlaySound(SoundID.Item2 with { Volume = 0.4f, Pitch = 1.2f }, NPC.Center); + for (int i = 0; i < 4; i++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1), 40); + } + NPC.Calamity().newAI[1]++; + } + // After munching 10 times, the vine is broken and the Pearlpod continues about its day + if (NPC.Calamity().newAI[1] == 10) + { + if (vine.TileType == ModContent.TileType()) + { + WorldGen.KillTile((int)NPC.position.X / 16, (int)NPC.position.Y / 16); + } + } + } + if (NPC.type == ModContent.NPCType()) + { + NPC.ProduceGoldCritterDust(); + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > 8) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + if (NPC.frame.Y > frameHeight * 5) + { + NPC.frame.Y = 0; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenBurrows && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * SpawnRate; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(PearlType); + } + } + + public class PearlpodWhite : Pearlpod + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + } + public override int PearlType => ItemID.WhitePearl; + public override float SpawnRate => 0.6f; + public override int ItemType => ModContent.ItemType(); + } + public class PearlpodPink : Pearlpod + { + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[NPC.type] = 6; + } + + public override int PearlType => ItemID.PinkPearl; + public override float SpawnRate => 0.2f; + public override int ItemType => ModContent.ItemType(); + } + public class PearlpodBlack : Pearlpod + { + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[NPC.type] = 6; + } + public override int PearlType => ItemID.BlackPearl; + public override float SpawnRate => 0.05f; + public override int ItemType => ModContent.ItemType(); + } + public class PearlpodGold : Pearlpod + { + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + Main.npcFrameCount[NPC.type] = 6; + } + public override void SetDefaults() + { + NPC.aiStyle = NPCAIStyleID.Snail; + NPC.damage = 0; + NPC.width = 24; + NPC.height = 24; + NPC.defense = 0; + NPC.lifeMax = 20; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lavaImmune = false; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.GravityIgnoresLiquid = true; + AIType = NPCID.Snail; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.catchItem = ItemType; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.rarity = 3; + } + public override int PearlType => ItemID.GoldCoin; + public override float SpawnRate => 0.0005f; + public override int ItemType => ModContent.ItemType(); + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + } + } +} diff --git a/NPCs/SunkenSea/PearlpodBlack.png b/NPCs/SunkenSea/PearlpodBlack.png new file mode 100644 index 0000000000..d5712b33f6 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodBlack.png differ diff --git a/NPCs/SunkenSea/PearlpodGold.png b/NPCs/SunkenSea/PearlpodGold.png new file mode 100644 index 0000000000..e6e92061d2 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodGold.png differ diff --git a/NPCs/SunkenSea/PearlpodPink.png b/NPCs/SunkenSea/PearlpodPink.png new file mode 100644 index 0000000000..3c54290643 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodPink.png differ diff --git a/NPCs/SunkenSea/PearlpodWhite.png b/NPCs/SunkenSea/PearlpodWhite.png new file mode 100644 index 0000000000..97ccc73385 Binary files /dev/null and b/NPCs/SunkenSea/PearlpodWhite.png differ diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs new file mode 100644 index 0000000000..d1c14b8688 --- /dev/null +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -0,0 +1,238 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Critters; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class PolypPanasea : ModNPC + { + #region Textures + // Welcome to the fish texture wall, have a nice stay, or just collapse this region, either works + public static Texture2D RadiantTexture; + public static Texture2D GreenTexture; + public static Texture2D PurpleTexture; + public static Texture2D TurquoiseTexture; + public static Texture2D GoldTexture; + public static Texture2D TextureCoated; + public static Texture2D RadiantTextureCoated; + public static Texture2D GreenTextureCoated; + public static Texture2D PurpleTextureCoated; + public static Texture2D TurquoiseTextureCoated; + public static Texture2D GoldTextureCoated; + #endregion + public ref float Variant => ref NPC.ai[1]; + public enum FishColor + { + Red = 0, + Turquoise = 1, + Green = 2, + Purple = 3, + Gold = 4, + Radiant = 5 + } + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 6; + if (!Main.dedServ) + { + RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiant", AssetRequestMode.ImmediateLoad).Value; + GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGold", AssetRequestMode.ImmediateLoad).Value; + GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreen", AssetRequestMode.ImmediateLoad).Value; + PurpleTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurple", AssetRequestMode.ImmediateLoad).Value; + TurquoiseTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoise", AssetRequestMode.ImmediateLoad).Value; + TextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRedCoated", AssetRequestMode.ImmediateLoad).Value; + RadiantTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaRadiantCoated", AssetRequestMode.ImmediateLoad).Value; + GoldTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGoldCoated", AssetRequestMode.ImmediateLoad).Value; + GreenTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaGreenCoated", AssetRequestMode.ImmediateLoad).Value; + PurpleTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaPurpleCoated", AssetRequestMode.ImmediateLoad).Value; + TurquoiseTextureCoated = ModContent.Request("CalamityMod/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated", AssetRequestMode.ImmediateLoad).Value; + } + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + } + + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void OnSpawn(IEntitySource source) + { + // Panaseas released by the player do not randomize when spawned + if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) + { + return; + } + // Randomize the color of the fish + NPC.ai[1] = Main.rand.Next(0, 4); + // 1 in 30 chance for a rare fish variant (rfv) + if (Main.rand.NextBool(30)) + { + NPC.ai[1] = Main.rand.Next(4, 6); + } + // 1 in 5 chance for a Panasea to be coated + if (Main.rand.NextBool(5)) + { + NPC.ai[2] = 61; + } + switch (NPC.ai[1]) + { + case (int)FishColor.Purple: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Green: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Turquoise: + NPC.catchItem = ModContent.ItemType(); + break; + case (int)FishColor.Gold: + { + NPC.catchItem = ModContent.ItemType(); + NPC.rarity = 3; + } + break; + case (int)FishColor.Radiant: + NPC.catchItem = ModContent.ItemType(); + break; + } + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.PolypPanasea") + }); + } + + public override void AI() + { + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 60f, 0.2f, 0.1f, 4f, 4f, 0.05f); + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + // Assure it cant be caught when collecting panacea + if (NPC.ai[2] <= 60 && NPC.ai[2] > 0) + { + NPC.ai[2]--; + } + if (Variant == (int)FishColor.Gold) + { + NPC.ProduceGoldCritterDust(); + NPC.rarity = 3; + } + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + { + NPC.frameCounter = 0.0; + return; + } + NPC.frameCounter += 0.1f; + NPC.frameCounter %= Main.npcFrameCount[NPC.type]; + int frame = (int)NPC.frameCounter; + NPC.frame.Y = frame * frameHeight; + NPC.ai[3] = frame; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSeaPolyp && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture = TextureAssets.Npc[NPC.type].Value; + switch (Variant) + { + case (int)FishColor.Radiant: + texture = NPC.ai[2] >= 61 ? RadiantTextureCoated : RadiantTexture; + break; + case (int)FishColor.Gold: + texture = NPC.ai[2] >= 61 ? GoldTextureCoated : GoldTexture; + break; + case (int)FishColor.Purple: + texture = NPC.ai[2] >= 61 ? PurpleTextureCoated : PurpleTexture; + break; + case (int)FishColor.Green: + texture = NPC.ai[2] >= 61 ? GreenTextureCoated : GreenTexture; + break; + case (int)FishColor.Turquoise: + texture = NPC.ai[2] >= 61 ? TurquoiseTextureCoated : TurquoiseTexture; + break; + case (int)FishColor.Red: + texture = NPC.ai[2] >= 61 ? TextureCoated : TextureAssets.Npc[NPC.type].Value; + break; + } + Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Rectangle frame = texture.Frame(1, 6, 0, (int)NPC.ai[3]); + spriteBatch.Draw(texture, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + + return false; + } + public override bool? CanBeCaughtBy(Item item, Player player) + { + if (NPC.ai[2] > 0) + { + if (NPC.ai[2] > 60) + { + Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ItemID.FlaskofPoison); + NPC.ai[2] = 60; + } + return false; + } + return null; + } + } +} diff --git a/NPCs/SunkenSea/PolypPanasea.png b/NPCs/SunkenSea/PolypPanasea.png new file mode 100644 index 0000000000..08ba323d31 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanasea.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGold.png b/NPCs/SunkenSea/PolypPanaseaGold.png new file mode 100644 index 0000000000..a48da65906 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGold.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGoldCoated.png b/NPCs/SunkenSea/PolypPanaseaGoldCoated.png new file mode 100644 index 0000000000..47dddda974 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGoldCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreen.png b/NPCs/SunkenSea/PolypPanaseaGreen.png new file mode 100644 index 0000000000..7bd323fb82 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGreen.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaGreenCoated.png b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png new file mode 100644 index 0000000000..1f46bf5148 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaGreenCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurple.png b/NPCs/SunkenSea/PolypPanaseaPurple.png new file mode 100644 index 0000000000..3871e4e412 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaPurple.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png new file mode 100644 index 0000000000..6d9f423150 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaPurpleCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiant.png b/NPCs/SunkenSea/PolypPanaseaRadiant.png new file mode 100644 index 0000000000..2099da1dfb Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRadiant.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png b/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png new file mode 100644 index 0000000000..74c021ef11 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRadiantCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaRedCoated.png b/NPCs/SunkenSea/PolypPanaseaRedCoated.png new file mode 100644 index 0000000000..bfbf7ba316 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaRedCoated.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoise.png b/NPCs/SunkenSea/PolypPanaseaTurquoise.png new file mode 100644 index 0000000000..e45b512f09 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaTurquoise.png differ diff --git a/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png new file mode 100644 index 0000000000..3d4c9475f8 Binary files /dev/null and b/NPCs/SunkenSea/PolypPanaseaTurquoiseCoated.png differ diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs new file mode 100644 index 0000000000..d8a75e80d7 --- /dev/null +++ b/NPCs/SunkenSea/Probesnout.cs @@ -0,0 +1,350 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Probesnout : SunkenSeaNPC + { + public static float PathDetectionSize = 300f; + + #region Members + + protected override List HuntNPCs => new() + { + // NPCType(), + }; + + protected override List AvoidNPCs => new() + { + // NPCType(), + NPCType(), + // NPCType(), + // NPCType(), + // NPCType(), + }; + + private enum PersonalityType { Curious, Shy, Paranoid } + + private PersonalityType Personality + { + get => (PersonalityType)NPC.ai[0]; + set + { + NPC.ai[0] = (float)value; + NetUpdate(); + } + } + + private enum AnimationState { Idle, Attack } + + private AnimationState Animation + { + get => (AnimationState)NPC.ai[1]; + set + { + if (value != Animation) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0; + } + + switch (value) + { + case AnimationState.Idle: + AnimationFrames = 8; + TimePerAnimationFrame = 5; + break; + case AnimationState.Attack: + AnimationFrames = 12; + TimePerAnimationFrame = 7; + break; + } + + NPC.ai[1] = (float)value; + NetUpdate(); + } + } + + private int AnimationFrames = 8; + + private int TimePerAnimationFrame = 5; + + private float MaximumSpeed = 6f; + + private Vector2 ScaleSquish = Vector2.One; + + #endregion + + #region AI + + protected override void CreatureOnSpawn() + { + CurrentBehavior = IdleBehavior; + + WeightedRandom randomPersonality = new(); + randomPersonality.Add(PersonalityType.Curious, 0.6f); + randomPersonality.Add(PersonalityType.Shy, 0.3f); + randomPersonality.Add(PersonalityType.Paranoid, 0.1f); + Personality = randomPersonality.Get(); + + NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + NPC.GravityMultiplier *= 2f; + NPC.MaxFallSpeedMultiplier *= 2f; + } + + protected override void CreatureAI() + { + CurrentBehavior.Invoke(); + + if (!NPC.velocity.HasNaNs()) + ConeDetectionDirection = (NPC.rotation * MathF.Sign(NPC.velocity.Y) + (NPC.spriteDirection == -1 ? MathHelper.Pi : 0f)).ToRotationVector2(); + + NPC.rotation = MathHelper.ToRadians(NPC.velocity.Length() * 3f) * MathF.Sign(NPC.velocity.X); + + if (MathF.Abs(NPC.velocity.X) > 2f) + NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); + + if (!NPC.wet) + CurrentBehavior = OutsideWaterBehavior; + + if (NPC.velocity.LengthSquared() > MaximumSpeed * MaximumSpeed) + NPC.velocity = NPC.velocity.SafeNormalize(-Vector2.UnitY) * MaximumSpeed; + + if (ScaleSquish.Y > 1f) + ScaleSquish.Y -= 0.025f; + + if (ScaleSquish.Y < 1f) + ScaleSquish.Y = 1f; + } + + protected override void OnBehaviorChange(Action newBehavior) => NPC.noGravity = newBehavior != OutsideWaterBehavior; + + protected override void OnPreyDetection(NPC prey) + { + // If it's not a small fish and it's not being chased by a predator, the Probesnout may hunt. + if (CurrentPredator is null) + { + CurrentBehavior = HuntBehavior; + React(Color.Orange * 0.6f, EmoteExpressionParticle.EmoteType.Exclamation, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + } + + ScaleSquish.Y += 1.4f; + } + + protected override void OnPredatorDetection(NPC predator) + { + // Regardless of anything, if it detects a predator, time to run. + CurrentBehavior = AvoidBehavior; + + MaximumSpeed *= 1.2f; + + React(Color.Red * 0.6f, EmoteExpressionParticle.EmoteType.DoubleExclamation, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + + ScaleSquish.Y += 1.4f; + } + + protected override void OnPlayerDetection(Player player) + { + // If the Probesnout is shy, it'll run away from the player. + if (Personality == PersonalityType.Shy) + { + CurrentBehavior = AvoidBehavior; + React(Color.Orange, EmoteExpressionParticle.EmoteType.QuestionExclamation, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + } + + if (Personality == PersonalityType.Curious) + React(Color.Green, EmoteExpressionParticle.EmoteType.Question, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + + ScaleSquish.Y += 0.4f; + } + + private void IdleBehavior() + { + if (PathfindingPoints is null) + { + NPC.velocity *= 0.95f; + + if (Main.rand.NextBool(125)) + MakePath(NPC.Center + Main.rand.NextVector2CircularEdge(PathDetectionSize, PathDetectionSize) * Main.rand.NextFloat(0.75f, 1f)); + } + else + GenericPathFollowing(acceleration: 0.03f, pathFollowingSpeed: 0.07f, conditionToFinishFollowing: FinishedPathfinding()); + } + + private void AvoidBehavior() + { + // Depending on the personality, the Sharkoon will choose who to avoid. + Entity entityToAvoid = null; + switch (Personality) + { + case PersonalityType.Shy: + entityToAvoid = (NearestEntity is NPC && HuntNPCs.Contains((NearestEntity as NPC).type)) ? null : NearestEntity; + break; + case PersonalityType.Curious: + entityToAvoid = CurrentPredator; + break; + case PersonalityType.Paranoid: + entityToAvoid = CurrentPredator; + break; + } + + // If there aren't any more targets detected, go back to idling. + if (entityToAvoid is null) + { + CurrentBehavior = IdleBehavior; + MaximumSpeed /= MaximumSpeed % 1.2f == 0f ? 1.2f : 1f; + return; + } + + bool isAvoidingPredator = entityToAvoid is NPC && (entityToAvoid as NPC).whoAmI == CurrentPredator.whoAmI; + + if (PathfindingPoints is null) + { + float fleeingDistance = isAvoidingPredator ? 600f : 300f; + + Point randomEscapePoint = (NPC.Center + NPC.DirectionFrom(entityToAvoid.Center).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(fleeingDistance, fleeingDistance + 100f)).ToSafeTileCoordinates(); + + var grid = CalamityUtils.AStar.MakeGenericGrid(NPC.Center, fleeingDistance); + + while (!grid.Contains(randomEscapePoint)) + randomEscapePoint = (NPC.Center + NPC.DirectionFrom(entityToAvoid.Center).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(fleeingDistance, fleeingDistance + 100f)).ToSafeTileCoordinates(); + + MakePath(randomEscapePoint.ToWorldCoordinates(), grid); + } + else + GenericPathFollowing(acceleration: 0.14f * (isAvoidingPredator ? 2f : 1f), pathFollowingSpeed: 0.07f * (isAvoidingPredator ? 2.2f : 1f), conditionToFinishFollowing: FinishedPathfinding()); + } + + private void HuntBehavior() + { + // If there's no more prey, go back to idling. + if (CurrentPrey is null) + { + CurrentBehavior = IdleBehavior; + return; + } + + if (!HasLineOfSight(CurrentPrey.Center)) + { + if (PathfindingPoints is not null) + GenericPathFollowing(acceleration: 0.14f, pathFollowingSpeed: 0.1f, conditionToFinishFollowing: FinishedPathfinding()); + else + MakePath(CurrentPrey.Center, CalamityUtils.ManhattanDistance(NPC.Center, CurrentPrey.Center)); + } + else + NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * 0.14f; + } + + private void OutsideWaterBehavior() + { + if (NPC.wet) + CurrentBehavior = PreviousBehavior; + } + + #endregion + + #region Drawing & Animation + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > TimePerAnimationFrame) + { + NPC.frame.Y += frameHeight; + NPC.frame.Y = Math.Min(NPC.frame.Y, AnimationFrames * frameHeight); + NPC.frame.Y = NPC.frame.Y % (AnimationFrames * frameHeight); + NPC.frameCounter = 0; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 drawPosition = NPC.Center - screenPos; + Rectangle frame = texture.Frame(horizontalFrames: 2, verticalFrames: 12, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); + Vector2 anchorPoint = frame.Size() * 0.5f; + SpriteEffects flip = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); + + return false; + } + + #endregion + + #region Other ModNPC Overrides + + protected override void ExtraSetStaticDefaults() + { + Main.npcFrameCount[Type] = 15; + Main.npcCatchable[Type] = true; + NPCID.Sets.CountsAsCritter[Type] = true; + } + + public override void SetDefaults() + { + NPC.lifeMax = 5; + + NPC.aiStyle = -1; + AIType = -1; + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.chaseable = false; + + NPC.width = 44; + NPC.height = 55; + + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + #endregion + + #region Syncing + + protected override void SendMoreExtraAI(BinaryWriter writer) + { + writer.Write7BitEncodedInt(AnimationFrames); + writer.Write7BitEncodedInt(TimePerAnimationFrame); + } + + protected override void ReceiveMoreExtraAI(BinaryReader reader) + { + AnimationFrames = reader.Read7BitEncodedInt(); + TimePerAnimationFrame = reader.Read7BitEncodedInt(); + } + + #endregion + } + + public class ProbesnoutGold : Probesnout + { + protected override void ExtraSetStaticDefaults() + { + base.ExtraSetStaticDefaults(); + this.HideFromBestiary(); + } + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.rarity = 3; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int i = 0; i < 5; i++) + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f); + } + } +} diff --git a/NPCs/SunkenSea/Probesnout.png b/NPCs/SunkenSea/Probesnout.png new file mode 100644 index 0000000000..ed19b8ecb7 Binary files /dev/null and b/NPCs/SunkenSea/Probesnout.png differ diff --git a/NPCs/SunkenSea/ProbesnoutGold.png b/NPCs/SunkenSea/ProbesnoutGold.png new file mode 100644 index 0000000000..81f7389093 Binary files /dev/null and b/NPCs/SunkenSea/ProbesnoutGold.png differ diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs new file mode 100644 index 0000000000..38c002c8d3 --- /dev/null +++ b/NPCs/SunkenSea/SandProwler.cs @@ -0,0 +1,637 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class SandProwler : ModNPC + { + public const int maxLength = 14; + public float speed = 3f; + public float turnSpeed = 0.0625f; + bool TailSpawned = false; + #region Textures + public static Asset BodySprite1; + public static Asset BodySprite2; + public static Asset BodySprite3; + public static Asset BodySprite4; + public static Asset BodySprite5; + public static Asset BodySprite6; + public static Asset BodySprite7; + public static Asset TailSprite; + #endregion + + public enum AnimType + { + None = 0, + Blink = 1, + Bite = 2 + } + + public bool IsHead => NPC.ai[3] == 0; + + public bool IsTail => NPC.ai[3] == 8; + + public ref float CurrentAnimation => ref NPC.localAI[1]; + + public ref float CurrentFrame => ref NPC.localAI[0]; + + public ref float BlinkTimer => ref NPC.localAI[2]; + + public override void SetStaticDefaults() + { + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", + PortraitPositionXOverride = 40, + PortraitPositionYOverride = 20 + }; + value.Position.Y += 20; + value.Position.X += 40; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.CantTakeLunchMoney[Type] = true; // It will only eat coins that the AI says it can, and when it does, you aren't getting them back + if (!Main.dedServ) + { + BodySprite1 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler2", AssetRequestMode.AsyncLoad); + BodySprite2 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler3", AssetRequestMode.AsyncLoad); + BodySprite3 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler4", AssetRequestMode.AsyncLoad); + BodySprite4 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler5", AssetRequestMode.AsyncLoad); + BodySprite5 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler6", AssetRequestMode.AsyncLoad); + BodySprite6 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler7", AssetRequestMode.AsyncLoad); + BodySprite7 = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler8", AssetRequestMode.AsyncLoad); + TailSprite = ModContent.Request("CalamityMod/NPCs/SunkenSea/SandProwler9", AssetRequestMode.AsyncLoad); + } + Main.npcFrameCount[Type] = 11; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 30; + NPC.height = 24; + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + NPC.waterMovementSpeed = 1; + NPC.GravityIgnoresLiquid = true; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + // only the head gets a healthbar + return IsHead; + } + + + public override void AI() + { + if (IsHead) + HeadAI(); + else + SegmentAI(); + } + public void HeadAI() + { + Point point = NPC.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; + if (createDust) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, 204, 0f, 0f, 150, default(Color), 0.3f); + dust.fadeIn = 0.75f; + dust.velocity *= 0.1f; + dust.noLight = true; + } + } + + if (NPC.ai[2] > 0f) + { + NPC.realLife = (int)NPC.ai[2]; + } + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) + { + NPC.TargetClosest(true); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + for (int segment = 0; segment < maxLength; segment++) + { + int lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = (float)NPC.whoAmI; + Main.npc[lol].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)lol; + float spriteUse = segment % 2 == 0 ? 3 : 4; // Looping body 3 and 4 + int width = 18; + switch (segment) + { + case maxLength - 1: + spriteUse = 8; // Tail + break; + case maxLength - 2: + spriteUse = 7; // Body 7 + width = 14 ; + break; + case maxLength - 3: + spriteUse = 6; // Body 6 + width = 16; + break; + case maxLength - 4: + spriteUse = 5; // Body 5 + break; + case 0: + spriteUse = 1; // Body 1 + break; + case 1: + spriteUse = 2; // Body 2 + break; + } + Main.npc[lol].ai[3] = spriteUse; + Main.npc[lol].npcSlots = 0; + Main.npc[lol].dontCountMe = true; + Main.npc[lol].width = width; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + TailSpawned = true; + } + } + if (NPC.velocity.X < 0f) + { + NPC.spriteDirection = -1; + } + else if (NPC.velocity.X > 0f) + { + NPC.spriteDirection = 1; + } + if (Main.player[NPC.target].dead) + { + NPC.TargetClosest(false); + } + NPC.alpha -= 42; + if (NPC.alpha < 0) + { + NPC.alpha = 0; + } + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) + { + NPC.active = false; + } + float currentSpeed = speed; + float currentTurnSpeed = turnSpeed; + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + bool coinTarget = false; + // Look for silver and gold coins to eat + for (int i = 0; i < Main.maxItems; i++) + { + Item item = Main.item[i]; + // continue if not an active silver or gold coin + if (item == null || !item.active || (item.type != ItemID.SilverCoin && item.type != ItemID.GoldCoin)) + continue; + // can only look for coins in a 75 tile radius + if (item.Distance(NPC.Center) > 1200) + continue; + // if its head touches the coin, eat it + if (item.getRect().Intersects(NPC.getRect())) + { + SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); + SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); + int dustType = item.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; + for (int j = 0; j < 4; j++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + } + item.active = false; + break; + } + // if it isn't touching the coin, go to it + targetXDist = item.Center.X; + targetYDist = item.Center.Y; + coinTarget = true; + break; + } + // aggro on coins takes priority over players + if (NPC.life > NPC.lifeMax * 0.99 && !coinTarget) + { + targetYDist += 300; + if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) + { + if (NPC.velocity.X > 0f) + { + targetXDist = Main.player[NPC.target].Center.X + 300f; + } + else + { + targetXDist = Main.player[NPC.target].Center.X - 300f; + } + } + + // Blink every so often + if (Main.rand.NextBool(600) && CurrentAnimation == (int)AnimType.None && BlinkTimer <= 0) + { + CurrentAnimation = (int)AnimType.Blink; + BlinkTimer = Main.rand.NextBool(4) ? 48 : 24; + } + } + else + { + currentSpeed *= 1.5f; + currentTurnSpeed *= 1.5f; + } + float maxCurrentSpeed = currentSpeed * 1.3f; + float minCurrentSpeed = currentSpeed * 0.7f; + float speedCompare = NPC.velocity.Length(); + if (speedCompare > 0f) + { + if (speedCompare > maxCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= maxCurrentSpeed; + } + else if (speedCompare < minCurrentSpeed) + { + NPC.velocity.Normalize(); + NPC.velocity *= minCurrentSpeed; + } + } + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float absoluteTargetX = System.Math.Abs(targetXDist); + float absoluteTargetY = System.Math.Abs(targetYDist); + float timeToReachTarget = currentSpeed / targetDistance; + targetXDist *= timeToReachTarget; + targetYDist *= timeToReachTarget; + if (targetDistance < 128 && (NPC.life <= NPC.lifeMax * 0.99 || coinTarget)) + { + CurrentAnimation = (int)AnimType.Bite; + } + else if (CurrentAnimation != (int)AnimType.Blink) + { + CurrentAnimation = (int)AnimType.None; + } + BlinkTimer--; + if (BlinkTimer <= 0) + { + BlinkTimer = 0; + if (CurrentAnimation == (int)AnimType.Blink) + { + CurrentAnimation = (int)AnimType.None; + } + } + if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; + } + } + if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 + } + } + } + else + { + if (absoluteTargetX > absoluteTargetY) + { + if (NPC.velocity.X < targetXDist) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 + } + else if (NPC.velocity.X > targetXDist) + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; + } + else + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; + } + } + } + else + { + if (NPC.velocity.Y < targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; + } + else if (NPC.velocity.Y > targetYDist) + { + NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; + } + if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + { + NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; + } + else + { + NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; + } + } + } + } + NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; + } + + public void SegmentAI() + { + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); + float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); + targetXDist = (float)((int)(targetXDist / 16f) * 16); + targetYDist = (float)((int)(targetYDist / 16f) * 16); + segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); + segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); + targetXDist -= segmentPosition.X; + targetYDist -= segmentPosition.Y; + float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) + { + try + { + segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); + float headDivisor = 1; + targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2 / headDivisor) - segmentPosition.X; + targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; + } + catch + { + } + NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; + targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + int segmentWidth = NPC.width; + targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + targetXDist; + NPC.position.Y = NPC.position.Y + targetYDist; + + if (targetXDist < 0f) + NPC.spriteDirection = -1; + else if (targetXDist > 0f) + NPC.spriteDirection = 1; + } + } + + public override void FindFrame(int frameHeight) + { + if (IsTail) + { + NPC.frameCounter++; + if (NPC.frameCounter > 6) + { + NPC.localAI[0]++; + NPC.frameCounter = 0; + } + if (NPC.localAI[0] > 7) + { + NPC.localAI[0] = 0; + } + } + if (IsHead) + { + NPC.frameCounter++; + if (NPC.frameCounter > 6) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + switch (CurrentAnimation) + { + case (int)AnimType.None: + NPC.frame.Y = 0; + break; + case (int)AnimType.Bite: + if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) + { + NPC.frame.Y = frameHeight * 5; + } + break; + case (int)AnimType.Blink: + if (NPC.frame.Y < frameHeight || NPC.frame.Y > frameHeight * 4) + { + NPC.frame.Y = frameHeight; + } + break; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && + !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override bool CheckActive() + { + return IsHead; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); + + public static void DefineSandProwlerLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 4); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.Server) + { + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D segmentSprite = TextureAssets.Npc[Type].Value; + switch (NPC.ai[3]) + { + case 0: + break; + case 1: + segmentSprite = BodySprite1.Value; + break; + case 2: + segmentSprite = BodySprite2.Value; + break; + case 3: + segmentSprite = BodySprite3.Value; + break; + case 4: + segmentSprite = BodySprite4.Value; + break; + case 5: + segmentSprite = BodySprite5.Value; + break; + case 6: + segmentSprite = BodySprite6.Value; + break; + case 7: + segmentSprite = BodySprite7.Value; + break; + case 8: + segmentSprite = TailSprite.Value; + break; + default: + segmentSprite = NPC.ai[3] % 2 == 0 ? BodySprite4.Value : BodySprite3.Value; + break; + } + float frameDivisor = IsTail ? 8 : IsHead ? Main.npcFrameCount[Type] : 1; + Vector2 origin = new Vector2(segmentSprite.Width / 2, segmentSprite.Height / 2 / frameDivisor); + Vector2 npcOffset = NPC.Center - screenPos; + npcOffset -= new Vector2(segmentSprite.Width, segmentSprite.Height / frameDivisor) * NPC.scale / 2f; + npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + SpriteEffects fx = NPC.oldPos[1].X < NPC.position.X ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Rectangle frame = segmentSprite.Frame(1, 1, 0, 0); + if (IsHead) + { + frame = NPC.frame; + } + else if (IsTail) + { + frame = segmentSprite.Frame(1, 8, 0, (int)NPC.localAI[0]); + } + spriteBatch.Draw(segmentSprite, npcOffset, frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, fx, 0f); + return false; + } + } +} diff --git a/NPCs/SunkenSea/SandProwler.png b/NPCs/SunkenSea/SandProwler.png new file mode 100644 index 0000000000..a36c31ffbb Binary files /dev/null and b/NPCs/SunkenSea/SandProwler.png differ diff --git a/NPCs/SunkenSea/SandProwler2.png b/NPCs/SunkenSea/SandProwler2.png new file mode 100644 index 0000000000..bb3fe551b5 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler2.png differ diff --git a/NPCs/SunkenSea/SandProwler3.png b/NPCs/SunkenSea/SandProwler3.png new file mode 100644 index 0000000000..7a33532959 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler3.png differ diff --git a/NPCs/SunkenSea/SandProwler4.png b/NPCs/SunkenSea/SandProwler4.png new file mode 100644 index 0000000000..8588ffaa7e Binary files /dev/null and b/NPCs/SunkenSea/SandProwler4.png differ diff --git a/NPCs/SunkenSea/SandProwler5.png b/NPCs/SunkenSea/SandProwler5.png new file mode 100644 index 0000000000..c1b0777eeb Binary files /dev/null and b/NPCs/SunkenSea/SandProwler5.png differ diff --git a/NPCs/SunkenSea/SandProwler6.png b/NPCs/SunkenSea/SandProwler6.png new file mode 100644 index 0000000000..b9304a7630 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler6.png differ diff --git a/NPCs/SunkenSea/SandProwler7.png b/NPCs/SunkenSea/SandProwler7.png new file mode 100644 index 0000000000..bbed0cae7f Binary files /dev/null and b/NPCs/SunkenSea/SandProwler7.png differ diff --git a/NPCs/SunkenSea/SandProwler8.png b/NPCs/SunkenSea/SandProwler8.png new file mode 100644 index 0000000000..c722b5e8f5 Binary files /dev/null and b/NPCs/SunkenSea/SandProwler8.png differ diff --git a/NPCs/SunkenSea/SandProwler9.png b/NPCs/SunkenSea/SandProwler9.png new file mode 100644 index 0000000000..594b3586ae Binary files /dev/null and b/NPCs/SunkenSea/SandProwler9.png differ diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs new file mode 100644 index 0000000000..12ae5ed946 --- /dev/null +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -0,0 +1,484 @@ +using System; +using CalamityMod.BiomeManagers; +using CalamityMod.DataStructures; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.GameContent.Bestiary; +using CalamityMod.NPCs.Crags; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class SandProwlerNested : ModNPC + { + public bool PeekingOut; + public bool HasChosenSpotToHideIn => SpotToHideIn != Vector2.Zero; + public Point TileCoordsToHideIn + { + get => SpotToHideIn.ToTileCoordinates(); + set => SpotToHideIn = value.ToWorldCoordinates(); + } + public Vector2 SpotToHideIn + { + get => new Vector2(NPC.ai[0], NPC.ai[1]); + set + { + NPC.ai[0] = value.X; + NPC.ai[1] = value.Y; + } + } + + public bool InHidingSpot => NPC.WithinRange(SpotToHideIn, 8f); + + public bool RetreatingToHidingSpot + { + get => NPC.ai[2] == 1f; + set => NPC.ai[2] = value.ToInt(); + } + + public ref float SnapTimer => ref NPC.ai[3]; + public ref float SnapCooldown => ref NPC.localAI[0]; + public ref float InitialSnapDirection => ref NPC.localAI[1]; + public ref float CurrentSnapDirection => ref NPC.localAI[2]; + public override string Texture => "CalamityMod/NPCs/SunkenSea/SandProwler"; + + public override void SetStaticDefaults() + { + this.HideFromBestiary(); + NPCID.Sets.TrailingMode[NPC.type] = 0; + NPCID.Sets.TrailCacheLength[NPC.type] = 60; + NPCID.Sets.UsesNewTargetting[NPC.type] = true; + NPCID.Sets.CantTakeLunchMoney[Type] = true; + Main.npcFrameCount[Type] = 11; + } + + public override void SetDefaults() + { + NPC.damage = 50; + NPC.width = 30; + NPC.height = 30; //32 + NPC.defense = 10; + NPC.lifeMax = 3000; + NPC.aiStyle = -1; + AIType = -1; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.behindTiles = true; + NPC.noGravity = true; + NPC.noTileCollide = true; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.netAlways = true; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + + NPC.waterMovementSpeed = 1f; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(PeekingOut); + writer.Write(SnapCooldown); + writer.Write(InitialSnapDirection); + writer.Write(CurrentSnapDirection); + writer.Write(NPC.Calamity().newAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + PeekingOut = reader.ReadBoolean(); + SnapCooldown = reader.ReadSingle(); + InitialSnapDirection = reader.ReadSingle(); + CurrentSnapDirection = reader.ReadSingle(); + NPC.Calamity().newAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + // Choose an initial tile to hide in. + if (Main.netMode != NetmodeID.MultiplayerClient && !HasChosenSpotToHideIn) + { + int tries; + for (tries = 0; tries < 1800; tries++) + { + int x = (int)(NPC.Center.X / 16f) + Main.rand.Next(-25, 25); + int y = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-25, 25); + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + + // Try again if the tile isn't solid or isn't exposed to air. + if (!WorldGen.SolidTile(tile) || !CalamityUtils.IsTileExposedToAir(x, y, out float? angleToOpenAir)) + continue; + + // Try again if there's no open water near the tile. + Vector2 moveDirection = angleToOpenAir.Value.ToRotationVector2(); + Vector2 collisionCheckPosition = new Vector2(x * 16f + 8f, y * 16f + 8f) + moveDirection * 16f; + float collisionDistance = CalamityUtils.DistanceToTileCollisionHit(collisionCheckPosition, moveDirection, 20) ?? 20; + if (collisionDistance <= 10) + continue; + + TileCoordsToHideIn = new Point(x, y); + break; + } + + // Just die if no spot was suitable. + if (tries >= 1799) + NPC.active = false; + + NPC.Center = SpotToHideIn; + NPC.netUpdate = true; + } + + Entity target = null; + + // Look for coins + for (int i = 0; i < Main.maxItems; i++) + { + Item n = Main.item[i]; + if (n == null || !n.active || (n.type != ItemID.SilverCoin && n.type != ItemID.GoldCoin)) + continue; + // if its head touches the coin, eat it + if (n.getRect().Intersects(NPC.getRect())) + { + SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 1.2f, Volume = 0.8f }, NPC.Center); + SoundEngine.PlaySound(SoundID.CoinPickup, NPC.Center); + int dustType = n.type == ItemID.SilverCoin ? DustID.SilverCoin : DustID.GoldCoin; + for (int j = 0; j < 4; j++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + } + n.active = false; + break; + } + // Set the coin as the target + if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) + { + target = n; + } + } + // Go after sea minnows if not distracted by shiny coin + if (target == null) + { + if (NPC.life > NPC.lifeMax * 0.99f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC n = Main.npc[i]; + if (n == null || !n.active || n.type != ModContent.NPCType()) + continue; + if (n.Distance(NPC.Center) <= 300 && Collision.CheckAABBvLineCollision(NPC.Center, NPC.Size, NPC.Center, n.Center)) + { + target = n; + } + } + } + // If you've pissed it off, it now goes after YOU + else + { + NPC.TargetClosest(false); + target = Main.player[NPC.target]; + } + } + + // Open mouth when launching towards a target + if (SnapTimer > 0 && target != null && !PeekingOut) + { + NPC.Calamity().newAI[1] = 1; + } + else if (RetreatingToHidingSpot || InHidingSpot) + { + NPC.Calamity().newAI[1] = 0; + } + + // Become invulnerable and mostly transparent if hiding in a tile. + NPC.dontTakeDamage = InHidingSpot; + NPC.Opacity = MathHelper.Clamp(NPC.Opacity - NPC.dontTakeDamage.ToDirectionInt(), 0.35f, 1f); + + // Also emit some particle effects as an indicator. + if (InHidingSpot) + { + Dust sparkle = Dust.NewDustDirect(TileCoordsToHideIn.ToWorldCoordinates(0, 0), 16, 16, 261); + sparkle.color = Color.Orange; + sparkle.velocity = Main.rand.NextVector2Circular(4f, 4f); + sparkle.noGravity = true; + } + + // Decide rotation. + NPC.rotation = NPC.AngleFrom(SpotToHideIn) + MathHelper.PiOver2; + + // Prevent the tile from being destroyed. + FixExploitManEaters.ProtectSpot(TileCoordsToHideIn.X, TileCoordsToHideIn.Y); + + // Do nothing other than hiding if instructed to do so. + if (RetreatingToHidingSpot) + { + NPC.velocity = NPC.SafeDirectionTo(SpotToHideIn) * 0.002f; + NPC.position += NPC.velocity.SafeNormalize(Vector2.Zero) * 5f; + + // Stop once the hiding spot has been reached. + if (InHidingSpot) + { + NPC.Center = SpotToHideIn; + NPC.velocity = Vector2.Zero; + RetreatingToHidingSpot = false; + NPC.netUpdate = true; + } + + return; + } + + // Don't do any snapping and such if the cooldown is active. + if (SnapCooldown > 0f) + { + SnapCooldown--; + if (SnapCooldown <= 0f) + NPC.netUpdate = true; + return; + } + + if (SnapTimer > 0f) + { + int snapTime = PeekingOut ? 45 : 32; + float idealSpeed = PeekingOut ? 1.75f : 10f; + float newSpeed = MathHelper.Lerp(NPC.velocity.Length(), idealSpeed, 0.08f); + NPC.velocity = CurrentSnapDirection.ToRotationVector2() * newSpeed; + + // Get closer to the target if one not peeking. + if (!PeekingOut && target != null) + CurrentSnapDirection = CurrentSnapDirection.AngleTowards(NPC.AngleTo(target.Center), 0.0125f); + + // Retreat if velocity is zero for some reason. + if (NPC.velocity == Vector2.Zero) + { + SnapTimer = 0f; + RetreatingToHidingSpot = true; + NPC.netUpdate = true; + return; + } + + SnapTimer++; + if (SnapTimer >= snapTime || (Collision.SolidCollision(NPC.Center, 1, 1) && SnapTimer > 5f)) + { + SnapTimer = 0f; + SnapCooldown = 35f; + PeekingOut = false; + RetreatingToHidingSpot = true; + } + + return; + } + + Vector2 snapDirection = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 * Main.rand.Next(4)); + + // Pick a potential direction to snap out. + // This is important for attacking. + int snapDirectionTries = 0; + float targetSnapAngularThreshold = 0.48f; + while ((CalamityUtils.DistanceToTileCollisionHit(SpotToHideIn, snapDirection, 50) ?? 50f) < 5f) + { + snapDirectionTries++; + snapDirection = snapDirection.RotatedBy(MathHelper.PiOver2); + + if (snapDirectionTries >= 8) + return; + + // Try again if there's a defined target and it isn't in the line of sight of the current direction. + if (target != null && snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) > targetSnapAngularThreshold) + continue; + } + + // Snap out if a suitable target gets close. + // Otherwise, sometimes randomly peek out. + bool canSnapAtTarget = + target != null && + snapDirection.AngleBetween(NPC.SafeDirectionTo(target.Center)) < targetSnapAngularThreshold && + Collision.CanHit(NPC.Center + snapDirection * 12f, 1, 1, target.Center, 1, 1); + if (Main.rand.NextBool(30) && !canSnapAtTarget) + PeekingOut = true; + + if (PeekingOut || canSnapAtTarget) + { + if (canSnapAtTarget) + SoundEngine.PlaySound(SoundID.Item96, NPC.Center); + else + SoundEngine.PlaySound(SoundID.Item95, NPC.Center); + + // Add some randomness when peeking. + if (PeekingOut) + snapDirection = snapDirection.RotatedByRandom(MathHelper.Pi / 6f); + + NPC.velocity = snapDirection * 4f; + InitialSnapDirection = CurrentSnapDirection = NPC.velocity.ToRotation(); + SnapTimer = 1f; + NPC.netUpdate = true; + } + } + + public override void FindFrame(int frameHeight) + { + if (NPC.Calamity().newAI[1] == 1) + { + NPC.frameCounter++; + if (NPC.frameCounter > 3) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y < frameHeight * 5 || NPC.frame.Y > frameHeight * 10) + { + NPC.frame.Y = frameHeight * 5; + } + } + else + { + NPC.frameCounter = 0; + NPC.frame.Y = 0; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (InHidingSpot) + return false; + + Texture2D headTexture = ModContent.Request(Texture).Value; + Texture2D body1Texture = SandProwler.BodySprite1.Value; + Texture2D body2Texture = SandProwler.BodySprite2.Value; + Texture2D body3Texture = SandProwler.BodySprite3.Value; + Texture2D body4Texture = SandProwler.BodySprite4.Value; + + Vector2 idealDrawPosition = SpotToHideIn; + Vector2 backOffset = (NPC.rotation - MathHelper.PiOver2).ToRotationVector2() * -18f; + if (Collision.SolidCollision(idealDrawPosition + backOffset, 4, 4)) + idealDrawPosition += backOffset; + + List bezierPoints = new List() + { + idealDrawPosition + }; + + // Calculate points to create segments at based on a catmull-rom spine. + float bendFactor = Utils.GetLerpValue(80f, 250f, NPC.Distance(idealDrawPosition), true); + for (int i = 0; i < 20; i++) + { + Vector2 leftEnd = idealDrawPosition - InitialSnapDirection.ToRotationVector2() * bendFactor * 450f; + Vector2 rightEnd = NPC.Center + CurrentSnapDirection.ToRotationVector2() * bendFactor * 450f; + bezierPoints.Add(Vector2.CatmullRom(leftEnd, idealDrawPosition, NPC.Center, rightEnd, i / 19f)); + } + bezierPoints.Add(NPC.Center); + + // And then generalize them with a bezier curve. + BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); + int totalChains = (int)(NPC.Distance(idealDrawPosition) / 16f); + totalChains = (int)MathHelper.Clamp(totalChains, 2f, 100f); + + for (int i = 0; i < totalChains - 1; i++) + { + Texture2D textureToUse; + + + if (i % 2 == 0) + { + textureToUse = body3Texture; + } + else + { + textureToUse = body4Texture; + } + + switch (totalChains - i - 1) + { + case 1: + textureToUse = headTexture; + break; + case 2: + textureToUse = body1Texture; + break; + case 3: + textureToUse = body2Texture; + break; + } + + Vector2 drawPosition = bezierCurve.Evaluate(i / (float)totalChains); + Color lightColor = Lighting.GetColor((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); + float angle = (bezierCurve.Evaluate(i / (float)totalChains + 1f / totalChains) - drawPosition).ToRotation() + MathHelper.PiOver2; + Rectangle frame = textureToUse.Frame(1, 1, 0, 0); + if (textureToUse == headTexture) + { + frame = NPC.frame; + } + Vector2 origin = new Vector2(textureToUse.Width / 2, textureToUse.Height / (textureToUse == headTexture ? 22 : 2)); + spriteBatch.Draw(textureToUse, drawPosition - Main.screenPosition, frame, lightColor, angle, origin, NPC.scale, SpriteEffects.None, 0f); + } + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return NPC.life < NPC.lifeMax * 0.99f; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSeaPolyp && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + + return 0f; + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => SandProwler.DefineSandProwlerLoot(npcLoot); + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 3; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0 && Main.netMode != NetmodeID.Server) + { + for (int k = 0; k < 10; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); + } + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, NPC.scale); + } + } + public override void OnKill() + { + // Increase the kill count of Sand Prowlers for the Bestiary + if (NPC.GetWereThereAnyInteractions()) + { + NPC nPC = new NPC(); + nPC.SetDefaults(ModContent.NPCType()); + Main.BestiaryTracker.Kills.RegisterKill(nPC); + } + } + } +} diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 4aaa21eb56..e18cf5ffc4 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -3,7 +3,9 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; @@ -15,7 +17,7 @@ namespace CalamityMod.NPCs.SunkenSea { public override void SetStaticDefaults() { - Main.npcFrameCount[NPC.type] = 4; + Main.npcFrameCount[NPC.type] = 8; Main.npcCatchable[NPC.type] = true; NPCID.Sets.CountsAsCritter[NPC.type] = true; } @@ -25,8 +27,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.damage = 0; - NPC.width = 36; - NPC.height = 22; + NPC.width = 32; + NPC.height = 26; NPC.defense = 0; NPC.lifeMax = 5; NPC.aiStyle = -1; @@ -48,144 +50,272 @@ namespace CalamityMod.NPCs.SunkenSea }); } + public override void OnSpawn(IEntitySource source) + { + NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); + } public override void AI() { - CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); - NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; - NPC.noGravity = true; - bool shouldSwimAway = false; - if (NPC.direction == 0) - { - NPC.TargetClosest(true); - } + NPC owner = Main.npc[(int)NPC.ai[2]]; if (NPC.wet) { - NPC.TargetClosest(false); - if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && - (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) + if (owner == null || !owner.active || (owner.type != ModContent.NPCType() && owner.type != ModContent.NPCType())) { - shouldSwimAway = true; - } - if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) - { - shouldSwimAway = false; - } - if (!shouldSwimAway) - { - if (NPC.collideX || NPC.velocity.X == 0f) + CalamityRegularEnemyAI.PassiveSwimmingAI(NPC, Mod, 3, 150f, 0.25f, 0.15f, 6f, 6f, 0.05f); + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + NPC.noGravity = true; + bool shouldSwimAway = false; + if (NPC.direction == 0) { - NPC.velocity.X = NPC.velocity.X * -3f; + NPC.TargetClosest(true); + } + NPC.TargetClosest(false); + if (Main.player[NPC.target].wet && !Main.player[NPC.target].dead && + (Main.player[NPC.target].Center - NPC.Center).Length() < 150f) + { + shouldSwimAway = true; + } + if ((!Main.player[NPC.target].wet || Main.player[NPC.target].dead) && shouldSwimAway) + { + shouldSwimAway = false; + } + if (!shouldSwimAway) + { + if (NPC.collideX || NPC.velocity.X == 0f) + { + NPC.velocity.X = NPC.velocity.X * -3f; + NPC.direction *= -1; + NPC.netUpdate = true; + } + if (NPC.collideY) + { + NPC.netUpdate = true; + if (NPC.velocity.Y > 0f) + { + NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; + NPC.directionY = -1; + NPC.ai[0] = -1f; + } + else if (NPC.velocity.Y < 0f) + { + NPC.velocity.Y = Math.Abs(NPC.velocity.Y); + NPC.directionY = 1; + NPC.ai[0] = 1f; + } + } + } + if (shouldSwimAway) + { + NPC.TargetClosest(true); + NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; + NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; + if (NPC.velocity.X > 6f) + { + NPC.velocity.X = 6f; + } + if (NPC.velocity.X < -6f) + { + NPC.velocity.X = -6f; + } + if (NPC.velocity.Y > 6f) + { + NPC.velocity.Y = 6f; + } + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } NPC.direction *= -1; - NPC.netUpdate = true; - } - if (NPC.collideY) - { - NPC.netUpdate = true; - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y) * -3f; - NPC.directionY = -1; - NPC.ai[0] = -1f; - } - else if (NPC.velocity.Y < 0f) - { - NPC.velocity.Y = Math.Abs(NPC.velocity.Y); - NPC.directionY = 1; - NPC.ai[0] = 1f; - } - } - } - if (shouldSwimAway) - { - NPC.TargetClosest(true); - NPC.velocity.X = NPC.velocity.X - (float)NPC.direction * 0.25f; - NPC.velocity.Y = NPC.velocity.Y - (float)NPC.directionY * 0.15f; - if (NPC.velocity.X > 6f) - { - NPC.velocity.X = 6f; - } - if (NPC.velocity.X < -6f) - { - NPC.velocity.X = -6f; - } - if (NPC.velocity.Y > 6f) - { - NPC.velocity.Y = 6f; - } - if (NPC.velocity.Y < -6f) - { - NPC.velocity.Y = -6f; - } - NPC.direction *= -1; - } - else - { - NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; - if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) - { - NPC.velocity.X = NPC.velocity.X * 0.95f; - } - if (NPC.ai[0] == -1f) - { - NPC.velocity.Y = NPC.velocity.Y - 0.01f; - if ((double)NPC.velocity.Y < -0.3) - { - NPC.ai[0] = 1f; - } } else { - NPC.velocity.Y = NPC.velocity.Y + 0.01f; - if ((double)NPC.velocity.Y > 0.3) + NPC.velocity.X = NPC.velocity.X + (float)NPC.direction * 0.1f; + if (NPC.velocity.X < -2.5f || NPC.velocity.X > 2.5f) + { + NPC.velocity.X = NPC.velocity.X * 0.95f; + } + if (NPC.ai[0] == -1f) + { + NPC.velocity.Y = NPC.velocity.Y - 0.01f; + if ((double)NPC.velocity.Y < -0.3) + { + NPC.ai[0] = 1f; + } + } + else + { + NPC.velocity.Y = NPC.velocity.Y + 0.01f; + if ((double)NPC.velocity.Y > 0.3) + { + NPC.ai[0] = -1f; + } + } + } + int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; + int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; + if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) + { + if (Main.tile[npcTileX, npcTileY + 1].HasTile) + { + NPC.ai[0] = -1f; + } + else if (Main.tile[npcTileX, npcTileY + 2].HasTile) { NPC.ai[0] = -1f; } } - } - int npcTileX = (int)(NPC.position.X + (float)(NPC.width / 2)) / 16; - int npcTileY = (int)(NPC.position.Y + (float)(NPC.height / 2)) / 16; - if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) - { - if (Main.tile[npcTileX, npcTileY + 1].HasTile) + if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) { - NPC.ai[0] = -1f; - } - else if (Main.tile[npcTileX, npcTileY + 2].HasTile) - { - NPC.ai[0] = -1f; + NPC.velocity.Y = NPC.velocity.Y * 0.95f; } } - if ((double)NPC.velocity.Y > 0.4 || (double)NPC.velocity.Y < -0.4) + else { - NPC.velocity.Y = NPC.velocity.Y * 0.95f; + float SAImovement = 0.05f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherFish = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherFish.active || k == NPC.whoAmI || (otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType() && otherFish.type != ModContent.NPCType())) + continue; + + float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); + if (taxicabDist < NPC.width * 1.5f) + { + if (NPC.position.X < otherFish.position.X) + NPC.velocity.X -= SAImovement; + else + NPC.velocity.X += SAImovement; + + if (NPC.position.Y < otherFish.position.Y) + NPC.velocity.Y -= SAImovement; + else + NPC.velocity.Y += SAImovement; + } + } + + if (!owner.active) + return; + + float passiveMvtFloat = 0.5f; + float range = 100f; + Vector2 fischPos = NPC.Center; + float xDist = owner.Center.X - fischPos.X; + float yDist = owner.Center.Y - fischPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + xDist += 30f * -(float)owner.direction; + Vector2 leaderVector = new Vector2(xDist, yDist); + float leaderDist = leaderVector.Length(); + float returnSpeed = 8f; + //If leader is close enough, resume normal + if (leaderDist < range && owner.velocity.Y == 0f && + NPC.Bottom.Y <= owner.Bottom.Y && + !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } + } + + if (leaderDist < 50f) + { + if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) + { + NPC.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (leaderDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (leaderDist > 300f) + { + passiveMvtFloat = 1f; + } + leaderDist = returnSpeed / leaderDist; + leaderVector.X *= leaderDist; + leaderVector.Y *= leaderDist; + } + if (NPC.velocity.X < leaderVector.X) + { + NPC.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) + { + NPC.velocity.X += passiveMvtFloat; + } + } + if (NPC.velocity.X > leaderVector.X) + { + NPC.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) + { + NPC.velocity.X -= passiveMvtFloat; + } + } + if (NPC.velocity.Y < leaderVector.Y) + { + NPC.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) + { + NPC.velocity.Y += passiveMvtFloat * 2f; + } + } + if (NPC.velocity.Y > leaderVector.Y) + { + NPC.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) + { + NPC.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (NPC.velocity.X >= 0.25f) + { + NPC.direction = -1; + } + else if (NPC.velocity.X < -0.25f) + { + NPC.direction = 1; + } + NPC.spriteDirection = -NPC.direction; } } else { - if (NPC.velocity.Y == 0f) + { - NPC.velocity.X = NPC.velocity.X * 0.94f; - if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) + if (NPC.velocity.Y == 0f) { - NPC.velocity.X = 0f; + NPC.velocity.X = NPC.velocity.X * 0.94f; + if ((double)NPC.velocity.X > -0.2 && (double)NPC.velocity.X < 0.2) + { + NPC.velocity.X = 0f; + } } + NPC.velocity.Y = NPC.velocity.Y + 0.3f; + if (NPC.velocity.Y > 10f) + { + NPC.velocity.Y = 10f; + } + NPC.ai[0] = 1f; } - NPC.velocity.Y = NPC.velocity.Y + 0.3f; - if (NPC.velocity.Y > 10f) + NPC.rotation = NPC.velocity.X * 0.05f; + if ((double)NPC.rotation < -0.1) { - NPC.velocity.Y = 10f; + NPC.rotation = -0.1f; + } + if ((double)NPC.rotation > 0.1) + { + NPC.rotation = 0.1f; + } + if (NPC.type == ModContent.NPCType()) + { + NPC.ProduceGoldCritterDust(); } - NPC.ai[0] = 1f; - } - NPC.rotation = NPC.velocity.X * 0.05f; - if ((double)NPC.rotation < -0.1) - { - NPC.rotation = -0.1f; - } - if ((double)NPC.rotation > 0.1) - { - NPC.rotation = 0.1f; - return; } } @@ -196,21 +326,12 @@ namespace CalamityMod.NPCs.SunkenSea NPC.frameCounter = 0.0; return; } - NPC.frameCounter += 0.075f; + NPC.frameCounter += 0.15f; NPC.frameCounter %= Main.npcFrameCount[NPC.type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) - { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; - } - return 0f; - } - public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) @@ -219,4 +340,41 @@ namespace CalamityMod.NPCs.SunkenSea } } } + public class SeaMinnowGold : SeaMinnow + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[NPC.type] = 8; + Main.npcCatchable[NPC.type] = true; + NPCID.Sets.CountsAsCritter[NPC.type] = true; + this.HideFromBestiary(); + } + public override void SetDefaults() + { + NPC.npcSlots = 0.1f; + NPC.noGravity = true; + NPC.damage = 0; + NPC.width = 36; + NPC.height = 22; + NPC.defense = 0; + NPC.lifeMax = 5; + NPC.aiStyle = -1; + AIType = -1; + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.chaseable = false; + NPC.catchItem = (short)ModContent.ItemType(); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.rarity = 3; + } + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); + } + } + } } diff --git a/NPCs/SunkenSea/SeaMinnow.png b/NPCs/SunkenSea/SeaMinnow.png index 456d61faab..4baf632a28 100644 Binary files a/NPCs/SunkenSea/SeaMinnow.png and b/NPCs/SunkenSea/SeaMinnow.png differ diff --git a/NPCs/SunkenSea/SeaMinnowGold.png b/NPCs/SunkenSea/SeaMinnowGold.png new file mode 100644 index 0000000000..f070775305 Binary files /dev/null and b/NPCs/SunkenSea/SeaMinnowGold.png differ diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs deleted file mode 100644 index 2cb2cdab19..0000000000 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ /dev/null @@ -1,323 +0,0 @@ -using System; -using CalamityMod.BiomeManagers; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent1 : ModNPC - { - public const int maxLength = 9; - public float speed = 3f; - public float turnSpeed = 0.0625f; - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SeaSerpent_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 20 - }; - value.Position.Y += 20; - value.Position.X += 40; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.damage = 50; - NPC.width = 50; //42 - NPC.height = 24; //32 - NPC.defense = 10; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; - AIType = -1; - NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 20, 0); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.SeaSerpent") - }); - } - - public override void AI() - { - Point point = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point); - bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; - if (createDust) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); - dust.fadeIn = 0.75f; - dust.velocity *= 0.1f; - dust.noLight = true; - } - } - - Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 0.3f / 255f, (255 - NPC.alpha) * 0.3f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) - NPC.TargetClosest(true); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && NPC.ai[0] == 0f) - { - int Previous = NPC.whoAmI; - for (int segment = 0; segment < maxLength; segment++) - { - int lol = 0; - if (segment == 0 || segment == 1 || segment == 4 || segment == 5) - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - else if (segment == 2 || segment == 3 || segment == 6) - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - else if (segment == 7) - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - else if (segment == 8) - lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType(), NPC.whoAmI); - - Main.npc[lol].realLife = NPC.whoAmI; - Main.npc[lol].ai[2] = (float)NPC.whoAmI; - Main.npc[lol].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - - TailSpawned = true; - } - } - - if (NPC.velocity.X < 0f) - NPC.spriteDirection = -1; - else if (NPC.velocity.X > 0f) - NPC.spriteDirection = 1; - - if (Main.player[NPC.target].dead) - NPC.TargetClosest(false); - - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - { - NPC.TargetClosest(false); - if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > 5600f) - NPC.active = false; - } - - float currentSpeed = speed; - float currentTurnSpeed = turnSpeed; - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - if (NPC.life > NPC.lifeMax * 0.99) - { - targetYDist += 300; - if (Math.Abs(NPC.Center.X - Main.player[NPC.target].Center.X) < 250f) - { - if (NPC.velocity.X > 0f) - { - targetXDist = Main.player[NPC.target].Center.X + 300f; - } - else - { - targetXDist = Main.player[NPC.target].Center.X - 300f; - } - } - } - else - { - currentSpeed *= 1.5f; - currentTurnSpeed *= 1.5f; - } - float maxCurrentSpeed = currentSpeed * 1.3f; - float minCurrentSpeed = currentSpeed * 0.7f; - float speedCompare = NPC.velocity.Length(); - if (speedCompare > 0f) - { - if (speedCompare > maxCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxCurrentSpeed; - } - else if (speedCompare < minCurrentSpeed) - { - NPC.velocity.Normalize(); - NPC.velocity *= minCurrentSpeed; - } - } - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float absoluteTargetX = System.Math.Abs(targetXDist); - float absoluteTargetY = System.Math.Abs(targetYDist); - float timeToReachTarget = currentSpeed / targetDistance; - targetXDist *= timeToReachTarget; - targetYDist *= timeToReachTarget; - if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - if ((double)System.Math.Abs(targetYDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 2f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 2f; - } - } - if ((double)System.Math.Abs(targetXDist) < (double)currentSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 2f; //changed from 2 - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 2f; //changed from 2 - } - } - } - else - { - if (absoluteTargetX > absoluteTargetY) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed * 1.1f; //changed from 1.1 - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed; - } - } - } - else - { - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + currentTurnSpeed * 1.1f; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - currentTurnSpeed * 1.1f; - } - if ((double)(System.Math.Abs(NPC.velocity.X) + System.Math.Abs(NPC.velocity.Y)) < (double)currentSpeed * 0.5) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + currentTurnSpeed; - } - else - { - NPC.velocity.X = NPC.velocity.X - currentTurnSpeed; - } - } - } - } - NPC.rotation = (float)System.Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (Main.hardMode && spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && - !NPC.AnyNPCs(ModContent.NPCType()) && !spawnInfo.Player.Calamity().clamity && !spawnInfo.PlayerSafe) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; - - return 0f; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 4); - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent1.png b/NPCs/SunkenSea/SeaSerpent1.png deleted file mode 100644 index 0e144e18e2..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent1.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs deleted file mode 100644 index 4334908959..0000000000 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent2 : ModNPC - { - public float speed = 6f; - public float turnSpeed = 0.125f; - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 40; - NPC.width = 24; //42 - NPC.height = 16; //24 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore2").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent2.png b/NPCs/SunkenSea/SeaSerpent2.png deleted file mode 100644 index bdb5c315db..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent2.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs deleted file mode 100644 index 3258776809..0000000000 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent3 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 40; - NPC.width = 24; //42 - NPC.height = 16; //24 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore3").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent3.png b/NPCs/SunkenSea/SeaSerpent3.png deleted file mode 100644 index 3ca49fc95e..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent3.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs deleted file mode 100644 index 336e640558..0000000000 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent4 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 30; - NPC.width = 28; //42 - NPC.height = 24; //34 - NPC.defense = 20; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore4").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent4.png b/NPCs/SunkenSea/SeaSerpent4.png deleted file mode 100644 index 5625d8cf2d..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent4.png and /dev/null differ diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs deleted file mode 100644 index 419b90c22f..0000000000 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ /dev/null @@ -1,149 +0,0 @@ -using CalamityMod.Items.Placeables.Banners; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.SunkenSea -{ - public class SeaSerpent5 : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.SeaSerpent1.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 20; - NPC.width = 36; //42 - NPC.height = 30; //40 - NPC.defense = 30; - NPC.lifeMax = 3000; - NPC.aiStyle = -1; //new - AIType = -1; //new - NPC.knockBackResist = 0f; - NPC.alpha = 255; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.netAlways = true; - NPC.dontCountMe = true; - NPC.chaseable = false; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - // Avoid cheap bullshit - NPC.damage = 0; - - Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.30f / 255f, (255 - NPC.alpha) * 0.30f / 255f); - - if (NPC.ai[2] > 0f) - NPC.realLife = (int)NPC.ai[2]; - - // Check if other segments are still alive, if not, die - bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); - if (!shouldDespawn) - { - if (NPC.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - NPC.active = false; - } - - if (Main.npc[(int)NPC.ai[1]].alpha < 128) - { - NPC.alpha -= 42; - if (NPC.alpha < 0) - NPC.alpha = 0; - } - - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)System.Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)System.Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = NPC.width; - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - - if (targetXDist < 0f) - NPC.spriteDirection = -1; - else if (targetXDist > 0f) - NPC.spriteDirection = 1; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); - } - if (Main.netMode != NetmodeID.Server) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore5").Type, 1f); - } - } - } - } -} diff --git a/NPCs/SunkenSea/SeaSerpent5.png b/NPCs/SunkenSea/SeaSerpent5.png deleted file mode 100644 index 2772709ecb..0000000000 Binary files a/NPCs/SunkenSea/SeaSerpent5.png and /dev/null differ diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs new file mode 100644 index 0000000000..c66a7514b9 --- /dev/null +++ b/NPCs/SunkenSea/Sharkoon.cs @@ -0,0 +1,607 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.BiomeManagers; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Enemy; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.Utilities; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Sharkoon : SunkenSeaNPC + { + public static float DistanceToKaboom = 80f; + public static float IdleMovementMaxRange = 640f; + public static int ExplosionRadius = 80; + public static float TimeToRecover = 600f; + public static float TimeRecovering = 120f; + + #region Fields & Properties + + protected override List HuntNPCs => new() + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + }; + + protected override List AvoidNPCs => new() + { + // NPCType(), + // NPCType(), + NPCType(), + // NPCType, + }; + + /// + /// The different types of personality this NPC can have. + /// + private enum PersonalityType { Shy, Curious, Paranoid } + + /// + /// The current personality of this NPC. + /// + private PersonalityType Personality + { + get => (PersonalityType)NPC.ai[0]; + set + { + NPC.ai[0] = (float)value; + NetUpdate(); + } + } + + /// + /// The different types of animation this enemy can have. + /// + private enum AnimationState { Normal, Explosion, Shrunk } + + /// + /// The current animation being played right now. + /// + private AnimationState Animation + { + get => (AnimationState)NPC.ai[1]; + set + { + // In case an animation is being set constantly, + // so we don't have it reset to the first frame every time, + // it'll only reset the current frame when actually changing animations. + if (value != Animation) + { + NPC.frame.Y = 0; + NPC.frameCounter = 0; + } + + NPC.ai[1] = (float)value; + + switch (value) + { + case AnimationState.Normal: + ChangeAnimation(animationFrames: 7, timePerAnimationFrame: 7, loops: true); + break; + case AnimationState.Explosion: + ChangeAnimation(animationFrames: 16, timePerAnimationFrame: 8, loops: false); + break; + case AnimationState.Shrunk: + ChangeAnimation(animationFrames: 6, timePerAnimationFrame: 6, loops: true); + break; + } + + NetUpdate(); + } + } + + /// + /// The amount of frames that one column of sprites has.
+ /// Defaults to 7 since that's the first column's amount of frames. + ///
+ private int AnimationFrames = 7; + + /// + /// The amount, in frames, that it takes to go to the next animation frame.
+ /// Defaults to 7. + ///
+ private int TimePerAnimationFrame = 7; + + /// + /// Whether or not the animation loops or not.
+ /// Defaults to . + ///
+ private bool AnimationLoop = true; + + /// + /// A timer used to know when the NPC should recover after it explodes. + /// + private ref float RecoverTimer => ref NPC.ai[2]; + + /// + /// The maximum speed this NPC can have, it cannot be faster than this number. + /// + private float MaximumSpeed = 4f; + + /// + /// How unlikely is the Sharkoon going to move normally.
+ /// Defaults to 250. + ///
+ private int RandomIdleMovementUnlikeliness = 250; + + /// + /// Whether or not the Sharkoon is capable of exploding. + /// + private bool IsBig => Animation == AnimationState.Normal; + + /// + /// The squish of this NPC while drawing. + /// + private Vector2 ScaleSquish = Vector2.One; + + #endregion + + #region Other Overridden Methods + + protected override void ExtraSetStaticDefaults() => Main.npcFrameCount[Type] = 16; + + public override void SetDefaults() + { + NPC.damage = 20; + NPC.lifeMax = 350; + NPC.defense = 5; + NPC.knockBackResist = 0.15f; + NPC.chaseable = false; + + NPC.aiStyle = -1; + AIType = -1; + NPC.width = 52; + NPC.height = 46; + NPC.noGravity = true; + + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.value = Item.buyPrice(0, 0, 5, 0); + // Banner = NPC.type; + // BannerItem = ModContent.ItemType(); + + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.9f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.RedMoss, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.RedMoss, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + + public override bool CanBeHitByNPC(NPC attacker) + { + if (attacker.whoAmI == NPC.whoAmI) + return false; + + CurrentBehavior = ExplodingBehavior; + + return true; + } + + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + if (IsBig) + CurrentBehavior = ExplodingBehavior; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit) + { + if (IsBig) + CurrentBehavior = ExplodingBehavior; + } + + #endregion + + #region AI + + protected override void CreatureOnSpawn() + { + CurrentBehavior = IdlingBehavior; + + WeightedRandom randomPersonality = new(); + randomPersonality.Add(PersonalityType.Shy, 0.4f); + randomPersonality.Add(PersonalityType.Curious, 0.4f); + randomPersonality.Add(PersonalityType.Paranoid, 0.2f); + Personality = randomPersonality.Get(); + + DetectionDistance = 320f; + ConeDetectionAngle = MathHelper.ToRadians(30f); + + if (Personality == PersonalityType.Curious) + { + DetectionDistance *= 1.5f; + ConeDetectionAngle *= 1.5f; + RandomIdleMovementUnlikeliness /= 2; + } + + if (Personality == PersonalityType.Paranoid) + MaximumSpeed *= 1.5f; + + NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + NPC.GravityMultiplier *= 2f; + NPC.MaxFallSpeedMultiplier *= 2f; + } + + protected override void CreatureAI() + { + CurrentBehavior?.Invoke(); + + if (!NPC.velocity.HasNaNs()) + ConeDetectionDirection = (NPC.rotation * MathF.Sign(NPC.velocity.Y) + (NPC.spriteDirection == -1 ? MathHelper.Pi : 0f)).ToRotationVector2(); + + NPC.rotation = MathHelper.ToRadians(NPC.velocity.Length() * 3f) * MathF.Sign(NPC.velocity.X); + + if (MathF.Abs(NPC.velocity.X) > 2f) + NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); + + bool isEntityPlayerOrNonPreyNPC = NearestEntity is not null && (NearestEntity is Player || NearestEntity is NPC && !HuntNPCs.Contains((NearestEntity as NPC).type)); + if (isEntityPlayerOrNonPreyNPC) + { + bool isWithinDistance = NPC.DistanceSQ(NearestEntity.Center) < DistanceToKaboom * DistanceToKaboom; + if (IsBig && Personality == PersonalityType.Paranoid && isEntityPlayerOrNonPreyNPC && isWithinDistance) + CurrentBehavior = ExplodingBehavior; + } + + if (!IsBig) + { + RecoverTimer++; + if (RecoverTimer > TimeToRecover) + CurrentBehavior = RecoveringBehavior; + } + + if (!NPC.wet) + CurrentBehavior = OutsideWaterBehavior; + + if (NPC.velocity.LengthSquared() > MaximumSpeed * MaximumSpeed) + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY) * MaximumSpeed; + + if (ScaleSquish.Y > 1f) + ScaleSquish.Y -= 0.025f; + + if (ScaleSquish.Y < 1f) + ScaleSquish.Y = 1f; + } + + protected override void OnBehaviorChange(Action newBehavior) + { + if (newBehavior == ExplodingBehavior) + Animation = AnimationState.Explosion; + + if (newBehavior == RecoveringBehavior) + RecoverTimer = 0f; + + if (PreviousBehavior == RecoveringBehavior) + RecoverTimer = 0f; + + if (newBehavior == AvoidBehavior) + MaximumSpeed *= 1.2f; + + if (PreviousBehavior == AvoidBehavior) + MaximumSpeed /= 1.2f; + + NPC.noGravity = newBehavior != OutsideWaterBehavior; + } + + protected override void OnPreyDetection(NPC prey) + { + // If it's not a small fish and it's not being chased by a predator, the Sharkoon may hunt. + if (IsBig && CurrentPredator is null) + { + CurrentBehavior = HuntBehavior; + ScaleSquish.Y += 0.4f; + React(Color.Orange * 0.6f, EmoteExpressionParticle.EmoteType.Exclamation, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + } + } + + protected override void OnPredatorDetection(NPC predator) + { + // Regardless of anything, if it detects a predator, time to run. + CurrentBehavior = AvoidBehavior; + + React(Color.Red * 0.6f, EmoteExpressionParticle.EmoteType.DoubleExclamation, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + + ScaleSquish.Y += 0.4f; + } + + protected override void OnPlayerDetection(Player player) + { + if (CurrentPredator is not null) + return; + + // If the Sharkoon is shy, it'll run away from the player. + if (Personality == PersonalityType.Shy) + { + CurrentBehavior = AvoidBehavior; + React(Color.Orange, EmoteExpressionParticle.EmoteType.QuestionExclamation, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + } + + if (Personality == PersonalityType.Curious) + React(Color.Green, EmoteExpressionParticle.EmoteType.Question, new("CalamityMod/Sounds/Custom/ur") { PitchVariance = 0.2f }); + + ScaleSquish.Y += 0.4f; + } + + private void IdlingBehavior() + { + if (PathfindingPoints is null) + { + // While it hasn't decided yet which path to follow, it'll deaccelerate and stand still. + NPC.velocity *= 0.95f; + + // Randomly, it'll decide a path whose destination is somewhere around him. + if (Main.rand.NextBool(RandomIdleMovementUnlikeliness)) + MakePath(NPC.Center + Main.rand.NextVector2CircularEdge(IdleMovementMaxRange, IdleMovementMaxRange) * Main.rand.NextFloat(0.75f, 1f), IdleMovementMaxRange); + } + else + GenericPathFollowing(acceleration: 0.07f, pathFollowingSpeed: 0.07f, conditionToFinishFollowing: FinishedPathfinding()); + } + + private void HuntBehavior() + { + // If there's no more prey, go back to idling. + if (CurrentPrey is null) + { + CurrentBehavior = IdlingBehavior; + return; + } + + if (!HasLineOfSight(CurrentPrey.Center)) + { + if (PathfindingPoints is not null) + GenericPathFollowing(acceleration: 0.14f, pathFollowingSpeed: 0.1f, conditionToFinishFollowing: FinishedPathfinding()); + else + MakePath(CurrentPrey.Center, CalamityUtils.ManhattanDistance(NPC.Center, CurrentPrey.Center)); + } + else + NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * 0.14f; + } + + private void AvoidBehavior() + { + // Depending on the personality, the Sharkoon will choose who to avoid. + Entity entityToAvoid = null; + switch (Personality) + { + case PersonalityType.Shy: + entityToAvoid = (NearestEntity is NPC && HuntNPCs.Contains((NearestEntity as NPC).type)) ? null : NearestEntity; + break; + case PersonalityType.Curious: + entityToAvoid = CurrentPredator; + break; + case PersonalityType.Paranoid: + entityToAvoid = CurrentPredator; + break; + } + + // If there aren't any more targets detected, go back to idling. + if (entityToAvoid is null) + { + CurrentBehavior = IdlingBehavior; + return; + } + + bool isAvoidingPredator = entityToAvoid is NPC && (entityToAvoid as NPC).whoAmI == CurrentPredator.whoAmI; + + if (Main.tile[(NPC.Center + NPC.DirectionFrom(entityToAvoid.Center) * 80f).ToTileCoordinates()].IsTileSolid()) + { + if (PathfindingPoints is null) + { + float fleeingDistance = isAvoidingPredator ? 600f : 400f; + + Point randomEscapePoint = (NPC.Center + NPC.DirectionFrom(entityToAvoid.Center).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(fleeingDistance, fleeingDistance + 100f)).ToSafeTileCoordinates(); + + var grid = CalamityUtils.AStar.MakeGenericGrid(NPC.Center, fleeingDistance); + + while (!grid.Contains(randomEscapePoint)) + randomEscapePoint = (NPC.Center + NPC.DirectionFrom(entityToAvoid.Center).RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(fleeingDistance, fleeingDistance + 100f)).ToSafeTileCoordinates(); + + MakePath(randomEscapePoint.ToWorldCoordinates(), grid); + } + else + GenericPathFollowing(acceleration: 0.14f * (isAvoidingPredator ? 2f : 1f), pathFollowingSpeed: 0.07f * (isAvoidingPredator ? 2.2f : 1f), conditionToFinishFollowing: FinishedPathfinding()); + } + else + NPC.velocity += NPC.DirectionFrom(entityToAvoid.Center) * 0.14f; + + // If it's capable of exploding and the predator's within distance, kaboom. + if (IsBig && NPC.DistanceSQ(entityToAvoid.Center) < DistanceToKaboom * DistanceToKaboom && entityToAvoid is NPC && AvoidNPCs.Contains((entityToAvoid as NPC).type)) + CurrentBehavior = ExplodingBehavior; + } + + private void ExplodingBehavior() + { + // Deaccelerate. + NPC.velocity *= 0.95f; + + if (IsBig) + Lighting.AddLight(NPC.Center, Color.Orange.ToVector3() * Utils.GetLerpValue(NPC.height, NPC.height * 9, NPC.frame.Y, true)); + + // On the exact frame that the NPC explodes, it'll will, indeed, explode. + if (NPC.frame.Y == NPC.height * 9 && NPC.frameCounter == 0) + Kaboom(); + + // When the animation's finished, go back to being a normal fish. + if (NPC.frame.Y >= NPC.height * 16) + { + Animation = AnimationState.Shrunk; + CurrentBehavior = PreviousBehavior; + } + } + + private void RecoveringBehavior() + { + if (RecoverTimer >= TimeRecovering) + { + Animation = AnimationState.Normal; + CurrentBehavior = PreviousBehavior; + } + + // Deaccelerates to stay still. + NPC.velocity *= 0.95f; + + // VFX and sound effects go here, + // a dedicated server doesn't need to load these. + if (!Main.dedServ) + { + // HI XYK! + } + + RecoverTimer++; + } + + private void OutsideWaterBehavior() + { + if (NPC.wet) + { + NPC.noGravity = true; + CurrentBehavior = PreviousBehavior; + } + } + + private void Kaboom() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectileDirect( + NPC.GetSource_FromThis(), + NPC.Center, + Vector2.Zero, + ProjectileType(), + NPC.damage, + 10f, + Main.myPlayer); + } + + // VFX and sound effects go here, + // a dedicated server doesn't need to load these. + if (!Main.dedServ) + { + for (int i = 0; i < 10; i++) + { + Dust dust = Dust.NewDustPerfect(NPC.Center, 278, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; + } + for (int i = 0; i < 18; i++) + { + Dust dust = Dust.NewDustPerfect(NPC.Center, 267, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.9f, 1.1f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Orange; + } + for (int i = 0; i < 8; i++) + { + Vector2 randVel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + Particle smoke = new HeavySmokeParticle(NPC.Center + randVel, randVel, Color.Lerp(Color.SlateGray, Color.Black, Main.rand.NextFloat(0.2f, 0.45f)), Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f); + GeneralParticleHandler.SpawnParticle(smoke); + } + SoundStyle boom = new("CalamityMod/Sounds/Custom/SharkoonBoom"); + SoundEngine.PlaySound(boom with { Volume = 0.7f, PitchVariance = 0.15f }, NPC.Center); + } + + NetUpdate(); + } + + #endregion + + #region Drawing & Animation + + /// + /// A quick method to change all the animation's properties. + /// + private void ChangeAnimation(int animationFrames, int timePerAnimationFrame, bool loops) + { + AnimationFrames = animationFrames; + TimePerAnimationFrame = timePerAnimationFrame; + AnimationLoop = loops; + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter++; + if (NPC.frameCounter > TimePerAnimationFrame) + { + NPC.frame.Y += frameHeight; + NPC.frame.Y = Math.Min(NPC.frame.Y, AnimationFrames * frameHeight); + NPC.frameCounter = 0; + if (AnimationLoop) + NPC.frame.Y = NPC.frame.Y % (AnimationFrames * frameHeight); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D texture = TextureAssets.Npc[Type].Value; + Vector2 drawPosition = NPC.Center - screenPos; + Rectangle frame = texture.Frame(horizontalFrames: 3, verticalFrames: 16, frameX: (int)Animation, frameY: NPC.frame.Y / NPC.height); + Vector2 anchorPoint = frame.Size() * 0.5f; + SpriteEffects flip = NPC.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (Personality == PersonalityType.Paranoid) + drawPosition += Main.rand.NextVector2Circular(1.5f, 1.5f); + + spriteBatch.Draw(texture, drawPosition, frame, NPC.GetAlpha(drawColor), NPC.rotation, anchorPoint, ScaleSquish, flip, 0f); + + return false; + } + + #endregion + + #region Syncing + + protected override void SendMoreExtraAI(BinaryWriter writer) + { + writer.Write7BitEncodedInt(AnimationFrames); + writer.Write7BitEncodedInt(TimePerAnimationFrame); + writer.Write(AnimationLoop); + writer.Write(MaximumSpeed); + writer.Write7BitEncodedInt(RandomIdleMovementUnlikeliness); + } + + protected override void ReceiveMoreExtraAI(BinaryReader reader) + { + AnimationFrames = reader.Read7BitEncodedInt(); + TimePerAnimationFrame = reader.Read7BitEncodedInt(); + AnimationLoop = reader.ReadBoolean(); + MaximumSpeed = reader.ReadSingle(); + RandomIdleMovementUnlikeliness = reader.Read7BitEncodedInt(); + } + + #endregion + } +} diff --git a/NPCs/SunkenSea/Sharkoon.png b/NPCs/SunkenSea/Sharkoon.png new file mode 100644 index 0000000000..44b0698b16 Binary files /dev/null and b/NPCs/SunkenSea/Sharkoon.png differ diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs new file mode 100644 index 0000000000..83f0163539 --- /dev/null +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -0,0 +1,474 @@ +using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.Utilities.NPCUtils; + +namespace CalamityMod.NPCs.SunkenSea +{ + /// + /// An abstract class that gives an NPC the memebers needed to be a Sunken Sea NPC.
+ /// These have the ability to hunt both players and NPCs, and also have a list of NPCs they hunt and avoid. + ///
+ public abstract class SunkenSeaNPC : ModNPC + { + #region Fields & Properties + + /// + /// A list which stores the NPC's IDs that this creature hunts. + /// + protected abstract List HuntNPCs { get; } + + /// + /// A list which stores the NPC's IDs that this creature avoids. + /// + protected abstract List AvoidNPCs { get; } + + /// + /// Since a lot of these NPCs change behaviors a lot, this abstract class provides an property to store and trigger behaviors.
+ /// Automatically resets and to not cause errors. + ///
+ protected Action CurrentBehavior + { + get => _currentBehavior; + set + { + PreviousBehavior = _currentBehavior; + PathfindingPoints = null; + PathTimer = 0f; + OnBehaviorChange(value); + _currentBehavior = value; + NetUpdate(); + } + } + private Action _currentBehavior; + + /// + /// The previous behavior that was used for . + /// + protected Action PreviousBehavior { get; private set; } + + /// + /// The current NPC that this creature has detected as prey. + /// + protected NPC CurrentPrey + { + get => _currentPrey; + private set + { + if (value != _currentPrey && value != null) + OnPreyDetection(value); + + _currentPrey = value; + } + } + private NPC _currentPrey; + + /// + /// The current NPC that this creature has detected as a predator. + /// + protected NPC CurrentPredator + { + get => _currentPredator; + private set + { + if (value != _currentPredator && value != null) + OnPredatorDetection(value); + + _currentPredator = value; + } + } + private NPC _currentPredator; + + /// + /// The current Player that this creature has detected. + /// + protected Player CurrentPlayer + { + get => _currentPlayer; + private set + { + if (value != _currentPlayer && value != null) + OnPlayerDetection(value); + + _currentPlayer = value; + } + } + private Player _currentPlayer; + + /// + /// The nearest entity detected, could be an NPC or Player. + /// + protected Entity NearestEntity { get; private set; } + + /// + /// Whether or not the creature has detected anything at all. + /// + protected bool HasAnyTargets => CurrentPrey != null || CurrentPredator != null || CurrentPlayer != null; + + /// + /// The distance detection radius.
+ /// Defaults to 300 pixels. + ///
+ protected float DetectionDistance { get; set; } = 300f; + + /// + /// The direction of the cone used to detect targets.
+ /// Defaults to times the direction.
+ /// When set, it normalizes the vector. + ///
+ protected Vector2 ConeDetectionDirection + { + get => _coneDetectionDirection; + set + { + _coneDetectionDirection = value.SafeNormalize(Vector2.UnitX * NPC.direction); + NetUpdate(); + } + } + private Vector2 _coneDetectionDirection; + + /// + /// How open the cone detection is -- given an angle.
+ /// Defaults to 45 degrees. + ///
+ protected float ConeDetectionAngle { get; set; } = MathHelper.ToRadians(45f); + + /// + /// When a this creature has lost sight of a target, it'll still have a sense of permanence.
+ /// This means that, even if it can't see it, it can know it's there.
+ /// This property states how much seconds it can know it's there.
+ /// Defaults to 3 seconds. + ///
+ protected virtual float PermanenceSenseTime => CalamityUtils.SecondsToFrames(3f); + + private int _permanenceSenseTimer; + + /// + /// A lot of these Sunken Sea creatures use the pathfinding algorithm,
+ /// so this abstract class provides a so you can store the paths.
+ /// Defaults to . + ///
+ protected List PathfindingPoints { get; set; } + + /// + /// To decide how to follow the , we use this timer that iteratres through all the points.
+ /// Depending on the speed given to the timer, it'll follow the path faster or slower. + ///
+ protected float PathTimer { get; set; } + + protected Vector2 CurrentlyFollowedPathPoint { get; private set; } + + private bool _hasSpawned; + + #endregion + + #region ModNPC Overrides + + public sealed override void SetStaticDefaults() + { + NPCID.Sets.UsesNewTargetting[Type] = true; + NPCID.Sets.TakesDamageFromHostilesWithoutBeingFriendly[Type] = true; + ExtraSetStaticDefaults(); + } + + public sealed override void OnSpawn(IEntitySource source) { } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement($"Mods.CalamityMod.Bestiary.{Name}") + }); + } + + public sealed override void AI() + { + if (!_hasSpawned) + { + CreatureOnSpawn(); + _coneDetectionDirection = Vector2.UnitX * NPC.direction; + _hasSpawned = true; + NetUpdate(); + } + + UpdateTargets(); + + CreatureAI(); + } + + #endregion + + #region Methods + + /// + /// Same function as , and since that one's for safety purposes,
+ /// this method serves the same. + ///
+ protected virtual void ExtraSetStaticDefaults() { } + + /// + /// Same function as , but this one actually syncs to the server. + /// + protected virtual void CreatureOnSpawn() { } + + /// + /// A method that is called on every frame, to put your actual enemy AI. + /// + protected virtual void CreatureAI() { } + + /// + /// A method that is triggered when this NPC's behavior is changed. + /// + protected virtual void OnBehaviorChange(Action newBehavior) { } + + /// + /// A method that is triggered when this creature has detected a prey. + /// + protected virtual void OnPreyDetection(NPC prey) { } + + /// + /// A method that is triggered when this creature has detected a predator. + /// + protected virtual void OnPredatorDetection(NPC predator) { } + + /// + /// A method that is triggered when this creature detects a player. + /// + protected virtual void OnPlayerDetection(Player player) { } + + /// + /// Whether or not a detected player is valid to be set as a target given some conditions. + /// + protected virtual bool PlayerSearchFilter(Player p) + { + if (!HasLineOfSight(p.Center)) + return false; + + bool isInsideCone = Vector2.Dot(_coneDetectionDirection, NPC.DirectionTo(p.Center)) >= MathF.Cos(ConeDetectionAngle) && NPC.DistanceSQ(p.Center) < DetectionDistance * DetectionDistance; + bool isInsideCirlceWhenAware = HasAnyTargets && NPC.DistanceSQ(p.Center) <= DetectionDistance * DetectionDistance; + if (isInsideCone || isInsideCirlceWhenAware) + return true; + + return false; + } + + /// + /// Whether or not a detected NPC is valid to be set as a target given some conditions. + /// + protected virtual bool NPCSearchFilter(NPC n) + { + if (!HasLineOfSight(n.Center)) + return false; + + bool isInsideCone = Vector2.Dot(_coneDetectionDirection, NPC.DirectionTo(n.Center)) >= MathF.Cos(ConeDetectionAngle) && NPC.DistanceSQ(n.Center) < DetectionDistance * DetectionDistance; + bool isInsideCirlceWhenAware = HasAnyTargets && NPC.DistanceSQ(n.Center) <= DetectionDistance * DetectionDistance; + if (isInsideCone || isInsideCirlceWhenAware) + return true; + + return false; + } + + /// + /// A method that finds and updates the current detected targets of this creature. + /// + protected void UpdateTargets() + { + var searchResults = SearchForTarget(NPC, playerFilter: PlayerSearchFilter, npcFilter: NPCSearchFilter); + if (searchResults.FoundTarget) + { + CurrentPlayer = searchResults.NearestTankOwner; + NearestEntity = searchResults.NearestTankOwner; + + if (searchResults.FoundNPC) + { + if (AvoidNPCs.Contains(searchResults.NearestNPC.type)) + CurrentPredator = searchResults.NearestNPC; + + else if (HuntNPCs.Contains(searchResults.NearestNPC.type)) + CurrentPrey = searchResults.NearestNPC; + + if (searchResults.NearestNPCDistance < searchResults.NearestTankDistance) + NearestEntity = searchResults.NearestNPC; + } + + NetUpdate(); + } + else + { + _permanenceSenseTimer++; + if (_permanenceSenseTimer > PermanenceSenseTime) + { + CurrentPlayer = null; + NearestEntity = null; + CurrentPredator = null; + CurrentPrey = null; + _permanenceSenseTimer = 0; + } + } + } + + #endregion + + #region Helper Methods + + /// + /// A quickhand method to make a path with the A* pathfidning algorithm. + /// + protected void MakePath(Vector2 destination, float? range = null) + { + range ??= DetectionDistance; + var grid = CalamityUtils.AStar.MakeGenericGrid(NPC.Center, (float)range); + + if (!grid.Contains(destination.ToTileCoordinates())) + return; + + PathfindingPoints = CalamityUtils.AStar.GetPath(grid, NPC.Center, destination); + NetUpdate(); + } + + /// + /// A quickhand method to make a path with the A* pathfidning algorithm. + /// + protected void MakePath(Vector2 destination, List grid) + { + if (!grid.Contains(destination.ToTileCoordinates())) + return; + + PathfindingPoints = CalamityUtils.AStar.GetPath(grid, NPC.Center, destination); + NetUpdate(); + } + + /// + /// A quickhand method to follow a path found. + /// + protected void GenericPathFollowing(float acceleration, float pathFollowingSpeed, bool conditionToFinishFollowing) + { + CurrentlyFollowedPathPoint = PathfindingPoints[(int)MathF.Floor(PathTimer)]; + NPC.velocity += NPC.DirectionTo(CurrentlyFollowedPathPoint) * acceleration; + PathTimer += pathFollowingSpeed; + PathTimer = MathF.Min(PathTimer, PathfindingPoints.Count - 1); + if (conditionToFinishFollowing) + { + PathfindingPoints = null; + PathTimer = 0f; + NetUpdate(); + } + } + + /// + /// A quick method to check whether this NPC has line of sight with something. + /// + protected bool HasLineOfSight(Vector2 position) => Collision.CanHitLine(NPC.Center, 0, 0, position, 0, 0); + + /// + /// A quickhand method to check if the NPC has finished following the path. + /// + /// + protected bool FinishedPathfinding() + => NPC.DistanceSQ(PathfindingPoints[^1]) < 80f * 80f || + NPC.DistanceSQ(CurrentlyFollowedPathPoint) > 240f * 240f || + PathfindingPoints[^1] == CurrentlyFollowedPathPoint && NPC.velocity == Vector2.Zero; + + /// + /// Spawns an emote particle. + /// + protected void React(Color emoteColor, EmoteExpressionParticle.EmoteType emoteImage, SoundStyle? sound = null) + { + if (!Main.dedServ) + { + var emoteDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(2f, 3f); + Particle emote = new EmoteExpressionParticle( + NPC.Center + emoteDirection * 2f, + emoteDirection, + 2.2f, + emoteColor, + Main.rand.Next(30, 46), + emoteImage); + GeneralParticleHandler.SpawnParticle(emote); + + if (sound is not null) + SoundEngine.PlaySound(sound, NPC.Center); + } + } + + #endregion + + #region Syncing + + /// + /// A quick method to both do and set .
+ /// Defaults to 0. + ///
+ protected void NetUpdate(int netSpam = 0) + { + NPC.netUpdate = true; + NPC.netSpam = netSpam; + } + + public sealed override void SendExtraAI(BinaryWriter writer) + { + writer.Write7BitEncodedInt(CurrentPrey.whoAmI); + writer.Write7BitEncodedInt(CurrentPredator.whoAmI); + writer.Write7BitEncodedInt(CurrentPlayer.whoAmI); + writer.Write7BitEncodedInt(NearestEntity.whoAmI); + + writer.Write(DetectionDistance); + writer.WritePackedVector2(_coneDetectionDirection); + writer.Write(ConeDetectionAngle); + writer.Write7BitEncodedInt(_permanenceSenseTimer); + + writer.Write7BitEncodedInt(PathfindingPoints.Count); + foreach (var point in PathfindingPoints) + writer.WritePackedVector2(point); + writer.Write(PathTimer); + + writer.Write(_hasSpawned); + + SendMoreExtraAI(writer); + } + + public sealed override void ReceiveExtraAI(BinaryReader reader) + { + CurrentPrey.whoAmI = reader.Read7BitEncodedInt(); + CurrentPredator.whoAmI = reader.Read7BitEncodedInt(); + CurrentPlayer.whoAmI = reader.Read7BitEncodedInt(); + NearestEntity.whoAmI = reader.Read7BitEncodedInt(); + + DetectionDistance = reader.ReadSingle(); + _coneDetectionDirection = reader.ReadPackedVector2(); + ConeDetectionAngle = reader.ReadSingle(); + _permanenceSenseTimer = reader.Read7BitEncodedInt(); + + int count = reader.Read7BitEncodedInt(); + for (int i = 0; i < count; i++) + PathfindingPoints.Add(reader.ReadPackedVector2()); + PathTimer = reader.ReadSingle(); + + _hasSpawned = reader.ReadBoolean(); + + ReceiveMoreExtraAI(reader); + } + + /// + /// Same function as , but since that one already sends information and to avoid accidents,
+ /// is and instead this is available. + ///
+ protected virtual void SendMoreExtraAI(BinaryWriter writer) { } + + /// + /// Same function as , but since that one already sends information and to avoid accidents,
+ /// is and instead this is available. + ///
+ protected virtual void ReceiveMoreExtraAI(BinaryReader reader) { } + + #endregion + } +} diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index f3b693f785..14a68f3be3 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -206,6 +206,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float distanceFromSCal = Main.getGoodWorld ? 300f : 225f; NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * distanceFromSCal - NPC.Size * 0.5f; + NPC.velocity = Vector2.Zero; RotationalDegreeOffset += 0.5f; } @@ -265,7 +266,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); int afterimageAmt = 2; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -288,7 +289,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas texture2D15 = GlowTexture.Value; Color redLerp = Color.Lerp(Color.White, Color.Red, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int j = 1; j < afterimageAmt; j++) { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 0a349f4664..36ee5887fd 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -456,7 +456,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityNetcode.SyncWorld(); } - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); bool bossRush = BossRushEvent.BossRushActive; @@ -700,7 +700,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region Enrage and DR if ((spawnArena && !player.Hitbox.Intersects(safeBox)) || bossRush) { - float projectileVelocityMultCap = (!player.Hitbox.Intersects(safeBox) && spawnArena) ? 2f : 1.5f; + float projectileVelocityMultCap = (!player.Hitbox.Intersects(safeBox) && spawnArena) ? 2f : 1.35f; uDieLul = MathHelper.Clamp(uDieLul * 1.01f, 1f, projectileVelocityMultCap); protectionBoost = !bossRush; if (!player.Hitbox.Intersects(safeBox)) @@ -3632,7 +3632,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas ponyPos -= new Vector2(pony.Width / 2f, pony.Height / 15) * NPC.scale / 2f; ponyPos += ponyOrigin * NPC.scale + new Vector2(-20, NPC.gfxOffY); - if (CalamityConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) + if (CalamityClientConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) { for (int i = 1; i < afterimageAmt; i += 2) { diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index dfe67d8368..ea353dd396 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -475,7 +475,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 origin = NPC.frame.Size() * 0.5f; int afterimageCount = 4; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i += 2) { @@ -492,7 +492,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Color primarycolor = Main.zenithWorld ? Color.Blue : Color.Red; // why? because blue fire is awesome!! Color baseGlowmaskColor = NPC.IsABestiaryIconDummy ? Color.White : Color.Lerp(Color.White, primarycolor, 0.5f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i++) { diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 60631d4c6e..3211f265b3 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -511,7 +511,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 origin = NPC.frame.Size() * 0.5f; int afterimageCount = 4; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i += 2) { @@ -527,7 +527,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas texture = GlowTexture.Value; Color baseGlowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.35f); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageCount; i++) { diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index b455f13eb2..e8acfc2086 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -206,7 +206,6 @@ namespace CalamityMod.NPCs.TownNPCs .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) .Add(ModContent.ItemType()) diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index ff591a3aea..6f9d0a7d19 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -10,6 +10,7 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Events; @@ -217,20 +218,26 @@ namespace CalamityMod.NPCs.TownNPCs int goblinIndex = NPC.FindFirstNPC(NPCID.GoblinTinkerer); if (goblinIndex != -1 && CalamityWorld.Reforges >= 1) { - CalamityWorld.Reforges = 0; - int[] coinCounts = Utils.CoinsSplit(CalamityWorld.MoneyStolenByBandit); - if (coinCounts[0] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.CopperCoin, coinCounts[0]); - if (coinCounts[1] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.SilverCoin, coinCounts[1]); - if (coinCounts[2] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.GoldCoin, coinCounts[2]); - if (coinCounts[3] > 0) - Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.PlatinumCoin, coinCounts[3]); + if (Main.netMode == NetmodeID.SinglePlayer) + { + DoRefund(bandit: NPC); + } + else if (Main.netMode == NetmodeID.MultiplayerClient) + { + // Possible Bug here: Minor text bug when two players send request this simultaneously + // Which result to both player to have successful message but only one request got accepted on server + // But since this is how base gamecode works theres no way to fix this clean way (Unless someone implement net queued response for NPC dialog) + // And as this does not duplicate the coin amount, It's not that bad I think...? + // + // Other way possible is to having bandit stolen inventory per player + // But I didn't wanted to change system too much + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.WantToRefundReforges); + packet.Write((byte)Main.myPlayer); + packet.Send(); + } - CalamityWorld.MoneyStolenByBandit = 0; SoundEngine.PlaySound(SoundID.Coins); // Money dink sound - CalamityNetcode.SyncWorld(); switch (Main.rand.Next(2)) { case 0: @@ -242,6 +249,29 @@ namespace CalamityMod.NPCs.TownNPCs return this.GetLocalizedValue("NoRefund"); } + public static void DoRefund(NPC bandit) + { + if (bandit == null) + return; + + if (CalamityWorld.Reforges <= 0) + return; + + int[] coinCounts = Utils.CoinsSplit(CalamityWorld.MoneyStolenByBandit); + if (coinCounts[0] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.CopperCoin, coinCounts[0]); + if (coinCounts[1] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.SilverCoin, coinCounts[1]); + if (coinCounts[2] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.GoldCoin, coinCounts[2]); + if (coinCounts[3] > 0) + Item.NewItem(new EntitySource_Gift(bandit), bandit.Hitbox, ItemID.PlatinumCoin, coinCounts[3]); + + CalamityWorld.MoneyStolenByBandit = 0; + CalamityWorld.Reforges = 0; + CalamityNetcode.SyncWorld(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (Main.LocalPlayer.Calamity().trippy) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index 22a0005454..f89cc0576c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -16,11 +16,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static bool shouldDrawEnrageBorder = true; public static bool hasTargetBeenInRange = true; - public const float increaseDRTriggerDistance = 450f; - public const float maxDRIncreaseDistance = 900f; + public const float increaseDRTriggerDistance = 750f; + public const float maxDRIncreaseDistance = 1200f; public static float borderDelay = 10f * 60f; - public static float innerBorder = 450f; - public static float outerBorder = 900f; + public static float innerBorder = 750f; + public static float outerBorder = 1200f; public static float borderScalar = 0f; public static Vector2 lastDeerclopsPosition; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index a0a767fa02..19474d1d09 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -29,6 +29,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public const float FlightTelegraphStartGateValue = FlightPhaseGateValue - PhaseTransitionTelegraphTime; private const int OneInXChanceToFireLaser = 200; + public const float ProbeLaserGateValue_Mechdusa = 360f; + public const float ProbeLaserGateValue_Rev = 240f; + public const float ProbeLaserGateValue_BossRush = 150f; + public const float ProbeLaserGateValue = 120f; + public const float ProbeLaserTelegraphTime = 60f; + public static bool BuffedDestroyerAI(NPC npc, Mod mod) { int mechdusaCurvedSpineSegmentIndex = 0; @@ -391,7 +397,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -583,7 +589,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(projectileType); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1287,7 +1293,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -1750,33 +1756,31 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocity = bossRush ? 12f : masterMode ? 8.4f : 7.2f; float acceleration = bossRush ? 0.1f : masterMode ? 0.07f : 0.06f; + float deceleration = 1f - acceleration; - Vector2 probeCenter = npc.Center; - float probeTargetX = targetData.Center.X; - float probeTargetY = targetData.Center.Y; - probeTargetX = (int)(probeTargetX / 8f) * 8; - probeTargetY = (int)(probeTargetY / 8f) * 8; - probeCenter.X = (int)(probeCenter.X / 8f) * 8; - probeCenter.Y = (int)(probeCenter.Y / 8f) * 8; - probeTargetX -= probeCenter.X; - probeTargetY -= probeCenter.Y; - float distanceFromTarget = (float)Math.Sqrt(probeTargetX * probeTargetX + probeTargetY * probeTargetY); - float distance2 = distanceFromTarget; - - bool farAwayFromTarget = false; - if (distanceFromTarget > 600f) - farAwayFromTarget = true; - - if (distanceFromTarget == 0f) + if (targetDead) { - probeTargetX = npc.velocity.X; - probeTargetY = npc.velocity.Y; + Vector2 destination = npc.Center - Vector2.UnitY; + Vector2 idealVelocity = npc.SafeDirectionTo(destination) * velocity * 0.5f; + idealVelocity.X *= npc.direction; + idealVelocity.Y *= 2.5f; + npc.SimpleFlyMovement(idealVelocity, acceleration); + npc.EncourageDespawn(10); + } + else if (npc.Distance(targetData.Center) > 400f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(idealVelocity, acceleration); } else { - distanceFromTarget = velocity / distanceFromTarget; - probeTargetX *= distanceFromTarget; - probeTargetY *= distanceFromTarget; + if (npc.Distance(targetData.Center) < 160f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(-idealVelocity, acceleration); + } + else + npc.velocity *= deceleration; } for (int i = 0; i < Main.maxNPCs; i++) @@ -1800,29 +1804,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (distance2 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - npc.velocity.Y += 0.023f; - else - npc.velocity.Y -= 0.023f; - - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - npc.velocity.X += 0.023f; - else - npc.velocity.X -= 0.023f; - - if (npc.ai[0] > 200f) - npc.ai[0] = -200f; - } - - if (targetDead) - { - probeTargetX = npc.direction * velocity / 2f; - probeTargetY = -velocity / 2f; - } - if (npc.ai[3] != 0f) { if (NPC.IsMechQueenUp) @@ -1876,25 +1857,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } else - { npc.dontTakeDamage = false; - if (npc.velocity.X < probeTargetX) - npc.velocity.X += acceleration; - else if (npc.velocity.X > probeTargetX) - npc.velocity.X -= acceleration; - - if (npc.velocity.Y < probeTargetY) - npc.velocity.Y += acceleration; - else if (npc.velocity.Y > probeTargetY) - npc.velocity.Y -= acceleration; - } - npc.localAI[0] += 1f; - if (npc.justHit && !masterMode) + if ((npc.justHit && !masterMode) || targetDead) npc.localAI[0] = 0f; - float laserGateValue = NPC.IsMechQueenUp ? 360f : bossRush ? 150f : 240f; + float laserGateValue = NPC.IsMechQueenUp ? ProbeLaserGateValue_Mechdusa : bossRush ? ProbeLaserGateValue_BossRush : ProbeLaserGateValue_Rev; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= laserGateValue) { npc.localAI[0] = 0f; @@ -1904,7 +1873,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1915,12 +1884,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int totalProjectiles = oblivionAlive ? 2 : (CalamityWorld.death || bossRush) ? 3 : 1; - Vector2 npcCenter = new Vector2(probeTargetX, probeTargetY); + Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - float projectileVelocity = 8f; - npcCenter = v.SafeNormalize(Vector2.UnitY) * projectileVelocity; + projectileVelocity = v.SafeNormalize(Vector2.UnitY) * 8f; } for (int i = 0; i < totalProjectiles; i++) { @@ -1930,14 +1898,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses case 0: break; case 1: - velocityMultiplier = 0.9f; + velocityMultiplier = 0.95f; break; case 2: - velocityMultiplier = 0.8f; + velocityMultiplier = 0.9f; break; } - Vector2 laserVelocity = npcCenter * velocityMultiplier; - Projectile.NewProjectile(npc.GetSource_FromAI(), probeCenter + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); + Vector2 laserVelocity = projectileVelocity * velocityMultiplier; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); } npc.netUpdate = true; @@ -1949,47 +1917,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (WorldGen.InWorld(x, y) && !WorldGen.SolidTile(x, y)) Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); - if (probeTargetX > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX); - } - if (probeTargetX < 0f) + if (targetData.Center.X - npc.Center.X > 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(probeTargetY, probeTargetX) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); } - - float tilePosX = -0.7f; - if (npc.collideX) + else { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * tilePosX; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * tilePosX; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) - npc.velocity.Y = -2f; - } - - if (farAwayFromTarget) - { - if ((npc.velocity.X > 0f && probeTargetX > 0f) || (npc.velocity.X < 0f && probeTargetX < 0f)) - { - if (Math.Abs(npc.velocity.X) < (NPC.IsMechQueenUp ? 5f : 12f)) - npc.velocity.X *= 1.05f; - } - else - npc.velocity.X *= 0.9f; + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; } if (NPC.IsMechQueenUp && npc.ai[2] == 0f) @@ -2000,13 +1936,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * 120; } - if (targetDead) - { - npc.velocity.Y -= acceleration * 2f; - if (npc.timeLeft > 10) - npc.timeLeft = 10; - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) npc.netUpdate = true; @@ -2019,61 +1948,37 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, default); NPCAimedTarget targetData = npc.GetTargetData(); - bool flag = false; + bool targetDead = false; if (targetData.Type == NPCTargetType.Player) - flag = Main.player[npc.target].dead; + targetDead = Main.player[npc.target].dead; - float num = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; - float num2 = Main.expertMode ? 0.06f : 0.05f; + float velocity = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; + float acceleration = Main.expertMode ? 0.06f : 0.05f; + float deceleration = 1f - acceleration; - Vector2 vector = npc.Center; - float num4 = targetData.Center.X; - float num5 = targetData.Center.Y; - num4 = (int)(num4 / 8f) * 8; - num5 = (int)(num5 / 8f) * 8; - vector.X = (int)(vector.X / 8f) * 8; - vector.Y = (int)(vector.Y / 8f) * 8; - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5); - float num7 = num6; - bool flag2 = false; - if (num6 > 600f) - flag2 = true; - - if (num6 == 0f) + if (targetDead || Main.IsItDay()) { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; + Vector2 destination = npc.Center - Vector2.UnitY; + Vector2 idealVelocity = npc.SafeDirectionTo(destination) * velocity * 0.5f; + idealVelocity.X *= npc.direction; + idealVelocity.Y *= 2.5f; + npc.SimpleFlyMovement(idealVelocity, acceleration); + npc.EncourageDespawn(10); + } + else if (npc.Distance(targetData.Center) > 400f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(idealVelocity, acceleration); } else { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - npc.velocity.Y += 0.023f; + if (npc.Distance(targetData.Center) < 160f) + { + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; + npc.SimpleFlyMovement(-idealVelocity, acceleration); + } else - npc.velocity.Y -= 0.023f; - - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - npc.velocity.X += 0.023f; - else - npc.velocity.X -= 0.023f; - - if (npc.ai[0] > 200f) - npc.ai[0] = -200f; - } - - if (flag) - { - num4 = (float)npc.direction * num / 2f; - num5 = (0f - num) / 2f; + npc.velocity *= deceleration; } if (npc.ai[3] != 0f) @@ -2129,30 +2034,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } else - { npc.dontTakeDamage = false; - if (npc.velocity.X < num4) - npc.velocity.X += num2; - else if (npc.velocity.X > num4) - npc.velocity.X -= num2; - - if (npc.velocity.Y < num5) - npc.velocity.Y += num2; - else if (npc.velocity.Y > num5) - npc.velocity.Y -= num2; - } - npc.localAI[0] += 1f; if (npc.ai[3] != 0f) npc.localAI[0] += 2f; - if (npc.justHit && !Main.masterMode) + if ((npc.justHit && !Main.masterMode) || targetDead) npc.localAI[0] = 0f; - float num10 = 120f; + float num10 = ProbeLaserGateValue; if (NPC.IsMechQueenUp) - num10 = 360f; + num10 = ProbeLaserGateValue_Mechdusa; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= num10) { @@ -2163,7 +2056,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2173,15 +2066,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 vector3 = new Vector2(num4, num5); + Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - float num12 = 8f; - vector3 = v.SafeNormalize(Vector2.UnitY) * num12; + projectileVelocity = v.SafeNormalize(Vector2.UnitY) * 8f; } - Projectile.NewProjectile(npc.GetSource_FromAI(), vector + vector3.SafeNormalize(Vector2.UnitY) * 50f, vector3, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); } } @@ -2192,54 +2084,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (WorldGen.InWorld(num13, num14) && !WorldGen.SolidTile(num13, num14)) Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(num5, num4); - } - - if (num4 < 0f) + if (targetData.Center.X - npc.Center.X > 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(num5, num4) + MathHelper.Pi; + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); } - - float num15 = 0.7f; - if (npc.collideX) + else { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * (0f - num15); - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * (0f - num15); - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - npc.velocity.Y = -2f; - } - - if (flag2) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - int num27 = 12; - if (NPC.IsMechQueenUp) - num27 = 5; - - if (Math.Abs(npc.velocity.X) < (float)num27) - npc.velocity.X *= 1.05f; - } - else - npc.velocity.X *= 0.9f; + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; } if (NPC.IsMechQueenUp && npc.ai[2] == 0f) @@ -2251,12 +2104,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28; } - if (Main.IsItDay() || flag) - { - npc.velocity.Y -= num2 * 2f; - npc.EncourageDespawn(10); - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) npc.netUpdate = true; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index cbcf4efead..e4c312fd4c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -350,7 +350,72 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } else - NormalJump(); + { + if (npc.ai[3] == 0f) + npc.ai[3] = !headAlive ? Main.rand.Next(2) + 1f : 1f; + + switch ((int)npc.ai[3]) + { + default: + case 0: + case 1: + NormalJump(); + break; + + // Jump directly above the target's head and slam down + case 2: + + npc.noTileCollide = true; + + npc.ai[2] += 1f; + float jumpVelocity = death ? 23f : 21f; + if (enrage) + jumpVelocity *= 1.25f; + if (turboEnrage) + jumpVelocity *= 1.5f; + + float minJumpTime = 15f; + float maxJumpTime = 45f; + if ((npc.ai[2] >= minJumpTime && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= jumpVelocity) || npc.ai[2] >= maxJumpTime) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + + Vector2 center = npc.Center; + if (!Main.player[npc.target].dead && Main.player[npc.target].active && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= despawnDistance) + center = Main.player[npc.target].Center; + + center.Y -= 480f; + if (npc.velocity.Y == 0f) + { + npc.velocity = center - npc.Center; + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); + npc.velocity *= jumpVelocity; + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + + float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) + speedMult += distanceBelowTarget * multiplier; + + float speedMultLimit = turboEnrage ? 3.5f : enrage ? 3f : 2.5f; + if (speedMult > speedMultLimit) + speedMult = speedMultLimit; + + if (Main.player[npc.target].position.Y < npc.Bottom.Y) + npc.velocity.Y *= speedMult; + } + else + npc.velocity.Y *= 0.95f; + + break; + } + } void NormalJump() { @@ -1328,21 +1393,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[3] -= 1f + - ((phase2 || turboEnrage) ? 1f : 0f) + - ((phase3 || turboEnrage) ? 1f : 0f) + - ((phase4 || turboEnrage) ? 2f : 0f); + (turboEnrage ? 1f : phase2 ? 0.5f : 0f) + + (turboEnrage ? 1f : phase3 ? 0.5f : 0f) + + (turboEnrage ? 2f : phase4 ? 1f : 0f); float offsetX = calamityGlobalNPC.newAI[0]; float offsetY = calamityGlobalNPC.newAI[1]; Vector2 destination = Main.player[npc.target].Center + new Vector2(offsetX, offsetY); // Velocity and acceleration - float velocity = 16f + - ((phase2 || turboEnrage) ? 8f : 0f) + - ((phase3 || turboEnrage) ? 8f : 0f); + float velocity = (turboEnrage ? 15f : 10f) + + (turboEnrage ? 7.5f : phase2 ? 5f : 0f) + + (turboEnrage ? 7.5f : phase3 ? 5f : 0f); if (enrage) - velocity = (phase3 || turboEnrage) ? 40f : 32f; + velocity = (phase3 || turboEnrage) ? 35f : 25f; float acceleration = phase3 ? 0f : turboEnrage ? 6f : enrage ? 4.8f : phase2 ? 1.2f : 0.8f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 886fc9795e..d4a518e626 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -856,7 +856,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fire stingers bool canFireStingers = stingerSpawnLocation.Y < Main.player[npc.target].Top.Y - maxDistance * 0.8f || !canHitTarget; - if (canFireStingers) + if (canFireStingers && npc.ai[1] < phaseLimit) { npc.ai[1] += 1f; if (npc.ai[1] % stingerAttackTimer == 0f && npc.ai[1] != 0f && npc.ai[1] != phaseLimit) @@ -897,17 +897,30 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Movement calculations - npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); - - // Go to a random phase + // Go to a random phase after pausing for a bit if (npc.ai[1] >= phaseLimit) { - npc.ai[0] = -1f; - npc.ai[1] = 4f; - npc.ai[2] = 0f; - npc.netUpdate = true; + npc.ai[1] += 1f; + + if (npc.Distance(Main.player[npc.target].Center) > 400f || !canHitTarget) + { + idealVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * stingerAttackSpeed; + npc.SimpleFlyMovement(idealVelocity * 0.5f, stingerAttackAccel * 0.5f); + } + else + npc.velocity *= 0.8f; + + float idleTime = masterMode ? 120f : 180f; + if (npc.ai[1] >= phaseLimit + idleTime) + { + npc.ai[0] = -1f; + npc.ai[1] = 4f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } } + else + npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); } if (Main.netMode == NetmodeID.Server) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 499d9ae6a8..23947c59d7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -363,7 +363,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && !(npc.ai[1] == 1f && phase3)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && (!(npc.ai[1] == 1f && phase3) || masterMode)) { // Teleport dust for (int m = 0; m < 30; m++) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index fada2e4274..f98bc6c82d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -319,13 +319,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] = 0f; npc.ai[1] = 1f; + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); npc.netUpdate = true; } else if (shouldSpinAround || npc.ai[1] != 4f) { if (shouldSpinAround) { - npc.localAI[3] = 120f; + npc.localAI[3] = 300f; npc.SyncVanillaLocalAI(); } @@ -345,22 +346,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float accelerationMult = 1f; if (!cannonAlive) { - acceleration += 0.01f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!laserAlive) { - acceleration += 0.01f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!viceAlive) - acceleration += 0.01f; + acceleration += 0.0125f; if (!sawAlive) - acceleration += 0.01f; + acceleration += 0.0125f; if (masterMode) acceleration *= accelerationMult; - float topVelocity = acceleration * 90f; + float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.7f : 0.85f; float headDecelerationUpDist = 0f; @@ -440,7 +441,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -650,7 +651,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning - float spinVelocity = 20f; + float spinVelocity = 30f; if (npc.ai[2] == 2f) { // Play angry noise @@ -704,7 +705,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -755,8 +756,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 21f : death ? 18f : 15f; - float flightAcceleration = bossRush ? 1f : death ? 0.65f : 0.4f; + float flightVelocity = bossRush ? 24f : death ? 21f : 18f; + float flightAcceleration = bossRush ? 1f : death ? 0.8f : 0.6f; if (masterMode) { @@ -785,7 +786,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -993,7 +994,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1061,7 +1062,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1296,7 +1297,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1343,7 +1344,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -2541,7 +2542,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2641,7 +2642,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 033dde9ece..4bfee885d7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.4f : 0f; + float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -96,9 +96,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == ModContent.NPCType()) && Main.npc[i].timeLeft - 1 > npc.timeLeft) npc.timeLeft = Main.npc[i].timeLeft - 1; - } } @@ -116,6 +115,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + // Foveanator spawn + if (!oblivionAlive && masterMode && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + calamityGlobalNPC.newAI[0] = 1f; + npc.SyncExtraAI(); + } + // Phase HP ratios float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; @@ -302,7 +309,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -441,7 +448,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -623,8 +630,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : 52f) : 26f)) { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || finalPhase) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; float retinazerPhase2LaserSpeed = 10f; @@ -633,7 +639,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -649,16 +655,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses retinazerPhase2TargetY *= retinazerPhase2TargetDist; Vector2 laserVelocity = new Vector2(retinazerPhase2TargetX, retinazerPhase2TargetY); - if (canHit) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } + Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -729,15 +726,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : 20f) : 10f)) { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || finalPhase) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; int type = ProjectileID.DeathLaser; int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -753,16 +749,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; Vector2 laserVelocity = new Vector2(retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY); - if (canHit) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -770,7 +757,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += spazAlive ? 1f : 1.5f; if (npc.ai[2] >= (masterMode ? 150f : 180f) - (death ? (masterMode ? 60f : 90f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) { - npc.ai[1] = (!spazAlive || finalPhase) ? 4f : 0f; + npc.ai[1] = finalPhase ? 4f : 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -857,7 +844,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1010,7 +997,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.4f : 0f; + float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -1083,9 +1070,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == ModContent.NPCType()) && Main.npc[i].timeLeft - 1 > npc.timeLeft) npc.timeLeft = Main.npc[i].timeLeft - 1; - } } @@ -1105,7 +1091,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase HP ratios float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; - float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + float finalPhaseLifeRatio = masterMode ? 0.3f : 0.15f; // Movement variables float phase1MaxSpeedIncrease = masterMode ? 2.25f : 4.5f; @@ -1282,7 +1268,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1430,7 +1416,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1578,15 +1564,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phaseGateValue = NPC.IsMechQueenUp ? 900f : 180f - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] >= phaseGateValue) { - npc.ai[1] = (!retAlive || finalPhase) ? 5f : 1f; + npc.ai[1] = finalPhase ? 5f : 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; npc.netUpdate = true; } // Fire fireballs and flamethrower - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !retAlive || finalPhase) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { // Play flame sound on timer npc.localAI[2] += 1f; @@ -1613,7 +1598,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1644,20 +1629,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } Vector2 flamethrowerVelocity = new Vector2(spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY); - if (canHit) + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + if (masterMode && npc.ai[3] % 30f == 0f) { - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - if (masterMode && npc.ai[3] % 30f == 0f) - { - type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); - } - } - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; + type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); } } } @@ -1821,7 +1798,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -1972,7 +1949,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; @@ -2226,7 +2203,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2367,7 +2344,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2547,7 +2524,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2638,7 +2615,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -2886,7 +2863,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -3024,7 +3001,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; @@ -3182,7 +3159,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) { double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 20bcd90c8e..26f7112402 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses distanceFromTarget = targetPosition - npcPosition; float halfAverageScreenWidth = 960f; - float distanceBeforeSlowingDown = 400f; + float distanceBeforeSlowingDown = 640f; float timeBeforeEnrage = (masterMode ? 150f : 600f) - (death ? (masterMode ? 130f : 390f) * (1f - lifeRatio) : 0f); float speedMult = 1f; @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[0] -= 1f; } - speedMult = MathHelper.Clamp(speedMult, 0.75f, 2f); + speedMult = MathHelper.Clamp(speedMult, 0.4f, 2f); } // Enrage if target is off screen for too long @@ -311,8 +311,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float masterModeVelocityBoost = 0f; if (masterMode) { - float velocityBoostStartDistance = 480f; - float velocityBoostMaxDistance = velocityBoostStartDistance * 2f; + float velocityBoostStartDistance = distanceBeforeSlowingDown; + float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); @@ -450,51 +450,56 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.rand.NextBool(chance)) { - int hungryAmt = 0; - float[] array = new float[10]; - for (int j = 0; j < Main.maxNPCs; j++) + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(masterMode ? 2f : 1f, masterMode ? 8f : 4f, npc.life / (float)npc.lifeMax)); + if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { - if (hungryAmt < 10 && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) + int hungryAmt = 0; + int maxHungries = 10; + float[] array = new float[maxHungries]; + for (int j = 0; j < Main.maxNPCs; j++) { - array[hungryAmt] = Main.npc[j].ai[0]; - hungryAmt++; - } - } - - int maxValue = 1 + hungryAmt * 2; - if (masterMode) - maxValue /= 2; - - if (maxValue < 2) - maxValue = 2; - - if (hungryAmt < 10 && Main.rand.Next(maxValue) <= 1) - { - int spawnHungryControl = -1; - for (int k = 0; k < 1000; k++) - { - int randomHungrySpawnValue = Main.rand.Next(10); - float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; - bool shouldRespawnHungry = true; - for (int i = 0; i < hungryAmt; i++) + if (hungryAmt < maxHungries && Main.npc[j].active && Main.npc[j].type == NPCID.TheHungry) { - if (hungryArrayValue == array[i]) + array[hungryAmt] = Main.npc[j].ai[0]; + hungryAmt++; + } + } + + int maxValue = 1 + hungryAmt * 2; + if (masterMode) + maxValue /= 2; + + if (maxValue < 2) + maxValue = 2; + + if (hungryAmt < maxHungries && Main.rand.Next(maxValue) <= 1) + { + int spawnHungryControl = -1; + for (int k = 0; k < 1000; k++) + { + int randomHungrySpawnValue = Main.rand.Next(maxHungries); + float hungryArrayValue = randomHungrySpawnValue * 0.1f - 0.05f; + bool shouldRespawnHungry = true; + for (int i = 0; i < hungryAmt; i++) { - shouldRespawnHungry = false; + if (hungryArrayValue == array[i]) + { + shouldRespawnHungry = false; + break; + } + } + if (shouldRespawnHungry) + { + spawnHungryControl = randomHungrySpawnValue; break; } } - if (shouldRespawnHungry) + if (spawnHungryControl >= 0) { - spawnHungryControl = randomHungrySpawnValue; - break; + int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); + Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; } } - if (spawnHungryControl >= 0) - { - int hungryRespawns = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); - Main.npc[hungryRespawns].ai[0] = spawnHungryControl * 0.1f - 0.05f; - } } } } @@ -521,11 +526,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses mouthYPosition = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; mouthYPosition = (mouthYPosition + Main.wofDrawAreaBottom) / 2f; - int maxHungries = masterMode ? 15 : 11; + int maxHungries = masterMode ? 16 : 11; + float maxOffset = masterMode ? (0.2f / 3f) : 0.1f; for (int j = 0; j < maxHungries; j++) { int hungrySpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)mouthYPosition, NPCID.TheHungry, npc.whoAmI); - Main.npc[hungrySpawn].ai[0] = j * 0.1f - 0.05f; + Main.npc[hungrySpawn].ai[0] = j * maxOffset - 0.05f; } } @@ -724,6 +730,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool shouldFireLasers = true; float phase2LifeRatio = 0.5f; bool masterModeDetach = lifeRatio < phase2LifeRatio && masterMode; + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (!masterModeDetach) { npc.position.X = Main.npc[Main.wofNPCIndex].position.X; @@ -759,7 +766,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - float distanceAboveTarget = 240f * npc.ai[0]; + float distanceAboveTarget = (canHit ? 240f : 120f) * npc.ai[0]; float distanceAwayFromTargetX = 560f; float distanceAwayFromTargetXLeeway = 40f; float distanceAwayFromTargetY = Main.player[npc.target].Center.Y - npc.Center.Y; @@ -864,8 +871,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float shootBoost = fireEnragedLasers ? (death ? 5f : 4f) : (death ? 3f : 3f * (1f - lifeRatio)); npc.localAI[1] += 1f + shootBoost; - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[2] == 0f) { if (npc.localAI[1] > LaserShootGateValue) @@ -1111,11 +1116,29 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y = 0f; npc.position.Y = num368; + float targetPosition = Main.player[npc.target].Center.X; + float npcPosition = npc.Center.X; + + // Slow down if close + float distanceFromTarget; + if (npc.velocity.X < 0f) + distanceFromTarget = npcPosition - targetPosition; + else + distanceFromTarget = targetPosition - npcPosition; + + float distanceBeforeSlowingDown = 640f; + float speedMult = 1f; + + if (distanceFromTarget < distanceBeforeSlowingDown) + speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; + + speedMult = MathHelper.Clamp(speedMult, 0.4f, 1f); + float masterModeVelocityBoost = 0f; if (Main.masterMode) { - float velocityBoostStartDistance = 480f; - float velocityBoostMaxDistance = velocityBoostStartDistance * 2f; + float velocityBoostStartDistance = distanceBeforeSlowingDown; + float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); @@ -1175,6 +1198,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num369 += 0.2f; } + num369 *= speedMult; + if (npc.velocity.X == 0f) { npc.TargetClosest(); @@ -1255,66 +1280,71 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) { - int num378 = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); - num378 *= num378; - if (num378 < 400) - num378 = (num378 * 19 + 400) / 20; + int chanceToSpawnHungry = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); + chanceToSpawnHungry *= chanceToSpawnHungry; + if (chanceToSpawnHungry < 400) + chanceToSpawnHungry = (chanceToSpawnHungry * 19 + 400) / 20; - if (num378 < 60) - num378 = (num378 * 3 + 60) / 4; + if (chanceToSpawnHungry < 60) + chanceToSpawnHungry = (chanceToSpawnHungry * 3 + 60) / 4; - if (num378 < 20) - num378 = (num378 + 20) / 2; + if (chanceToSpawnHungry < 20) + chanceToSpawnHungry = (chanceToSpawnHungry + 20) / 2; - num378 = (int)((double)num378 * (Main.masterMode ? 0.5 : 0.7)); - if (num378 < 2) - num378 = 2; + chanceToSpawnHungry = (int)((double)chanceToSpawnHungry * (Main.masterMode ? 0.5 : 0.7)); + if (chanceToSpawnHungry < 2) + chanceToSpawnHungry = 2; - if (Main.rand.NextBool(num378)) + if (Main.rand.NextBool(chanceToSpawnHungry)) { - int num379 = 0; - float[] array = new float[10]; - for (int num380 = 0; num380 < Main.maxNPCs; num380++) + int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(Main.masterMode ? 2f : 1f, Main.masterMode ? 8f : 4f, npc.life / (float)npc.lifeMax)); + if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) { - if (num379 < 10 && Main.npc[num380].active && Main.npc[num380].type == NPCID.TheHungry) + int hungryCount = 0; + int maxHungries = 10; + float[] hungryArray = new float[maxHungries]; + for (int i = 0; i < Main.maxNPCs; i++) { - array[num379] = Main.npc[num380].ai[0]; - num379++; - } - } - - int maxValue = 1 + num379 * 2; - if (Main.masterMode) - maxValue /= 2; - if (maxValue < 2) - maxValue = 2; - - if (num379 < 10 && Main.rand.Next(maxValue) <= 1) - { - int num381 = -1; - for (int num382 = 0; num382 < 1000; num382++) - { - int num383 = Main.rand.Next(10); - float num384 = (float)num383 * 0.1f - 0.05f; - bool flag26 = true; - for (int num385 = 0; num385 < num379; num385++) + if (hungryCount < maxHungries && Main.npc[i].active && Main.npc[i].type == NPCID.TheHungry) { - if (num384 == array[num385]) + hungryArray[hungryCount] = Main.npc[i].ai[0]; + hungryCount++; + } + } + + int maxValue = 1 + hungryCount * 2; + if (Main.masterMode) + maxValue /= 2; + if (maxValue < 2) + maxValue = 2; + + if (hungryCount < maxHungries && Main.rand.Next(maxValue) <= 1) + { + int ai0 = -1; + for (int i = 0; i < 1000; i++) + { + int randomHungryLocation = Main.rand.Next(maxHungries); + float hungryLocation = (float)randomHungryLocation * 0.1f - 0.05f; + bool spawnHungry = true; + for (int j = 0; j < hungryCount; j++) { - flag26 = false; + if (hungryLocation == hungryArray[j]) + { + spawnHungry = false; + break; + } + } + + if (spawnHungry) + { + ai0 = randomHungryLocation; break; } } - if (flag26) - { - num381 = num383; - break; - } + if (ai0 >= 0) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)ai0 * 0.1f - 0.05f); } - - if (num381 >= 0) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)num381 * 0.1f - 0.05f); } } } @@ -1327,9 +1357,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float num388 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num388, NPCID.WallofFleshEye, npc.whoAmI, -1f); float num389 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; - int maxHungries = Main.masterMode ? 17 : 11; - for (int num390 = 0; num390 < maxHungries; num390++) - num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num389, NPCID.TheHungry, npc.whoAmI, (float)num390 * 0.1f - 0.05f); + int maxHungries = Main.masterMode ? 16 : 11; + float maxOffset = Main.masterMode ? (0.2f / 3f) : 0.1f; + for (int i = 0; i < maxHungries; i++) + num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num389, NPCID.TheHungry, npc.whoAmI, i * maxOffset - 0.05f); } return false; diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index c8c313ddd0..b7d968484d 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -3635,6 +3635,7 @@ PrepareToShoot: npc.localAI[2] = 0f; npc.SyncVanillaLocalAI(); } + if (npc.localAI[1] == 0f) { npc.alpha = 0; @@ -3785,183 +3786,44 @@ PrepareToShoot: acceleration *= 1.25f; } - Vector2 vector = npc.Center; - float targetXDist = Main.player[npc.target].Center.X; - float targetYDist = Main.player[npc.target].Center.Y; - targetXDist = (float)((int)(targetXDist / 8f) * 8); - targetYDist = (float)((int)(targetYDist / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - targetXDist -= vector.X; - targetYDist -= vector.Y; - float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float targetDistCheck = targetDistance; - - bool flag = false; - if (targetDistance > 600f) - flag = true; - - if (targetDistance == 0f) + if (queenBeeHornet) { - targetXDist = npc.velocity.X; - targetYDist = npc.velocity.Y; - } - else - { - targetDistance = maxVelocity / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - } - - if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) - { - if (targetDistCheck > 100f || npc.type == NPCID.Corruptor || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) + float deceleration = 1f - acceleration; + if (targetDead) { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - npc.velocity.Y += CalamityWorld.revenge ? 0.03f : 0.023f; - else - npc.velocity.Y -= CalamityWorld.revenge ? 0.03f : 0.023f; - - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - npc.velocity.X += CalamityWorld.revenge ? 0.03f : 0.023f; - else - npc.velocity.X -= CalamityWorld.revenge ? 0.03f : 0.023f; - - if (npc.ai[0] > 200f) - npc.ai[0] = -200f; + Vector2 destination = npc.Center - Vector2.UnitY; + Vector2 idealVelocity = npc.SafeDirectionTo(destination) * maxVelocity * 0.5f; + idealVelocity.X *= npc.direction; + idealVelocity.Y *= 2.5f; + npc.SimpleFlyMovement(idealVelocity, acceleration); + npc.EncourageDespawn(10); + npc.wet = false; + npc.noTileCollide = true; } - - if (targetDistCheck < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid)) + else if (npc.Distance(targetData.Center) > 400f) { - npc.velocity.X += targetXDist * (CalamityWorld.revenge ? 0.009f : 0.007f); - npc.velocity.Y += targetYDist * (CalamityWorld.revenge ? 0.009f : 0.007f); + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * maxVelocity; + npc.SimpleFlyMovement(idealVelocity, acceleration); } - - // Master Mode Queen Bee Bees - if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) + else { - if (npc.ai[3] == 1f) + if (npc.Distance(targetData.Center) < 160f) { - float pushVelocity = 0.5f + npc.ai[2] * 0.2f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != npc.whoAmI && Main.npc[i].type == npc.type) - { - if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 32f * npc.scale) - { - if (npc.position.X < Main.npc[i].position.X) - npc.velocity.X -= pushVelocity; - else - npc.velocity.X += pushVelocity; - - if (npc.position.Y < Main.npc[i].position.Y) - npc.velocity.Y -= pushVelocity; - else - npc.velocity.Y += pushVelocity; - } - } - } - } + Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * maxVelocity; + npc.SimpleFlyMovement(-idealVelocity, acceleration); } + else + npc.velocity *= deceleration; } - } - if (targetDead) - { - targetXDist = (float)npc.direction * maxVelocity / 2f; - targetYDist = -maxVelocity / 2f; - } - - if (npc.velocity.X < targetXDist) - { - npc.velocity.X += acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.X < 0f && targetXDist > 0f) - npc.velocity.X += acceleration; - } - else if (npc.velocity.X > targetXDist) - { - npc.velocity.X -= acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.X > 0f && targetXDist < 0f) - npc.velocity.X -= acceleration; - } - - if (npc.velocity.Y < targetYDist) - { - npc.velocity.Y += acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.Y < 0f && targetYDist > 0f) - npc.velocity.Y += acceleration; - } - else if (npc.velocity.Y > targetYDist) - { - npc.velocity.Y -= acceleration; - if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && !queenBeeHornet && npc.type != NPCID.BloodSquid && npc.velocity.Y > 0f && targetYDist < 0f) - npc.velocity.Y -= acceleration; - } - - if (npc.type == NPCID.ServantofCthulhu) - { - float pushVelocity = 0.5f + npc.ai[2] * 0.25f; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != npc.whoAmI && Main.npc[i].type == npc.type) - { - if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 48f * npc.scale) - { - if (npc.position.X < Main.npc[i].position.X) - npc.velocity.X -= pushVelocity; - else - npc.velocity.X += pushVelocity; - - if (npc.position.Y < Main.npc[i].position.Y) - npc.velocity.Y -= pushVelocity; - else - npc.velocity.Y += pushVelocity; - } - } - } - } - } - - if (npc.type == NPCID.MeteorHead) - { - if (targetXDist > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist); - } - else if (targetXDist < 0f) - { + if (targetData.Center.X - npc.Center.X > 0f) npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + MathHelper.Pi; - } - } - else if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) - { - npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) - MathHelper.PiOver2; - } - else if (npc.type == NPCID.Moth || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) - { - if (npc.velocity.X > 0f) + else npc.spriteDirection = 1; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; npc.rotation = npc.velocity.X * 0.1f; - } - else - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - MathHelper.PiOver2; - if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) - { float reboundSpeed = 0.7f; - if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) - reboundSpeed = 0.4f; - if (npc.collideX) { npc.netUpdate = true; @@ -3981,60 +3843,256 @@ PrepareToShoot: if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) npc.velocity.Y = -2f; } + } + else + { + Vector2 vector = npc.Center; + float targetXDist = Main.player[npc.target].Center.X; + float targetYDist = Main.player[npc.target].Center.Y; + targetXDist = (float)((int)(targetXDist / 8f) * 8); + targetYDist = (float)((int)(targetYDist / 8f) * 8); + vector.X = (float)((int)(vector.X / 8f) * 8); + vector.Y = (float)((int)(vector.Y / 8f) * 8); + targetXDist -= vector.X; + targetYDist -= vector.Y; + float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); + float targetDistCheck = targetDistance; - if (npc.type == NPCID.BloodSquid) + if (targetDistance == 0f) { - int bloodDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); - Main.dust[bloodDust].velocity *= 0.5f; + targetXDist = npc.velocity.X; + targetYDist = npc.velocity.Y; } - else if (npc.type == NPCID.MeteorHead) + else { - int meteorDust = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, DustID.Torch, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); - Dust dust = Main.dust[meteorDust]; - dust.noGravity = true; - dust.velocity.X *= 0.3f; - dust.velocity.Y *= 0.3f; + targetDistance = maxVelocity / targetDistance; + targetXDist *= targetDistance; + targetYDist *= targetDistance; } - else if (npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && Main.rand.NextBool(20)) - { - int dustType = 18; - if (npc.type == NPCID.Crimera) - dustType = 5; - int idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), dustType, npc.velocity.X, 2f, 75, npc.color, npc.scale); - Dust dust = Main.dust[idleDust]; + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) + { + if (targetDistCheck > 100f || npc.type == NPCID.Corruptor || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) + { + npc.ai[0] += 1f; + if (npc.ai[0] > 0f) + npc.velocity.Y += CalamityWorld.revenge ? 0.03f : 0.023f; + else + npc.velocity.Y -= CalamityWorld.revenge ? 0.03f : 0.023f; + + if (npc.ai[0] < -100f || npc.ai[0] > 100f) + npc.velocity.X += CalamityWorld.revenge ? 0.03f : 0.023f; + else + npc.velocity.X -= CalamityWorld.revenge ? 0.03f : 0.023f; + + if (npc.ai[0] > 200f) + npc.ai[0] = -200f; + } + + if (targetDistCheck < 150f && (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid)) + { + npc.velocity.X += targetXDist * (CalamityWorld.revenge ? 0.009f : 0.007f); + npc.velocity.Y += targetYDist * (CalamityWorld.revenge ? 0.009f : 0.007f); + } + + // Master Mode Queen Bee Bees + if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) + { + if (npc.ai[3] == 1f) + { + float pushVelocity = 0.5f + npc.ai[2] * 0.2f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != npc.whoAmI && Main.npc[i].type == npc.type) + { + if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 32f * npc.scale) + { + if (npc.position.X < Main.npc[i].position.X) + npc.velocity.X -= pushVelocity; + else + npc.velocity.X += pushVelocity; + + if (npc.position.Y < Main.npc[i].position.Y) + npc.velocity.Y -= pushVelocity; + else + npc.velocity.Y += pushVelocity; + } + } + } + } + } + } + } + + if (targetDead) + { + targetXDist = (float)npc.direction * maxVelocity / 2f; + targetYDist = -maxVelocity / 2f; + } + + if (npc.velocity.X < targetXDist) + { + npc.velocity.X += acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.BloodSquid && npc.velocity.X < 0f && targetXDist > 0f) + npc.velocity.X += acceleration; + } + else if (npc.velocity.X > targetXDist) + { + npc.velocity.X -= acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.BloodSquid && npc.velocity.X > 0f && targetXDist < 0f) + npc.velocity.X -= acceleration; + } + + if (npc.velocity.Y < targetYDist) + { + npc.velocity.Y += acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.BloodSquid && npc.velocity.Y < 0f && targetYDist > 0f) + npc.velocity.Y += acceleration; + } + else if (npc.velocity.Y > targetYDist) + { + npc.velocity.Y -= acceleration; + if (npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.Corruptor && npc.type != NPCID.BloodSquid && npc.velocity.Y > 0f && targetYDist < 0f) + npc.velocity.Y -= acceleration; + } + + if (npc.type == NPCID.ServantofCthulhu) + { + float pushVelocity = 0.5f + npc.ai[2] * 0.25f; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active) + { + if (i != npc.whoAmI && Main.npc[i].type == npc.type) + { + if (Vector2.Distance(npc.Center, Main.npc[i].Center) < 48f * npc.scale) + { + if (npc.position.X < Main.npc[i].position.X) + npc.velocity.X -= pushVelocity; + else + npc.velocity.X += pushVelocity; + + if (npc.position.Y < Main.npc[i].position.Y) + npc.velocity.Y -= pushVelocity; + else + npc.velocity.Y += pushVelocity; + } + } + } + } + } + + if (npc.type == NPCID.MeteorHead) + { + if (targetXDist > 0f) + { + npc.spriteDirection = 1; + npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist); + } + else if (targetXDist < 0f) + { + npc.spriteDirection = -1; + npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + MathHelper.Pi; + } + } + else if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) + { + npc.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) - MathHelper.PiOver2; + } + else if (npc.type == NPCID.Moth || npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) + { + if (npc.velocity.X > 0f) + npc.spriteDirection = 1; + if (npc.velocity.X < 0f) + npc.spriteDirection = -1; + + npc.rotation = npc.velocity.X * 0.1f; + } + else + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - MathHelper.PiOver2; + + if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy) || npc.type == NPCID.EaterofSouls || npc.type == NPCID.MeteorHead || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.Moth || npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.BloodSquid) + { + float reboundSpeed = 0.7f; + if (npc.type == NPCID.EaterofSouls || npc.type == NPCID.Crimera) + reboundSpeed = 0.4f; + + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -reboundSpeed; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + npc.velocity.X = 2f; + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + npc.velocity.X = -2f; + } + + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -reboundSpeed; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + npc.velocity.Y = 2f; + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + npc.velocity.Y = -2f; + } + + if (npc.type == NPCID.BloodSquid) + { + int bloodDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100); + Main.dust[bloodDust].velocity *= 0.5f; + } + else if (npc.type == NPCID.MeteorHead) + { + int meteorDust = Dust.NewDust(new Vector2(npc.position.X - npc.velocity.X, npc.position.Y - npc.velocity.Y), npc.width, npc.height, DustID.Torch, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); + Dust dust = Main.dust[meteorDust]; + dust.noGravity = true; + dust.velocity.X *= 0.3f; + dust.velocity.Y *= 0.3f; + } + else if (npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && Main.rand.NextBool(20)) + { + int dustType = 18; + if (npc.type == NPCID.Crimera) + dustType = 5; + + int idleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), dustType, npc.velocity.X, 2f, 75, npc.color, npc.scale); + Dust dust = Main.dust[idleDust]; + dust.velocity.X *= 0.5f; + dust.velocity.Y *= 0.1f; + } + } + else if (npc.type != NPCID.Parrot && Main.rand.NextBool(40)) + { + int otherIdleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default(Color), 1f); + Dust dust = Main.dust[otherIdleDust]; dust.velocity.X *= 0.5f; dust.velocity.Y *= 0.1f; } - } - else if (npc.type != NPCID.Parrot && Main.rand.NextBool(40)) - { - int otherIdleDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f, 0, default(Color), 1f); - Dust dust = Main.dust[otherIdleDust]; - dust.velocity.X *= 0.5f; - dust.velocity.Y *= 0.1f; - } - if ((npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) && npc.wet) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.95f; + if ((npc.type == NPCID.EaterofSouls || npc.type == NPCID.Corruptor || npc.type == NPCID.Crimera || npc.type == NPCID.BloodSquid) && npc.wet) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.95f; - npc.velocity.Y -= CalamityWorld.revenge ? 0.4f : 0.3f; - if (npc.velocity.Y < -(CalamityWorld.revenge ? 3f : 2f)) - npc.velocity.Y = -(CalamityWorld.revenge ? 3f : 2f); - } + npc.velocity.Y -= CalamityWorld.revenge ? 0.4f : 0.3f; + if (npc.velocity.Y < -(CalamityWorld.revenge ? 3f : 2f)) + npc.velocity.Y = -(CalamityWorld.revenge ? 3f : 2f); + } - if (npc.type == NPCID.Moth && npc.wet) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.95f; + if (npc.type == NPCID.Moth && npc.wet) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.95f; - npc.velocity.Y -= 0.7f; - if (npc.velocity.Y < -6f) - npc.velocity.Y = -6f; + npc.velocity.Y -= 0.7f; + if (npc.velocity.Y < -6f) + npc.velocity.Y = -6f; - npc.TargetClosest(true); + npc.TargetClosest(); + } } if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || (npc.type >= NPCID.HornetFatty && npc.type <= NPCID.HornetStingy)) @@ -4103,17 +4161,6 @@ PrepareToShoot: } } - if (queenBeeHornet & flag) - { - if ((npc.velocity.X > 0f && targetXDist > 0f) || (npc.velocity.X < 0f && targetXDist < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - npc.velocity.X *= 1.05f; - } - else - npc.velocity.X *= 0.9f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && !targetDead) { if (Main.getGoodWorld && npc.type == NPCID.EaterofSouls) @@ -4199,11 +4246,14 @@ PrepareToShoot: } } - if ((Main.dayTime && npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.MeteorHead && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && npc.type != NPCID.Corruptor && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.BloodSquid) || Main.player[npc.target].dead) + if (!queenBeeHornet) { - npc.velocity.Y -= acceleration * 2f; - if (npc.timeLeft > 10) - npc.timeLeft = 10; + if ((Main.dayTime && npc.type != NPCID.Crimera && npc.type != NPCID.EaterofSouls && npc.type != NPCID.MeteorHead && npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall && npc.type != NPCID.Corruptor && npc.type != NPCID.Moth && npc.type != NPCID.Parrot && npc.type != NPCID.BloodSquid) || Main.player[npc.target].dead) + { + npc.velocity.Y -= acceleration * 2f; + if (npc.timeLeft > 10) + npc.timeLeft = 10; + } } if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 8b492036f8..ce447fe3be 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.Yharon float lifeRatio = NPC.life / (float)NPC.lifeMax; // Stop rain - if (CalamityConfig.Instance.BossesStopWeather) + if (CalamityServerConfig.Instance.BossesStopWeather) CalamityMod.StopRain(); // Variables @@ -2773,7 +2773,7 @@ namespace CalamityMod.NPCs.Yharon else color = drawColor; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { @@ -2822,7 +2822,7 @@ namespace CalamityMod.NPCs.Yharon afterimageScale = 20f; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int k = 0; k < additionalAfterimageAmt; k++) { @@ -2899,7 +2899,7 @@ namespace CalamityMod.NPCs.Yharon blueGlowColor *= teleportGlowColorScaler; } - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int l = 1; l < afterimageAmt; l += afterimageIncrement) { diff --git a/Particles/BlastCone.png b/Particles/BlastCone.png new file mode 100644 index 0000000000..eb2027990f Binary files /dev/null and b/Particles/BlastCone.png differ diff --git a/Particles/ChumBone.cs b/Particles/ChumBone.cs new file mode 100644 index 0000000000..88838070b4 --- /dev/null +++ b/Particles/ChumBone.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ChumBone : Particle + { + public override string Texture => "CalamityMod/Particles/ChumBone1"; + + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + private bool direction; + private bool variant; + public static string Texture2 => "CalamityMod/Particles/ChumBone2"; + + public ChumBone(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, int lifeTime, bool variant, bool direction) + { + Position = position; + Velocity = velocity; + Scale = scale; + Lifetime = lifeTime; + Rotation = rotation; + Color = color; + } + + public override void Update() + { + // Gravity + Tile below = CalamityUtils.ParanoidTileRetrieval((int)(Position.X / 16), (int)(Position.Y / 16)); + if (!below.HasTile || !below.IsTileSolid() || below.Slope > 0) + { + if (Velocity.Y < 10) + { + Velocity.Y += 1; + } + } + else + { + Velocity.Y = 0; + } + if (Time == Lifetime) + { + for (int i = 0; i < 4; i++) + { + Dust.NewDust(Position, 10, 10, DustID.Bone, Main.rand.NextFloat(-4, 4), Main.rand.NextFloat(-4, 4)); + } + } + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = variant ? ModContent.Request(Texture2).Value : ModContent.Request(Texture).Value; + SpriteEffects spriteDir = direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Lighting.GetColor(Position.ToTileCoordinates()), Rotation, new Vector2(tex.Width / 2, tex.Height), Scale, spriteDir, 0); + } + } +} diff --git a/Particles/ChumBone1.png b/Particles/ChumBone1.png new file mode 100644 index 0000000000..86bff0e329 Binary files /dev/null and b/Particles/ChumBone1.png differ diff --git a/Particles/ChumBone2.png b/Particles/ChumBone2.png new file mode 100644 index 0000000000..58961d2094 Binary files /dev/null and b/Particles/ChumBone2.png differ diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index a3072597f7..415faf1555 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -18,11 +18,12 @@ namespace CalamityMod.Particles private string NewTexture; private float OriginalScale; private float FinalScale; + private float BaseOpacity; private float opacity; private Vector2 Squish; private Color BaseColor; - public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true) + public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true, float baseOpacity = 1f) { Position = position; Velocity = velocity; @@ -32,6 +33,7 @@ namespace CalamityMod.Particles FinalScale = finalScale; Scale = originalScale; Lifetime = lifeTime; + BaseOpacity = baseOpacity; Squish = squish; Rotation = rotation; UseAltVisual = UseAdditiveBlend; @@ -42,7 +44,7 @@ namespace CalamityMod.Particles float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); - opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) * BaseOpacity; Color = BaseColor * opacity; Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs new file mode 100644 index 0000000000..6b2b72ef92 --- /dev/null +++ b/Particles/CustomSpark.cs @@ -0,0 +1,92 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class CustomSpark : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public string NewTexture; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false) + { + Position = relativePosition; + Velocity = velocity; + NewTexture = texture; + ExtraRotation = extraRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + } + + public override void Update() + { + if (!FadeIn) + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Stretch * Scale; + Texture2D texture = ModContent.Request(NewTexture).Value; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (GlowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + } + } +} diff --git a/Particles/EmoteExpressionParticle.cs b/Particles/EmoteExpressionParticle.cs new file mode 100644 index 0000000000..4e9de2e4e0 --- /dev/null +++ b/Particles/EmoteExpressionParticle.cs @@ -0,0 +1,57 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class EmoteExpressionParticle : Particle + { + public override string Texture => "CalamityMod/Particles/EmoteExpressions"; + + public override bool UseCustomDraw => true; + + public override bool SetLifetime => true; + + public enum EmoteType + { + Exclamation, + DoubleExclamation, + QuestionExclamation, + Question, + Note, + DoubleNote, + Smile, + BigSmile + } + + private Rectangle Frame; + + public EmoteExpressionParticle(Vector2 position, Vector2 velocity, float scale, Color color, int lifeTime, EmoteType emote) + { + Position = position; + Scale = scale; + Velocity = velocity; + Color = color; + Lifetime = lifeTime; + Frame = ModContent.Request(Texture).Value.Frame(horizontalFrames: 8, verticalFrames: 1, frameX: (int)emote); + Rotation = velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void Update() + { + Velocity *= 0.96f; + Scale *= 0.97f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D emoteTexture = ModContent.Request(Texture).Value; + Vector2 origin = new Vector2(Frame.Width / 2f, Frame.Height); + float opacity = 1 - (float)Math.Pow(LifetimeCompletion, 4f); + + spriteBatch.Draw(emoteTexture, Position - Main.screenPosition, Frame, Color * opacity, Rotation, origin, Scale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/EmoteExpressions.png b/Particles/EmoteExpressions.png new file mode 100644 index 0000000000..3c08c3cce8 Binary files /dev/null and b/Particles/EmoteExpressions.png differ diff --git a/Particles/FlameExplosion.cs b/Particles/FlameExplosion.cs new file mode 100644 index 0000000000..6403703253 --- /dev/null +++ b/Particles/FlameExplosion.cs @@ -0,0 +1,55 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Particles +{ + public class FlameExplosion : Particle + { + public override string Texture => "CalamityMod/Particles/FlameExplosion"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private float opacity; + private Vector2 Squish; + private Color BaseColor; + + public FlameExplosion(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, float opacity) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Squish = squish; + Rotation = rotation; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + + Color = BaseColor * opacity; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + Velocity *= 0.95f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + } + + } +} diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 6791e8a9ed..eaa9d59dec 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Particles if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) return; - if (particles.Count >= CalamityConfig.Instance.ParticleLimit && !particle.Important) + if (particles.Count >= CalamityClientConfig.Instance.ParticleLimit && !particle.Important) return; particles.Add(particle); @@ -165,8 +165,14 @@ namespace CalamityMod.Particles particle.CustomDraw(sb); else { + Color lightColor = particle.Color; + if (particle.AffectedByLight) + { + lightColor = particle.Color.MultiplyRGB(Lighting.GetColor((particle.Position / 16).ToPoint())); + } + Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); - sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, particle.Color, particle.Rotation, frame.Size() * 0.5f, + sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, lightColor, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); } } @@ -233,7 +239,7 @@ namespace CalamityMod.Particles if (Main.dedServ || particles == null) return 0; - return CalamityConfig.Instance.ParticleLimit - particles.Count(); + return CalamityClientConfig.Instance.ParticleLimit - particles.Count(); } /// diff --git a/Particles/GlowSparkParticle.cs b/Particles/GlowSparkParticle.cs index 424589f5b0..7e81b9a9c4 100644 --- a/Particles/GlowSparkParticle.cs +++ b/Particles/GlowSparkParticle.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Particles public bool AffectedByGravity; public bool QuickShrink; public bool Glowing; + public float ShrinkSpeed = 1; public Vector2 Squash = new Vector2(0.5f, 1.6f); public override bool SetLifetime => true; public override bool UseCustomDraw => true; @@ -19,7 +20,7 @@ namespace CalamityMod.Particles public override string Texture => "CalamityMod/Particles/GlowSpark"; - public GlowSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 squash, bool quickShrink = false, bool glow = true) + public GlowSparkParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 squash, bool quickShrink = false, bool glow = true, float shrinkSpeed = 1) { Position = relativePosition; Velocity = velocity; @@ -31,6 +32,7 @@ namespace CalamityMod.Particles QuickShrink = quickShrink; Glowing = glow; Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + ShrinkSpeed = shrinkSpeed; } public override void Update() @@ -40,8 +42,16 @@ namespace CalamityMod.Particles Velocity *= 0.95f; if (QuickShrink) { - Squash.X *= 0.8f; - Squash.Y *= 1.2f; + if (ShrinkSpeed == 1) + { + Squash.X *= 0.8f; + Squash.Y *= 1.2f; + } + else + { + Squash.X *= (1 - 0.2f * ShrinkSpeed); + Squash.Y *= (1 + 0.2f * ShrinkSpeed); + } } if (Velocity.Length() < 12f && AffectedByGravity) { diff --git a/Particles/GlowSquareParticle.cs b/Particles/GlowSquareParticle.cs new file mode 100644 index 0000000000..971f7f1995 --- /dev/null +++ b/Particles/GlowSquareParticle.cs @@ -0,0 +1,66 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class GlowSquareParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public float fadeOut = 1; + public bool imporant; + public bool glowCenter; + public float RotationUse; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Particles/GlowSquareParticle"; + + public GlowSquareParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool GlowCenter = true, float rotation = 0) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + glowCenter = GlowCenter; + RotationUse = rotation; + } + public override void Update() + { + //if (RotationUse != 0 && fadeOut == 1) + //Rotation = Main.rand.NextFloat(-100, 100); + fadeOut -= 0.1f; + Scale *= 0.93f; + Color = Color.Lerp(InitialColor, InitialColor * 0.2f, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + if (RotationUse != 0) + { + Rotation += RotationUse; + RotationUse *= 0.992f; + } + else + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(1f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (glowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White * fadeOut * 0.7f, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.9f, 0.9f), 0, 0f); + } + } +} diff --git a/Particles/GlowSquareParticle.png b/Particles/GlowSquareParticle.png new file mode 100644 index 0000000000..308df23843 Binary files /dev/null and b/Particles/GlowSquareParticle.png differ diff --git a/Particles/HeavySmoke.cs b/Particles/HeavySmoke.cs index a7fa2365ef..f8ea0115eb 100644 --- a/Particles/HeavySmoke.cs +++ b/Particles/HeavySmoke.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Particles if (AffectedByLight) { - col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGBA(col); + col = col.MultiplyRGBA(Lighting.GetColor((Position / 16).ToPoint())); } spriteBatch.Draw(tex, Position - Main.screenPosition, frame, col, Rotation, frame.Size() / 2f, Scale, SpriteEffects.None, 0); diff --git a/Particles/MantisPunch.cs b/Particles/MantisPunch.cs new file mode 100644 index 0000000000..4f948f02e3 --- /dev/null +++ b/Particles/MantisPunch.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using ReLogic.Content; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class MantisPunch : Particle + { + int Frame = 0; + int FrameTimer = 0; + + public override string Texture => "CalamityMod/Particles/MantisPunch"; + public override bool UseCustomDraw => true; + public override void CustomDraw(SpriteBatch spriteBatch) + { + Asset tex = ModContent.Request(Texture); + + Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, tex.Frame(1, 6, 0, Frame), Lighting.GetColor((Position / 16).ToPoint()), Rotation, Origin, 1f, SpriteEffects.None); + } + public MantisPunch(Vector2 position, float rotation) + { + Position = position; + Rotation = rotation; + + Origin = new Vector2(32, 56); + + AffectedByLight = true; + } + public override void Update() + { + FrameTimer++; + if (FrameTimer % 3 == 0) + { + Frame++; + } + if (Frame >= 6) + { + Kill(); + } + } + } +} diff --git a/Particles/MantisPunch.png b/Particles/MantisPunch.png new file mode 100644 index 0000000000..605bcea928 Binary files /dev/null and b/Particles/MantisPunch.png differ diff --git a/Particles/SemiCircularSmearFade.cs b/Particles/SemiCircularSmearFade.cs index 8ee2296013..fcff0bd3eb 100644 --- a/Particles/SemiCircularSmearFade.cs +++ b/Particles/SemiCircularSmearFade.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Particles { public class SemiCircularSmearFade : Particle { - public override string Texture => "CalamityMod/Particles/SemiCircularSmearVertical"; + public override string Texture => "CalamityMod/Particles/SemiCircularSmearVerticalBlank"; public override bool UseAdditiveBlend => true; public override bool UseCustomDraw => true; public override bool SetLifetime => true; @@ -19,7 +19,8 @@ namespace CalamityMod.Particles public bool RotateToVelocity; public Vector2 Squish; public bool ProduceLight; - public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true) + public int Direction = 1; + public SemiCircularSmearFade(Vector2 position, Vector2 velocity, Color color, float rotation, float scale, Vector2 squish, int lifetime, bool playerCentered = false, bool rotateToVelocity = false, bool produceLight = true, int direction = 1) { Position = position; Velocity = velocity; @@ -31,7 +32,7 @@ namespace CalamityMod.Particles PlayerCentered = playerCentered; RotateToVelocity = rotateToVelocity; ProduceLight = produceLight; - + Direction = direction; } public override void Update() { @@ -53,7 +54,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(Texture).Value; - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, 0, 0f); + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() * 0.5f, Scale * Squish, Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); } } } diff --git a/Particles/SemiCircularSmearSwipe.png b/Particles/SemiCircularSmearSwipe.png new file mode 100644 index 0000000000..cf9a7c4edc Binary files /dev/null and b/Particles/SemiCircularSmearSwipe.png differ diff --git a/Particles/SemiCircularSmearVerticalBlank.png b/Particles/SemiCircularSmearVerticalBlank.png new file mode 100644 index 0000000000..cf9a7c4edc Binary files /dev/null and b/Particles/SemiCircularSmearVerticalBlank.png differ diff --git a/Particles/SmallBloom.png b/Particles/SmallBloom.png new file mode 100644 index 0000000000..f87bb65686 Binary files /dev/null and b/Particles/SmallBloom.png differ diff --git a/Particles/SquareAshParticle.cs b/Particles/SquareAshParticle.cs new file mode 100644 index 0000000000..66ad1f48d5 --- /dev/null +++ b/Particles/SquareAshParticle.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class SquareAshParticle : Particle + { + public Color InitialColor; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => false; + + public override string Texture => "CalamityMod/Particles/Square"; + + public SquareAshParticle(Vector2 relativePosition, Vector2 velocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + // Shrink to nothing near end of lifetime + if (Time > Lifetime - 60) + { + Scale *= 0.95f; + } + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Rotation += Velocity.X > 0 ? 0.8f : -0.8f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(0.8f, 1.2f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/ThunderBoltVFX.cs b/Particles/ThunderBoltVFX.cs index 83b6461954..46aecc9660 100644 --- a/Particles/ThunderBoltVFX.cs +++ b/Particles/ThunderBoltVFX.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -12,26 +13,75 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Vector2 Squish; - public float ShakePower; - public float Opacity; - public Projectile AttachedProjectile; - public float DisplacementFromProjectile; + /// + /// The function that decides to follow a specific . + /// + public Func FollowFunction; - public ThunderBoltVFX(Vector2 position, Color color, float rotation, float scale, Vector2 squish, float opacity = 1f, float shakePower = 20f, Projectile projectileToFollow = null, float displacementFromProjectile = 0f) + /// + /// The opacity of this particle, can only go from 0 to 1.
+ /// Defaults to 1. + ///
+ public float Opacity + { + get => opacity; + set => opacity = Math.Clamp(value, 0f, 1f); + } + private float opacity = 1f; + + /// + /// The amount of shaking this particle will have.
+ /// Will always be positive.
+ /// Defaults to 0. + ///
+ public float ShakePower + { + get => shakePower; + set => shakePower = Math.Abs(value); + } + private float shakePower; + + /// + /// The squish of this particle, how much is streched, widened, distorted, etc.
+ /// For standard purposes, it defaults to . + ///
+ public Vector2 Squish = Vector2.One; + + /// + /// A constructor that spawns a particle that does not move from where it spawns. + /// + public ThunderBoltVFX(Vector2 position, float rotation, float scale, Color color, int lifeTime, float shakePower, float opacity = 1f, Vector2? squish = null) { Position = position; - Velocity = Vector2.Zero; - Color = color; - Scale = scale; - Squish = squish; Rotation = rotation; + Scale = scale; + Color = color; Opacity = opacity; + Lifetime = lifeTime; ShakePower = shakePower; - if (projectileToFollow != null) - AttachedProjectile = projectileToFollow; - DisplacementFromProjectile = displacementFromProjectile; - Lifetime = 30; + if (squish != null) + Squish = (Vector2)squish; + } + + /// + /// A constructor that spawns a particle that follows a specific .
+ /// For simple one-line positions, you can just write in the argument, for example:
+ ///
+ /// () => Projectile.Center + /// For more complicated logic to decide which it should follow,
+ /// you'd just make your own function which returns a and give it as an argument. + ///
+ public ThunderBoltVFX(Func followFunction, float rotation, float scale, Color color, int lifeTime, float shakePower, float opacity = 1f, Vector2? squish = null) + { + FollowFunction = followFunction; + Rotation = rotation; + Scale = scale; + Color = color; + Opacity = opacity; + Lifetime = lifeTime; + ShakePower = shakePower; + if (squish != null) + Squish = (Vector2)squish; } public override void Update() @@ -40,9 +90,7 @@ namespace CalamityMod.Particles float fadeFactor = 1f - 0.05f * MathHelper.Clamp((Time - 10) / 10f, 0f, 1f); Opacity *= fadeFactor; Squish.X *= fadeFactor; - - if (AttachedProjectile != null && AttachedProjectile.active) - Position = AttachedProjectile.Center + Vector2.UnitY * DisplacementFromProjectile; + if (FollowFunction is not null) Position = FollowFunction.Invoke(); } public override void CustomDraw(SpriteBatch spriteBatch) diff --git a/Particles/VerticalSmear.png b/Particles/VerticalSmear.png new file mode 100644 index 0000000000..74d237ccaa Binary files /dev/null and b/Particles/VerticalSmear.png differ diff --git a/Particles/WaterFlavoredParticle.cs b/Particles/WaterFlavoredParticle.cs index 58dcf1b993..edd3458e2a 100644 --- a/Particles/WaterFlavoredParticle.cs +++ b/Particles/WaterFlavoredParticle.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics.Renderers; using Terraria.ModLoader; namespace CalamityMod.Particles @@ -44,8 +45,14 @@ namespace CalamityMod.Particles Vector2 scale = new Vector2(0.65f, 1f) * Scale; Texture2D texture = ModContent.Request(Texture).Value; - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + Color lightColor = Color; + if (AffectedByLight) + { + lightColor = Color.MultiplyRGB(Lighting.GetColor((Position / 16).ToPoint())); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, lightColor, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, lightColor, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); } } } diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index b07847957b..bdab30559d 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -166,6 +166,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { + bool ItemAnimationActive = Owner.ItemAnimationActive; + if (Owner.HeldItem.type != AssignedItemID) { Projectile.Kill(); @@ -174,7 +176,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner.Calamity().mouseWorldListener = true; Owner.Calamity().rightClickListener = true; - if (Owner.ItemAnimationActive) + if (ItemAnimationActive) { Animation++; @@ -210,18 +212,19 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.position = AbsolutePosition - (Projectile.Size / 2) + Offset; } - if (Owner.itemAnimation == 1) + if (AnimationProgress == Owner.itemAnimationMax - 1) { OnEndUse(); NumberOfAnimations++; } - if (Owner.ItemAnimationJustStarted) + if (Owner.itemAnimation == Owner.itemAnimationMax - 1) { Projectile.timeLeft = Owner.HeldItem.useAnimation + 1; - if (DrawUnconditionally) Projectile.timeLeft = 100; OnBeginUse(); } + + if (DrawUnconditionally) Projectile.timeLeft = Math.Max(Projectile.timeLeft, 2); } public override bool? CanHitNPC(NPC target) diff --git a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs new file mode 100644 index 0000000000..44249a02b3 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs @@ -0,0 +1,563 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + // Adapted from ExampleMod's ExampleAdvancedFlailProjectile (which in turn also adapted from Vanilla's AI Style 15) + public abstract class BaseMaceFlailProjectile : ModProjectile + { + public abstract int AssociatedItemID { get; } + + // The following can also be used in each individual projectile class, without the need to re-define: + #region Utilities + public enum FlailState + { + Spinning = 0, + LaunchingForward = 1, + Retracting = 2, + ForcedRetracting = 4, + Ricochet = 5, + Dropping = 6 + } + + public FlailState CurrentFlailState + { + get => (FlailState)Projectile.ai[0]; + set => Projectile.ai[0] = (float)value; + } + public ref float StateTimer => ref Projectile.ai[1]; + public ref float CollisionCounter => ref Projectile.localAI[0]; + // ai[2] and localAI[1] are completely open for additional gimmicks. + + public Player Owner => Main.player[Projectile.owner]; + #endregion + + // Core properties of the mace's function. + #region Properties + /// + /// Local immunity frames granted while dropped or retracted
+ /// Defaults to 10. + ///
+ public virtual int BaseIFrames => 10; + + /// + /// Local immunity frames granted during the spin.
+ /// Defaults to 20. + ///
+ public virtual int SpinIFrames => 20; + + /// + /// Local immunity frames granted while launched or ricochet.
+ /// Defaults to 10. + ///
+ public virtual int LaunchIFrames => 10; + + /// + /// The rate of which the mace visually spins around the player. Does NOT influence any other aspects.
+ /// Defaults to 10f. + ///
+ public virtual float SpinSpeed => 10f; + + /// + /// Horizontal radius for the mace's hitbox while spinning.
+ /// Defaults to 55f. (3.4375 tiles) + ///
+ public virtual float SpinHitboxRadius => 55f; + + ///
+ /// The distance between the projectile and the player's centers while spinning.
+ /// Defaults to 30f. (1.875 tiles) + /// + public virtual float SpinVisualRadius => 30f; + + /// + /// Effect which runs as soon as a spinning mace launches. Does nothing by default. + /// + public virtual Action EffectBeforeLaunch => null; + + /// + /// Max amount of afterimages, which is only drawn while the mace is launched.
+ /// Defaults to 6. + ///
+ public virtual int AfterimageLength => 6; + + /// + /// Constant speed when launched, affected by attack speed.
+ /// Defaults to 16f. + ///
+ public virtual float LaunchSpeed { get; set; } = 16f; + + /// + /// How long the mace launches before retracting. Multiply by its speed to determine its base range.
+ /// Defaults to 15. (0.25 seconds) + ///
+ public virtual int LaunchLifespan => 15; + + /// + /// Max launch range before forcibly being set to retract.
+ /// Typically not useful as it should retract naturally through lifespan before doing so by force.
+ /// Defaults to 960f. (60 tiles) + ///
+ public virtual float MaxLaunchRange => 960f; + + /// + /// Max drop range before forcibly being set to retract.
+ /// Defaults to 400f. (25 tiles) + ///
+ public virtual float MaxDropRange => 400f; + + /// + /// Effect which runs as soon as a launched mace retracts. Does nothing by default. + /// + public virtual Action EffectBeforePullback => null; + + /// + /// When hitting a tile while launched, how long the ricochet lasts before dropping. + /// Defaults to the launch's lifespan added by 5. (20 / 0.33 seconds) + /// + public virtual int RicochetLifespan => LaunchLifespan + 5; + + /// + /// Max speed when retracted, affected by attack speed.
+ /// Defaults to 15f. + ///
+ public virtual float MaxRetractSpeed { get; set; } = 15f; + + /// + /// Acceleration when retracted, affected by attack speed.
+ /// Defaults to 2.5f. + ///
+ public virtual float RetractAcceleration { get; set; } = 2.5f; + #endregion + + // Most of these should be kept default for consistency with vanilla maces. + // However, they can be overridden anyway. + #region Overridable Values + /// + /// File path for the mace's chain. These should just be the name of the projectile with "Chain" appended at the end.
+ /// Custom maces may also elect to not draw chains. Simply override this value with string.Empty. + ///
+ public virtual string ChainTexturePath => Texture + "Chain"; + + /// + /// Damage multiplier while spinning. Defaults to 1.2f. + /// + public virtual float SpinDamage => 1.2f; + + /// + /// Knockback multiplier while spinning. Defaults to 0.25f. + /// + public virtual float SpinKnockback => 0.25f; + + /// + /// The vertical multiplier which makes the spin motion elliptical. Defaults to 0.8f. + /// + public virtual float SpinVerticalFactor => 0.8f; + + /// + /// Damage multiplier while launching or non-forced retracting. Defaults to 2f. + /// + public virtual float LaunchDamage => 2f; + + /// + /// Knockback multiplier while dropping. Defaults to 0.5f. + /// + public virtual float DropKnockback => 0.5f; + #endregion + + // Methods for most individual behaviour steps which can be useful to override. + #region Overridable Methods + /// + /// Scales every value that should be affected by melee speed.
+ /// Can be overridden to leave out certain variables. + ///
+ public virtual void ScaleWithMeleeSpeed(ref float launchSpeed, ref float maxSpeed, ref float acceleration) + { + float meleeSpeedMultiplier = Owner.GetTotalAttackSpeed(DamageClass.Melee); + launchSpeed *= meleeSpeedMultiplier; + maxSpeed *= meleeSpeedMultiplier; + acceleration *= meleeSpeedMultiplier; + } + + /// + /// Calculates the damage and knockback multiplier based on the current behaviour.
+ /// Can be overridden to include any extra stat adjustments. + ///
+ public virtual void UpdateDamageKB(out float damageMult, out float kbMult) + { + damageMult = 1f; + kbMult = 1f; + if (CurrentFlailState == FlailState.Spinning) + { + damageMult = SpinDamage; + kbMult = SpinKnockback; + } + else if (CurrentFlailState == FlailState.LaunchingForward || CurrentFlailState == FlailState.Retracting) + damageMult = LaunchDamage; + else if (CurrentFlailState == FlailState.Dropping) + kbMult = DropKnockback; + } + + public virtual void SpinAI(float launchSpeed) + { + Projectile.ownerHitCheck = true; + if (Projectile.owner == Main.myPlayer) + { + Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction); + Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt()); + if (!Owner.channel) + { + CurrentFlailState = FlailState.LaunchingForward; + StateTimer = 0f; + Projectile.Center = Owner.MountedCenter; + Projectile.velocity = toMouse * launchSpeed + Owner.velocity; + Projectile.netUpdate = true; + Projectile.ResetLocalNPCHitImmunity(); + Projectile.localNPCHitCooldown = LaunchIFrames * Projectile.MaxUpdates; + Projectile.ownerHitCheck = false; + EffectBeforeLaunch?.Invoke(Projectile); + return; + } + } + StateTimer++; + Vector2 spinOffset = new Vector2(Owner.direction).RotatedBy(MathHelper.Pi * SpinSpeed * (StateTimer / 60f) * Owner.direction); + + spinOffset.Y *= SpinVerticalFactor; + if (spinOffset.Y * Owner.gravDir > 0f) + spinOffset.Y *= 0.5f; + + Projectile.Center = Owner.MountedCenter + spinOffset * SpinVisualRadius + new Vector2(0, Owner.gfxOffY); + Projectile.velocity = Vector2.Zero; + Projectile.localNPCHitCooldown = SpinIFrames * Projectile.MaxUpdates; + } + + public virtual void LaunchAI() + { + bool shouldRetract = StateTimer++ >= LaunchLifespan; + shouldRetract |= Projectile.Distance(Owner.MountedCenter) >= MaxLaunchRange; + if (Owner.controlUseItem) // If the player clicks, transition to the Dropping state + { + CurrentFlailState = FlailState.Dropping; + StateTimer = 0f; + Projectile.netUpdate = true; + Projectile.velocity *= 0.2f; + return; + } + if (shouldRetract) + { + CurrentFlailState = FlailState.Retracting; + StateTimer = 0f; + Projectile.netUpdate = true; + Projectile.velocity *= 0.3f; + EffectBeforePullback?.Invoke(Projectile); + } + Owner.ChangeDir((Owner.Center.X < Projectile.Center.X).ToDirectionInt()); + Projectile.localNPCHitCooldown = LaunchIFrames * Projectile.MaxUpdates; + } + + public virtual void RetractAI(bool forced, float maxSpeed, float acceleration) + { + if (forced) + { + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + } + + float forceMult = forced ? 2f : 1f; + Vector2 toPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); + Vector2 value = Owner.MountedCenter.DirectionFrom(Projectile.Center + Projectile.velocity).SafeNormalize(Vector2.Zero); + if (Projectile.Distance(Owner.MountedCenter) <= maxSpeed * forceMult || (forced && Vector2.Dot(toPlayer, value) < 0f)) + { + Projectile.Kill(); + return; + } + if (Owner.controlUseItem && !forced) // If the player clicks, transition to the Dropping state + { + CurrentFlailState = FlailState.Dropping; + StateTimer = 0f; + Projectile.netUpdate = true; + Projectile.velocity *= 0.2f; + return; + } + + Projectile.velocity *= 0.98f; + Projectile.velocity = Projectile.velocity.MoveTowards(toPlayer * maxSpeed * forceMult, acceleration * forceMult); + Owner.ChangeDir((Owner.Center.X < Projectile.Center.X).ToDirectionInt()); + } + + public virtual void RicochetAI() + { + if (StateTimer++ >= RicochetLifespan) + { + CurrentFlailState = FlailState.Dropping; + StateTimer = 0f; + Projectile.netUpdate = true; + return; + } + + Projectile.localNPCHitCooldown = LaunchIFrames * Projectile.MaxUpdates; + Projectile.velocity.Y += 0.6f; + Projectile.velocity.X *= 0.95f; + Owner.ChangeDir((Owner.Center.X < Projectile.Center.X).ToDirectionInt()); + } + + public virtual void DropAI() + { + if (!Owner.controlUseItem || Projectile.Distance(Owner.MountedCenter) > MaxDropRange) + { + CurrentFlailState = FlailState.ForcedRetracting; + StateTimer = 0f; + Projectile.netUpdate = true; + EffectBeforePullback?.Invoke(Projectile); + return; + } + + Projectile.localNPCHitCooldown = BaseIFrames * Projectile.MaxUpdates; + Projectile.velocity.Y += 0.8f; + Projectile.velocity.X *= 0.95f; + Owner.ChangeDir((Owner.Center.X < Projectile.Center.X).ToDirectionInt()); + } + + /// + /// Reserved for extra AI that is always ran regardless of state. Does nothing by default.
+ /// Example cases include shooting projectiles in a similar manner to Flower Pow. + ///
+ public virtual void ExtraBehavior() { } + + /// + /// Handles simple chain drawing. Can be overridden for cases such as chains with multiple frames/variants. + /// Example cases include Drippler Cripper's chain variants. + /// + public virtual void DrawChain() + { + Texture2D Chain = ModContent.Request(ChainTexturePath).Value; + Vector2 playerArmPosition = Main.GetPlayerArmPosition(Projectile); + + // This fixes a vanilla GetPlayerArmPosition bug causing the chain to draw incorrectly when stepping up slopes. The flail itself still draws incorrectly due to another similar bug. + // This should be removed once the vanilla bug is fixed. + playerArmPosition.Y -= Owner.gfxOffY; + + Vector2 chainPos = Projectile.Center; + Vector2 toArms = playerArmPosition.MoveTowards(chainPos, 4f) - chainPos; + float chainSegmentLength = MathF.Max(1f, Chain.Height); + float rotation = toArms.ToRotation() + MathHelper.PiOver2; + + float chainsLeft = toArms.Length() + chainSegmentLength * 0.5f; + while (chainsLeft > 0f) + { + Color chainDrawColor = Lighting.GetColor((int)(chainPos.X / 16f), (int)(chainPos.Y / 16f)); + Main.spriteBatch.Draw(Chain, chainPos - Main.screenPosition, null, chainDrawColor, rotation, Chain.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + chainPos += toArms.SafeNormalize(Vector2.Zero) * chainSegmentLength; + chainsLeft -= chainSegmentLength; + } + } + #endregion + + #region Hook Overrides + public override LocalizedText DisplayName => CalamityUtils.GetItemName(AssociatedItemID); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = AfterimageLength; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.HeldProjDoesNotUsePlayerGfxOffY[Type] = true; + } + + public override void SetDefaults() + { + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = BaseIFrames * Projectile.MaxUpdates; + } + + public override void AI() + { + if (!Owner.active || Owner.dead || Owner.noItems || Owner.CCed || Vector2.Distance(Projectile.Center, Owner.Center) > MaxLaunchRange + 160f) + { + Projectile.Kill(); + return; + } + if (Main.myPlayer == Projectile.owner && Main.mapFullscreen) + { + Projectile.Kill(); + return; + } + + float launchSpeed = LaunchSpeed; + float maxRetractSpeed = MaxRetractSpeed; + float retractAcceleration = RetractAcceleration; + ScaleWithMeleeSpeed(ref launchSpeed, ref maxRetractSpeed, ref retractAcceleration); + + switch (CurrentFlailState) + { + case FlailState.Spinning: + SpinAI(launchSpeed); + break; + case FlailState.LaunchingForward: + LaunchAI(); + break; + case FlailState.Retracting: + RetractAI(false, maxRetractSpeed, retractAcceleration); + break; + case FlailState.ForcedRetracting: + RetractAI(true, maxRetractSpeed, retractAcceleration); + break; + case FlailState.Ricochet: + RicochetAI(); + break; + case FlailState.Dropping: + DropAI(); + break; + } + + ExtraBehavior(); + + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); + + // Non-symmetric rotation (symmetric is just in this if condition here) + if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + { + if (Projectile.velocity.Length() > 1f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + else + Projectile.rotation += Projectile.velocity.X * 0.1f; + } + else + { + Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); + Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); + } + + Projectile.timeLeft = 2; + Owner.heldProj = Projectile.whoAmI; + Owner.SetDummyItemTime(2); + Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); + if (Projectile.Center.X < Owner.MountedCenter.X) + Owner.itemRotation += MathHelper.Pi; + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + int impactIntensity = 0; + Vector2 velocity = Projectile.velocity; + float bounceFactor = 0.2f; + if (CurrentFlailState == FlailState.LaunchingForward || CurrentFlailState == FlailState.Ricochet) + bounceFactor = 0.4f; + if (CurrentFlailState == FlailState.Dropping) + bounceFactor = 0f; + + if (oldVelocity.X != Projectile.velocity.X) + { + if (Math.Abs(oldVelocity.X) > 4f) + impactIntensity = 1; + + Projectile.velocity.X = oldVelocity.X * -bounceFactor; + CollisionCounter++; + } + + if (oldVelocity.Y != Projectile.velocity.Y) + { + if (Math.Abs(oldVelocity.Y) > 4f) + impactIntensity = 1; + + Projectile.velocity.Y = oldVelocity.Y * -bounceFactor; + CollisionCounter++; + } + + if (CurrentFlailState == FlailState.LaunchingForward) + { + CurrentFlailState = FlailState.Ricochet; + Projectile.localNPCHitCooldown = BaseIFrames * Projectile.MaxUpdates; + Projectile.netUpdate = true; + Point scanAreaStart = Projectile.TopLeft.ToTileCoordinates(); + Point scanAreaEnd = Projectile.BottomRight.ToTileCoordinates(); + impactIntensity = 2; + Projectile.CreateImpactExplosion(2, Projectile.Center, ref scanAreaStart, ref scanAreaEnd, Projectile.width, out bool causedShockwaves); + Projectile.CreateImpactExplosion2_FlailTileCollision(Projectile.Center, causedShockwaves, velocity); + Projectile.position -= velocity; + } + + if (impactIntensity > 0) + { + Projectile.netUpdate = true; + for (int i = 0; i < impactIntensity; i++) + Collision.HitTiles(Projectile.position, velocity, Projectile.width, Projectile.height); + + SoundEngine.PlaySound(SoundID.Dig, Projectile.position); + } + + // Force retraction if stuck on tiles while retracting + if (CurrentFlailState != FlailState.Spinning && CurrentFlailState != FlailState.Ricochet && CurrentFlailState != FlailState.Dropping && CollisionCounter >= 10f) + { + CurrentFlailState = FlailState.ForcedRetracting; + Projectile.netUpdate = true; + } + + return false; + } + + public override bool? CanDamage() + { + if (CurrentFlailState == FlailState.Spinning && StateTimer <= 12f) + return false; + + return base.CanDamage(); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (CurrentFlailState == FlailState.Spinning) + { + Vector2 distance = targetHitbox.ClosestPointInRect(Owner.MountedCenter) - Owner.MountedCenter; + distance.Y /= SpinVerticalFactor; + return distance.Length() <= SpinHitboxRadius; + } + return base.Colliding(projHitbox, targetHitbox); + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + UpdateDamageKB(out float damageMult, out float kbMult); + modifiers.SourceDamage *= damageMult; + modifiers.Knockback *= kbMult; + + modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + } + + public override bool PreDraw(ref Color lightColor) + { + if (!String.IsNullOrEmpty(ChainTexturePath)) + DrawChain(); + + // By default, maces have afterimages when launched. + // This can still be disabled via config or set individually by the projectile. + // (Does not use utils due to set trail length conditions) + if (CurrentFlailState == FlailState.LaunchingForward && CalamityClientConfig.Instance.Afterimages && AfterimageLength > 0) + { + Texture2D maceTex = TextureAssets.Projectile[Type].Value; + Vector2 drawOrigin = new Vector2(maceTex.Width * 0.5f, maceTex.Height * 0.5f); + SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + for (int k = 0; k < Projectile.oldPos.Length && k < StateTimer; k++) + { + Vector2 drawPos = Projectile.oldPos[k] - Main.screenPosition + drawOrigin * Projectile.scale + new Vector2(0f, Projectile.gfxOffY); + Color color = Projectile.GetAlpha(lightColor) * ((float)(Projectile.oldPos.Length - k) / (float)Projectile.oldPos.Length); + Main.spriteBatch.Draw(maceTex, drawPos, null, color, Projectile.rotation, drawOrigin, Projectile.scale - k / (float)Projectile.oldPos.Length / 3, spriteEffects, 0f); + } + } + return true; + } + #endregion + } +} diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 7b0113ff24..01673d9b36 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Boss int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/ApolloRocketGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/ApolloRocketGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 0cf7e9e6ba..5f6e1b731e 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.width = 80; - Projectile.height = 80; + Projectile.width = 32; + Projectile.height = 32; Projectile.hostile = true; Projectile.alpha = 255; Projectile.penetrate = -1; @@ -76,6 +76,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.Kill(); return; } + if (Projectile.localAI[0] % 4 == 0) + Projectile.frameCounter++; Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * projScale; if (Projectile.scale > projScale) @@ -129,43 +131,47 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { if (Projectile.velocity == Vector2.Zero) - { return false; - } - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Texture2D texture2 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraStart", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd", AssetRequestMode.ImmediateLoad).Value; - float auraDrawLength = Projectile.localAI[1]; //length of laser + + Texture2D middleTex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D endpointTex = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEndpoints", AssetRequestMode.ImmediateLoad).Value; + + // Used to track the animation of the segments + int middleFrame = Projectile.frameCounter % 12; + int endpointFrame = Projectile.frameCounter % 3; + float auraDrawLength = Projectile.localAI[1]; // Length of the laser Color grayColor = new Color(128, 128, 128, 0); - Vector2 vector = Projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2, vector, sourceRectangle2, grayColor, Projectile.rotation, texture2.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - auraDrawLength -= (texture2.Height / 2 + texture3.Height) * Projectile.scale; + + // Draw the bottom endpoint segment + Rectangle? sourceRectangle2 = endpointTex.Frame(1, 3, 0, endpointFrame); + Vector2 endPosition = Projectile.Center - Main.screenPosition - new Vector2(0f, 22f); // Of course it's 22, this stupid fucking accursed number + Main.EntitySpriteDraw(endpointTex, endPosition, sourceRectangle2, grayColor, Projectile.rotation, endpointTex.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + + // Draw the middle segments + auraDrawLength -= (endpointTex.Height / 2 + endpointTex.Height) * Projectile.scale; Vector2 projCenter = Projectile.Center; - projCenter += Projectile.velocity * Projectile.scale * texture2.Height / 2f; - if (auraDrawLength > 0f) + projCenter += Projectile.velocity * Projectile.scale * endpointTex.Height / 2f; + if (auraDrawLength > 0f) // Only draw a middle segment if there's enough height for one { float auraSegment = 0f; - Rectangle drawRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + Rectangle drawRectangle = middleTex.Frame(12, 1, middleFrame, 0); while (auraSegment + 1f < auraDrawLength) { if (auraDrawLength - auraSegment < drawRectangle.Height) { drawRectangle.Height = (int)(auraDrawLength - auraSegment); } - Main.EntitySpriteDraw(texture, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(middleTex, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); auraSegment += drawRectangle.Height * Projectile.scale; projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; - drawRectangle.Y += texture.Height; - if (drawRectangle.Y + drawRectangle.Height > texture.Height) + drawRectangle.Y += middleTex.Height; + if (drawRectangle.Y + drawRectangle.Height > middleTex.Height) { drawRectangle.Y = 0; } } } - Vector2 vector2 = projCenter - Main.screenPosition; - sourceRectangle2 = null; - Main.EntitySpriteDraw(texture3, vector2, sourceRectangle2, grayColor, Projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + // There is intentionally no top endpoint segment drawn return false; } diff --git a/Projectiles/Boss/BirbAura.png b/Projectiles/Boss/BirbAura.png index 3515f6998c..0b6f0a7026 100644 Binary files a/Projectiles/Boss/BirbAura.png and b/Projectiles/Boss/BirbAura.png differ diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index d34e761d03..2056239802 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Cal Clone bullet hell projectiles accelerate after a certain time has passed - if (Projectile.ai[0] == 2f && Main.expertMode && Projectile.timeLeft < 1260) + if (Projectile.ai[0] == 2f && (Main.expertMode || BossRushEvent.BossRushActive) && Projectile.timeLeft < 1260) { - if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 15f : 10f)) + if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 12.5f : 10f)) Projectile.velocity *= 1.005f; } diff --git a/Projectiles/Boss/DestroyerCursedLaser.cs b/Projectiles/Boss/DestroyerCursedLaser.cs index f9ffe4065f..31fc250b1a 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -4,11 +4,13 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DestroyerCursedLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.width = 4; @@ -25,32 +27,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.75f / 255f, 0f); + if (Projectile.alpha > 0) - { Projectile.alpha -= 125; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } + if (Projectile.localAI[1] == 0f) { SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); Projectile.localAI[1] = 1f; } - if (Projectile.velocity.Length() < 12f) - { + + if (Projectile.velocity.Length() < CalamityGlobalProjectile.AcceleratingBossLaserVelocityCap) Projectile.velocity *= 1.0025f; - } } public override Color? GetAlpha(Color lightColor) { if (Projectile.alpha < 200) - { return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); - } + return Color.Transparent; } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 75ff1f1ed5..5a30ce18b1 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -5,11 +5,13 @@ using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DestroyerElectricLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.ignoreWater = true; @@ -26,32 +28,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(Projectile.Center, 0f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.35f / 255f); + if (Projectile.alpha > 0) - { Projectile.alpha -= 125; - } if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } + if (Projectile.localAI[1] == 0f) { SoundEngine.PlaySound(SoundID.Item33, Projectile.Center); Projectile.localAI[1] = 1f; } - if (Projectile.velocity.Length() < 12f) - { + + if (Projectile.velocity.Length() < CalamityGlobalProjectile.AcceleratingBossLaserVelocityCap) Projectile.velocity *= 1.0025f; - } } public override Color? GetAlpha(Color lightColor) { if (Projectile.alpha < 200) - { return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); - } + return Color.Transparent; } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 38f7349271..f3b3d87ad7 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.Opacity = 0f; Projectile.penetrate = -1; - Projectile.timeLeft = 600; + Projectile.timeLeft = 480; CooldownSlot = ImmunityCooldownID.Bosses; } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index fb00892801..202b85a3e9 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,6 +14,7 @@ namespace CalamityMod.Projectiles.Boss public class HiveBombGoliath : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -83,13 +86,20 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { + Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 250, 50, Projectile.alpha); + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/HiveBombGoliathGlow").Value; + Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 drawArea = Projectile.Center - Main.screenPosition; + drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawArea += textureArea + new Vector2(0f, Projectile.gfxOffY); + Color whiteColor = Color.White; + int height = glow.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Main.spriteBatch.Draw(glow, drawArea, new Rectangle(0, drawStart, glow.Width, height), whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); + + return false; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/HiveBombGoliathGlow.png b/Projectiles/Boss/HiveBombGoliathGlow.png new file mode 100644 index 0000000000..13874fb07b Binary files /dev/null and b/Projectiles/Boss/HiveBombGoliathGlow.png differ diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 40c4680ee5..0837b1a5ea 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 origin = texture.Size() / 2f; float time = Main.GlobalTimeWrappedHourly % 10f / 10f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - int drawnAmt = 30; + int drawnAmt = 45; float[] posX = new float[drawnAmt]; float[] posY = new float[drawnAmt]; float[] hue = new float[drawnAmt]; @@ -49,15 +50,17 @@ namespace CalamityMod.Projectiles.Boss float sizeScalar = (1f - sizeScale) / drawnAmt; float yPosOffset = 60f; float xPosOffset = 400f; - Vector2 scale = new Vector2(6f, 6f); + Vector2 scale = new Vector2(12f, 12f); + + float amount2 = CalamityUtils.SineBumpEasing((float)Projectile.timeLeft / (float)totalTime, 1); for (int i = 0; i < drawnAmt; i++) { float timeScalar = (float)Math.Sin(time * MathHelper.TwoPi + (float)Math.PI / 2f + i / 2f); - posX[i] = timeScalar * (xPosOffset - i * 3f); + posX[i] = timeScalar * (xPosOffset - i * 3f) * amount2; - posY[i] = (float)Math.Sin(time * MathHelper.TwoPi * 2f + (float)Math.PI / 3f + i) * yPosOffset; + posY[i] = (float)Math.Sin(time * MathHelper.TwoPi * 4f + (float)Math.PI / 3f + i) * yPosOffset * 2; posY[i] -= i * 3f; hue[i] = i / (float)drawnAmt * 2f + time; @@ -66,12 +69,14 @@ namespace CalamityMod.Projectiles.Boss size[i] = sizeScale + (i + 1) * sizeScalar; size[i] *= 0.3f; - Color color = Main.hslToRgb(hue[i] % 1f, 1f, 0.5f) * colorChangeAmt * colorChangeAmt2; + float a = (float)Math.Sin(amount2 / 20) + 1; + + Color color = Color.Lerp(ProvUtils.GetProjectileColor(0, true), ProvUtils.GetProjectileColor(0, false), a); bool underworld = Projectile.ai[0] == 2f; if (!Main.zenithWorld) { - if (Main.IsItDay()) + if (Main.IsItDay() || Main.remixWorld) { color.R = 255; if (underworld) @@ -87,12 +92,9 @@ namespace CalamityMod.Projectiles.Boss } } - color.A /= 4; + color.A = 0; - int fadeTime = 30; - if (Projectile.timeLeft < fadeTime) { - float amount2 = Projectile.timeLeft / (float)fadeTime; if (color.R > 0) color.R = (byte)MathHelper.Lerp(0, color.R, amount2); @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss color.A = (byte)MathHelper.Lerp(0, color.A, amount2); } - float rotation = MathHelper.PiOver2 + timeScalar * MathHelper.PiOver4 * -0.3f + (float)Math.PI * i; + float rotation = MathHelper.PiOver2 + timeScalar * MathHelper.PiOver4 * -0.3f; Main.EntitySpriteDraw(texture, drawPosition + new Vector2(posX[i], posY[i]), null, color, rotation, origin, new Vector2(size[i], size[i]) * scale, SpriteEffects.None, 0); } diff --git a/Projectiles/Boss/HolyAura.png b/Projectiles/Boss/HolyAura.png index bec16a6412..549ed95c1d 100644 Binary files a/Projectiles/Boss/HolyAura.png and b/Projectiles/Boss/HolyAura.png differ diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index d6e09c41fd..235f07e767 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,12 +1,19 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; +using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +21,12 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBlast : ModProjectile, ILocalizedModType { + public bool started = false; + + private const int TimeLeft = 120; + private const int AccelerationTime = 60; + private const float Acceleration = 1.05f; + public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); @@ -23,6 +36,10 @@ namespace CalamityMod.Projectiles.Boss Main.projFrames[Projectile.type] = 4; } + public override void OnSpawn(IEntitySource source) + { + } + public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -31,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.timeLeft = TimeLeft; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -47,30 +64,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 320, 20); + Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); + if (Projectile.timeLeft > TimeLeft - AccelerationTime) + Projectile.velocity *= Acceleration; + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -80,9 +83,19 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; + if (!started) + { + for (int i = 0; i < 13; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-30f, 30f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(3f, 6f), ProvUtils.GetProjectileColor(255, false))); + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-50f, 50f))) * Main.rand.NextFloat(2.4f, 4.2f), false, 15, Main.rand.NextFloat(2f, 5f), ProvUtils.GetProjectileColor(255, false))); + } + started = true; + } + if (Projectile.localAI[0] == 0f) { - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int i = 0; i < 10; i++) { int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -101,32 +114,50 @@ namespace CalamityMod.Projectiles.Boss if (Math.Abs(Projectile.velocity.X) > 0.2) Projectile.spriteDirection = -Projectile.direction; + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(50), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, false, 20, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(255))); + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center + new Vector2(40, 0).RotatedBy(Vector2.Zero.AngleTo(-Projectile.velocity)) + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(1f, 3f), 150f)); + if (Projectile.velocity.X < 0f) Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); else Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + Vector2 sc = Vector2.One; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, sc, texture); + + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), sc, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 30; i++) + { + Particle p = new FlameParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hiColor, loColor); + p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(p); + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(12f, 40f), 0).RotatedByRandom(MathHelper.TwoPi), loColor, 60, Main.rand.NextFloat(0.75f, 1.75f), 1f, Main.rand.NextFloat(-0.05f, 0.05f), true)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.25f, 35)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.175f, 25)); + if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 8 : 6; + int totalProjectiles = !ProvUtils.DayAI() ? 8 : 6; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) totalProjectiles *= 2; @@ -134,16 +165,19 @@ namespace CalamityMod.Projectiles.Boss int type = ModContent.ProjectileType(); float velocity = 5f; Vector2 spinningPoint = new Vector2(0f, -velocity); + Vector2 additionalVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f; for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + Projectile.velocity * 0.25f, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + additionalVelocity, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); } } SoundEngine.PlaySound(ImpactSound, Projectile.Center); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); + + int dustType = ProvUtils.GetDustID(); for (int j = 0; j < 4; j++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 2f); @@ -160,20 +194,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 320, 20); + ProvUtils.ApplyDebuffs(target, 320); } } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 15ff7a1b48..228eb43f73 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,6 +15,8 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBomb : ModProjectile, ILocalizedModType { + float SquishAnimation = 1f; + public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { @@ -34,53 +37,29 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - /* - * Day mode by default but syncs with the boss - * Uses maxPenetrate because it's kinda pointless for a boss projectile - * and it's convenient to copypaste without having to do adjustments - * If someone really feels like making a proper int for this purpose they can do it themselves - Iris - */ - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + SquishAnimation += 0.06f; + SquishAnimation = MathHelper.Clamp(SquishAnimation, 0f, 1f); Projectile.ai[0] += 1f; if (Projectile.ai[0] % 120f == 0f) { SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + + for (int i = 0; i < 10; i++) + { + Vector2 center = Projectile.Center + new Vector2(0, -15); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(center, new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-4f, 2f)), false, 30, Main.rand.NextFloat(1f, 2.5f), ProvUtils.GetProjectileColor(255))); + } + float velocityY = -2f; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 2; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); - Main.dust[dust].noGravity = true; - } - for (int j = 0; j < 20; j++) - { - int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 0, default, 2.5f); - Main.dust[holyDust].noGravity = true; - Main.dust[holyDust].velocity *= 2f; - holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, velocityY, 50, default, 1.5f); - Main.dust[holyDust].velocity *= 1.5f; - Main.dust[holyDust].noGravity = true; - } + + SquishAnimation = 0f; if (Projectile.owner == Main.myPlayer) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, velocityY, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); @@ -106,59 +85,51 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; + float squish = CalamityUtils.SineBumpEasing(SquishAnimation, 1) * 0.25f; + + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale + squish, Projectile.scale - squish), texture, offset: new Vector2(0, (-22 * (1 - squish)))); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, (framing / 2f) + 22), new Vector2(Projectile.scale + squish, Projectile.scale - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 100; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 2; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[dust].noGravity = true; - } - for (int j = 0; j < 20; j++) - { - int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[holyDust].noGravity = true; - Main.dust[holyDust].velocity *= 3f; - holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[holyDust].velocity *= 2f; - Main.dust[holyDust].noGravity = true; - } - } + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1f; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.Item20.WithPitchOffset(-0.8f), Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 160, 20); + ProvUtils.ApplyDebuffs(target, 160); } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index b7bdb2c51b..c8a9dcbb94 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -3,11 +3,13 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,11 +17,13 @@ namespace CalamityMod.Projectiles.Boss { public class HolyBurnOrb : ModProjectile, ILocalizedModType { + bool started = false; public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/StarProj"; public override void SetDefaults() { + Projectile.localAI[1] = Main.rand.NextFloat(30f); Projectile.width = Projectile.height = 30; Projectile.hostile = true; Projectile.ignoreWater = true; @@ -33,30 +37,20 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 50); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); if (Projectile.ai[0] == 0f && BossRushEvent.BossRushActive) Projectile.velocity *= 1.25f; + if (!started) + { + Color cl = ProvUtils.GetProjectileColor(255); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, cl, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); + started = true; + } + if (Projectile.ai[0] < 240f) { Projectile.ai[0] += 1f; @@ -79,21 +73,29 @@ namespace CalamityMod.Projectiles.Boss } else if (Projectile.velocity.Length() < 16f) Projectile.velocity *= 1.01f; + + Projectile.localAI[1] += (Projectile.velocity.Length() / 20); + + Color col = ProvUtils.GetProjectileColor(255); + + float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f); + + GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity + new Vector2(Main.rand.NextFloat(vel * 2), 0).RotatedByRandom(MathHelper.TwoPi), false, 4, 1f, col); + + GeneralParticleHandler.SpawnParticle(p); } public override bool PreDraw(ref Color lightColor) { - float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; - + float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f))); + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 255); - baseColor *= 0.5f; + Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4; + Color baseColor2 = ProvUtils.GetProjectileColor(255); baseColor.A = 0; - Color colorA = baseColor; - Color colorB = baseColor * 0.5f; - colorA *= lerpMult; - colorB *= lerpMult; + baseColor *= lerpMult; + baseColor2 *= lerpMult; Vector2 origin = texture.Size() / 2f; Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; @@ -101,18 +103,20 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; + Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f); + float upRight = MathHelper.PiOver4; float up = MathHelper.PiOver2; float upLeft = 3f * MathHelper.PiOver4; float left = MathHelper.Pi; - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0); return false; } @@ -121,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(50); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int d = 0; d < 5; d++) { int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -144,22 +148,15 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - - Projectile.Kill(); - } + public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => Projectile.Kill(); public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 50); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 0a19097430..612d6e1542 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,7 @@ namespace CalamityMod.Projectiles.Boss public class HolyFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -34,26 +36,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 80, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); if (Projectile.ai[1] == 0f) { @@ -61,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.alpha -= (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 10 : 5; + Projectile.alpha -= !ProvUtils.DayAI() ? 10 : 5; if (Projectile.alpha <= 0) Projectile.Kill(); @@ -75,23 +60,34 @@ namespace CalamityMod.Projectiles.Boss Projectile.frame = 0; } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; + Projectile.scale = 1.5f; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale)); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 25; i++) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.125f * i, 8)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); + if (Main.rand.NextBool()) { if (Projectile.owner == Main.myPlayer) @@ -100,12 +96,12 @@ namespace CalamityMod.Projectiles.Boss if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); } } else @@ -116,55 +112,26 @@ namespace CalamityMod.Projectiles.Boss if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= Main.rand.NextFloat(1f, 2f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); } } - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 40; - Projectile.height = 40; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 5; i++) - { - int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; - } - } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 20); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 8e8c50642e..360f7796a4 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,6 +17,7 @@ namespace CalamityMod.Projectiles.Boss public class HolyFire2 : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -34,26 +37,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 80, 10); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); Projectile.frameCounter++; if (Projectile.frameCounter > 6) @@ -64,7 +50,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - if (Math.Abs(Projectile.velocity.X) < 7f) + float maxVelocity = Projectile.ai[0] == 0f ? 7f : (Main.masterMode || BossRushEvent.BossRushActive) ? 13f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; + if (Math.Abs(Projectile.velocity.X) < maxVelocity) Projectile.velocity.X *= 1.05f; int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); @@ -79,26 +66,30 @@ namespace CalamityMod.Projectiles.Boss Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; playerDirection.Normalize(); playerDirection *= projVelocityMult; - float inertia = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 20f : 25f; + float inertia = !ProvUtils.DayAI() ? 20f : 25f; Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= projVelocityMult; } - Projectile.rotation = Projectile.velocity.X * 0.025f; + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); + + Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f)); } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor); public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -112,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 40; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); for (int i = 0; i < 5; i++) { int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); @@ -132,20 +123,13 @@ namespace CalamityMod.Projectiles.Boss } } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 10); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 1208b849ad..72817641c2 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -1,6 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -34,26 +36,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); Player player = Main.player[Projectile.owner]; @@ -71,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Y > velocityYCap) Projectile.velocity.Y = velocityYCap; - float velocityX = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 0.025f : 0.02f; + float velocityX = !ProvUtils.DayAI() ? 0.025f : 0.02f; if (Projectile.position.X + Projectile.width < player.position.X) { if (Projectile.velocity.X < 0f) @@ -85,71 +70,66 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X -= velocityX; } - float velocityXCap = Projectile.maxPenetrate != (int)Providence.BossMode.Day ? 10f : 8f; + float velocityXCap = !ProvUtils.DayAI() ? 10f : 8f; if (Projectile.velocity.X > velocityXCap || Projectile.velocity.X < -velocityXCap) Projectile.velocity.X *= 0.97f; - Projectile.rotation = Projectile.velocity.X * 0.025f; + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + { + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); + } + + Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f)); } public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Projectile.maxPenetrate == (int)Providence.BossMode.Day ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; int framing = texture.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 30; - Projectile.height = 60; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 5; i++) - { - int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; - } - } + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index 19fb29c30b..af177af1c4 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -1,8 +1,11 @@ using System; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -15,6 +18,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { + Projectile.localAI[1] = Main.rand.NextFloat(30f); Projectile.width = 20; Projectile.height = 20; Projectile.hostile = true; @@ -25,6 +29,16 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 200; } + public override void OnSpawn(IEntitySource source) + { + SoundStyle soundStyle = SoundID.DD2_WitherBeastCrystalImpact; + soundStyle.MaxInstances = 10; + SoundEngine.PlaySound(soundStyle, Projectile.Center); + + Color col = new Color(54, 209, 54); + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, col, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(4f, 7f), 1.5f), Vector2.Zero.AngleTo(Projectile.velocity), 1f, 0f, 30)); + } + public override void AI() { Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); @@ -58,16 +72,26 @@ namespace CalamityMod.Projectiles.Boss NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); Projectile.Kill(); } + + Color col = new Color(54, 209, 54); + + GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity, false, 25, 1f, col); + + GeneralParticleHandler.SpawnParticle(p); } public override bool PreDraw(ref Color lightColor) { + float vel = Projectile.velocity.Length() / 8; + Projectile.localAI[1] += vel; + Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color brightGreen = new Color(54, 209, 54, 0); Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; Color halfBrightGreen = brightGreen * 0.5f; - float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; + float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f))); + Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f); Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale; Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; brightGreen *= timeLeftColorScale; @@ -79,15 +103,15 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, (float)Math.PI / 2f, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, (float)Math.PI / 2f, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, (float)Math.PI / 2f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, (float)Math.PI / 2f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0); + Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0); return false; } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 697dfa6c2a..8f1d475119 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,11 +17,12 @@ namespace CalamityMod.Projectiles.Boss public class HolySpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + Vector2 velocity = Vector2.Zero; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } @@ -53,26 +55,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); if (Projectile.localAI[0] == 0f) { @@ -84,14 +69,14 @@ namespace CalamityMod.Projectiles.Boss bool commanderSpear = Projectile.ai[0] == -1f; bool enragedCommanderSpear = Projectile.ai[0] == -2f; - float timeGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); + float timeGateValue = !ProvUtils.DayAI() ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); if (Projectile.ai[0] <= 0f) { Projectile.ai[1] += 1f; - float slowGateValue = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); + float slowGateValue = !ProvUtils.DayAI() ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); float fastGateValue = 30f; - float minVelocity = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); + float minVelocity = !ProvUtils.DayAI() ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); float maxVelocity = minVelocity * 4f; float extremeVelocity = maxVelocity * 2f; float deceleration = 0.95f; @@ -120,8 +105,8 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 0.2f : 0.1f; - float amplitude = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 4f : 2f; + float frequency = !ProvUtils.DayAI() ? 0.2f : 0.1f; + float amplitude = !ProvUtils.DayAI() ? 4f : 2f; Projectile.ai[1] += frequency; @@ -141,6 +126,29 @@ namespace CalamityMod.Projectiles.Boss Projectile.Opacity = MathHelper.Lerp(240f, 220f, Projectile.timeLeft); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + bool aimedSpear = Projectile.ai[0] > 0f; + + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to day + + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + baseColor = new Color(aimedSpear ? 125 : 255, aimedSpear ? 0 : 255, 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + baseColor = new Color(0, 255, aimedSpear ? 0 : 175); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + baseColor = new Color(255, 125, aimedSpear ? 0 : 175); + else // Red + baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); + } + else if (!ProvUtils.DayAI()) + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity, false, 15, Main.rand.NextFloat(0.5f, 1.5f) * MathHelper.Clamp(Projectile.velocity.Length() / 15, 0f, 2f), aimedSpear ? baseColor : ProvUtils.GetProjectileColor(255, false))); } public override bool PreDraw(ref Color lightColor) @@ -148,99 +156,75 @@ namespace CalamityMod.Projectiles.Boss Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; bool aimedSpear = Projectile.ai[0] > 0f; - int red = 255; - int green = 255; - int blue = 0; - switch (Projectile.maxPenetrate) - { - case (int)Providence.BossMode.Red: - red = 255; - green = aimedSpear ? 0 : 125; - blue = aimedSpear ? 0 : 255; - break; - case (int)Providence.BossMode.Orange: - red = 255; - green = 125; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Yellow: //Same as day - case (int)Providence.BossMode.Day: - red = 255; - green = aimedSpear ? 255 : 125; - blue = aimedSpear ? 0 : 125; - break; - case (int)Providence.BossMode.Green: - red = 0; - green = 255; - blue = aimedSpear ? 0 : 175; - break; - case (int)Providence.BossMode.Blue: //Same as night - case (int)Providence.BossMode.Night: - red = aimedSpear ? 100 : 175; - green = aimedSpear ? 255 : 175; - blue = 255; - break; - case (int)Providence.BossMode.Violet: - red = aimedSpear ? 125 : 255; - green = aimedSpear ? 0 : 255; - blue = 125; - break; - default: - break; - } - Color baseColor = new Color(red, green, blue, 0); + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to day + Color baseColor2 = new Color(15, 35, 50, 0); - Color baseColor2 = baseColor; - Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); + if (Main.zenithWorld) + { + if (Main.GlobalTimeWrappedHourly % 6f >= 5f) // Violet + baseColor = new Color(aimedSpear ? 125 : 255, aimedSpear ? 0 : 255, 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 4f) // Blue + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + else if (Main.GlobalTimeWrappedHourly % 6f >= 3f) // Green + baseColor = new Color(0, 255, aimedSpear ? 0 : 175); + else if (Main.GlobalTimeWrappedHourly % 6f >= 2f) // Yellow + baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); + else if (Main.GlobalTimeWrappedHourly % 6f >= 1f) // Orange + baseColor = new Color(255, 125, aimedSpear ? 0 : 175); + else // Red + baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); + } + else if (!ProvUtils.DayAI()) + baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); + + if (!aimedSpear) + { + baseColor = ProvUtils.GetProjectileColor(0); + baseColor2 = ProvUtils.GetProjectileColor(0, true); + } + + Vector2 projDirection = Main.screenPosition - new Vector2(0f, Projectile.gfxOffY); Vector2 halfTextureSize = drawTexture.Size() / 2f; Color halfOfHalfBaseColor = baseColor2 * 0.5f; - float timeLeftColorScale = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f; - Vector2 timeLeftDrawEffect = new Vector2(1f, 1.5f) * timeLeftColorScale; - Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale; - baseColor2 *= timeLeftColorScale; - halfOfHalfBaseColor *= timeLeftColorScale; + + float squish = MathHelper.Clamp(Projectile.velocity.Length() / 20, -0.3f, 0.3f); + + Vector2 sc = new Vector2(1 - squish, 1 + squish); SpriteEffects spriteEffects = SpriteEffects.None; if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { - Vector2 drawPos = Projectile.oldPos[i] + projDirection; - Color baseColorAlpha = Projectile.GetAlpha(baseColor2) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, SpriteEffects.None, 0); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, SpriteEffects.None, 0); - - baseColorAlpha = Projectile.GetAlpha(halfOfHalfBaseColor) * ((Projectile.oldPos.Length - i) / Projectile.oldPos.Length); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, SpriteEffects.None, 0); - Main.spriteBatch.Draw(drawTexture, drawPos, null, baseColorAlpha, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(drawTexture, Projectile.oldPos[i] - projDirection + (Projectile.Size / 2), null, Color.Lerp(baseColor, baseColor2, MathHelper.Lerp((float)i / (float)Projectile.oldPos.Length, 1f, 0.5f)), Projectile.rotation, halfTextureSize, sc * MathHelper.Lerp(1, 0, (float)((float)i / Projectile.oldPos.Length)), spriteEffects, 0); } } - Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, baseColor2, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0); - Main.EntitySpriteDraw(drawTexture, projDirection, null, halfOfHalfBaseColor, Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0); + for (float i = 0; i < 360; i += 90) + { + Main.EntitySpriteDraw(drawTexture, Projectile.Center + new Vector2(4, 0).RotatedBy(MathHelper.ToRadians(i)) - projDirection, null, Color.Lerp(baseColor, baseColor2, 0.75f), Projectile.rotation, halfTextureSize, sc, spriteEffects, 0); + } + + Main.EntitySpriteDraw(drawTexture, Projectile.Center - projDirection, null, baseColor, Projectile.rotation, halfTextureSize, sc, spriteEffects, 0); return false; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 120, 20); + ProvUtils.ApplyDebuffs(target, 120); + } + + public override Color? GetAlpha(Color lightColor) + { + return ProvUtils.GetProjectileColor(0, false); } } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 18ee564f3b..350853f561 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,7 +16,12 @@ namespace CalamityMod.Projectiles.Boss { public class MoltenBlast : ModProjectile, ILocalizedModType { + private const int TimeLeft = 90; + private const int AccelerationTime = 60; + private const float Acceleration = 1.05f; + public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -29,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 90; + Projectile.timeLeft = TimeLeft; CooldownSlot = ImmunityCooldownID.Bosses; } @@ -47,30 +53,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + if (Projectile.timeLeft > TimeLeft - AccelerationTime) + Projectile.velocity *= Acceleration; + if (Projectile.Hitbox.Intersects(new Rectangle((int)Projectile.ai[0], (int)Projectile.ai[1], Player.defaultWidth, Player.defaultHeight))) Projectile.tileCollide = true; - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -80,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); if (Projectile.localAI[1] == 0f) { for (int d = 0; d < 10; d++) @@ -94,6 +86,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + Projectile.localAI[1] = 1f; SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); } @@ -105,8 +98,8 @@ namespace CalamityMod.Projectiles.Boss for (int l = 0; l < 12; l++) { Vector2 dustRotate = Vector2.UnitX * -Projectile.width / 2f; - dustRotate += -Vector2.UnitY.RotatedBy(l * 3.14159274f / 6f, default) * new Vector2(8f, 16f); - dustRotate = dustRotate.RotatedBy(Projectile.rotation - 1.57079637f, default); + dustRotate += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f, default) * new Vector2(8f, 16f); + dustRotate = dustRotate.RotatedBy(Projectile.rotation - MathHelper.PiOver2, default); int profaned = Dust.NewDust(Projectile.Center, 0, 0, dustType, 0f, 0f, 160, default, 1f); Main.dust[profaned].scale = 1.1f; Main.dust[profaned].noGravity = true; @@ -117,72 +110,68 @@ namespace CalamityMod.Projectiles.Boss } Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + + float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f); + + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.5f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255))); + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f)))); } - public override Color? GetAlpha(Color lightColor) - { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(0); public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - int blobAmt = (Projectile.maxPenetrate != (int)Providence.BossMode.Day) ? 9 : 6; + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); + + for (int i = 0; i < 25; i++) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.125f * i, 8)); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); + + int blobAmt = !ProvUtils.DayAI() ? 9 : 6; if (Projectile.owner == Main.myPlayer) { + Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y); for (int b = 0; b < blobAmt; b++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + Projectile.velocity; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) velocity *= 2f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); } } - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 4; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[dust].noGravity = true; - } - for (int j = 0; j < 40; j++) - { - int killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 2.5f); - Main.dust[killHolyDust].noGravity = true; - Main.dust[killHolyDust].velocity *= 3f; - killHolyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 50, default, 1.5f); - Main.dust[killHolyDust].velocity *= 2f; - Main.dust[killHolyDust].noGravity = true; - } + SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18f, targetHitbox); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 160, 20); + ProvUtils.ApplyDebuffs(target, 160); } } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index f0516d1376..6e1562fccd 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,10 +12,15 @@ namespace CalamityMod.Projectiles.Boss { public class MoltenBlob : ModProjectile, ILocalizedModType { + float Landing = 1f; + bool colliding = false; + + bool inLava = false; + public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() @@ -31,43 +37,43 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 80, 10); + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) + Landing += 0.1f; + Landing = MathHelper.Clamp(Landing, 0f, 1f); + + colliding = Projectile.velocity.Y == 0f; + + if (colliding) { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; + Landing = 0f; + Projectile.localAI[2] = 5; + + Projectile.velocity.X *= 0.8f; } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; Projectile.velocity.X *= 0.95f; if (Projectile.wet || Projectile.lavaWet) { - Projectile.velocity.Y -= 0.2f; - if (Projectile.velocity.Y < -10f) - Projectile.velocity.Y = -10f; + if (!inLava) + { + Projectile.position.Y -= Projectile.velocity.Y; + Projectile.velocity.Y = 0f; + inLava = true; + } } else { - if (Projectile.velocity.Y < 0f) - Projectile.velocity.Y = 0f; + if (!inLava) + { + if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y = 0f; - Projectile.velocity.Y += 0.1f; - if (Projectile.velocity.Y > 5f) - Projectile.velocity.Y = 5f; + Projectile.velocity.Y += 0.15f; + } } Projectile.frameCounter++; @@ -90,62 +96,54 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetProjectileColor(0); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; - int y6 = framing * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0); + int y6 = framing * (1 + Projectile.frame); + float squish = CalamityUtils.SineBumpEasing(Landing, 1) * 0.5f; + Projectile.rotation = 0f; + if (!colliding) + { + y6 = 0; + squish = -MathHelper.Clamp(Projectile.velocity.Length() / 15, 0, 0.5f); + Projectile.rotation = Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.PiOver2; + } + Vector2 vec = new Vector2(0, framing * squish); + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.alpha, true), 4f, new Vector2(1 + squish, 1 - squish), texture, offset: vec); + Main.spriteBatch.Draw(texture, Projectile.Center + vec - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), new Vector2(1 + squish, 1 - squish), SpriteEffects.None, 0); return false; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.position.X = Projectile.position.X + (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2); - Projectile.width = 10; - Projectile.height = 10; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); - for (int i = 0; i < 3; i++) - { - int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 5; j++) - { - int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].noGravity = true; - } - } + Color hiColor = ProvUtils.GetProjectileColor(255, false); + Color loColor = ProvUtils.GetProjectileColor(0, true); - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - //In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(3), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.1f, 0.4f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f * i, 0.0125f * i, 8)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.002f, 0.015f, 5)); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 80, 10); + ProvUtils.ApplyDebuffs(target, 80); } } } diff --git a/Projectiles/Boss/MoltenBlob.png b/Projectiles/Boss/MoltenBlob.png index 811a46069d..f2a8116099 100644 Binary files a/Projectiles/Boss/MoltenBlob.png and b/Projectiles/Boss/MoltenBlob.png differ diff --git a/Projectiles/Boss/MoltenBlobNight.png b/Projectiles/Boss/MoltenBlobNight.png index fa915552df..524da76f30 100644 Binary files a/Projectiles/Boss/MoltenBlobNight.png and b/Projectiles/Boss/MoltenBlobNight.png differ diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index fb76be00e3..8069efd309 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 133cb9ef32..32d119dd72 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 80); + target.AddBuff(ModContent.BuffType(), 80); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index 31c1331385..fcadc0e03b 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() >= Projectile.ai[0]) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 3d1d3021cf..0cc7f9eed7 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 80); + target.AddBuff(ModContent.BuffType(), 80); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index f8cb269e5c..fc59234722 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -1,19 +1,23 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.PlaguebringerGoliath; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class PlagueStingerGoliath : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; - Projectile.scale = 1.5f; Projectile.hostile = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -52,16 +56,22 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 90); } + public override bool PreDraw(ref Color lightColor) + { + Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } + public override void PostDraw(Color lightColor) { - Vector2 center = new Vector2(Projectile.Center.X, Projectile.Center.Y); - Vector2 textureArea = new Vector2(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Width / 2, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / 2); - Vector2 drawArea = center - Main.screenPosition; - drawArea -= new Vector2(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Width, ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Height) * 1f / 2f; - drawArea += textureArea * 1f + new Vector2(0f, 4f + Projectile.gfxOffY); + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; + Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 drawArea = Projectile.Center - Main.screenPosition; + drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawArea += textureArea + new Vector2(0f, Projectile.gfxOffY); Color whiteColor = Color.White; - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value, drawArea, - null, whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(glow, drawArea, null, whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index d379ddf72f..a7615548da 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.PlaguebringerGoliath; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,7 +19,6 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 10; Projectile.height = 10; - Projectile.scale = 1.5f; Projectile.hostile = true; Projectile.penetrate = -1; Projectile.extraUpdates = 2; @@ -42,15 +42,22 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 90); } + public override bool PreDraw(ref Color lightColor) + { + Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); + return false; + } + public override void PostDraw(Color lightColor) { Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; Vector2 origin = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); Vector2 drawPos = Projectile.Center - Main.screenPosition; - drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) * 1f / 2f; - drawPos += origin * 1f + new Vector2(0f, 0f + 4f + Projectile.gfxOffY); - Color color = new Color(127 - Projectile.alpha, 127 - Projectile.alpha, 127 - Projectile.alpha, 0).MultiplyRGBA(Color.Red); - Main.spriteBatch.Draw(glow, drawPos, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawPos += origin + new Vector2(0f, Projectile.gfxOffY); + Color whiteColor = Color.White; + Main.spriteBatch.Draw(glow, drawPos, null, whiteColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index f716020d87..ecaaa25008 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -2,9 +2,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -35,17 +37,6 @@ namespace CalamityMod.Projectiles.Boss { Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - if (Projectile.timeLeft < 510) Projectile.tileCollide = true; @@ -70,18 +61,41 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha); + return ProvUtils.GetDayNightColor(Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = (Projectile.maxPenetrate == (int)Providence.BossMode.Day) ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.maxPenetrate, Projectile.alpha, true), 4f, texture); + Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + public override void OnKill(int timeLeft) + { + Color hiColor = ProvUtils.GetDayNightColor(255, false); + Color loColor = ProvUtils.GetDayNightColor(0, true); + + for (int i = 0; i < 25; i++) + { + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.8f, 1.2f), hiColor)); + } + + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.5f, 0.1f, 4)); + + for (float i = 0; i < 1; i += 0.25f) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f * i, 0.075f * i, 24)); + } + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 16)); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(0.6f), Projectile.Center); + SoundEngine.PlaySound(SoundID.Item100.WithPitchOffset(0.4f), Projectile.Center); + + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) { if (info.Damage <= 0) diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index bf409a9f5d..a90cc4a6a7 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -3,9 +3,11 @@ using System.IO; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,6 +17,8 @@ namespace CalamityMod.Projectiles.Boss { public class ProvidenceCrystal : ModProjectile, ILocalizedModType { + public bool introAnimationDone = false; + public float introAnimationProgress = 0f; public new string LocalizationCategory => "Projectiles.Boss"; public override void SetDefaults() { @@ -38,8 +42,40 @@ namespace CalamityMod.Projectiles.Boss Projectile.localAI[0] = reader.ReadSingle(); } + void CrystalExplosion() + { + Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; + for (int i = 0; i < 7; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, proviTarget.velocity, Color.Violet, "CalamityMod/Particles/BlastCone", new Vector2(Main.rand.NextFloat(2.5f, 6f), 3f), Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.5f, 20)); + } + for (int i = 0; i < 4; i++) + { + GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, proviTarget.velocity, Color.Violet, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 3f, 0f, 35)); + } + } + public override void AI() { + if (introAnimationProgress == 0f) + { + SoundEngine.PlaySound(SoundID.Item101.WithPitchOffset(-1f), Projectile.Center); + } + + introAnimationProgress += 0.025f; + introAnimationProgress = MathHelper.Clamp(introAnimationProgress, 0f, 1f); + + if (introAnimationProgress == 1f) + { + if (!introAnimationDone) + { + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact.WithPitchOffset(-0.5f), Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); + CrystalExplosion(); + } + introAnimationDone = true; + } + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) { Projectile.active = false; @@ -55,8 +91,6 @@ namespace CalamityMod.Projectiles.Boss Player proviTarget = Main.player[Main.npc[CalamityGlobalNPC.holyBoss].target]; - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - Projectile.position.X = proviTarget.Center.X - (Projectile.width / 2); Projectile.position.Y = proviTarget.Center.Y - (Projectile.height / 2) + proviTarget.gfxOffY - 360f; if (proviTarget.gravDir == -1f) @@ -71,13 +105,13 @@ namespace CalamityMod.Projectiles.Boss Projectile.position.Y = (int)Projectile.position.Y; Projectile.velocity = Vector2.Zero; - Projectile.alpha -= 5; + Projectile.alpha -= 20; if (Projectile.alpha < 0) Projectile.alpha = 0; if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Color BaseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0); + Color BaseColor = ProvUtils.GetProjectileColor(0); float Brightness = 0.8f; Color DustColor = Color.Lerp(BaseColor, Color.White, Brightness); Dust crystalDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, DustColor, 1f)]; @@ -96,7 +130,7 @@ namespace CalamityMod.Projectiles.Boss // At day, fires every 300 frames but lasts 1500-3600 frames. // At night, fires every 30 framges but lasts 210 frames. // In GFB, fires at night rate for the first 210 frames, then at day rate for the next 1500. - bool dayAI = Projectile.maxPenetrate == (int)Providence.BossMode.Day || (Projectile.maxPenetrate >= (int)Providence.BossMode.Red && Projectile.timeLeft < 1500); + bool dayAI = ProvUtils.DayAI() || (Main.zenithWorld && Projectile.timeLeft < 1500); if (Projectile.localAI[0] >= (dayAI ? 300f : 30f)) { @@ -117,6 +151,7 @@ namespace CalamityMod.Projectiles.Boss float randomSpread = dayAI ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX + speedAdjustment * i + randomSpread, speedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, x4, Projectile.whoAmI); } + CrystalExplosion(); } // Reset timer @@ -128,22 +163,36 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => false; - public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha); public override bool PreDraw(ref Color lightColor) { - Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); - Vector2 drawArea = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Rectangle textureRect = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); - Color colorAlpha = Projectile.GetAlpha(colorArea); - Vector2 halfRect = textureRect.Size() / 2f; - float scaleFactor = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; - for (float i = 0f; i < 4f; i += 1f) + if (introAnimationDone) { - double angle = i * MathHelper.PiOver2; - Vector2 center = default; - Main.spriteBatch.Draw(texture2D34, drawArea + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(textureRect), colorAlpha * 0.2f, Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); + Vector2 drawArea = Projectile.position + new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle textureRect = texture2D34.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Color colorAlpha = Projectile.GetAlpha(colorArea); + Vector2 halfRect = textureRect.Size() / 2f; + float scaleFactor = (float)Math.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 3f + 3f; + for (float i = 0f; i < 4f; i += 0.5f) + { + double angle = i * MathHelper.PiOver2; + Vector2 center = default; + Main.spriteBatch.Draw(texture2D34, drawArea + Vector2.UnitY.RotatedBy(angle, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(textureRect), Color.Violet.MultiplyRGBA(new Color(1f, 1f, 1f, 0f)), Projectile.rotation, halfRect, Projectile.scale, SpriteEffects.None, 0); + } + Main.EntitySpriteDraw(texture2D34, Projectile.Center - Main.screenPosition, texture2D34.Frame(), Color.White, 0f, texture2D34.Frame().Center(), 1f, SpriteEffects.None); + } + else + { + Asset tex = ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceCrystal_Halves"); + for (int i = 0; i < 2; i++) + { + float dir = i == 0 ? -1 : 1; + float ii = MathHelper.Lerp(60, 0, CalamityUtils.CircInEasing(introAnimationProgress, 1) - CalamityUtils.SineBumpEasing(introAnimationProgress, 1)); + Main.EntitySpriteDraw(tex.Value, Projectile.Center + (new Vector2(dir * ii).RotatedBy(MathHelper.ToRadians(MathHelper.Lerp(0, -90, CalamityUtils.CircInEasing(introAnimationProgress, 1))))) - Main.screenPosition, new Rectangle(i * 50, 0, 50, tex.Height()), Projectile.GetAlpha(lightColor).MultiplyRGBA(new Color(1f, 1f, 1f, 1f)), MathHelper.ToRadians(MathHelper.Lerp(70, 0, introAnimationProgress)), new Vector2(25, tex.Height() / 2), 1f, SpriteEffects.None); + } } return false; } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index aec440d1d4..bfc1e781c0 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -4,6 +4,8 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -14,6 +16,13 @@ namespace CalamityMod.Projectiles.Boss public class ProvidenceCrystalShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20; + ProjectileID.Sets.TrailingMode[Projectile.type] = 3; + } + public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -42,23 +51,16 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + ProvUtils.ApplyGFBDamage(Projectile, 0, 10); + bool healerGuardianAlive = true; if (CalamityGlobalNPC.doughnutBossHealer < 0 || !Main.npc[CalamityGlobalNPC.doughnutBossHealer].active) healerGuardianAlive = false; Lighting.AddLight(Projectile.Center, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity); - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - // Night AI or Guardian Healer - if (Projectile.maxPenetrate != (int)Providence.BossMode.Day || healerGuardianAlive) + if (!ProvUtils.DayAI() || healerGuardianAlive) Projectile.extraUpdates = 1; if (Projectile.timeLeft < 300) @@ -207,22 +209,21 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 0); - - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) + public override bool PreDraw(ref Color lightColor) { - // In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; + Asset texture = ModContent.Request(Texture); + + for (int i = 1; i < Projectile.oldPos.Length; i++) + { + Main.EntitySpriteDraw(texture.Value, Projectile.oldPos[i] + (Projectile.Size / 2) - Main.screenPosition, texture.Frame(), Color.Lerp(Color.Violet, new Color(42, 25, 60), (float)i / (float)Projectile.oldPos.Length).MultiplyRGBA(new Color(1f, 1f, 1f, 0f)), Projectile.oldRot[i], texture.Frame().Center(), Projectile.scale * MathHelper.Lerp(1.3f, 0.4f, (float)i / (float)Projectile.oldPos.Length), SpriteEffects.None); + } + + Projectile.DrawBackglow(Color.Violet.MultiplyRGBA(new Color(1f, 1f, 1f, 0f)), 4f); + Main.EntitySpriteDraw(texture.Value, Projectile.Center - Main.screenPosition, texture.Frame(), Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Frame().Center(), Projectile.scale, SpriteEffects.None); + + return false; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) - return; - - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 0, 10); - } + public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity); } } diff --git a/Projectiles/Boss/ProvidenceCrystal_Halves.png b/Projectiles/Boss/ProvidenceCrystal_Halves.png new file mode 100644 index 0000000000..45eca54187 Binary files /dev/null and b/Projectiles/Boss/ProvidenceCrystal_Halves.png differ diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index fff9c36e64..72a56060bf 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -3,11 +3,13 @@ using System.IO; using CalamityMod.NPCs; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +18,11 @@ namespace CalamityMod.Projectiles.Boss { public class ProvidenceHolyRay : ModProjectile, ILocalizedModType { + // ExtraWidth is a buffer variable to make this file more readable, which Projectile.ai[2] is then fed into on projectile spawn. + // When spawning the projectile, use Projectile.ai[2] in place of this. + // Also, this value is multiplicative, e.g. ExtraWidth of 1f will make the width the same as the sprite. + // 2f will make it doubly wide without affecting length, etc etc. + float ExtraWidth = 1f; public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() { @@ -49,26 +56,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // Day mode by default but syncs with the boss - if (CalamityGlobalNPC.holyBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.holyBoss].active) - Projectile.maxPenetrate = (int)Main.npc[CalamityGlobalNPC.holyBoss].localAI[1]; - } - else if (CalamityGlobalNPC.doughnutBoss != -1) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].active) - { - if (Main.npc[CalamityGlobalNPC.doughnutBoss].Calamity().CurrentlyEnraged) - Projectile.maxPenetrate = (int)Providence.BossMode.Night; - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; - } - } - else - Projectile.maxPenetrate = (int)Providence.BossMode.Day; + ExtraWidth = Projectile.ai[2]; - bool scissorLasers = CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day); + bool scissorLasers = CalamityWorld.revenge || !ProvUtils.DayAI(); Vector2? vector78 = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) @@ -94,6 +84,9 @@ namespace CalamityMod.Projectiles.Boss return; } + if (projScale == 1f) + ProvUtils.ApplyGFBDamage(Projectile, 400, 20); + Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * projScale; if (Projectile.scale > projScale) Projectile.scale = projScale; @@ -122,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss if (!Collision.CanHitLine(Main.npc[(int)Projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)Projectile.ai[1]].target].Center, 1, 1)) rayLength = 2400f; - int dustType = ProvUtils.GetDustID(Projectile.maxPenetrate); + int dustType = ProvUtils.GetDustID(); Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], rayLength, 0.5f); // Length of laser, linear interpolation Vector2 dustRotation = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); for (int j = 0; j < 2; j++) @@ -146,6 +139,16 @@ namespace CalamityMod.Projectiles.Boss DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); + + for (float i = 0; i < Projectile.localAI[1]; i += Main.rand.NextFloat(15, 30)) + { + GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(30 * ExtraWidth), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)) + (Projectile.velocity * i), Projectile.velocity * 5, false, 5, Main.rand.NextFloat(0.5f, 1.5f), ProvUtils.GetProjectileColor(255), false)); + } + } + + public override Color? GetAlpha(Color lightColor) + { + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) @@ -153,7 +156,9 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity == Vector2.Zero) return false; - bool dayTime = Projectile.maxPenetrate == (int)Providence.BossMode.Day; + Vector2 scale = new Vector2(Projectile.scale * ExtraWidth, Projectile.scale); + + bool dayTime = ProvUtils.DayAI(); Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight", AssetRequestMode.ImmediateLoad).Value; Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : @@ -162,14 +167,24 @@ namespace CalamityMod.Projectiles.Boss ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float rayDrawLength = Projectile.localAI[1]; //length of laser - Color baseColor = ProvUtils.GetProjectileColor(Projectile.maxPenetrate, 0) * 0.9f; + Color baseColor = ProvUtils.GetProjectileColor(lightColor); Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, baseColor, Projectile.rotation, texture2D19.Size() / 2f, scale, SpriteEffects.None, 0); rayDrawLength -= (texture2D19.Height / 2 + texture2D21.Height) * Projectile.scale; Vector2 projCenter = Projectile.Center; projCenter += Projectile.velocity * Projectile.scale * texture2D19.Height / 2f; + Texture2D GlowBallTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D GlowRingTexture = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + Projectile.localAI[2]++; + + Color glowColor = ProvUtils.GetProjectileColor(0); + + Main.EntitySpriteDraw(GlowBallTexture, Projectile.Center - Main.screenPosition, GlowBallTexture.Frame(), glowColor, 0f, GlowBallTexture.Frame().Center(), Projectile.scale / 1.5f * ExtraWidth, SpriteEffects.None); + Main.EntitySpriteDraw(GlowRingTexture, Projectile.Center - Main.screenPosition, GlowRingTexture.Frame(), glowColor, 0f, GlowRingTexture.Frame().Center(), Projectile.scale / MathHelper.Lerp(1.5f, 1f, (float)Math.Sin(Projectile.localAI[2] / 20f) * 0.5f) * ExtraWidth, SpriteEffects.None); + if (rayDrawLength > 0f) { float raySegment = 0f; @@ -179,7 +194,7 @@ namespace CalamityMod.Projectiles.Boss if (rayDrawLength - raySegment < drawRectangle.Height) drawRectangle.Height = (int)(rayDrawLength - raySegment); - Main.spriteBatch.Draw(texture2D20, projCenter - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D20, projCenter - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), baseColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), scale, SpriteEffects.None, 0); raySegment += drawRectangle.Height * Projectile.scale; projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; drawRectangle.Y += 36; @@ -192,7 +207,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector2 = projCenter - Main.screenPosition; sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, baseColor, Projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), scale, SpriteEffects.None, 0); return false; } @@ -206,6 +221,9 @@ namespace CalamityMod.Projectiles.Boss public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { + targetHitbox.Width = (int)((float)targetHitbox.Width * ExtraWidth); + targetHitbox.Height = (int)((float)targetHitbox.Height * ExtraWidth); + if (projHitbox.Intersects(targetHitbox)) return true; @@ -216,20 +234,13 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - // In GFB, "real damage" is replaced with negative healing - if (Projectile.maxPenetrate >= (int)Providence.BossMode.Red) - modifiers.SourceDamage *= 0f; - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { // If the player is dodging, don't apply debuffs - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) + if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyHitEffects(target, Projectile.maxPenetrate, 400, 20); + ProvUtils.ApplyDebuffs(target, 400); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/SwirlingFire.cs b/Projectiles/Boss/SwirlingFire.cs index a1d5261879..f5554e4fb8 100644 --- a/Projectiles/Boss/SwirlingFire.cs +++ b/Projectiles/Boss/SwirlingFire.cs @@ -1,4 +1,7 @@ -using CalamityMod.World; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,21 +25,24 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.timeLeft = 180; CooldownSlot = ImmunityCooldownID.Bosses; + Projectile.ai[0] = MathHelper.ToRadians(Main.rand.NextFloat(-3, 3)); } public override void AI() { - Vector2 fireVelocity = (Time / 6f).ToRotationVector2() * Main.rand.NextFloat(1.7f, 2.2f); - Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(3f, 3f), Main.zenithWorld || !Main.IsItDay() ? 267 : 6); - fire.velocity = fireVelocity.RotatedBy(MathHelper.PiOver2); - fire.scale = Main.rand.NextFloat(1.3f, 1.45f); - fire.noGravity = true; - if (Main.zenithWorld) - fire.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - else if (!Main.IsItDay()) - fire.color = Color.Lerp(Color.Cyan, Color.BlueViolet, Main.rand.NextFloat()); + Color c = ProvUtils.GetProjectileColor(255); - Dust.CloneDust(fire).velocity = fireVelocity.RotatedBy(-MathHelper.PiOver2); + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center, Projectile.velocity / 2f, false, 10, 0.5f * Projectile.ai[2], c)); + GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, 0.5f * Projectile.ai[2], 150, Main.rand.NextFloat(-0.01f, 0.01f))); + + Projectile.ai[2] *= 0.98f; + + Projectile.velocity *= 0.97f; + + if (Projectile.ai[2] < 0.2f) + { + Projectile.Kill(); + } Projectile.velocity = Projectile.velocity.RotatedBy(AngularTurnSpeed); Time++; diff --git a/Projectiles/Boss/YharonBulletHellVortex.cs b/Projectiles/Boss/YharonBulletHellVortex.cs index f9ef9fa121..ce7aa08e4d 100644 --- a/Projectiles/Boss/YharonBulletHellVortex.cs +++ b/Projectiles/Boss/YharonBulletHellVortex.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; - for (int i = 0; i < 110; i++) + for (int i = 0; i < 50; i++) { float angle = MathHelper.TwoPi * i / 50f + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; Color drawColor = Color.White * 0.04f; diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index aa5a68dc69..553a32d527 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 167a01f150..a4dbe1a3f6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; @@ -21,6 +22,11 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.Crags.Tree; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.World; @@ -53,7 +59,7 @@ namespace CalamityMod.Projectiles public bool CreatedByPlayerDash = false; // Speed cap for accelerating boss laser projectiles with 2 extraUpdates. - public const float AcceleratingBossLaserVelocityCap = 10f; + public const float AcceleratingBossLaserVelocityCap = 8f; // Damage Adjusters public const float PierceResistHarshness = 0.12f; @@ -237,8 +243,6 @@ namespace CalamityMod.Projectiles if (pointBlankShotDuration > 0) pointBlankShotDuration--; - if (pointBlankShotDistanceTravelled < PointBlankShotDistanceLimit) - pointBlankShotDistanceTravelled += projectile.velocity.Length() * projectile.MaxUpdates; // Reduce secondary yoyo damage if the player has Yoyo Glove // Brief behavior documentation of yoyo AI: ai[0, 1] are the x, y co-ords and localAI[0] is the airtime in frames @@ -2672,7 +2676,7 @@ namespace CalamityMod.Projectiles { int totalProjectiles = masterMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = ProjectileType(); float velocity = 1f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) @@ -3641,7 +3645,7 @@ namespace CalamityMod.Projectiles if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) { - if (modPlayer.fungalSymbiote && CalamityLists.MushroomProjectileIDs.Contains(projectile.type)) + if (modPlayer.fungalSymbiote && player.HasBuff(BuffType())) { if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) { @@ -3812,7 +3816,7 @@ namespace CalamityMod.Projectiles } break; case CalamityGlobalBuff.ModdedFlaskEnchant: - int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : ModContent.DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); + int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); if (Main.rand.NextBool(4)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); @@ -3832,7 +3836,7 @@ namespace CalamityMod.Projectiles { if ((player.Calamity().flaskBrimstone || player.Calamity().flaskCrumbling || player.Calamity().flaskHoly) && !projectile.noEnchantments && !projectile.noEnchantmentVisuals) { - int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : ModContent.DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); + int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); if (Main.rand.NextBool(player.Calamity().flaskCrumbling ? 5 : 4)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); @@ -3899,7 +3903,7 @@ namespace CalamityMod.Projectiles PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f, Color.Crimson * 0.7f); GeneralParticleHandler.SpawnParticle(spark); - Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : ModContent.DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); + Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.5f, 1f); } @@ -4055,6 +4059,12 @@ namespace CalamityMod.Projectiles flatDR = 0; } + // CIT 29JUN2024: Moved from PreAI to PostAI so that it is called every update instead of every frame. + // This makes the distance traveled increment more accurately for projectiles with extra updates, as previously projectiles with extra updates + // would add the distance traveled for the whole frame on the first update, making the distance checking much choppier. + if (pointBlankShotDistanceTravelled < PointBlankShotDistanceLimit) + pointBlankShotDistanceTravelled += projectile.velocity.Length(); + // optimization to remove conversion X/Y loop for irrelevant projectiles bool isConversionProjectile = projectile.type == ProjectileID.PurificationPowder || projectile.type == ProjectileID.VilePowder @@ -4062,7 +4072,8 @@ namespace CalamityMod.Projectiles || projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.CorruptSpray || projectile.type == ProjectileID.CrimsonSpray - || projectile.type == ProjectileID.HallowSpray; + || projectile.type == ProjectileID.HallowSpray + || projectile.type == ProjectileID.Fertilizer; if (!isConversionProjectile) return; @@ -4073,10 +4084,39 @@ namespace CalamityMod.Projectiles bool isPowder = projectile.type == ProjectileID.PurificationPowder || projectile.type == ProjectileID.VilePowder || projectile.type == ProjectileID.ViciousPowder; + if (!WorldGen.InWorld(x, y, 3)) + return; + for (int i = x - 1; i <= x + 1; i++) { for (int j = y - 1; j <= y + 1; j++) { + if (projectile.type == ProjectileID.Fertilizer) + { + Tile tile = Main.tile[i, j]; + + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + bool success = WorldGen.GrowTree(i, j); + if (success && isPlayerNear) + WorldGen.TreeGrowFXCheck(i, j); + } + else if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + bool success = WorldGen.GrowPalmTree(i, j); + if (success && isPlayerNear) + WorldGen.TreeGrowFXCheck(i, j); + } + else if (tile.TileType == ModContent.TileType()) + { + bool isPlayerNear = WorldGen.PlayerLOS(i, j); + if (isPlayerNear && Main.tile[i, j + 1].TileType != ModContent.TileType()) + SpineTree.Spawn(i, j, 22, 28, true); + } + } + if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) { AstralBiome.ConvertFromAstral(i, j, ConvertType.Pure, !isPowder); @@ -4217,13 +4257,13 @@ namespace CalamityMod.Projectiles } } - // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. - // damageScale = 0.1f + player.velocity.Length() / 7f * 0.9f if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { + // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. + float vanillaVelocityDamageMultiplier = 0.1f + player.velocity.Length() / 7f * 0.9f; float baseVelocityDamageMultiplier = 0.01f + player.velocity.Length() * 0.002f; float calamityVelocityDamageMultiplier = 100f * (1f - (1f / (1f + baseVelocityDamageMultiplier))); - modifiers.SourceDamage *= calamityVelocityDamageMultiplier; + modifiers.SourceDamage *= calamityVelocityDamageMultiplier / vanillaVelocityDamageMultiplier; } // If applicable, use ricoshot bonus damage. @@ -4801,7 +4841,7 @@ namespace CalamityMod.Projectiles int beeType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); if (Main.zenithWorld) { - beeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + beeType = Main.rand.NextBool(3) ? NPCType() : NPCType(); } else if (Main.masterMode || BossRushEvent.BossRushActive) { diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index d99945fe33..ebbc95683f 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles { ProjectileID.ClusterFragmentsI, Do(IDStaticIFrames(15)) }, { ProjectileID.ClusterRocketII, Do(LocalIFrames(15)) }, { ProjectileID.ClusterFragmentsII, Do(IDStaticIFrames(15)) }, - { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, + { ProjectileID.ClusterSnowmanRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterSnowmanRocketII, Do(LocalIFrames(15)) }, { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3)) }, // Flying Dragon { ProjectileID.EmeraldBolt, Do(NoPiercing) }, @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1)) }, { ProjectileID.ExplosiveBullet, standardBulletTweaks }, { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert - { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(400)) }, + { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150)) }, { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2)) }, { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1)) }, diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 61308df0d2..9cf0a0aff5 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Buffs.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal @@ -173,7 +175,23 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, 1, lightColor, 2); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Color drawColor = Projectile.GetAlpha(lightColor); + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + if (i % 2 == 0) + continue; + + Color trailColor = Color.Lerp(drawColor, Color.Transparent, i / (float)Projectile.oldPos.Length) * 0.67f; + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(tex, trailPos, null, trailColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index 11b7379fb5..a4b6b8f7ca 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -216,7 +216,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - bool onKill = target.life <= 0; + bool onKill = (target.life <= 0 && target.realLife == -1); if (notSplit) { Projectile.Kill(); diff --git a/Projectiles/Enemy/HorsPoisonBlast.cs b/Projectiles/Enemy/HorsPoisonBlast.cs new file mode 100644 index 0000000000..c4a1ae5515 --- /dev/null +++ b/Projectiles/Enemy/HorsPoisonBlast.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.GameContent; + +namespace CalamityMod.Projectiles.Enemy +{ + public class HorsPoisonBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + public override string Texture => "CalamityMod/Projectiles/Magic/VitriolicViperSpit"; + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 15; + Projectile.timeLeft = 60; + } + + public override void AI() + { + if (Projectile.velocity.Length() < 0.08f) + Projectile.alpha += 15; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Main.rand.NextBool(3)) + { + int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Venom); + Main.dust[d].noGravity = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } + + public override void OnKill(int timeLeft) + { + float totalDusts = 18f; + for (float i = 0f; i < totalDusts; i++) + { + Vector2 ringSpeed = new Vector2((float)Math.Cos(i / totalDusts * MathHelper.TwoPi), (float)Math.Sin(i / totalDusts * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.rotation) * 4f * Projectile.scale; + Dust droplets = Dust.NewDustPerfect(Projectile.Center, DustID.Venom, ringSpeed, 100); + droplets.noGravity = true; + } + } + } +} diff --git a/Projectiles/Enemy/IceClasperEnemyProjectile.cs b/Projectiles/Enemy/IceClasperEnemyProjectile.cs index f9c5b9df8e..05065edba3 100644 --- a/Projectiles/Enemy/IceClasperEnemyProjectile.cs +++ b/Projectiles/Enemy/IceClasperEnemyProjectile.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return true; diff --git a/Projectiles/Enemy/SharkoonExplosion.cs b/Projectiles/Enemy/SharkoonExplosion.cs new file mode 100644 index 0000000000..c672ea04e8 --- /dev/null +++ b/Projectiles/Enemy/SharkoonExplosion.cs @@ -0,0 +1,24 @@ +using CalamityMod.NPCs.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class SharkoonExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.hostile = true; + Projectile.friendly = true; + Projectile.width = Projectile.height = Sharkoon.ExplosionRadius * 2; + Projectile.timeLeft = 2; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + => CalamityUtils.CircularHitboxCollision(Projectile.Center, Sharkoon.ExplosionRadius, targetHitbox); + } +} diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index 84a1716635..fa7697db9b 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; + Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Magic; } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index c109d2a738..a89860f6d3 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -57,6 +58,10 @@ namespace CalamityMod.Projectiles.Magic Main.dust[moreGreen].fadeIn = 1f; Main.dust[moreGreen].noGravity = true; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/AugurTentacle.cs similarity index 98% rename from Projectiles/Magic/ElementTentacle.cs rename to Projectiles/Magic/AugurTentacle.cs index 2cd1d493bf..78deee20b7 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/AugurTentacle.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class ElementTentacle : ModProjectile, ILocalizedModType + public class AugurTentacle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs deleted file mode 100644 index 3abea1c3f3..0000000000 --- a/Projectiles/Magic/AuraRain.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class AuraRain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.aiStyle = ProjAIStyleID.RainCloud; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.timeLeft = 300; - Projectile.alpha = 255; - Projectile.scale = 1.1f; - Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 1; - AIType = ProjectileID.RainFriendly; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust.velocity = Vector2.Zero; - dust.position -= Projectile.velocity / 5f; - dust.noGravity = true; - dust.scale = 0.8f; - dust.noLight = true; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } - } -} diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs deleted file mode 100644 index 1afd7066fb..0000000000 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneFireball : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; - Projectile.timeLeft = 300; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.25f, 0f, 0f); - if (Projectile.wet) - { - Projectile.Kill(); - SpawnFireballs(true); - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 4f) - { - int brimstone = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[brimstone].noGravity = true; - Main.dust[brimstone].velocity *= 0f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0.0 && Projectile.velocity.X != 0.0) - { - Projectile.velocity.X *= 0.97f; - if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.2f; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f * Projectile.direction; - } - if (Projectile.velocity.Y <= 16f) - return; - Projectile.velocity.Y = 16f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - Projectile.ai[0] += 0.1f; - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - Projectile.velocity *= 0.8f; - } - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - - if (target.HasBuff(BuffID.Wet) || target.Calamity().eutrophication > 0 || target.Calamity().rTide > 0 || target.Calamity().cDepth > 0) - { - SpawnFireballs(false); - } - } - - public void SpawnFireballs(bool isFromLiquidHit) - { - if (Projectile.owner == Main.myPlayer) - { - int homerAmt = 2; - if (!isFromLiquidHit && Projectile.numHits > 0) - homerAmt = 1; - - for (int j = 0; j < homerAmt; j++) - { - Vector2 velocity = new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-100f, -50f)); - while (velocity.X == 0f) - { - velocity.X = (float)Main.rand.Next(-100, 101); - } - velocity.Normalize(); - velocity *= Main.rand.NextFloat(7f, 10f); - float damageMult = isFromLiquidHit ? 1f : 0.25f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocity.X, velocity.Y, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), 0f, Projectile.owner, 0f, 0f); - } - } - } - } -} diff --git a/Projectiles/Magic/BrimstoneFireball.png b/Projectiles/Magic/BrimstoneFireball.png deleted file mode 100644 index 62d616a8c1..0000000000 Binary files a/Projectiles/Magic/BrimstoneFireball.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs deleted file mode 100644 index a18d3379fd..0000000000 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneHomer : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 180; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 150 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.rotation += 0.7f * Projectile.direction; - - int brimstone = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); - Main.dust[brimstone].noGravity = true; - - if (Projectile.timeLeft < 160) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 240f, 8f, 20f); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Magic/BrimstoneHomer.png b/Projectiles/Magic/BrimstoneHomer.png deleted file mode 100644 index 282b689545..0000000000 Binary files a/Projectiles/Magic/BrimstoneHomer.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs deleted file mode 100644 index d49ed65926..0000000000 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BrimstoneTentacle : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 40; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.MaxUpdates = 3; - Projectile.DamageType = DamageClass.Magic; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; - } - - public override void AI() - { - Projectile.localAI[1]++; - if (Projectile.velocity.X != Projectile.velocity.X) - { - if (Math.Abs(Projectile.velocity.X) < 1f) - { - Projectile.velocity.X = -Projectile.velocity.X; - } - else - { - Projectile.Kill(); - } - } - if (Projectile.velocity.Y != Projectile.velocity.Y) - { - if (Math.Abs(Projectile.velocity.Y) < 1f) - { - Projectile.velocity.Y = -Projectile.velocity.Y; - } - else - { - Projectile.Kill(); - } - } - Vector2 center10 = Projectile.Center; - Projectile.scale = 1f - Projectile.localAI[0]; - Projectile.width = (int)(20f * Projectile.scale); - Projectile.height = Projectile.width; - Projectile.position.X = center10.X - (float)(Projectile.width / 2); - Projectile.position.Y = center10.Y - (float)(Projectile.height / 2); - if (Projectile.localAI[0] < 0.1f) - { - Projectile.localAI[0] += 0.01f; - } - else - { - Projectile.localAI[0] += 0.025f; - } - if (Projectile.localAI[0] >= 0.95f) - { - Projectile.Kill(); - } - Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; - Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; - if (Projectile.velocity.Length() > 16f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 16f; - } - Projectile.ai[0] *= 1.05f; - Projectile.ai[1] *= 1.05f; - if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) - { - int scaleLoopCheck = 0; - while ((float)scaleLoopCheck < Projectile.scale * 10f) - { - int brimDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.5f); - Main.dust[brimDust].position = (Main.dust[brimDust].position + Projectile.Center) / 2f; - Main.dust[brimDust].noGravity = true; - Main.dust[brimDust].velocity *= 0.1f; - Main.dust[brimDust].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[brimDust].fadeIn = (float)(100 + Projectile.owner); - Main.dust[brimDust].scale += Projectile.scale * 0.75f; - scaleLoopCheck++; - } - } - } - } -} diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index 36e9c1e8df..7386caa9e2 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 56b7b6ac47..1993e6f085 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,6 +1,8 @@ using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,85 +13,164 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public bool preDamage = true; + public bool moving = false; + public float scaling = 1; + public int scalingTimer = 0; + public Color InnerColor = Color.LightGreen; + public int curveDirection = 100; + public int curves = 3; + + public int scalingTimerMax = 90; + public float damageMult = 1; public override void SetDefaults() { - Projectile.width = 40; - Projectile.height = 40; + Projectile.width = 90; + Projectile.height = 90; Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.MaxUpdates = 3; + Projectile.penetrate = -1; + Projectile.extraUpdates = 8; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8 * Projectile.extraUpdates; } public override void AI() { - Projectile.localAI[1]++; - if (Projectile.velocity.X != Projectile.velocity.X) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + Vector2 vel = ((Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 7).RotatedBy(0.2f * curveDirection); + + if (curveDirection == 100) { - if (Math.Abs(Projectile.velocity.X) < 1f) - { - Projectile.velocity.X = -Projectile.velocity.X; - } - else - { - Projectile.Kill(); - } + curveDirection = Main.rand.NextBool() ? 1 : -1; } - if (Projectile.velocity.Y != Projectile.velocity.Y) + if (preDamage) { - if (Math.Abs(Projectile.velocity.Y) < 1f) + if (targetDist < 1400f) { - Projectile.velocity.Y = -Projectile.velocity.Y; + float scaler = Utils.GetLerpValue(-60, 120, time, true); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.6f * scaler, 0f, 4, false); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * scaler, 0f, 4, true); + GeneralParticleHandler.SpawnParticle(blastRing2); } - else - { - Projectile.Kill(); - } - } - Vector2 projCenter = Projectile.Center; - Projectile.scale = 1f - Projectile.localAI[0]; - Projectile.width = (int)(20f * Projectile.scale); - Projectile.height = Projectile.width; - Projectile.position.X = projCenter.X - (float)(Projectile.width / 2); - Projectile.position.Y = projCenter.Y - (float)(Projectile.height / 2); - if (Projectile.localAI[0] < 0.1f) - { - Projectile.localAI[0] += 0.01f; + Projectile.velocity *= 0.96f; } else { - Projectile.localAI[0] += 0.025f; - } - if (Projectile.localAI[0] >= 0.95f) - { - Projectile.Kill(); - } - Projectile.velocity.X = Projectile.velocity.X + Projectile.ai[0] * 1.5f; - Projectile.velocity.Y = Projectile.velocity.Y + Projectile.ai[1] * 1.5f; - if (Projectile.velocity.Length() > 16f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 16f; - } - Projectile.ai[0] *= 1.05f; - Projectile.ai[1] *= 1.05f; - if (Projectile.scale < 1f && Projectile.localAI[1] > 5f) - { - int scaleLoopCheck = 0; - while ((float)scaleLoopCheck < Projectile.scale * 10f) + if (moving) { - int purpleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1.1f); - Main.dust[purpleDust].position = (Main.dust[purpleDust].position + Projectile.Center) / 2f; - Main.dust[purpleDust].noGravity = true; - Main.dust[purpleDust].velocity *= 0.1f; - Main.dust[purpleDust].velocity -= Projectile.velocity * (1.3f - Projectile.scale); - Main.dust[purpleDust].fadeIn = (float)(100 + Projectile.owner); - Main.dust[purpleDust].scale += Projectile.scale * 0.75f; - scaleLoopCheck++; + float curveStrength = Utils.GetLerpValue(scalingTimerMax, 0, scalingTimer, true) * 0.04f; + Projectile.velocity = Projectile.velocity.RotatedBy(curveStrength * curveDirection); + scaling = Utils.GetLerpValue(0, scalingTimerMax, scalingTimer, true); + + if (time % 2 == 0 && targetDist < 1400f) + { + Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 12, 3.5f * scaling, Color.Black); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 12, 1.5f * scaling, InnerColor); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Main.rand.NextBool(6)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); + dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = InnerColor; + } + + scalingTimer--; + if (scalingTimer <= 0) + { + if (curves > 1) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0f, scalingTimerMax / 2, false); + GeneralParticleHandler.SpawnParticle(blastRing); + for (int i = 0; i < 2; i++) + { + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.26f, 0f, scalingTimerMax / 2, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + Projectile.velocity = Vector2.Zero; + } + else + Projectile.Kill(); + moving = false; + } + } + else + { + scalingTimer += 2; + if (scalingTimer >= scalingTimerMax) + { + curves--; + if (curves > 0) + { + for (int i = 0; i <= 6; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 191 : dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.velocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + dust.noGravity = true; + dust.color = dust.type == dustStyle ? InnerColor : default; + } + Projectile.velocity = vel; + curveDirection = (curveDirection == 1 ? -1 : 1); + moving = true; + Projectile.numHits = 0; + } + else + Projectile.Kill(); + } } } + if (time == 120) + { + for (int i = 0; i <= 12; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } + preDamage = false; + moving = true; + scalingTimer = scalingTimerMax; + Projectile.velocity = vel; + } + time++; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(fire with { Volume = 0.3f, Pitch = 0.9f }, Projectile.Center); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // it was GOING to have this but deus made it real bad + //damageMult = MathHelper.Clamp(Utils.GetLerpValue(5, 1, Projectile.numHits), 0.7f, 1); + //modifiers.SourceDamage *= damageMult; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 8; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.3f, 3.1f); + dust.noGravity = true; + dust.color = InnerColor; + } + } + public override bool? CanDamage() => preDamage ? false : null; } } diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 99543487e8..32a30db723 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -58,82 +58,46 @@ namespace CalamityMod.Projectiles.Magic float laserNormalize; Vector2 projDirection = Vector2.Zero; float laserTimer; - float y; + float yOffset; float laserRotationSpeed; float scaleFactor6; - Color color = new Color(1, 1, 1, 127); + Color color = GetBeamColor((int)projectile2.ai[0], (int)Projectile.ai[0]); Projectile.Opacity = 1f; - if (projectile2.ai[0] < 720f) + if (projectile2.ai[0] < 360f) { - laserTimer = projectile2.ai[0] / 1440f; - y = 6f + projectile2.ai[0] / 720f * 7f; - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - - if (projectile2.ai[0] < 480f) + laserTimer = projectile2.ai[0] / 720f; + yOffset = 6f + projectile2.ai[0] / 360f * 7f; + if (projectile2.ai[0] < 240f) laserRotationSpeed = 1.75f; else - laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); - - scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; + laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 240f) / 120f); + scaleFactor6 = -2f - projectile2.ai[0] / 360f * 5f; } else { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - colorLimit = 255f; - - switch ((int)Projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); - break; - } - laserTimer = 0.5f; laserRotationSpeed = 10.875f; - y = 13f; + yOffset = 13f; scaleFactor6 = -7f; } float laserDirection = (projectile2.ai[0] + laserPosition * laserRotationSpeed) / (laserRotationSpeed * 6f) * MathHelper.TwoPi; laserNormalize = Vector2.UnitY.RotatedBy(laserDirection).Y * (MathHelper.Pi / 6) * laserTimer * 0.33f; - projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, y)).RotatedBy(projectile2.velocity.ToRotation()); + projDirection = (Vector2.UnitY.RotatedBy(laserDirection) * new Vector2(4f, yOffset)).RotatedBy(projectile2.velocity.ToRotation()); Projectile.position = projectile2.Center + aimDirection * 16f - Projectile.Size / 2f + new Vector2(0f, -Main.projectile[(int)Projectile.ai[1]].gfxOffY); Projectile.position += projectile2.velocity.ToRotation().ToRotationVector2() * scaleFactor6; Projectile.position += projDirection; Projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(laserNormalize); Projectile.scale = 1.5f * (1.5f - laserTimer); - // Takes 360 frames to reach normal damage - float amount = projectile2.ai[0] / 1200f; + // Takes 180 frames to reach normal damage + float amount = projectile2.ai[0] / 600f; if (amount > 1f) amount = 1f; Projectile.damage = (int)(projectile2.damage * MathHelper.Lerp(0.25f, 2.2f, amount)); - if (projectile2.ai[0] >= 720f) + if (projectile2.ai[0] >= 360f) chargeUpCenter = new Vector2?(projectile2.Center); if (!Collision.CanHitLine(Main.player[Projectile.owner].Center, 0, 0, projectile2.Center, 0, 0)) @@ -212,55 +176,15 @@ namespace CalamityMod.Projectiles.Magic Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float drawArea = Projectile.localAI[1]; Projectile projectile2 = Main.projectile[(int)Projectile.ai[1]]; - Color color = new Color(1, 1, 1, 127); - if (projectile2.ai[0] < 720f) - { - if (projectile2.ai[0] > 360f) - { - int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); - color = new Color(colorValue, colorValue, colorValue, 127); - } - } - else - { - float colorLimit = projectile2.ai[0] - 720f; - if (colorLimit > 255f) - { - colorLimit = 255f; - } - switch ((int)Projectile.ai[0]) //R O Y G B I V - { - case 0: - color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); - break; - case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); - break; - case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); - break; - case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); - break; - case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); - break; - case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); - break; - case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); - break; - } - } + Color color = GetBeamColor((int)projectile2.ai[0], (int)Projectile.ai[0]); - Color value25 = color; + Vector2 drawStart = Projectile.Center.Floor(); drawStart += Projectile.velocity * Projectile.scale * 10.5f; drawArea -= Projectile.scale * 14.5f * Projectile.scale; Vector2 drawScale = new Vector2(Projectile.scale); DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 = value25 * 0.75f * Projectile.Opacity; + DelegateMethods.c_1 = color * 0.75f * Projectile.Opacity; Vector2 projPos = Projectile.oldPos[0]; projPos = new Vector2(Projectile.width, Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, drawStart - Main.screenPosition, drawStart + Projectile.velocity * drawArea - Main.screenPosition, drawScale, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); @@ -269,6 +193,46 @@ namespace CalamityMod.Projectiles.Magic return false; } + public Color GetBeamColor(int timer, int type) + { + Color color = Color.Black; + if (timer < 360f) + { + float brightness = MathHelper.Clamp(timer / 180f, 0f, 1f); + color = Color.Lerp(Color.Black, Color.White, brightness); + } + else + { + float hue = 0f; + switch (type) + { + case 1: // 30 (Orange) + hue = 1f / 12f; + break; + case 2: // 60 (Yellow) + hue = 1f / 6f; + break; + case 3: // 120 (Green) + hue = 1f / 3f; + break; + case 4: // 210 (Blue) + hue = 7f / 12f; + break; + case 5: // 270 (Purple) + hue = 3f / 4f; + break; + case 0: // 0 (Red) + default: + hue = 0f; + break; + } + float lightness = 1f - (MathHelper.Clamp((timer - 360f) / 240f, 0f, 1f) * 0.4f); + color = Main.hslToRgb(hue, 1f, lightness); + } + color.A = 127; + return color; + } + public override void CutTiles() { DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index 5e8cf54258..76982a34f4 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -1,4 +1,4 @@ -using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -12,9 +12,19 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private static int Lifetime = 40; - private static float ExplosionRadius = 210.0f; - private static float StartDustQuantity = 36f; + private static float ExplosionRadius = 500.0f; + private static float ParticleRadius = 210.0f; + private Player Owner => Main.player[Projectile.owner]; + public int frameX = 0; + public int frameY = 0; + private const int horizontalFrames = 5; + private const int verticalFrames = 4; + public int time = 0; + public int currentFrame = 0; + private const int frameLength = 2; + public bool damageFrame = false; + public float starAngle = 0; + public override void SetDefaults() { @@ -26,64 +36,108 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = Lifetime; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = -1; } - // localAI[0] = frame counter - // localAI[1] = dust quantity public override void AI() { - // Play sound on frame 1 and initialize dust quantity - if (Projectile.localAI[0] == 0f) + if (currentFrame == 19) + damageFrame = true; + else + damageFrame = false; + if (currentFrame == 0) { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); - Projectile.localAI[1] = StartDustQuantity; + for (int i = 0; i < 6; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 3f, 1f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.5f, 0.5f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + Particle p = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orange * 0.5f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-5, 5), 5.5f, 0f, 20); + GeneralParticleHandler.SpawnParticle(p); } - - // Pure dust projectile - DrawProjectile(); - - // Increment frame counter - Projectile.localAI[0] += 1f; - } - - private void DrawProjectile() - { - // Taper down the dust amount for the last bit of the projectile's life - if (Projectile.localAI[0] >= Lifetime - 15) - Projectile.localAI[1] -= 1f; - - int dustCount = (int)Projectile.localAI[1]; - for (int i = 0; i < dustCount; ++i) + if (currentFrame == 5) { - int dustType = Main.rand.NextBool(3) ? 262 : 87; - float scale = Main.rand.NextFloat(2.0f, 2.5f); - float randX = Main.rand.NextFloat(-30f, 30f); - float randY = Main.rand.NextFloat(-30f, 30f); - float randVelocity = Main.rand.NextFloat(5f, 24f); - float speed = (float)Math.Sqrt((double)(randX * randX + randY * randY)); - speed = randVelocity / speed; - randX *= speed; - randY *= speed; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].velocity.X = randX; - Main.dust[idx].velocity.Y = randY; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; + Particle p = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Orange * 0.5f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-5, 5), 4.5f, 0f, 15); + GeneralParticleHandler.SpawnParticle(p); } + if (currentFrame == 10) + { + starAngle = Main.rand.NextFloat(-0.9f, 0.9f); + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 6, 0.12f, Color.Orange, new Vector2(1.5f, 0.9f), true, true, 2); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + if (currentFrame == 19) + { + Owner.Calamity().GeneralScreenShakePower = 8f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HeliumFlashExplodeNoMetal") { Volume = 1f }, Projectile.Center); + for (int i = 0; i < 12; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Orange, Utils.GetLerpValue(0, 12, i, true)), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0006f + 0.08f + 0.04f * i, (int)(30 - i * 1.3f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.OrangeRed, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0006f + 0.093f + 0.04f * i * 4, (int)(30 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 5f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 2f, 35, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 4; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2().RotatedBy(starAngle) * 8f; + + Particle pulse = new GlowSparkParticle(Projectile.Center, vel, false, 10, 0.22f, Color.Orange, new Vector2(1.5f, 0.9f), true, true, 1); + GeneralParticleHandler.SpawnParticle(pulse); + } + for (int i = 0; i < 35; i++) + { + Vector2 randVel = new Vector2(50, 50).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.SlateGray, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.8f, 1.3f), 0.5f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 60; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 1.25f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + currentFrame++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 300); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.85f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + public override bool? CanDamage() => damageFrame ? null : false; } } + + diff --git a/Projectiles/Magic/HeliumFlashEmpty.png b/Projectiles/Magic/HeliumFlashEmpty.png new file mode 100644 index 0000000000..0c1fa38df7 Binary files /dev/null and b/Projectiles/Magic/HeliumFlashEmpty.png differ diff --git a/Projectiles/Magic/HeliumFlashHoldout.cs b/Projectiles/Magic/HeliumFlashHoldout.cs new file mode 100644 index 0000000000..c26c976f60 --- /dev/null +++ b/Projectiles/Magic/HeliumFlashHoldout.cs @@ -0,0 +1,266 @@ +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + internal class HeliumFlashHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 60f; + public override float BaseOffsetY => 0f; + public override float RecoilResolveSpeed => 0.4f; + public override string Texture => "CalamityMod/Projectiles/Magic/HeliumFlashEmpty"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * 26; + + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private bool FullyCharged => CurrentChargingFrames >= HeliumFlash.FullChargeFrames; + public SlotId HeliumChargeSlot; + public static float BulletSpeed = 15f; + public int time = 0; + public int starcoreFrameCounter = 0; + public int starcoreFrame = 0; + + public override void KillHoldoutLogic() + { + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + if (SoundEngine.TryGetActiveSound(HeliumChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + + // Starcore animation + starcoreFrameCounter++; + if (starcoreFrameCounter > (FullyCharged ? 0 : 1)) + { + starcoreFrame++; + starcoreFrameCounter = 0; + } + if (starcoreFrame >= 6) + starcoreFrame = 0; + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + KeepRefreshingLifetime = false; + + if (Projectile.ai[1] != 1f) + { + Projectile.timeLeft = (FullyCharged ? HeliumFlash.AftershotCooldownFrames * 3 : (int)(HeliumFlash.AftershotCooldownFrames * 1.5f)); + + ChargeSound?.Stop(); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + if (FullyCharged) + { + Projectile.ai[2] = 1f; + OffsetLengthFromArm -= 25; + SoundEngine.PlaySound(HeliumFlash.ChargeFire, Projectile.Center); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0); + + Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.08f, 14); + GeneralParticleHandler.SpawnParticle(pulse2); + + for (int i = 0; i < 17; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(5, 25); + chargefull.scale = Main.rand.NextFloat(0.65f, 0.95f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, Color.OrangeRed, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + for (int i = 0; i <= 18; i++) + { + Vector2 sparkVelocity = shootVelocity / 2f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(GunTipPosition, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? Color.Red : Color.DarkRed); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(GunTipPosition, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashDudFire"); + SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.3f }, Projectile.Center); + for (int i = 0; i < 12; i++) + { + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1f, 3.5f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.9f); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + Projectile.ai[1] = 1f; + } + } + else + { + if (Projectile.ai[1] != 1f) + CurrentChargingFrames++; + + // Sounds + if (FullyCharged) + { + if ((CurrentChargingFrames - HeliumFlash.FullChargeFrames) % HeliumFlash.ChargeLoopSoundFrames == 0) + HeliumChargeSlot = SoundEngine.PlaySound(HeliumFlash.ChargeLoop, Projectile.Center); + + if (Main.rand.NextBool()) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 5); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.15f); + dust2.scale = Main.rand.NextFloat(0.35f, 0.7f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + else if (CurrentChargingFrames == 10) + HeliumChargeSlot = SoundEngine.PlaySound(HeliumFlash.Charge, Projectile.Center); + + // Charge-up visuals + if (CurrentChargingFrames >= 10) + { + if (!FullyCharged) + { + Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.06f + (CurrentChargingFrames / 180), 0.08f + (CurrentChargingFrames / 180)), Main.rand.NextVector2CircularEdge(2.5f, 2.5f) * Main.rand.NextFloat(0.3f * CurrentChargingFrames, 0.3f * CurrentChargingFrames), 0f, Color.Red, Color.Orange, 7, GunTipPosition); + GeneralParticleHandler.SpawnParticle(streak); + } + } + + // Full charge effects + if (CurrentChargingFrames == HeliumFlash.FullChargeFrames) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashReadyAlt"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0f }, Projectile.Center); + for (int i = 0; i < 18; i++) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1, 5); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); + dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed, 0.7f); + } + } + } + if (Projectile.ai[1] == 1f) + { + if (Projectile.ai[2] == 1 && Projectile.timeLeft == (int)(HeliumFlash.AftershotCooldownFrames * 1.4f)) + { + OffsetLengthFromArm += 8; + } + if (Projectile.ai[2] == 1 && Projectile.timeLeft == (int)(HeliumFlash.AftershotCooldownFrames * 1.1f)) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashSteamRelease"); + SoundEngine.PlaySound(fire with { Volume = 0.6f, Pitch = 0f }, Projectile.Center); + for (int b = 0; b < 12; b++) + { + Vector2 smokeVel1 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(84)) * 14; // Middle + Vector2 smokeVel2 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(48f)) * 14; // Front + Vector2 smokeVel3 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(125f)) * 14; // Back + for (int i = 0; i < 2; i++) + { + Particle smoke1 = new HeavySmokeParticle(GunTipPosition + smokeVel1 * 2, smokeVel1 * Main.rand.NextFloat(0.2f, 0.7f), Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)), Main.rand.Next(15, 35 + 1), Main.rand.NextFloat(0.08f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke1); + Particle smoke2 = new HeavySmokeParticle(GunTipPosition + smokeVel2 * 2, smokeVel2 * Main.rand.NextFloat(0.2f, 0.7f), Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)), Main.rand.Next(15, 35 + 1), Main.rand.NextFloat(0.08f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke2); + Particle smoke3 = new HeavySmokeParticle(GunTipPosition + smokeVel3 * 2, smokeVel3 * Main.rand.NextFloat(0.2f, 0.7f), Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)), Main.rand.Next(15, 35 + 1), Main.rand.NextFloat(0.08f, 0.45f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke3); + + Dust dust1 = Dust.NewDustPerfect(GunTipPosition + smokeVel1 * 2, 303, smokeVel1.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.03f, 0.3f), 180, default, Main.rand.NextFloat(0.3f, 1.1f)); + dust1.noGravity = false; + dust1.color = Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + smokeVel2 * 2, 303, smokeVel2.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.03f, 0.3f), 180, default, Main.rand.NextFloat(0.3f, 1.1f)); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)); + Dust dust3 = Dust.NewDustPerfect(GunTipPosition + smokeVel3 * 2, 303, smokeVel3.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.03f, 0.3f), 180, default, Main.rand.NextFloat(0.3f, 1.1f)); + dust3.noGravity = false; + dust3.color = Color.Lerp(Color.SlateGray, Color.Orange, Main.rand.NextFloat(0, 0.4f)); + + if (i == 0) + { + smokeVel1 *= -1; + smokeVel2 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(-125f)) * 14; + smokeVel3 = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(-48f)) * 14; + } + } + } + } + + CurrentChargingFrames *= FullyCharged ? 0 : 0.9f; + } + + Lighting.AddLight(GunTipPosition, Color.OrangeRed.ToVector3() * 1.5f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true)); + + time++; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(HeliumChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (!Owner.CantUseHoldout() && !FullyCharged) + { + float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, HeliumFlash.FullChargeFrames); + drawPosition += Main.rand.NextVector2Circular(rumble / 25f, rumble / 25f); + } + + Texture2D orbTexture = ModContent.Request("CalamityMod/Projectiles/Magic/VolatileStarcore").Value; + Rectangle frame = orbTexture.Frame(1, 6, 0, starcoreFrame); + Vector2 origin = frame.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float bonusScale = 1; + if (CurrentChargingFrames >= HeliumFlash.FullChargeFrames) + { + bonusScale = MathHelper.Clamp(2 * Utils.GetLerpValue(HeliumFlash.FullChargeFrames * 1.2f, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true), 1, 3); + } + + // Glow Orb + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.OrangeRed with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.5f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true) * randSize * bonusScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.White with { A = 0 } * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true) * 0.75f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.25f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true) * randSize * bonusScale, SpriteEffects.None, 0); + + // Main staff + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + // Starcore + Main.EntitySpriteDraw(orbTexture, GunTipPosition - Main.screenPosition, frame, Color.White, 0, origin, Projectile.scale * 0.5f * Utils.GetLerpValue(0, HeliumFlash.FullChargeFrames, CurrentChargingFrames, true), SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Magic/IncineratingFireball.cs b/Projectiles/Magic/IncineratingFireball.cs new file mode 100644 index 0000000000..7848a49ad0 --- /dev/null +++ b/Projectiles/Magic/IncineratingFireball.cs @@ -0,0 +1,188 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class IncineratingFireball : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public Player Owner => Main.player[Projectile.owner]; + public bool Released = false; + public bool TriggeredBurnOut = false; + public const float StartScale = 0.0004f; + public const float EndScale = 10.25f; + + public ref float Timer => ref Projectile.ai[0]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.alpha = 255; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 60000; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 12; + Projectile.hide = true; + } + + public override void AI() + { + Timer++; + Lighting.AddLight(Projectile.Center, Color.Red.ToVector3() * (Projectile.scale * 0.5f)); + + // This CalamityPlayer variable causes the weapon to be unusable while it's greater than 0. + // Yes, it's getting set every frame as soon as the fireball starts despawning. That's intentional. + // It's the delay for after the fireball despawns, and the burnout visual effects should appear immediately. + if (TriggeredBurnOut) + Owner.Calamity().burningSeaBurnOut = BurningSea.BurnOutReuseDelay; + + bool canUseMana = Owner.CheckMana(Owner.ActiveItem()); + // Use different behavior depending on if the player is channeling or not. + if (Owner.CantUseHoldout() || !canUseMana || Projectile.timeLeft <= 40) + { + Released = true; + + // Time spent fizzling out scales with how long the fireball was charged up. + if (Projectile.timeLeft > BurningSea.FizzleOutTime) + Projectile.timeLeft = (int)MathHelper.Clamp(MathHelper.Lerp(0f, BurningSea.FizzleOutTime, Timer / BurningSea.ChargeTime), 0f, BurningSea.FizzleOutTime); + + // Lose velocity sharply. + Projectile.velocity *= 0.965f; + + // Fizzle out. Once it's small enough, it dies. + Projectile.scale = Utils.Remap(Projectile.timeLeft, 0f, BurningSea.FizzleOutTime, StartScale, EndScale); + Projectile.ExpandHitboxBy((int)(Projectile.scale * 50f)); + } + else if (!Released) + { + // Follow the player's position. + if (Main.myPlayer == Projectile.owner) + { + Vector2 projLocation = Owner.Center; + float mouseDist = Vector2.Distance(Main.MouseWorld, projLocation); + Vector2 mouseDiff = Main.MouseWorld - projLocation; + if (mouseDist > 128f) + { + mouseDiff.Normalize(); + mouseDiff *= 128f; + } + projLocation += mouseDiff; + + Vector2 orbAttemptedVelocity = Vector2.Zero.MoveTowards(projLocation - Projectile.Center, 25f); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, orbAttemptedVelocity, 0.08f); + } + + // Slowly increase in size as the fireball is charged up. + Projectile.scale = Utils.Remap(Timer, 0f, BurningSea.ChargeTime, StartScale, EndScale); + Projectile.ExpandHitboxBy((int)(Projectile.scale * 50f)); + + // Consume mana periodically. + if (Timer % 15 == 0f) + Owner.CheckMana(Owner.ActiveItem(), -1, true); + + // If channeled for a while, turns red (handled in PreDraw) and starts emitting smoke as a warning. + // The smoke only starts once the fireball is completely red. + if (Timer > BurningSea.BurnOutTime - 60f) + { + for (int s = 0; s < 2; s++) + { + Vector2 smokeLocation = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 237f; + Vector2 smokeVel = smokeLocation - Projectile.Center; + smokeVel.Normalize(); + smokeVel *= 5f; + HeavySmokeParticle burningUp = new(smokeLocation, smokeVel, new Color(192, 192, 192), 10, 1f, 0.6f); + GeneralParticleHandler.SpawnParticle(burningUp); + } + } + // Holding it to this point triggers its burn-out mechanic. This has several effects: + // Spawn text, play a sound, immediately cause the fizzle out, inflict Brimstone Flames on the player, and set a long delay to the weapon. + if (Timer > BurningSea.BurnOutTime) + { + Projectile.timeLeft = (int)BurningSea.FizzleOutTime; + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/WeaponEnchant"), Owner.Center); + CombatText.NewText(Owner.Hitbox, new Color(192, 0, 0), CalamityUtils.GetTextValue("Misc.BurningSeaBurn"), true); + + Owner.AddBuff(ModContent.BuffType(), (int)BurningSea.FizzleOutTime); + TriggeredBurnOut = true; + } + } + + AdjustPlayerValues(); + } + + public void AdjustPlayerValues() + { + Projectile.spriteDirection = Projectile.direction = Owner.direction; + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + // Can only deal damage while not fizzling out. + public override bool? CanDamage() => !Released; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundStyle Burn = new SoundStyle("CalamityMod/Sounds/Item/WeldingBurn") with { Volume = 0.25f }; + SoundEngine.PlaySound(Burn, target.Center); + target.AddBuff(ModContent.BuffType(), 180); + + // Whoa buddy no smoking allowed + for (int i = 0; i < 4; i++) + { + Vector2 smokeVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(2.5f, 5f); + HeavySmokeParticle smoke = new(target.Center, smokeVel, Color.Gray, 36, 0.7f, 0.625f, 0f, true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + // We don't want this massive thing obstructing nearby projectiles. + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindProjectiles.Add(index); + } + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D TheodoreJNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise").Value; + Vector2 drawScale = Projectile.Size / TheodoreJNoise.Size() * 1.25f; + float rotation = Main.GlobalTimeWrappedHourly * 4.2f; + + GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); + + // Big fucking fireball + for (int i = 0; i < 6; i++) + { + float direction = (i % 2f == 0f).ToDirectionInt(); + Color fireballColor = Color.Lerp(new Color(255, 200, 200), new Color(255, 30, 30), MathHelper.Clamp(Timer / BurningSea.ChargeTime, 0f, 1f)); + if (Timer > BurningSea.BurnOutTime - 120f) + fireballColor = Color.Lerp(new Color(255, 30, 30), Color.Red, MathHelper.Clamp((Timer - BurningSea.BurnOutTime + 120f) / 60f, 0f, 1f)); + + Main.spriteBatch.Draw(TheodoreJNoise, Projectile.Center - Main.screenPosition, null, fireballColor, direction * rotation, TheodoreJNoise.Size() / 2f, drawScale, SpriteEffects.None, 0f); + } + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index c2292cb1bb..ac9a45264c 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Magic } // Die immediately if the owner of this projectile is clipping into tiles because of its movement. - if (Collision.SolidCollision(Owner.position, Owner.width, Owner.height) && Projectile.velocity != Vector2.Zero) + if (Collision.SolidCollision(Owner.position + Projectile.velocity, Owner.width, Owner.height) && Projectile.velocity != Vector2.Zero) { Owner.velocity.Y = 0f; Explode(); diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 806fdadff5..54d192a1ef 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -1,5 +1,7 @@ using System; +using System.Threading.Channels; using Microsoft.Xna.Framework; +using Steamworks; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -9,11 +11,14 @@ namespace CalamityMod.Projectiles.Magic public class PhantasmalFuryProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public int time = 0; + public float dustRotation = 0; + public bool launched = false; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() @@ -22,13 +27,19 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.timeLeft = 900; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 15; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -38,51 +49,94 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - if (Projectile.timeLeft % 10 == 0) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - if (Projectile.timeLeft < 100) - { - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 10f, 20f); - } + dustRotation += 0.12f; + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.5f); - Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0.25f); - - for (int i = 0; i < 3; i++) - { - int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 2f); - Main.dust[spectre].noGravity = true; - Main.dust[spectre].velocity *= 0.5f; - Main.dust[spectre].velocity += Projectile.velocity * 0.1f; - } + // 175, 100 ALPHA Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + if (time >= 500) + { + if (time == 500) + { + Projectile.penetrate = 1; + launched = true; + } + + NPC target = Projectile.Center.ClosestNPCAt(700); + if (target != null && target.CanBeChasedBy(Projectile)) + { + Vector2 moveTotarget = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 6) + Projectile.velocity += moveTotarget * 0.45f; + else + Projectile.velocity *= 0.9f; + } + + if (time < 550 && target == null) + { + if (Projectile.velocity.Length() < 6) + Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + else + Projectile.velocity *= 0.9f; + } + } + else if (time > 15) + { + Vector2 circle = Owner.Center + new Vector2(0, -30).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToEnemy * Main.rand.NextFloat(0.2f, 0.4f); + else + Projectile.velocity *= 0.85f; + } + + if (time > 5) + { + Vector2 dustPos = Projectile.Center + (MathHelper.Pi + dustRotation + MathHelper.PiOver2).ToRotationVector2() * 10f * Projectile.scale; + Dust dust = Dust.NewDustPerfect(dustPos, 175, (MathHelper.Pi + dustRotation * Math.Sign(Projectile.velocity.Length())).ToRotationVector2() * 2); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust.alpha = Main.rand.Next(100, 170 + 1); + dust.velocity = dust.velocity.RotatedByRandom(0f); + } + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (launched ? 1f : 0.05f); + + Player Owner = Main.player[Projectile.owner]; + if (target.CanBeMoved(true)) + { + // Custom knockback + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 2); + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); - for (int j = 0; j <= 10; j++) + //SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + for (int i = 0; i <= 3; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); - } - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 8; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } + Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 6).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(1.2f, 1.8f)); + dust.noGravity = true; + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 278 : 267); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(1f, 4); + chargefull.scale = Main.rand.NextFloat(0.5f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Color.Aqua, 0.3f); } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 1); + return false; } } diff --git a/Projectiles/Magic/Phantom.cs b/Projectiles/Magic/Phantom.cs index 16f456274e..36b8d0bab3 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,31 +9,121 @@ namespace CalamityMod.Projectiles.Magic public class Phantom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public float sizeVariance = 2; + public int time = 0; + public int spinDir = 100; + public int waveOften = 40; + public float scaleVariance = 1; + + public bool launched = false; public override void SetDefaults() { Projectile.width = 8; Projectile.height = 8; Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 2; + Projectile.extraUpdates = 5; + Projectile.penetrate = -1; Projectile.ignoreWater = true; - Projectile.timeLeft = 120; + Projectile.tileCollide = false; + Projectile.timeLeft = 900; Projectile.DamageType = DamageClass.Magic; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 16 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 30; } public override void AI() { - Projectile.rotation += 0.01f; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); + Projectile.rotation += Main.rand.NextFloat(0.02f, 0.09f); - for (int i = 0; i < 2; i++) + if (spinDir == 100) { - int spectre = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100, default, 1f); - Main.dust[spectre].noGravity = true; + spinDir = Main.rand.NextBool() ? 1 : -1; + waveOften = Main.rand.Next(10, 40 + 1); + Projectile.scale = Main.rand.NextFloat(0.95f, 1.1f); } - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 12f, 20f); + Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * 0.3f); + + if (time % 2 == 0 && time > 3 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-1, 1), -Projectile.velocity * 0.3f, false, 4, 0.025f, Color.Lerp(Color.White, Color.Aqua, 0.3f) * 0.6f, new Vector2(1, 0.3f), true, false, 2); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (time >= 500) + { + if (time == 500) + { + Projectile.penetrate = 1; + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 6; + launched = true; + } + + float badDist = Vector2.Distance(Owner.Calamity().mouseWorld, Projectile.Center); + if (badDist < 30) + { + time = 600; + } + + NPC target = Projectile.Center.ClosestNPCAt(550); + + if (target != null) + { + Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 6) + Projectile.velocity += moveToEnemy * 0.3f; + else + Projectile.velocity *= 0.85f; + } + + if (time < 550 && target == null) + { + if (Projectile.velocity.Length() < 6) + Projectile.velocity += (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.35f; + else + Projectile.velocity *= 0.9f; + } + + if (time % waveOften == 0) + spinDir *= -1; + + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.01f, 0.02f) * spinDir); + } + else if (time > 15) + { + Vector2 circle = Owner.Center + new Vector2(0, -30).RotatedBy(time * 0.05f); + Vector2 moveToEnemy = (circle - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToEnemy * Main.rand.NextFloat(0.2f, 0.4f); + else + Projectile.velocity *= 0.85f; + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= (launched ? 1f : 0.05f); + + Player Owner = Main.player[Projectile.owner]; + if (target.CanBeMoved(true)) + { + // Custom knockback + Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 2); + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 175, (Projectile.velocity * 3).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.3f)); + dust.noGravity = true; + } } } } diff --git a/Projectiles/Magic/RancorArm.cs b/Projectiles/Magic/RancorArm.cs index e9247e6092..2f3c7a281c 100644 --- a/Projectiles/Magic/RancorArm.cs +++ b/Projectiles/Magic/RancorArm.cs @@ -1,9 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -28,7 +29,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = Projectile.height = 4; Projectile.friendly = true; - Projectile.hostile = true; Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic // Decide a frame to use and adjust the hitbox based on it. if (Projectile.localAI[0] == 0f) { - // Play a wraith death sound by default, play a generic flame sound when spawned by gfb Orthoceras + // Play a wraith death sound by default, play a generic flame sound when spawned by GFB Orthoceras SoundStyle sound = Time == 0 ? SoundID.NPCDeath52 : SoundID.Item20; SoundEngine.PlaySound(sound, Projectile.Center); @@ -135,17 +135,6 @@ namespace CalamityMod.Projectiles.Magic behindNPCsAndTiles.Add(index); } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - if (Projectile.friendly) - { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 450f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 375f; - else modifiers.SourceDamage.Flat += 300f; - } - } - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index cc971a645e..caa7e8cfb2 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic // Decide scale and initial rotation on the first frame this projectile exists. if (Projectile.localAI[0] == 0f) { - Projectile.scale = Main.rand.NextFloat(1f, 1.7f); + Projectile.scale = Main.rand.NextFloat(1f, 1.7f) * Projectile.ai[1]; Projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); Projectile.localAI[0] = 1f; } diff --git a/Projectiles/Magic/RancorLargeCinder.cs b/Projectiles/Magic/RancorLargeCinder.cs index 45e9a59036..a27ef75db1 100644 --- a/Projectiles/Magic/RancorLargeCinder.cs +++ b/Projectiles/Magic/RancorLargeCinder.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.friendly = true; - Projectile.hostile = true; Projectile.timeLeft = 300; Projectile.ignoreWater = true; } @@ -49,12 +48,6 @@ namespace CalamityMod.Projectiles.Magic Time++; } - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += Main.rand.Next(80, 90); - } - public override Color? GetAlpha(Color lightColor) => Color.White * Projectile.Opacity; } } diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index b2d907be0d..195f7e0446 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Magic public void CreateTileHitEffects() { Vector2 endOfLaser = Projectile.Center + Projectile.velocity * (LaserLength - Main.rand.NextFloat(12f, 72f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), endOfLaser, Main.rand.NextVector2Circular(4f, 8f), ModContent.ProjectileType(), 0, 0f, Projectile.owner, 0f, 1f); if (Main.rand.NextBool()) { @@ -182,10 +182,7 @@ namespace CalamityMod.Projectiles.Magic overWiresUI.Add(index); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 150); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.Calamity().ashesOnDeath = 10; public override bool ShouldUpdatePosition() => false; } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 098ba4593b..bbd4f3a18e 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -35,13 +35,15 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + // Play a sound upon spawning if (Projectile.ai[0] == 0f) { SoundEngine.PlaySound(BrimstoneElemental.DartSound, Projectile.Center); Projectile.ai[0] = 1f; } - if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < (Projectile.ai[1] == 1f ? 12f : 16f)) + // Accelerate over time + if ((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f) && Projectile.ai[1] != 1f) { Projectile.velocity *= 1.01f; } @@ -57,6 +59,30 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); + + // Seething Discharge darts have weak homing capabilities + if (Projectile.ai[1] == 1f && Projectile.timeLeft < 585) + { + float npcDistCompare = 480f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + if (index != -1) + { + float homingStrength = Main.rand.NextFloat(0.075f, 0.085f); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.npc[index].Center).ToRotation(), homingStrength).ToRotationVector2() * 12f; + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index f43a8400cc..2535e7ee60 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.timeLeft = 255; Projectile.alpha = 0; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs deleted file mode 100644 index 9bf3b72a10..0000000000 --- a/Projectiles/Magic/ShadeNimbus.cs +++ /dev/null @@ -1,92 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ShadeNimbus : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 6; - } - - public override void SetDefaults() - { - Projectile.width = 54; - Projectile.height = 24; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 8) - { - Projectile.frameCounter = 0; - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.type]) - { - Projectile.frame = 0; - } - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 8f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int rainX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int rainY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainX, (float)rainY, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projCount = 0; - int oldestCloud = 0; - float cloudAge = 0f; - int projType = Projectile.type; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) - { - projCount++; - if (proj.ai[1] > cloudAge) - { - oldestCloud = projIndex; - cloudAge = proj.ai[1]; - } - } - } - if (projCount > 2) - { - Main.projectile[oldestCloud].netUpdate = true; - Main.projectile[oldestCloud].ai[1] = 36000f; - return; - } - } - } - } -} diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index da5645ebb2..b4dc9c2450 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Magic public class Shaderain : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Magic/AuraRain"; public override void SetDefaults() { diff --git a/Projectiles/Magic/AuraRain.png b/Projectiles/Magic/Shaderain.png similarity index 100% rename from Projectiles/Magic/AuraRain.png rename to Projectiles/Magic/Shaderain.png diff --git a/Projectiles/Magic/ShadowPlatform.png b/Projectiles/Magic/ShadowPlatform.png new file mode 100644 index 0000000000..1cf9fd563a Binary files /dev/null and b/Projectiles/Magic/ShadowPlatform.png differ diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 333ed9a895..39192a3d4e 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -1,7 +1,13 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using rail; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; +using ReLogic.Content; +using Terraria.Audio; namespace CalamityMod.Projectiles.Magic { @@ -9,65 +15,231 @@ namespace CalamityMod.Projectiles.Magic { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - + public int time = 0; + public float platFade = 0; + public float platRot = 0; + public bool spawnPlat = false; + public bool hasSetPlatSpawn = false; + public bool hasReboundOffPlat = false; + public bool reflecting = false; + public int reflectionTimer = 50; + public Vector2 platPosCenter; + public Vector2 platPosWall; + public NPC chosenTarget; + public Vector2 targetCenter; + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + } public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; - Projectile.penetrate = 6; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 2400; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } - - public override bool OnTileCollide(Vector2 oldVelocity) + public override void AI() { - Projectile.damage = (int)(Projectile.damage * 1.15); - Projectile.penetrate--; - if (Projectile.penetrate <= 0) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + + if (!spawnPlat && !hasReboundOffPlat && targetCenter != Vector2.Zero) + platFade = MathHelper.Lerp(platFade, 1, 0.008f); + if (hasReboundOffPlat) { - Projectile.Kill(); + platFade -= 0.0007f; + } + + BeamMainVisuals(Owner, targetDist); + + if (reflecting) + { + if (reflectionTimer > 15) + platPosCenter += (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * -2.7f * Utils.GetLerpValue(15, 40, reflectionTimer, true); + else + platPosCenter += (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 9f * Utils.GetLerpValue(10, 0, reflectionTimer, true); + + Projectile.extraUpdates = 0; + Projectile.velocity = Vector2.Zero; + Projectile.Center = platPosWall; + reflectionTimer--; + if (reflectionTimer <= 0) + { + SoundStyle bounce = new("CalamityMod/Sounds/Item/ShadowboltReflect"); + SoundEngine.PlaySound(bounce with { Volume = 0.6f, Pitch = 0f }, platPosWall); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.velocity = (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 5; + reflecting = false; + hasReboundOffPlat = true; + time = 10; + Projectile.extraUpdates = 100; + } + } + + if (spawnPlat && hasSetPlatSpawn) + { + chosenTarget = Projectile.Center.ClosestNPCAt(2000); + + if (chosenTarget == null) + targetCenter = Owner.Calamity().mouseWorld; + else + targetCenter = chosenTarget.Center; + + platPosCenter = Projectile.Center + Projectile.velocity * Main.rand.Next(70, 120 + 1); + platRot = (Projectile.Center - platPosCenter).SafeNormalize(Vector2.UnitX).ToRotation(); + platPosWall = platPosCenter + new Vector2(0, 8).RotatedBy(platRot); + spawnPlat = false; + } + if (!spawnPlat && reflecting && targetCenter != Vector2.Zero) + { + if (chosenTarget == null) + targetCenter = Owner.Calamity().mouseWorld; + else + targetCenter = chosenTarget.Center; + + platRot = platRot.AngleLerp((targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX).ToRotation(), 0.1f); + platPosWall = platPosCenter + new Vector2(0, -30).RotatedBy(platRot + MathHelper.ToRadians(90f)); + } + if (!spawnPlat && !hasReboundOffPlat && targetCenter != Vector2.Zero) + { + float beamDist = Vector2.Distance(platPosWall, Projectile.Center); + if (beamDist <= 25 && !reflecting) + { + Particle blastRing = new CustomPulse(platPosWall, Vector2.Zero, Color.Purple, "CalamityMod/Particles/SmallBloomRing", Vector2.One, Main.rand.NextFloat(-10, 10), 0.1f, 1.55f, 20, true); + GeneralParticleHandler.SpawnParticle(blastRing); + + SoundStyle wall = new("CalamityMod/Sounds/Item/ShadowboltWallHit"); + SoundEngine.PlaySound(wall with { Volume = 0.5f, Pitch = 0f }, platPosWall); + reflecting = true; + Projectile.extraUpdates = 0; + } + } + + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && (Collision.SolidCollision(Projectile.Center, 20, 20) || time > 90)) + { + hasSetPlatSpawn = true; + spawnPlat = true; + } + time++; + } + private void BeamMainVisuals(Player Owner, float targetDist) + { + if (reflecting) + { + for (int i = 0; i < 2; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 267); + chargefull.velocity = new Vector2(3, 3).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.8f); + chargefull.scale = Main.rand.NextFloat(0.35f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } else { - if (Projectile.velocity.X != oldVelocity.X) + if (time == 14) { - Projectile.velocity.X = -oldVelocity.X; + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f, 0.75f, 12, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.2f, 0.55f, 12, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + for (int i = 0; i < 6; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.6f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 0.9f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } - if (Projectile.velocity.Y != oldVelocity.Y) + if (targetDist < 1400) { - Projectile.velocity.Y = -oldVelocity.Y; + if (time > 30 && Main.rand.NextBool(15)) + { + Particle spark = new LineParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-1, 1), false, 50, 1.9f, Color.Lerp(Color.Indigo, Color.Purple, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 22 && time % 3 == 0) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * 0.1f, false, 18, 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), Color.Lerp(Color.Indigo, Color.Orchid, 0.25f), new Vector2(0.7f, 1f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 30 && Main.rand.NextBool(12)) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 267); + chargefull.velocity = Projectile.velocity * Main.rand.NextFloat(-2, 2); + chargefull.scale = Main.rand.NextFloat(0.95f, 1.4f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Indigo : Color.Purple, 0.7f); + } } } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (hasReboundOffPlat ? 2.5f : 1) * damageMult; + + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn) + { + spawnPlat = true; + hasSetPlatSpawn = true; + } + //if (!hasReboundOffPlat) + //Projectile.extraUpdates = 10; + } + public override bool? CanDamage() => reflecting ? false : null; + public override bool PreDraw(ref Color lightColor) + { + if (targetCenter != Vector2.Zero && platFade > 0) + { + Texture2D pTexture = ModContent.Request("CalamityMod/Projectiles/Magic/ShadowPlatform").Value; + + for (int i = 0; i < 5; i++) + { + Color auraColor = Color.Lerp(Color.Indigo, Color.Purple, Utils.GetLerpValue(0, 5, i)) with { A = 0 } * 0.55f * platFade; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 30f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition + rotationalDrawOffset, null, auraColor, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f), SpriteEffects.None); + } + + for (int i = 0; i < 4; i++) + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition, null, Color.Purple with { A = 0 } * platFade, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f), SpriteEffects.None); + Main.EntitySpriteDraw(pTexture, platPosCenter - Main.screenPosition, null, Color.White with { A = 0 } * platFade * 0.6f, platRot + MathHelper.ToRadians(90f), pTexture.Size() * 0.5f, new Vector2(1, 0.7f) * 0.93f, SpriteEffects.None); + } + + if (!reflecting && time >= 22 && !hasReboundOffPlat) + { + Asset tex = ModContent.Request("CalamityMod/Particles/GlowSpark"); + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15, null, Color.White with { A = 0 } * 0.7f, Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f), tex.Size() * 0.5f, new Vector2(0.4f, 1f) * (i * 0.3f) * 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), SpriteEffects.None); + } + } + + if (reflecting) + { + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, platPosWall - Main.screenPosition, null, Color.Purple with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.65f * Utils.GetLerpValue(-25, 20, reflectionTimer, true) * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, platPosWall - Main.screenPosition, null, Color.White with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.45f * Utils.GetLerpValue(-25, 20, reflectionTimer, true) * randSize, SpriteEffects.None, 0); + } return false; } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 1.15); - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] > 9f) - { - for (int i = 0; i < 4; i++) - { - Vector2 projPos = Projectile.position; - projPos -= Projectile.velocity * ((float)i * 0.25f); - Projectile.alpha = 255; - int shadowDust = Dust.NewDust(projPos, 1, 1, DustID.ShadowbeamStaff, 0f, 0f, 0, default, 1f); - Main.dust[shadowDust].position = projPos; - Main.dust[shadowDust].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[shadowDust].velocity *= 0.2f; - } - } - } } } diff --git a/Projectiles/Magic/SmallSpirit.cs b/Projectiles/Magic/SmallSpirit.cs index ef1d961c19..495e8611b2 100644 --- a/Projectiles/Magic/SmallSpirit.cs +++ b/Projectiles/Magic/SmallSpirit.cs @@ -61,12 +61,8 @@ namespace CalamityMod.Projectiles.Magic float flySpeed = 8f; float flyInertia = 54f; - Projectile.hostile = true; - Projectile.friendly = false; if (ProjectileOwner != null && (ProjectileOwner.ModProjectile().CurrentPower > 0.97f || Projectile.timeLeft < 95)) { - Projectile.hostile = false; - radius += 36f; target = ProjectileOwner; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index 71f1e234be..2af7ed9e9d 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -140,11 +140,6 @@ namespace CalamityMod.Projectiles.Magic HoverOffset = Vector2.Zero; } - // Previously, Gruesome Eminence stopped being able to hurt you when fully charged. - // This has been changed so that its threat is everpresent. - Projectile.hostile = Time > 75f; - // Projectile.hostile = !tame && Time > 75f; - // Explode into a burst of spirit dust and gas clouds when a bigger face appears. if (!WasStrongBefore && CurrentPower > LargeMouthPowerLowerBound) { @@ -304,22 +299,6 @@ namespace CalamityMod.Projectiles.Magic DrawHead(backTexture, 1.04f); } - // Damage scales up over time as it grows. - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - float damageFactor = 0.25f + 0.75f * CurrentPower; - int fullPowerDamage; - if (Main.masterMode) - fullPowerDamage = 540; - else if (Main.expertMode) - fullPowerDamage = 450; - else - fullPowerDamage = 360; - - modifiers.SourceDamage *= 0f; - modifiers.SourceDamage.Flat += (int)(damageFactor * fullPowerDamage); - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { for (int i = 0; i < Projectile.oldPos.Length; i++) diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index ba7bb2f167..bc5f59087b 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic public override void SendExtraAI(BinaryWriter writer) { writer.Write(damageMultiplier); - writer.Write(damageShouldDecay); writer.Write(decayGracePeriod); + writer.Write(damageShouldDecay); } public override void ReceiveExtraAI(BinaryReader reader) diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 55c7c4f354..0b377eb749 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,38 +16,62 @@ namespace CalamityMod.Projectiles.Magic ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; } - + public int time = 0; + public bool explode = true; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 7; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; } public override void AI() { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45); Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0f); - if (Projectile.wet && !Projectile.lavaWet) - { - Projectile.Kill(); - } + + if (Projectile.timeLeft == 1) + explode = false; if (Projectile.localAI[0] == 0f) { SoundEngine.PlaySound(SoundID.Item73, Projectile.Center); Projectile.localAI[0] += 1f; } - for (int i = 0; i < 3; i++) + if (time == 5) { - int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1.2f); - Main.dust[venusDust].noGravity = true; - Main.dust[venusDust].velocity *= 0.5f; - Main.dust[venusDust].velocity += Projectile.velocity * 0.1f; + for (int i = 0; i < 12; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(0.1f, 1); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.8f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); + } } + if (targetDist < 1400) + { + if (time > 8 && time % 3 == 0) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 35, 0.8f, Color.Lerp(Color.OrangeRed, Color.Coral, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 6 && time % 2 == 0) + { + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.08f * (i == 0 ? 0.5f : 1), Color.Lerp(Color.Orange, Color.Coral, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -56,16 +81,33 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) + Player Owner = Main.player[Projectile.owner]; + if (Projectile.owner == Main.myPlayer && explode) { - int explosionDamage = Projectile.damage; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item74 with { Volume = 0.7f, Pitch = 1f }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Red, Color.Coral, Utils.GetLerpValue(-2, 6, i, true)), i == 5 ? "CalamityMod/Particles/FlameExplosion" : "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.1f + 0.03f * i, (int)(30 - i * 1.3f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 2; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 3f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 1.5f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + } + + int explosionDamage = Projectile.damage / 4; float explosionKB = 6f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, explosionKB, Projectile.owner); - int cinderDamage = (int)(Projectile.damage * 0.20); + int cinderDamage = (int)(Projectile.damage * 0.02); float cinderKB = 0f; - Vector2 cinderPos = Projectile.oldPosition + 0.5f * Projectile.Size; - int numCinders = Main.rand.Next(7, 10); + Vector2 cinderPos = Projectile.Center; + int numCinders = 10; for (int i = 0; i < numCinders; i++) { Vector2 cinderVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); @@ -75,15 +117,24 @@ namespace CalamityMod.Projectiles.Magic } cinderVel.Normalize(); cinderVel *= Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), cinderPos, cinderVel + new Vector2(0, -3), ModContent.ProjectileType(), cinderDamage, cinderKB, Projectile.owner); + } + + for (int i = 0; i < 20; i++) + { + Dust chargefull = Dust.NewDustPerfect(Projectile.Center, 278); + chargefull.velocity = new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 2f); + chargefull.scale = Main.rand.NextFloat(0.65f, 1.25f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); } } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.White, 1); + return true; } } } diff --git a/Projectiles/Magic/VenusianExplosion.cs b/Projectiles/Magic/VenusianExplosion.cs index 199f6ca856..6fdb7c87b8 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -14,65 +14,34 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - Projectile.width = 250; - Projectile.height = 250; + Projectile.width = 400; + Projectile.height = 400; Projectile.friendly = true; Projectile.ignoreWater = false; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 120; + Projectile.timeLeft = 2; Projectile.DamageType = DamageClass.Magic; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 17; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); - if (Projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - Projectile.localAI[0] += 1f; - } - float projTimer = 25f; - if (Projectile.ai[0] > 180f) - { - projTimer -= (Projectile.ai[0] - 180f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rando1 = (float)Main.rand.Next(-30, 31); - float rando2 = (float)Main.rand.Next(-30, 31); - float rando3 = (float)Main.rand.Next(9, 27); - float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2)); - randoAdjuster = rando3 / randoAdjuster; - rando1 *= randoAdjuster; - rando2 *= randoAdjuster; - int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 2.5f); - Dust dust = Main.dust[venusDust]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rando1; - dust.velocity.Y = rando2; - timerCounter++; - } - return; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 300); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index a30274e76a..9d06d4ffea 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -23,10 +23,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 14; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 3; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 120; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -105,7 +106,7 @@ namespace CalamityMod.Projectiles.Magic } //Dust - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(6)) { int venusDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[venusDust]; @@ -114,16 +115,18 @@ namespace CalamityMod.Projectiles.Magic dust.scale += (float)Main.rand.Next(50) * 0.01f; dust.noGravity = true; dust.velocity.Y -= 2f; + dust.velocity += Projectile.velocity * 0.5f; } - if (Main.rand.NextBool(10)) + if (Main.rand.NextBool(14)) { - int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 1f); + int venusDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 278, 0f, 0f, 0, default, Main.rand.NextFloat(0.3f, 0.5f)); Dust dust2 = Main.dust[venusDust2]; dust2.position.X -= 2f; dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; dust2.noGravity = true; dust2.velocity *= 0.1f; + dust2.velocity += Projectile.velocity * 0.5f; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Orange : Color.Coral, 0.7f); } } diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index 692d1cc032..b011911b30 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -1,6 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -12,56 +15,61 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } - public override void SetDefaults() { Projectile.width = 16; Projectile.height = 34; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 4; - Projectile.timeLeft = 300; + Projectile.penetrate = 3; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 90; + Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; } public override void AI() { + Projectile.velocity *= 0.96f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.penetrate == 0) + Projectile.alpha = (int)(255 * Utils.GetLerpValue(70, 0, Projectile.timeLeft, true)); + if (Main.rand.NextBool(3) && Projectile.timeLeft <= 70) { - Projectile.alpha += 4; - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - } + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(8, 8), Main.rand.NextBool(6) ? 215 : (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f) * Utils.GetLerpValue(255, 0, Projectile.alpha); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); } } public override void OnKill(int timeLeft) { - for (int i = 0; i < 10; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, (int)CalamityDusts.SulphurousSeaAcid); - dust.noGravity = true; - } + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; + Asset tex = ModContent.Request(Texture); + + for (int i = 0; i < 3; i++) + { + Color auraColor = Color.Lerp(Color.Chartreuse, Color.Lime, Utils.GetLerpValue(0, 3, i)) * 0.5f; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 27f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 15f) * 0.5f + 0.5f); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor with { A = 0 } * Utils.GetLerpValue(255, 0, Projectile.alpha), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.5f, 2); + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35, targetHitbox); } } diff --git a/Projectiles/Magic/VitriolicViperHoldout.cs b/Projectiles/Magic/VitriolicViperHoldout.cs new file mode 100644 index 0000000000..e969041603 --- /dev/null +++ b/Projectiles/Magic/VitriolicViperHoldout.cs @@ -0,0 +1,237 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + internal class VitriolicViperHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 40f; + public override float BaseOffsetY => 0f; + public override float RecoilResolveSpeed => 0.4f; + public override string Texture => "CalamityMod/Items/Weapons/Magic/VitriolicViper"; + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * -20; + + private ref float CurrentChargingFrames => ref Projectile.ai[0]; + private ref float CurrentOverchargeFrames => ref Projectile.ai[2]; + public int FirstChargeFrames = 30; + public int FullyChargedFrames = 30; + private bool FirstCharge => CurrentChargingFrames >= FirstChargeFrames; + private bool FullCharge => CurrentOverchargeFrames >= FullyChargedFrames; + public SlotId ChargeSlot; + public static float BulletSpeed = 15f; + public int time = 0; + public float chargePower = 0; + public float overchargePower = 0; + public Color bColor = Color.Chartreuse; // Base color + + public float vortexRotation = 0; + + public override void KillHoldoutLogic() + { + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type) + Projectile.Kill(); + } + + public override void HoldoutAI() + { + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying) + ChargeSound.Position = Projectile.Center; + + chargePower = Utils.GetLerpValue(0, FirstChargeFrames, CurrentChargingFrames, true) * (FullCharge ? 1.3f : 1); + if (CurrentOverchargeFrames < FullyChargedFrames) + overchargePower = MathHelper.Clamp(Utils.GetLerpValue(FullyChargedFrames * 2, 0, CurrentOverchargeFrames, true), 0.5f, 1); + else + overchargePower = MathHelper.Lerp(overchargePower, 1, 0.09f); + + vortexRotation += 0.4f * chargePower; + + // Fire if the owner stops channeling or otherwise cannot use the weapon. + if (Owner.CantUseHoldout()) + { + KeepRefreshingLifetime = false; + + if (Projectile.ai[1] != 1f) + { + Projectile.timeLeft = 30; + + ChargeSound?.Stop(); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; + if (FullCharge) + { + OffsetLengthFromArm -= 25; + SoundStyle fire = new("CalamityMod/Sounds/Item/ViperSpit"); + SoundEngine.PlaySound(fire with { Pitch = -0.3f + Main.rand.NextFloat(-0.1f, 0.1f) + (FirstCharge ? 0.2f : 0) }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(fire2 with { Pitch = -0.3f, Volume = 0.5f }, Projectile.Center); + + // Vipers can apparently have 33 teeth or something like that + Owner.Calamity().GeneralScreenShakePower = 4f; + for (int i = 0; i < 33; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (shootVelocity * 2).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 10, Projectile.knockBack, Projectile.owner, 0); + } + + Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, bColor, "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 14); + GeneralParticleHandler.SpawnParticle(pulse); + + for (int i = 0; i < 17; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(5, 25); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.75f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : bColor, 0.7f); + } + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + for (int i = 0; i <= 18; i++) + { + Vector2 sparkVelocity = shootVelocity / 2f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(GunTipPosition, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(GunTipPosition, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + else + { + OffsetLengthFromArm -= 15; + SoundStyle fire = new("CalamityMod/Sounds/Item/ViperSpit"); + SoundEngine.PlaySound(fire with { Pitch = (chargePower * 0.3f) + Main.rand.NextFloat(-0.1f, 0.1f), Volume = 0.5f }, Projectile.Center); + + Projectile hiss = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * MathHelper.Clamp(chargePower, 0.3f, 1), ModContent.ProjectileType(), (int)(Projectile.damage * MathHelper.Clamp(chargePower, 0.3f, 1)), Projectile.knockBack, Projectile.owner, 0, 0, chargePower); + hiss.extraUpdates = (int)(Utils.Remap(chargePower, 0, 1, 2, 13, true)); + for (int i = 0; i < 17; i++) + { + Dust chargefull = Dust.NewDustPerfect(GunTipPosition, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(5, 25); + chargefull.scale = Main.rand.NextFloat(0.55f, 0.75f) * chargePower + 0.1f; + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : bColor, 0.7f); + } + + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f * chargePower, bColor, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + } + Projectile.ai[1] = 1f; + } + } + else + { + if (Projectile.ai[1] != 1f) + { + if (!FirstCharge) + CurrentChargingFrames++; + else + CurrentOverchargeFrames++; + } + + // Charge-up visuals + if (CurrentChargingFrames >= 10) + { + if (FirstCharge) + { + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = GunTipPosition + (i * MathHelper.Pi + vortexRotation * 0.35f + MathHelper.PiOver2).ToRotationVector2() * 20f * chargePower * overchargePower; + Dust dust = Dust.NewDustPerfect(dustPos, (int)CalamityDusts.SulphurousSeaAcid, (i * MathHelper.Pi + vortexRotation * 0.35f * Math.Sign(Projectile.velocity.Length())).ToRotationVector2() * 4); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 0.9f); + } + } + else + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, (int)CalamityDusts.SulphurousSeaAcid, new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f) * chargePower * overchargePower); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.6f, 0.7f); + } + } + + // Full charge effects + if (CurrentChargingFrames == FirstChargeFrames && CurrentOverchargeFrames == 0) + { + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); + for (int i = 0; i < 18; i++) + { + Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(1, 5); + Dust dust2 = Dust.NewDustPerfect(GunTipPosition + dustVel, 278, dustVel * 0.7f); + dust2.scale = Main.rand.NextFloat(0.45f, 0.9f); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? bColor : Color.Green, 0.7f); + } + } + if (CurrentOverchargeFrames == FullyChargedFrames) + { + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0.2f }, Projectile.Center); + for (int i = 0; i < 12; i++) + { + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(2f, 5.5f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.1f); + dust2.noGravity = false; + dust2.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : bColor, 0.7f); + } + } + } + if (Projectile.ai[1] == 1f) + { + CurrentChargingFrames = 0; + CurrentOverchargeFrames = 0; + } + + Lighting.AddLight(GunTipPosition, bColor.ToVector3() * 1.5f * chargePower); + + time++; + } + + public override void OnKill(int timeLeft) + { + if (SoundEngine.TryGetActiveSound(ChargeSlot, out var ChargeSound)) + ChargeSound?.Stop(); + } + + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleVortex").Value; + + // Glow Orb + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.Chartreuse with { A = 0 } * 0.4f, vortexRotation * (i * 0.3f), rechargeTexture.Size() * 0.5f, (0.5f * 0.14f + i * 0.015f) * chargePower * overchargePower, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(rechargeTexture, GunTipPosition - Main.screenPosition, null, Color.White with { A = 0 } * chargePower, vortexRotation, rechargeTexture.Size() * 0.5f, 0.25f * chargePower * 0.14f * overchargePower, SpriteEffects.None, 0); + + // Main staff + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + return false; + } + } +} diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index 5006073273..6e3dae08c5 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -1,6 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,37 +13,75 @@ namespace CalamityMod.Projectiles.Magic public class VitriolicViperSpit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public int direction = 0; public override void SetDefaults() { Projectile.width = 16; Projectile.height = 26; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 13; + Projectile.usesLocalNPCImmunity = true; + Projectile.timeLeft = 300 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 14; i++) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 4.5f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f); + + if (time == 0) { - Dust dust = Dust.NewDustDirect(Projectile.position, 10, 10, DustID.Shadowflame); - dust.noGravity = true; + direction = Main.rand.NextBool() ? 1 : -1; } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } + if (time > 3) + Projectile.Center += offset * direction; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 60); + if (time > 3 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 0.7f), false, true); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool((int)(MathHelper.Clamp((1 - Projectile.ai[2]) * 5, 1, 15)))) + { + int area = (int)(25 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(area, area), (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.7f); + } + } + time++; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 230); + + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.7f }, Projectile.Center); + + for (int i = 0; i < (MathHelper.Clamp(6 - Projectile.numHits * 2, 1, 10)); i++) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(target.Center, Projectile.velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1), Main.rand.NextBool() ? Color.Chartreuse : Color.GreenYellow, new Vector2(1f, 1), 0, Main.rand.NextFloat(0.28f, 0.44f) * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f), 0f, 50); + GeneralParticleHandler.SpawnParticle(pulse); + } + + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 60 * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), targetHitbox); } } diff --git a/Projectiles/Magic/VividExplosion.cs b/Projectiles/Magic/VividExplosion.cs index 141dd92601..2ab46185d6 100644 --- a/Projectiles/Magic/VividExplosion.cs +++ b/Projectiles/Magic/VividExplosion.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 075df64777..d4aa82ba38 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,7 +13,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; private static int Lifetime = 240; private static int NumAnimationFrames = 6; - private static int AnimationFrameTime = 2; + private static int AnimationFrameTime = 1; + public bool explode = true; + public int time = 0; public override void SetStaticDefaults() { @@ -20,28 +23,28 @@ namespace CalamityMod.Projectiles.Magic } public override void SetDefaults() { - Projectile.width = 26; - Projectile.height = 26; + // Actual hitbox is different + Projectile.width = 1; + Projectile.height = 1; Projectile.DamageType = DamageClass.Magic; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 6; Projectile.timeLeft = Lifetime; - Projectile.alpha = 48; } public override void AI() { - // Draw offsets - DrawOffsetX = -10; - DrawOriginOffsetY = -10; - DrawOriginOffsetX = 0; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - // Play sound and set rotation on frame 1 + if (Projectile.timeLeft == 1) // if it doesnt hit a tile or enemy, then don't explode + explode = false; + + // Set rotation on frame 1 if (Projectile.localAI[0] == 0f) { Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.NPCDeath56, Projectile.Center); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; } @@ -51,7 +54,6 @@ namespace CalamityMod.Projectiles.Magic // Lighting and spin Lighting.AddLight(Projectile.Center, 1.8f, 1.6f, 0.5f); - Projectile.rotation += 0.11f; // Increment frame counter Projectile.localAI[0] += 1f; @@ -65,31 +67,35 @@ namespace CalamityMod.Projectiles.Magic } if (Projectile.frame >= NumAnimationFrames) Projectile.frame = 0; + if (targetDist < 1400) + { + if (time > 8 && time % 2 == 0) + { + SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 35, 0.9f, Color.Lerp(Color.Orange, Color.OrangeRed, Main.rand.NextFloat(0, 1))); + GeneralParticleHandler.SpawnParticle(spark); + } + if (time > 6 && time % 2 == 0) + { + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.5f : 1), Color.Lerp(Color.Red, Color.OrangeRed, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + time++; } - private void SpawnDust() { - int coreDustCount = 2; //3 - int coreDustType = 262; - for (int i = 0; i < coreDustCount; ++i) + int trailDustCount = 3; + int trailDustType = 303; + for (int i = 0; i < trailDustCount; i++) { - float scale = Main.rand.NextFloat(1.0f, 1.4f); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, coreDustType); - Main.dust[idx].velocity *= 0.7f; - Main.dust[idx].velocity += Projectile.velocity * 1.4f; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; - } - - int trailDustCount = 4; //5 - int trailDustType = 264; - for (int i = 0; i < trailDustCount; ++i) - { - float scale = Main.rand.NextFloat(1.0f, 1.4f); - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, trailDustType, 0f, 0f); - Main.dust[idx].velocity = Projectile.velocity * 0.8f; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; + float scale = Main.rand.NextFloat(0.7f, 1.1f); + Dust b = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(25, 25), trailDustType, Vector2.Zero, 120); + b.velocity = -Projectile.velocity * Main.rand.NextFloat(0.4f, 0.8f); + b.scale = scale; + b.noGravity = true; } } @@ -112,7 +118,32 @@ namespace CalamityMod.Projectiles.Magic int type = ModContent.ProjectileType(); int damage = (int)(HeliumFlash.ExplosionDamageMultiplier * Projectile.damage); float kb = 9.5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, damage, kb, Projectile.owner, 0f, 0f); + if (explode) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, damage, kb, Projectile.owner, 0f, 0f); + } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D orbTexture = ModContent.Request("CalamityMod/Projectiles/Magic/VolatileStarcore").Value; + Rectangle frame = orbTexture.Frame(1, NumAnimationFrames, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + // Glow Orb + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.OrangeRed with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.6f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * 0.75f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.35f * randSize, SpriteEffects.None, 0); + + + + // Starcore + Main.EntitySpriteDraw(orbTexture, Projectile.Center - Main.screenPosition, frame, Color.White, 0, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); } } diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index 9e78cc627b..69c3d25b70 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 5b3bb7fb7e..7ef7023edc 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -489,7 +489,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(flipped ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type] && Combo == 0f) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type] && Combo == 0f) { for (int i = 1; i < Projectile.oldRot.Length; ++i) { @@ -544,7 +544,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + (drawAngle.ToRotationVector2() * 56f + (drawAngle - MathHelper.PiOver2).ToRotationVector2() * 11 * Owner.direction) * Projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { Texture2D afterimage = Request("CalamityMod/Projectiles/Melee/SunderingScissorsGlow").Value; diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index 6ad36b293e..7afe20cae8 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -308,7 +308,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(Combo == 1 ? sword.Width / 2f : flipped ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { @@ -362,7 +362,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + functionalDrawAngle.ToRotationVector2() * 70f * Projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade float backScissorRotation = drawRotation + (Combo == 1 ? (!flipped ? MathHelper.PiOver4 * 0.75f : MathHelper.PiOver4 * -0.75f) : 0f); - if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 8855fed60a..f2e5c9157d 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -14,13 +14,11 @@ namespace CalamityMod.Projectiles.Melee { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - Projectile.width = 46; - Projectile.height = 36; + Projectile.width = Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; @@ -46,15 +44,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 4) - Projectile.frame = 0; - if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { int npcTracker = (int)Projectile.ai[0]; diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.png b/Projectiles/Melee/BalefulHarvesterProjectile.png index da20d1059b..ed73d2a5f7 100644 Binary files a/Projectiles/Melee/BalefulHarvesterProjectile.png and b/Projectiles/Melee/BalefulHarvesterProjectile.png differ diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs deleted file mode 100644 index 08ab2fec41..0000000000 --- a/Projectiles/Melee/BallOFuguProj.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BallOFuguProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 30; - Projectile.height = 30; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.alpha = 255; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - Vector2 projVector = player.Center - Projectile.Center; - Projectile.rotation = projVector.ToRotation() - MathHelper.PiOver2; - if (player.dead) - { - Projectile.Kill(); - return; - } - player.itemAnimation = 10; - player.itemTime = 10; - if (projVector.X < 0f) - { - player.ChangeDir(1); - Projectile.direction = 1; - } - else - { - player.ChangeDir(-1); - Projectile.direction = -1; - } - player.itemRotation = (projVector * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (projVector.X > 0f) ? -1 : 1; - if (Projectile.ai[0] == 0f && projVector.Length() > 400f) - { - Projectile.ai[0] = 1f; - } - if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) - { - float playerDist = projVector.Length(); - if (playerDist > 1500f) - { - Projectile.Kill(); - return; - } - if (playerDist > 600f) - { - Projectile.ai[0] = 2f; - } - Projectile.tileCollide = false; - float returnSpeed = 20f; - if (Projectile.ai[0] == 2f) - { - returnSpeed = 40f; - } - Projectile.velocity = Vector2.Normalize(projVector) * returnSpeed; - if (projVector.Length() < returnSpeed) - { - Projectile.Kill(); - return; - } - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) - { - Projectile.alpha = 0; - } - if (Projectile.ai[1] % 6f == 0f && Projectile.owner == Main.myPlayer) - { - Vector2 spikeVector = projVector * -1f; - spikeVector.Normalize(); - spikeVector *= (float)Main.rand.Next(45, 65) * 0.1f; - spikeVector = spikeVector.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, spikeVector.X, spikeVector.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/BallOFuguChain").Value; - Vector2 projCenter = Projectile.Center; - Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float projHeight = (float)texture2D2.Height; - Vector2 actualCenter = mountedCenter - projCenter; - float drawRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; - bool isActive = true; - if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) - { - isActive = false; - } - if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) - { - isActive = false; - } - while (isActive) - { - if (actualCenter.Length() < projHeight + 1f) - { - isActive = false; - } - else - { - Vector2 drawCenter = actualCenter; - drawCenter.Normalize(); - projCenter += drawCenter * projHeight; - actualCenter = mountedCenter - projCenter; - Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, drawRotation, origin, 1f, SpriteEffects.None, 0); - } - } - return true; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Poisoned, 180); - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - } -} diff --git a/Projectiles/Melee/BallOFuguProj.png b/Projectiles/Melee/BallOFuguProj.png deleted file mode 100644 index ca90c057a0..0000000000 Binary files a/Projectiles/Melee/BallOFuguProj.png and /dev/null differ diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs new file mode 100644 index 0000000000..7268f58bda --- /dev/null +++ b/Projectiles/Melee/BasherHoldout.cs @@ -0,0 +1,230 @@ +using System; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class BasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/Basher"; + public override float HitboxOutset => 60; + + public override Vector2 HitboxSize => new Vector2(80, 80); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + + public override Vector2 SpriteOrigin => new(-7, 65); + public Vector2 mousePos; + public Vector2 aimVel; + public bool doSwing = true; + public bool postSwing = false; + public float fadeIn = 0; + public int useAnim; + public int swingCount; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + } + public override void OnSpawn(IEntitySource source) + { + Projectile.knockBack = 0; + Projectile.scale = 1; + Projectile.ai[1] = 1; + base.OnSpawn(source); + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnim = Owner.itemAnimationMax; + + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + DrawUnconditionally = false; + + if (CanHit || postSwing) + mousePos = Owner.Center - aimVel; + else + { + mousePos = Owner.Calamity().mouseWorld; + } + + if (CanHit) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + Projectile.numHits = 0; + mousePos = Owner.Calamity().mouseWorld; + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + swingCount++; + } + else + { + if (!CanHit && !postSwing) + { + if (mousePos.X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + else + { + if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1; + else Owner.direction = 1; + } + + + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnim / 3)) + { + aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + Projectile.ai[1] = -Projectile.ai[1]; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + } + else + { + float time = (AnimationProgress) - (useAnim / 3); + float timeMax = useAnim - (useAnim / 3); + + if (time == (int)(timeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.35f, -0.55f) }, Projectile.Center); + } + if ( time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.85f)) + { + CanHit = true; + + Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(10, 90), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + + Dust dust = Dust.NewDustPerfect(particlePos, 79); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.85f, 1.3f); + dust.velocity = -particleVel.RotatedByRandom(0.2f); + } + else + CanHit = false; + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), + 0.2f); + + if (time >= timeMax) + doSwing = false; + if (time < (int)(timeMax * 0.7f)) + postSwing = true; + + if (CanHit) + { + for (int i = 0; i < 2; i++) + { + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(90, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.JungleTorch, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); + dust2.noGravity = true; + } + } + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + Projectile.numHits -= 1; + + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit", 3); + SoundEngine.PlaySound(fire with { Volume = 0.65f, Pitch = -0.2f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DrumTomHigh with { Volume = 0.45f, Pitch = -0.9f }, Projectile.Center); + + target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(BuffID.Poisoned, 90); + + if (target.CanBeMoved(true)) + { + // Launch + Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -12; + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } + if (Owner.Calamity().mouseRight) + { + SoundStyle fire3 = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion"); + SoundEngine.PlaySound(fire3 with { Volume = 0.35f, Pitch = 0.7f }, Projectile.Center); + for (int i = 0; i < MathHelper.Clamp(15 - Projectile.numHits * 3, 2, 15); i++) + { + Dust dust2 = Dust.NewDustPerfect(target.Center, DustID.JungleTorch, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3.5f, 7f)); + dust2.scale = Main.rand.NextFloat(0.65f, 1.35f); + dust2.noGravity = true; + } + Vector2 playerLaunchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * 10; + Owner.velocity = playerLaunchVel; + } + + for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++) + { + Dust dust2 = Dust.NewDustPerfect(target.Center, Main.rand.NextBool(5) ? DustID.JungleTorch : 79, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -20).RotatedByRandom(0.7) * Main.rand.NextFloat(0.1f, 0.7f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.25f); + dust2.noGravity = true; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.3f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + return false; + } + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/BladecrestOathswordProj.cs b/Projectiles/Melee/BladecrestOathswordProj.cs index a7d2d28243..b962bf36c3 100644 --- a/Projectiles/Melee/BladecrestOathswordProj.cs +++ b/Projectiles/Melee/BladecrestOathswordProj.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class BladecrestOathswordProj : BaseIdleHoldoutProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public enum SwingState + public enum SwingState : byte { Default, Swinging @@ -57,14 +57,14 @@ namespace CalamityMod.Projectiles.Melee { writer.Write(Direction); writer.Write(PostSwingRepositionDelay); - writer.Write((int)CurrentState); + writer.Write((byte)CurrentState); } public override void ReceiveExtraAI(BinaryReader reader) { Direction = reader.ReadInt32(); PostSwingRepositionDelay = reader.ReadSingle(); - CurrentState = (SwingState)reader.ReadInt32(); + CurrentState = (SwingState)reader.ReadByte(); } public override void SafeAI() diff --git a/Projectiles/Melee/BloodExplosion.cs b/Projectiles/Melee/BloodExplosion.cs deleted file mode 100644 index 1b0c3b97fa..0000000000 --- a/Projectiles/Melee/BloodExplosion.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class BloodExplosion : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 100; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 5; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - if (Projectile.ai[1] > 0f) - return; - - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int d = 0; d < 4; d++) - { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); - Main.dust[index].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[index].scale = 0.5f; - Main.dust[index].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 6; d++) - { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 2f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity *= 5f; - index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1.5f); - Main.dust[index].velocity *= 2f; - } - Projectile.ai[1]++; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index 8e0c8da37d..eb980cd6f7 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player player = Main.player[Projectile.owner]; - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 60); if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 56788a64b3..14d9f76f4c 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] += 0.01f; Projectile.scale = Projectile.ai[1]; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Projectile.type])) + if (Projectile.ai[0] >= (3 * Main.projFrames[Projectile.type])) { Projectile.Kill(); return; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5f) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5f) / 16)); if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { colorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); @@ -115,16 +115,18 @@ namespace CalamityMod.Projectiles.Melee return new Color(150, Main.DiscoG, 255, 127); }*/ + // Only inflict Voidfrost if not spawned from Icebreaker public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.ai[2] != 1f) + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.ai[2] != 1f) + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } } diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs index 125511774e..842105dfaf 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); Projectile.localAI[1] = 4f; } } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 907fa657ae..326c17d55e 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/DeathsAscensionSwing.cs b/Projectiles/Melee/DeathsAscensionSwing.cs index 46aa29cd7f..23ed40049e 100644 --- a/Projectiles/Melee/DeathsAscensionSwing.cs +++ b/Projectiles/Melee/DeathsAscensionSwing.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -26,6 +27,16 @@ namespace CalamityMod.Projectiles.Melee } public Player Owner => Main.player[Projectile.owner]; + public static Asset glowTexture = null; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + glowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } + } + public override void SetDefaults() { Projectile.width = 159; @@ -45,16 +56,17 @@ namespace CalamityMod.Projectiles.Melee { //Frames and crap Projectile.frameCounter++; - if (Projectile.frameCounter % 3 == 0) + if (Projectile.frameCounter > 2) { CurrentFrame++; if (frameX >= 2) CurrentFrame = 0; - } - if (frameX == 0 && frameY == 3 && Projectile.frameCounter % 3 == 0) - { - SoundEngine.PlaySound(SoundID.Item71, Projectile.position); + if (frameX == 0 && frameY == 3) + { + SoundEngine.PlaySound(SoundID.Item71, Projectile.position); + } + Projectile.frameCounter = 0; } if ((frameX == 0 && frameY >= 3) || (frameX == 1 && frameY <= 1)) @@ -91,6 +103,10 @@ namespace CalamityMod.Projectiles.Melee // Prevents the projectile from dying Projectile.timeLeft = 2; + // Move the player's arm accordingly + bool ownerFacingRight = Owner.direction == 1; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, GetArmRotation() * (ownerFacingRight ? 1 : -1) - MathHelper.PiOver2 + (ownerFacingRight ? 0 : MathHelper.Pi)); + // Player item-based field manipulation. Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); Owner.heldProj = Projectile.whoAmI; @@ -98,6 +114,27 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + // This hurt my soul to do, but because the swing is done with a sprite animation, tracking specific visual rotation of the weapon is nigh impossible + public float GetArmRotation() + { + return (frameX, frameY) switch + { + (0, 0) => -2.12f, + (0, 1) => -2.59f, + (0, 2) => -2.29f, + (0, 3) => -0.97f, + (0, 4) => 0.75f, + (0, 5) => 1.07f, + (1, 0) => 1.4f, + (1, 1) => 1.14f, + (1, 2) => 0.85f, + (1, 3) => 0.4f, + (1, 4) => -0.28f, + (1, 5) => -1.8f, + _ => 0 + }; + } + public void HandleChannelMovement(Vector2 playerRotatedPoint) { Vector2 newVelocity = Vector2.UnitX * (Main.MouseWorld.X > playerRotatedPoint.X).ToDirectionInt(); @@ -111,14 +148,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.frameCounter <= 1) - return false; Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Vector2 position = Projectile.Center - Main.screenPosition + (Projectile.spriteDirection == -1 ? new Vector2(60, 0) : new Vector2(-60, 0)); + Vector2 position = Projectile.Center - Main.screenPosition + (Projectile.spriteDirection == -1 ? new Vector2(60, 0) : new Vector2(-60, 0)) - Projectile.velocity; Vector2 origin = texture.Size() / new Vector2(2f, 6f) * 0.5f; Rectangle frame = texture.Frame(2, 6, frameX, frameY); SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(texture, position, frame, lightColor, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); + Main.EntitySpriteDraw(glowTexture.Value, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Melee/DeathsAscensionSwingGlow.png b/Projectiles/Melee/DeathsAscensionSwingGlow.png new file mode 100644 index 0000000000..a07e528be7 Binary files /dev/null and b/Projectiles/Melee/DeathsAscensionSwingGlow.png differ diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 851b2fc96b..394182dcc3 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,17 +1,13 @@ using System; -using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -23,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; - public override float HitboxOutset => 105; + public override float HitboxOutset => 135; public override Vector2 HitboxSize => new Vector2(255, 255); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); @@ -208,7 +204,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; if (target.CanBeMoved(true)) diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index d71aa2f35e..a1ae925afa 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -1,5 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Potions; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,54 +14,123 @@ namespace CalamityMod.Projectiles.Melee public class EntropicFlechette : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float sizeVariance = 2; + public int time = 60; + public int spinDir = 100; + public int waveOften = 40; + public float scaleVariance = 1; public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 50; + Projectile.height = 50; Projectile.friendly = true; - Projectile.penetrate = 1; + Projectile.penetrate = 5; + Projectile.extraUpdates = 1; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 600; + Projectile.timeLeft = 450; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 rotateVector = new Vector2(6f, 12f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) + Player Owner = Main.player[Projectile.owner]; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (spinDir == 100) { - Projectile.localAI[0] = 0f; + spinDir = Main.rand.NextBool() ? 1 : -1; + waveOften = Main.rand.Next(10, 40 + 1); + scaleVariance = Main.rand.NextFloat(0.65f, 1f); } - else + + if (time % 18 == 0) + sizeVariance = Main.rand.NextFloat(1.5f, 2.5f) * scaleVariance; + Projectile.scale = MathHelper.Lerp(Projectile.scale, sizeVariance, 0.09f); + if (time % 2 == 0 && time > 5) { - for (int i = 0; i < 2; i++) + Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, 6, 0.7f, Color.Black); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(8)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); + dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } + if (time >= 5) + { + if (Projectile.numHits < 1) { - Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); - Main.dust[darkDust].scale = 1f; - Main.dust[darkDust].noGravity = true; - Main.dust[darkDust].position = Projectile.Center + dustRotate; - Main.dust[darkDust].velocity = Projectile.velocity; + NPC target = Projectile.Center.ClosestNPCAt(320); + + if (target == null) + { + Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 14) + Projectile.velocity += moveToMouse * 0.3f; + else + Projectile.velocity *= 0.8f; + + if (time % waveOften == 0) + spinDir *= -1; + + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); + } + else + { + Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 14) + Projectile.velocity += moveToEnemy * 0.8f; + else + Projectile.velocity *= 0.7f; + } + } + else + { + if (time % waveOften == 0) + spinDir *= -1; + + Projectile.velocity = Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.05f, 0.15f) * spinDir * Utils.GetLerpValue(60, 180, time, true)); } } - - int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); - Main.dust[darkestDust].noGravity = true; - Main.dust[darkestDust].velocity *= 0f; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); + if (Projectile.numHits > 0) + Projectile.extraUpdates = 2; + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MeldBurn"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + } + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 9; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.5f, 1.2f); + dust.velocity = Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.3f, 2.1f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + Asset tex = ModContent.Request("CalamityMod/Particles/WaterFlavored"); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.Black, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale * 0.7f, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, new Vector2(0.4f, 1) * Projectile.scale * 0.5f, SpriteEffects.None); return false; } } diff --git a/Projectiles/Melee/EntropicFlechette.png b/Projectiles/Melee/EntropicFlechette.png deleted file mode 100644 index 90aede20e7..0000000000 Binary files a/Projectiles/Melee/EntropicFlechette.png and /dev/null differ diff --git a/Projectiles/Melee/EntropicFlechetteLarge.cs b/Projectiles/Melee/EntropicFlechetteLarge.cs deleted file mode 100644 index b54b35ec53..0000000000 --- a/Projectiles/Melee/EntropicFlechetteLarge.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EntropicFlechetteLarge : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 18; - Projectile.height = 18; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 rotateVector = new Vector2(6f, 12f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) - { - Projectile.localAI[0] = 0f; - } - else - { - for (int i = 0; i < 2; i++) - { - Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); - Main.dust[darkDust].scale = 1f; - Main.dust[darkDust].noGravity = true; - Main.dust[darkDust].position = Projectile.Center + dustRotate; - Main.dust[darkDust].velocity = Projectile.velocity; - } - } - - int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); - Main.dust[darkestDust].noGravity = true; - Main.dust[darkestDust].velocity *= 0f; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - } -} diff --git a/Projectiles/Melee/EntropicFlechetteLarge.png b/Projectiles/Melee/EntropicFlechetteLarge.png deleted file mode 100644 index d2e1ad5ddb..0000000000 Binary files a/Projectiles/Melee/EntropicFlechetteLarge.png and /dev/null differ diff --git a/Projectiles/Melee/EntropicFlechetteSmall.cs b/Projectiles/Melee/EntropicFlechetteSmall.cs deleted file mode 100644 index 1db25a8648..0000000000 --- a/Projectiles/Melee/EntropicFlechetteSmall.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EntropicFlechetteSmall : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Melee; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 rotateVector = new Vector2(6f, 12f); - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) - { - Projectile.localAI[0] = 0f; - } - else - { - for (int i = 0; i < 2; i++) - { - Vector2 dustRotate = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)i * 3.14159274f), default) * rotateVector; - int darkDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.Shadowflame, 0f, 0f, 160, default, 1f); - Main.dust[darkDust].scale = 1f; - Main.dust[darkDust].noGravity = true; - Main.dust[darkDust].position = Projectile.Center + dustRotate; - Main.dust[darkDust].velocity = Projectile.velocity; - } - } - - int darkestDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Shadowflame, 0f, 0f, 100, default, 0.8f); - Main.dust[darkestDust].noGravity = true; - Main.dust[darkestDust].velocity *= 0f; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - } -} diff --git a/Projectiles/Melee/EntropicFlechetteSmall.png b/Projectiles/Melee/EntropicFlechetteSmall.png deleted file mode 100644 index 7930994094..0000000000 Binary files a/Projectiles/Melee/EntropicFlechetteSmall.png and /dev/null differ diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs deleted file mode 100644 index c305f82456..0000000000 --- a/Projectiles/Melee/EutrophicSpark.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class EutrophicSpark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.timeLeft = 30; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int eutrophicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[eutrophicDust]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[eutrophicDust]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[eutrophicDust].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[eutrophicDust].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[eutrophicDust]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool()) - { - int eutrophicDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[eutrophicDust2]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[eutrophicDust2]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[eutrophicDust2].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[eutrophicDust2].noGravity = true; - Main.dust[eutrophicDust2].velocity *= 0.1f; - } - if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index dea78a8c39..3bb96e5877 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -286,7 +286,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffset = Projectile.Center - Main.screenPosition; //Afterimages - if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) + if (CalamityClientConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index 53e5614b03..90739eec1a 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 272, new Vector2(Projectile.velocity.X * 0.4f + velOffset.X, Projectile.velocity.Y * 0.4f + velOffset.Y), 100, default, 0.7f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 272, Projectile.velocity * 0.4f + velOffset, 100, default, 0.7f); dust.noGravity = true; } @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f)); Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation()); - Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 226, new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y), 100, default, 0.7f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 226, Projectile.velocity * 0.5f + velOffset, 100, default, 0.7f); dust.noGravity = true; } } diff --git a/Projectiles/Melee/GalileosMoon.cs b/Projectiles/Melee/GalileosMoon.cs index f330f94964..b9cb04ebe4 100644 --- a/Projectiles/Melee/GalileosMoon.cs +++ b/Projectiles/Melee/GalileosMoon.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index a51dceec4b..bc651357af 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -177,7 +177,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs index 243cf93949..fdfe26c180 100644 --- a/Projectiles/Melee/GayBeam.cs +++ b/Projectiles/Melee/GayBeam.cs @@ -340,7 +340,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = rectangle.Size() / 2f; Color alphaColor = Projectile.GetAlpha(lightColor); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { Vector2 centerOffset = Projectile.Size / 2f; int totalAfterimages = TotalAfterimages; diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 15ac9190c2..146d323354 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -24,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandDad"; public override float HitboxOutset => 125; - public override Vector2 HitboxSize => new Vector2(170, 170); + public override Vector2 HitboxSize => new Vector2(190, 190); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(0, 124); @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (time == (int)(timeMax * 0.4f)) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); - SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.32f) }, Projectile.Center); } if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) { @@ -136,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 165), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); GeneralParticleHandler.SpawnParticle(new LineParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue)); GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.Black : Color.DarkBlue, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f)); } @@ -154,9 +155,21 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.Gold : Color.Goldenrod)); + if (Main.rand.NextBool(4)) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Color.Black, false, false, false)); + else + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue)); + } + for (int i = 0; i < 3; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.95f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.Goldenrod : Color.Gold; } } } @@ -167,7 +180,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); @@ -252,9 +265,9 @@ namespace CalamityMod.Projectiles.Melee float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { - Color auraColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; + Color auraColor = Color.Lerp(Color.Goldenrod, Color.Gold, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/GrandDadGhost").Value; Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 3187cf01d9..08b75853bb 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; public override float HitboxOutset => 105; - public override Vector2 HitboxSize => new Vector2(150, 150); + public override Vector2 HitboxSize => new Vector2(175, 175); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(0, 124); @@ -159,10 +159,10 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; if (target.CanBeMoved(false)) diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index ef2a593aa6..01666d03fd 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -1,11 +1,7 @@ using System; -using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; -using Humanizer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -13,8 +9,6 @@ using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.Graphics.Renderers; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -47,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public bool chargedSwing = false; // True if you have a charged swing fully charged public int chargeTimer = 0; // Timer for charging the blade with right click - public int chargeTimerMax = 240; + public int chargeTimerMax = 240; // This is set to be base don use time on spawn public SlotId AudSlot; public override void SetDefaults() @@ -67,7 +61,8 @@ namespace CalamityMod.Projectiles.Melee aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; storedUseAnim = useAnim; - chargeTimerMax = useAnim * 5; + + chargeTimerMax = useAnim * 5; // Max charge time is set here if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -329,7 +324,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits (which uses Projectile.numHits) - if ((damageDone <= 2 || target.life <= 0) && pierceReduction > 0) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && pierceReduction > 0) { pierceReduction -= 1; } @@ -401,7 +396,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.25f; int hitsToMinMult = 4; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 3.5f * (GFBMulti) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? 4f * (GFBMulti) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index dc2c3c4ba3..162c726b27 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -1,6 +1,11 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,127 +18,179 @@ namespace CalamityMod.Projectiles.Melee { public new string LocalizationCategory => "Projectiles.Melee"; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public int time = 0; + public float fade = 0; + + public int strongTimeMax = 60; + public int strongTimer = 0; + + public bool isPowered = false; + public bool canBePowered = false; + public Vector2 storedVel = Vector2.Zero; + public NPC targetedNPC; + public bool hasHitTarget = false; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 66; + Projectile.height = 70; Projectile.friendly = true; - Projectile.penetrate = 8; - Projectile.alpha = 255; + Projectile.penetrate = -1; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.scale = 1.3f; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20 * Projectile.extraUpdates; - Projectile.tileCollide = true; + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; + Projectile.timeLeft = 600; + Projectile.alpha = 255; + Projectile.tileCollide = false; } public override void AI() { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 25; - } - if (Projectile.alpha < 0) + Projectile.rotation = storedVel.ToRotation() + MathHelper.ToRadians(45f); + + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time > 2) { + if (!canBePowered) + canBePowered = true; Projectile.alpha = 0; + if (fade < 1) + fade += 0.008f; } - if (Projectile.ai[0] == 0f) - { - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 60f) - { - Projectile.velocity.X *= 0.99f; - Projectile.velocity.Y += 0.3f; - if (Projectile.velocity.Y > 16f) - Projectile.velocity.Y = 16f; + if (canBePowered && !isPowered) + { + Projectile.velocity *= 0.975f; + strongTimer++; + if (strongTimer >= strongTimeMax) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/ImpalerLaunch"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + + targetedNPC = Projectile.Center.ClosestNPCAt(1200); + if (targetedNPC != null) + storedVel = (Projectile.Center - targetedNPC.Center).SafeNormalize(Vector2.UnitX) * -30; + Projectile.velocity = storedVel * 1.15f; + Particle pulse2 = new CustomPulse(Projectile.Center - storedVel * 3, -storedVel * 0.1f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), storedVel.ToRotation(), 0f, 0.13f, 25); + GeneralParticleHandler.SpawnParticle(pulse2); + Particle pulse = new CustomPulse(Projectile.Center - storedVel * 3, -storedVel * 0.2f, Color.Chartreuse * 0.7f, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1f), storedVel.ToRotation(), 0f, 0.25f, 25); + GeneralParticleHandler.SpawnParticle(pulse); + Projectile.extraUpdates = 3; + strongTimer = 0; + isPowered = true; } } - - int dustType = 171; - if (Main.rand.NextBool(3)) + if (isPowered) { - dustType = 46; - } - if (Main.rand.NextBool(9)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - if (Projectile.ai[0] == 0f) - { - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - Projectile.rotation += Projectile.spriteDirection * MathHelper.ToRadians(45f); - } - //Sticky Behaviour - Projectile.StickyProjAI(15); - if (Projectile.ai[0] == 2f) - { - Projectile.velocity *= 0f; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(20); - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.ai[0] = 2f; - Projectile.timeLeft = 300; - return false; - } - - public override void OnKill(int timeLeft) - { - int dustType = 171; - if (Main.rand.NextBool(3)) - { - dustType = 46; - } - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 50; - Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.Damage(); - for (int i = 0; i < 15; i++) - { - int deathDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.2f); - Main.dust[deathDust].velocity *= 3f; - if (Main.rand.NextBool()) + if (targetDist < 1400) { - Main.dust[deathDust].scale = 0.5f; - Main.dust[deathDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + if (Main.rand.NextBool(7)) + { + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(30, 30), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 60, Main.rand.NextFloat(0.8f, 1.3f), Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(trail); + } + if (time % 10 == 0) + { + Particle pulse2 = new CustomPulse(Projectile.Center - Projectile.velocity, Projectile.velocity * 0.1f, Color.Chartreuse, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.1f), Projectile.velocity.ToRotation(), 0f, 0.075f, 14); + GeneralParticleHandler.SpawnParticle(pulse2); + } + + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 6, 0.07f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1); + GeneralParticleHandler.SpawnParticle(spark); + } + + targetedNPC = Projectile.Center.ClosestNPCAt(600); + if (targetedNPC != null && !hasHitTarget) + { + Vector2 position = targetedNPC.Center; + Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 23) + Projectile.velocity += moveToMouse * 0.45f; + else + Projectile.velocity *= 0.9f; + } + else if (Projectile.velocity.Length() < 23) + Projectile.velocity *= 1.1f; + } + else if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Main.rand.NextBool(7) ? 28 : 215); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } + if (strongTimer == 0) + { + storedVel = Projectile.velocity; + } + if (Main.rand.NextBool(5)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } + time++; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits < 1) + { + canBePowered = true; + strongTimer = 1; + Particle pulse3 = new GlowSparkParticle(Projectile.Center, storedVel * 1.5f, false, 7, 0.057f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(pulse3); + for (int i = 0; i <= 15; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid, storedVel.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } + if (!isPowered) + { + Projectile.velocity *= -1f; + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/NuclearTerrorHit"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.7f }, Projectile.Center); + SoundStyle fir2e = new("CalamityMod/Sounds/NPCHit/PerfMediumHit2"); + SoundEngine.PlaySound(fir2e with { Volume = 0.65f, Pitch = -0.6f }, Projectile.Center); } } - for (int j = 0; j < 30; j++) - { - int deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1.7f); - Main.dust[deathDust2].noGravity = true; - Main.dust[deathDust2].velocity *= 5f; - deathDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 1f); - Main.dust[deathDust2].velocity *= 2f; - } - } + target.AddBuff(ModContent.BuffType(), 180); + modifiers.SourceDamage *= isPowered ? 1.2f : 1f; + if (targetedNPC != null && target == targetedNPC) + hasHitTarget = true; + } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } + if (time < 7) + return false; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Venom, 60); + Asset tex = ModContent.Request(Texture); + + if (isPowered || canBePowered) + { + for (int i = 0; i < 3; i++) + { + Color auraColor = Color.Lerp(Color.Chartreuse, Color.Lime, Utils.GetLerpValue(0, 3, i)) * 0.7f * fade; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 27f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 15f) * 0.5f + (isPowered ? 1.5f : 4.5f * Utils.GetLerpValue(0, strongTimeMax, strongTimer))); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor with { A = 0 }, storedVel.ToRotation() + MathHelper.ToRadians(45f), tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + + if (!isPowered) + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); + return true; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); } } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 0137b32032..583ad48e1e 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -1,75 +1,119 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class JudgementProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - int whiteLightTimer = 15; - + public override string Texture => "CalamityMod/Projectiles/Melee/JudgementProj"; + public ref float time => ref Projectile.ai[0]; + public float hitboxSize = 10; + public Color mainColor; + public float fade = 1; + public float fadeOut = 1; public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 336; + Projectile.height = 274; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.timeLeft = 90; + Projectile.tileCollide = false; + Projectile.timeLeft = 450; Projectile.DamageType = DamageClass.Melee; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.extraUpdates = 9; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - whiteLightTimer--; - if (whiteLightTimer == 0) + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 137; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 137; + + if (time == 0) { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (Projectile.owner == Main.myPlayer) + Projectile.scale = 0.0875f; + Projectile.velocity *= 0.9f; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (time < 200) + { + Projectile.scale += 0.0026f; + hitboxSize += 0.4525f; + Projectile.velocity *= 0.995f; + // Spawn 3 + if (time % 50 == 0 && time > 10) { - for (i = 0; i < 1; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f); + } + } + else + { + Projectile.velocity *= 0.975f; + } + if (time > 300 && fade > 0) + fade -= 0.0065f; + + if (time < 250 && time > 20) + { + if (time < 200) + { + if (Projectile.timeLeft % 4 == 0) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); - int projectile2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); - Main.projectile[projectile1].velocity.X *= 0.1f; - Main.projectile[projectile1].velocity.Y *= 0.1f; - Main.projectile[projectile2].velocity.X *= 0.1f; - Main.projectile[projectile2].velocity.Y *= 0.1f; + SparkParticle spark = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(185f)), false, 15, 1f, mainColor * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.timeLeft % 4 == 0) + { + SparkParticle spark = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-185f)), false, 15, 1f, mainColor * 0.25f); + GeneralParticleHandler.SpawnParticle(spark); } } - whiteLightTimer = 15; + + if (Main.rand.NextBool(3)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); + trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.noGravity = true; + } + + if (Main.rand.NextBool(12)) + { + GlowOrbParticle orb = new GlowOrbParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GeneralParticleHandler.SpawnParticle(orb); + GlowOrbParticle orb2 = new GlowOrbParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(10f, 30f), false, 17, Main.rand.NextFloat(0.4f, 0.75f), mainColor, true, true); + GeneralParticleHandler.SpawnParticle(orb2); + } } - - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); - - for (int i = 0; i < 2; i++) - { - int shinyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); - Main.dust[shinyDust].noGravity = true; - Main.dust[shinyDust].velocity *= 0.5f; - Main.dust[shinyDust].velocity += Projectile.velocity * 0.1f; - } - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); + fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true); + time++; } - - public override void OnKill(int timeLeft) + public override bool PreDraw(ref Color lightColor) { - SoundEngine.PlaySound(SoundID.Item122, Projectile.position); - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Texture2D tex = ModContent.Request(Texture).Value; + float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade), 1 + (0.45f * waveFade)) * Projectile.scale, SpriteEffects.None, 0); + return false; } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); } } diff --git a/Projectiles/Melee/JudgementProj.png b/Projectiles/Melee/JudgementProj.png new file mode 100644 index 0000000000..983f63e892 Binary files /dev/null and b/Projectiles/Melee/JudgementProj.png differ diff --git a/Projectiles/Melee/MaceFlails/BallOFuguProj.cs b/Projectiles/Melee/MaceFlails/BallOFuguProj.cs new file mode 100644 index 0000000000..afbe2c194e --- /dev/null +++ b/Projectiles/Melee/MaceFlails/BallOFuguProj.cs @@ -0,0 +1,108 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.MaceFlails +{ + public class BallOFuguProj : BaseMaceFlailProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float SpinHitboxRadius => 80f; + public override float SpinVisualRadius => 48f; + public override float LaunchSpeed => 20f; + public override int LaunchLifespan => 20; + public override float MaxDropRange => 640f; + public override float MaxRetractSpeed => 24f; + public override float RetractAcceleration => 3.6f; + + public static float MaxSpikeTime = 180f; + public static float SpikeRate = 10f; + public static float SpikeDamage => 0.6f; + public static float SpikeKnockback => 0.2f; + public static Color SpikeColor => new Color(91, 62, 153); + + public ref float SpikeTimer => ref Projectile.ai[2]; + + public static Asset ChargeGlow; + public override void Load() => ChargeGlow = ModContent.Request("CalamityMod/Particles/LargeBloom"); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 38; + Projectile.ignoreWater = true; + base.SetDefaults(); + } + + public override void SpinAI(float launchSpeed) + { + SpikeTimer++; + + // Play Jellyfish idle sounds as it spins + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Zombie35 with { Pitch = -0.4f, PitchVariance = 0.2f }, Projectile.Center); + Projectile.soundDelay = Main.rand.Next(48, 60); + } + + // Spews spikes while spinning if timer exceeded + // This is slightly random and a bit faster than building up normally + if (Projectile.owner == Main.myPlayer && SpikeTimer > MaxSpikeTime + SpikeRate) + { + Vector2 velocity = Projectile.DirectionFrom(Owner.MountedCenter).SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(4.5f, 6.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner); + SpikeTimer = MaxSpikeTime + Main.rand.Next(5); + } + base.SpinAI(launchSpeed); + } + + public override Action EffectBeforePullback => (proj) => + { + int SpikeCount = (int)(MathHelper.Clamp(SpikeTimer, 0f, MaxSpikeTime) / SpikeRate); + if (SpikeCount > 0) + { + SoundEngine.PlaySound(BallOFugu.BlowSound, Projectile.Center); + Particle BlowParticle = new CustomPulse(Projectile.Center, Vector2.Zero, SpikeColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(0, MathHelper.TwoPi), 0f, 0.05f + 0.005f * SpikeCount, 12); + GeneralParticleHandler.SpawnParticle(BlowParticle); + + for (int i = 0; i < SpikeCount; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 7.2f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner); + } + } + + SpikeTimer = 0f; + Projectile.netUpdate = true; + }; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Poisoned, 180); + + if (CurrentFlailState == FlailState.LaunchingForward) + { + StateTimer = LaunchLifespan; + Projectile.netUpdate = true; + } + } + + public override bool PreDraw(ref Color lightColor) + { + if (SpikeTimer > SpikeRate) + { + float power = Utils.GetLerpValue(0f, MaxSpikeTime, SpikeTimer, true); + Main.EntitySpriteDraw(ChargeGlow.Value, Projectile.Center - Main.screenPosition, null, SpikeColor * (0.6f + 0.12f * power), 0f, ChargeGlow.Size() * 0.5f, 0.1f + 0.05f * power, SpriteEffects.None); + } + return base.PreDraw(ref lightColor); + } + } +} diff --git a/Projectiles/Melee/MaceFlails/BallOFuguProj.png b/Projectiles/Melee/MaceFlails/BallOFuguProj.png new file mode 100644 index 0000000000..9578a2f700 Binary files /dev/null and b/Projectiles/Melee/MaceFlails/BallOFuguProj.png differ diff --git a/Projectiles/Melee/BallOFuguChain.png b/Projectiles/Melee/MaceFlails/BallOFuguProjChain.png similarity index 100% rename from Projectiles/Melee/BallOFuguChain.png rename to Projectiles/Melee/MaceFlails/BallOFuguProjChain.png diff --git a/Projectiles/Melee/MaceFlails/RemsRevengeProj.cs b/Projectiles/Melee/MaceFlails/RemsRevengeProj.cs new file mode 100644 index 0000000000..224fd4eb9d --- /dev/null +++ b/Projectiles/Melee/MaceFlails/RemsRevengeProj.cs @@ -0,0 +1,53 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.MaceFlails +{ + public class RemsRevengeProj : BaseMaceFlailProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override int SpinIFrames => 12; + public override float SpinSpeed => 16f; + public override float SpinHitboxRadius => 96f; + public override float SpinVisualRadius => 64f; + public override int AfterimageLength => 8; + public override float LaunchSpeed => 30f; + public override int LaunchLifespan => 24; + public override float MaxDropRange => 960f; + public override float MaxRetractSpeed => 36f; + public override float RetractAcceleration => 4.5f; + + public ref float LaunchedHitCounter => ref Projectile.ai[2]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 26; + base.SetDefaults(); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 240); + + if (CurrentFlailState != FlailState.Spinning && CurrentFlailState != FlailState.Dropping) + LaunchedHitCounter++; + + // While spinning, the projectile center won't always be where the target is, so it needs to be moved + UpdateDamageKB(out float damageMult, out float kbMult); + if (LaunchedHitCounter <= 5f) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), CurrentFlailState == FlailState.Spinning ? target.Center : Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack * kbMult, Projectile.owner); + if (LaunchedHitCounter >= 4f) + { + CurrentFlailState = FlailState.ForcedRetracting; + StateTimer = 0f; + Projectile.netUpdate = true; + } + } + } +} diff --git a/Projectiles/Melee/RemsRevengeProj.png b/Projectiles/Melee/MaceFlails/RemsRevengeProj.png similarity index 100% rename from Projectiles/Melee/RemsRevengeProj.png rename to Projectiles/Melee/MaceFlails/RemsRevengeProj.png diff --git a/Projectiles/Melee/RemsRevengeChain.png b/Projectiles/Melee/MaceFlails/RemsRevengeProjChain.png similarity index 100% rename from Projectiles/Melee/RemsRevengeChain.png rename to Projectiles/Melee/MaceFlails/RemsRevengeProjChain.png diff --git a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs new file mode 100644 index 0000000000..5941aa2188 --- /dev/null +++ b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs @@ -0,0 +1,127 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; +using ReLogic.Content; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.MaceFlails +{ + public class TumbleweedFlail : BaseMaceFlailProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override int SpinIFrames => 10; + public override float SpinHitboxRadius => MathF.Max(64f, 224f * AuraScale); + public override float SpinVerticalFactor => 1f; // The aura is fully circular, rather than elliptical + public override float SpinVisualRadius => 45f; + public override float LaunchSpeed => 24f; + public override int LaunchLifespan => 20; + public override float MaxDropRange => 640f; + public override float MaxRetractSpeed => 28f; + public override float RetractAcceleration => 4f; + + public static float MaxAuraTime = 60f; + + public ref float AuraScale => ref Projectile.ai[2]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 42; + base.SetDefaults(); + } + + public override void ExtraBehavior() + { + // Randomly play grass sounds idly if it is moving/spinning + if ((CurrentFlailState == FlailState.Spinning || Projectile.velocity.Length() > 2f) && Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Grass with { PitchVariance = 1.2f }, Projectile.Center); + Projectile.soundDelay = Main.rand.Next(12, 15); + } + + if (CurrentFlailState != FlailState.Spinning || Main.rand.NextBool()) + { + Dust sand = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Alpha: 100, Scale: Main.rand.NextFloat(0.6f, 1.2f)); + sand.noGravity = CurrentFlailState == FlailState.Dropping; + sand.velocity = CurrentFlailState == FlailState.Spinning ? Main.rand.NextVector2Unit() * 1.5f : Projectile.velocity * 0.25f; + } + + if (CurrentFlailState == FlailState.Spinning) + { + Projectile.ownerHitCheck = false; // Dust aura can hit through walls + AuraScale = MathHelper.Clamp(AuraScale + 1f / MaxAuraTime, 0f, 1f); + + if (AuraScale < 0.15f) + return; + + // The dust machine + for (int i = 0; i < (int)(10 * AuraScale); i++) + { + Circle dustCircle = new Circle(Owner.MountedCenter, 240f * AuraScale); + Vector2 dustPos = dustCircle.RandomPointInCircle(); + if ((dustPos - Owner.MountedCenter).Length() > 60f * AuraScale) + { + Dust sand = Dust.NewDustPerfect(dustPos, DustID.Sand); + sand.noGravity = true; + sand.fadeIn = Main.rand.NextFloat(0.4f, 1f); + sand.velocity = (dustCircle.Center - dustPos).SafeNormalize(Vector2.Zero).RotatedBy(-MathHelper.PiOver4) * Vector2.Distance(dustCircle.Center, dustPos) * 0.04f; + } + } + } + else + AuraScale = MathHelper.Clamp(AuraScale - 3f / MaxAuraTime, 0f, 1f); + } + + public override bool PreDraw(ref Color lightColor) + { + if (AuraScale > 0f) + { + Texture2D Aura = TextureAssets.Projectile[ModContent.ProjectileType()].Value; + Vector2 position = Owner.MountedCenter - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor) * 0.05f * AuraScale; + for (int i = 0; i < 20; i++) + { + Main.EntitySpriteDraw(Aura, position, null, drawColor, Main.GlobalTimeWrappedHourly * 0.5f + (i * i * 0.03f), Aura.Size() * 0.5f, AuraScale - (i * 0.03f), SpriteEffects.None, 0); + } + } + return base.PreDraw(ref lightColor); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (CurrentFlailState == FlailState.Spinning) + return; + + SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.Center); + for (int i = 0; i < 10; i++) + { + Dust tumbleDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Alpha: 100, Scale: 1.2f); + tumbleDust.velocity *= 3f; + if (Main.rand.NextBool()) + { + tumbleDust.scale = 0.5f; + tumbleDust.fadeIn = Main.rand.NextFloat(1f, 1.1f); + } + + tumbleDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, Alpha: 100, Scale: 1.7f); + tumbleDust.noGravity = true; + tumbleDust.velocity *= 5f; + + tumbleDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, Alpha: 100, Scale: 1f); + tumbleDust.velocity *= 2f; + } + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * LaunchDamage), Projectile.knockBack, Projectile.owner, CurrentFlailState == FlailState.LaunchingForward ? 0f : 1f); + + Projectile.Kill(); + } + } +} diff --git a/Projectiles/Melee/TumbleweedFlail.png b/Projectiles/Melee/MaceFlails/TumbleweedFlail.png similarity index 100% rename from Projectiles/Melee/TumbleweedFlail.png rename to Projectiles/Melee/MaceFlails/TumbleweedFlail.png diff --git a/Projectiles/Melee/TumbleweedChain.png b/Projectiles/Melee/MaceFlails/TumbleweedFlailChain.png similarity index 100% rename from Projectiles/Melee/TumbleweedChain.png rename to Projectiles/Melee/MaceFlails/TumbleweedFlailChain.png diff --git a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs new file mode 100644 index 0000000000..3b78e442ef --- /dev/null +++ b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.BaseProjectiles; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.MaceFlails +{ + public class YateveoBloomMace : BaseMaceFlailProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 30; + base.SetDefaults(); + } + + public override void ExtraBehavior() + { + if (Main.rand.NextBool(3)) + { + int dustType = Main.rand.Next(5); + switch (dustType) + { + case 0: + dustType = 2; + break; + case 1: + dustType = 44; + break; + default: + dustType = 136; + break; + } + Dust spore = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, 0f, 0f); + spore.noGravity = true; + spore.scale = 1.5f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); + } +} diff --git a/Projectiles/Melee/YateveoBloomProj.png b/Projectiles/Melee/MaceFlails/YateveoBloomMace.png similarity index 100% rename from Projectiles/Melee/YateveoBloomProj.png rename to Projectiles/Melee/MaceFlails/YateveoBloomMace.png diff --git a/Projectiles/Melee/YateveoBloomChain.png b/Projectiles/Melee/MaceFlails/YateveoBloomMaceChain.png similarity index 100% rename from Projectiles/Melee/YateveoBloomChain.png rename to Projectiles/Melee/MaceFlails/YateveoBloomMaceChain.png diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 21b0654eca..31ca65eac1 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -1,17 +1,13 @@ using System; -using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -128,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee if (time == (int)(timeMax * 0.4f)) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); - SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.55f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.35f, 0.55f) }, Projectile.Center); } if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) { @@ -153,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold; @@ -167,7 +163,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if ((damageDone <= 2 || target.life <= 0) && Projectile.numHits > 0) + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow"); diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs new file mode 100644 index 0000000000..f73be31680 --- /dev/null +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -0,0 +1,272 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using CalamityMod.Items.BaseItems; +using Terraria.ModLoader; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using CalamityMod.Balancing; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Particles; +using Terraria.DataStructures; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Projectiles.Melee +{ + public class MantisClawHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + bool AnimationCooldown = false; + + float JetDamageMultiplier => 7.5f; + int SlashSpeed => 6; + + int BlastChargeUses => 3; + float SlashTimer = 0; + + public override Vector2 SpriteOrigin => new(0, 20); + + public override int AssignedItemID => ModContent.ItemType(); + + public float ClawOpenness = MathHelper.ToRadians(80); + public float BubbleSize = 0f; + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/MantisClaws"; + public override void ResetStyle() + { + if (AnimationCooldown) + { + if (NumberOfAnimations % 5 <= BlastChargeUses) + { + ClawOpenness = MathHelper.Lerp(ClawOpenness, MathHelper.ToRadians(80f), 0.15f); + + BubbleSize *= 0.85f; + + if (BubbleSize < 0.05f) + { + Projectile.scale -= 0.1f; + + if (Projectile.scale < 0.1f) + Projectile.active = false; + } + } + else + { + Clamp(); + } + Offset = new Vector2(MathHelper.Lerp(0, 12, BubbleSize / 2), 0).RotatedBy(Projectile.rotation); + } + } + + public void Clamp() + { + if (BubbleSize != 0f) + { + Owner.Calamity().mouseWorldListener = true; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(20, 0).RotatedBy(Projectile.rotation), + Owner.DirectionTo(Owner.Calamity().mouseWorld) * 30, ModContent.ProjectileType(), (int)(Projectile.damage * JetDamageMultiplier), 7, Owner.whoAmI); + + for (int i = 0; i < 9; i++) + { + WaterFlavoredParticle waterFlavored = new WaterFlavoredParticle(Owner.Center, new Vector2(Main.rand.NextFloat(15, 25), 0).RotatedBy(Projectile.rotation + MathHelper.ToRadians(Main.rand.NextFloat(-45, 45))), true, 40, Main.rand.NextFloat(0.5f, 1.2f), MantisClawJet.WaterColor); + waterFlavored.AffectedByLight = true; + GeneralParticleHandler.SpawnParticle(waterFlavored); + } + + SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset(-0.5f), Owner.Center); + SoundEngine.PlaySound(SoundID.NPCDeath14.WithPitchOffset(1f), Owner.Center); + + Owner.Calamity().GeneralScreenShakePower = 3f; + + GeneralParticleHandler.SpawnParticle(new MantisPunch(Owner.Center + new Vector2(26, 0).RotatedBy(Projectile.rotation), Projectile.rotation)); + } + + ClawOpenness = MathHelper.ToRadians(80); + BubbleSize = 0f; + } + + public override void UseStyle() + { + if (Owner.altFunctionUse != 2) + { + if (AnimationCooldown) + { + if (!Owner.Calamity().mouseRight) + { + if (Owner.itemAnimation > 0) + { + Projectile.Kill(); + } + DrawUnconditionally = true; + AnimationCooldown = true; + Owner.itemAnimation = 0; + Owner.itemTime = 0; + } + } + + Projectile.scale = 1f; + + DrawUnconditionally = false; + + Owner.Calamity().mouseWorldListener = true; + + { + if (SlashTimer % SlashSpeed == 0) + { + SoundStyle SlashStyle = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe" + (Main.rand.Next(2) + 1).ToString()); + SlashStyle.PitchVariance = 0.3f; + SlashStyle.Volume = 0.7f; + + SoundEngine.PlaySound(SlashStyle.WithPitchOffset(0.2f), Owner.Center); + + Owner.Calamity().mouseWorldListener = true; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Owner.whoAmI).rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); + } + + SlashTimer++; + } + + Owner.direction = Math.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X); + Projectile.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld); + + Projectile.ai[2] = MathHelper.Lerp(Projectile.ai[2], MathHelper.ToRadians(135f * (SlashTimer % (SlashSpeed * 2) < SlashSpeed ? 1 : -1)), 0.2f); + + ArmRotationOffset = MathHelper.ToRadians(-90f) - (Projectile.ai[2]) * Owner.direction; + ArmRotationOffsetBack = MathHelper.ToRadians(-90f) + (Projectile.ai[2]) * Owner.direction; + } + else + { + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1f, 0.15f); + Projectile.scale = MathHelper.Clamp(Projectile.scale, 0f, 1f); + if (Owner.Calamity().mouseRight) + { + Owner.itemAnimation = 3; + + float chargeFactor = (float)(NumberOfAnimations % 5f) / 3f; + + DrawUnconditionally = true; + + ArmRotationOffset = MathHelper.ToRadians(-90f) - (ClawOpenness / 5) * Owner.direction; + ArmRotationOffsetBack = MathHelper.ToRadians(-90f) + (ClawOpenness / 5) * Owner.direction; + if (NumberOfAnimations % 5 > BlastChargeUses) + { + Clamp(); + } + else + { + Owner.Calamity().mouseWorldListener = true; + + Owner.direction = Math.Sign(Owner.Calamity().mouseWorld.X - Owner.Center.X); + Projectile.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld); + + Projectile.ai[0]++; + + if (AnimationProgress == 1) + { + if (NumberOfAnimations % 5 == 0) + { + ClawOpenness = MathHelper.ToRadians(80); + BubbleSize = 0f; + } + + SoundEngine.PlaySound((Main.rand.NextBool(2) ? SoundID.Item85 : SoundID.Item86).WithPitchOffset((float)NumberOfAnimations % 5 / (float)BlastChargeUses), Owner.Center); + + Projectile.ai[1] = MathHelper.Lerp(0.5f, 2f, chargeFactor); + Projectile.ai[2] = MathHelper.Lerp(MathHelper.ToRadians(100f), MathHelper.ToRadians(180f), chargeFactor); + } + + BubbleSize = MathHelper.Lerp(BubbleSize, Projectile.ai[1], 0.2f); + ClawOpenness = MathHelper.Lerp(ClawOpenness, Projectile.ai[2], 0.2f); + } + + Offset = new Vector2(MathHelper.Lerp(0, 12, BubbleSize / 2), 0).RotatedBy(Projectile.rotation); + } + else + { + if (Owner.controlUseItem) + { + Projectile.Kill(); + } + DrawUnconditionally = true; + AnimationCooldown = true; + Owner.itemAnimation = 0; + Owner.itemTime = 0; + } + } + } + public override bool PreDraw(ref Color lightColor) + { + { + FlipAsSword = false; + float rot = 0f; + if (Owner.altFunctionUse != 2 && !AnimationCooldown) + { + rot = Projectile.ai[2]; + if (Owner.direction == -1) + { + FlipAsSword = true; + + RotationOffset = MathHelper.ToRadians(-90f); + + Owner.compositeFrontArm.rotation -= RotationOffset; + Owner.compositeBackArm.rotation -= RotationOffset; + } + } + else + { + RotationOffset = 0f; + } + + // Bubble texture drawing + + Asset Bubble = ModContent.Request("CalamityMod/Particles/Bubble"); + + Main.EntitySpriteDraw(Bubble.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY) + new Vector2(20, 0).RotatedBy(Projectile.rotation + RotationOffset), Bubble.Frame(), lightColor, 0f, Bubble.Size() / 2, BubbleSize, SpriteEffects.None); + + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if (Owner.itemAnimation > 0 || DrawUnconditionally) + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? 0f : MathHelper.ToRadians(90); + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation - ClawOpenness + rot + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + if (Owner.itemAnimation > 0 || DrawUnconditionally) + { + + if (Owner.altFunctionUse == 2 || AnimationCooldown) + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? 0f : MathHelper.ToRadians(90); + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + ClawOpenness + RotationOffset + r, !FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.None : SpriteEffects.FlipHorizontally)); + } + else + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? 0f : MathHelper.ToRadians(90); + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation - ClawOpenness - rot + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } + } + } + + return false; + } + + // The holdout cannot deal damage. + public override bool? CanDamage() => false; + + public override void OnSpawn(IEntitySource source) => Projectile.scale = 0f; + } +} diff --git a/Projectiles/Melee/MantisClawJet.cs b/Projectiles/Melee/MantisClawJet.cs new file mode 100644 index 0000000000..d2142f8676 --- /dev/null +++ b/Projectiles/Melee/MantisClawJet.cs @@ -0,0 +1,127 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using CalamityMod.Items.BaseItems; +using Terraria.ModLoader; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using CalamityMod.Balancing; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Particles; +using Terraria.DataStructures; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Projectiles.Melee +{ + public class MantisClawJet : ModProjectile, ILocalizedModType + { + int TimerCap = 70; + + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Particles/ThunderBolt"; + + public static Color WaterColor = new Color(114, 197, 255, 0); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.timeLeft = TimerCap; + Projectile.knockBack = 2; + Projectile.tileCollide = false; + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 5; + Projectile.DamageType = DamageClass.Melee; + Projectile.ai[1] = 40; + } + + int dir = 1; + + public override void OnSpawn(IEntitySource source) + { + Projectile.ai[1] = 40; + } + + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + + } + + public override void AI() + { + Projectile.velocity *= 0.97f; + + if (Projectile.ai[0] < 16) Projectile.ai[1] -= 2; + + Projectile.ai[0]++; + } + + public override bool? CanDamage() + { + return true; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player owner = Main.player[Projectile.owner]; + if (Main.rand.Next(100) < owner.GetWeaponCrit(owner.ActiveItem()) + 20) + modifiers.SetCrit(); + } + + public override bool PreDraw(ref Color lightColor) + { + for (int i = 0; i < 6; i++) + { + float ii = ((float)i) / 6f; + Vector2 position = Vector2.Lerp(Projectile.position, Projectile.oldPos[5], ii); + + float Prog = MathHelper.Lerp(3, 1, (float)Projectile.timeLeft / (float)TimerCap); + + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f) * Prog, 411); + bubble.timeLeft = 8 + Main.rand.Next(6); + bubble.scale = Main.rand.NextFloat(0.6f, 1f) * (1 + Prog * 0.4f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + + for (int i = 0; i < 3; i++) + { + float ii = ((float)i) / 3f; + Vector2 position = Vector2.Lerp(Projectile.position, Projectile.oldPos[5], ii); + + float Prog = MathHelper.Lerp(3, 10, (float)Projectile.timeLeft / (float)TimerCap); + + GeneralParticleHandler.SpawnParticle(new WaterFoamParticle(position, Projectile.velocity * 0.4f, 10 - (i * 2), Prog, WaterColor)); + } + + Asset tex = ModContent.Request(Texture); + + List positions = new(); + + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + positions.Add(Projectile.oldPos[i]); + } + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request(Texture)); + + PrimitiveRenderer.RenderTrail(positions, new PrimitiveSettings(AA => { return Projectile.ai[1]; }, CC => { return Lighting.GetColor(Vector2.Lerp(Projectile.oldPos[Projectile.oldPos.Length - 1], Projectile.position, CC).ToPoint()).MultiplyRGBA(WaterColor); }, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); + + return false; + } + } +} diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs new file mode 100644 index 0000000000..db79a3a927 --- /dev/null +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -0,0 +1,113 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using CalamityMod.Items.BaseItems; +using Terraria.ModLoader; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using CalamityMod.Balancing; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Melee; +using System; +using CalamityMod.Particles; +using Terraria.DataStructures; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Projectiles.Melee +{ + public class MantisClawSlash : ModProjectile, ILocalizedModType + { + public int TimerCap => 20; + + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Particles/SlashSmear"; + + Color startColor; + Color endColor; + + public override void SetDefaults() + { + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 60; + Projectile.timeLeft = TimerCap; + Projectile.knockBack = 2; + Projectile.tileCollide = false; + Projectile.width = 256; + Projectile.height = 256; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Melee; + } + + int dir = 1; + + public override void OnSpawn(IEntitySource source) + { + Projectile.scale = 0f; + Projectile.ai[2] = Main.rand.NextFloat(0.5f, 1.25f); + + if (Main.rand.NextBool(2)) dir = -1; + + // i cherry picked five specific colors to make a similar but different palette to the claws themselves + // of those five, the projectile lerps between two, randomly chosen when the projectile is spawned + List ColorList = + [ + new Color(248, 197, 58), + new Color(143, 208, 50), + new Color(69, 114, 227), + new Color(212, 128, 187), + new Color(255, 140, 82), + ]; + + startColor = ColorList[Main.rand.Next(ColorList.Count)]; + endColor = ColorList[Main.rand.Next(ColorList.Count)]; + } + + public override void ModifyDamageHitbox(ref Rectangle hitbox) + { + hitbox = new Rectangle((int)Projectile.Center.X - 65, (int)Projectile.Center.Y - 65, 130, 130); + } + + public override void AI() + { + Projectile.velocity *= 0.9f; + + if (Projectile.timeLeft > (TimerCap / 2)) + { + Projectile.scale = MathHelper.Lerp(Projectile.scale, Projectile.ai[2], 0.1f); + } + else + { + Projectile.scale = MathHelper.Lerp(Projectile.scale, Projectile.ai[2], -0.1f); + } + + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f) * dir); + + Projectile.ai[1]++; + + Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], MathHelper.TwoPi * dir, 0.15f); + } + + public override bool? CanDamage() + { + return true; + } + + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + + for (float i = 0; i < 1; i += 0.33f) + { + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.Lerp(startColor, endColor, Projectile.ai[1] / TimerCap).MultiplyRGBA(new Color(255, 255, 255, 0f)), + Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Projectile.scale, dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); + } + + return false; + } + } +} diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 10dbf2ddde..719e2b7024 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffset = Projectile.Center - Main.screenPosition; //Afterimages - if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) + if (CalamityClientConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/OldLordClaymoreProj.cs b/Projectiles/Melee/OldLordClaymoreProj.cs index e28a4fe8d1..2ad7609cef 100644 --- a/Projectiles/Melee/OldLordClaymoreProj.cs +++ b/Projectiles/Melee/OldLordClaymoreProj.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class OldLordClaymoreProj : BaseIdleHoldoutProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public enum SwingState + public enum SwingState : byte { Default, Swinging, @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee writer.Write(Direction); writer.Write(PostSwingRepositionDelay); writer.Write(ChargePower); - writer.Write((int)CurrentState); + writer.Write((byte)CurrentState); } public override void ReceiveExtraAI(BinaryReader reader) @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee Direction = reader.ReadInt32(); PostSwingRepositionDelay = reader.ReadSingle(); ChargePower = reader.ReadSingle(); - CurrentState = (SwingState)reader.ReadInt32(); + CurrentState = (SwingState)reader.ReadByte(); } public override void SafeAI() diff --git a/Projectiles/Melee/OrderbringerAura.cs b/Projectiles/Melee/OrderbringerAura.cs deleted file mode 100644 index bdc5e8c106..0000000000 --- a/Projectiles/Melee/OrderbringerAura.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OrderbringerAura : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 2; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 1200; - } - - public override void AI() - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 12f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int randOrbXOffset = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int randOrbYOffset = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)randOrbXOffset, (float)randOrbYOffset, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projTimer = 0; - int incTracker = 0; - float aiTracker = 0f; - int theProjectile = Projectile.type; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner == Projectile.owner && p.type == theProjectile && p.ai[1] < 3600f) - { - projTimer++; - if (p.ai[1] > aiTracker) - { - incTracker = p.whoAmI; - aiTracker = p.ai[1]; - } - } - } - if (projTimer > 1) - { - Main.projectile[incTracker].netUpdate = true; - Main.projectile[incTracker].ai[1] = 36000f; - } - } - } - } -} diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index 72feafc6e6..0e1d762941 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -10,121 +12,62 @@ namespace CalamityMod.Projectiles.Melee public class OrderbringerBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/OrderbringerBeam"; private int whiteLightTimer = 5; + public int time = 0; + public Color mainColor = Color.White; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; } public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.extraUpdates = 3; + Projectile.width = 100; + Projectile.height = 100; + Projectile.tileCollide = false; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.penetrate = -1; + Projectile.extraUpdates = 6; + Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { + if (time == 0) + { + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Projectile.ai[1] == 0f) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.timeLeft % 3 == 0 && targetDist < 1400f) { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item60, Projectile.position); + Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3, -Projectile.velocity * 0.05f, false, 17, 1.5f, mainColor * 0.7f); + GeneralParticleHandler.SpawnParticle(spark); } - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 30; - if (Projectile.alpha >= 250) - { - Projectile.alpha = 255; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 30; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); - - whiteLightTimer--; - if (whiteLightTimer == 0) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (Projectile.owner == Main.myPlayer) - { - for (i = 0; i < 1; 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) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - whiteLightTimer = 5; - } - - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.6f); - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].velocity *= 0.5f; - Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; - - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 10f, 20f); + time++; } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); - } - public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 115) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Lerp(mainColor, Color.White, 0.3f) with { A = 0 }, 1, null, true, true); return false; } - public override void OnKill(int timeLeft) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); - for (int i = 0; i < 2; i++) + target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits < 1) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[dust].noGravity = true; - } - for (int j = 0; j < 20; j++) - { - int deathRainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); - Main.dust[deathRainbow].noGravity = true; - Main.dust[deathRainbow].velocity *= 3f; - deathRainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.5f); - Main.dust[deathRainbow].velocity *= 2f; - Main.dust[deathRainbow].noGravity = true; - } - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Particle orb = new GlowSparkParticle(target.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY), false, 12, 0.07f, mainColor, new Vector2(1.5f, 0.8f), true); + GeneralParticleHandler.SpawnParticle(orb); } } } diff --git a/Projectiles/Melee/OrderbringerBeam.png b/Projectiles/Melee/OrderbringerBeam.png index 615ff62268..48b2f67cde 100644 Binary files a/Projectiles/Melee/OrderbringerBeam.png and b/Projectiles/Melee/OrderbringerBeam.png differ diff --git a/Projectiles/Melee/OrderbringerRain.cs b/Projectiles/Melee/OrderbringerRain.cs deleted file mode 100644 index 690b46cd4b..0000000000 --- a/Projectiles/Melee/OrderbringerRain.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OrderbringerRain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 2; - Projectile.penetrate = 2; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 180; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item125, Projectile.Center); - } - - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); - - for (int i = 0; i < 2; i++) - { - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].velocity *= 0.5f; - Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; - } - - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); - } - } -} diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs new file mode 100644 index 0000000000..2a396cb395 --- /dev/null +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -0,0 +1,127 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using CalamityMod.Particles; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework.Graphics; +using System.ComponentModel; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Melee +{ + public class OrderbringerWaveProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/JudgementProj"; + public ref float time => ref Projectile.ai[0]; + public float hitboxSize = 10; + public Color mainColor; + public float fade = 1; + public float damageMult = 1; + public float fadeOut = 1; + public override void SetDefaults() + { + Projectile.width = 336; + Projectile.height = 274; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 450; + Projectile.DamageType = DamageClass.Melee; + Projectile.extraUpdates = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 157; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 157; + + if (time == 0) + { + Projectile.scale = 0.0875f; + Projectile.velocity *= 0.9f; + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + } + + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (time < 200) + { + Projectile.scale += 0.0026f; + hitboxSize += 0.4525f; + Projectile.velocity *= 0.995f; + + if (time % 50 == 0 && time > 10) + { + //Projectile stars = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f); + //stars.penetrate = 1; + } + } + else + { + Projectile.velocity *= 0.975f; + } + if (time > 300 && fade > 0) + fade -= 0.0065f; + + if (time < 250 && time > 20) + { + if (Main.rand.NextBool(3)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); + trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.noGravity = true; + } + + if (time % 9 == 0) + { + Particle orb = new GlowSparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new GlowSparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(orb2); + } + if (Main.rand.NextBool(12)) + { + Particle orb3 = new SparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + GeneralParticleHandler.SpawnParticle(orb3); + Particle orb4 = new SparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)) * Main.rand.NextFloat(5f, 20f), false, 15, Main.rand.NextFloat(0.8f, 1.35f), mainColor); + GeneralParticleHandler.SpawnParticle(orb4); + } + } + + fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true); + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + + float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); + for (int i = 1; i < 6; i++) // Weird for loop because of squash code + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (i * 0.2f * waveFade), 1 + (i * 0.35f * waveFade)) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + if (damageMult < 1.3f && damageDone > 2) + damageMult += 0.325f; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // Deal more damage on pierce + modifiers.SourceDamage *= damageMult; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox); + } +} diff --git a/Projectiles/Melee/OrderbringerWhiteOrb.cs b/Projectiles/Melee/OrderbringerWhiteOrb.cs deleted file mode 100644 index 10f687be16..0000000000 --- a/Projectiles/Melee/OrderbringerWhiteOrb.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class OrderbringerWhiteOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.extraUpdates = 2; - Projectile.penetrate = 1; - Projectile.ignoreWater = true; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 200f, (float)Main.DiscoG / 200f, (float)Main.DiscoB / 200f); - for (int i = 0; i < 2; i++) - { - int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f); - Main.dust[rainbow].noGravity = true; - Main.dust[rainbow].velocity *= 0.5f; - Main.dust[rainbow].velocity += Projectile.velocity * 0.1f; - } - } - } -} diff --git a/Projectiles/Melee/RemsRevengeExplosion.cs b/Projectiles/Melee/RemsRevengeExplosion.cs new file mode 100644 index 0000000000..3d1c9452c0 --- /dev/null +++ b/Projectiles/Melee/RemsRevengeExplosion.cs @@ -0,0 +1,47 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class RemsRevengeExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 80; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 5; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Projectile.ai[1] > 0f) + return; + + // Makeshift metal-blood explosion sound that is good enough ig + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); + for (int p = 0; p < 10; p++) + { + Vector2 velocity = (-Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(75f)) * Main.rand.NextFloat(4f, 6f); + float scale = Main.rand.NextFloat(0.6f, 2f); + Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(blood); + } + Projectile.ai[1]++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + } +} diff --git a/Projectiles/Melee/RemsRevengeProj.cs b/Projectiles/Melee/RemsRevengeProj.cs deleted file mode 100644 index 4adb4f9c7b..0000000000 --- a/Projectiles/Melee/RemsRevengeProj.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RemsRevengeProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - private int hitCounter = 0; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 26; - Projectile.height = 26; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.alpha = 255; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; - Projectile.extraUpdates = 1; - Projectile.scale = 2f; - Projectile.tileCollide = false; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - Vector2 projVector = player.Center - Projectile.Center; - Projectile.rotation = projVector.ToRotation() - MathHelper.PiOver2; - if (player.dead) - { - Projectile.Kill(); - return; - } - player.itemAnimation = 10; - player.itemTime = 10; - if (projVector.X < 0f) - { - player.ChangeDir(1); - Projectile.direction = 1; - } - else - { - player.ChangeDir(-1); - Projectile.direction = -1; - } - player.itemRotation = (projVector * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (projVector.X > 0f) ? -1 : 1; - if (Projectile.ai[0] == 0f && projVector.Length() > 850f) - { - Projectile.ai[0] = 1f; - } - if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) - { - Projectile.extraUpdates = 2; - float playerDist = projVector.Length(); - if (playerDist > 1500f) - { - Projectile.Kill(); - return; - } - if (playerDist > 1000f) - { - Projectile.ai[0] = 2f; - } - Projectile.tileCollide = false; - float returnSpeed = 15f; - if (Projectile.ai[0] == 2f) - { - returnSpeed = 30f; - } - Projectile.velocity = Vector2.Normalize(projVector) * returnSpeed; - if (projVector.Length() < returnSpeed) - { - Projectile.Kill(); - return; - } - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) - { - Projectile.alpha = 0; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Texture2D chainTexture = ModContent.Request("CalamityMod/Projectiles/Melee/RemsRevengeChain").Value; - Vector2 projCenter = Projectile.Center; - Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)chainTexture.Width * 0.5f, (float)chainTexture.Height * 0.5f); - float chainHeight = (float)chainTexture.Height; - Vector2 realCenter = mountedCenter - projCenter; - float rotation = (float)Math.Atan2((double)realCenter.Y, (double)realCenter.X) - MathHelper.PiOver2; - bool canDraw = true; - if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) - { - canDraw = false; - } - if (float.IsNaN(realCenter.X) && float.IsNaN(realCenter.Y)) - { - canDraw = false; - } - while (canDraw) - { - if (realCenter.Length() < chainHeight + 1f) - { - canDraw = false; - } - else - { - Vector2 centerDir = realCenter; - centerDir.Normalize(); - projCenter += centerDir * chainHeight; - realCenter = mountedCenter - projCenter; - Color color = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); - Main.spriteBatch.Draw(chainTexture, projCenter - Main.screenPosition, sourceRectangle, color, rotation, origin, 1f, SpriteEffects.None, 0); - } - } - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 240); - hitCounter++; - if (hitCounter < 6) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); - if (hitCounter > 3) - { - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - } - } -} diff --git a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs index bf94ea1dc1..2843ec3b4a 100644 --- a/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs +++ b/Projectiles/Melee/Shortswords/GalileoGladiusProj.cs @@ -63,13 +63,13 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); SpawnMeteor(Main.player[Projectile.owner]); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); SpawnMeteor(Main.player[Projectile.owner]); } diff --git a/Projectiles/Melee/Shortswords/ElementalShivProj.cs b/Projectiles/Melee/Shortswords/StarburstShivProj.cs similarity index 91% rename from Projectiles/Melee/Shortswords/ElementalShivProj.cs rename to Projectiles/Melee/Shortswords/StarburstShivProj.cs index 7be4025f5c..52e9409cfd 100644 --- a/Projectiles/Melee/Shortswords/ElementalShivProj.cs +++ b/Projectiles/Melee/Shortswords/StarburstShivProj.cs @@ -10,10 +10,10 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Shortswords { - public class ElementalShivProj : BaseShortswordProjectile + public class StarburstShivProj : BaseShortswordProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Melee/ElementalShiv"; + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/StarburstShiv"; public override void SetDefaults() { @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords public override Action EffectBeforePullback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); }; public override void SetVisualOffsets() diff --git a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs index d14369a186..20871afe34 100644 --- a/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs +++ b/Projectiles/Melee/Shortswords/SubmarineShockerProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -48,16 +49,15 @@ namespace CalamityMod.Projectiles.Melee.Shortswords Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - var source = Projectile.GetSource_FromThis(); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Main.myPlayer); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnSparks(target); - public override void OnHitPlayer(Player target, Player.HurtInfo info) + public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnSparks(target); + + public void SpawnSparks(Entity target) { var source = Projectile.GetSource_FromThis(); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Main.myPlayer); + Projectile spark = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7f), Projectile.knockBack, Main.myPlayer); + spark.DamageType = DamageClass.Melee; } } } diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs deleted file mode 100644 index 682e49ad7d..0000000000 --- a/Projectiles/Melee/Spark.cs +++ /dev/null @@ -1,93 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class Spark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 5; - Projectile.timeLeft = 60; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; - Projectile.DamageType = DamageClass.Melee; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void AI() - { - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; - } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[sparky]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[sparky]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparky].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[sparky]; - expr_89E7_cp_0.velocity.Y -= 2f; - if (Main.rand.NextBool()) - { - int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[sparkier]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[sparkier]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[sparkier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparkier].noGravity = true; - Main.dust[sparkier].velocity *= 0.1f; - } - if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Melee/Spears/NadirSpear.cs b/Projectiles/Melee/Spears/NadirSpear.cs index 51c1f30f62..672789f03f 100644 --- a/Projectiles/Melee/Spears/NadirSpear.cs +++ b/Projectiles/Melee/Spears/NadirSpear.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -70,5 +71,6 @@ namespace CalamityMod.Projectiles.Melee.Spears Main.dust[idx].velocity = Vector2.Zero; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/StarburstBeam.cs similarity index 93% rename from Projectiles/Melee/ElementBallShiv.cs rename to Projectiles/Melee/StarburstBeam.cs index 0a114c1225..33eb2304d6 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/StarburstBeam.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class ElementBallShiv : ModProjectile, ILocalizedModType + public class StarburstBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override void SetDefaults() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.owner == Main.myPlayer) { - CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 20f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, false, 50f); + CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, x > 2, 800f, 800f, 0f, 800f, 20f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, false, 50f); } } } diff --git a/Projectiles/Melee/ElementBallShiv.png b/Projectiles/Melee/StarburstBeam.png similarity index 100% rename from Projectiles/Melee/ElementBallShiv.png rename to Projectiles/Melee/StarburstBeam.png diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/StarburstSHIV.cs similarity index 96% rename from Projectiles/Melee/SHIV.cs rename to Projectiles/Melee/StarburstSHIV.cs index 5fc14d89be..47059fd832 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/StarburstSHIV.cs @@ -4,7 +4,7 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class SHIV : ModProjectile, ILocalizedModType + public class StarburstSHIV : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override void SetStaticDefaults() diff --git a/Projectiles/Melee/SHIV.png b/Projectiles/Melee/StarburstSHIV.png similarity index 100% rename from Projectiles/Melee/SHIV.png rename to Projectiles/Melee/StarburstSHIV.png diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs new file mode 100644 index 0000000000..4fac88070f --- /dev/null +++ b/Projectiles/Melee/StarofJudgement.cs @@ -0,0 +1,124 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using CalamityMod.Particles; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using System; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Melee +{ + public class StarofJudgement : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Melee/StarofJudgement"; + public ref float time => ref Projectile.ai[0]; + public Color mainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20; + } + + public override void AI() + { + if (time == 0) + { + Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); + mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + if (Projectile.ai[2] == 1) + { + Projectile.localNPCHitCooldown = 7; + Projectile.penetrate = 4; + } + } + Projectile.rotation += (Projectile.velocity.X + MathF.Abs(Projectile.velocity.Y) * Projectile.direction) * 0.01f; + + if (Projectile.ai[2] == 1) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); + if (Main.rand.NextBool(4) && Projectile.numHits < 1) + { + Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(7, 7) - Projectile.velocity, -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f), false, 13, 1f, mainColor * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + else if (time > 15) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 700f * (Projectile.numHits > 1 ? 2 : 1), 20, 20f * (Projectile.numHits > 1 ? 5 : 1)); + if (Main.rand.NextBool(3)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); + trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.noGravity = true; + } + } + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/StarofJudgement").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Color.Lerp(mainColor, Color.White, 0.2f) with { A = 0 }; + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor * 0.5f, 1, texture, true, true); + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int buffType = Projectile.ai[2] == 1f ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffType, 60); + + if (Projectile.ai[2] == 0) + { + Projectile.timeLeft = 180; + time = 0; + Projectile.velocity *= 1.2f; + } + } + public override void OnKill(int timeLeft) + { + if (Projectile.ai[2] == 1) + { + int points = 5; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f).RotatedByRandom(100)); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new PointParticle((Projectile.Center + velocity * 7.5f), velocity * 5.5f, false, 9, 1.2f, mainColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + else + { + for (int k = 0; k < 3; k++) + { + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(4, 4).RotatedByRandom(100f) * Main.rand.NextFloat(0.3f, 0.8f), false, 15, Main.rand.NextFloat(0.6f, 0.95f), mainColor); + GeneralParticleHandler.SpawnParticle(orb); + } + } + } + } +} diff --git a/Projectiles/Melee/StarofJudgement.png b/Projectiles/Melee/StarofJudgement.png new file mode 100644 index 0000000000..d11469686b Binary files /dev/null and b/Projectiles/Melee/StarofJudgement.png differ diff --git a/Projectiles/Melee/TriactisHammerEcho.png b/Projectiles/Melee/TriactisHammerEcho.png new file mode 100644 index 0000000000..82b8f21a72 Binary files /dev/null and b/Projectiles/Melee/TriactisHammerEcho.png differ diff --git a/Projectiles/Melee/TriactisHammerExplosion.cs b/Projectiles/Melee/TriactisHammerExplosion.cs new file mode 100644 index 0000000000..af160569b0 --- /dev/null +++ b/Projectiles/Melee/TriactisHammerExplosion.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TriactisHammerExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + + public List> crackTrails = new List>(); + public static int crackCount = 15; + public static int totalPoints = 12; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + if (Timer == 0f) + { + float rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + Particle blastR = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(1f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation, 0f, 0.8f, 30); + GeneralParticleHandler.SpawnParticle(blastR); + Particle blastG = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(2f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation + MathHelper.ToRadians(120f), 0f, 0.6f, 27); + GeneralParticleHandler.SpawnParticle(blastG); + Particle blastB = new CustomPulse(Projectile.Center, Vector2.Zero, TriactisHammerFlare.GetColor(3f) * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, rotation + MathHelper.ToRadians(240f), 0f, 0.4f, 24); + GeneralParticleHandler.SpawnParticle(blastB); + Owner.Calamity().GeneralScreenShakePower = 40; + } + + if (Timer % 4f == 0f) + { + crackTrails.Clear(); + for (int i = 0; i < crackCount; i++) + { + List points = new List(); + for (int j = 0; j < totalPoints; j++) + { + float radians = MathHelper.TwoPi / crackCount; + if (j == 0) + points.Add(Projectile.Center + Main.rand.NextVector2Circular(30, 30)); + else + { + Vector2 newPoint = new Vector2(); + Vector2 jtolookfor = j > 1 ? points[j - 2] : Projectile.Center; + float baseDist = j == totalPoints - 1 ? 20 : Main.rand.Next(60, 120) * (1 + (20 - Projectile.timeLeft) / 15); + newPoint = points[j - 1] + (jtolookfor.DirectionTo(points[j - 1]) * baseDist).RotatedByRandom(MathHelper.PiOver2); + points.Add(newPoint); + } + } + crackTrails.Add(points); + } + } + Timer++; + + for (int l = 0; l < 3; l++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(18f, 60f), true, 15, Main.rand.NextFloat(0.02f, 0.05f), TriactisHammerFlare.GetColor(1f + Main.rand.Next(3)), new Vector2(3f, 1f), true); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 640f, targetHitbox); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + + internal float WidthFunction(float completionRatio) => MathHelper.Clamp(CalamityUtils.Convert01To010(completionRatio * 2), 0.2f, 1f) * 4f; + internal Color ColorFunction(float completionRatio) => Color.White; + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 2f; + internal Color BackgroundColorFunction(float completionRatio) => ColorFunction(completionRatio) * 0.5f; + + public override bool PreDraw(ref Color lightColor) + { + if (crackTrails.Count <= 0) + return false; + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); + foreach (List points in crackTrails) + { + PrimitiveRenderer.RenderTrail(points, new(WidthFunction, ColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 60); + PrimitiveRenderer.RenderTrail(points, new(BackgroundWidthFunction, BackgroundColorFunction, smoothen: false, shader: GameShaders.Misc["CalamityMod:TeslaTrail"]), 60); + } + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Melee/TriactisHammerFlare.cs b/Projectiles/Melee/TriactisHammerFlare.cs new file mode 100644 index 0000000000..e12aebdd45 --- /dev/null +++ b/Projectiles/Melee/TriactisHammerFlare.cs @@ -0,0 +1,153 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TriactisHammerFlare : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/ExtraTextures/TinyGreyscaleCircle"; + + public ref float FlareType => ref Projectile.ai[0]; + public ref float Target => ref Projectile.ai[1]; + public ref float OrbitRadius => ref Projectile.ai[2]; // Repurposed for target once transformed + public Player Owner => Main.player[Projectile.owner]; + + public static Asset Sparkle; + public static Asset Bloom; + public override void Load() + { + Sparkle = ModContent.Request("CalamityMod/Particles/Sparkle"); + Bloom = ModContent.Request("CalamityMod/Particles/BloomCircle"); + } + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 16; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Melee; + } + + public override void AI() + { + if (Owner.dead || !Owner.active) + { + Projectile.Kill(); + return; + } + + Projectile.timeLeft = 2; + float rotation = Main.GlobalTimeWrappedHourly * 2f + MathHelper.ToRadians(120f) * FlareType; + + // Transform into smashy hammers + if (Target == -2f) + { + Projectile hammer = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, FlareType, OrbitRadius); + hammer.scale = 0f; + Projectile.Kill(); + return; + } + // Orbit around the player + else if (!Main.npc.IndexInRange((int)Target)) + Projectile.Center = Owner.MountedCenter + Vector2.UnitX.RotatedBy(rotation) * 96f; + // Orbit around the enemies + else + { + NPC enemy = Main.npc[(int)Target]; + // Relocate to the player and spawn teleporting particles if said target cannot be stuck on + if (enemy is null || enemy.life <= 0 || !enemy.active || enemy.dontTakeDamage || enemy.immortal) + { + Target = -1f; + Projectile.netUpdate = true; + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 10f); + Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, GetColor(FlareType), 1f, 24, 0.1f, 2.4f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + return; + } + + OrbitRadius = MathHelper.Clamp(MathF.Max(enemy.width, enemy.height) + 64f, 64f, 400f); + Projectile.Center = enemy.Center + Vector2.UnitX.RotatedBy(rotation) * OrbitRadius; + } + + // Dust trail + if (Main.rand.NextBool(3)) + { + Dust trail = Dust.QuickDust(Projectile.Center, GetColor(FlareType)); + trail.position += Main.rand.NextVector2Unit() * Main.rand.NextFloat(0f, 8f); + } + } + + // Hue-shifted version of the base colours + public static Color GetColor(float type) + { + if (type == 3f) + { + Vector3 blue = Main.rgbToHsl(new Color(117, 170, 239)); + return Main.hslToRgb(blue.X + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), blue.Y, blue.Z); + } + if (type == 2f) + { + Vector3 green = Main.rgbToHsl(new Color(132, 225, 26)); + return Main.hslToRgb(green.X + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), green.Y, green.Z); + } + Vector3 red = Main.rgbToHsl(Color.Red); + return Main.hslToRgb(red.X + 0.05f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f), red.Y, red.Z); + } + + public override Color? GetAlpha(Color lightColor) => GetColor(FlareType); + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + + Texture2D sparkleTex = Sparkle.Value; + Texture2D bloomTex = Bloom.Value; + float bloomScale = (float)sparkleTex.Height / (float)bloomTex.Height; + float sparkleScale = 0.7f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f; + + Color color = Projectile.GetAlpha(lightColor); + float rotation = Main.GlobalTimeWrappedHourly * 8f; + Vector2 drawPos = Projectile.Center - Main.screenPosition; + + Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None); + Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None); + + Texture2D texture = TextureAssets.Projectile[Type].Value; + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float completionRatio = i / (float)Projectile.oldPos.Length; + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + + // The further the smaller + Color trailColor = Color.Lerp(color, Color.Black, completionRatio); + float trailScale = MathHelper.Lerp(0.15f, 1f, 1f - completionRatio); + Main.EntitySpriteDraw(texture, trailPos, null, trailColor, 0f, texture.Size() * 0.5f, Projectile.scale * trailScale, SpriteEffects.None); + } + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index 37c79c6c07..f615dfd4bb 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -1,6 +1,9 @@ -using System; -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,153 +14,305 @@ namespace CalamityMod.Projectiles.Melee public class TriactisHammerProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight"; + + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.6f }; + public static readonly SoundStyle HitSoundGFB = new("CalamityMod/Sounds/Item/CalamityBell"); + public static readonly SoundStyle WindUpSound = new("CalamityMod/Sounds/Item/GalaxySmasherClone") { Volume = 0.9f }; + public static readonly SoundStyle SmashSound = new("CalamityMod/Sounds/Item/GalaxySmasherSmash") { Volume = 0.7f }; + public static readonly SoundStyle SmashSoundGFB = new("CalamityMod/Sounds/Item/TF2PanHit"); + + public static float ExplosionDamageKBMult = 2f; + public static float SuperHammerDamageMult = 4f; + public static float SmashHomingRange = 800f; // 50 tiles + public static float WindUpTime = 216f; // 1.2 seconds + public static float ConvergeTime = 18f; // 0.1 seconds + + public ref float AirTime => ref Projectile.ai[0]; + public ref float HammerState => ref Projectile.ai[1]; // R, G, B, Center + public ref float SmashTarget => ref Projectile.ai[2]; + public Player Owner => Main.player[Projectile.owner]; + public float OrbitRadius; + + public static Asset EchoHammer; + public override void Load() => EchoHammer = ModContent.Request("CalamityMod/Projectiles/Melee/TriactisHammerEcho"); public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + ProjectileID.Sets.TrailingMode[Projectile.type] = 1; } public override void SetDefaults() { - Projectile.width = 160; - Projectile.height = 160; + Projectile.width = Projectile.height = 168; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - Lighting.AddLight(Projectile.Center, 0f, 0.5f, 0.75f); - if (Projectile.soundDelay == 0) + // Smashing hammers + if (HammerState > 0f) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } - if (Projectile.ai[0] == 0f) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 30f) + // Central spot (invisible) + if (HammerState == 4f) { - Projectile.ai[0] = 1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; + // Target should already be set -- if not, retarget + NPC target = Main.npc[(int)SmashTarget]; + if (target is null || target.life <= 0 || !target.active || target.dontTakeDamage || target.immortal) + { + target = Projectile.Center.ClosestNPCAt(SmashHomingRange, bossPriority: true); + if (target != null) + SmashTarget = target.whoAmI; + } + + // Strongly locks onto the target center + // If there is no target, it would just rest there + if (target != null) + Projectile.Center = target.Center; + + // Explode when told to + if (AirTime == -1f) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * ExplosionDamageKBMult), Projectile.knockBack * ExplosionDamageKBMult, Projectile.owner); + SoundEngine.PlaySound(Main.zenithWorld ? SmashSoundGFB : SmashSound, Projectile.Center); + Projectile.Kill(); + return; + } + } + // Orbital RGB hammers + else + { + // Need the central spot to exist or they explode immediately + float rotation = Main.GlobalTimeWrappedHourly * 2f + MathHelper.ToRadians(120f) * HammerState; + Color currentColor = TriactisHammerFlare.GetColor(HammerState); + Projectile target = Main.projectile[(int)SmashTarget]; + if (target is null || !target.active) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, currentColor, Vector2.One, 0f, 0.2f, 4f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + Projectile.Kill(); + return; + } + + // Initialize orbit radius + if (AirTime == 0f) + OrbitRadius = MathHelper.Clamp(Vector2.Distance(Projectile.Center, target.Center), 64f, 400f); + + // Move outwards for a bit + AirTime++; + if (AirTime < WindUpTime) + { + OrbitRadius = MathHelper.Lerp(OrbitRadius, 800f, 0.04f); + Projectile.Center = target.Center + Vector2.UnitX.RotatedBy(rotation) * OrbitRadius; + Projectile.rotation = Projectile.AngleFrom(target.Center) + MathHelper.PiOver4; + // Scales up to full size after a short portion of the animation time + Projectile.scale = Utils.GetLerpValue(0f, WindUpTime * 0.1f, AirTime, true); + + if (AirTime == 1f) + { + for (int i = 0; i < 6; i++) + { + Vector2 velocity = Vector2.UnitX.RotatedBy(rotation).RotatedByRandom(MathHelper.ToRadians(36f)) * Main.rand.NextFloat(10f, 30f); + float scale = Main.rand.NextFloat(0.8f, 1.5f); + Particle sparkle = new CritSpark(Projectile.Center, velocity, Color.White, currentColor, 1f * scale, 24, 0.1f, 2.5f * scale); + GeneralParticleHandler.SpawnParticle(sparkle); + } + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, currentColor, Vector2.One, 0f, 0.1f, 0.8f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + } + + if (OrbitRadius > 792f) + { + Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.6f, 1f), Main.rand.NextVector2Unit() * Main.rand.NextFloat(160f, 320f), 0f, currentColor, Projectile.GetAlpha(Color.White), Main.rand.Next(10, 20), Projectile.Center); + GeneralParticleHandler.SpawnParticle(streak); + if (AirTime % 18f == 0f) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.GetAlpha(Color.White), Vector2.One, 0f, 0.2f, 2.5f, 12); + GeneralParticleHandler.SpawnParticle(pulse); + } + } + } + // Then converge at the middle where the central spot is + else + { + OrbitRadius = MathHelper.Lerp(800f, 0f, (AirTime - WindUpTime) / ConvergeTime); + Projectile.Center = target.Center + Vector2.UnitX.RotatedBy(rotation) * OrbitRadius; + Projectile.rotation = Projectile.AngleTo(target.Center) + MathHelper.PiOver4; + + // Trigger the central spot to explode which then causes these hammers to explode too + if (Projectile.Hitbox.Intersects(target.Hitbox) || AirTime > WindUpTime + ConvergeTime) + target.ai[0] = -1f; + } } } + // Normal hammers + else if (HammerState == 0f) + { + AirTime++; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4 + Projectile.direction * MathHelper.ToRadians(2f) * AirTime; + Projectile.velocity.X *= 0.99f; + + if (Projectile.velocity.Y < 20f) + Projectile.velocity.Y += 0.2f; + + // Dust trail + Dust trail = Dust.NewDustPerfect(Projectile.Center, DustID.GoldFlame, Projectile.velocity * 0.3f); + trail.position += Main.rand.NextVector2Unit() * Main.rand.NextFloat(0f, 64f); + trail.noGravity = true; + + // Prevent the projectile from wreacking too much havoc off-screen + if (Vector2.Distance(Projectile.Center, Owner.MountedCenter) >= 2000f) + Projectile.Kill(); + } + // Returning hammers else { - Projectile.tileCollide = false; - float projVelModifier = 5f; - Vector2 projDirection = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f); - float projXDist = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - projDirection.X; - float projYDist = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - projDirection.Y; - float projDistance = (float)Math.Sqrt(projXDist * projXDist + projYDist * projYDist); - if (projDistance > 3000f) - Projectile.Kill(); - projDistance = 20f / projDistance; - projXDist *= projDistance; - projYDist *= projDistance; - if (Projectile.velocity.X < projXDist) + // Slows down a little + if (AirTime < 30f) { - Projectile.velocity.X = Projectile.velocity.X + projVelModifier; - if (Projectile.velocity.X < 0f && projXDist > 0f) - Projectile.velocity.X = Projectile.velocity.X + projVelModifier; + AirTime++; + Projectile.velocity *= 0.9f; + float idealRotation = Projectile.AngleTo(Owner.MountedCenter) + MathHelper.PiOver4; + Projectile.rotation = MathHelper.Lerp(Projectile.rotation, idealRotation, AirTime / 30f); } - else if (Projectile.velocity.X > projXDist) + // Then return to the player + else { - Projectile.velocity.X = Projectile.velocity.X - projVelModifier; - if (Projectile.velocity.X > 0f && projXDist < 0f) - Projectile.velocity.X = Projectile.velocity.X - projVelModifier; - } - if (Projectile.velocity.Y < projYDist) - { - Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; - if (Projectile.velocity.Y < 0f && projYDist > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + projVelModifier; - } - else if (Projectile.velocity.Y > projYDist) - { - Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; - if (Projectile.velocity.Y > 0f && projYDist < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - projVelModifier; - } - if (Main.myPlayer == Projectile.owner) - { - Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height); - Rectangle playerArea = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height); - if (rectangle.Intersects(playerArea)) + Projectile.rotation = Projectile.AngleTo(Owner.MountedCenter) + MathHelper.PiOver4; + Projectile.velocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * 25f; + if (Projectile.Hitbox.Intersects(Owner.Hitbox) || Vector2.Distance(Projectile.Center, Owner.MountedCenter) >= 2000f) Projectile.Kill(); } + + // (Slightly less) dust trail + if (!Main.rand.NextBool(4)) + { + Dust trail = Dust.NewDustPerfect(Projectile.Center, DustID.GoldFlame, Projectile.velocity * 0.2f); + trail.position += Main.rand.NextVector2Unit() * Main.rand.NextFloat(0f, 64f); + trail.noGravity = true; + } } - Projectile.rotation += 0.5f; } public override Color? GetAlpha(Color lightColor) { - return new Color(250, 250, 250, 50); + switch (HammerState) + { + case 1f: + return Color.Red; + case 2f: + return new Color(132, 225, 26); + case 3f: + return new Color(117, 170, 239); + } + return Color.White; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 40; i++) - { - int triactisDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[triactisDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[triactisDust].scale = 0.5f; - Main.dust[triactisDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 70; j++) - { - int triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); - Main.dust[triactisDust2].noGravity = true; - Main.dust[triactisDust2].velocity *= 5f; - triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[triactisDust2].velocity *= 2f; - } - } + if (Projectile.numHits > 0 || HammerState > 0f) + return; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 40; i++) + int FlareCount = Owner.ownedProjectileCounts[ModContent.ProjectileType()] + 1; + + if (Main.zenithWorld) + SoundEngine.PlaySound(HitSoundGFB with { Pitch = FlareCount * 0.15f - 0.15f }, Projectile.Center); + else + SoundEngine.PlaySound(HitSound with { Pitch = FlareCount * 0.15f - 0.15f }, Projectile.Center); + + // Simple on-hit dust ring on all normal hits + for (int i = 0; i < 32; i++) { - int triactisDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[triactisDust].velocity *= 3f; - if (Main.rand.NextBool()) + Vector2 velocity = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * i / 32f) * (8f + 2f * FlareCount) * (i % 2 == 0 ? 1.2f : 1f); + Dust ring = Dust.NewDustPerfect(Projectile.Center, DustID.GoldFlame, velocity); + ring.noGravity = true; + ring.noLight = true; + ring.scale = (i % 2 == 0 ? 1.6f : 2.4f) * (0.7f + 0.3f * FlareCount); + } + + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == Owner.whoAmI) { - Main.dust[triactisDust].scale = 0.5f; - Main.dust[triactisDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + // Update target of orbit to the most recently hit one + // Create telporting particles if this happens to be a different target + if (p.ai[1] != target.whoAmI) + { + p.ai[1] = target.whoAmI; + for (int i = 0; i < 5; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 10f); + Particle sparkle = new CritSpark(p.Center, velocity, Color.White, TriactisHammerFlare.GetColor(p.ai[0]), 1f, 24, 0.1f, 2.4f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + + // Set the flares up to transform themselves if ready + if (FlareCount > 3) + { + p.ai[1] = -2f; + p.ai[2] = Projectile.whoAmI; + } + p.netUpdate = true; } } - for (int j = 0; j < 70; j++) + + // Change state and turn invisible + if (FlareCount > 3) { - int triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 3f); - Main.dust[triactisDust2].noGravity = true; - Main.dust[triactisDust2].velocity *= 5f; - triactisDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? 89 : 229, 0f, 0f, 100, default, 2f); - Main.dust[triactisDust2].velocity *= 2f; + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Gold, Color.White, 0.5f), Vector2.One, 0f, 0.2f, 2.5f, 24); + GeneralParticleHandler.SpawnParticle(pulse); + SoundEngine.PlaySound(WindUpSound, Projectile.Center); + HammerState = 4f; + SmashTarget = target.whoAmI; + Projectile.velocity = Vector2.Zero; + Projectile.ExpandHitboxBy(4); + Projectile.netUpdate = true; + } + else + { + // Spawn flares and set to return to player + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * SuperHammerDamageMult), 0f, Projectile.owner, FlareCount, target.whoAmI); + HammerState = -1f; + Projectile.netUpdate = true; } } public override bool PreDraw(ref Color lightColor) { + if (HammerState == 4f) + return false; + + if (HammerState > 0f) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D echoTex = EchoHammer.Value; + Main.EntitySpriteDraw(echoTex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, echoTex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return false; + } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + + // Echo Hammers can only hit when they converge + public override bool? CanDamage() + { + if (HammerState == 4f) + return false; + + if (HammerState > 0f && AirTime < WindUpTime) + return false; + return base.CanDamage(); + } } } diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index e3b784cf55..dbf5921c89 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? sword.Width : 0f, sword.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - if (CalamityConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) + if (CalamityClientConfig.Instance.Afterimages && Timer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 672b2c4a28..2c3099f71d 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -161,7 +161,13 @@ namespace CalamityMod.Projectiles.Melee //Chunger var Sound = SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Volume = CommonCalamitySounds.LightningSound.Volume * 0.4f }, Projectile.Center); - Particle thunder = new ThunderBoltVFX(Projectile.Center + Vector2.UnitY * 20f, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 0f, 1.5f, Vector2.One, 1f, 15f, Projectile, 20f); + Particle thunder = new ThunderBoltVFX( + () => Projectile.Center + Vector2.UnitY * 20f, + 0f, + 1.5f, + Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, + 30, + 15f); GeneralParticleHandler.SpawnParticle(thunder); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 8c8351f8f7..6404dc74ae 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -310,7 +310,7 @@ namespace CalamityMod.Projectiles.Melee drawOrigin = new Vector2(0f, blade.Height); //Afterimages - if (CalamityConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) + if (CalamityClientConfig.Instance.Afterimages && CurrentState == 0f && Empowerment / maxEmpowerment > 0.4f) { for (int i = 0; i < Projectile.oldRot.Length; ++i) { diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs deleted file mode 100644 index b3b204545f..0000000000 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class TumbleweedFlail : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = Projectile.height = 42; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.alpha = 255; - } - - public override void AI() - { - Vector2 projDirection = Main.player[Projectile.owner].Center - Projectile.Center; - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction; - if (Main.player[Projectile.owner].dead) - { - Projectile.Kill(); - return; - } - Main.player[Projectile.owner].itemAnimation = 10; - Main.player[Projectile.owner].itemTime = 10; - float arg_1DC8F_0 = projDirection.X; - if (projDirection.X < 0f) - { - Main.player[Projectile.owner].ChangeDir(1); - Projectile.direction = 1; - } - else - { - Main.player[Projectile.owner].ChangeDir(-1); - Projectile.direction = -1; - } - Main.player[Projectile.owner].itemRotation = (projDirection * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (projDirection.X > 0f) ? -1 : 1; - if (Projectile.ai[0] == 0f && projDirection.Length() > 400f) - { - Projectile.ai[0] = 1f; - } - if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) - { - float projDistance = projDirection.Length(); - if (projDistance > 1500f) - { - Projectile.Kill(); - return; - } - if (projDistance > 600f) - { - Projectile.ai[0] = 2f; - } - Projectile.tileCollide = false; - float returnLength = 20f; - if (Projectile.ai[0] == 2f) - { - returnLength = 40f; - } - Projectile.velocity = Vector2.Normalize(projDirection) * returnLength; - if (projDirection.Length() < returnLength) - { - Projectile.Kill(); - return; - } - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) - { - Projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - SoundEngine.PlaySound(SoundID.NPCHit11, Projectile.position); - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/TumbleweedChain").Value; - Vector2 projCenter = Projectile.Center; - Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float projHeight = (float)texture2D2.Height; - Vector2 actualCenter = mountedCenter - projCenter; - float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; - bool isActive = true; - if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) - { - isActive = false; - } - if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) - { - isActive = false; - } - while (isActive) - { - if (actualCenter.Length() < projHeight + 1f) - { - isActive = false; - } - else - { - Vector2 centerCopy = actualCenter; - centerCopy.Normalize(); - projCenter += centerCopy * projHeight; - actualCenter = mountedCenter - projCenter; - Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0); - } - } - return true; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); - for (int i = 0; i < 20; i++) - { - int tumbleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, 0f, 0f, 100, default, 1.2f); - Main.dust[tumbleDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[tumbleDust].scale = 0.5f; - Main.dust[tumbleDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 30; j++) - { - int tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1.7f); - Main.dust[tumbleDust2].noGravity = true; - Main.dust[tumbleDust2].velocity *= 5f; - tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); - Main.dust[tumbleDust2].velocity *= 2f; - } - if (Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, 0f, 0f); - } - Projectile.Kill(); - } - } -} diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index 1427231e09..e73c217f69 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -8,60 +8,80 @@ namespace CalamityMod.Projectiles.Melee public class TumbleweedRolling : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TumbleweedFlail"; + public override string Texture => "CalamityMod/Projectiles/Melee/MaceFlails/TumbleweedFlail"; + + public static int Lifetime = 120; + public static int Rolltime = 30; // How long it remains gravity-defiant if it doesn't hit tiles + + public ref float RollState => ref Projectile.ai[0]; // 1f: falling public override void SetDefaults() { - Projectile.width = 44; - Projectile.height = 44; + Projectile.width = Projectile.height = 42; Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 8; - Projectile.timeLeft = 300; + Projectile.penetrate = 6; + Projectile.timeLeft = Lifetime; Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 5; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - if ((Projectile.velocity.X != Projectile.velocity.X && (Projectile.velocity.X < -3f || Projectile.velocity.X > 3f)) || - (Projectile.velocity.Y != Projectile.velocity.Y && (Projectile.velocity.Y < -3f || Projectile.velocity.Y > 3f))) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.NPCHit11, Projectile.position); - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } Projectile.rotation += Projectile.velocity.X * 0.05f; + + if (Projectile.timeLeft < Lifetime - Rolltime) + RollState = 1f; + + if (RollState == 1f && Projectile.velocity.Y < 10f) + Projectile.velocity.Y += 0.6f; + + Dust sand = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Alpha: 100, Scale: Main.rand.NextFloat(0.6f, 1.2f)); + sand.noGravity = RollState != 1f; + sand.velocity = Projectile.velocity * 0.5f; } - public override void OnKill(int timeLeft) + public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.NPCDeath15, Projectile.position); - for (int i = 0; i < 20; i++) + if (RollState != 1f) + RollState = 1f; + + Projectile.penetrate--; + Projectile.numHits++; + + if (oldVelocity.Y != Projectile.velocity.Y) + Projectile.velocity.Y = MathHelper.Clamp(oldVelocity.Y * -0.5f * Projectile.penetrate, -16f, -2f); + + Point scanAreaStart = Projectile.TopLeft.ToTileCoordinates(); + Point scanAreaEnd = Projectile.BottomRight.ToTileCoordinates(); + Projectile.CreateImpactExplosion(2, Projectile.Center, ref scanAreaStart, ref scanAreaEnd, Projectile.width, out bool causedShockwaves); + Projectile.CreateImpactExplosion2_FlailTileCollision(Projectile.Center, causedShockwaves, Projectile.velocity); + TumbleImpactEffects(); + return false; + } + + public override void OnKill(int timeLeft) => TumbleImpactEffects(); + + public void TumbleImpactEffects() + { + float impactIntensity = 1f - Projectile.numHits * 0.08f; + SoundEngine.PlaySound(SoundID.NPCDeath15 with { Volume = impactIntensity }, Projectile.Center); + for (int i = 0; i < (int)(8 * impactIntensity); i++) { - int tumbleDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, 0f, 0f, 100, default, 1.2f); - Main.dust[tumbleDust].velocity *= 3f; + Dust tumbleDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Sand, Alpha: 100, Scale: 1.2f); + tumbleDust.velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[tumbleDust].scale = 0.5f; - Main.dust[tumbleDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + tumbleDust.scale = 0.5f; + tumbleDust.fadeIn = Main.rand.NextFloat(1f, 1.1f); } - } - for (int j = 0; j < 30; j++) - { - int tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1.7f); - Main.dust[tumbleDust2].noGravity = true; - Main.dust[tumbleDust2].velocity *= 5f; - tumbleDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); - Main.dust[tumbleDust2].velocity *= 2f; + + tumbleDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, Alpha: 100, Scale: 1.7f); + tumbleDust.noGravity = true; + tumbleDust.velocity *= 5f; + + tumbleDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, Alpha: 100, Scale: 1f); + tumbleDust.velocity *= 2f; } } } diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs deleted file mode 100644 index 439efbe746..0000000000 --- a/Projectiles/Melee/UrchinBall.cs +++ /dev/null @@ -1,150 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class UrchinBall : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public bool spike = false; - - public override void SetDefaults() - { - Projectile.width = 34; - Projectile.height = 34; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.alpha = 255; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 3; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - Vector2 projDirection = player.Center - Projectile.Center; - Projectile.rotation = projDirection.ToRotation() - MathHelper.PiOver2; - if (player.dead) - { - Projectile.Kill(); - return; - } - player.itemAnimation = 10; - player.itemTime = 10; - if (projDirection.X < 0f) - { - player.ChangeDir(1); - Projectile.direction = 1; - } - else - { - player.ChangeDir(-1); - Projectile.direction = -1; - } - player.itemRotation = (projDirection * -1f * (float)Projectile.direction).ToRotation(); - Projectile.spriteDirection = (projDirection.X > 0f) ? -1 : 1; - if (Projectile.ai[0] == 0f && projDirection.Length() > 400f) - { - Projectile.ai[0] = 1f; - } - if (Projectile.ai[0] == 1f || Projectile.ai[0] == 2f) - { - if (spike) - { - spike = false; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); - } - Projectile.usesLocalNPCImmunity = false; - float projDistance = projDirection.Length(); - if (projDistance > 1500f) - { - Projectile.Kill(); - return; - } - if (projDistance > 600f) - { - Projectile.ai[0] = 2f; - } - Projectile.tileCollide = false; - float returnLength = 20f; - if (Projectile.ai[0] == 2f) - { - returnLength = 40f; - } - Projectile.velocity = Vector2.Normalize(projDirection) * returnLength; - if (projDirection.Length() < returnLength) - { - Projectile.Kill(); - return; - } - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) - { - Projectile.alpha = 0; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/UrchinFlailChain").Value; - Vector2 projCenter = Projectile.Center; - Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float projHeight = (float)texture2D2.Height; - Vector2 actualCenter = mountedCenter - projCenter; - float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; - bool isActive = true; - if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) - { - isActive = false; - } - if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) - { - isActive = false; - } - while (isActive) - { - if (actualCenter.Length() < projHeight + 1f) - { - isActive = false; - } - else - { - Vector2 centerCopy = actualCenter; - centerCopy.Normalize(); - projCenter += centerCopy * projHeight; - actualCenter = mountedCenter - projCenter; - Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0); - } - } - return true; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - spike = true; - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - target.AddBuff(BuffID.Poisoned, 180); - } - } -} diff --git a/Projectiles/Melee/UrchinBall.png b/Projectiles/Melee/UrchinBall.png deleted file mode 100644 index 58eb311c75..0000000000 Binary files a/Projectiles/Melee/UrchinBall.png and /dev/null differ diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs deleted file mode 100644 index 43487f17d5..0000000000 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class UrchinBallSpike : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 6; - Projectile.height = 6; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.penetrate = -1; - AIType = ProjectileID.BoneJavelin; - } - - public override void AI() - { - if (Projectile.ai[0] == 0f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.99f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.15f; - Projectile.rotation += 0.4f * (float)Projectile.direction; - Projectile.spriteDirection = Projectile.direction; - } - //Sticky Behaviour - Projectile.StickyProjAI(6); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(6); - public override bool? CanDamage() => Projectile.ai[0] == 1f ? false : base.CanDamage(); - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (targetHitbox.Width > 8 && targetHitbox.Height > 8) - { - targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); - } - return null; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 13; - Projectile.height = 20; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 20; i++) - { - int urchin = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, 0f, 0f, 0, new Color(0, 255, 255), 1f); - Main.dust[urchin].noGravity = true; - Main.dust[urchin].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Poisoned, 120); - } - } -} diff --git a/Projectiles/Melee/UrchinBallSpike.png b/Projectiles/Melee/UrchinBallSpike.png deleted file mode 100644 index 9828a05673..0000000000 Binary files a/Projectiles/Melee/UrchinBallSpike.png and /dev/null differ diff --git a/Projectiles/Melee/UrchinFlailChain.png b/Projectiles/Melee/UrchinFlailChain.png deleted file mode 100644 index 34510cfce7..0000000000 Binary files a/Projectiles/Melee/UrchinFlailChain.png and /dev/null differ diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 8d22f3cf4a..667a5789f9 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -1,6 +1,9 @@ -using System; +using CalamityMod.Graphics.Primitives; +using System; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -9,10 +12,18 @@ namespace CalamityMod.Projectiles.Melee public class UrchinSpikeFugu : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + + public ref float Time => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = Projectile.height = 6; Projectile.friendly = true; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; @@ -24,55 +35,30 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] == 0f) + Time++; + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.alpha = (int)Utils.Remap(Time, 0f, 12f, 255f, 0f); + + NPC potentialTarget = Projectile.Center.ClosestNPCAt(256f); + if (potentialTarget != null && Time >= 12f) { - float maxRange = Projectile.ai[1] == 1f ? 256f : 100f; // Increased homing range for Lionfish - int npcIndex = -1; - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - float targetDist = (npc.Center - Projectile.Center).Length(); - if (targetDist < maxRange) - { - npcIndex = npc.whoAmI; - maxRange = targetDist; - } - } - } - Projectile.ai[0] = (float)(npcIndex + 1); - if (Projectile.ai[0] == 0f) - { - Projectile.ai[0] = -15f; - } - if (Projectile.ai[0] > 0f) - { - float scaleFactor5 = (float)Main.rand.Next(35, 75) / 30f; - Projectile.velocity = (Projectile.velocity * 20f + Vector2.Normalize(Main.npc[(int)Projectile.ai[0] - 1].Center - Projectile.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor5) / 21f; - Projectile.netUpdate = true; - } - } - else if (Projectile.ai[0] > 0f) - { - Vector2 value16 = Vector2.Normalize(Main.npc[(int)Projectile.ai[0] - 1].Center - Projectile.Center); - Projectile.velocity = (Projectile.velocity * 40f + value16 * 12f) / 41f; - } - else - { - Projectile.ai[0] += 1f; - Projectile.alpha -= 25; - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - Projectile.velocity.Y = Projectile.velocity.Y + 0.015f; + Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 12f; + Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f; + Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 120); + + public override bool? CanDamage() => Time < 12f ? false : base.CanDamage(); + + internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 4f; + internal Color ColorFunction(float completionRatio) => new Color(91, 62, 153) * Projectile.Opacity; + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(BuffID.Poisoned, 120); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); + return true; } } } diff --git a/Projectiles/Melee/UrchinSpikeFugu.png b/Projectiles/Melee/UrchinSpikeFugu.png index 0d8e8c9ebf..477129b581 100644 Binary files a/Projectiles/Melee/UrchinSpikeFugu.png and b/Projectiles/Melee/UrchinSpikeFugu.png differ diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index 692aea191f..334f79b348 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -151,6 +152,8 @@ namespace CalamityMod.Projectiles.Melee float scale = Main.rand.NextFloat(1.0f, 1.8f); Main.dust[idx].scale = scale; } + + target.AddBuff(ModContent.BuffType(), 180); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs deleted file mode 100644 index f6778cd633..0000000000 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteBoltAura : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 100; - Projectile.height = 2; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 12f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int randOrbXOffset = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int randOrbYOffset = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)randOrbXOffset, (float)randOrbYOffset, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 20f) - { - Projectile.localAI[0] = 0f; - int projTimer = 0; - int incTracker = 0; - float aiTracker = 0f; - int theProjectile = Projectile.type; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner == Projectile.owner && p.type == theProjectile && p.ai[1] < 3600f) - { - projTimer++; - if (p.ai[1] > aiTracker) - { - incTracker = p.whoAmI; - aiTracker = p.ai[1]; - } - } - } - if (projTimer > 1) - { - Main.projectile[incTracker].netUpdate = true; - Main.projectile[incTracker].ai[1] = 36000f; - } - } - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs deleted file mode 100644 index 75df233253..0000000000 --- a/Projectiles/Melee/WhiteOrb.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class WhiteOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 8; - Projectile.height = 8; - Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 1; - Projectile.ignoreWater = true; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); - - int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); - Main.dust[shiny].noGravity = true; - Main.dust[shiny].velocity *= 0.5f; - Main.dust[shiny].velocity += Projectile.velocity * 0.1f; - } - } -} diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs deleted file mode 100644 index 0bf0617dfa..0000000000 --- a/Projectiles/Melee/Whiterain.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class Whiterain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 1; - Projectile.penetrate = 2; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 120; - Projectile.DamageType = DamageClass.Melee; - } - - public override void AI() - { - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - SoundEngine.PlaySound(SoundID.Item125 with { Volume = 0.7f }, Projectile.Center); - } - - Lighting.AddLight(Projectile.Center, 0.2f, 0.2f, 0.2f); - - for (int i = 0; i < 2; i++) - { - int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemDiamond, 0f, 0f, 100, default, 1.25f); - Main.dust[shiny].noGravity = true; - Main.dust[shiny].velocity *= 0.5f; - Main.dust[shiny].velocity += Projectile.velocity * 0.1f; - } - - CalamityUtils.HomeInOnNPC(Projectile, true, 320f, 14f, 20f); - } - } -} diff --git a/Projectiles/Melee/YateveoBloomProj.cs b/Projectiles/Melee/YateveoBloomProj.cs deleted file mode 100644 index 1e4dcf6113..0000000000 --- a/Projectiles/Melee/YateveoBloomProj.cs +++ /dev/null @@ -1,224 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class YateveoBloomProj : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override void SetDefaults() - { - Projectile.width = 18; - Projectile.height = 18; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; - Projectile.alpha = 255; - } - - public override void AI() - { - Vector2 projDirection = Main.player[Projectile.owner].MountedCenter - Projectile.Center; - Projectile.rotation = projDirection.ToRotation() - MathHelper.PiOver2; - float distance = projDirection.Length(); - - if (Main.player[Projectile.owner].dead) - { - Projectile.Kill(); - return; - } - - Main.player[Projectile.owner].itemAnimation = 10; - Main.player[Projectile.owner].itemTime = 10; - - if (projDirection.X < 0f) - { - Main.player[Projectile.owner].ChangeDir(1); - Projectile.direction = 1; - } - else - { - Main.player[Projectile.owner].ChangeDir(-1); - Projectile.direction = -1; - } - - if (Projectile.ai[0] == 0f) - { - Projectile.tileCollide = true; - if (distance > 210f) - { - Projectile.ai[0] = 1f; - Projectile.netUpdate = true; - } - else if (!Main.player[Projectile.owner].channel) - { - if (Projectile.velocity.Y < 0f) - Projectile.velocity.Y = Projectile.velocity.Y * 0.9f; - - Projectile.velocity.Y = Projectile.velocity.Y + 1f; - Projectile.velocity.X = Projectile.velocity.X * 0.9f; - } - } - else - { - float meleeSpeedDistance = 14f / Main.player[Projectile.owner].GetAttackSpeed() * 1.25f; - float meleeDamage = 0.9f / Main.player[Projectile.owner].GetAttackSpeed() * 1.25f; - - if (Projectile.ai[1] == 1f) - Projectile.tileCollide = false; - - if (!Main.player[Projectile.owner].channel || distance > 375f || !Projectile.tileCollide) - { - Projectile.ai[1] = 1f; - - if (Projectile.tileCollide) - Projectile.netUpdate = true; - - Projectile.tileCollide = false; - - if (distance < 20f) - Projectile.Kill(); - } - - if (!Projectile.tileCollide) - meleeDamage *= 2f; - - if (distance > 80f || !Projectile.tileCollide) - { - distance = meleeSpeedDistance / distance; - projDirection.X *= distance; - projDirection.Y *= distance; - - float projXDirect = projDirection.X - Projectile.velocity.X; - float projYDirect = projDirection.Y - Projectile.velocity.Y; - float projDistance = (float)Math.Sqrt((double)(projXDirect * projXDirect + projYDirect * projYDirect)); - - projDistance = meleeDamage / projDistance; - projXDirect *= projDistance; - projYDirect *= projDistance; - - Projectile.velocity.X = Projectile.velocity.X * 0.98f; - Projectile.velocity.Y = Projectile.velocity.Y * 0.98f; - Projectile.velocity.X = Projectile.velocity.X + projXDirect; - Projectile.velocity.Y = Projectile.velocity.Y + projYDirect; - } - else - { - if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 6f) - { - Projectile.velocity.X = Projectile.velocity.X * 0.96f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; - } - - if (Main.player[Projectile.owner].velocity.X == 0f) - Projectile.velocity.X = Projectile.velocity.X * 0.96f; - } - } - - if (Main.rand.NextBool(3)) - { - int dustType = Main.rand.Next(5); - switch (dustType) - { - case 0: - dustType = 2; - break; - case 1: - dustType = 44; - break; - case 2: - case 3: - case 4: - dustType = 136; - break; - default: - break; - } - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, 0f, 0f); - Main.dust[dust].noGravity = true; - Main.dust[dust].scale = 1.5f; - } - - if (Projectile.alpha == 255 && distance > 10f) - Projectile.alpha = 0; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bool hitTile = false; - if (oldVelocity.X != Projectile.velocity.X) - { - hitTile = Math.Abs(oldVelocity.X) > 4f; - - Projectile.position.X = Projectile.position.X + Projectile.velocity.X; - Projectile.velocity.X = -oldVelocity.X * 0.2f; - } - if (oldVelocity.Y != Projectile.velocity.Y) - { - hitTile = Math.Abs(oldVelocity.Y) > 4f; - - Projectile.position.Y = Projectile.position.Y + Projectile.velocity.Y; - Projectile.velocity.Y = -oldVelocity.Y * 0.2f; - } - - Projectile.ai[0] = 1f; - - if (hitTile) - { - Projectile.netUpdate = true; - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Dig, Projectile.position); - } - - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Texture2D texture2D2 = ModContent.Request("CalamityMod/Projectiles/Melee/YateveoBloomChain").Value; - Vector2 projCenter = Projectile.Center; - Rectangle? sourceRectangle = null; - Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); - float projHeight = (float)texture2D2.Height; - Vector2 actualCenter = mountedCenter - projCenter; - float projRotation = (float)Math.Atan2((double)actualCenter.Y, (double)actualCenter.X) - MathHelper.PiOver2; - bool isActive = true; - if (float.IsNaN(projCenter.X) && float.IsNaN(projCenter.Y)) - { - isActive = false; - } - if (float.IsNaN(actualCenter.X) && float.IsNaN(actualCenter.Y)) - { - isActive = false; - } - while (isActive) - { - if (actualCenter.Length() < projHeight + 1f) - { - isActive = false; - } - else - { - Vector2 centerCopy = actualCenter; - centerCopy.Normalize(); - projCenter += centerCopy * projHeight; - actualCenter = mountedCenter - projCenter; - Color drawArea = Lighting.GetColor((int)projCenter.X / 16, (int)(projCenter.Y / 16f)); - Main.spriteBatch.Draw(texture2D2, projCenter - Main.screenPosition, sourceRectangle, drawArea, projRotation, origin, 1f, SpriteEffects.None, 0); - } - } - return true; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Poisoned, 180); - } - } -} diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 6844252aed..16b047ceb3 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -73,7 +73,6 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, speed, 12f); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Ranged/BuzzkillHoldout.cs b/Projectiles/Ranged/BuzzkillHoldout.cs index a0e818b0f7..44db5dd77a 100644 --- a/Projectiles/Ranged/BuzzkillHoldout.cs +++ b/Projectiles/Ranged/BuzzkillHoldout.cs @@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time / ChargeupTime >= 0.25f) Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None); - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing for the slashes only diff --git a/Projectiles/Ranged/BuzzkillSaw.cs b/Projectiles/Ranged/BuzzkillSaw.cs index c4ef59e32b..be7825b949 100644 --- a/Projectiles/Ranged/BuzzkillSaw.cs +++ b/Projectiles/Ranged/BuzzkillSaw.cs @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Ranged } } - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return true; // Special afterimage drawing to include the slashes diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 0db0ed946a..bfbffc0be1 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.dedServ) return; - for (int i = 0; i < 70; i++) + for (int i = 0; i < 50; i++) { // The exponent being greater than 1 gives the randomness a bias towards 0. This means that more dust will spawn // closer to the center than the edge. diff --git a/Projectiles/Ranged/ChickenRocket.cs b/Projectiles/Ranged/ChickenRocket.cs index 60ac94fae2..dcf3ba3218 100644 --- a/Projectiles/Ranged/ChickenRocket.cs +++ b/Projectiles/Ranged/ChickenRocket.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; // Slight gravity, equivalent to Plasma Grenade. - Projectile.velocity.Y += 0.09f; + Projectile.velocity.Y += 0.075f; } // Instead of dying instantly on collision, fly straight up for a moment. @@ -85,33 +85,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 1040; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); if (Projectile.owner == Main.myPlayer) - { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < 40; i++) - { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); - Main.dust[d].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[d].scale = 0.5f; - Main.dust[d].fadeIn = 1f + Main.rand.NextFloat(); - } - } - for (int i = 0; i < 70; i++) - { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= 5f; - d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[d].velocity *= 2f; - } } } } diff --git a/Projectiles/Ranged/ElementalEruptionHouldout.cs b/Projectiles/Ranged/ChromaticEruptionHoldout.cs similarity index 90% rename from Projectiles/Ranged/ElementalEruptionHouldout.cs rename to Projectiles/Ranged/ChromaticEruptionHoldout.cs index bb8f4c68f1..e737a8ba0a 100644 --- a/Projectiles/Ranged/ElementalEruptionHouldout.cs +++ b/Projectiles/Ranged/ChromaticEruptionHoldout.cs @@ -10,9 +10,9 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class ElementalEruptionHoldout : BaseGunHoldoutProjectile + public class ChromaticEruptionHoldout : BaseGunHoldoutProjectile { - public override int AssociatedItemID => ModContent.ItemType(); + public override int AssociatedItemID => ModContent.ItemType(); public override float MaxOffsetLengthFromArm => 15f; public override float OffsetXUpwards => -10f; public override float BaseOffsetY => -5f; @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged Owner.PickAmmo(Owner.ActiveItem(), out _, out float shootSpeed, out int damage, out float knockback, out _, Main.rand.NextFloat() < 0.70f); for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (Projectile.velocity * 10).RotatedByRandom(0.12f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, (Projectile.velocity * 10).RotatedByRandom(0.12f), ModContent.ProjectileType(), damage, knockback, Projectile.owner); } ShotsFired++; ShotCooldown = HeldItem.useTime; @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Ranged { Vector2 newVel = (Projectile.velocity * 9); Vector2 newPos = GunTipPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 36f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), -1f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), -1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), newPos, newVel, ModContent.ProjectileType(), damage, knockback, Projectile.owner, newVel.Length(), 1f); FireBlobs = 3; } else diff --git a/Projectiles/Ranged/ElementalFire.cs b/Projectiles/Ranged/ChromaticFire.cs similarity index 98% rename from Projectiles/Ranged/ElementalFire.cs rename to Projectiles/Ranged/ChromaticFire.cs index 9f1b355c28..a97a221ad5 100644 --- a/Projectiles/Ranged/ElementalFire.cs +++ b/Projectiles/Ranged/ChromaticFire.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class ElementalFire : ModProjectile, ILocalizedModType + public class ChromaticFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Ranged/ElementalFlare.cs b/Projectiles/Ranged/ChromaticFlare.cs similarity index 99% rename from Projectiles/Ranged/ElementalFlare.cs rename to Projectiles/Ranged/ChromaticFlare.cs index c92fe7d148..ae0517b920 100644 --- a/Projectiles/Ranged/ElementalFlare.cs +++ b/Projectiles/Ranged/ChromaticFlare.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class ElementalFlare : ModProjectile, ILocalizedModType + public class ChromaticFlare : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/ExtraTextures/SmallGreyscaleCircle"; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index adb6c6d397..a2756431ff 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -46,6 +46,10 @@ namespace CalamityMod.Projectiles.Ranged public override void HoldoutAI() { + // Does not run if the player stops channeling + if (Owner.CantUseHoldout()) + return; + // Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows. if (FramesToLoadNextArrow == 0f) { @@ -77,7 +81,7 @@ namespace CalamityMod.Projectiles.Ranged SpawnArrowLoadedDust(); CurrentChargingFrames = 0f; ++ArrowsLoaded; - --FramesToLoadNextArrow; + FramesToLoadNextArrow = MathHelper.Clamp(FramesToLoadNextArrow--, 1f, HeldItem.useAnimation); // Play a sound for additional notification that an arrow has been loaded. var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.3f }); diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 83feeccb0f..05f7be8b12 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = true; dust.color = InnerColor; - CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, false, 600f, 12f, 15f); } } @@ -95,16 +95,13 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { Projectile.timeLeft = 27 * Projectile.MaxUpdates; - float numberOflines = 5; - float rotFactorlines = 360f / numberOflines; - for (int i = 0; i < numberOflines; i++) + + for (int i = 0; i < 2; i++) { - float rot = MathHelper.ToRadians(i * rotFactorlines); - Vector2 offset = new Vector2(Main.rand.NextFloat(1, 3.1f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - Vector2 velOffset = new Vector2(Main.rand.NextFloat(1, 3.1f), 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 9.1f)); - AltSparkParticle spark = new AltSparkParticle(Projectile.Center + offset, velOffset, false, 20, Main.rand.NextFloat(1.9f, 2.3f), Color.Black); - GeneralParticleHandler.SpawnParticle(spark); + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f, 0.6f, 25, false); + GeneralParticleHandler.SpawnParticle(blastRing); } + float numberOfDusts = 12; float rotFactor = 360f / numberOfDusts; for (int i = 0; i < numberOfDusts; i++) diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index 05d52851f7..7e23091bf4 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -47,14 +48,17 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 70, 0, 0, 255, true)); if (targetDist < 1400f && Projectile.timeLeft > 70 && Projectile.timeLeft < 790) { - if (Projectile.timeLeft % 6 == 0) + if (Projectile.timeLeft % 5 == 0) { - Particle spark = new LineParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.8f), false, Main.rand.Next(9, 20 + 1), Main.rand.NextFloat(0.8f, 1.2f), Color.Chartreuse * Main.rand.NextFloat(0.15f, 0.5f)); + //Particle spark = new LineParticle(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.2f, 1.8f), false, Main.rand.Next(9, 20 + 1), Main.rand.NextFloat(0.8f, 1.2f), Color.Chartreuse * Main.rand.NextFloat(0.15f, 0.5f)); + //GeneralParticleHandler.SpawnParticle(spark); + + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 6, 0.07f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.5f, new Vector2(1, 0.3f), true, false, 1); GeneralParticleHandler.SpawnParticle(spark); } - if (Main.rand.NextBool(6)) + if (Main.rand.NextBool(5)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), 75, -Projectile.velocity.RotatedByRandom(0.1) * Main.rand.NextFloat(0.1f, 0.3f), 0, default, Main.rand.NextFloat(0.5f, 1.2f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(20, 20), Main.rand.NextBool(4) ? 215 : (int)CalamityDusts.SulphurousSeaAcid, -Projectile.velocity.RotatedByRandom(0.1) * Main.rand.NextFloat(0.1f, 0.3f), 0, default, Main.rand.NextFloat(0.5f, 1.2f)); dust.noGravity = true; } } diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 55536073df..be4ba1de28 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 450); + target.AddBuff(ModContent.BuffType(), 450); SoundEngine.PlaySound(HalleysInferno.Hit, Projectile.Center); // Dust emission on hit diff --git a/Projectiles/Ranged/HellbornHoldout.cs b/Projectiles/Ranged/HellbornHoldout.cs new file mode 100644 index 0000000000..5d41469ad0 --- /dev/null +++ b/Projectiles/Ranged/HellbornHoldout.cs @@ -0,0 +1,230 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HellbornHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 24f; + public override float OffsetXUpwards => -5f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + public override float RecoilResolveSpeed => 0.5f; + + public ref float time => ref Projectile.ai[0]; + public float cooldownTimer = 0; + public bool onCooldown => cooldownTimer > 0; + public SlotId SoundSlot; + + public bool Spinning => Projectile.ai[2] == 0; + public bool failedShot = false; + public float drawRot = 0; + public bool hasPlayedSound = false; + public bool hasPlayedReloadSound = false; + public float fade = 0; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 12; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 62; + Projectile.height = 34; + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + Projectile.tileCollide = false; + Projectile.ArmorPenetration = 25; + } + public override void HoldoutAI() + { + fade = Utils.GetLerpValue(0, 40, time, true); + if (SoundEngine.TryGetActiveSound(SoundSlot, out var sSound) && sSound.IsPlaying) + { + sSound.Volume = fade * 100 * 0.5f; + sSound.Position = Projectile.Center; + } + + if (onCooldown) + { + PostFiringCooldown(); + if (!Spinning) + return; + } + if (Spinning) + { + float armRot = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float spinArmRot = (((Projectile.Center + new Vector2(0, -3).RotatedBy(drawRot * 0.6f)) - Owner.Center).SafeNormalize(Vector2.UnitX) * 5).ToRotation(); + Owner.SetCompositeArmBack(true, FrontArmStretch, armRot + 0.6f * Projectile.direction); + Owner.SetCompositeArmFront(true, BackArmStretch, spinArmRot + MathHelper.ToRadians(-90f)); + } + if (time > 3) + { + if (Spinning) + { + if (Owner.CantUseHoldout()) + { + Projectile.Kill(); + sSound?.Stop(); + } + else + { + OffsetLengthFromArm = MathHelper.Lerp(OffsetLengthFromArm, 9, 0.5f); + drawRot += 0.75f * Projectile.direction * MathHelper.Clamp(fade, 0.3f, 1f); + + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.OrangeRed, Color.White, 0.6f).ToVector3() * fade * 0.7f); + if (!hasPlayedSound) + { + SoundStyle spin = new("CalamityMod/Sounds/Item/SpinningWoosh"); + SoundSlot = SoundEngine.PlaySound(spin with { Volume = 0.01f, Pitch = -0.1f, IsLooped = true }, Projectile.Center); + hasPlayedSound = true; + } + + Particle Smear = new CircularSmearVFX(Projectile.Center, Color.Red * Main.rand.NextFloat(0.45f, 0.6f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(1.13f, 1.25f) * fade); + GeneralParticleHandler.SpawnParticle(Smear); + + Particle Smear2 = new CircularSmearVFX(Projectile.Center, Color.OrangeRed * Main.rand.NextFloat(0.45f, 0.6f), Main.rand.NextFloat(-8, 8), Main.rand.NextFloat(0.65f, 0.72f) * fade); + GeneralParticleHandler.SpawnParticle(Smear2); + + if (Main.rand.NextBool() && fade > 0.2f) + { + for (int i = 0; i < 2; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + drawRot * 0.25f + MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 35f * fade; + Dust dust = Dust.NewDustPerfect(dustPos, 278, (i * MathHelper.Pi + (drawRot * Projectile.direction) * 0.25f * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedBy(MathHelper.ToRadians(180f) * (Projectile.direction == 1 ? 0 : 1)) * -3f * Main.rand.NextFloat(0.5f, 1f) * fade); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.42f, 0.62f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + + } + } + else if (fade > 0.2f) + { + for (int i = 0; i < 3; i++) + { + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + drawRot * 0.5f + MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.5f) * 87f * fade; + Dust dust = Dust.NewDustPerfect(dustPos, 267, (i * MathHelper.Pi + (drawRot * Projectile.direction) * 0.5f * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedBy(MathHelper.ToRadians(180f) * (Projectile.direction == 1 ? 0 : 1)) * -7f * Main.rand.NextFloat(0.5f, 1f) * fade); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.62f, 0.82f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + } + } + } + else if (!onCooldown) + { + if (Owner.Calamity().hellbornShots > 0) + { + Owner.Calamity().GeneralScreenShakePower = 5f; + OffsetLengthFromArm -= 35f; + cooldownTimer = Owner.itemAnimationMax * 2; + Owner.Calamity().hellbornShots--; + SoundStyle bigShot = new("CalamityMod/Sounds/Item/HellbornShoot"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.9f }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7; + + Owner.velocity += shootVelocity * -0.68f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -shootVelocity.RotatedBy(0.75f * Projectile.direction) * 1f, ModContent.ProjectileType(), 0, 0, Projectile.owner); + + for (int i = 0; i <= 13; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 1.5f), 80, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = Color.White; + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1f)); + dust2.noGravity = true; + dust2.scale = Main.rand.NextFloat(0.52f, 0.72f); + dust2.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + for (int i = 0; i < 14; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, shootVelocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1.5f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + else + { + OffsetLengthFromArm -= 8f; + failedShot = true; + SoundStyle bigShot = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.75f }, Projectile.Center); + cooldownTimer = Owner.itemAnimationMax; + } + } + } + + time++; + } + private void PostFiringCooldown() + { + Owner.channel = true; + cooldownTimer -= (Spinning ? 1 : 2f); + + if (cooldownTimer > 1) + { + if (!Owner.Calamity().mouseRight && cooldownTimer < Owner.itemAnimationMax * 1.7f && !failedShot) + Projectile.ai[2] = 0; + if (cooldownTimer <= 18 && !hasPlayedReloadSound) + { + if (!failedShot) + { + SoundStyle fire = new("CalamityMod/Sounds/Item/HellbornReload"); + SoundEngine.PlaySound(fire with { Volume = 0.8f }, Projectile.Center); + } + hasPlayedReloadSound = true; + } + } + else if (!Spinning) + { + if (SoundEngine.TryGetActiveSound(SoundSlot, out var sSound) && sSound.IsPlaying) + sSound?.Stop(); + Projectile.Kill(); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SourceDamage *= 0.08f; + if (Owner.Calamity().hellbornShots < 8) + { + Owner.Calamity().hellbornShots++; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Hellborn").Value; + Texture2D spinTexture = ModContent.Request("CalamityMod/Items/Weapons/Ranged/Hellborn").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition + (Spinning ? new Vector2(0, -8).RotatedBy(drawRot * 0.6f) : Vector2.Zero), null, Projectile.GetAlpha(lightColor), drawRotation + drawRot, rotationPoint, Projectile.scale, flipSprite); + return false; + } + public override bool? CanDamage() => Spinning && time > 5 ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 100, targetHitbox); + public override void KillHoldoutLogic() + { + } + } +} diff --git a/Projectiles/Ranged/HellbornProj.cs b/Projectiles/Ranged/HellbornProj.cs new file mode 100644 index 0000000000..9f12d7abfb --- /dev/null +++ b/Projectiles/Ranged/HellbornProj.cs @@ -0,0 +1,135 @@ +using System; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HellbornProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 38; + Projectile.height = 38; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 600; + Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 2; + Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + //Animation + if (Projectile.frame == 0 || Projectile.frame == 3) + Projectile.frameCounter++; + else + Projectile.frameCounter += 2; + if (Projectile.frameCounter > 20) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame > 5) + { + Projectile.frame = 0; + } + if (Projectile.velocity.Length() < 18) + Projectile.velocity *= 1.035f; + + //Rotation + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + Lighting.AddLight(Projectile.Center, Color.Orange.ToVector3()); + + if (targetDist < 1400f) + { + // Spawn in a helix-style pattern + float sine = (float)Math.Sin(Projectile.timeLeft * 0.575f / MathHelper.Pi); + + Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * 16f; + if (Main.rand.NextBool(2)) + { + Particle orb = new GlowOrbParticle(Projectile.Center + offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(orb); + } + if (Main.rand.NextBool(2)) + { + Particle orb2 = new GlowOrbParticle(Projectile.Center - offset, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, Main.rand.Next(20, 28 + 1), Main.rand.NextFloat(0.6f, 1.3f), Main.rand.NextBool() ? Color.Orange : Color.OrangeRed); + GeneralParticleHandler.SpawnParticle(orb2); + } + } + Vector2 dustPos = Projectile.Center + Main.rand.NextVector2Circular(30, 30); + Dust dust = Dust.NewDustPerfect(dustPos, 267, -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.72f, 1.12f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + Player Owner = Main.player[Projectile.owner]; + if (target.CanBeMoved(true)) + { + // Launch + Vector2 launchVel = (Projectile.Center - target.Center).SafeNormalize(Vector2.UnitY) * -17; + target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); + } + } + public override void OnKill(int timeLeft) + { + for (int l = 0; l < 17; l++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.62f, 0.82f); + dust.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0f, 1f)); + } + + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1.2f, 1.7f, 16, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White * 0.7f, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f, 0.9f, 16, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + + SoundStyle bigShot = new("CalamityMod/Sounds/Item/HellbornImpact"); + SoundEngine.PlaySound(bigShot with { PitchVariance = 0.15f, Volume = 0.8f }, Projectile.Center); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Ranged/HellbornProj").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + + Rectangle frame = texture.Frame(1, 6, 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + + Texture2D rechargeTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + // Glow Orb + float randSize = Main.rand.NextFloat(0.8f, 1.2f); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.OrangeRed with { A = 0 }, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.5f * randSize, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rechargeTexture, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * 0.75f, Projectile.rotation, rechargeTexture.Size() * 0.5f, 0.35f * randSize, SpriteEffects.None, 0); + + for (int i = 0; i < 1; i++) + Main.EntitySpriteDraw(texture, drawPosition, frame, Color.White, 0, origin, Projectile.scale * (i == 0 ? 1.15f : 1), SpriteEffects.None, 0); + + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 35, targetHitbox); + } +} diff --git a/Projectiles/Ranged/HellbornProj.png b/Projectiles/Ranged/HellbornProj.png new file mode 100644 index 0000000000..f99f640dfa Binary files /dev/null and b/Projectiles/Ranged/HellbornProj.png differ diff --git a/Projectiles/Ranged/HellbornShell.cs b/Projectiles/Ranged/HellbornShell.cs new file mode 100644 index 0000000000..7647aaf586 --- /dev/null +++ b/Projectiles/Ranged/HellbornShell.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HellbornShell : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/HellbornShell"; + public int Time = 0; + public bool TouchedGrass = false; + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 26; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Projectile.scale = 0.8f; + Projectile.extraUpdates = 1; + Time++; + Player Owner = Main.player[Projectile.owner]; + if (!TouchedGrass) + { + if (Projectile.timeLeft <= 240) + Projectile.rotation += 0.04f * Projectile.direction; + else + Projectile.rotation = (new Vector2(0, -5 * Projectile.direction) + Projectile.velocity * -1.2f).ToRotation(); + + Projectile.velocity.Y += 0.087f; + Projectile.velocity.X *= 0.99f; + + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, 303, -Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(0.2f, 1f), 180, default, Main.rand.NextFloat(0.4f, 1.3f)); + dust.noGravity = false; + dust.color = Color.White; + } + } + else + { + Projectile.velocity = Vector2.Zero; + } + Projectile.alpha = (int)(255 * Utils.GetLerpValue(60, 0, Projectile.timeLeft, true)); + if (Collision.SolidCollision(Projectile.Center - Projectile.velocity * 1.5f, 2, 2)) + Projectile.tileCollide = true; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.damage = 0; + TouchedGrass = true; + Projectile.velocity = Vector2.Zero; + return false; + } + } +} diff --git a/Projectiles/Ranged/HellbornShell.png b/Projectiles/Ranged/HellbornShell.png new file mode 100644 index 0000000000..03dd40086a Binary files /dev/null and b/Projectiles/Ranged/HellbornShell.png differ diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 21fba14125..33ceb2d7f6 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged // Rotates towards its velocity. Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) { HasHit = true; Projectile.Kill(); diff --git a/Projectiles/Ranged/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs index 95c48cb8dc..fd07e0e2ba 100644 --- a/Projectiles/Ranged/HiveNuke.cs +++ b/Projectiles/Ranged/HiveNuke.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Ranged // Rotates towards its velocity. Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); Time++; diff --git a/Projectiles/Ranged/MarksmanShot.cs b/Projectiles/Ranged/MarksmanShot.cs index e7f74735cf..e3db98ad8c 100644 --- a/Projectiles/Ranged/MarksmanShot.cs +++ b/Projectiles/Ranged/MarksmanShot.cs @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Ranged { Player coinOwner = Main.player[struckCoin.owner]; if (coinOwner.name.ToLower() == "v1" || coinOwner.name.ToLower() == "v2" || coinOwner.name.ToLower() == "mirage") - ORDERSystem.JUDGMENT(); + ORDERSystem.JUDGEMENT(); } } @@ -183,7 +183,10 @@ namespace CalamityMod.Projectiles.Ranged Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); // Instead of immediately killing the projectile, simply set the time left so the trail can fade out. - Projectile.timeLeft = Math.Min(Lifetime - Projectile.timeLeft, trailLength); + if (Projectile.numHits == 0) + Projectile.timeLeft = Math.Min(Lifetime - Projectile.timeLeft, trailLength); + + Projectile.numHits++; return false; } @@ -192,8 +195,11 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Midas, 60); // Instead of immediately killing the projectile, simply set the time left so the trail can fade out. - Projectile.velocity = Vector2.Zero; - Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), trailLength); + if (Projectile.numHits == 0) + { + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), trailLength); + } } internal Color ColorFunction(float completionRatio) diff --git a/Projectiles/Ranged/MineralMortarProjectile.cs b/Projectiles/Ranged/MineralMortarProjectile.cs index bbda255676..98a7ae6fec 100644 --- a/Projectiles/Ranged/MineralMortarProjectile.cs +++ b/Projectiles/Ranged/MineralMortarProjectile.cs @@ -179,7 +179,7 @@ namespace CalamityMod.Projectiles.Ranged GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SwordSlashTexture")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, ColorTrailFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 50); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index 3a4177fb51..ff90d3f020 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Ranged else { if (Owner.Calamity().NorfleetCounter >= 1000) - Owner.Calamity().NorfleetCounter = 3; + Owner.Calamity().NorfleetCounter = 4; else Owner.Calamity().NorfleetCounter = 1000; diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 5a78feabf5..217acf83c3 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Electrified, 180); if (Projectile.owner == Main.myPlayer) { - if (target.life <= 0) + if ((target.life <= 0 && target.realLife == -1)) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 93548a466e..2877dc14bc 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -94,6 +95,10 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index b870ab4aff..fd0109446f 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -1,21 +1,8 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Dusts; using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; using Terraria.ModLoader; -using static CalamityMod.Items.Weapons.Ranged.PolarisParrotfish; -using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged { @@ -42,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.penetrate = -1; // Only hits once, "pierces" so that it can last a bit after hitting Projectile.extraUpdates = 2; - Projectile.timeLeft = 50; + Projectile.timeLeft = 40; Projectile.DamageType = DamageClass.Ranged; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index 93522b1934..6dea938198 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -28,8 +29,13 @@ namespace CalamityMod.Projectiles.Ranged private ref float CurrentChargingFrames => ref Projectile.ai[0]; private ref float PumpkinsCharge => ref Projectile.ai[1]; + private ref float FramesToLoadNextPumpkin => ref Projectile.localAI[0]; + + //This possibly could moved to ai[2] ¯\_(ツ)_/¯ private ref float Overfilled => ref Projectile.localAI[1]; //This functionally is a "IsPlayingShootAnim" variable + + private bool IsOverfilled => (Overfilled >= 0.5f); private float angularSpread = MathHelper.ToRadians(15); public override void SetDefaults() @@ -49,10 +55,10 @@ namespace CalamityMod.Projectiles.Ranged Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Unloads all pumpkins if you can't shoot/stop holding out the projectile or if the gun is overfilled - if (Owner.CantUseHoldout() || Overfilled == 1f) + if (Owner.CantUseHoldout() || IsOverfilled) { - if (PumpkinsCharge <= 0f && Overfilled == 0f) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it + if (PumpkinsCharge <= 0f && !IsOverfilled) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it { Projectile.Kill(); return; @@ -68,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frameCounter = 0; } // Shoot anim is done? Remove the shoot anim tag - if (Projectile.frame == 0 && Overfilled == 1f) + if (Projectile.frame == 0 && IsOverfilled) Overfilled = 0f; //Animation stuff end @@ -145,7 +151,7 @@ namespace CalamityMod.Projectiles.Ranged SmokeBurst(tipPosition); FramesToLoadNextPumpkin = Owner.ActiveItem().useAnimation; //reset the reload time PumpkinsCharge = 0; //Unload the barrel - if (!(Overfilled == 1f)) + if (!IsOverfilled) Overfilled = 1f; //Make the shoot anim play Projectile.frame = 6; //Initialize the animation } @@ -213,7 +219,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(); - if (PumpkinsCharge > 0 && Overfilled == 0f) + if (PumpkinsCharge > 0 && !IsOverfilled) { GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(MathHelper.Clamp(1f - 0.20f * CurrentChargingFrames - 0.1f * (5f - PumpkinsCharge), 0f, 1f)); //tint effect is visible if its charging. The more pumpkins are loaded, the more opacity @@ -240,12 +246,12 @@ namespace CalamityMod.Projectiles.Ranged //netcode hell public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Overfilled); + writer.Write(IsOverfilled); } public override void ReceiveExtraAI(BinaryReader reader) { - Overfilled = reader.ReadInt32(); + Overfilled = reader.ReadBoolean() ? 1.0f : 0.0f; } } } diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs index f4382f2726..0404c6b0f6 100644 --- a/Projectiles/Ranged/ScorpioLargeRocket.cs +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 1.032f; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); // Every X frames it changes the projectile to its next animation frame. diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index 309634c16a..321682b4ef 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged else Projectile.velocity *= 0.9f; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); // Rotates towards its velocity. diff --git a/Projectiles/Ranged/SepticChain.png b/Projectiles/Ranged/SepticChain.png new file mode 100644 index 0000000000..cf87d1f927 Binary files /dev/null and b/Projectiles/Ranged/SepticChain.png differ diff --git a/Projectiles/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index b6e487b778..23e8884714 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -1,5 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,146 +13,57 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - + public bool setStats = true; + public int rotDirection = 1; + public int time = 0; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = 45; + Projectile.height = 45; Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 300; + Projectile.timeLeft = 80; + Projectile.extraUpdates = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = DamageClass.Ranged; } public override void AI() { - int dustType = 171; + if (setStats) + { + Projectile.timeLeft += Main.rand.Next(0, 25 + 1); + rotDirection = (Main.rand.NextBool() ? -1 : 1); + Projectile.rotation = Main.rand.NextFloat(-20, 20); + Projectile.scale = Main.rand.NextFloat(0.55f, 0.8f); + setStats = false; + } + if (time % 8 == 0 && time > 40) + { + Particle spark = new CustomSpark(Projectile.Center - Projectile.velocity + Main.rand.NextVector2Circular(20, 20), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f), "CalamityMod/Projectiles/Boss/OldDukeGore", false, Main.rand.Next(9, 20 + 1), Main.rand.NextFloat(0.4f, 0.6f), Color.Lerp(Color.White, Color.Chartreuse, 0.5f) * Main.rand.NextFloat(0.55f, 0.7f) * Utils.GetLerpValue(255, 0, Projectile.alpha), new Vector2(1, 1), false, false, Main.rand.NextFloat(-1f, 1f)); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(15)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f) * Utils.GetLerpValue(255, 0, Projectile.alpha); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } if (Main.rand.NextBool(3)) { - dustType = 46; - } - int toxicDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[toxicDust].noGravity = true; - float scaleAlpha = 1f - (float)Projectile.alpha / 255f; - scaleAlpha *= Projectile.scale; - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 90f) - { - Projectile.localAI[0] *= -1f; - } - if (Projectile.localAI[0] >= 0f) - { - Projectile.scale += 0.003f; - } - else - { - Projectile.scale -= 0.003f; - } - Projectile.rotation += 0.0025f * Projectile.scale; - float yVelControl = 1f; - float xVelControl = 1f; - if (Projectile.identity % 6 == 0) - { - xVelControl *= -1f; - } - if (Projectile.identity % 6 == 1) - { - yVelControl *= -1f; - } - if (Projectile.identity % 6 == 2) - { - xVelControl *= -1f; - yVelControl *= -1f; - } - if (Projectile.identity % 6 == 3) - { - xVelControl = 0f; - } - if (Projectile.identity % 6 == 4) - { - yVelControl = 0f; - } - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] > 60f) - { - Projectile.localAI[1] = -180f; - } - if (Projectile.localAI[1] >= -60f) - { - Projectile.velocity.X = Projectile.velocity.X + 0.002f * xVelControl; - Projectile.velocity.Y = Projectile.velocity.Y + 0.002f * yVelControl; - } - else - { - Projectile.velocity.X = Projectile.velocity.X - 0.002f * xVelControl; - Projectile.velocity.Y = Projectile.velocity.Y - 0.002f * yVelControl; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5400f) - { - Projectile.damage = 0; - Projectile.ai[1] = 1f; - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - else if (Projectile.owner == Main.myPlayer) - { - Projectile.Kill(); - } - } - else - { - float playerDist = (Projectile.Center - Main.player[Projectile.owner].Center).Length() / 100f; - if (playerDist > 4f) - { - playerDist *= 1.1f; - } - if (playerDist > 5f) - { - playerDist *= 1.2f; - } - if (playerDist > 6f) - { - playerDist *= 1.3f; - } - if (playerDist > 7f) - { - playerDist *= 1.4f; - } - if (playerDist > 8f) - { - playerDist *= 1.5f; - } - if (playerDist > 9f) - { - playerDist *= 1.6f; - } - if (playerDist > 10f) - { - playerDist *= 1.7f; - } - Projectile.ai[0] += playerDist; - if (Projectile.alpha > 50) - { - Projectile.alpha -= 10; - if (Projectile.alpha < 50) - { - Projectile.alpha = 50; - } - } - } - if ((double)Projectile.velocity.Length() > 0.2) - { - Projectile.velocity *= 0.98f; + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + dust.alpha = (int)MathHelper.Clamp(Projectile.alpha, 0, 255); } + Projectile.rotation += 0.035f * rotDirection * Utils.GetLerpValue(0, 100, Projectile.timeLeft, true); + Projectile.velocity *= 0.965f; + if (Projectile.timeLeft < 60) + Projectile.alpha += 5; + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -159,21 +73,20 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 56; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int constant = 36; - for (int i = 0; i < constant; i++) - { - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(i - (constant / 2 - 1)) * 6.28318548f / (float)constant), default) + Projectile.Center; - Vector2 faceDirection = rotate - Projectile.Center; - int dust = Dust.NewDust(rotate + faceDirection, 0, 0, DustID.Venom, faceDirection.X, faceDirection.Y, 100, default, 0.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].noLight = true; - Main.dust[dust].velocity = faceDirection; - } + + } + public override bool PreDraw(ref Color lightColor) + { + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeGore").Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + return false; } } } diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 5e4628a6e4..8532758f96 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -1,7 +1,14 @@ using System; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.DataStructures; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -10,119 +17,388 @@ namespace CalamityMod.Projectiles.Ranged public class SepticSkewerHarpoon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public ref float time => ref Projectile.ai[0]; + + public Vector2[] OldVelocities = new Vector2[20]; + public bool canDamage = true; + public bool returning = false; + public float CenterX; + public float CenterY; + public bool setPosition = true; + public int returnTime = 75; + + public NPC chosenTarget; + public bool stuckInTarget = false; + public bool canStick = true; + public Vector2 placementCenter; + float placementDistance; + Vector2 placementVelocity; + public Vector2 storedVelocity; + public bool collideWithTiles = true; + public bool hasHitTile = false; + public Color bColor = Color.Chartreuse; + + public bool ripped = false; + public bool pullingTarget = false; + public bool spawnPullBlood = true; + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Projectile.type] = 10000; + } + public Vector2 DrawStartPosition + { + get + { + if (Projectile.owner < 0 || Projectile.owner >= Main.player.Length) + return Vector2.Zero; + return Main.player[Projectile.owner].Center; + } + } public override void SetDefaults() { Projectile.width = 4; Projectile.height = 4; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.alpha = 255; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 1; Projectile.timeLeft = 900; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool(5)) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + bool pullCheckValid = ((chosenTarget != null && chosenTarget.life < Projectile.damage * 15f && Projectile.ai[2] != 5 && chosenTarget.CanBeMoved(true)) || Main.zenithWorld); + + if (Projectile.ai[2] == 5) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Venom, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + ripped = true; + pullingTarget = false; } - Vector2 playerDist = player.Center - Projectile.Center; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) + if (Projectile.ai[1] > 0) + Projectile.extraUpdates = (int)(MathHelper.Clamp(Projectile.ai[1], 1, 18)); + + if (!stuckInTarget && (!hasHitTile && !returning)) + storedVelocity = Projectile.velocity; + + if (Main.zenithWorld) { - Projectile.alpha = 0; + returnTime = 90; + Projectile.extraUpdates = 7; } - if (Projectile.ai[1] % 8f == 0f && Projectile.owner == Main.myPlayer && Main.rand.NextBool(5)) + + if (time >= returnTime * (pullCheckValid ? 0.9f : stuckInTarget ? 5 : 1) || ripped) { - Vector2 harpoonPos = playerDist * -1f; - harpoonPos.Normalize(); - harpoonPos *= Main.rand.Next(45, 65) * 0.1f; - harpoonPos = harpoonPos.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, harpoonPos.X, harpoonPos.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.175), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); - } - if (player.dead) - { - Projectile.Kill(); - return; - } - if (Projectile.alpha == 0) - { - if (Projectile.position.X + (float)(Projectile.width / 2) > player.position.X + (float)(player.width / 2)) + stuckInTarget = false; + returning = true; + if (pullCheckValid && chosenTarget != null) { - player.ChangeDir(1); + pullingTarget = true; + canDamage = false; + chosenTarget.damage = 0; + chosenTarget.Center = Projectile.Center; + chosenTarget.velocity = Projectile.velocity; } else { - player.ChangeDir(-1); + canDamage = true; } } - if (Projectile.ai[0] == 0f) + + if (returning) { - Projectile.extraUpdates = 2; - } - else - { - Projectile.extraUpdates = 3; - } - Vector2 halfDist = Projectile.Center; - float xDist = player.position.X + (float)(player.width / 2) - halfDist.X; - float yDist = player.position.Y + (float)(player.height / 2) - halfDist.Y; - float playerDistance = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (Projectile.ai[0] == 0f) - { - if (playerDistance > 2000f) + int startTime = 1000; + int endTime = startTime + (int)((pullingTarget ? 45 : ripped ? 25 : 85)); + if (setPosition) { - Projectile.ai[0] = 1f; + SoundStyle pull3 = new("CalamityMod/Sounds/Item/ChainPull"); + SoundEngine.PlaySound(pull3 with { Pitch = (Main.rand.NextFloat(0, 0.05f)), Volume = (Projectile.numHits > 0 && ripped ? 0.6f : 0.4f) }, Owner.Center); + + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + canStick = false; + time = 1000; + CenterX = Projectile.Center.X; + CenterY = Projectile.Center.Y; + setPosition = false; + if (Projectile.numHits > 0 && !pullingTarget) + { + float ripIntensity = ripped ? 2 : 1; + if (ripped) + { + SoundStyle pull = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveIchorShoot"); + SoundStyle pull2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(pull with { Pitch = Main.rand.NextFloat(0, -0.2f), Volume = 0.7f }, Projectile.Center); + SoundEngine.PlaySound(pull2 with { Pitch = Main.rand.NextFloat(0.3f, 0.4f), Volume = 0.9f }, Projectile.Center); + } + else + { + SoundStyle pull = new("CalamityMod/Sounds/Custom/Perforator/PerfHiveShoot3"); + SoundStyle pull2 = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(pull with { Pitch = -0.2f, Volume = 0.6f }, Projectile.Center); + SoundEngine.PlaySound(pull2 with { Pitch = -0.6f, Volume = 0.5f }, Projectile.Center); + } + + for (int i = 0; i < 7 * ripIntensity; i++) + { + Vector2 vel = ((Projectile.Center - Owner.Center).SafeNormalize(Vector2.UnitX) * -18).RotatedByRandom(0.2f * ripIntensity) * Main.rand.NextFloat(0.2f, 0.6f) * ripIntensity; + if (i % 3 == 0) + { + Particle spark = new AltLineParticle(Projectile.Center, vel, true, (int)(18 * ripIntensity), Main.rand.NextFloat(0.55f, 0.8f) * ripIntensity, Color.DarkRed * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Particle spark = new GlowOrbParticle(Projectile.Center, vel, true, (int)(18 * ripIntensity), Main.rand.NextFloat(0.55f, 0.8f) * ripIntensity, Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, vel * 3, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + } + + if (!pullingTarget) + { + for (int i = 0; i < 4 + (ripped ? 2 : 0); i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, ((Projectile.Center - Owner.Center).SafeNormalize(Vector2.UnitX) * -18).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.3f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 9, Projectile.knockBack, Projectile.owner, 0); + } + } } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 5f) - { - Projectile.alpha = 0; - } - if (Projectile.ai[1] > 8f) - { - Projectile.ai[1] = 8f; - } - if (Projectile.ai[1] >= 10f) - { - Projectile.ai[1] = 15f; - Projectile.velocity.Y = Projectile.velocity.Y + 0.3f; - } - } - else if (Projectile.ai[0] == 1f) - { - Projectile.tileCollide = false; - Projectile.rotation = (float)Math.Atan2((double)yDist, (double)xDist) - MathHelper.PiOver2; - float returnSpeed = 20f; - if (playerDistance < 50f) - { + + storedVelocity += (Projectile.Center - Owner.Center).SafeNormalize(Vector2.UnitX) * 0.5f; + Projectile.Center = new Vector2(MathHelper.Lerp(CenterX, Owner.Center.X, Utils.GetLerpValue(startTime, endTime, time, true)), MathHelper.Lerp(CenterY, Owner.Center.Y, Utils.GetLerpValue(startTime, endTime, time, true))); + if (time >= endTime) Projectile.Kill(); + + if (time >= endTime - 2 && pullingTarget) + { + if (spawnPullBlood && chosenTarget != null && chosenTarget.life > 0) + { + SoundStyle die = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); + SoundEngine.PlaySound(die with { Pitch = Main.rand.NextFloat(0, 0.1f), Volume = 0.85f }, Projectile.Center); + for (int i = 0; i < 40; i++) + { + Vector2 vel = (Vector2.One * -28).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.9f); + if (i % 3 == 0) + { + Particle spark = new AltLineParticle(Projectile.Center, vel, true, (int)(35), Main.rand.NextFloat(0.55f, 1.3f), Color.DarkRed * 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Particle spark = new GlowOrbParticle(Projectile.Center, vel, true, (int)(35), Main.rand.NextFloat(0.55f, 1.3f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int r = 0; r < 2; r++) + { + Vector2 vel2 = (Vector2.One * -28).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.8f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, vel2, 100, default, Main.rand.NextFloat(0.9f, 1.7f)); + dust.noGravity = false; + } + } + + NPC closestTarget = null; + float distance = 2000; + for (int index = 0; index < Main.npc.Length; index++) + { + if (Main.npc[index].CanBeChasedBy(null, false)) + { + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + + if (Vector2.Distance(Projectile.Center, Main.npc[index].Center) < distance && canHit && Main.npc[index] != chosenTarget) + { + distance = Vector2.Distance(Projectile.Center, Main.npc[index].Center); + closestTarget = Main.npc[index]; + } + } + if (Main.zenithWorld && Main.npc[index] != null && Main.rand.NextBool(15) && index < 80 && Main.npc[index].realLife == -1 && Owner.ownedProjectileCounts[Projectile.type] < 80) + { + closestTarget = Main.npc[index]; + Projectile harpoon = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, ((closestTarget.Center - Owner.Center + closestTarget.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 18), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1] + 1); + } + } + if (closestTarget != null) + { + Projectile harpoon = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, ((closestTarget.Center - Owner.Center + closestTarget.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 18), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0, Projectile.ai[1] + 1); + } + + int heal = 25; + Owner.statLife += heal; + Owner.HealEffect(heal); + if (Owner.statLife > Owner.statLifeMax2) + Owner.statLife = Owner.statLifeMax2; + + spawnPullBlood = false; + } + canDamage = true; } - playerDistance = returnSpeed / playerDistance; - xDist *= playerDistance; - yDist *= playerDistance; - Projectile.velocity.X = xDist; - Projectile.velocity.Y = yDist; } + + if ((time <= returnTime * 0.6f && !stuckInTarget || returning && Main.rand.NextBool(5))) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(9, 9), Main.rand.NextBool(7) ? 28 : 215, storedVelocity * Main.rand.NextFloat(0.05f, 0.15f), 0, default, Main.rand.NextFloat(0.5f, 0.9f)); + dust.noGravity = true; + } + + if (stuckInTarget) + { + placementCenter = chosenTarget.Center + placementVelocity * placementDistance + storedVelocity * 2; + + Projectile.Center = placementCenter; + + if (chosenTarget.life <= 0 || chosenTarget == null) + { + returning = true; + stuckInTarget = false; + } + } + else if (time >= returnTime * 0.4f && !returning) + { + Projectile.velocity *= 0.95f; + } + + if (collideWithTiles && Collision.SolidCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30, 4, 4) && !Main.zenithWorld && Projectile.ai[1] < 1) + { + hasHitTile = true; + Projectile.velocity *= -0.5f; + Vector2 sparkVelocity = Projectile.velocity * 3; + for (int i = 0; i < 6; i++) + { + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, true, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/CeramicImpact", 2) with { Pitch = 0.4f, Volume = 0.5f }, Projectile.Center); + } + + time = returnTime * 0.5f; + collideWithTiles = false; + canStick = false; + } + + if (!hasHitTile || returning) + { + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.ToRadians(90f); + } + AdjustOldVelocityArray(); + time++; + } + public void AdjustOldVelocityArray() + { + for (int i = OldVelocities.Length - 1; i > 0; i--) + OldVelocities[i] = OldVelocities[i - 1]; + + OldVelocities[0] = storedVelocity; } - public override bool OnTileCollide(Vector2 oldVelocity) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - Projectile.ai[0] = 1f; - return false; - } + bool pullCheckValid = ((chosenTarget != null && chosenTarget.life < Projectile.damage * 15f && Projectile.ai[2] != 5 && chosenTarget.CanBeMoved(true)) || Main.zenithWorld); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + if (!stuckInTarget && canStick) + { + for (int i = 0; i <= 8; i++) + { + Vector2 sparkVelocity = Projectile.velocity * 0.5f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(Projectile.Center, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, sparkvelocity2, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; + } + + time = 1; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + canStick = false; + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + + pullCheckValid = ((chosenTarget != null && chosenTarget.life < Projectile.damage * 15f && Projectile.ai[2] != 5 && chosenTarget.CanBeMoved(true)) || Main.zenithWorld); + if (pullCheckValid) + { + SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + } + } + + bool hitTarget = chosenTarget != null && target == chosenTarget; + modifiers.SourceDamage *= hitTarget ? pullingTarget ? 20 : (ripped ? 2 : Projectile.numHits < 1 ? 0.01f : 1) : 0.2f; + + pullCheckValid = ((chosenTarget != null && chosenTarget.life < Projectile.damage * 15f && Projectile.ai[2] != 5 && chosenTarget.CanBeMoved(true)) || Main.zenithWorld); + if (!pullCheckValid) + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, !spawnPullBlood ? 150 : 25, targetHitbox); + + public override bool PreDraw(ref Color lightColor) { - target.AddBuff(ModContent.BuffType(), 180); + Texture2D chain = ModContent.Request("CalamityMod/Projectiles/Ranged/SepticChain").Value; + Vector2 end = Projectile.Center - storedVelocity.SafeNormalize(Vector2.UnitX) * 35; + + List controlPoints = new List + { + DrawStartPosition + }; + for (int i = 0; i < OldVelocities.Length; i++) + { + float swayResponsiveness = Utils.GetLerpValue(0f, 6f, i, true) * Utils.GetLerpValue(OldVelocities.Length, OldVelocities.Length - 6f, i, true); + Vector2 swayTotalOffset = OldVelocities[i] * swayResponsiveness; + controlPoints.Add(Vector2.Lerp(DrawStartPosition, end, i / (float)OldVelocities.Length) + swayTotalOffset); + } + controlPoints.Add(end); + + int chainPointCount = (int)(Vector2.Distance(controlPoints.First(), controlPoints.Last()) / 7f); + if (chainPointCount < 12) + chainPointCount = 12; + BezierCurve bezierCurve = new BezierCurve(controlPoints.ToArray()); + List chainPoints = bezierCurve.GetPoints(chainPointCount); + + for (int i = 0; i < chainPoints.Count; i++) + { + Vector2 positionAtPoint = chainPoints[i]; + if (Vector2.Distance(positionAtPoint, Projectile.Center) < 10f) + continue; + float angleAtPoint = i == chainPoints.Count - 1 ? (end - chainPoints[i]).ToRotation() : (chainPoints[i + 1] - chainPoints[i]).ToRotation(); + angleAtPoint += MathHelper.PiOver2; + Main.EntitySpriteDraw(chain, + positionAtPoint - Main.screenPosition, + null, + Lighting.GetColor(positionAtPoint.ToTileCoordinates()), + angleAtPoint, + chain.Size() / 2f, + 0.85f, + SpriteEffects.None, + 0); + } + return true; } } } diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index 47b6b88a0f..52c5f49420 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Ranged public int soundtimer = 0; // Counts how long the slot machine has been spinning + the cooldown public SlotId RouletteSoundSlot; + public SlotId JingleSoundSlot; public override void SetStaticDefaults() { @@ -37,7 +38,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.alpha = 255; } public override void AI() @@ -134,18 +134,18 @@ namespace CalamityMod.Projectiles.Ranged // Play a sound and display the jackpot text if (shottimer == 1) { - SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); + JingleSoundSlot = SoundEngine.PlaySound(Main.zenithWorld ? TheSevensStriker.JackpotGFB : TheSevensStriker.JackpotSound, player.Center); CombatText.NewText(player.getRect(), Color.Gold, CalamityUtils.GetTextValue("Misc.SevensJackpot"), true); } // Every 7 frames, shoot 7 coins. The first 7 frames are excluded for timing purposes - if (shottimer % 7 == 0 && shottimer > 7) + if (shottimer % 7 == 0 && shottimer > 7 && shottimer <= 56) { - int jackpotDamage = (int)(weaponDamage * TheSevensStriker.JackpotMultiplier); + int jackpotDamage = (int)(weaponDamage * (Main.zenithWorld ? TheSevensStriker.JackpotMultiplierGFB : TheSevensStriker.JackpotMultiplier)); Shoot(7, ModContent.ProjectileType(), jackpotDamage, weaponKnockback, (int)scaleFactor * 2f, 0.2f); SoundEngine.PlaySound(TheSevensStriker.CoinSound, Projectile.Center); } // After 7 waves have been shot, reset the gun and roll again - if (shottimer > 56) + if (shottimer > (Main.zenithWorld ? 88 : 56)) { soundtimer = 0; rolling = true; @@ -166,14 +166,14 @@ namespace CalamityMod.Projectiles.Ranged case 1: Shoot(1, ModContent.ProjectileType(), weaponDamage, 0, 2f, 0); CombatText.NewText(player.getRect(), Color.Gray, CalamityUtils.GetTextValue("Misc.SevensBust"), true); - SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center); + JingleSoundSlot = SoundEngine.PlaySound(Main.zenithWorld ? TheSevensStriker.BustGFB : TheSevensStriker.BustSound, player.Center); break; // 7 exploding oranges with 100% damage case 2: int doublesDamage = (int)(weaponDamage * TheSevensStriker.DoublesMultiplier); Shoot(7, ModContent.ProjectileType(), doublesDamage, weaponKnockback, 2f, 0.1f); CombatText.NewText(player.getRect(), Color.Orange, CalamityUtils.GetTextValue("Misc.SevensDoubles"), true); - SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center); + JingleSoundSlot = SoundEngine.PlaySound(TheSevensStriker.DoublesSound, player.Center); break; // 7 piercing grapes with X% damage // Also fires 7 splitting cherries in a tighter spread with Y% damage @@ -183,13 +183,13 @@ namespace CalamityMod.Projectiles.Ranged Shoot(7, ModContent.ProjectileType(), cherryDamage, weaponKnockback, 1.5f, 0.1f); Shoot(7, ModContent.ProjectileType(), grapeDamage, weaponKnockback, 2f, 0.2f); CombatText.NewText(player.getRect(), Color.Red, CalamityUtils.GetTextValue("Misc.SevensTriples"), true); - SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); + JingleSoundSlot = SoundEngine.PlaySound(TheSevensStriker.TriplesSound, player.Center); break; } } // Reset the gun and roll again - if (shottimer > 16) + if (shottimer > (Main.zenithWorld ? 56 : 16)) { soundtimer = 0; rolling = true; @@ -198,9 +198,12 @@ namespace CalamityMod.Projectiles.Ranged } } } - // Update the roll sound position + // Update the roll and jingle sound positions, if applicable if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var rouletteSound) && rouletteSound.IsPlaying) rouletteSound.Position = Projectile.Center; + + if (SoundEngine.TryGetActiveSound(JingleSoundSlot, out var jingle) && jingle.IsPlaying) + jingle.Position = player.Center; } // If the player can't use the gun, KILL it else @@ -231,68 +234,79 @@ namespace CalamityMod.Projectiles.Ranged player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } // Calculates which attack will occur based on coin. public int CalculateOutcome() { - switch (Projectile.ai[0]) + if (Main.zenithWorld) { - // Copper Coins have: - // 50% chance for a brick - // 30% chance for oranges - // 15% chance for grapes and cherries - // 5% chance for a jackpot - case ProjectileID.CopperCoin: - { - int roll = Main.rand.Next(100); - if (roll <= 50) - return 1; - else if (roll > 50 && roll <= 80) - return 2; - else if (roll > 80 && roll <= 95) - return 3; - else - return 4; - } - // Silver Coins have: - // 20% chance for a brick - // 50% chance for oranges - // 20% chance for grapes and cherries - // 10% chance for a jackpot - case ProjectileID.SilverCoin: - { - int roll = Main.rand.Next(100); - if (roll <= 20) - return 1; - else if (roll > 20 && roll <= 70) - return 2; - else if (roll > 70 && roll <= 90) - return 3; - else - return 4; - } - // Gold Coins have: - // 5% chance for a brick - // 30% chance for oranges - // 50% chance for grapes and cherries - // 15% chance for a jackpot - case ProjectileID.GoldCoin: - { - int roll = Main.rand.Next(100); - if (roll <= 5) - return 1; - else if (roll > 5 && roll <= 35) - return 2; - else if (roll > 35 && roll <= 85) - return 3; - else - return 4; - } - // Platinum Coins are a guaranteed jackpot - case ProjectileID.PlatinumCoin: + int roll = Main.rand.Next(100); + if (roll < 20) return 4; + else + return 1; + } + else + { + switch (Projectile.ai[0]) + { + // Copper Coins have: + // 50% chance for a brick + // 30% chance for oranges + // 15% chance for grapes and cherries + // 5% chance for a jackpot + case ProjectileID.CopperCoin: + { + int roll = Main.rand.Next(100); + if (roll <= 50) + return 1; + else if (roll > 50 && roll <= 80) + return 2; + else if (roll > 80 && roll <= 95) + return 3; + else + return 4; + } + // Silver Coins have: + // 20% chance for a brick + // 50% chance for oranges + // 20% chance for grapes and cherries + // 10% chance for a jackpot + case ProjectileID.SilverCoin: + { + int roll = Main.rand.Next(100); + if (roll <= 20) + return 1; + else if (roll > 20 && roll <= 70) + return 2; + else if (roll > 70 && roll <= 90) + return 3; + else + return 4; + } + // Gold Coins have: + // 5% chance for a brick + // 30% chance for oranges + // 50% chance for grapes and cherries + // 15% chance for a jackpot + case ProjectileID.GoldCoin: + { + int roll = Main.rand.Next(100); + if (roll <= 5) + return 1; + else if (roll > 5 && roll <= 35) + return 2; + else if (roll > 35 && roll <= 85) + return 3; + else + return 4; + } + // Platinum Coins are a guaranteed jackpot + case ProjectileID.PlatinumCoin: + return 4; + } } // This should never be returned return 1; @@ -305,8 +319,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 armPosition = player.RotatedRelativePoint(player.MountedCenter, true); armPosition += Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * 32f; armPosition.Y -= 20f; - Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); - Vector2 gunTip = armPosition + shootDirection * player.ActiveItem().scale * 90f; + Vector2 gunTip = armPosition + Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * player.ActiveItem().scale * 70f; for (int i = 0; i < projcount; ++i) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-spreadfactor, spreadfactor, i / 7f)) * scaleFactor; @@ -331,21 +344,28 @@ namespace CalamityMod.Projectiles.Ranged int currentframe = indframeheight * Projectile.frame; Rectangle frame = new Rectangle(0, currentframe, gun.Width, indframeheight); - Main.EntitySpriteDraw(gun, drawOffset, frame, lightColor, drawAngle, drawOrigin, Projectile.scale, flip, 0); + // This is full brightness but it's better than random flickering for whatever reason + Main.EntitySpriteDraw(gun, drawOffset, frame, Color.White, drawAngle, drawOrigin, Projectile.scale, flip, 0); return false; } - // When the gun disappears, stop any in-progress slots sounds and set a cooldown of 12 frames. + // When the gun disappears, stop any in-progress slot or jingle sounds and set a cooldown of 12 frames. public override void OnKill(int timeLeft) { if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var dringdring)) dringdring.Stop(); + if (SoundEngine.TryGetActiveSound(JingleSoundSlot, out var jingle)) + jingle.Stop(); + Main.player[Projectile.owner].SetDummyItemTime(12); } // This gun does not deal melee damage, thanks. public override bool? CanDamage() => false; + + // Has velocity but updates positions manually + public override bool ShouldUpdatePosition() => false; } } diff --git a/Projectiles/Ranged/SuperradiantSaw.cs b/Projectiles/Ranged/SuperradiantSaw.cs index 023582e299..5e43af296a 100644 --- a/Projectiles/Ranged/SuperradiantSaw.cs +++ b/Projectiles/Ranged/SuperradiantSaw.cs @@ -363,7 +363,7 @@ namespace CalamityMod.Projectiles.Ranged Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition, null, Main.DiscoColor, Projectile.rotation, outline.Size() * 0.5f, 1f, SpriteEffects.None); } - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing to include the slashes diff --git a/Projectiles/Ranged/SuperradiantSawLingering.cs b/Projectiles/Ranged/SuperradiantSawLingering.cs index e576590ff9..49529f2016 100644 --- a/Projectiles/Ranged/SuperradiantSawLingering.cs +++ b/Projectiles/Ranged/SuperradiantSawLingering.cs @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D outline = SawOutline.Value; Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition, null, Main.DiscoColor, Projectile.rotation, outline.Size() * 0.5f, 1f, SpriteEffects.None); - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing to include the slashes diff --git a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs index 0306b7f797..16e78c01b0 100644 --- a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs +++ b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs @@ -328,7 +328,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time / ChargeupTime >= 0.25f) Main.EntitySpriteDraw(smallSlashTexture, GunTipPosition - Main.screenPosition, null, slashColor, Time * MathHelper.ToRadians(42f), smallSlashTexture.Size() * 0.5f, 1f, SpriteEffects.None); - if (!CalamityConfig.Instance.Afterimages) + if (!CalamityClientConfig.Instance.Afterimages) return false; // Special afterimage drawing for the slashes only diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index d40e05db3a..8362bf5a60 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -1,7 +1,14 @@ -using CalamityMod.Items.Weapons.Rogue; +using System; +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -10,76 +17,345 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShardofAntumbra"; + public ref float time => ref Projectile.ai[0]; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; - ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - } + // Vanilla sticky code is jank, So I did my own (for better or worse) + public NPC chosenTarget; + public bool stuckInTarget = false; + public bool stuckInGround = false; + public bool canDamage = true; + public bool canStick = true; + public int stuckTimer = 180; + public Vector2 placementCenter; + float placementDistance; + Vector2 placementVelocity; + public Vector2 storedVelocity; + public bool collideWithTiles = true; + public Vector2 startingVel; + public bool jitter = false; + public Vector2 portalSpot; + public Vector2 shadowPlacement; + public int clones = 9; // This is just a counter for the clones, it will not change how many spawn + NPC closestTarget; public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 2; + Projectile.height = 2; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.MaxUpdates = 2; - Projectile.aiStyle = ProjAIStyleID.StickProjectile; + Projectile.extraUpdates = 2; Projectile.timeLeft = 600; - AIType = ProjectileID.BoneJavelin; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 20 total + Projectile.localNPCHitCooldown = -1; + Projectile.tileCollide = false; } public override void AI() { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - if (Projectile.spriteDirection == -1) + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (closestTarget != null && closestTarget.life <= 0) + closestTarget = null; + if (Projectile.ai[2] > 0 && time == 0) { - Projectile.rotation -= MathHelper.PiOver2; + closestTarget = Projectile.Center.ClosestNPCAt(2000); + storedVelocity = ((closestTarget == null ? Owner.Calamity().mouseWorld : closestTarget.Center) - Projectile.Center).SafeNormalize(Vector2.UnitX); + Projectile.alpha = 255; + Projectile.velocity = Vector2.Zero; + stuckInTarget = true; + collideWithTiles = false; + canDamage = false; + portalSpot = Projectile.Center; } - if (Main.rand.NextBool(3)) + if (time == 0) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurpleTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + startingVel = Projectile.velocity; } - if (Projectile.timeLeft % 12 == 0) + float fading = stuckInTarget ? Utils.GetLerpValue(0, 180, stuckTimer) : 0.5f; + if (stuckInTarget && time % ((int)(10 * fading) + 1) == 0) { - if (Projectile.owner == Main.myPlayer) + shadowPlacement = Main.rand.NextVector2Circular(30, 30); + jitter = !jitter; + } + + if (stuckInGround) + { + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); + } + if (!stuckInTarget && !stuckInGround) + { + storedVelocity = Projectile.velocity; + Projectile.rotation = (storedVelocity).ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); + if (Projectile.spriteDirection == -1) { - if (Projectile.Calamity().stealthStrike) + Projectile.rotation -= MathHelper.PiOver2; + } + if (time > 5 && !stuckInTarget) + { + if (Main.rand.NextBool(4) && canStick) { - int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); - Main.projectile[star].DamageType = RogueDamageClass.Instance; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); + dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } + if ((Projectile.Calamity().stealthStrike || Projectile.ai[1] == 1) && targetDist < 1400) + { + float randVel = Main.rand.NextFloat(0.3f, 1.2f); + int lifetime = Projectile.Calamity().stealthStrike ? 24 : 8; + Particle spark = new AltSparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 1.2f, Color.Black); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 0.9f, Color.LightGreen); + GeneralParticleHandler.SpawnParticle(spark2); + if (Main.rand.NextBool() && !Projectile.Calamity().stealthStrike) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278); + dust.noGravity = true; + dust.velocity = Projectile.velocity * randVel; + dust.scale = Main.rand.NextFloat(0.6f, 0.8f); + dust.color = Color.LightGreen; + } + } + if (targetDist < 1400f && time % 3 == 0 && !canStick && Projectile.ai[1] == 0) + { + Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(15, 15); + float speed = Main.rand.NextFloat(0.2f, 0.7f); + Particle spark = new AltSparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.8f, Color.Black); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new SparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) + { + Vector2 moveTotarget = (closestTarget.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 16) + Projectile.velocity += moveTotarget * 0.85f; + else + Projectile.velocity *= 0.8f; } } } - } + else if (stuckInTarget) + { + Projectile.rotation = (storedVelocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } + if (Projectile.ai[2] == 0) + { + placementCenter = chosenTarget.Center + placementVelocity * placementDistance + storedVelocity * 2; + Projectile.Center = placementCenter; + + if (Main.rand.NextBool()) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(portalSpot, dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.4f, 0.8f); + dust.velocity = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f) * Utils.GetLerpValue(180, 0, stuckTimer); + dust.noGravity = true; + dust.color = Color.LightGreen; + } + + if (stuckTimer <= 20) + Projectile.scale *= 0.97f; + } + if (closestTarget == null) + closestTarget = Projectile.Center.ClosestNPCAt(2000); + + if (Projectile.Calamity().stealthStrike && time % 20 == 0) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2CircularEdge(450, 450) * Main.rand.NextFloat(0.7f, 1.3f), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1, 5); + clones--; + } + + stuckTimer--; + if (Projectile.ai[2] == 0) + { + if (chosenTarget.life <= 0 || chosenTarget == null) + { + if (clones > 0 && Projectile.Calamity().stealthStrike) + { + for (int i = 0; i < clones; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2CircularEdge(450, 450) * Main.rand.NextFloat(0.7f, 1.3f), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 1, 5); + } + clones = 0; + } + stuckTimer = 0; + } + } + if (stuckTimer <= 0) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + SoundStyle sound = new("CalamityMod/Sounds/Item/MeldExplosion"); + SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.8f }, Projectile.Center); + + Projectile.ai[2] = 0; + Projectile.numHits = 0; + Projectile.scale = 1; + jitter = false; + canDamage = true; + canStick = false; + stuckInTarget = false; + Projectile.extraUpdates = 4; + + Projectile.Center = portalSpot; + + if (closestTarget == null) + Projectile.velocity = (Projectile.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * -16; + else + Projectile.velocity = (Projectile.Center - closestTarget.Center).SafeNormalize(Vector2.UnitX) * -16; + + for (int i = 0; i <= 12; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust2.scale = Main.rand.NextFloat(0.5f, 1.1f); + dust2.velocity = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + dust2.noGravity = true; + dust2.color = Color.LightGreen; + } + + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.85f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1f, 18); + GeneralParticleHandler.SpawnParticle(bolt2); + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); + } + + } + + time++; + + if (collideWithTiles && Collision.SolidCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 68, 4, 4)) // Vanilla tile collision messes with velocity so we use this instead + { + canDamage = false; + if (Projectile.timeLeft > 180) + Projectile.timeLeft = 180; + stuckInGround = true; + + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit1"); + SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.6f) }, Projectile.Center); + Projectile.rotation = storedVelocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); + collideWithTiles = false; + for (int k = 0; k < 8; k++) + { + Vector2 partPos = Projectile.Center + storedVelocity.SafeNormalize(Vector2.UnitX) * 68; + Color colorType = Main.rand.NextBool() ? Color.LightGreen : Color.Black; + Particle spark3 = new GlowOrbParticle(partPos, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), false, 19, Main.rand.NextFloat(0.6f, 1f), colorType, colorType == Color.Black ? false : true, false, colorType == Color.Black ? false : true); + GeneralParticleHandler.SpawnParticle(spark3); + } + + } + + if (Projectile.ai[2] == 0) + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.9f); + Projectile.damage = (int)(Projectile.damage * 0.88f); if (Projectile.damage < 1) - { Projectile.damage = 1; - } - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Projectile.damage /= 2; - if (Projectile.damage < 1) + if (!stuckInTarget && canStick) { - Projectile.damage = 1; + if (Projectile.timeLeft < 600) + Projectile.timeLeft = 600; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + portalSpot = Projectile.Center + Main.rand.NextVector2CircularEdge(350, 350) * Main.rand.NextFloat(0.8f, 1.1f); + SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + for (int i = 0; i <= 11; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center + storedVelocity.SafeNormalize(Vector2.UnitX) * 68 + Main.rand.NextVector2Circular(12, 12), dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.7f, 1.1f); + dust.velocity = storedVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 2.1f); + dust.noGravity = true; + dust.color = Color.LimeGreen; + } + } + + if (!canStick) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/MeldSlice"); + SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = 0.4f }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/Item/ExobladeBeamSlash"); + SoundEngine.PlaySound(sound2 with { Volume = 0.15f, Pitch = 0.7f }, Projectile.Center); } } + public override bool PreDraw(ref Color lightColor) + { + Player Owner = Main.player[Projectile.owner]; + if (time <= 4) + return false; + Asset tex = ModContent.Request(Texture); + Asset tex2 = ModContent.Request("CalamityMod/Items/Weapons/Rogue/ShardofAntumbraGhost"); + Asset portal = ModContent.Request("CalamityMod/Particles/Light"); + float alpha = Utils.GetLerpValue(255, 0, Projectile.alpha); + float fading = stuckInTarget ? Utils.GetLerpValue(0, 180, stuckTimer) : 0.5f; + float portalFading = Utils.GetLerpValue(75, 0, stuckTimer, true); + + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + Vector2 portalDrawPos = portalSpot - Main.screenPosition; + + if (jitter && stuckInTarget) + { + Main.EntitySpriteDraw(tex2.Value, generalDrawPos + (shadowPlacement * (1 - fading)), null, Color.Black * alpha, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, storedVelocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(tex2.Value, generalDrawPos + (-shadowPlacement * (1 - fading)), null, Color.Black * alpha, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, storedVelocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); + + Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.Black * (1 - fading * 0.3f), 0, portal.Size() * 0.5f, 1.8f * portalFading, SpriteEffects.None); + Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.LightGreen with { A = 0 } * (1 - fading), 0, portal.Size() * 0.5f, 1.1f * portalFading, SpriteEffects.None); + Vector2 expectedVel = ((closestTarget == null ? Owner.Calamity().mouseWorld : closestTarget.Center) - portalSpot).SafeNormalize(Vector2.UnitX); + if (true) + { + for (int i = 0; i < 4; i++) + { + Main.EntitySpriteDraw(tex2.Value, portalDrawPos, null, Color.LightGreen with { A = 0 } * portalFading * 0.7f, expectedVel.ToRotation() + MathHelper.ToRadians(45f * (expectedVel.X > 0 ? 1 : -1)), tex2.Size() * 0.5f, (1 - (i * 0.05f)) * (1 - fading), expectedVel.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); + } + } + } + else if (stuckInTarget) + Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.Black * (1 - fading * 0.3f), 0, portal.Size() * 0.5f, 1.5f * portalFading, SpriteEffects.None); + + if (!canStick || stuckInTarget) + { + for (int i = 0; i < 4; i++) + { + Color auraColor = Color.Lerp(Color.LightGreen, Color.White, Utils.GetLerpValue(0, 4, i)) * (1 - fading); + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f + (!canStick ? 1.5f : 0)); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, (auraColor * alpha) with { A = 0 }, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, storedVelocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); + } + } + + Main.EntitySpriteDraw(tex.Value, generalDrawPos, null, lightColor * alpha * (stuckInTarget ? fading : 1), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, storedVelocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); + if (stuckInTarget) + { + Main.EntitySpriteDraw(tex2.Value, generalDrawPos, null, Color.LightGreen with { A = 0 } * alpha * (1 - fading) * 0.7f, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, storedVelocity.X > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically); + for (int i = 0; i < 3; i++) + { + Main.EntitySpriteDraw(portal.Value, portalDrawPos, null, Color.LightGreen with { A = 0 } * (1 - fading * 0.3f) * 0.7f, 0, portal.Size() * 0.5f, (0.8f - (i * 0.15f)) * portalFading, SpriteEffects.None); + } + } + return false; + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 68, Projectile.ai[1] == 1 ? 60 : 20, targetHitbox); } } diff --git a/Projectiles/Rogue/AshenStalactiteDebris.png b/Projectiles/Rogue/AshenStalactiteDebris.png index c19bebc35f..8afd326680 100644 Binary files a/Projectiles/Rogue/AshenStalactiteDebris.png and b/Projectiles/Rogue/AshenStalactiteDebris.png differ diff --git a/Projectiles/Rogue/AshenStalagmiteProj.png b/Projectiles/Rogue/AshenStalagmiteProj.png index 2f1751aaa4..4f22b80bf9 100644 Binary files a/Projectiles/Rogue/AshenStalagmiteProj.png and b/Projectiles/Rogue/AshenStalagmiteProj.png differ diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index e4faf91f2e..c1850724fa 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -17,13 +17,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = 2; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + AIType = ProjectileID.ThrowingKnife; + Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; - AIType = ProjectileID.ThrowingKnife; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 7; } public override void AI() diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index b01506837b..f14f4858d9 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; //Projectile.aiStyle = ProjAIStyleID.StickProjectile; diff --git a/Projectiles/Rogue/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index fff8a5a9d5..7ff1767715 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.aiStyle = ProjAIStyleID.StickProjectile; diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 7ab9e7cc56..a6aa89de0b 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -1,5 +1,9 @@ using System; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -10,204 +14,125 @@ namespace CalamityMod.Projectiles.Rogue public class DestructionBolt : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int dustType = 191; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10; - ProjectileID.Sets.TrailingMode[Projectile.type] = 1; - } - + public ref float time => ref Projectile.ai[0]; + public float CenterX; + public float CenterY; + public float MouseX; + public float MouseY; + public int timerOffset; public override void SetDefaults() { Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.alpha = 255; - Projectile.timeLeft = 300; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; } public override void AI() { - if (Main.rand.NextBool(8)) + Player Owner = Main.player[Projectile.owner]; + Projectile.velocity *= 0.99f; + if (time == 0) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + MouseX = Projectile.Center.X; + MouseY = Projectile.Center.Y; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + timerOffset = (int)(60 - Projectile.ai[1] * 15); + time += timerOffset; + } + if (time == 180 + timerOffset) + { + MouseX = Owner.Calamity().mouseWorld.X; + MouseY = Owner.Calamity().mouseWorld.Y; + } + else if (time < 180) + { + MouseX = Projectile.Center.X; + MouseY = Projectile.Center.Y; + } + if (time >= (180 - timerOffset)) + { + if (time == (180 + timerOffset)) + { + CenterX = Projectile.Center.X; + CenterY = Projectile.Center.Y; + } + if (time >= 180 + timerOffset) + { + Projectile.velocity = Vector2.Zero; + Projectile.rotation = Projectile.rotation.AngleLerp((new Vector2(MouseX, MouseY) - Projectile.Center).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2, 0.2f); + Projectile.Center = new Vector2(MathHelper.Lerp(CenterX, MouseX, Utils.GetLerpValue(180 + timerOffset, 300, time, true)), MathHelper.Lerp(CenterY, MouseY, Utils.GetLerpValue(180 + timerOffset, 300, time, true))); + } + } + else + { + Projectile.rotation = Projectile.rotation.AngleLerp(Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.08f); } - if (Projectile.alpha > 0) - Projectile.alpha -= 8; + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15, 15), Main.rand.NextBool(6) ? 278 : 263, -Projectile.velocity); + dust.scale = dust.type == 278 ? Main.rand.NextFloat(0.3f, 0.6f) : Main.rand.NextFloat(0.6f, 1.4f); + dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - - float constant = 5f; - float scaleFactor = 6f; - if (Projectile.ai[1] == 0f) - { - Projectile.ai[1] = 1f; - Projectile.localAI[0] = (float)-(float)Main.rand.Next(48); - } - else if (Projectile.ai[1] == 1f && Projectile.owner == Main.myPlayer) - { - if (Projectile.alpha < 128) - { - int index = -1; - float otherConstant = 300f; - foreach (NPC n in Main.ActiveNPCs) - { - if (n.CanBeChasedBy(Projectile, false)) - { - Vector2 npcCenter = n.Center; - float targetDist = Vector2.Distance(npcCenter, Projectile.Center); - if (targetDist < otherConstant && index == -1 && Collision.CanHitLine(Projectile.Center, 1, 1, npcCenter, 1, 1)) - { - otherConstant = targetDist; - index = n.whoAmI; - } - } - } - if (otherConstant < 4f) - { - Projectile.Kill(); - return; - } - if (index != -1) - { - Projectile.ai[1] = constant + 1f; - Projectile.ai[0] = (float)index; - Projectile.netUpdate = true; - } - } - } - else if (Projectile.ai[1] > constant) - { - Projectile.ai[1] += 1f; - int otherIndex = (int)Projectile.ai[0]; - if (!Main.npc[otherIndex].active || !Main.npc[otherIndex].CanBeChasedBy(Projectile, false)) - { - Projectile.ai[1] = 1f; - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - else - { - Projectile.velocity.ToRotation(); - Vector2 enemyCenterDist = Main.npc[otherIndex].Center - Projectile.Center; - if (enemyCenterDist.Length() < 10f) - { - Projectile.Kill(); - return; - } - if (enemyCenterDist != Vector2.Zero) - { - enemyCenterDist.Normalize(); - enemyCenterDist *= scaleFactor; - } - Projectile.velocity = (Projectile.velocity * 29f + enemyCenterDist) / 30f; - } - } - if (Projectile.ai[1] >= 1f && Projectile.ai[1] < constant) - { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] == constant) - { - Projectile.ai[1] = 1f; - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] == 48f) - { - Projectile.localAI[0] = 0f; - } + time++; + if (time >= 300) + Projectile.Kill(); } - - public override bool PreDraw(ref Color lightColor) + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); - return false; + modifiers.SourceDamage *= 0.02f; } - - public override bool? CanDamage() - { - return Projectile.alpha < 128 ? null : false; - } - public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 50; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 20; j++) + if ((Projectile.ai[1] >= 4 && Projectile.ai[2] == 0) || (Projectile.ai[1] == 4 && Projectile.ai[2] == 15)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 5, Projectile.owner); + if (Projectile.ai[2] >= 1) { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + proj.Calamity().stealthStrike = true; + proj.timeLeft = 240; } - } - for (int k = 0; k < 45; k++) - { - int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[dusty].noGravity = true; - Main.dust[dusty].velocity *= 5f; - dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[dusty].velocity *= 2f; - } - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 9; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + for (int i = 0; i < 2; i++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - 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; + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false); + GeneralParticleHandler.SpawnParticle(blastRing); } } + else + { + for (int i = 0; i < 3; i++) + { + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.25f, Projectile.ai[1] * 0.2f, 10, false); + GeneralParticleHandler.SpawnParticle(blastRing); + } + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Asset tex2 = ModContent.Request("CalamityMod/Projectiles/Rogue/DestructionBoltGhost"); + Asset tex3 = ModContent.Request("CalamityMod/Particles/BloomCircle"); + float fading = Utils.GetLerpValue(180, 90, time, true); + float fading2 = Utils.GetLerpValue(240, 180, time, true); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * fading, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + for (int i = 0; i < 2; i++) + { + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * (1 - fading) * fading2, Projectile.rotation, tex2.Size() / 2f, Projectile.scale * fading2, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex3.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * (1 - fading2), Projectile.rotation, tex3.Size() / 2f, Projectile.scale / 3, SpriteEffects.None, 0); + } + return false; } } } diff --git a/Projectiles/Rogue/DestructionBoltGhost.png b/Projectiles/Rogue/DestructionBoltGhost.png new file mode 100644 index 0000000000..c49df60163 Binary files /dev/null and b/Projectiles/Rogue/DestructionBoltGhost.png differ diff --git a/Projectiles/Rogue/DestructionExplosion.cs b/Projectiles/Rogue/DestructionExplosion.cs new file mode 100644 index 0000000000..d20d58abca --- /dev/null +++ b/Projectiles/Rogue/DestructionExplosion.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DestructionExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private float ExplosionRadius = 400f; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 200; + Projectile.height = 200; + Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + public override void AI() + { + if (Projectile.ai[0] == 1) + ExplosionRadius = 800; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.88f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); + } +} diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index a757048966..308432534e 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -1,9 +1,10 @@ using System; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -12,74 +13,219 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/StarofDestruction"; - - public int hitCount = 0; - private static float Radius = 47f; - + public ref float time => ref Projectile.ai[0]; + private float Radius = 47f; + public float fade = 0; + public int beepTimerMax = 50; + public int beepTimer = 0; + public int stealthHitCooldown = 0; + public bool makeReadySound = false; + public int rotDirection = 1; + public float rot = 0.01f; + public bool setRot = true; public override void SetDefaults() { Projectile.width = 94; Projectile.height = 94; Projectile.friendly = true; - Projectile.penetrate = 16; + Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 5; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 25; } - public override void AI() { - if (Main.rand.NextBool(8)) + if (setRot) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.SpookyWood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + rotDirection = Main.rand.NextBool() ? 1 : -1; + setRot = false; } - Projectile.rotation += Math.Sign(Projectile.velocity.X) * MathHelper.ToRadians(8f); - if (Projectile.Calamity().stealthStrike || hitCount > 16) - hitCount = 16; - } + Projectile.rotation += rot; + rot += (Utils.Remap(Projectile.timeLeft, 0, 240, 0.02f, 0.0015f)) * rotDirection; + Player Owner = Main.player[Projectile.owner]; + Vector2 moveToMouse = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.numHits == 0 || Projectile.Calamity().stealthStrike) + { + if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 18 : 13) && time > 8) + Projectile.velocity += moveToMouse * (Projectile.Calamity().stealthStrike ? 0.8f : 0.4f); + else if (time > 8) + Projectile.velocity *= 0.9f; + + if (Projectile.velocity.Length() > 3 && Main.rand.NextBool()) + { + Vector2 placement = Projectile.Center + Main.rand.NextVector2Circular(70, 70); + float speed = Main.rand.NextFloat(0.9f, 1.9f); + Particle spark = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 11, 0.8f, Color.Black, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new GlowOrbParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen, true, false, true); + GeneralParticleHandler.SpawnParticle(spark2); + } + + fade = MathHelper.Lerp(fade, 0, 0.088f); + if (Projectile.timeLeft < 240) + { + if (beepTimer >= beepTimerMax) + { + beepTimerMax = (int)(beepTimerMax * 0.81f); + fade = 1; + rot *= -0.8f; + rotDirection *= -1; + SoundStyle sound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort"); + SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.7f * Utils.GetLerpValue(240, 0, Projectile.timeLeft, true) }, Projectile.Center); + beepTimer = 0; + } + beepTimer++; + } + } + else if (!Projectile.Calamity().stealthStrike) + { + fade = 0; + Projectile.velocity = Vector2.Zero; + if (time == 8) + Projectile.Kill(); + } + //if (Projectile.Calamity().stealthStrike) + + time++; + if (stealthHitCooldown > 0) + stealthHitCooldown--; + + if (Projectile.Calamity().stealthStrike && Projectile.numHits > 0) + { + Projectile.velocity = Vector2.Zero; + if (time == 8) + { + Projectile.numHits = 0; + stealthHitCooldown = 45; + makeReadySound = true; + Explode(false); + + Projectile.velocity += moveToMouse * 30; + } + } + if (stealthHitCooldown == 0 && makeReadySound) + { + SoundStyle explo2 = new("CalamityMod/Sounds/Item/DeadSunRicochet"); + SoundEngine.PlaySound(explo2 with { Volume = 0.7f, Pitch = 0.2f }, Projectile.Center); + for (int i = 0; i <= 15; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle, Projectile.velocity); + dust.scale = Main.rand.NextFloat(0.8f, 1f); + dust.velocity = new Vector2(13, 13).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f); + dust.noGravity = true; + dust.color = Color.LightGreen; + } + makeReadySound = false; + } + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - hitCount++; + time = 0; + SoundStyle sound = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = -0.4f }, Projectile.Center); + + Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 3, 0f, 12, false); + GeneralParticleHandler.SpawnParticle(orb7); + } + public override void OnKill(int timeLeft) + { + if (!Projectile.Calamity().stealthStrike) + Explode(false); + else + Explode(true); + } - public override void OnHitPlayer(Player target, Player.HurtInfo info) + internal void Explode(bool big) { - hitCount++; + float sizeBonus = big ? 2 : 1; + float bigExplosionDamage = 1f; + Player Owner = Main.player[Projectile.owner]; + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); + GeneralParticleHandler.SpawnParticle(orb2); + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.4f : 0.8f)), Projectile.knockBack * 1.5f, Projectile.owner); + SoundStyle explo = new("CalamityMod/Sounds/Item/MeldExplosion"); + SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); + if (big) + { + SoundStyle explo2 = new("CalamityMod/Sounds/Item/EarthMeteor"); + SoundEngine.PlaySound(explo2 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center); + + SoundStyle explo3 = new("CalamityMod/Sounds/Item/ExobladeDashImpact"); + SoundEngine.PlaySound(explo3 with { Volume = 0.9f, Pitch = -0.2f }, Projectile.Center); + } + + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18); + GeneralParticleHandler.SpawnParticle(bolt2); + + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30); + GeneralParticleHandler.SpawnParticle(bolt3); + + Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30); + GeneralParticleHandler.SpawnParticle(bolt4); + + for (int i = 0; i < 2; i++) + { + Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), (2.2f + i * 0.5f) * sizeBonus, 0f, 80, false); + GeneralParticleHandler.SpawnParticle(orb7); + } + for (int i = 0; i < 12; i++) + { + Particle spark3 = new GlowOrbParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus, false, 25, Main.rand.NextFloat(0.8f, 1.5f) * sizeBonus, Color.LightGreen, true, false, false); + GeneralParticleHandler.SpawnParticle(spark3); + Particle spark4 = new GlowOrbParticle(Projectile.Center, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1f) * sizeBonus, false, 25, Main.rand.NextFloat(0.8f, 1.5f) * sizeBonus, Color.Black, false, false, false); + GeneralParticleHandler.SpawnParticle(spark4); + } + for (int i = 0; i < (25 * sizeBonus); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278); + dust.noGravity = false; + dust.velocity = new Vector2(18, 18).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f) * sizeBonus; + dust.scale = Main.rand.NextFloat(0.8f, 1.2f); + dust.color = Color.LightGreen; + } + Owner.Calamity().GeneralScreenShakePower = 6f * (big ? 2.5f : 1f); } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } + Asset tex = ModContent.Request(Texture); + Asset tex2 = ModContent.Request("CalamityMod/Items/Weapons/Rogue/StarofDestructionGhost"); + Asset portal = ModContent.Request("CalamityMod/Particles/BloomCircle"); - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Vector2 vector2 = new Vector2(20f, 20f); - for (int index1 = 0; index1 < 10; ++index1) + if (Projectile.Calamity().stealthStrike) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); - Dust dust = Main.dust[index2]; - dust.velocity = dust.velocity * 1.4f; + Main.EntitySpriteDraw(portal.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * Utils.GetLerpValue(45, 0, stealthHitCooldown), 0, portal.Size() * 0.5f, 1.1f * Utils.GetLerpValue(45, 0, stealthHitCooldown), SpriteEffects.None); } - if (Projectile.owner == Main.myPlayer) + for (int i = 0; i < 3; i++) { - if (hitCount < 4) - hitCount = 4; - for (int i = 0; i < hitCount; i++) + Color auraColor = Color.Black; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f); + Vector2 rotationalDrawOffset2 = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset2 *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 6f) * 0.5f - 2); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + for (int b = 0; b < 2; b++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset2, null, Color.LightGreen with { A = 0 }, Projectile.rotation, tex2.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } } + + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - Main.screenPosition, null, Color.LightGreen with { A = 0 } * fade, Projectile.rotation, tex2.Size() / 2f, Projectile.scale * 1.1f, SpriteEffects.None, 0); + return false; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + public override bool? CanDamage() => stealthHitCooldown > 0 ? false : Projectile.numHits > 0 ? false : null; } } diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 278b40b93e..7e2cecaddf 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -74,13 +75,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.Frostburn2, 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 150); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Frostburn2, 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 150); } diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 75a7cede89..343c1c80c2 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -70,9 +71,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 4ae1e85156..d040baf46a 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.WoodenBoomerang; Projectile.coldDamage = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -55,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { if (explosionCount < 3) //max amount of explosions to prevent worm memes { - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; explosionCount++; @@ -85,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Calamity().stealthStrike) { //no explosion count cap in pvp - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index 42621db550..d63bb9830f 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.tileCollide = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 50; + Projectile.timeLeft = 25; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index d83ea2dff3..33fe5a4944 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue Vector2 velocity = Projectile.DirectionFrom(Main.player[Projectile.owner].Center); velocity *= Main.rand.NextFloat(4.5f, 6.5f); velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI * 0.5, default); - int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, -10f, 1f); + int spike = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); if (spike.WithinBounds(Main.maxProjectiles)) Main.projectile[spike].DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index ae1f678100..4c6a02c5c7 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; @@ -51,6 +52,11 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Vortex, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override void OnKill(int timeLeft) { if (lunarEnhance) diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index ae0d6d85fb..588a14db6c 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -14,11 +14,12 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 2; + Main.projFrames[Projectile.type] = 3; } public override void SetDefaults() { + Projectile.frame = 1; Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; @@ -48,9 +49,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.frame++; Projectile.frameCounter = 0; } - if (Projectile.frame > 1) + if (Projectile.frame > 2) { - Projectile.frame = 0; + Projectile.frame = 1; } } diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index ea2a217ec1..380d4a6bc8 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -55,13 +55,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); + target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); OnHitEffects(); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); + target.AddBuff(ModContent.BuffType(), Projectile.timeLeft); OnHitEffects(); } diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index 6d51909b88..a33e54ff06 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index fad89f3222..e45644d91c 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -96,9 +96,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Rogue/RadiationBurst.cs b/Projectiles/Rogue/RadiationBurst.cs new file mode 100644 index 0000000000..36ae2c6f25 --- /dev/null +++ b/Projectiles/Rogue/RadiationBurst.cs @@ -0,0 +1,93 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RadiationBurst : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC targetedNPC; + public int time = 0; + public int boomTime = 50; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 6; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = boomTime + 2; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time < boomTime) + { + float fade = Utils.GetLerpValue(boomTime + 3, 0, time); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new GlowOrbParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, (int)(14 - (5 * fade)), Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; + } + } + if (time == boomTime && targetDist < 1400) + { + for (int i = 0; i <= 30; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 278 : (int)CalamityDusts.SulphurousSeaAcid, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(0.9f, 1.3f)); + dust.noGravity = true; + if (dust.type == 278) + { + dust.noGravity = false; + dust.color = Color.Chartreuse; + } + else + dust.scale *= 1.5f; + + } + for (int i = 0; i < 3; i++) + { + Particle Smear = new CustomPulse(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 18, Projectile.velocity, Color.Chartreuse * 0.7f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-5, 5), 0, 0.25f + i * 0.11f, 18 - i * 3); + GeneralParticleHandler.SpawnParticle(Smear); + } + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1.5f, 0.5f, 32); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 1f, 0.2f, 32); + GeneralParticleHandler.SpawnParticle(orb2); + + Owner.Calamity().GeneralScreenShakePower = 3.5f; + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => time >= boomTime ? CalamityUtils.CircularHitboxCollision(Projectile.Center, 350, targetHitbox) : false; + } +} diff --git a/Projectiles/Rogue/RadiationRain.cs b/Projectiles/Rogue/RadiationRain.cs new file mode 100644 index 0000000000..fec93913a9 --- /dev/null +++ b/Projectiles/Rogue/RadiationRain.cs @@ -0,0 +1,113 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RadiationRain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC targetedNPC; + public int time = 0; + public Vector2 spawnSpot; + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 10; + Projectile.timeLeft = 200; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + Projectile.ArmorPenetration = 30; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + if (time == 0) + { + float orbScale = 0.6f * Main.rand.NextFloat(0.8f, 1.1f); + Color smokeColor = Color.Lerp(Color.DimGray, Color.DarkGreen, Main.rand.NextFloat(0.2f, 0.6f)); + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor * 0.7f, "CalamityMod/ExtraTextures/GreyscaleVortex", new Vector2(1, 1), Projectile.ai[2] * 0.45f, orbScale, orbScale * 1.1f, 12, false); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.8f, 0.4f, 18); + GeneralParticleHandler.SpawnParticle(orb3); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.4f, 0.2f, 18); + GeneralParticleHandler.SpawnParticle(orb2); + + for (int i = 0; i < 2; i++) + { + int dir = (i == 0 ? 1 : -1); + Particle pulse3 = new GlowSparkParticle(Projectile.Center + new Vector2(20 * dir, 0), new Vector2(10 * dir, 0), false, 12, 0.087f, Color.Chartreuse, new Vector2(1.7f, 0.8f), true, true, 0.8f); + GeneralParticleHandler.SpawnParticle(pulse3); + } + + for (int i = 0; i < 3; i++) + { + smokeColor = Color.Lerp(Color.DimGray, Color.DarkGreen, Main.rand.NextFloat(0.2f, 0.6f)); + Particle smoke = new HeavySmokeParticle(Projectile.Center, new Vector2(27, 27).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), smokeColor, Main.rand.Next(25, 40 + 1), Main.rand.NextFloat(0.7f, 1.3f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: false); + GeneralParticleHandler.SpawnParticle(smoke); + } + spawnSpot = Projectile.Center; + + targetedNPC = Projectile.Center.ClosestNPCAt(1200); + if (targetedNPC != null) + Projectile.velocity = (targetedNPC.Center - Projectile.Center + targetedNPC.velocity * 1.5f).SafeNormalize(Vector2.UnitX) * 8; + else + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * 8; + } + + if (targetDist < 1400 && time > 5) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Main.rand.NextVector2Circular(70, 70), Projectile.velocity * Main.rand.NextFloat(1.5f, 5f), false, 2, Main.rand.NextFloat(0.04f, 0.06f), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0.2f, 1f)), new Vector2(0.2f * (3 * Utils.GetLerpValue(40, 0, time, true) + 1), 1.5f), true, false, 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + if (time % 6 == 0) + { + Particle spark2 = new AltLineParticle(Projectile.Center + Main.rand.NextVector2Circular(70, 70), Projectile.velocity * Main.rand.NextFloat(4.5f, 9f), false, 12, Main.rand.NextFloat(0.9f, 1.1f) * (2 * Utils.GetLerpValue(40, 0, time, true) + 1), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0.2f, 1f))); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % 4 == 0) + { + Dust c = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(70, 70), 267); + c.velocity = Projectile.velocity * Main.rand.NextFloat(0.5f, 3f); + c.scale = Main.rand.NextFloat(0.45f, 0.75f); + c.noGravity = true; + c.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : Color.Chartreuse, 0.7f); + c.noLight = true; + c.noLightEmittence = true; + } + } + if (time % 10 * Projectile.MaxUpdates == 0) + { + Owner.Calamity().GeneralScreenShakePower = 1.5f; + } + + if (Projectile.ai[2] > 0 && time == 30) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnSpot, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage), 0f, Projectile.owner, 0, 0, Projectile.ai[2] - 1); + + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 60, targetHitbox); + } +} diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index b1f15611b0..4081ba6f1e 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,22 +1,39 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Rogue { public class ReaperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public int time = 0; + public int ChargeupTime = 56; + public int Lifetime = 500; + public bool spinning = false; public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheOldReaper"; + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + public Player Owner => Main.player[Projectile.owner]; + public SlotId SpinSoundSlot; + + Vector2 squash = Vector2.One; public override void SetStaticDefaults() { @@ -33,168 +50,242 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.extraUpdates = 2; - Projectile.timeLeft = Projectile.MaxUpdates * 120; + Projectile.timeLeft = Lifetime + ChargeupTime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 9; // can't hit too fast, but can hit many many times + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; Projectile.DamageType = RogueDamageClass.Instance; } + public override bool ShouldUpdatePosition() + { + return ChargeProgress >= 1; + } + + public override bool? CanDamage() + { + //We don't want the anticipation to deal damage. + if (ChargeProgress < 1) + return false; + + return base.CanDamage(); + } + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); public override void AI() { - Projectile.rotation += 0.4f; - if (Projectile.soundDelay == 0) + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound) && SpinSound.IsPlaying) + SpinSound.Position = Projectile.Center; + + //Anticipation animation. Make the player look like theyre holding the weapon + if (ChargeProgress < 1) { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = Owner.direction; + Projectile.direction = Owner.direction; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -70f * Owner.gravDir + new Vector2(14 * Owner.direction, 0); + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + time++; + return; } - if (Projectile.localAI[0] == 0f) + + //Play the throw sound when the throw ACTUALLY BEGINS. + //Additionally, make the projectile collide and set its speed and velocity + if (Projectile.timeLeft == Lifetime) { - Projectile.ai[1] += 1f; + Projectile.netUpdate = true; - // If the Reaper lands a hit, switch to second behavior mode immediately. - if (Projectile.ai[1] >= 60f || Projectile.numHits > 0) + SoundStyle fire = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center); + + Projectile.Center = Owner.MountedCenter + Projectile.velocity * 4f; + if (Projectile.Calamity().stealthStrike) { - Projectile.localAI[0] = 1f; - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; + Projectile.velocity = new Vector2(0.5f * Owner.direction, -1) * 18; } - - // Initial homing before landing a hit. else - CalamityUtils.HomeInOnNPC(Projectile, true, 250f, 14f, 14f); + { + Projectile.velocity = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; + } + Projectile.spriteDirection = Projectile.direction; + SpinSoundSlot = SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/SpinningWoosh") with { Pitch = -0.3f, Volume = 0.75f }, Projectile.Center); + + time = 0; + spinning = true; } - // Homing after landing a hit. This homing repeatedly turns on and off. + if (Projectile.velocity.X > 0) + Projectile.direction = 1; else + Projectile.direction = -1; + + if (spinning) { - float homingRange = 1100f; //tbh 700 works for fat targets but then we'll get so many bug reports cuz it doesnt work on dummies - bool noHomingThisFrame = false; - if (Projectile.ai[0] == 1f) + if (Projectile.velocity.Length() < 15) + Projectile.velocity *= 1.01f; + if (time == 0) + Projectile.rotation += Main.rand.NextFloat(0, 10) * Projectile.direction; + squash = new Vector2(1.3f, 0.8f); + Projectile.rotation += 0.2f * Projectile.direction; + + if (targetDist < 1400) { - Projectile.ai[1] += 1f; - if (Projectile.ai[1] > 30f) + for (int i = 0; i < 2; i++) { - Projectile.ai[1] = 0f; - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; + float rot = Main.rand.NextFloat(-5.5f, 5.5f); + float scale = Main.rand.NextFloat(1f, 1.15f); + Particle Smear = new CustomPulse(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 18, Projectile.velocity, Color.Chartreuse * Main.rand.NextFloat(0.68f, 0.75f), "CalamityMod/Particles/CircularSmearSmokey", squash.RotatedBy(rot), Projectile.velocity.ToRotation() + MathHelper.ToRadians(150f) - rot, scale, scale, 3); + GeneralParticleHandler.SpawnParticle(Smear); + } + + if (time % 7 == 0) + { + Particle trail = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(80, 80), -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f), false, 60, Main.rand.NextFloat(0.9f, 1.5f), Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(trail); + } + for (int i = 0; i < 2; i++) + { + float rot2 = (Projectile.rotation * Projectile.direction); + Vector2 dustPos = Projectile.Center + (i * MathHelper.Pi + Projectile.rotation * 0.3f + MathHelper.PiOver2).ToRotationVector2() * 70f; + Dust dust = Dust.NewDustPerfect(dustPos, 267); + dust.noGravity = true; + dust.scale = 0.8f; + dust.color = Color.Chartreuse; + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.45f, 0.6f); + } + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(23, 23), Main.rand.NextBool(7) ? 28 : 215); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); } - else - noHomingThisFrame = true; } - if (noHomingThisFrame) - return; - - Vector2 homingTarget = Projectile.Center; - bool foundTarget = false; - Vector2 targetVelocity = new Vector2(0f); - foreach (NPC potentialTarget in Main.ActiveNPCs) + if (Projectile.Calamity().stealthStrike) { - if (potentialTarget.CanBeChasedBy(Projectile, false) && Projectile.WithinRange(potentialTarget.Center, homingRange)) + if (time == 30) { - if (!foundTarget) + SpinSound?.Stop(); + SoundStyle fire = new("CalamityMod/Sounds/Item/RadiationBurst"); + SpinSoundSlot = SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0.3f }, Projectile.Center); + } + if (time >= 150) + { + NPC target = Owner.Calamity().mouseWorld.ClosestNPCAt(4000); + if (time == 150) { - homingRange = Vector2.Distance(Projectile.Center, potentialTarget.Center); - homingTarget = potentialTarget.Center; - targetVelocity = potentialTarget.velocity; - foundTarget = true; - break; + Projectile.extraUpdates = 25; + } + if (target != null) + { + if (Projectile.numHits <= 0 && Projectile.velocity.Length() < 15) + Projectile.velocity += (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX) * 0.9f; + else if (Projectile.numHits <= 0) + Projectile.velocity *= 0.9f; + } + else if (time == 150) + { + Projectile.velocity = (Owner.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX * Owner.direction) * 15; + } + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 7, 0.13f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + else if (time > 30) + { + Projectile.velocity *= 0.955f; + float fade = Utils.GetLerpValue(150, 0, time); + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + for (int i = 0; i < numberOfDusts; i++) + { + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f); + velOffset *= Main.rand.NextFloat(25, 45) * fade; + Particle energy = new GlowOrbParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, (int)(14 - (5 * fade)), Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Color.Chartreuse); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f)); + dust.noGravity = true; + dust.color = Color.Chartreuse; } } } - - - if (foundTarget && Projectile.ai[0] == 0f) - { - bool perfectAim = Main.rand.NextBool(3); - if (perfectAim) - Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, homingTarget, targetVelocity, Main.rand.NextFloat(18f, 20f)); - else - { - float angularTurnSpeed = 0.35f; - float angleToTargetCoords = Projectile.AngleTo(homingTarget); - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(angleToTargetCoords, angularTurnSpeed).ToRotationVector2() * Main.rand.NextFloat(18f, 20f); - } - } - - if (Projectile.ai[1] > 0f) - Projectile.ai[1] += (float)Main.rand.Next(1, 5); - if (Projectile.ai[1] > 30f) - { - Projectile.ai[1] = 0f; - Projectile.netUpdate = true; - } - - if (Projectile.ai[0] == 0f) - { - if (Projectile.ai[1] == 0f && foundTarget && homingRange < 500f) - { - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner) - Projectile.ai[0] = 1f; - } - } } - } - public override bool PreDraw(ref Color lightColor) + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.ai[0] == 1) + if (Projectile.Calamity().stealthStrike && time <= 151) + Projectile.numHits--; + if (Projectile.numHits == 0) { - //Glowing - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1.64f, 0.8f, 0.5f)); //Using RGB directly fails, gotta use HSL - float opacityFactor = Projectile.ai[1] - 5; - if (opacityFactor < 0f) - opacityFactor = 0f; - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(opacityFactor / 40f); - GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - Main.spriteBatch.ExitShaderRegion(); + if (Projectile.Calamity().stealthStrike) // Rainstorm + { + Vector2 rainSpot = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 490; + SoundStyle fire = new("CalamityMod/Sounds/Item/RadiationRain"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0 }, rainSpot); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/ViperSpit"); + SoundEngine.PlaySound(fire2 with { Volume = 1f, Pitch = -0.3f }, rainSpot); + for (int i = 0; i < 37; i++) + { + Dust chargefull = Dust.NewDustPerfect(rainSpot, 278); + chargefull.velocity = Projectile.velocity.RotatedByRandom(100) * Main.rand.NextFloat(1, 8); + chargefull.scale = Main.rand.NextFloat(0.45f, 0.75f); + chargefull.noGravity = true; + chargefull.color = Color.Lerp(Color.White, Main.rand.NextBool(4) ? Color.Green : Color.Chartreuse, 0.7f); + } + Particle Smear = new CustomPulse(rainSpot, Vector2.Zero, Color.Chartreuse * 0.7f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(-5, 5), 0, 0.35f, 12); + GeneralParticleHandler.SpawnParticle(Smear); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), rainSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0, 0, 100); + } + else // Radiation Burst + { + SoundStyle fire = new("CalamityMod/Sounds/Item/RadiationBurst"); + SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0, MaxInstances = -1 }, Projectile.Center); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0); + } } - else - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } + target.AddBuff(ModContent.BuffType(), 90); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); + float minMult = 0.25f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 100; - Projectile.height = 100; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[dust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 8; j++) - { - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity *= 5f; - dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 2f); - Main.dust[dust2].velocity *= 2f; - } + if (SoundEngine.TryGetActiveSound(SpinSoundSlot, out var SpinSound)) + SpinSound?.Stop(); } + public override bool PreDraw(ref Color lightColor) + { + Vector2 drawPos = Projectile.Center - Main.screenPosition; + Asset tex = ModContent.Request(Texture); + Main.EntitySpriteDraw(tex.Value, drawPos, null, spinning ? Color.White : Color.Lerp(lightColor, Color.White, Utils.GetLerpValue(0, ChargeupTime, time, true)), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + Asset p = ModContent.Request("CalamityMod/Particles/VerticalSmear"); + + if (spinning) + { + Main.EntitySpriteDraw(p.Value, drawPos + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4, null, Color.Chartreuse with { A = 0 } * 0.45f, Projectile.velocity.ToRotation() + MathHelper.PiOver2, p.Size() * 0.5f, new Vector2(0.9f - 0.3f * Utils.GetLerpValue(25, 0, time, true), 1 + 0.6f * Utils.GetLerpValue(25, 0, time, true)) * Main.rand.NextFloat(1.25f, 1.4f), SpriteEffects.None); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Chartreuse * 0.5f, 1); + } + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 70, targetHitbox); } } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index e7c66ff3e9..690eabffda 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -1,7 +1,14 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Dusts; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Rogue { @@ -9,29 +16,82 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC targetedNPC; public override void SetDefaults() { Projectile.width = 6; Projectile.height = 6; Projectile.friendly = true; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.penetrate = 1; + Projectile.penetrate = -1; + Projectile.extraUpdates = 3; Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; } public override void AI() { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 1f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 0f; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.ai[1] % 2 == 0 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 5, 0.04f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + + Projectile.rotation += 0.2f; + + targetedNPC = (Projectile.ai[1] > 90) ? Projectile.Center.ClosestNPCAt(1200) : null; + float moveSpeed = Utils.GetLerpValue(200, 0, Projectile.timeLeft); + if (targetedNPC == null) + { + Vector2 position = (Owner.Calamity().mouseWorld + ((new Vector2(0, -250).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); + Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 8) + Projectile.velocity += moveToMouse * (0.7f); + else + Projectile.velocity *= 0.9f; + } + else + { + Vector2 position = targetedNPC.Center; + Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 13 * moveSpeed) + Projectile.velocity += moveToMouse * moveSpeed; + else + Projectile.velocity *= 0.9f; + if (Projectile.ai[1] % 2 == 0) + Projectile.timeLeft++; // Lasts longer if it has a target + } + if (targetedNPC != null && targetedNPC.life <= 0) + targetedNPC = null; + + Projectile.ai[1]++; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); + if (target == targetedNPC) + Projectile.Kill(); } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 40, targetHitbox); } } diff --git a/Projectiles/Rogue/ToxicantTwisterProj.cs b/Projectiles/Rogue/ToxicantTwisterProj.cs new file mode 100644 index 0000000000..34bdbd5884 --- /dev/null +++ b/Projectiles/Rogue/ToxicantTwisterProj.cs @@ -0,0 +1,125 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ToxicantTwisterProj : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ToxicantTwister"; + + private int targetIndex = -1; + public float circleRange = -150; + public float circleSpeed = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 42; + Projectile.height = 46; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 1; + Projectile.timeLeft = 300; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + if (Projectile.Calamity().stealthStrike) + { + Projectile.extraUpdates = 2; + if (Projectile.ai[1] == 0) + { + Projectile.timeLeft = 600; + circleRange *= 5; + circleSpeed *= 3; + } + if (Projectile.timeLeft % 30 == 0) + { + Projectile dustProjectile = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0, 0, Projectile.ai[2]); + dustProjectile.timeLeft = 240; + } + } + + if (Main.rand.NextBool(4) && Projectile.ai[1] > 7) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(13, 13), Main.rand.NextBool(3) ? 215 : (int)CalamityDusts.SulphurousSeaAcid); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.9f, 1.3f) * Utils.GetLerpValue(255, 0, Projectile.alpha); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.7f); + } + + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.ai[1] % 2 == 0 && Projectile.ai[1] > 7 && targetDist < 1400) + { + Particle spark = new GlowSparkParticle(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-2, -1), -Projectile.velocity * 0.3f, false, 6, 0.07f, Color.Lerp(Color.Green, Color.Chartreuse, 0.8f) * 0.65f, new Vector2(1, 0.3f), true, false, 1); + GeneralParticleHandler.SpawnParticle(spark); + } + + // Boomerang rotation + Projectile.rotation += 0.5f / circleSpeed; + + if (Projectile.ai[1] > 20f) + { + Vector2 position = (Owner.Calamity().mouseWorld + ((new Vector2(0, circleRange).RotatedBy(Projectile.rotation * 0.2f)).RotatedBy(MathHelper.ToRadians(90f) * Projectile.ai[2]))); + Vector2 moveToMouse = (position - Projectile.Center).SafeNormalize(Vector2.UnitX); + if (Projectile.velocity.Length() < 18) + Projectile.velocity += moveToMouse * circleSpeed; + else + Projectile.velocity *= 0.9f; + } + else + { + Projectile.velocity *= 0.985f; + } + Projectile.ai[1]++; + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i <= 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 215 : (int)CalamityDusts.SulphurousSeaAcid, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.3f, 1.8f), 0, default, Main.rand.NextFloat(1.3f, 1.8f)); + dust.noGravity = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + + for (int i = 0; i < 3; i++) + { + Color auraColor = Color.Lerp(Color.Chartreuse, Color.Lime, Utils.GetLerpValue(0, 3, i)) * 0.7f; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 27f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 15f) * 0.5f + 1f); + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + rotationalDrawOffset, null, auraColor with { A = 0 } * Utils.GetLerpValue(255, 0, Projectile.alpha), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.3f, 2); + return true; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 55, targetHitbox); + } +} diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs deleted file mode 100644 index 66788be39e..0000000000 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ /dev/null @@ -1,151 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class ToxicantTwisterTwoPointZero : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Items/Weapons/Rogue/ToxicantTwister"; - - private int lifeTime = 300; - private int targetIndex = -1; - - public override void SetDefaults() - { - Projectile.width = 42; - Projectile.height = 46; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.timeLeft = lifeTime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; - } - - public override void AI() - { - if (Projectile.Calamity().stealthStrike) - { - if (Projectile.timeLeft % 20 == 0 && Main.myPlayer == Projectile.owner) - { - for (int i = 0; i < 2; i++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.1f) * -0.6f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), 0f, Projectile.owner); - } - Projectile.rotation += 0.06f * (Projectile.velocity.X > 0).ToDirectionInt(); - } - // Boomerang rotation - Projectile.rotation += 0.4f * Projectile.direction; - - // Boomerang sound - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = 8; - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } - - Projectile.ai[1]++; - if (Projectile.ai[0] != 0f) - { - float returnSpeed = 30f; - float acceleration = 1.4f; - - Player owner = Main.player[Projectile.owner]; - - // Delete the projectile if it's excessively far away. - Vector2 projVector = owner.Center - Projectile.Center; - float dist = projVector.Length(); - if (dist > 3000f) - Projectile.Kill(); - - dist = returnSpeed / dist; - projVector.X *= dist; - projVector.Y *= dist; - - // Home back in on the player. - if (Projectile.velocity.X < projVector.X) - { - Projectile.velocity.X += acceleration; - if (Projectile.velocity.X < 0f && projVector.X > 0f) - Projectile.velocity.X += acceleration; - } - else if (Projectile.velocity.X > projVector.X) - { - Projectile.velocity.X -= acceleration; - if (Projectile.velocity.X > 0f && projVector.X < 0f) - Projectile.velocity.X -= acceleration; - } - if (Projectile.velocity.Y < projVector.Y) - { - Projectile.velocity.Y += acceleration; - if (Projectile.velocity.Y < 0f && projVector.Y > 0f) - Projectile.velocity.Y += acceleration; - } - else if (Projectile.velocity.Y > projVector.Y) - { - Projectile.velocity.Y -= acceleration; - if (Projectile.velocity.Y > 0f && projVector.Y < 0f) - Projectile.velocity.Y -= acceleration; - } - - // Delete the projectile if it touches its owner. - if (Main.myPlayer == Projectile.owner) - if (Projectile.Hitbox.Intersects(owner.Hitbox)) - Projectile.Kill(); - } - else if (Projectile.ai[1] > 40f) - { - NPC closestTarget = Projectile.Center.ClosestNPCAt(1769f, true, true); - if (closestTarget != null) - { - Projectile.extraUpdates = 1; - targetIndex = closestTarget.whoAmI; - float inertia = 20f; - float homingVelocity = Projectile.Calamity().stealthStrike ? 30f : 20f; - Vector2 moveDirection = Projectile.SafeDirectionTo(closestTarget.Center, Vector2.UnitY); - - Projectile.velocity = (Projectile.velocity * inertia + moveDirection * homingVelocity) / (inertia + 1f); - } - } - else - { - Projectile.velocity *= 0.985f; - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.ai[1] <= 40f && Projectile.ai[0] != 1f) - { - modifiers.SourceDamage *= 0.3333f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (targetIndex == target.whoAmI) - Projectile.ai[0] = 1f; - - target.AddBuff(ModContent.BuffType(), 180); - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - Projectile.ai[0] = 1f; - target.AddBuff(ModContent.BuffType(), 180); - SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - for (int k = 0; k < 10; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } - } -} diff --git a/Projectiles/Rogue/WrathwingFireball.cs b/Projectiles/Rogue/WrathwingFireball.cs index ea87dc0f35..2d3428e84c 100644 --- a/Projectiles/Rogue/WrathwingFireball.cs +++ b/Projectiles/Rogue/WrathwingFireball.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue int frameHeight = texture.Height / Main.projFrames[Projectile.type]; int frameY = frameHeight * Projectile.frame; Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/BrimstoneDartMinion.cs b/Projectiles/Summon/BrimstoneDartMinion.cs index ea5ddd301c..60f7c8aee1 100644 --- a/Projectiles/Summon/BrimstoneDartMinion.cs +++ b/Projectiles/Summon/BrimstoneDartMinion.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Other; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -42,6 +43,13 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); } + public override bool? CanHitNPC(NPC target) + { + if (target.type == ModContent.NPCType()) + return false; + return null; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 1e2568e1ea..9ec49d7203 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.Center = Vector2.Lerp(Projectile.Center, idleDestination, 0.15f); AITimer++; - Owner.statDefense += 5; + Owner.statDefense += 4; Projectile.rotation += MoveWidth * 0.2f; } if (!MinionBuffMode && !Reforming) // Minion when ramming diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index b7f2697bdb..1a93a130b9 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -51,14 +51,8 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player player = Main.player[Projectile.owner]; - if ((player.ActiveItem().CountsAsClass() && - !player.ActiveItem().CountsAsClass() && - !player.ActiveItem().CountsAsClass() && - !player.ActiveItem().CountsAsClass() && - !player.ActiveItem().CountsAsClass()) || - player.ActiveItem().hammer > 0 || - player.ActiveItem().pick > 0 || - player.ActiveItem().axe > 0) + Item heldItem = player.ActiveItem(); + if (!CalamityUtils.ShouldTriggerSummonPenalty(player, heldItem)) { int duration = Main.rand.Next(60, 181); // Anywhere between 1 and 3 seconds switch ((int)Projectile.ai[0]) diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/CelestialAxeMinion.cs similarity index 81% rename from Projectiles/Summon/ElementalAxeMinion.cs rename to Projectiles/Summon/CelestialAxeMinion.cs index 18421a635d..ef8d7d91cb 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/CelestialAxeMinion.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class ElementalAxeMinion : ModProjectile, ILocalizedModType + public class CelestialAxeMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() @@ -41,8 +42,8 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - bool isMinion = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); + bool isMinion = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); if (isMinion) { if (player.dead) @@ -57,6 +58,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation += 0.075f; Projectile.ChargingMinionAI(1600f, 1800f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true); + + // Destroy trees in GFB, because it's an axe, and axes should do that + if (Main.zenithWorld) + { + Point pointToCheck = (Projectile.position + Projectile.Size * 0.5f).ToTileCoordinates(); + var prismTooth = new PrismTooth(); // Grrrr CS0120 + prismTooth.AbsolutelyFuckingAnnihilateTrees(pointToCheck.X, pointToCheck.Y); + } } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/ElementalAxeMinion.png b/Projectiles/Summon/CelestialAxeMinion.png similarity index 100% rename from Projectiles/Summon/ElementalAxeMinion.png rename to Projectiles/Summon/CelestialAxeMinion.png diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 311ac275e6..e1b83aa8cb 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; @@ -351,7 +352,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool? CanDamage() => AttackMode == 2; diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index 45fd326ec5..ba3408aa09 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; @@ -145,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool? CanDamage() => AttackMode == 2; diff --git a/Projectiles/Summon/EndoFire.cs b/Projectiles/Summon/EndoFire.cs index 3b40c7d549..5f3687bdb6 100644 --- a/Projectiles/Summon/EndoFire.cs +++ b/Projectiles/Summon/EndoFire.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -104,7 +105,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn2, 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 660a10c5a6..6fdcbd8e02 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon { if (Time % 40f == 24f) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } if (Time % 40f >= 33f) diff --git a/Projectiles/Summon/EndoRay.cs b/Projectiles/Summon/EndoHydraRay.cs similarity index 84% rename from Projectiles/Summon/EndoRay.cs rename to Projectiles/Summon/EndoHydraRay.cs index 7373b166b2..17a8fd6e1b 100644 --- a/Projectiles/Summon/EndoRay.cs +++ b/Projectiles/Summon/EndoHydraRay.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class EndoRay : ModProjectile, ILocalizedModType + public class EndoHydraRay : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -45,5 +46,9 @@ namespace CalamityMod.Projectiles.Summon } } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index 9d87d5f665..4a476027fd 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -125,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Summon/GlacialEmbracePointyThing.cs b/Projectiles/Summon/GlacialEmbracePointyThing.cs index a06cefa7f5..a1535c1d7b 100644 --- a/Projectiles/Summon/GlacialEmbracePointyThing.cs +++ b/Projectiles/Summon/GlacialEmbracePointyThing.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon writer.Write(recharging); writer.Write(circling); writer.Write(circlingPlayer); - writer.Write((double)floatyDistance); + writer.Write(floatyDistance); writer.Write(target is null ? -1 : target.whoAmI); } public override void ReceiveExtraAI(BinaryReader reader) @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Summon recharging = reader.ReadInt32(); circling = reader.ReadBoolean(); circlingPlayer = reader.ReadBoolean(); - floatyDistance = (float)reader.ReadDouble(); + floatyDistance = reader.ReadSingle(); int targ = reader.ReadInt32(); target = targ == -1 ? null : Main.npc[targ]; } diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 94aca8ef17..89aded9c6b 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Summon AfterimageInterpolant = MathHelper.Clamp(AfterimageInterpolant, 0f, 1f); float AfterimageFade = MathHelper.Lerp(0f, 1f, AfterimageInterpolant); - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MidnightSunBeam.cs b/Projectiles/Summon/MidnightSunBeam.cs index 51ec173a6b..f921c8feae 100644 --- a/Projectiles/Summon/MidnightSunBeam.cs +++ b/Projectiles/Summon/MidnightSunBeam.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.timeLeft = TrueTimeLeft; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; + Projectile.localNPCHitCooldown = 15; Projectile.DamageType = DamageClass.Summon; } @@ -173,5 +174,8 @@ namespace CalamityMod.Projectiles.Summon } return false; } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/Projectiles/Summon/MidnightSunShot.cs b/Projectiles/Summon/MidnightSunShot.cs index c67c9fc96f..372bad85f1 100644 --- a/Projectiles/Summon/MidnightSunShot.cs +++ b/Projectiles/Summon/MidnightSunShot.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Summon public class MidnightSunShot : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; + public static int MaxUpdate = 4; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 1; @@ -17,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.width = Projectile.height = 14; Projectile.alpha = 255; - Projectile.MaxUpdates = 3; + Projectile.MaxUpdates = MaxUpdate; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.friendly = true; diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index a7ba26a3cc..fe93e7ab10 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -3,8 +3,10 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -14,12 +16,12 @@ namespace CalamityMod.Projectiles.Summon { public new string LocalizationCategory => "Projectiles.Summon"; public const float DistanceToCheck = 2600f; + public ref float Timer => ref Projectile.ai[0]; public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - ProjectileID.Sets.SentryShot[Projectile.type] = true; } public override void SetDefaults() @@ -83,17 +85,18 @@ namespace CalamityMod.Projectiles.Summon if (potentialTarget != null) { - Projectile.ai[0]++; - if (Projectile.ai[0] % 360f < 180f) + Timer++; + if (Timer % 330f < 180f) { Projectile.rotation = Projectile.rotation.AngleTowards(0f, 0.2f); - float angle = MathHelper.ToRadians(2f * Projectile.ai[0] % 180f); + float angle = MathHelper.ToRadians(2f * Timer % 180f); Vector2 destination = potentialTarget.Center - new Vector2((float)Math.Cos(angle) * potentialTarget.width * 0.65f, 250f); Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(destination) * 24f, 0.03f); - if (Projectile.ai[0] % MidnightSunBeacon.MachineGunRate == Projectile.localAI[0] && potentialTarget.Top.Y > Projectile.Bottom.Y) + if (Timer % MidnightSunBeacon.MachineGunRate == Projectile.localAI[0] && potentialTarget.Top.Y > Projectile.Bottom.Y) { - Vector2 laserVelocity = Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.15f) * 25f; + // Vector2 laserVelocity = Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.05f) * 25f; + Vector2 laserVelocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, potentialTarget, 25f, MidnightSunShot.MaxUpdate).RotatedByRandom(0.04f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Bottom, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } Projectile.MinionAntiClump(0.35f); @@ -102,12 +105,12 @@ namespace CalamityMod.Projectiles.Summon else { // Move very, very quickly above the target. - Vector2 hoverDestination = potentialTarget.Top - Vector2.UnitY * 40f + (Projectile.minionPos + Projectile.ai[0] / 7f).ToRotationVector2() * 40f; + Vector2 hoverDestination = potentialTarget.Top - Vector2.UnitY * 40f + (Projectile.minionPos + Timer / 7f).ToRotationVector2() * 40f; Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.1f).MoveTowards(hoverDestination, 20f); Projectile.velocity = Projectile.velocity.MoveTowards(Vector2.Zero, 4f); Projectile.ai[1] = Math.Abs(hoverDestination.Y - potentialTarget.Bottom.Y) + MathHelper.Lerp(30f, 50f, Projectile.identity % 7f / 7f); - if (Projectile.ai[0] % 360f == 240f) + if (Timer % 330f == 210f) { if (Main.myPlayer == Projectile.owner) { @@ -135,7 +138,21 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Color trailColor = Color.Lerp(drawColor, Color.Transparent, i / (float)Projectile.oldPos.Length); + Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; + Main.EntitySpriteDraw(tex, trailPos, frame, trailColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); + } + } + + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, drawColor, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 26db5b6ad2..7618a2ec74 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -323,9 +323,8 @@ namespace CalamityMod.Projectiles.Summon if (shouldDrawDust) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); var shouldAdjust = !Main.dayTime && buffedAi; - int dustId = ProvUtils.GetDustID(pscState); + int dustId = ProvUtils.GetDustID(!Main.dayTime); for (int i = 0; i < 6; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center + (Projectile.Size / 2f).RotatedBy(Projectile.rotation), dustId); diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 7f05149aa0..ff490d34a0 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = new Vector2(Owner.Center.X + Main.rand.NextFloat(-10, 10), Owner.Center.Y + Main.rand.NextFloat(-10, 10)); Vector2 velocity = (Owner.Center - dustPos).SafeNormalize(Vector2.Zero); velocity *= (Main.dayTime || !SpawnedFromPSC) ? 3f : 6.9f; - var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID((float)((Main.dayTime || !SpawnedFromPSC) ? Providence.BossMode.Day : Providence.BossMode.Night)), velocity, 0, default(Color), 2f); + var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID(!Main.dayTime && SpawnedFromPSC), velocity, 0, default(Color), 2f); if (!Main.dayTime && SpawnedFromPSC) dust.noGravity = true; } @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon if (!Main.rand.NextBool(3)) continue; - Dust dust = Dust.NewDustDirect(Owner.position, Owner.width, Owner.height, ProvUtils.GetDustID((float)((Main.dayTime || !SpawnedFromPSC) ? Providence.BossMode.Day : Providence.BossMode.Night))); + Dust dust = Dust.NewDustDirect(Owner.position, Owner.width, Owner.height, ProvUtils.GetDustID(!Main.dayTime && SpawnedFromPSC)); dust.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); dust.velocity.Y -= Main.rand.NextFloat(1f, 3f); dust.scale = Main.rand.NextFloat(1.15f, 1.45f); diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index bd791dc12e..4db64bdb9b 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -314,9 +314,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); Vector2 dustVelocity = (player.Center - spawnPosition) * 0.085f + owner.velocity; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - - Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(pscState)); + Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(!Main.dayTime)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); dust.color = Color.Lerp(Color.LightCoral, Color.White, Projectile.ai[2] / 120 * Main.rand.NextFloat(0.65f, 1f)); diff --git a/Projectiles/Summon/MiniGuardianHolyRay.cs b/Projectiles/Summon/MiniGuardianHolyRay.cs index c2fa1521ab..a5c7f9dd29 100644 --- a/Projectiles/Summon/MiniGuardianHolyRay.cs +++ b/Projectiles/Summon/MiniGuardianHolyRay.cs @@ -107,8 +107,7 @@ namespace CalamityMod.Projectiles.Summon // Fire laser through walls at max length num807 = 2400f; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustType = ProvUtils.GetDustID(pscState); + int dustType = ProvUtils.GetDustID(!Main.dayTime); float amount = 0.5f; Projectile.localAI[1] = MathHelper.Lerp(Projectile.localAI[1], num807, amount); // Length of laser, linear interpolation Vector2 vector79 = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); @@ -149,8 +148,7 @@ namespace CalamityMod.Projectiles.Summon ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float num223 = Projectile.localAI[1]; //length of laser - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Color color44 = ProvUtils.GetProjectileColor(pscState, 0) * 0.9f; + Color color44 = ProvUtils.GetDayNightColor(!Main.dayTime, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/MiniGuardianRock.cs b/Projectiles/Summon/MiniGuardianRock.cs index 5f7c775d22..f4030d1c70 100644 --- a/Projectiles/Summon/MiniGuardianRock.cs +++ b/Projectiles/Summon/MiniGuardianRock.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon lerpVal = Utils.GetLerpValue(psc ? 87 : 57, psc ? 150 : 120, ownerDist, true); mult = MathHelper.Lerp(0.42f, 1f, lerpVal); } - if (CalamityConfig.Instance.Afterimages && Projectile.ai[0] >= 1f) //handle afterimages manually since the utility broke it and didn't render correctly + if (CalamityClientConfig.Instance.Afterimages && Projectile.ai[0] >= 1f) //handle afterimages manually since the utility broke it and didn't render correctly { for (int i = 0; i < Projectile.oldPos.Length; ++i) { diff --git a/Projectiles/Summon/MiniGuardianStars.cs b/Projectiles/Summon/MiniGuardianStars.cs index 2d2092bd96..94fec64eb7 100644 --- a/Projectiles/Summon/MiniGuardianStars.cs +++ b/Projectiles/Summon/MiniGuardianStars.cs @@ -87,8 +87,7 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); Projectile.ExpandHitboxBy(50); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustType = ProvUtils.GetDustID(pscState); + int dustType = ProvUtils.GetDustID(!Main.dayTime); for (int d = 0; d < 5; d++) { int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -118,9 +117,6 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitPlayer(Player target, Player.HurtInfo info) { - if ((info.Damage <= 0 && Projectile.maxPenetrate < (int)Providence.BossMode.Red) || target.creativeGodMode) - return; - Projectile.Kill(); } } diff --git a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs index 5e064d63a7..1d1faac2f7 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/HopeShredderArrow.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs index 2ac39278e4..98bab8425f 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override void ReceiveExtraAI(BinaryReader reader) { hasTeleported = reader.ReadBoolean(); - ChargeStartingPosition = reader.ReadPackedVector2(); + ChargeStartingPosition = reader.ReadVector2(); } public override void AI() @@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Vector2 origin = frame.Size() * 0.5f; float rotation = (Target is not null) ? Projectile.rotation : Projectile.rotation + MathHelper.PiOver4; - if (CalamityConfig.Instance.Afterimages && Target is not null) + if (CalamityClientConfig.Instance.Afterimages && Target is not null) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs b/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs index 2ddb451933..c2fdddd74b 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Starforge.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions DrawSpin -= MathHelper.ToRadians(MirrorofKalandra.Purple_SpinSpeed); float rotation = (Target is not null) ? DrawSpin : Projectile.rotation + MathHelper.Pi - MathHelper.PiOver4; - if (CalamityConfig.Instance.Afterimages && Target is not null) + if (CalamityClientConfig.Instance.Afterimages && Target is not null) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs b/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs index e972745785..006b16a2e1 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/WindRipperArrow.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/MutatedTruffleMinion.cs b/Projectiles/Summon/MutatedTruffleMinion.cs index 20ca2992a1..498383c09d 100644 --- a/Projectiles/Summon/MutatedTruffleMinion.cs +++ b/Projectiles/Summon/MutatedTruffleMinion.cs @@ -267,7 +267,7 @@ namespace CalamityMod.Projectiles.Summon float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 && State != AIState.Idle ? MathHelper.Pi : 0f); SpriteEffects effects = (Projectile.spriteDirection == 1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - if (CalamityConfig.Instance.Afterimages && (State == AIState.Dashing || State == AIState.Vortex)) + if (CalamityClientConfig.Instance.Afterimages && (State == AIState.Dashing || State == AIState.Vortex)) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs index 7ffcd03e5a..1d62639829 100644 --- a/Projectiles/Summon/PhantomicDagger.cs +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); } diff --git a/Projectiles/Summon/PlantationStaffSeed.cs b/Projectiles/Summon/PlantationStaffSeed.cs index 86f09239fc..e891f75ec4 100644 --- a/Projectiles/Summon/PlantationStaffSeed.cs +++ b/Projectiles/Summon/PlantationStaffSeed.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Summon Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Summon/PlantationStaffSummon.cs b/Projectiles/Summon/PlantationStaffSummon.cs index 8e0f6380f5..7d8bd78097 100644 --- a/Projectiles/Summon/PlantationStaffSummon.cs +++ b/Projectiles/Summon/PlantationStaffSummon.cs @@ -341,7 +341,7 @@ namespace CalamityMod.Projectiles.Summon Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; - if (State == AIState.Ramming && CalamityConfig.Instance.Afterimages) + if (State == AIState.Ramming && CalamityClientConfig.Instance.Afterimages) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/PlantationStaffTentacle.cs b/Projectiles/Summon/PlantationStaffTentacle.cs index a713ee71f3..e1cd5ad274 100644 --- a/Projectiles/Summon/PlantationStaffTentacle.cs +++ b/Projectiles/Summon/PlantationStaffTentacle.cs @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Summon } } } - else if (CalamityConfig.Instance.Afterimages) + else if (CalamityClientConfig.Instance.Afterimages) CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor); return true; diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 5b17d39ef2..218ceafe13 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -137,8 +137,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -146,8 +145,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -180,8 +178,7 @@ namespace CalamityMod.Projectiles.Summon Split(false, false); } SoundEngine.PlaySound(SoundID.Item20, Projectile.position); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, 1.5f); @@ -251,7 +248,7 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.timeLeft > 550) Projectile.velocity *= 0.95f; - int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID((float)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night)), 0f, 0f, 100, default, Main.dayTime ? 1f : 0.75f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime), 0f, 0f, 100, default, Main.dayTime ? 1f : 0.75f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -329,17 +326,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -380,8 +375,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -507,9 +501,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha), 1); return false; } @@ -524,8 +517,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -736,8 +728,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity *= boomerSwarm ? 1.03f : 1.02f; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; @@ -747,8 +738,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -756,8 +746,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/ProfanedCrystalRangedHugesNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -792,8 +781,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 200; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -922,8 +910,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.height = 50; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, 0f, 0f, 100, default, Main.dayTime ? 2f : 0.5f); @@ -956,16 +943,14 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -1507,9 +1492,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * outwardness * Main.rand.NextFloat(0.75f, 1.1f); Vector2 dustVelocity = (Projectile.Center - spawnPosition) * 0.085f + owner.velocity; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - - Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(pscState)); + Dust dust = Dust.NewDustPerfect(spawnPosition, ProvUtils.GetDustID(!Main.dayTime)); dust.velocity = dustVelocity; dust.scale = dustScale * Main.rand.NextFloat(0.75f, 1.15f); dust.noGravity = true; @@ -1567,7 +1550,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 dustPos = new Vector2(Owner.Center.X + Main.rand.NextFloat(-10, 10), Owner.Center.Y + Main.rand.NextFloat(-10, 10)); Vector2 velocity = (Owner.Center - dustPos).SafeNormalize(Vector2.Zero); velocity *= Main.dayTime ? 3f : 6.9f; - var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID((float)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night)), velocity, 0, default(Color), 2f); + var dust = Dust.NewDustPerfect(Owner.Center, ProvUtils.GetDustID(!Main.dayTime), velocity, 0, default(Color), 2f); if (!Main.dayTime) dust.noGravity = true; } @@ -1656,7 +1639,7 @@ namespace CalamityMod.Projectiles.Summon drawPos -= new Vector2(texture.Width, texture.Height) * Projectile.scale / 2f; drawPos += drawOrigin * Projectile.scale + new Vector2(0f, Projectile.gfxOffY); Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); - if (CalamityConfig.Instance.Afterimages) //handle afterimages manually since the utility broke it and didn't render correctly + if (CalamityClientConfig.Instance.Afterimages) //handle afterimages manually since the utility broke it and didn't render correctly { for (int i = 0; i < Projectile.oldPos.Length; ++i) { @@ -1795,8 +1778,7 @@ namespace CalamityMod.Projectiles.Summon //Ensure that psa's spears are not coloured by night var psc = Projectile.ai[0] > 0f; - int pscState = (int)((!Main.dayTime && psc) ? Providence.BossMode.Night : Providence.BossMode.Day); - int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 1f); + int num469 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime && psc), 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; handleAI(psc && Projectile.ai[1] > 0f); @@ -1813,9 +1795,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { var psc = Projectile.ai[0] > 0f; - int pscState = (int)((!Main.dayTime && psc) ? Providence.BossMode.Night : Providence.BossMode.Day); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetProjectileColor(pscState, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime && psc, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], ProvUtils.GetDayNightColor(!Main.dayTime && psc, Projectile.alpha), 1); return false; } @@ -1830,9 +1811,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); var psc = Projectile.ai[0] > 0f; - var shouldAdjust = !Main.dayTime && psc; - int pscState = (int)(shouldAdjust ? Providence.BossMode.Night : Providence.BossMode.Day); - int dustID = ProvUtils.GetDustID(pscState); + bool shouldAdjust = !Main.dayTime && psc; + int dustID = ProvUtils.GetDustID(shouldAdjust); for (int num621 = 0; num621 < 4; num621++) { int num622 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, !Main.dayTime && psc ? 0.5f : 2f); @@ -1927,16 +1907,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.damage = (int)Owner.GetTotalDamage().ApplyTo(Projectile.originalDamage); Projectile.damage = Owner.ApplyArmorAccDamageBonusesTo(Projectile.damage); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(pscState), 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, ProvUtils.GetDustID(!Main.dayTime), 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -1944,8 +1922,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -1980,8 +1957,7 @@ namespace CalamityMod.Projectiles.Summon Split(); } SoundEngine.PlaySound(HolyBlast.ImpactSound, Projectile.Center); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dustID = ProvUtils.GetDustID(pscState); + int dustID = ProvUtils.GetDustID(!Main.dayTime); for (int num193 = 0; num193 < 6; num193++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 50, default, Main.dayTime ? 1.5f : 0.5f); @@ -2077,17 +2053,15 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - return ProvUtils.GetProjectileColor(pscState, Projectile.alpha); + return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(pscState, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -2102,8 +2076,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); - int dust = ProvUtils.GetDustID(pscState); + int dust = ProvUtils.GetDustID(!Main.dayTime); for (int num621 = 0; num621 < 4; num621++) { diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 93860c3ce5..971d9601d8 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Summon HoverNearOwner, AttackEnemy_Charge, AttackEnemy_ReleaseDartBurst, - AttackOwner + AttackHearts } public int IdleTimer; public int AttackTimer; - public int PlayerAttackCountdown; + public int HeartAttackCountdown; public SepulcherSegment[] Segments = new SepulcherSegment[24]; public List Arms = new List(); public Player Owner => Main.player[Projectile.owner]; @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon Initialize(); writer.Write(IdleTimer); - writer.Write(PlayerAttackCountdown); + writer.Write(HeartAttackCountdown); writer.Write(Arms.Count); for (int i = 0; i < Arms.Count; i++) { @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Summon Initialize(); IdleTimer = reader.ReadInt32(); - PlayerAttackCountdown = reader.ReadInt32(); + HeartAttackCountdown = reader.ReadInt32(); int armCount = reader.ReadInt32(); Arms.Clear(); for (int i = 0; i < armCount; i++) @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = AttemptToFindTarget(1450f); // Enter the attack state if a valid enemy is found and go back to hovering otherwise. - // This will be overriden if attacking the owner. + // This will be overriden if attacking its hearts. if (CurrentAIState != AIState.AttackEnemy_ReleaseDartBurst && CurrentAIState != AIState.AttackEnemy_Charge) { if (potentialTarget != null) @@ -195,23 +195,19 @@ namespace CalamityMod.Projectiles.Summon AttackTimer = 0; } - // Reset the AI to player attack mode if the countdown is going on. - if (PlayerAttackCountdown > 0) + // Reset the AI to heart attack mode if the countdown is going on. + if (HeartAttackCountdown > 0) { - if (CurrentAIState != AIState.AttackOwner) - CurrentAIState = AIState.AttackOwner; + if (CurrentAIState != AIState.AttackHearts) + CurrentAIState = AIState.AttackHearts; - PlayerAttackCountdown--; + HeartAttackCountdown--; // If it's finished, go back to idle owner hover movement. - if (PlayerAttackCountdown <= 0) + if (HeartAttackCountdown <= 0) CurrentAIState = AIState.HoverNearOwner; } - - // Determine whether the projectile can attack its owner based on the attakc countdown. - Projectile.hostile = PlayerAttackCountdown > 0; - switch (CurrentAIState) { case AIState.HoverNearOwner: @@ -225,8 +221,8 @@ namespace CalamityMod.Projectiles.Summon AttackEnemyByCharging(potentialTarget); AttackTimer++; break; - case AIState.AttackOwner: - AttackOwner(); + case AIState.AttackHearts: + AttackHearts(); break; } @@ -248,7 +244,7 @@ namespace CalamityMod.Projectiles.Summon chanceToBecomeAngry = Utils.GetLerpValue(2f, 6f, heartsAttachedToOwner, true); if (Main.rand.NextFloat() < chanceToBecomeAngry) { - PlayerAttackCountdown = 300; + HeartAttackCountdown = 300; Projectile.netUpdate = true; } else if (Main.netMode != NetmodeID.MultiplayerClient) @@ -349,7 +345,7 @@ namespace CalamityMod.Projectiles.Summon float rotationalVelocityFactor = Utils.GetLerpValue(0f, 6f, Projectile.velocity.Length(), true); if (CurrentAIState == AIState.AttackEnemy_Charge) rotationalVelocityFactor *= 0.85f; - if (CurrentAIState == AIState.AttackOwner) + if (CurrentAIState == AIState.AttackHearts) rotationalVelocityFactor *= 1.2f; if (Arms[i].ReelingBack) @@ -455,14 +451,39 @@ namespace CalamityMod.Projectiles.Summon } } - public void AttackOwner() + public void AttackHearts() { // Attempt to angle towards the owner. float newSpeed = MathHelper.Lerp(Projectile.velocity.Length(), 21f, 0.025f); - if (!Projectile.WithinRange(Owner.Center, 370f)) + // Find the closest heart to the minion. + float npcDistCompare = 960f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) { - Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.Center) * newSpeed; + if (!n.CanBeChasedBy(Projectile, false) || n.type != ModContent.NPCType()) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If there are no Hearts left, immediately go back to being passive. + if (index == -1) + { + HeartAttackCountdown = 0; + CurrentAIState = AIState.HoverNearOwner; + return; + } + // Otherwise, move towards the targeted heart. + NPC targetHeart = Main.npc[index]; + if (!Projectile.WithinRange(targetHeart.Center, 185f)) + { + Vector2 idealVelocity = Projectile.SafeDirectionTo(targetHeart.Center) * newSpeed; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); float idealAimDirection = idealVelocity.ToRotation(); @@ -470,15 +491,15 @@ namespace CalamityMod.Projectiles.Summon } else if (Projectile.velocity.Length() < 36f) { - Projectile.velocity *= 1.03f; + Projectile.velocity *= 1.066f; if (JawSnapTimer <= 0f) { // Open the mouth of the jaw if close but not super close to the owner. - if (Projectile.WithinRange(Owner.Center, 300f)) + if (Projectile.WithinRange(targetHeart.Center, 150f)) JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); // If really close, snap. - if (Projectile.WithinRange(Owner.Center, 180f)) + if (Projectile.WithinRange(targetHeart.Center, 90f)) { SoundEngine.PlaySound(SoundID.DD2_SkeletonHurt, Projectile.Center); JawSnapTimer = 45f; @@ -526,7 +547,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - float angerFactor = Utils.GetLerpValue(300f, 280f, PlayerAttackCountdown, true) * Utils.GetLerpValue(0f, 30f, PlayerAttackCountdown, true); + float angerFactor = Utils.GetLerpValue(300f, 280f, HeartAttackCountdown, true) * Utils.GetLerpValue(0f, 30f, HeartAttackCountdown, true); float afterimageOutwardness = MathHelper.Lerp(6f, 8f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 2.3f) * 0.5f + 0.5f) * angerFactor; Color backAfterimageColor = Color.Red * angerFactor; backAfterimageColor.A = 0; @@ -671,21 +692,11 @@ namespace CalamityMod.Projectiles.Summon #endregion - #region Damage Stuff - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) - { - modifiers.SourceDamage *= 0f; - if (Main.masterMode) modifiers.SourceDamage.Flat += 450f; - else if (Main.expertMode) modifiers.SourceDamage.Flat += 375f; - else modifiers.SourceDamage.Flat += 300f; - } - public override bool? CanHitNPC(NPC target) { if (target.type == ModContent.NPCType()) - return false; + return HeartAttackCountdown > 0; return null; } - #endregion } } diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index 52185dadfc..770ce4b47d 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); float x4 = Main.rgbToHsl(new Color(103, 203, Main.DiscoB)).X; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, Projectile.whoAmI); } diff --git a/Projectiles/Summon/SiriusExplosion.cs b/Projectiles/Summon/SiriusExplosion.cs index d4ea45da2a..99670e593b 100644 --- a/Projectiles/Summon/SiriusExplosion.cs +++ b/Projectiles/Summon/SiriusExplosion.cs @@ -231,6 +231,6 @@ namespace CalamityMod.Projectiles.Summon return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index 8518677727..bf709d1a85 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -83,6 +83,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { Projectile.rotation = reader.ReadSingle(); + //limb count has passed from SendExtraAI + //therefore we should read this for packet aligns sake + _ = reader.ReadInt32(); + int limbCount = Limbs.Limbs.Length; for (int i = 0; i < limbCount; i++) { diff --git a/Projectiles/Summon/SquirrelSquireAcorn.cs b/Projectiles/Summon/SquirrelSquireAcorn.cs index b5456cd62e..6031563d3f 100644 --- a/Projectiles/Summon/SquirrelSquireAcorn.cs +++ b/Projectiles/Summon/SquirrelSquireAcorn.cs @@ -1,39 +1,68 @@ -using Terraria; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.SquirrelSquireStaff; namespace CalamityMod.Projectiles.Summon { public class SquirrelSquireAcorn : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public const float Gravity = 0.5f; - public override void SetStaticDefaults() - { - ProjectileID.Sets.SentryShot[Projectile.type] = true; - } + + public override void SetStaticDefaults() => ProjectileID.Sets.SentryShot[Type] = true; public override void SetDefaults() { - Projectile.width = 10; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = ProjectileTimeAlive; + Projectile.width = 16; Projectile.height = 16; Projectile.friendly = true; - Projectile.penetrate = 2; - Projectile.timeLeft = 180; - Projectile.MaxUpdates = 2; - Projectile.DamageType = DamageClass.Summon; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; } public override void AI() { - Projectile.velocity.Y += Gravity; - Projectile.rotation += (Projectile.velocity.X > 0f).ToDirectionInt() * 0.3f; + if (Projectile.timeLeft < ProjectileTimeAlive - TimeBeforeFalling) + Projectile.velocity.Y += ProjectileGravity; + + Projectile.rotation += MathHelper.ToRadians(Projectile.velocity.X * 3f); + + if (!Main.dedServ) + { + if (Main.rand.NextBool()) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 7 : 79); + dust.noGravity = true; + dust.scale = 0.85f; + dust.velocity = Projectile.velocity * 0.4f; + dust.noLight = true; + dust.noLightEmittence = true; + } + } } public override void OnKill(int timeLeft) { - for (int k = 0; k < 5; k++) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.WoodFurniture, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + Projectile.ExpandHitboxBy(ProjectileAoERadiusSize * 2); + if (Main.myPlayer == Projectile.owner) + Projectile.Damage(); + + if (Main.dedServ) + return; + + for (int k = 0; k < 6; k++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 7 : 167); + dust.scale = Main.rand.NextFloat(0.6f, 1.1f); + dust.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f); + dust.noGravity = false; + Particle spark = new AltLineParticle(Projectile.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.9f), true, 15, 0.7f, Color.Lerp(Color.White, Color.Brown, Main.rand.NextFloat(0.3f, 0.7f)) * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } } } } diff --git a/Projectiles/Summon/SquirrelSquireAcorn.png b/Projectiles/Summon/SquirrelSquireAcorn.png index 7746f7829f..65f893126a 100644 Binary files a/Projectiles/Summon/SquirrelSquireAcorn.png and b/Projectiles/Summon/SquirrelSquireAcorn.png differ diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index 561b59c262..e912f9c7f2 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -1,148 +1,158 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Summon.SquirrelSquireStaff; namespace CalamityMod.Projectiles.Summon { public class SquirrelSquireMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public ref float AttackTimer => ref Projectile.ai[1]; - public bool Attacking + + private enum AIState { Idle, Attack } + + private AIState State { - get => Projectile.localAI[1] == 1f; - set => Projectile.localAI[1] = value.ToInt(); - } - public bool OnSolidGround - { - get + get => (AIState)Projectile.ai[0]; + set { - bool groundSolid = false; - for (int i = (int)Projectile.Left.X / 16 - 1; i < (int)Projectile.Right.X / 16 + 1; i++) - { - bool bottomTileSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16).IsTileSolidGround(); - bool firstTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16 + 1).IsTileSolidGround(); - bool secondTileDownSolid = CalamityUtils.ParanoidTileRetrieval(i, (int)Projectile.Bottom.Y / 16 + 2).IsTileSolidGround(); - groundSolid |= bottomTileSolid || firstTileDownSolid || secondTileDownSolid; - } - return groundSolid; + Projectile.ai[0] = (float)value; + NetUpdate(); } } - public Player Owner => Main.player[Projectile.owner]; + + private bool OnSpawnCheck + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value == true ? 1f : 0f; + } + + private Player Owner; + + private NPC Target; public override void SetStaticDefaults() { - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; - Main.projFrames[Projectile.type] = 16; + Main.projFrames[Type] = 14; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() { - Projectile.width = 34; - Projectile.height = 64; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; + Projectile.DamageType = DamageClass.Summon; Projectile.timeLeft = Projectile.SentryLifeTime; Projectile.penetrate = -1; + + Projectile.width = 40; + Projectile.height = 32; + Projectile.friendly = true; Projectile.tileCollide = true; Projectile.sentry = true; - Projectile.DamageType = DamageClass.Summon; + Projectile.netImportant = true; } public override void AI() { - if (Projectile.localAI[0] == 0f) + if (!OnSpawnCheck) { - DoInitializationEffects(); - Projectile.localAI[0] = 1f; + ActualOnSpawn(); + OnSpawnCheck = true; } - Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.004f, -12f, 12f); + SetTarget(); + ApplyGravity(); + DoAnimation(); + + switch (State) + { + case AIState.Idle: + IdleBehavior(); + break; + case AIState.Attack: + AttackBehavior(); + break; + } + } + + #region AI Methods + + private void ActualOnSpawn() + { + Owner = Main.player[Projectile.owner]; + Projectile.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + } + + private void SetTarget() => Target = Projectile.Center.MinionHoming(960f, Owner, false); + + private void ApplyGravity() + { + float speedY = Projectile.velocity.Y; + if (speedY < 20f) + speedY = MathF.Min(speedY + 0.4f, 20f); + Projectile.velocity.Y = speedY; + } + + private void DoAnimation() + { Projectile.frameCounter++; - - Attacking = false; - NPC potentialTarget = Projectile.Center.MinionHoming(800f, Owner, false); - if (potentialTarget is null) + if (Projectile.frameCounter >= 5) { - if (OnSolidGround) - { - if (Projectile.frameCounter > 3) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - { - Projectile.frame = 0; - } - } - else - { - if (Projectile.frameCounter > 5) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame < 8 || Projectile.frame > 11) - { - Projectile.frame = 9; - } - } + Projectile.frameCounter = 0; + Projectile.frame = (Projectile.frame + 1) % 7; } - else - { - Attacking = true; - AttackTarget(potentialTarget); - } - - Projectile.rotation = 0f; - Projectile.tileCollide = true; } - public void DoInitializationEffects() + private void IdleBehavior() { - int dustQuantity = 36; - for (int d = 0; d < dustQuantity; d++) + if (Target is not null) { - // The ground squirrel is very slightly off-center - Dust dust = Dust.NewDustPerfect(Projectile.Center + Vector2.UnitY * 16f, 7); - dust.scale = 1.4f; - dust.velocity = (MathHelper.TwoPi * d / dustQuantity).ToRotationVector2() * 4f; - dust.noGravity = true; - dust.noLight = true; + State = AIState.Attack; + return; } + + if (Projectile.Distance(Owner.Center) < 60f) + Projectile.spriteDirection = MathF.Sign(Owner.Center.X - Projectile.Center.X); } - public void AttackTarget(NPC target) + private void AttackBehavior() { - AttackTimer++; - - // Pelt the target with acorns. - if (!OnSolidGround) - Projectile.frame = 12 + (int)(AttackTimer / 6.4) % 4; - else + if (Target is null) { - Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.2f, -12f, 12f); - Projectile.frame = 4 + (int)(AttackTimer / 6.4) % 4; + State = AIState.Idle; + return; } - if (Main.myPlayer == Projectile.owner && AttackTimer % 30f == 27f) + + if (Projectile.frame == 0 && Projectile.frameCounter == 0 && Main.myPlayer == Projectile.owner) { - Projectile.spriteDirection = (target.Center.X > Projectile.Center.X).ToDirectionInt(); - Vector2 acornSpawnPosition = Projectile.Center + new Vector2(Projectile.spriteDirection * 6f, 10f); - float acornShootSpeed = MathHelper.Lerp(15f, 32f, Projectile.Distance(target.Center) / 800f); - Vector2 acornShootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(acornSpawnPosition, target.Top + target.velocity * 25f, SquirrelSquireAcorn.Gravity, acornShootSpeed); - - if (Projectile.WithinRange(target.Center, 200f)) - acornShootVelocity = (target.Center - acornSpawnPosition).SafeNormalize(-Vector2.UnitY) * acornShootSpeed; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 spawnPosition = Projectile.spriteDirection == -1 ? Projectile.Left : Projectile.Right; + Vector2 shootVelocity = CalamityUtils.CalculatePredictiveAimToTarget(spawnPosition, Target, ProjectileVelocity); + Projectile.NewProjectileDirect( + Projectile.GetSource_FromThis(), + spawnPosition, + shootVelocity, + ModContent.ProjectileType(), + Projectile.damage, + Projectile.knockBack, + Projectile.owner); + SoundEngine.PlaySound(SoundID.Item1 with { Volume = 0.5f, Pitch = 0.8f, PitchVariance = 0.1f }, spawnPosition); + NetUpdate(); } + + Projectile.spriteDirection = MathF.Sign(Target.Center.X - Projectile.Center.X); } - public override bool? CanDamage() => false; + private void NetUpdate() + { + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + + #endregion public override bool OnTileCollide(Vector2 oldVelocity) => false; @@ -152,13 +162,20 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override void OnKill(int timeLeft) + public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) { - if (Main.netMode != NetmodeID.Server) - { - int index = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Vector2.Zero, Main.rand.Next(61, 64), Projectile.scale); - Main.gore[index].velocity *= 0.1f; - } + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Top - Main.screenPosition + Vector2.UnitY * Projectile.gfxOffY; + Rectangle frame = texture.Frame(2, 7, (int)State, Projectile.frame); + Color drawColor = Projectile.GetAlpha(lightColor); + Vector2 anchorPoint = new(frame.Size().X * 0.5f, 0f); + SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, Projectile.rotation, anchorPoint, Projectile.scale, flipSprite); + + return false; } } } diff --git a/Projectiles/Summon/SquirrelSquireMinion.png b/Projectiles/Summon/SquirrelSquireMinion.png index 57814576d0..a4d153ee6c 100644 Binary files a/Projectiles/Summon/SquirrelSquireMinion.png and b/Projectiles/Summon/SquirrelSquireMinion.png differ diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index 1b27ab23b2..e196726c0a 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -1,6 +1,5 @@ using System; using CalamityMod.Buffs.Summon; -using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -280,7 +279,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.rand.Next(1, 4); i++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } sparkCounter = 0; } @@ -313,17 +312,7 @@ namespace CalamityMod.Projectiles.Summon for (int j = 0; j < Main.rand.Next(1, 4); j++) { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int spark = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (spark.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[spark].DamageType = DamageClass.Summon; - Main.projectile[spark].originalDamage = Projectile.originalDamage; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkS, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } sparkCounter = 0; } diff --git a/Projectiles/Summon/StormjawSpark.cs b/Projectiles/Summon/StormjawSpark.cs index 0758cf42e9..6c06785a0a 100644 --- a/Projectiles/Summon/StormjawSpark.cs +++ b/Projectiles/Summon/StormjawSpark.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - //literally had to make another projectile cuz whips exist + // Clone of Typeless/GenericElectricSpark but specfically benefits from whips public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Projectile.type] = true; public override void SetDefaults() @@ -24,65 +26,48 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void AI() { if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X = Projectile.velocity.X * -0.5f; - } + Projectile.velocity.X *= -0.1f; if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y = Projectile.velocity.Y * -0.5f; - } - Projectile.ai[0] += 1f; + Projectile.velocity.Y *= -0.5f; + + Projectile.ai[0]++; if (Projectile.ai[0] > 5f) { Projectile.ai[0] = 5f; if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) { - Projectile.velocity.X = Projectile.velocity.X * 0.97f; - if ((double)Projectile.velocity.X > -0.01 && (double)Projectile.velocity.X < 0.01) + Projectile.velocity.X *= 0.97f; + if (MathF.Abs(Projectile.velocity.X) < 0.01f) { Projectile.velocity.X = 0f; Projectile.netUpdate = true; } } - Projectile.velocity.Y = Projectile.velocity.Y + 0.2f; + Projectile.velocity.Y += 0.2f; } - Projectile.rotation += Projectile.velocity.X * 0.1f; - int sparky = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8976_cp_0 = Main.dust[sparky]; - expr_8976_cp_0.position.X -= 2f; - Dust expr_8994_cp_0 = Main.dust[sparky]; - expr_8994_cp_0.position.Y += 2f; - Main.dust[sparky].scale += (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparky].noGravity = true; - Dust expr_89E7_cp_0 = Main.dust[sparky]; - expr_89E7_cp_0.velocity.Y -= 2f; + Dust spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0f, 0.5f); + spark.noGravity = true; + spark.velocity.Y -= 2f; if (Main.rand.NextBool()) { - int sparkier = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Dust expr_8A4E_cp_0 = Main.dust[sparkier]; - expr_8A4E_cp_0.position.X -= 2f; - Dust expr_8A6C_cp_0 = Main.dust[sparkier]; - expr_8A6C_cp_0.position.Y += 2f; - Main.dust[sparkier].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - Main.dust[sparkier].noGravity = true; - Main.dust[sparkier].velocity *= 0.1f; + spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0.3f, 0.8f); + spark.noGravity = true; + spark.velocity *= 0.1f; } - if ((double)Projectile.velocity.Y < 0.25 && (double)Projectile.velocity.Y > 0.15) - { - Projectile.velocity.X = Projectile.velocity.X * 0.8f; - } - Projectile.rotation = -Projectile.velocity.X * 0.05f; + if (Projectile.velocity.Y > 16f) - { Projectile.velocity.Y = 16f; - } } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/Umbrella/MagicHat.cs b/Projectiles/Summon/Umbrella/MagicHat.cs index 663c9df9e3..3da5df70a1 100644 --- a/Projectiles/Summon/Umbrella/MagicHat.cs +++ b/Projectiles/Summon/Umbrella/MagicHat.cs @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella // Use a different texture if the player is invisible or has at least 50% stealth Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; float stealthPercent = player.Calamity().rogueStealthMax != 0 ? (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax) : 0f; //0 to 1 - bool hasStealth = player.Calamity().rogueStealth > 0f && stealthPercent > 0.5f && player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisibility; + bool hasStealth = player.Calamity().rogueStealth > 0f && stealthPercent > 0.5f && player.townNPCs < 3f && CalamityClientConfig.Instance.StealthInvisibility; if (player.ShouldNotDraw || hasStealth) texture = ModContent.Request("CalamityMod/Projectiles/Summon/Umbrella/MagicHatInvis").Value; diff --git a/Projectiles/Summon/YharonMinionFireball.cs b/Projectiles/Summon/YharonMinionFireball.cs index 61c54b2438..e85bf8136c 100644 --- a/Projectiles/Summon/YharonMinionFireball.cs +++ b/Projectiles/Summon/YharonMinionFireball.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.spriteDirection == -1) direction = SpriteEffects.FlipHorizontally; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { for (int i = 0; i < Projectile.oldPos.Length; i++) { diff --git a/Projectiles/Typeless/AscendantAura.cs b/Projectiles/Typeless/AscendantAura.cs index 6e5b32dcc9..311dfd0c3d 100644 --- a/Projectiles/Typeless/AscendantAura.cs +++ b/Projectiles/Typeless/AscendantAura.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -69,6 +70,7 @@ namespace CalamityMod.Projectiles.Typeless int lifetime = Main.rand.Next(3, 6); float scale = Main.rand.NextFloat(0.5f, 0.9f); Color color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; + /* SparkParticle spark1 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(7, 12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); GeneralParticleHandler.SpawnParticle(spark1); SparkParticle spark2 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(-7, -12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); @@ -81,6 +83,7 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(spark5); SparkParticle spark6 = new SparkParticle(Projectile.Center + new Vector2(-20, 0), new Vector2(Main.rand.NextFloat(-7, -12), 0), false, lifetime, scale - 0.3f, color); GeneralParticleHandler.SpawnParticle(spark6); + */ // Emit some light Vector3 Light = new Vector3(0.251f, 0.255f, 0.219f); @@ -94,14 +97,42 @@ namespace CalamityMod.Projectiles.Typeless { float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(8f, 0).RotatedBy(rot); - Vector2 velOffset = new Vector2(2.5f, 0).RotatedBy(rot); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 204, new Vector2(velOffset.X, velOffset.Y)); + Vector2 velOffset = new Vector2(10.5f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; - dust.velocity = velOffset * Main.rand.NextFloat(0.9f, 1.1f); - dust.scale = 2.5f; + dust.velocity = velOffset * Main.rand.NextFloat(0.2f, 1.1f); + dust.scale = Main.rand.NextFloat(0.3f, 0.8f); + dust.color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; } + + SoundStyle s = new("CalamityMod/Sounds/Item/AscendantActivate"); + SoundEngine.PlaySound(s with { Volume = 0.3f, Pitch = -0.9f }, Projectile.Center); } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/AscendantAura").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Color drawColor = Color.Lerp(Color.Khaki, Color.LightGreen, Utils.GetLerpValue(240, -100, Projectile.timeLeft, true)); + + Vector2 bScale = new Vector2(Main.rand.NextFloat(0.15f, 0.2f), 0.5f) * Projectile.scale * 0.04f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true) * Main.rand.NextFloat(0.7f, 1.3f); + + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(-30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(90f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(-90f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(0, -30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true)) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0, bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(0, 30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true)) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(180f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + + for (int i = 0; i < 4; i++) + { + Vector2 bScale2 = new Vector2(0.1f, 0.8f) * Projectile.scale * 0.04f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true) * Main.rand.NextFloat(0.7f, 1.3f); + Vector2 bVel = new Vector2(20 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0).RotatedBy(MathHelper.ToRadians(45f + (i * 90))) * Main.rand.NextFloat(0.6f, 1.3f); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + bVel, null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), bVel.ToRotation() + MathHelper.ToRadians(90f), bTexture.Size() * 0.5f, bScale2, SpriteEffects.None, 0); + } + + Main.EntitySpriteDraw(rTexture, Projectile.Center - Main.screenPosition, null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), Projectile.rotation, rTexture.Size() * 0.5f, Projectile.scale * 0.4f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), SpriteEffects.None, 0); + return false; + } public override bool? CanDamage() => false; } } diff --git a/Projectiles/Typeless/AscendantAura.png b/Projectiles/Typeless/AscendantAura.png index fb2bd6cc34..e48fd57ef6 100644 Binary files a/Projectiles/Typeless/AscendantAura.png and b/Projectiles/Typeless/AscendantAura.png differ diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 61bf31726a..9ef3c27837 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -86,42 +86,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - // Don't draw the aura at all if visibility is toggled off - if (!Main.player[Projectile.owner].Calamity().blunderBoosterVisibility) - return false; - Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColour = Color.White; Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); - float opacity = 1f; - int sparkCount = 0; - int fadeTime = 20; - - if (Projectile.timeLeft < fadeTime) - { - opacity = Projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - Projectile.timeLeft; - } - - for (int i = 0; i < sparkCount * 2; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - float rangeDiff = 2f; - - Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustPos.Normalize(); - dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - - int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } + float opacity = Main.player[Projectile.owner].Calamity().blunderBoosterVisibility ? 1f : 0.25f; Main.EntitySpriteDraw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Typeless/GenericElectricSpark.cs b/Projectiles/Typeless/GenericElectricSpark.cs new file mode 100644 index 0000000000..869b6548cb --- /dev/null +++ b/Projectiles/Typeless/GenericElectricSpark.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class GenericElectricSpark : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.penetrate = 5; + Projectile.timeLeft = 60; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Prevents Amidias' Spark sparks from inflicting it to not make its other effect worthless + if (Projectile.ai[1] != 1f) + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void AI() + { + if (Projectile.velocity.X != Projectile.velocity.X) + Projectile.velocity.X *= -0.1f; + if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) + Projectile.velocity.Y *= -0.5f; + + Projectile.ai[0]++; + if (Projectile.ai[0] > 5f) + { + Projectile.ai[0] = 5f; + if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) + { + Projectile.velocity.X *= 0.97f; + if (MathF.Abs(Projectile.velocity.X) < 0.01f) + { + Projectile.velocity.X = 0f; + Projectile.netUpdate = true; + } + } + Projectile.velocity.Y += 0.2f; + } + Dust spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0f, 0.5f); + spark.noGravity = true; + spark.velocity.Y -= 2f; + if (Main.rand.NextBool()) + { + spark = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, Alpha: 100); + spark.position.X -= 2f; + spark.position.Y += 2f; + spark.scale += Main.rand.NextFloat(0.3f, 0.8f); + spark.noGravity = true; + spark.velocity *= 0.1f; + } + + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } +} diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs deleted file mode 100644 index 7dc61d9aa9..0000000000 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class MageHammerBoom : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 500; - Projectile.height = 500; - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 5; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; - } - } -} diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PearlAuraShard.cs similarity index 70% rename from Projectiles/Typeless/PendantProjectile3.cs rename to Projectiles/Typeless/PearlAuraShard.cs index cf8165e20d..0732ddd80f 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PearlAuraShard.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class PendantProjectile3 : ModProjectile, ILocalizedModType + public class PearlAuraShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetDefaults() @@ -16,17 +16,17 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.timeLeft = 220; - Projectile.penetrate = 1; Projectile.tileCollide = false; } public override void AI() { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); + if (Projectile.timeLeft < 210) + CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 4; i++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); Main.dust[dust].noGravity = true; @@ -34,9 +34,5 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[dust].velocity += Projectile.velocity * 0.1f; } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Typeless/PendantProjectile3.png b/Projectiles/Typeless/PearlAuraShard.png similarity index 100% rename from Projectiles/Typeless/PendantProjectile3.png rename to Projectiles/Typeless/PearlAuraShard.png diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs deleted file mode 100644 index f04ae59970..0000000000 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PendantProjectile1 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity += Projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 30); - } -} diff --git a/Projectiles/Typeless/PendantProjectile1.png b/Projectiles/Typeless/PendantProjectile1.png deleted file mode 100644 index df5a566c0b..0000000000 Binary files a/Projectiles/Typeless/PendantProjectile1.png and /dev/null differ diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs deleted file mode 100644 index c50d8c358f..0000000000 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PendantProjectile2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity += Projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 30); - } -} diff --git a/Projectiles/Typeless/PendantProjectile2.png b/Projectiles/Typeless/PendantProjectile2.png deleted file mode 100644 index bcf5f2e978..0000000000 Binary files a/Projectiles/Typeless/PendantProjectile2.png and /dev/null differ diff --git a/Projectiles/Typeless/PlaguePulse.cs b/Projectiles/Typeless/PlaguePulse.cs index c9439dbd73..14e6e4158e 100644 --- a/Projectiles/Typeless/PlaguePulse.cs +++ b/Projectiles/Typeless/PlaguePulse.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; target.AddBuff(ModContent.BuffType(), 420); - if (target.life <= 0) + if ((target.life <= 0 && target.realLife == -1)) { player.Heal(10); Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(startDamage * 0.8f), 0f, Projectile.owner, 0, 0, 1); diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 966e7c3f66..a68256bee6 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.rotation += 0.01f; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; Vector2 posDiff = player.Center - Projectile.Center; if (posDiff.Length() <= radius) { - player.statDefense += 6; - player.lifeRegen += 2; + player.statDefense += 8; + player.GetCritChance() += 3; } } @@ -72,15 +72,10 @@ namespace CalamityMod.Projectiles.Typeless Vector2 dustPos = dustCircle.RandomPointInCircle(); if ((dustPos - Projectile.Center).Length() > 48) { - int dustIndex = Dust.NewDust(dustPos, 1, 1, DustID.Sand); - Main.dust[dustIndex].noGravity = true; - Main.dust[dustIndex].fadeIn = 1f; - Vector2 dustVelocity = Projectile.Center - Main.dust[dustIndex].position; - float distToCenter = dustVelocity.Length(); - dustVelocity.Normalize(); - dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); - dustVelocity *= distToCenter * 0.04f; - Main.dust[dustIndex].velocity = dustVelocity; + Dust sand = Dust.NewDustPerfect(dustPos, DustID.Sand); + sand.noGravity = true; + sand.fadeIn = 1f; + sand.velocity = Projectile.SafeDirectionTo(dustPos).RotatedBy(-MathHelper.PiOver4) * Vector2.Distance(Projectile.Center, dustPos) * 0.04f; } } @@ -97,7 +92,7 @@ namespace CalamityMod.Projectiles.Typeless // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = SandCloak.KnockbackStrength * MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); + float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; diff --git a/Projectiles/Typeless/ShadeNimbus.cs b/Projectiles/Typeless/ShadeNimbus.cs new file mode 100644 index 0000000000..593d90780c --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbus.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbus : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; + + public const float Lifespan = 210f; + public ref float RainTimer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 24; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + } + + if (Projectile.velocity.Length() > 0.5f) + Projectile.velocity *= 0.9765f; + else + Projectile.velocity = Vector2.Zero; + + // Push away horizontally from other shade nimbuses + float pushForce = 0.02f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distanceGate = 20f; + if (sameProjType && taxicabDist < distanceGate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + } + } + + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= Lifespan) + { + Projectile.alpha += 5; + if (Projectile.alpha > 255) + { + Projectile.alpha = 255; + Projectile.Kill(); + } + } + else if (Projectile.ai[1] >= 15f) + { + RainTimer += 1f; + if (RainTimer > 8f) + { + RainTimer = 0f; + if (Projectile.owner == Main.myPlayer) + { + float rainX = Projectile.position.X + Main.rand.NextFloat(14f, Projectile.width - 28f); + float rainY = Projectile.position.Y + Projectile.height + 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), rainX, rainY, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + } + } + } + } + + // The cloud doesn't deal damage, just the rain + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/ShadeNimbusRain.cs b/Projectiles/Typeless/ShadeNimbusRain.cs new file mode 100644 index 0000000000..6e16735484 --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbusRain.cs @@ -0,0 +1,43 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbusRain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Boss/ShaderainHostile"; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.alpha = 50; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; + } + + public override void OnKill(int timeLeft) + { + int shadeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, DustID.Demonite, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[shadeDust]; + dust.position.X -= 2f; + dust.alpha = 38; + dust.velocity *= 0.1f; + dust.velocity += -Projectile.oldVelocity * 0.25f; + dust.scale = 0.95f; + } + + public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, Projectile.alpha); + + public override void OnHitNPC(NPC target, NPC.HitInfo info, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + } +} diff --git a/Projectiles/Typeless/ShadeNimbusSpawner.cs b/Projectiles/Typeless/ShadeNimbusSpawner.cs new file mode 100644 index 0000000000..a29894b24e --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbusSpawner.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbusSpawner : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/NPCs/HiveMind/DankCreeper"; + + public ref float EffectStrength => ref Projectile.ai[2]; // 1 Rotten Brain, 2 Amal Brain, 3 The Amalgam + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 35; + } + + public override void AI() => Projectile.rotation = Projectile.velocity.X * 0.05f; + + // The spawner should not deal damage + public override bool? CanDamage() => false; + + public override void OnKill(int timeLeft) + { + // Kill sound, dust, and gores of Dank Creeper + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + + for (int k = 0; k < 20; k++) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Glass, Projectile.velocity.X > 0f ? 1f : -1f, -1f); + + if (Main.netMode != NetmodeID.Server) + { + Vector2 goreVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y * 0.4f); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore2").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore3").Type); + } + + // Spawn shade rain clouds out to the sides + // Number of clouds and their damage scale based on what accessory in the upgrade path triggered it (damage is set when the spawner is created) + int cloudAmt = EffectStrength == 3f ? 10 : EffectStrength == 2f ? 6 : 4; + for (int c = -(cloudAmt / 2); c < cloudAmt / 2; c++) + { + Vector2 cloudVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 72f) * Main.rand.NextFloat(4.5f, 11f); + cloudVelocity *= c < 0f ? -1f : 1f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cloudVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + } + } + } +} diff --git a/Projectiles/Typeless/SabatonSlam.cs b/Projectiles/Typeless/StomperSlam.cs similarity index 96% rename from Projectiles/Typeless/SabatonSlam.cs rename to Projectiles/Typeless/StomperSlam.cs index 8abe1134e2..53cc78a957 100644 --- a/Projectiles/Typeless/SabatonSlam.cs +++ b/Projectiles/Typeless/StomperSlam.cs @@ -11,7 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class SabatonSlam : ModProjectile, ILocalizedModType + public class StomperSlam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Typeless } if (Projectile.localAI[0] == 0) { - scaleFromFall = (Projectile.ai[0] / 22) + 0.5f; + scaleFromFall = (Projectile.ai[0] / 20) + 0.5f; damageScaleFromFall = Projectile.ai[0] / 40; Projectile.damage = (int)(300f * damageScaleFromFall + 300f); diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 64b1ae6879..1185a9aa11 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -60,12 +60,6 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; Projectile.Center = player.Center; - if (player is null || player.dead) - { - player.ClearBuff(ModContent.BuffType()); - player.Calamity().tesla = false; - Projectile.Kill(); - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -100,32 +94,7 @@ namespace CalamityMod.Projectiles.Typeless Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); - float opacity = 1f; - int sparkCount = 0; - int fadeTime = 20; - - if (Projectile.timeLeft < fadeTime) - { - opacity = Projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - Projectile.timeLeft; - } - - for (int i = 0; i < sparkCount * 2; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - float rangeDiff = 2f; - - Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustPos.Normalize(); - dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - - int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } + float opacity = Main.player[Projectile.owner].Calamity().teslaVisuals ? 1f : 0.25f; Main.EntitySpriteDraw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Typeless/SabatonBoom.cs b/Projectiles/Typeless/TitanHeartBoom.cs similarity index 95% rename from Projectiles/Typeless/SabatonBoom.cs rename to Projectiles/Typeless/TitanHeartBoom.cs index 4a7a7d32bb..06a5e3623a 100644 --- a/Projectiles/Typeless/SabatonBoom.cs +++ b/Projectiles/Typeless/TitanHeartBoom.cs @@ -3,7 +3,7 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class SabatonBoom : ModProjectile, ILocalizedModType + public class TitanHeartBoom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; diff --git a/Projectiles/Typeless/UrsaSlash.cs b/Projectiles/Typeless/UrsaSlash.cs new file mode 100644 index 0000000000..37b13b72f8 --- /dev/null +++ b/Projectiles/Typeless/UrsaSlash.cs @@ -0,0 +1,113 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class UrsaSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float radius = 65f; + public bool visuals = true; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = (int)radius; + Projectile.friendly = true; + Projectile.DamageType = AverageDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + if (visuals) + { + bool visible = Owner.Calamity().ursaSergeantVisual; + Vector2 slashDir = new Vector2(13, 13).RotatedByRandom(100); + Vector2 slashPos1 = Projectile.Center + slashDir.RotatedBy(MathHelper.ToRadians(90f)); + Vector2 slashPos2 = Projectile.Center + slashDir.RotatedBy(MathHelper.ToRadians(-90f)); + + for (int i = 0; i < 3; i++) + { + Particle bigSpark = new GlowSparkParticle(Projectile.Center - slashDir * 6, slashDir * 0.65f, false, 19, 0.07f * (1 - i * 0.25f), Color.Coral * (visible ? 1 : 0.3f), new Vector2(1.9f, 1), true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(bigSpark); + Particle spark1 = new GlowSparkParticle(slashPos1 - slashDir * 6, slashDir * 0.65f, false, 19, 0.052f * (1 - i * 0.25f), Color.DarkTurquoise * (visible ? 1 : 0.3f), new Vector2(1.9f, 1), true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark1); + Particle spark2 = new GlowSparkParticle(slashPos2 - slashDir * 6, slashDir * 0.65f, false, 19, 0.052f * (1 - i * 0.25f), Color.DarkTurquoise * (visible ? 1 : 0.3f), new Vector2(1.9f, 1), true, false, 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); + } + for (int i = 0; i <= 9; i++) + { + int dustStyle = Main.rand.NextBool() ? 66 : 263; + Dust dust = Dust.NewDustPerfect(Projectile.Center - slashDir * 6, dustStyle); + dust.scale = Main.rand.NextFloat(0.6f, 1.2f) * (visible ? 1 : 0.3f); + dust.velocity = slashDir.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.3f, 2); + dust.noGravity = true; + dust.color = Color.Coral; + if (!visible) + { + dust.noLight = true; + dust.noLightEmittence = true; + } + Dust dust2 = Dust.NewDustPerfect(slashPos1 - slashDir * 6, dustStyle); + dust2.scale = Main.rand.NextFloat(0.6f, 1.2f) * (visible ? 1 : 0.3f); + dust2.velocity = slashDir.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.3f, 2); + dust2.noGravity = true; + dust2.color = Color.DarkTurquoise; + if (!visible) + { + dust2.noLight = true; + dust2.noLightEmittence = true; + } + Dust dust3 = Dust.NewDustPerfect(slashPos2 - slashDir * 6, dustStyle); + dust3.scale = Main.rand.NextFloat(0.6f, 1.2f) * (visible ? 1 : 0.3f); + dust3.velocity = slashDir.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.3f, 2); + dust3.noGravity = true; + dust3.color = Color.DarkTurquoise; + if (!visible) + { + dust3.noLight = true; + dust3.noLightEmittence = true; + } + } + + if (visible) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/AstralSlash", 3); + SoundEngine.PlaySound(sound with { Volume = 0.65f }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(sound2 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.4f, 0.5f) }, Projectile.Center); + } + } + visuals = false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.7f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + public override bool? CanDamage() => base.CanDamage(); + public override bool? CanCutTiles() => false; + } +} diff --git a/Scenes/MusicScenes/ProvidenceMusicScene.cs b/Scenes/MusicScenes/ProvidenceMusicScene.cs index 4965e5b757..7cc9fdd909 100644 --- a/Scenes/MusicScenes/ProvidenceMusicScene.cs +++ b/Scenes/MusicScenes/ProvidenceMusicScene.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs.Providence; +using CalamityMod.Projectiles.Boss; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,8 +11,33 @@ namespace CalamityMod.Systems public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; public override int NPCType => ModContent.NPCType(); - public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Providence"); + public override int? MusicModMusic + { + get + { + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.type == ModContent.ProjectileType() && proj.timeLeft > 35) + { + return MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + } + } + return CalamityMod.Instance.GetMusicFromMusicMod("Providence"); + } + } public override int VanillaMusic => MusicID.LunarBoss; public override int OtherworldMusic => MusicID.OtherworldlyLunarBoss; + public override void SpecialVisuals(Player player, bool isActive) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + Projectile proj = Main.projectile[i]; + if (isActive && proj.type == ModContent.ProjectileType() && proj.timeLeft <= 35) + { + Main.musicFade[Main.curMusic] = 1f; + } + } + } } } diff --git a/Sounds/Custom/GreatSandSharkRoar.ogg b/Sounds/Custom/GreatSandSharkRoar.ogg index a6761195bf..5b0a19e994 100644 Binary files a/Sounds/Custom/GreatSandSharkRoar.ogg and b/Sounds/Custom/GreatSandSharkRoar.ogg differ diff --git a/Sounds/Custom/SharkoonBoom.ogg b/Sounds/Custom/SharkoonBoom.ogg new file mode 100644 index 0000000000..bed6187a7a Binary files /dev/null and b/Sounds/Custom/SharkoonBoom.ogg differ diff --git a/Sounds/Custom/ur.ogg b/Sounds/Custom/ur.ogg new file mode 100644 index 0000000000..d8c84eb7b8 Binary files /dev/null and b/Sounds/Custom/ur.ogg differ diff --git a/Sounds/Item/ArsenalOffCooldown.ogg b/Sounds/Item/ArsenalOffCooldown.ogg new file mode 100644 index 0000000000..3be62abb8b Binary files /dev/null and b/Sounds/Item/ArsenalOffCooldown.ogg differ diff --git a/Sounds/Item/AstralSlash1.ogg b/Sounds/Item/AstralSlash1.ogg new file mode 100644 index 0000000000..608266515a Binary files /dev/null and b/Sounds/Item/AstralSlash1.ogg differ diff --git a/Sounds/Item/AstralSlash2.ogg b/Sounds/Item/AstralSlash2.ogg new file mode 100644 index 0000000000..d5045d9593 Binary files /dev/null and b/Sounds/Item/AstralSlash2.ogg differ diff --git a/Sounds/Item/AstralSlash3.ogg b/Sounds/Item/AstralSlash3.ogg new file mode 100644 index 0000000000..279180ec88 Binary files /dev/null and b/Sounds/Item/AstralSlash3.ogg differ diff --git a/Sounds/Item/ChainPull.ogg b/Sounds/Item/ChainPull.ogg new file mode 100644 index 0000000000..f0e5d4ab00 Binary files /dev/null and b/Sounds/Item/ChainPull.ogg differ diff --git a/Sounds/Item/FuguBlow.ogg b/Sounds/Item/FuguBlow.ogg new file mode 100644 index 0000000000..0742c84e48 Binary files /dev/null and b/Sounds/Item/FuguBlow.ogg differ diff --git a/Sounds/Item/HeliumFlashCharge.ogg b/Sounds/Item/HeliumFlashCharge.ogg new file mode 100644 index 0000000000..bac7219115 Binary files /dev/null and b/Sounds/Item/HeliumFlashCharge.ogg differ diff --git a/Sounds/Item/HeliumFlashCoreImpact.ogg b/Sounds/Item/HeliumFlashCoreImpact.ogg new file mode 100644 index 0000000000..f6fc3238df Binary files /dev/null and b/Sounds/Item/HeliumFlashCoreImpact.ogg differ diff --git a/Sounds/Item/HeliumFlashDudFire.ogg b/Sounds/Item/HeliumFlashDudFire.ogg new file mode 100644 index 0000000000..0a4f154be3 Binary files /dev/null and b/Sounds/Item/HeliumFlashDudFire.ogg differ diff --git a/Sounds/Item/HeliumFlashExplodeNoMetal.ogg b/Sounds/Item/HeliumFlashExplodeNoMetal.ogg new file mode 100644 index 0000000000..0a92c514e4 Binary files /dev/null and b/Sounds/Item/HeliumFlashExplodeNoMetal.ogg differ diff --git a/Sounds/Item/HeliumFlashFire.ogg b/Sounds/Item/HeliumFlashFire.ogg new file mode 100644 index 0000000000..53ce7544c1 Binary files /dev/null and b/Sounds/Item/HeliumFlashFire.ogg differ diff --git a/Sounds/Item/HeliumFlashFullChargeLoop.ogg b/Sounds/Item/HeliumFlashFullChargeLoop.ogg new file mode 100644 index 0000000000..5b2b889c9e Binary files /dev/null and b/Sounds/Item/HeliumFlashFullChargeLoop.ogg differ diff --git a/Sounds/Item/HeliumFlashReady.ogg b/Sounds/Item/HeliumFlashReady.ogg new file mode 100644 index 0000000000..69bfb600bc Binary files /dev/null and b/Sounds/Item/HeliumFlashReady.ogg differ diff --git a/Sounds/Item/HeliumFlashReadyAlt.ogg b/Sounds/Item/HeliumFlashReadyAlt.ogg new file mode 100644 index 0000000000..355124aaa7 Binary files /dev/null and b/Sounds/Item/HeliumFlashReadyAlt.ogg differ diff --git a/Sounds/Item/HeliumFlashSteamRelease.ogg b/Sounds/Item/HeliumFlashSteamRelease.ogg new file mode 100644 index 0000000000..11a852f711 Binary files /dev/null and b/Sounds/Item/HeliumFlashSteamRelease.ogg differ diff --git a/Sounds/Item/HellbornImpact.ogg b/Sounds/Item/HellbornImpact.ogg new file mode 100644 index 0000000000..630befa59a Binary files /dev/null and b/Sounds/Item/HellbornImpact.ogg differ diff --git a/Sounds/Item/HellbornReload.ogg b/Sounds/Item/HellbornReload.ogg new file mode 100644 index 0000000000..098e08b0e0 Binary files /dev/null and b/Sounds/Item/HellbornReload.ogg differ diff --git a/Sounds/Item/HellbornShoot.ogg b/Sounds/Item/HellbornShoot.ogg new file mode 100644 index 0000000000..f136ea748b Binary files /dev/null and b/Sounds/Item/HellbornShoot.ogg differ diff --git a/Sounds/Item/ImpalerLaunch.ogg b/Sounds/Item/ImpalerLaunch.ogg new file mode 100644 index 0000000000..78d57487ca Binary files /dev/null and b/Sounds/Item/ImpalerLaunch.ogg differ diff --git a/Sounds/Item/MantisSwipe1.ogg b/Sounds/Item/MantisSwipe1.ogg new file mode 100644 index 0000000000..59ca52080c Binary files /dev/null and b/Sounds/Item/MantisSwipe1.ogg differ diff --git a/Sounds/Item/MantisSwipe2.ogg b/Sounds/Item/MantisSwipe2.ogg new file mode 100644 index 0000000000..b0e0945c36 Binary files /dev/null and b/Sounds/Item/MantisSwipe2.ogg differ diff --git a/Sounds/Item/MeldBurn.ogg b/Sounds/Item/MeldBurn.ogg new file mode 100644 index 0000000000..1a46abd532 Binary files /dev/null and b/Sounds/Item/MeldBurn.ogg differ diff --git a/Sounds/Item/MeldExplosion.ogg b/Sounds/Item/MeldExplosion.ogg new file mode 100644 index 0000000000..b7dbfd24de Binary files /dev/null and b/Sounds/Item/MeldExplosion.ogg differ diff --git a/Sounds/Item/MeldShoot.ogg b/Sounds/Item/MeldShoot.ogg new file mode 100644 index 0000000000..1b9dad1e50 Binary files /dev/null and b/Sounds/Item/MeldShoot.ogg differ diff --git a/Sounds/Item/MeldSlice.ogg b/Sounds/Item/MeldSlice.ogg new file mode 100644 index 0000000000..41e7a1479c Binary files /dev/null and b/Sounds/Item/MeldSlice.ogg differ diff --git a/Sounds/Item/PhantasmalFuryShoot.ogg b/Sounds/Item/PhantasmalFuryShoot.ogg new file mode 100644 index 0000000000..27b47390c1 Binary files /dev/null and b/Sounds/Item/PhantasmalFuryShoot.ogg differ diff --git a/Sounds/Item/RadiationBurst.ogg b/Sounds/Item/RadiationBurst.ogg new file mode 100644 index 0000000000..df865e2b1c Binary files /dev/null and b/Sounds/Item/RadiationBurst.ogg differ diff --git a/Sounds/Item/RadiationRain.ogg b/Sounds/Item/RadiationRain.ogg new file mode 100644 index 0000000000..29823ce07b Binary files /dev/null and b/Sounds/Item/RadiationRain.ogg differ diff --git a/Sounds/Item/SevensStrikerBustGFB.ogg b/Sounds/Item/SevensStrikerBustGFB.ogg new file mode 100644 index 0000000000..b7b48240ea Binary files /dev/null and b/Sounds/Item/SevensStrikerBustGFB.ogg differ diff --git a/Sounds/Item/SevensStrikerJackpotGFB.ogg b/Sounds/Item/SevensStrikerJackpotGFB.ogg new file mode 100644 index 0000000000..1393f65a70 Binary files /dev/null and b/Sounds/Item/SevensStrikerJackpotGFB.ogg differ diff --git a/Sounds/Item/ShadowboltReflect.ogg b/Sounds/Item/ShadowboltReflect.ogg new file mode 100644 index 0000000000..a2d84277be Binary files /dev/null and b/Sounds/Item/ShadowboltReflect.ogg differ diff --git a/Sounds/Item/ShadowboltWallHit.ogg b/Sounds/Item/ShadowboltWallHit.ogg new file mode 100644 index 0000000000..9293a99d50 Binary files /dev/null and b/Sounds/Item/ShadowboltWallHit.ogg differ diff --git a/Sounds/Item/SharkoonBoom.ogg b/Sounds/Item/SharkoonBoom.ogg new file mode 100644 index 0000000000..8dd94403c2 Binary files /dev/null and b/Sounds/Item/SharkoonBoom.ogg differ diff --git a/Sounds/Item/SwingMid.ogg b/Sounds/Item/SwingMid.ogg new file mode 100644 index 0000000000..ce336917ff Binary files /dev/null and b/Sounds/Item/SwingMid.ogg differ diff --git a/Sounds/Item/ViperSpit.ogg b/Sounds/Item/ViperSpit.ogg new file mode 100644 index 0000000000..b7fb928fa1 Binary files /dev/null and b/Sounds/Item/ViperSpit.ogg differ diff --git a/Sounds/NPCHit/GreatSandSharkHit.ogg b/Sounds/NPCHit/GreatSandSharkHit.ogg index 9f7db8deb5..8042ffaa81 100644 Binary files a/Sounds/NPCHit/GreatSandSharkHit.ogg and b/Sounds/NPCHit/GreatSandSharkHit.ogg differ diff --git a/Sounds/NPCKilled/GreatSandSharkDeath.ogg b/Sounds/NPCKilled/GreatSandSharkDeath.ogg index 19f1aac3ef..bf2471e824 100644 Binary files a/Sounds/NPCKilled/GreatSandSharkDeath.ogg and b/Sounds/NPCKilled/GreatSandSharkDeath.ogg differ diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index 897754c9a7..2b95101060 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -46,7 +46,6 @@ namespace CalamityMod CalamityGlobalNPC.draedonExoMechWorm = -1; CalamityGlobalNPC.adultEidolonWyrmHead = -1; BossRushEvent.BossRushStage = 0; - ArmoredDiggerSpawnCooldown = 0; BossRushEvent.BossRushActive = false; BossRushEvent.BossRushSpawnCountdown = 180; BossRushEvent.HostileProjectileKillCounter = 0; diff --git a/Systems/MusicEventSystem.cs b/Systems/MusicEventSystem.cs index 8349dca788..676a712615 100644 --- a/Systems/MusicEventSystem.cs +++ b/Systems/MusicEventSystem.cs @@ -53,20 +53,20 @@ namespace CalamityMod.Systems } AddEntry("CloneDefeated", "Interlude1", TimeSpan.FromSeconds(214.577d), - () => DownedBossSystem.downedCalamitasClone, () => CalamityConfig.Instance.Interlude1); + () => DownedBossSystem.downedCalamitasClone, () => CalamityClientConfig.Instance.Interlude1); AddEntry("MLDefeated", "Interlude2", TimeSpan.FromSeconds(191.912d), () => NPC.downedMoonlord, - () => CalamityConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); + () => CalamityClientConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); // Alternative Interlude 2 -> AddEntry("MLDefeated", "Interlude2_CutIntro", TimeSpan.FromSeconds(160.989d), - // () => NPC.downedMoonlord, () => CalamityConfig.Instance.Interlude2, + // () => NPC.downedMoonlord, () => CalamityClientConfig.Instance.Interlude2, // outroSilence: TimeSpan.FromSeconds(1f)); AddEntry("YharonDefeated", "Interlude3", TimeSpan.FromSeconds(295.932d), - () => DownedBossSystem.downedYharon, () => CalamityConfig.Instance.Interlude3); + () => DownedBossSystem.downedYharon, () => CalamityClientConfig.Instance.Interlude3); AddEntry("DoGDefeated", "DevourerofGodsEulogy", TimeSpan.FromSeconds(203.620d), - () => DownedBossSystem.downedDoG, () => CalamityConfig.Instance.DevourerofGodsEulogy, + () => DownedBossSystem.downedDoG, () => CalamityClientConfig.Instance.DevourerofGodsEulogy, introSilence: TimeSpan.FromSeconds(7.5f)); // Acceptance is NOT toggleable in the config diff --git a/Systems/NerfExpertDebuffsSystem.cs b/Systems/NerfExpertDebuffsSystem.cs index 49a6da275c..67ea9cdaaa 100644 --- a/Systems/NerfExpertDebuffsSystem.cs +++ b/Systems/NerfExpertDebuffsSystem.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Systems public override void PostUpdateTime() { // Reduce the expert+ debuff time multiplier to the normal mode multiplier - if (CalamityConfig.Instance.NerfExpertDebuffs) + if (CalamityServerConfig.Instance.NerfExpertDebuffs) { var copy = Main.RegisteredGameModes[GameModeID.Expert]; copy.DebuffTimeMultiplier = 1f; diff --git a/Systems/ORDERSystem.cs b/Systems/ORDERSystem.cs index 565546dbb0..d30877afca 100644 --- a/Systems/ORDERSystem.cs +++ b/Systems/ORDERSystem.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Systems } // DIE! - public static void JUDGMENT() + public static void JUDGEMENT() { if (!currentlyPlaying) orderSoundSlot = SoundEngine.PlaySound(ORDERTrack); diff --git a/Systems/Quests/AmidiasQuest.cs b/Systems/Quests/AmidiasQuest.cs new file mode 100644 index 0000000000..43d8e1642e --- /dev/null +++ b/Systems/Quests/AmidiasQuest.cs @@ -0,0 +1,15 @@ +namespace CalamityMod.Systems.Quests +{ + /// + /// The different progression points of Amidias' Quest. + /// + public enum AmidiasQuestProgression + { + KilledGiantClam, + } + + /// + /// A ModSystem which controls, progresses, saves, and loads the data necessary for Amidias' Quest. + /// + public class AmidiasQuest : Quest { } +} diff --git a/Systems/Quests/Quest.cs b/Systems/Quests/Quest.cs new file mode 100644 index 0000000000..e424ce291c --- /dev/null +++ b/Systems/Quests/Quest.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Systems.Quests +{ + /// + /// An that implements the foundation to make quests in Terraria
+ /// and making their data be saved and loaded accordingly. + ///
+ /// A which contains all the progression points of the quest + public abstract class Quest : ModSystem where TEnum : Enum + { + #region Data Saving & Loading + + public override void Unload() => QuestProgression = null; + + public override void ClearWorld() + { + // Resets all the properties when loading a world without a TagCompound. + + QuestStarted = false; + QuestFinished = false; + QuestProgression = ResetQuestProgression(); + } + + public override void LoadWorldData(TagCompound tag) + { + QuestStarted = tag.ContainsKey("questStarted"); + QuestFinished = tag.ContainsKey("questFinished"); + + QuestProgression = ResetQuestProgression(); + + // Although this method may seem weird, it's endorsed by tML on their guides for save & loading dictionaries. + if (tag.TryGet>("questProgression", out var value)) + QuestProgression = QuestProgression.Keys.Zip(value, (k, v) => new { Key = k, Value = v }).ToDictionary(x => x.Key, x => x.Value); + } + + public override void SaveWorldData(TagCompound tag) + { + // If any of them have modified values from the default value, we save them on the TagCompound. + + if (QuestStarted) + tag.Add("questStarted", QuestStarted); + + if (QuestFinished) + tag.Add("questFinished", QuestFinished); + + if (QuestProgression.ContainsValue(true)) + tag.Add("questProgression", QuestProgression.Values.ToList()); + } + + #endregion + + /// + /// Whether or not this quest has started. + /// + public static bool QuestStarted { get; private set; } + + /// + /// Whether or not this quest has finished. + /// + public static bool QuestFinished { get; private set; } + + /// + /// A dictionary that saves a boolean for each progression point, to state which one was completed and which one was not. + /// + public static Dictionary QuestProgression { get; private set; } = ResetQuestProgression(); + + /// + /// An event that is triggered when this quest starts. + /// + public static event Action OnQuestStarted; + + /// + /// An event that is triggered when this quest finishes. + /// + public static event Action OnQuestFinish; + + /// + /// An event that is triggered when this quest completes a new progression point. + /// + public static event Action OnQuestProgression; + + /// + /// A method that makes this quest start and trigger its corresponding event.
+ /// Does nothing if the quest has already started. + ///
+ public static void StartQuest() + { + if (!QuestStarted) + { + QuestStarted = true; + OnQuestStarted?.Invoke(); + } + } + + /// + /// A method that makes this quest finishes and trigger its corresponding event.
+ /// Does nothing if the quest has already finished. + ///
+ public static void FinishQuest() + { + if (!QuestFinished) + { + QuestFinished = true; + OnQuestFinish?.Invoke(); + } + } + + /// + /// A method that makes a progression point be counted as completed.
+ /// Does nothing if the progression point has already been completed. + ///
+ /// The progression point that has been completed. + public static void ProgressQuest(TEnum progressionPoint) + { + if (!QuestProgression[progressionPoint]) + { + QuestProgression[progressionPoint] = true; + OnQuestProgression?.Invoke(progressionPoint); + } + } + + /// + /// A quick method to resets the progression of Amidias' Quest.
+ /// Used for when changing worlds or initializing . + ///
+ private static Dictionary ResetQuestProgression() + { + Dictionary questProgression = new(); + var progressionPoints = Enum.GetValues(typeof(TEnum)); + foreach (TEnum progressionPoint in progressionPoints) + questProgression.Add(progressionPoint, false); + return questProgression; + } + } +} diff --git a/Systems/RecipeSystem.cs b/Systems/RecipeSystem.cs index 792d606922..22c09a7d10 100644 --- a/Systems/RecipeSystem.cs +++ b/Systems/RecipeSystem.cs @@ -804,6 +804,7 @@ namespace CalamityMod.Systems { r => r.HasResult(ItemID.HorseshoeBundle) && !r.HasIngredient(ItemID.BundleofBalloons), AddIngredient(ModContent.ItemType(), 3) }, { Vanilla(ItemID.NightsEdge), AddIngredient(ModContent.ItemType(), 5) }, { Vanilla(ItemID.FairyBoots), AddIngredient(ItemID.SoulofLight, 5) }, + { Vanilla(ItemID.FairyBell), RemoveIngredient(ItemID.SoulofSight) }, { Vanilla(ItemID.HellfireTreads), AddIngredient(ModContent.ItemType(), 4) }, { Vanilla(ItemID.SpiritFlame), AddGroup(AnyAdamantiteBar, 2) }, { Vanilla(ItemID.TerraBlade), AddIngredient(ModContent.ItemType(), 12) }, @@ -815,7 +816,7 @@ namespace CalamityMod.Systems { VanillaEach( ItemID.MechanicalEye, ItemID.MechanicalWorm, ItemID.MechanicalSkull, ItemID.MechdusaSummon, ItemID.DaoofPow, ItemID.Chik, ItemID.MeteorStaff, ItemID.CoolWhip, - ItemID.AngelWings, ItemID.DemonWings, ItemID.FairyWings, + ItemID.AngelWings, ItemID.DemonWings, ItemID.FairyWings, ItemID.FairyBell, ItemID.CursedArrow, ItemID.CursedBullet, ItemID.IchorArrow, ItemID.IchorBullet), ReplaceTile(TileID.MythrilAnvil, TileID.Anvils) }, @@ -1277,15 +1278,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Shadow Key - r = Recipe.Create(ItemID.ShadowKey); - r.AddIngredient(ItemID.GoldenKey); - r.AddIngredient(ItemID.Obsidian, 10); - r.AddIngredient(ItemID.Bone, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Sky Mill r = Recipe.Create(ItemID.SkyMill); r.AddIngredient(ItemID.SunplateBlock, 10); @@ -1699,14 +1691,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Shoe Spikes - r = Recipe.Create(ItemID.ShoeSpikes); - r.AddRecipeGroup("IronBar", 5); - r.AddIngredient(ItemID.Spike, 5); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Flare Gun r = Recipe.Create(ItemID.FlareGun); r.AddRecipeGroup(AnyCopperBar, 5); diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index c172445a7b..eb8fc619f6 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Systems // Reset this int because it causes bugs with other mods if you delete Dr. Draedon through abnormal means. if (CalamityGlobalNPC.draedon != -1) { - if (!NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(NPCType())) CalamityGlobalNPC.draedon = -1; } @@ -85,7 +85,6 @@ namespace CalamityMod.Systems if (player is not null && player.active) { CalamityPlayer modPlayer = player.Calamity(); - TrySpawnArmoredDigger(player, modPlayer); TrySpawnDungeonGuardian(player); TrySpawnAEoW(player, modPlayer); } @@ -132,13 +131,13 @@ namespace CalamityMod.Systems if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45) { IEntitySource source = new EntitySource_WorldEvent(); - Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ProjectileType(), 0, 0f); } if (DraedonSummonCountdown == 0) { IEntitySource source = new EntitySource_WorldEvent(); - NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); + NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, NPCType()); } } #endregion Handle Draedon Summoning @@ -242,7 +241,7 @@ namespace CalamityMod.Systems if (CalamityGlobalTile.GrowthTiles.Contains(tileType) && growthTile.Slope == SlopeType.Solid && !growthTile.IsHalfBlock) { int growthChance = 2; - if (tileType == ModContent.TileType()) + if (tileType == TileType()) growthChance *= 5; if (Main.rand.NextBool(growthChance)) @@ -269,18 +268,18 @@ namespace CalamityMod.Systems { Tile tile = Main.tile[x, y]; bool growTile = !tile.HasTile && tile.LiquidAmount >= 128; - bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType(); + bool isSunkenSeaTile = tileType == TileType() || tileType == TileType(); bool meetsAdditionalGrowConditions = tile.Slope == SlopeType.Solid && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; if (growTile && meetsAdditionalGrowConditions) { - int tileType2 = ModContent.TileType(); + int tileType2 = TileType(); - if (tileType == ModContent.TileType()) - tileType2 = ModContent.TileType(); + if (tileType == TileType()) + tileType2 = TileType(); bool canPlaceBasedOnAttached = true; - if (tileType2 == ModContent.TileType() && !isSunkenSeaTile) + if (tileType2 == TileType() && !isSunkenSeaTile) canPlaceBasedOnAttached = false; if (canPlaceBasedOnAttached && CanPlaceBasedOnProximity(x, y, tileType2)) @@ -395,7 +394,7 @@ namespace CalamityMod.Systems public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !DownedBossSystem.downedLeviathan) + if (tileType == TileType() && !DownedBossSystem.downedLeviathan) return false; int minDistanceFromOtherTiles = 10; @@ -417,70 +416,6 @@ namespace CalamityMod.Systems } #endregion - #region Handle Armored Digger Random Spawns - public static void TrySpawnArmoredDigger(Player player, CalamityPlayer modPlayer) - { - bool gfbCondition = Main.zenithWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; - if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle)) && !player.ZoneDungeon && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) - { - if (NPC.downedPlantBoss && player.townNPCs < 3f) - { - double spawnRate = 100000D; - - if (CalamityWorld.LegendaryMode && revenge) - spawnRate *= 0.25D; - - if (revenge) - spawnRate *= 0.85D; - - if (death && Main.bloodMoon) - spawnRate *= 0.2D; - if (modPlayer.zerg) - spawnRate *= 0.5D; - if (modPlayer.chaosCandle) - spawnRate *= 0.6D; - if (player.enemySpawns) - spawnRate *= 0.7D; - if (Main.SceneMetrics.WaterCandleCount > 0) - spawnRate *= 0.8D; - - if (modPlayer.isNearbyBoss && CalamityConfig.Instance.BossZen) - spawnRate *= 50D; - if (modPlayer.zen || (CalamityConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) - spawnRate *= 2D; - if (modPlayer.tranquilityCandle) - spawnRate *= 1.67D; - if (player.calmed) - spawnRate *= 1.43D; - if (Main.SceneMetrics.PeaceCandleCount > 0) - spawnRate *= 1.25D; - - int chance = (int)spawnRate; - if (Main.rand.NextBool(chance)) - { - if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient && - ArmoredDiggerSpawnCooldown <= 0) - { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - ArmoredDiggerSpawnCooldown = 36000; - } - } - } - } - if (ArmoredDiggerSpawnCooldown > 0) - { - ArmoredDiggerSpawnCooldown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ArmoredDiggerCountdownSync); - netMessage.Write(ArmoredDiggerSpawnCooldown); - netMessage.Send(); - } - } - } - #endregion - #region Handle Dungeon Guardian Spawns public static void TrySpawnDungeonGuardian(Player player) { @@ -507,7 +442,7 @@ namespace CalamityMod.Systems bool adultWyrmAlive = CalamityGlobalNPC.adultEidolonWyrmHead != -1 && Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active; if (!adultWyrmAlive) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, NPCType()); } #endregion } diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 36a6baef26..e791568ddc 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -148,11 +148,11 @@ namespace CalamityMod.Systems })); } - // All further tasks occur after vanilla worldgen is completed + // All further tasks occur right before vanilla worldgen is completed (which includes The Dirtiest Block and final secret seed adjustments) int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { - int currentFinalIndex = FinalIndex; + int currentFinalIndex = FinalIndex - 1; // Reallocate gems so rarity corresponds to depth tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => @@ -306,6 +306,16 @@ namespace CalamityMod.Systems progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.Roxcalibur").Value; MiscWorldgenRoutines.PlaceRoxShrine(); })); + + // No Traps/GFB Auric Land Mines + if (Main.noTrapsWorld) + { + tasks.Insert(++currentFinalIndex, new PassLegacy("Auric Land Mines", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AuricLandMines").Value; + MiscWorldgenRoutines.GenerateAuricLandMines(); + })); + } } } @@ -333,7 +343,7 @@ namespace CalamityMod.Systems // Disable gen pass if Early Hardmode Rework is disabled. // Could just not add/remove gen pass, but that could lead to mod conflicts // in case whatever mod targets this specific gen pass. - if (!CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) { hardmodeOreT1Pass.Disable(); } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs index 97a4ee60a2..dce2106312 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -12,8 +12,16 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { public class AbyssGiantKelp1 : ModTile { + protected virtual string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow"; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + if (!string.IsNullOrEmpty(GlowAsset)) + { + GlowMask = new(GlowAsset, 18, 18); + } + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 2; @@ -65,23 +73,20 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask is not null && GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + Vector2 pos = new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + spriteBatch.Draw(GlowMask.Texture, pos, frame, Color.White); + } } } //just clone the first one its literally the same size public class AbyssGiantKelp2 : AbyssGiantKelp1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs index 0178df170f..77ed6250f1 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -12,8 +12,12 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { public class AbyssGiantKelp3 : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow", 18, 18); + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 2; @@ -65,10 +69,12 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + spriteBatch.Draw(GlowMask.Texture, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs index 5d7deca65d..d239d0098b 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -12,8 +12,12 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { public class AbyssGiantKelp4 : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow", 18, 18); + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 2; @@ -65,10 +69,12 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + spriteBatch.Draw(GlowMask.Texture, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + } } } } diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree.cs b/Tiles/Abyss/AbyssAmbient/BulbTree.cs index b8fcb75a47..146de972b3 100644 --- a/Tiles/Abyss/AbyssAmbient/BulbTree.cs +++ b/Tiles/Abyss/AbyssAmbient/BulbTree.cs @@ -11,8 +11,16 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { public class BulbTree1 : ModTile { + protected virtual string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow"; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + if (!string.IsNullOrEmpty(GlowAsset)) + { + GlowMask = new(GlowAsset, 18, 18); + } + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 3; @@ -48,34 +56,24 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask is not null && GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + Vector2 pos = new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + spriteBatch.Draw(GlowMask.Texture, pos, frame, Color.White); + } } } public class BulbTree2 : BulbTree1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow"; } public class BulbTree3 : BulbTree1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs index 6d8da9a561..af87b809f4 100644 --- a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs +++ b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs @@ -9,11 +9,22 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Abyss.AbyssAmbient { + // + // Pirate Crate With Glow + public class PirateCrate1 : ModTile { + protected virtual string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow"; + internal static FramedGlowMask GlowMask; + public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; public override void SetStaticDefaults() { + if (!string.IsNullOrEmpty(GlowAsset)) + { + GlowMask = new(GlowAsset, 18, 18); + } + Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; Main.tileWaterDeath[Type] = false; @@ -33,7 +44,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient //explode when broken (troll!) //also instakill players in for the worthy Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); - Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition.X, spawnPosition.Y, 0, 0, ProjectileID.Explosives, Main.getGoodWorld ? 99999 : 130, 0f); + // NOTE: The damage of ProjectileID.Explosives is reduced in CalamityPlayerHitHurt, this actually deals 52 / 67 / 101 damage. + int blastDamage = (Main.getGoodWorld ? 99999 : 150) * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition.X, spawnPosition.Y, 0, 0, ProjectileID.Explosives, blastDamage, 0f); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -44,37 +57,30 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask is not null && GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + Vector2 pos = new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + spriteBatch.Draw(GlowMask.Texture, pos, frame, Color.White); + } } } public class PirateCrate2 : PirateCrate1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate2Glow"; } public class PirateCrate3 : PirateCrate1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/PirateCrate3Glow"; } + // + // Pirate Crate Without Glow + public class PirateCrate4 : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/CrateBreak", 3) { Volume = 0.8f }; diff --git a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs index 11f62b915d..c9fbaa387a 100644 --- a/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SpiderCoral.cs @@ -13,8 +13,16 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { public class SpiderCoral1 : ModTile { + protected virtual string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow"; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + if (!string.IsNullOrEmpty(GlowAsset)) + { + GlowMask = new(GlowAsset, 18, 18); + } + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; @@ -36,58 +44,34 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask is not null && GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + Vector2 pos = new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + spriteBatch.Draw(GlowMask.Texture, pos, frame, Color.White); + } } } public class SpiderCoral2 : SpiderCoral1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow"; } public class SpiderCoral3 : SpiderCoral1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow"; } public class SpiderCoral4 : SpiderCoral1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow"; } public class SpiderCoral5 : SpiderCoral1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs index 0c5ee30a41..0e4c74303f 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurPireCoral.cs @@ -11,8 +11,16 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient { public class SulphurPireCoral1 : ModTile { + protected virtual string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow"; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + if (!string.IsNullOrEmpty(GlowAsset)) + { + GlowMask = new(GlowAsset, 18, 18); + } + Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; TileObjectData.newTile.Width = 3; @@ -48,34 +56,24 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + if (GlowMask is not null && GlowMask.HasContentInFramePos(tile.TileFrameX, tile.TileFrameY)) + { + Vector2 pos = new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + spriteBatch.Draw(GlowMask.Texture, pos, frame, Color.White); + } } } public class SulphurPireCoral2 : SulphurPireCoral1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow"; } public class SulphurPireCoral3 : SulphurPireCoral1 { - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - } + protected override string GlowAsset => "CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow"; } } diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs index a37f2547ef..b126b95158 100644 --- a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs +++ b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs @@ -71,13 +71,18 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { + if (steamTimer <= 450) + return; + + if (!Main.rand.NextBool(3)) + return; + float positionInterpolant = (i + j) * 0.041f % 1f; Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; smokeVelocity.Y -= Main.rand.Next(3, 6); - if (steamTimer >= 450 && Main.rand.NextBool(3)) - Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 20 : 30, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 20 : 30, 0f); } } } diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs index f6e031ce93..48a803f6df 100644 --- a/Tiles/Abyss/PyreMantleMolten.cs +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Tiles.Abyss public class PyreMantleMolten : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Abyss/PyreMantleMolten_Glowmask", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/Abyss/PyreMantleMolten_Glowmask", 18, 18); Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; @@ -77,23 +77,26 @@ namespace CalamityMod.Tiles.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(200, 200, 200, 200)); - Tile trackTile = Main.tile[i, j]; - float glowbrightness = 1f; - float glowspeed = Main.GameUpdateCount * 0.01f; - glowbrightness *= (float)MathF.Sin(i / 60f + glowspeed); - drawColour *= glowbrightness; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); - glowbrightness += 0.3f; + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(200, 200, 200, 200)); + Tile trackTile = Main.tile[i, j]; + float glowbrightness = 1f; + float glowspeed = Main.GameUpdateCount * 0.01f; + glowbrightness *= (float)MathF.Sin(i / 60f + glowspeed); + drawColour *= glowbrightness; + double num6 = Main.time * 0.08; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + glowbrightness += 0.3f; + } } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index 7056860026..eddcede916 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -54,13 +54,18 @@ namespace CalamityMod.Tiles.Abyss if (!Main.gamePaused && t.TileFrameX % 36 == 0 && t.TileFrameY % 36 == 0 && Collision.CanHitLine(spawnPosition, 1, 1, spawnPosition - Vector2.UnitY * 100f, 1, 1)) { + if (steamTimer <= 180) + return; + + if (!Main.rand.NextBool(3)) + return; + float positionInterpolant = (i + j) * 0.041f % 1f; Vector2 smokeVelocity = -Vector2.UnitY.RotatedByRandom(0.11f) * MathHelper.Lerp(4.8f, 8.1f, positionInterpolant); smokeVelocity.X += (float)Math.Cos(MathHelper.TwoPi * positionInterpolant) * 1.1f; smokeVelocity.Y -= Main.rand.Next(3, 6); - if (steamTimer >= 180 && Main.rand.NextBool(3)) - Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 15 : 23, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition, smokeVelocity, ModContent.ProjectileType(), Main.expertMode ? 15 : 23, 0f); } } } diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index af545c680f..c63eefe42f 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -15,12 +15,11 @@ namespace CalamityMod.Tiles.Abyss public class Voidstone : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Abyss/Voidstone_Glowmask", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/Abyss/Voidstone_Glowmask", 18, 18); Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -168,7 +167,7 @@ namespace CalamityMod.Tiles.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; int xPos = Main.tile[i, j].TileFrameX; @@ -262,19 +261,23 @@ namespace CalamityMod.Tiles.Abyss xOffset *= 234; xPos += xOffset; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(255, 255, 255, 255)); - Tile trackTile = Main.tile[i, j]; - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawColour *= brightness; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(255, 255, 255, 255)); + Tile trackTile = Main.tile[i, j]; + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= 0.5f; + drawColour *= brightness; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index 18ff19942a..43204bb557 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Astral TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; - + TileID.Sets.Conversion.Dirt[Type] = true; this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index 2ea9214d4b..f7f937fcec 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -15,9 +15,13 @@ namespace CalamityMod.Tiles private const short subsheetWidth = 324; private const short subsheetHeight = 90; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/AstralBrickGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; HitSound = SoundID.Tink; @@ -56,13 +60,16 @@ namespace CalamityMod.Tiles yOffset *= subsheetHeight; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/AstralBrickGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + Tile trackTile = Main.tile[i, j]; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index 27b8b2a29e..7fc6237c15 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Tiles.AstralSnow AddMapEntry(new Color(189, 211, 221)); TileID.Sets.Snow[Type] = true; + TileID.Sets.Conversion.Snow[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeClearedDuringOreRunner[Type] = true; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index da3a59a6f7..a40f0dd4fe 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -85,9 +85,6 @@ namespace CalamityMod.Tiles } } - // This function has two purposes: - // 1 - Shatters adjacent Lumenyl or Sea Prism crystals when a neighboring solid tile is destroyed - // 2 - Gives the player breath back when breaking blocks with Reaver set bonus public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) { Tile tile = Main.tile[i, j]; @@ -309,13 +306,6 @@ namespace CalamityMod.Tiles if (player is null || !player.active) return; - if (player.Calamity().reaverExplore && !fail) - { - player.breath += 20; - if (player.breath > player.breathMax) - player.breath = player.breathMax; - } - // Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse if (player.Calamity().miningSet && player.Calamity().miningSetCooldown <= 0 && !fail && TileID.Sets.Ore[tile.TileType]) { @@ -352,25 +342,47 @@ namespace CalamityMod.Tiles public override void Drop(int i, int j, int type)/* tModPorter Suggestion: Use CanDrop to decide if items can drop, use this method to drop additional items. See documentation. */ { - Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); - if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) + // Handle for Demon Altar Drops + // Drop: + // - Soul of Night (x4) (Only if Early Hardmode Progression Rework is on) + // - Evil Smasher (x1) (Every 12th altar) + if (type == TileID.DemonAltar && Main.hardMode) { - if (type == TileID.DemonAltar && Main.hardMode) + Vector2 spreadMinMax = new Vector2(-32.0f, 32.0f); + + // Drop 4 Soul of Night + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) { - Vector2 pos = new Vector2(i, j) * 16; - if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) - { - WorldGen.altarCount++; - int quantity = 4; - for (int k = 0; k < quantity; k += 1) - { - pos.X += Main.rand.NextFloat(-32f, 32f); - pos.Y += Main.rand.NextFloat(-32f, 32f); - Item.NewItem(new EntitySource_TileBreak(i, j), pos, ItemID.SoulofNight); - } - } - if (WorldGen.altarCount % 12 == 0 && WorldGen.altarCount > 1) - Item.NewItem(new EntitySource_TileBreak(i, j), pos, ModContent.ItemType()); + DropItem(i, j, ItemID.SoulofNight, quantity: 4, asStack: false, spreadMinMax); + WorldGen.altarCount++; // altarCount does not update automatically if ProgressionRework is enabled! + } + + // Drop Evil Smasher on every 12 alter smashed + if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) + { + DropItem(i, j, ModContent.ItemType(), quantity: 1, asStack: true); + } + } + } + + private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default) + { + // Multiplayer Client should not spawn item themselves + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + Vector2 worldPos = new Vector2(i, j) * 16.0f; + if (asStack) + { + Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y); + Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: quantity); + } + else + { + for (int k = 0; k < quantity; k += 1) + { + Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y); + Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: 1); } } } diff --git a/Tiles/Crags/Tree/SpineSapling.cs b/Tiles/Crags/Tree/SpineSapling.cs index 140f46a145..e1af1f142c 100644 --- a/Tiles/Crags/Tree/SpineSapling.cs +++ b/Tiles/Crags/Tree/SpineSapling.cs @@ -57,5 +57,7 @@ namespace CalamityMod.Tiles.Crags.Tree } } } + + public override bool CanDrop(int i, int j) => false; } } diff --git a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs index 28ecf21af7..b0c3781911 100644 --- a/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs +++ b/Tiles/Furniture/BabyCannonballJellyfishBowlTile.cs @@ -32,6 +32,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 8; diff --git a/Tiles/Furniture/BabyFlakCrabCageTile.cs b/Tiles/Furniture/BabyFlakCrabCageTile.cs index 2e1ad66170..79cf298931 100644 --- a/Tiles/Furniture/BabyFlakCrabCageTile.cs +++ b/Tiles/Furniture/BabyFlakCrabCageTile.cs @@ -13,9 +13,11 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; + TileID.Sets.CritterCageLidStyle[Type] = TileID.Sets.CritterCageLidStyle[TileID.BunnyCage]; // Big, gray lid TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); TileObjectData.addTile(Type); AnimationFrameHeight = 54; @@ -33,6 +35,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 34; diff --git a/Tiles/Furniture/BabyGhostBellJarTile.cs b/Tiles/Furniture/BabyGhostBellJarTile.cs index a7a504383a..5f29ee1dee 100644 --- a/Tiles/Furniture/BabyGhostBellJarTile.cs +++ b/Tiles/Furniture/BabyGhostBellJarTile.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 8; diff --git a/Tiles/Furniture/CorruptionEffigy.cs b/Tiles/Furniture/CorruptionEffigy.cs index 55513d9acf..f0b28ff9f7 100644 --- a/Tiles/Furniture/CorruptionEffigy.cs +++ b/Tiles/Furniture/CorruptionEffigy.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; @@ -25,6 +24,12 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Origin = new Point16(0, 3); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); TileObjectData.addTile(Type); AddMapEntry(new Color(126, 156, 134), CalamityUtils.GetItemName()); } diff --git a/Tiles/Furniture/CorruptionEffigy.png b/Tiles/Furniture/CorruptionEffigy.png index fef465f910..4389f81731 100644 Binary files a/Tiles/Furniture/CorruptionEffigy.png and b/Tiles/Furniture/CorruptionEffigy.png differ diff --git a/Tiles/Furniture/CrimsonEffigy.cs b/Tiles/Furniture/CrimsonEffigy.cs index 12d51122ad..c11e47db6c 100644 --- a/Tiles/Furniture/CrimsonEffigy.cs +++ b/Tiles/Furniture/CrimsonEffigy.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; @@ -25,6 +24,12 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Origin = new Point16(0, 3); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); TileObjectData.addTile(Type); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); } diff --git a/Tiles/Furniture/CrimsonEffigy.png b/Tiles/Furniture/CrimsonEffigy.png index ef06cd32e7..623df7c679 100644 Binary files a/Tiles/Furniture/CrimsonEffigy.png and b/Tiles/Furniture/CrimsonEffigy.png differ diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.cs b/Tiles/Furniture/EffigyOfDecayPlaceable.cs index 9bf1b0aefd..e8f70ad6d6 100644 --- a/Tiles/Furniture/EffigyOfDecayPlaceable.cs +++ b/Tiles/Furniture/EffigyOfDecayPlaceable.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; @@ -26,6 +25,12 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.newTile.Origin = new Point16(0, 3); TileObjectData.newTile.UsesCustomCanPlace = true; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); TileObjectData.addTile(Type); AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); } diff --git a/Tiles/Furniture/EffigyOfDecayPlaceable.png b/Tiles/Furniture/EffigyOfDecayPlaceable.png index 61db8a5d83..375640636b 100644 Binary files a/Tiles/Furniture/EffigyOfDecayPlaceable.png and b/Tiles/Furniture/EffigyOfDecayPlaceable.png differ diff --git a/Tiles/Furniture/LanternCenterTile.cs b/Tiles/Furniture/LanternCenterTile.cs index 5d87d1aad6..6744a2c100 100644 --- a/Tiles/Furniture/LanternCenterTile.cs +++ b/Tiles/Furniture/LanternCenterTile.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -25,6 +26,8 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.addTile(Type); AddMapEntry(new Color(99, 99, 99), CalamityUtils.GetItemName()); TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.InteractibleByNPCs[Type] = true; + TileID.Sets.DisableSmartInteract[Type] = true; AnimationFrameHeight = 54; } @@ -35,12 +38,21 @@ namespace CalamityMod.Tiles.Furniture public override void AnimateTile(ref int frame, ref int frameCounter) { - frameCounter++; - if (frameCounter >= 6) + if (!LanternNight.LanternsUp) { - frame = (frame + 1) % 6; + frame = 0; frameCounter = 0; } + else + { + frameCounter++; + if (frameCounter >= 6) + { + frame = (frame + 1) % 7; + frameCounter = 0; + } + frame = Math.Clamp(frame, 1, 6); + } } public override void KillMultiTile(int i, int j, int frameX, int frameY) @@ -50,13 +62,11 @@ namespace CalamityMod.Tiles.Furniture public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); LanternNight.ToggleManualLanterns(); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); LanternNight.ToggleManualLanterns(); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; diff --git a/Tiles/Furniture/LanternCenterTile.png b/Tiles/Furniture/LanternCenterTile.png index 1f8cc97ef3..fffbe3d12e 100644 Binary files a/Tiles/Furniture/LanternCenterTile.png and b/Tiles/Furniture/LanternCenterTile.png differ diff --git a/Tiles/Furniture/LanternCenterTile_Highlight.png b/Tiles/Furniture/LanternCenterTile_Highlight.png index 6e86215b5d..7c9e7546ef 100644 Binary files a/Tiles/Furniture/LanternCenterTile_Highlight.png and b/Tiles/Furniture/LanternCenterTile_Highlight.png differ diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index 517372277c..55aacb60f9 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -13,9 +13,11 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileTable[Type] = true; + TileID.Sets.CritterCageLidStyle[Type] = TileID.Sets.CritterCageLidStyle[TileID.BunnyCage]; // Big, gray lid TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); TileObjectData.addTile(Type); AnimationFrameHeight = 54; @@ -33,6 +35,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 34; diff --git a/Tiles/Furniture/SeaMinnowJarTile.cs b/Tiles/Furniture/SeaMinnowJarTile.cs index d8f90548b8..6d8ae9201b 100644 --- a/Tiles/Furniture/SeaMinnowJarTile.cs +++ b/Tiles/Furniture/SeaMinnowJarTile.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Tiles.Furniture { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.InteractibleByNPCs[Type] = true; // Emulating Fish Bowl. NPCs do not interact with Jelly jars (probably because they're deadly or something) TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); AnimationFrameHeight = 36; @@ -33,6 +33,8 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => offsetY = 2; + public override void AnimateTile(ref int frame, ref int frameCounter) { int frameAmt = 12; diff --git a/Tiles/Furniture/SunkenIdolTile.cs b/Tiles/Furniture/SunkenIdolTile.cs new file mode 100644 index 0000000000..e3d5dadf61 --- /dev/null +++ b/Tiles/Furniture/SunkenIdolTile.cs @@ -0,0 +1,51 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class SunkenIdolTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 18 }; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + + TileObjectData.addTile(Type); + AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName()); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BlueMoss); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/Furniture/SunkenIdolTile.png b/Tiles/Furniture/SunkenIdolTile.png new file mode 100644 index 0000000000..5db73b921f Binary files /dev/null and b/Tiles/Furniture/SunkenIdolTile.png differ diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index c43658ab80..44abdceee6 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -10,8 +10,12 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class SmoothBrimstoneSlag : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurnitureAshen/SmoothBrimstoneSlagGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; @@ -37,13 +41,16 @@ namespace CalamityMod.Tiles.FurnitureAshen { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/SmoothBrimstoneSlagGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); + Tile trackTile = Main.tile[i, j]; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs index adf9d77758..0cb0752600 100644 --- a/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs +++ b/Tiles/FurnitureAuric/ActivatedAuricPanelTile.cs @@ -11,11 +11,12 @@ namespace CalamityMod.Tiles.FurnitureAuric { public class ActivatedAuricPanelTile : ModTile { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/FurnitureAuric/ActivatedAuricPanelTile_Glow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; HitSound = AuricOre.MineSound; @@ -34,13 +35,17 @@ namespace CalamityMod.Tiles.FurnitureAuric { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, Color.White); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs b/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs index 740c2d764d..4b38dc3aac 100644 --- a/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs +++ b/Tiles/FurnitureAuric/AuricRepulserPanelTile.cs @@ -11,11 +11,12 @@ namespace CalamityMod.Tiles.FurnitureAuric { public class AuricRepulserPanelTile : ModTile { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/FurnitureAuric/AuricRepulserPanelTile_Glow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; HitSound = AuricOre.MineSound; @@ -34,13 +35,17 @@ namespace CalamityMod.Tiles.FurnitureAuric { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, Color.White); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureAuric/ExoAuricPanelTile.cs b/Tiles/FurnitureAuric/ExoAuricPanelTile.cs index 8431ec84e0..23738fec60 100644 --- a/Tiles/FurnitureAuric/ExoAuricPanelTile.cs +++ b/Tiles/FurnitureAuric/ExoAuricPanelTile.cs @@ -11,11 +11,12 @@ namespace CalamityMod.Tiles.FurnitureAuric { public class ExoAuricPanelTile : ModTile { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/FurnitureAuric/ExoAuricPanelTile_Glow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; HitSound = AuricOre.MineSound; @@ -34,13 +35,17 @@ namespace CalamityMod.Tiles.FurnitureAuric { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, Color.White); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index b8af599897..56c0145275 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -10,8 +10,12 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBrick : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBrickGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; HitSound = SoundID.Tink; @@ -30,14 +34,17 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBrickGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, Color.White); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, Color.White); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureExo/ExoPlatingTile.cs b/Tiles/FurnitureExo/ExoPlatingTile.cs index 44edc712ae..e9362c3376 100644 --- a/Tiles/FurnitureExo/ExoPlatingTile.cs +++ b/Tiles/FurnitureExo/ExoPlatingTile.cs @@ -11,14 +11,11 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoPlatingTile : ModTile { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPlatingTileGlow", AssetRequestMode.ImmediateLoad).Value; - } + GlowMask = new("CalamityMod/Tiles/FurnitureExo/ExoPlatingTileGlow", 18, 18); Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -49,18 +46,22 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); int xPos = tile.TileFrameX; int frameOffset = j % 2 * AnimationFrameHeight; int yPos = tile.TileFrameY + frameOffset; - Color drawColour = GetDrawColour(i, j, Color.White); - Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Color drawColour = GetDrawColour(i, j, Color.White); + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/FurnitureExo/ExoPrismPanelTile.cs b/Tiles/FurnitureExo/ExoPrismPanelTile.cs index f3c9429df2..5d531fb550 100644 --- a/Tiles/FurnitureExo/ExoPrismPanelTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPanelTile.cs @@ -11,14 +11,11 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoPrismPanelTile : ModTile { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPrismPanelTileGlow", AssetRequestMode.ImmediateLoad).Value; - } + GlowMask = new("CalamityMod/Tiles/FurnitureExo/ExoPrismPanelTileGlow", 18, 18); Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -49,18 +46,22 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); int xPos = tile.TileFrameX; int frameOffset = (i + j) % 6 * AnimationFrameHeight; int yPos = tile.TileFrameY + frameOffset; - Color drawColour = GetDrawColour(i, j, Color.White); - Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Color drawColour = GetDrawColour(i, j, Color.White); + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 1cebc94b13..8df409c0d9 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -10,8 +10,12 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public class PlaguedPlate : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurniturePlaguedPlate/PlaguedPlateGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; HitSound = SoundID.Tink; @@ -39,12 +43,15 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurniturePlaguedPlate/PlaguedPlateGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); + Tile trackTile = Main.tile[i, j]; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index 65721061b7..6e6dc45c34 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -16,14 +16,16 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate Main.tileFrameImportant[Type] = true; Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; + TileID.Sets.InteractibleByNPCs[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.IsValidSpawnPoint[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This bed has different dimensions to conventional beds, using bookcase dimentions instead TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CreateMapEntryName()); - TileID.Sets.DisableSmartCursor[Type] = true; - AdjTiles = new int[] { TileID.Beds }; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(191, 142, 111), CreateMapEntryName()); + AdjTiles = new int[] { TileID.Beds }; } public override bool CreateDust(int i, int j, ref int type) @@ -51,12 +53,12 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate if (player.SpawnX == spawnX && player.SpawnY == spawnY) { player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20); + Main.NewText(Language.GetTextValue("Game.SpawnPointRemoved"), 255, 240, 20); } else if (Player.CheckSpawn(spawnX, spawnY)) { player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20); + Main.NewText(Language.GetTextValue("Game.SpawnPointSet"), 255, 240, 20); } return true; } diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index 609d66f9b3..da4358dccc 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -11,8 +11,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedRock : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurnitureProfaned/ProfanedRockGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -128,6 +132,9 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (GlowMask.Texture is null) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; int xOffset = 0; @@ -218,13 +225,15 @@ namespace CalamityMod.Tiles.FurnitureProfaned } xOffset *= 288; xPos += xOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedRockGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(25, 25, 25, 25)); + Tile trackTile = Main.tile[i, j]; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index d734338fe6..d3b35e775b 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -11,8 +11,12 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class RunicProfanedBrick : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -50,13 +54,16 @@ namespace CalamityMod.Tiles.FurnitureProfaned yOffset *= AnimationFrameHeight; xPos += xOffset; yPos += yOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/RunicProfanedBrickGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(128, 128, 128, 128)); + Tile trackTile = Main.tile[i, j]; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 5f124a73a4..da0b76cb1d 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -10,8 +10,12 @@ namespace CalamityMod.Tiles.FurnitureStratus { public class StratusBricks : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurnitureStratus/StratusBricksGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; @@ -39,13 +43,16 @@ namespace CalamityMod.Tiles.FurnitureStratus { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusBricksGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Tile trackTile = Main.tile[i, j]; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index cc0cf79aa6..2332a12843 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -11,8 +11,12 @@ namespace CalamityMod.Tiles.FurnitureVoid { public class SmoothVoidstone : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow", 18, 18); + Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -217,20 +221,23 @@ namespace CalamityMod.Tiles.FurnitureVoid } xOffset *= 288; xPos += xOffset; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureVoid/SmoothVoidstoneGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(255, 255, 255, 255)); - Tile trackTile = Main.tile[i, j]; - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawColour *= brightness; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(255, 255, 255, 255)); + Tile trackTile = Main.tile[i, j]; + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawColour *= brightness; + + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/GiantPlanteraBulb.cs b/Tiles/GiantPlanteraBulb.cs index f2c9e3c6d7..0d14f8dfcf 100644 --- a/Tiles/GiantPlanteraBulb.cs +++ b/Tiles/GiantPlanteraBulb.cs @@ -15,14 +15,11 @@ namespace CalamityMod.Tiles { public class GiantPlanteraBulb : ModTile { - public static Asset Glow { get; private set; } + public static FramedGlowMask GlowMask { get; private set; } public override void Load() { - if (!Main.dedServ) - { - Glow = ModContent.Request($"{Texture}Glow"); - } + GlowMask = new($"{Texture}Glow", 18, 18); } public override void SetStaticDefaults() @@ -65,12 +62,6 @@ namespace CalamityMod.Tiles HitSound = SoundID.Grass; } - public override void Unload() - { - // Textures are auto disposed by tModLoader, all we need to do is get rid of the asset wrapper reference - Glow = null; - } - // Use the second map entry in Hardmode public override ushort GetMapOption(int i, int j) { @@ -205,12 +196,18 @@ namespace CalamityMod.Tiles { var tile = Main.tile[i, j]; - spriteBatch.Draw( - Glow.Value, - new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + CalamityUtils.TileDrawOffset, - new Rectangle(tile.TileFrameX, tile.TileFrameY + AnimationFrameHeight * Main.tileFrame[Type], 16, 16), - Color.Yellow - ); + var xPos = tile.TileFrameX; + var yPos = tile.TileFrameY + AnimationFrameHeight * Main.tileFrame[Type]; + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw( + GlowMask.Texture, + new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + CalamityUtils.TileDrawOffset, + new Rectangle(xPos, yPos, 16, 16), + Color.Yellow + ); + } } } } diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.cs b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs new file mode 100644 index 0000000000..10f9f299e6 --- /dev/null +++ b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +namespace CalamityMod.Tiles.LivingFire +{ + public class LivingPlagueFireBlockTile : ModTile + { + //Thank you to Seraph for getting living fire blocks to work properly. + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + HitSound = SoundID.Dig; + AddMapEntry(new Color(0, 171, 31)); + AnimationFrameHeight = 90; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = false; + Main.tileFrameImportant[Type] = false; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); + + TileObjectData.addTile(Type); + } + + public int CanPlaceAlter(int i, int j, int type, int style, int direction, int alternate) => 1; + + public static int AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 1, 1); + } + return 1; + } + + public override bool CanPlace(int i, int j) + { + List> around = new List> + { + new List() {i, j-1 }, + new List() {i-1, j }, + new List() {i+1, j }, + new List() {i, j+1 } + }; + //if (Main.tile[i, j]) || tile.type == Type + + //return true; //temporary for testing purposes + + if (Main.tile[i, j].WallType != WallID.None) + { + return true; + } + + for (int k = 0; k < around.Count; ++k) + { + Tile tile = Main.tile[around[k][0], around[k][1]]; + if (tile.HasTile && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) + { + return true; + } + } + return false; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frame = Main.tileFrame[TileID.LivingFire]; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0f; + g = 1f; + b = 0.2f; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.Plague, 0f, 0f, 1, default, 1f); + return false; + } + } +} diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.png b/Tiles/LivingFire/LivingPlagueFireBlockTile.png new file mode 100644 index 0000000000..2282b3ce0a Binary files /dev/null and b/Tiles/LivingFire/LivingPlagueFireBlockTile.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 75470b3984..4432adf882 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -361,7 +361,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 106: - npc = NPCType(); + npc = NPCType(); break; case 108: npc = NPCType(); diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 2b9da5ece9..0b1f23af65 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Astral; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -28,7 +30,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.OreMergesWithMud[Type] = true; - MinPick = 210; + MinPick = 110; DustType = 173; AddMapEntry(new Color(255, 153, 255), CreateMapEntryName()); MineResist = 3f; @@ -36,7 +38,8 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; + // TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; + TileID.Sets.AvoidedByMeteorLanding[Type] = true; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AstralDirtMerge"); } @@ -57,14 +60,23 @@ namespace CalamityMod.Tiles.Ores } } - public override bool CanKillTile(int i, int j, ref bool blockDamaged) + public override void RandomUpdate(int i, int j) { - return DownedBossSystem.downedAstrumDeus; + if (Main.rand.NextBool(4)) + { + int xRandom = Main.rand.Next(-3, 3); + int yRandom = Main.rand.Next(-3, 3); + if (Main.tile[i + xRandom, j + yRandom].TileType == TileID.Meteorite) + AstralBiome.ConvertToAstral(i + xRandom, j + yRandom, true); + } } - public override bool CanExplode(int i, int j) + public override IEnumerable GetItemDrops(int i, int j) { - return false; + if (!DownedBossSystem.downedAstrumDeus) + yield return new Item(ModContent.ItemType(), Main.rand.Next(1, 2 + 1)); + else + yield return new Item(ModContent.ItemType()); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index 8ae1f84b8b..851a2ab95b 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -19,13 +19,14 @@ namespace CalamityMod.Tiles.Ores { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/AuricMine", 3); public static bool Animate; - internal static Texture2D GlowTexture; + + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/Ores/AuricOreGlow", 18, 18); + AnimationFrameHeight = 90; Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; @@ -89,13 +90,16 @@ namespace CalamityMod.Tiles.Ores { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY + AnimationFrameHeight * Main.tileFrame[Type]; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/AuricOreGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(225, 255, 255, 255)); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(225, 255, 255, 255)); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index ab3dcf4236..5e163d274f 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -15,12 +15,12 @@ namespace CalamityMod.Tiles.Ores { public class PerennialOre : ModTile { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/PerennialOreGlow", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Tiles/Ores/PerennialOreGlow", 18, 18); + Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; @@ -198,7 +198,7 @@ namespace CalamityMod.Tiles.Ores public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; int xPos = Main.tile[i, j].TileFrameX; @@ -292,11 +292,15 @@ namespace CalamityMod.Tiles.Ores xOffset *= 234; xPos += xOffset; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(175, 175, 175, 175)); - Tile trackTile = Main.tile[i, j]; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(175, 175, 175, 175)); + Tile trackTile = Main.tile[i, j]; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index 7ae960e3d9..6801b8e6de 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -15,8 +15,12 @@ namespace CalamityMod.Tiles.Ores [LegacyName("ChaoticOre")] public class ScoriaOre : ModTile { + internal static FramedGlowMask GlowMask; + public override void SetStaticDefaults() { + GlowMask = new("CalamityMod/Tiles/Ores/ScoriaOreGlow", 18, 18); + Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -92,13 +96,16 @@ namespace CalamityMod.Tiles.Ores { int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Ores/ScoriaOreGlow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; - TileFramingSystem.SlopedGlowmask(i, j, 0, glowmask, drawOffset, null, GetDrawColour(i, j, drawColour), default); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawOffset, null, GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) diff --git a/Tiles/ScoriaBrick.cs b/Tiles/ScoriaBrick.cs index 0db0749b05..46f061f57b 100644 --- a/Tiles/ScoriaBrick.cs +++ b/Tiles/ScoriaBrick.cs @@ -14,15 +14,13 @@ namespace CalamityMod.Tiles public class ScoriaBrick : ModTile { int subsheetHeight = 72; - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/Tiles/ScoriaBrickGlow", AssetRequestMode.ImmediateLoad).Value; - } + GlowMask = new("CalamityMod/Tiles/ScoriaBrickGlow", 18, 18); + Main.tileLighted[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -61,17 +59,21 @@ namespace CalamityMod.Tiles public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { // If the cached textures don't exist for some reason, don't bother using them. - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); int xPos = tile.TileFrameX; int frameOffset = j % 2 * 72; int yPos = tile.TileFrameY + frameOffset; - Color drawColour = GetDrawColour(i, j, Color.White); - Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; - TileFramingSystem.SlopedGlowmask(i, j, 0, GlowTexture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), GetDrawColour(i, j, drawColour), default); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) + { + Color drawColour = GetDrawColour(i, j, Color.White); + Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; + TileFramingSystem.SlopedGlowmask(i, j, 0, GlowMask.Texture, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), GetDrawColour(i, j, drawColour), default); + } } private Color GetDrawColour(int i, int j, Color colour) { diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index afbb994bc5..ea58ed2b90 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -213,7 +213,7 @@ namespace CalamityMod.UI.CalamitasEnchants new Enchantment(CalamityUtils.GetText("UI.Tainted.DisplayName"), CalamityUtils.GetText("UI.Tainted.Description"), 800, "CalamityMod/UI/CalamitasEnchantments/CurseIcon_Tainted", - item => item.useTime = item.useAnimation = 25, + item => item.useAnimation = item.useTime = 25, (Player player) => { if (Main.gameMenu) diff --git a/UI/CooldownRackUI.cs b/UI/CooldownRackUI.cs index acd23acbd4..8c0469ba29 100644 --- a/UI/CooldownRackUI.cs +++ b/UI/CooldownRackUI.cs @@ -19,7 +19,7 @@ namespace CalamityMod.UI get { // Option 1: Always use compact icons if configured to do so. - if (CalamityConfig.Instance.CooldownDisplay == 1) + if (CalamityClientConfig.Instance.CooldownDisplay == 1) return true; // Option 2: If there are too many cooldowns, auto switch to compact mode. @@ -43,7 +43,7 @@ namespace CalamityMod.UI // 1 - The game isn't even on the game screen yet. // 2 - The player's inventory is open. // 3 - Cooldown display is completely disabled. - if (Main.gameMenu || Main.playerInventory || CalamityConfig.Instance.CooldownDisplay < 1) + if (Main.gameMenu || Main.playerInventory || CalamityClientConfig.Instance.CooldownDisplay < 1) return; IList cooldownsToDraw = Main.LocalPlayer.GetDisplayedCooldowns(); diff --git a/UI/DraedonsArsenal/ChargeMeterUI.cs b/UI/DraedonsArsenal/ChargeMeterUI.cs index 709f36a8dd..b3c159411e 100644 --- a/UI/DraedonsArsenal/ChargeMeterUI.cs +++ b/UI/DraedonsArsenal/ChargeMeterUI.cs @@ -38,7 +38,7 @@ namespace CalamityMod.UI.DraedonsArsenal public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.ChargeMeterPosX, CalamityConfig.Instance.ChargeMeterPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.ChargeMeterPosX, CalamityClientConfig.Instance.ChargeMeterPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultChargePosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -54,23 +54,23 @@ namespace CalamityMod.UI.DraedonsArsenal void SavePosition() { bool changed = false; - if (CalamityConfig.Instance.ChargeMeterPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.ChargeMeterPosX != screenRatioPosition.X) { - CalamityConfig.Instance.ChargeMeterPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.ChargeMeterPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } // If the Charge Meter is turned off or the player is not holding an item, stop. Item heldItem = player.ActiveItem(); - if (!CalamityConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir) + if (!CalamityClientConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir) { Reset(); SavePosition(); @@ -96,7 +96,7 @@ namespace CalamityMod.UI.DraedonsArsenal if (chargeBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // If the mouse is on top of the meter, show the exact numeric charge. @@ -106,7 +106,7 @@ namespace CalamityMod.UI.DraedonsArsenal Vector2 newScreenRatioPosition = screenRatioPosition; // Handle mouse dragging - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -124,15 +124,15 @@ namespace CalamityMod.UI.DraedonsArsenal Vector2 delta = newScreenRatioPosition - screenRatioPosition; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.ChargeMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.ChargeMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } } } diff --git a/UI/FlightBar/FlightBar.cs b/UI/FlightBar/FlightBar.cs index 60ec028cfb..9ceab28314 100644 --- a/UI/FlightBar/FlightBar.cs +++ b/UI/FlightBar/FlightBar.cs @@ -35,7 +35,7 @@ namespace CalamityMod.UI return disabledBarTexture; if ((modPlayer.infiniteFlight || RidingInfiniteFlightMount(modPlayer.Player)) && completedAnimation) return infiniteBarTexture; - if (modPlayer.weakPetrification || modPlayer.vHex || modPlayer.icarusFolly || modPlayer.DoGExtremeGravity) + if (modPlayer.weakPetrification || modPlayer.icarusFolly || modPlayer.DoGExtremeGravity) return limitedBarTexture; return borderTexture; } @@ -90,7 +90,7 @@ namespace CalamityMod.UI public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.FlightBarPosX, CalamityConfig.Instance.FlightBarPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.FlightBarPosX, CalamityClientConfig.Instance.FlightBarPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultFlightPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -106,26 +106,26 @@ namespace CalamityMod.UI CalamityPlayer modPlayer = player.Calamity(); // If not drawing the flight bar, save its latest position to config and leave. - if (CalamityConfig.Instance.FlightBar && ((player.wingsLogic > 0 && player.wingTimeMax > 0) || (player.mount.Active && player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet)) + if (CalamityClientConfig.Instance.FlightBar && ((player.wingsLogic > 0 && player.wingTimeMax > 0) || (player.mount.Active && player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet)) { DrawFlightBar(spriteBatch, modPlayer, screenPos); } else { bool changed = false; - if (CalamityConfig.Instance.FlightBarPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.FlightBarPosX != screenRatioPosition.X) { - CalamityConfig.Instance.FlightBarPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.FlightBarPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.FlightBarPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.FlightBarPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.FlightBarPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.FlightBarPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); return; } @@ -138,7 +138,7 @@ namespace CalamityMod.UI // Handle mouse dragging if (flightBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; if (modPlayer.Player.equippedWings != null && modPlayer.Player.wingTimeMax > 0 || (player.mount.Active && modPlayer.Player.mount._data.flightTimeMax > 0) || player.carpet && !player.canCarpet) //equipped wings or riding a flying mount and max wingtime/flighttime above 0 (so not disabled bar) @@ -149,7 +149,7 @@ namespace CalamityMod.UI Vector2 newScreenRatioPosition = screenRatioPosition; // As long as the mouse button is held down, drag the meter along with an offset. - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -167,15 +167,15 @@ namespace CalamityMod.UI Vector2 delta = newScreenRatioPosition - screenRatioPosition; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.FlightBarPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.FlightBarPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.FlightBarPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.FlightBarPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } } } diff --git a/UI/Rippers/RipperUI.cs b/UI/Rippers/RipperUI.cs index 6c8a3cde57..2f9cce458e 100644 --- a/UI/Rippers/RipperUI.cs +++ b/UI/Rippers/RipperUI.cs @@ -105,14 +105,14 @@ namespace CalamityMod.UI.Rippers public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned Rage Meter position - Vector2 rageScreenRatioPos = new Vector2(CalamityConfig.Instance.RageMeterPosX, CalamityConfig.Instance.RageMeterPosY); + Vector2 rageScreenRatioPos = new Vector2(CalamityClientConfig.Instance.RageMeterPosX, CalamityClientConfig.Instance.RageMeterPosY); if (rageScreenRatioPos.X < 0f || rageScreenRatioPos.X > 100f) rageScreenRatioPos.X = DefaultRagePosX; if (rageScreenRatioPos.Y < 0f || rageScreenRatioPos.Y > 100f) rageScreenRatioPos.Y = DefaultRagePosY; // Sanity check the planned Adrenaline Meter position - Vector2 adrenScreenRatioPos = new Vector2(CalamityConfig.Instance.AdrenalineMeterPosX, CalamityConfig.Instance.AdrenalineMeterPosY); + Vector2 adrenScreenRatioPos = new Vector2(CalamityClientConfig.Instance.AdrenalineMeterPosX, CalamityClientConfig.Instance.AdrenalineMeterPosY); if (adrenScreenRatioPos.X < 0f || adrenScreenRatioPos.X > 100f) adrenScreenRatioPos.X = DefaultAdrenPosX; if (adrenScreenRatioPos.Y < 0f || adrenScreenRatioPos.Y > 100f) @@ -135,18 +135,18 @@ namespace CalamityMod.UI.Rippers else { bool changed = false; - if (CalamityConfig.Instance.RageMeterPosX != rageScreenRatioPos.X) + if (CalamityClientConfig.Instance.RageMeterPosX != rageScreenRatioPos.X) { - CalamityConfig.Instance.RageMeterPosX = rageScreenRatioPos.X; + CalamityClientConfig.Instance.RageMeterPosX = rageScreenRatioPos.X; changed = true; } - if (CalamityConfig.Instance.RageMeterPosY != rageScreenRatioPos.Y) + if (CalamityClientConfig.Instance.RageMeterPosY != rageScreenRatioPos.Y) { - CalamityConfig.Instance.RageMeterPosY = rageScreenRatioPos.Y; + CalamityClientConfig.Instance.RageMeterPosY = rageScreenRatioPos.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } if (modPlayer.AdrenalineEnabled) @@ -154,18 +154,18 @@ namespace CalamityMod.UI.Rippers else { bool changed = false; - if (CalamityConfig.Instance.AdrenalineMeterPosX != adrenScreenRatioPos.X) + if (CalamityClientConfig.Instance.AdrenalineMeterPosX != adrenScreenRatioPos.X) { - CalamityConfig.Instance.AdrenalineMeterPosX = adrenScreenRatioPos.X; + CalamityClientConfig.Instance.AdrenalineMeterPosX = adrenScreenRatioPos.X; changed = true; } - if (CalamityConfig.Instance.AdrenalineMeterPosY != adrenScreenRatioPos.Y) + if (CalamityClientConfig.Instance.AdrenalineMeterPosY != adrenScreenRatioPos.Y) { - CalamityConfig.Instance.AdrenalineMeterPosY = adrenScreenRatioPos.Y; + CalamityClientConfig.Instance.AdrenalineMeterPosY = adrenScreenRatioPos.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } #region Mouse Interaction @@ -190,7 +190,7 @@ namespace CalamityMod.UI.Rippers if (rageHover && !adrenHover) { // If the meter isn't locked, then the player's mouse counts as being over interface - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // Add hover text if the mouse is over Rage bar @@ -199,7 +199,7 @@ namespace CalamityMod.UI.Rippers // The bar is draggable if enabled in config. Vector2 newScreenRatioPosition = rageScreenRatioPos; - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!rageDragOffset.HasValue) @@ -217,21 +217,21 @@ namespace CalamityMod.UI.Rippers Vector2 delta = newScreenRatioPosition - rageScreenRatioPos; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.RageMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.RageMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.RageMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.RageMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { rageDragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } } else if (adrenHover) { // If the meter isn't locked, then the player's mouse counts as being over interface - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // Add hover text if the mouse is over the bar @@ -241,7 +241,7 @@ namespace CalamityMod.UI.Rippers // The bar is draggable if enabled in config. Vector2 newScreenRatioPosition = adrenScreenRatioPos; - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!adrenDragOffset.HasValue) @@ -259,15 +259,15 @@ namespace CalamityMod.UI.Rippers Vector2 delta = newScreenRatioPosition - adrenScreenRatioPos; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.AdrenalineMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.AdrenalineMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.AdrenalineMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.AdrenalineMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { adrenDragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } } #endregion @@ -446,7 +446,7 @@ namespace CalamityMod.UI.Rippers #endregion private static Vector2 GetShakeOffset() { - float shake = CalamityConfig.Instance.RipperMeterShake; + float shake = CalamityClientConfig.Instance.RipperMeterShake; float shakeX = Main.rand.NextFloat(-shake, shake); float shakeY = Main.rand.NextFloat(-shake, shake); return new Vector2(shakeX, shakeY); diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index 6f340be742..7835193f47 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -44,11 +44,11 @@ namespace CalamityMod.UI public static void Draw(Player player) { - if (Main.gameMenu || !CalamityConfig.Instance.SpeedrunTimer) + if (Main.gameMenu || !CalamityClientConfig.Instance.SpeedrunTimer) return; // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.SpeedrunTimerPosX, CalamityConfig.Instance.SpeedrunTimerPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.SpeedrunTimerPosX, CalamityClientConfig.Instance.SpeedrunTimerPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultTimerPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 4562d8a1fe..5abcc3896f 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -41,7 +41,7 @@ namespace CalamityMod.UI public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.StealthMeterPosX, CalamityConfig.Instance.StealthMeterPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.StealthMeterPosX, CalamityClientConfig.Instance.StealthMeterPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultStealthPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -57,26 +57,26 @@ namespace CalamityMod.UI CalamityPlayer modPlayer = player.Calamity(); // If not drawing the stealth meter, save its latest position to config and leave. - if (modPlayer.stealthUIAlpha > 0f && CalamityConfig.Instance.StealthMeter && modPlayer.rogueStealthMax > 0f && modPlayer.wearingRogueArmor) + if (modPlayer.stealthUIAlpha > 0f && CalamityClientConfig.Instance.StealthMeter && modPlayer.rogueStealthMax > 0f && modPlayer.wearingRogueArmor) { DrawStealthBar(spriteBatch, modPlayer, screenPos); } else { bool changed = false; - if (CalamityConfig.Instance.StealthMeterPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.StealthMeterPosX != screenRatioPosition.X) { - CalamityConfig.Instance.StealthMeterPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.StealthMeterPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.StealthMeterPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.StealthMeterPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.StealthMeterPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.StealthMeterPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); @@ -88,7 +88,7 @@ namespace CalamityMod.UI // Handle mouse dragging if (stealthBar.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // If the mouse is on top of the meter, show the player's exact numeric stealth. @@ -113,7 +113,7 @@ namespace CalamityMod.UI Vector2 newScreenRatioPosition = screenRatioPosition; // As long as the mouse button is held down, drag the meter along with an offset. - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -131,15 +131,15 @@ namespace CalamityMod.UI Vector2 delta = newScreenRatioPosition - screenRatioPosition; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.StealthMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.StealthMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } } } diff --git a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs index a1a4899dab..97a3df2f64 100644 --- a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs +++ b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs @@ -37,7 +37,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter public static void Draw(SpriteBatch spriteBatch, Player player) { // Sanity check the planned position before drawing. This is done relative. - Vector2 screenRatioPosition = new Vector2(CalamityConfig.Instance.SulphuricWaterMeterPosX, CalamityConfig.Instance.SulphuricWaterMeterPosY); + Vector2 screenRatioPosition = new Vector2(CalamityClientConfig.Instance.SulphuricWaterMeterPosX, CalamityClientConfig.Instance.SulphuricWaterMeterPosY); if (screenRatioPosition.X < 0f || screenRatioPosition.X > 100f) screenRatioPosition.X = DefaultPosX; if (screenRatioPosition.Y < 0f || screenRatioPosition.Y > 100f) @@ -58,19 +58,19 @@ namespace CalamityMod.UI.SulphurousWaterMeter else { bool changed = false; - if (CalamityConfig.Instance.SulphuricWaterMeterPosX != screenRatioPosition.X) + if (CalamityClientConfig.Instance.SulphuricWaterMeterPosX != screenRatioPosition.X) { - CalamityConfig.Instance.SulphuricWaterMeterPosX = screenRatioPosition.X; + CalamityClientConfig.Instance.SulphuricWaterMeterPosX = screenRatioPosition.X; changed = true; } - if (CalamityConfig.Instance.SulphuricWaterMeterPosY != screenRatioPosition.Y) + if (CalamityClientConfig.Instance.SulphuricWaterMeterPosY != screenRatioPosition.Y) { - CalamityConfig.Instance.SulphuricWaterMeterPosY = screenRatioPosition.Y; + CalamityClientConfig.Instance.SulphuricWaterMeterPosY = screenRatioPosition.Y; changed = true; } if (changed) - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); @@ -82,7 +82,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter // Handle mouse dragging if (waterBarArea.Intersects(mouseHitbox)) { - if (!CalamityConfig.Instance.MeterPosLock) + if (!CalamityClientConfig.Instance.MeterPosLock) Main.LocalPlayer.mouseInterface = true; // If the mouse is on top of the meter, show the player's accumulated sulphuric poisoning. @@ -97,7 +97,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter Vector2 newScreenRatioPosition = screenRatioPosition; // As long as the mouse button is held down, drag the meter along with an offset. - if (!CalamityConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) + if (!CalamityClientConfig.Instance.MeterPosLock && ms.LeftButton == ButtonState.Pressed) { // If the drag offset doesn't exist yet, create it. if (!dragOffset.HasValue) @@ -115,15 +115,15 @@ namespace CalamityMod.UI.SulphurousWaterMeter Vector2 delta = newScreenRatioPosition - screenRatioPosition; if (Math.Abs(delta.X) >= MouseDragEpsilon || Math.Abs(delta.Y) >= MouseDragEpsilon) { - CalamityConfig.Instance.SulphuricWaterMeterPosX = newScreenRatioPosition.X; - CalamityConfig.Instance.SulphuricWaterMeterPosY = newScreenRatioPosition.Y; + CalamityClientConfig.Instance.SulphuricWaterMeterPosX = newScreenRatioPosition.X; + CalamityClientConfig.Instance.SulphuricWaterMeterPosY = newScreenRatioPosition.Y; } // When the mouse is released, save the config and destroy the drag offset. if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityMod.SaveConfig(CalamityConfig.Instance); + CalamityMod.SaveConfig(CalamityClientConfig.Instance); } } else diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 0b541aa8ec..2396f26e4c 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -52,7 +52,7 @@ namespace CalamityMod /// If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages. /// The texture to draw. Set to null to draw the projectile's own loaded texture. /// If false, the afterimages will be centered on the projectile's position instead of its own center. - public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true) + public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true, bool shrink = false) { if (texture is null) texture = TextureAssets.Projectile[proj.type].Value; @@ -72,7 +72,7 @@ namespace CalamityMod // If no afterimages are drawn due to an invalid mode being specified, ensure the projectile itself is drawn anyway. bool failedToDrawAfterimages = false; - if (CalamityConfig.Instance.Afterimages) + if (CalamityClientConfig.Instance.Afterimages) { Vector2 centerOffset = drawCentered ? proj.Size / 2f : Vector2.Zero; Color alphaColor = proj.GetAlpha(lightColor); @@ -85,8 +85,9 @@ namespace CalamityMod { Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = alphaColor * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); + float interpolant = ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Color color = alphaColor * interpolant; + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, shrink ? scale * interpolant : scale, spriteEffects, 0f); } break; @@ -102,13 +103,14 @@ namespace CalamityMod while (k < afterimageCount) { Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + float interpolant = ((float)(proj.oldPos.Length - k) / (float)proj.oldPos.Length); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. if (k > 0) { float colorMult = (float)(afterimageCount - k); drawColor *= colorMult / afterimageColorCount; } - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, shrink ? scale * interpolant : scale, spriteEffects, 0f); k += increment; } break; @@ -123,8 +125,10 @@ namespace CalamityMod Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. - Color color = alphaColor * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); + float interpolant = ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Color color = alphaColor * interpolant; + + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, shrink ? scale * interpolant : scale, sfxForThisAfterimage, 0f); } break; @@ -135,7 +139,7 @@ namespace CalamityMod } // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. - if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) + if (!CalamityClientConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) { Vector2 startPos = drawCentered ? proj.Center : proj.position; Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY), rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 43b46b9065..b137434c5f 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -118,8 +118,6 @@ namespace CalamityMod public static string CatastropheKilledLast = CalamityUtils.GetTextValue("Condition.Drops.CatastropheKilledLast"); public static string CynosureText = CalamityUtils.GetTextValue("Condition.Drops.Cynosure"); - public static string ProvidenceHallowText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceHallow"); - public static string ProvidenceUnderworldText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceUnderworld"); public static string ProvidenceNightText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceNight"); public static string ProvidenceChallengeText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceChallenge"); @@ -489,7 +487,7 @@ namespace CalamityMod public static IItemDropRuleCondition HallowedBarsCondition = If((info) => { // If the Early Hardmode Progression Rework is not enabled, then Hallowed Bars can always drop from Mechanical Bosses. - if (!CalamityConfig.Instance.EarlyHardmodeProgressionRework) + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) return true; // If the Early Hardmode Progression Rework is enabled, then all 3 Mechanical Bosses must be defeated for Hallowed Bars to drop. diff --git a/Utilities/EntityUtils.cs b/Utilities/EntityUtils.cs index 96d60c9900..f05d7ebc6d 100644 --- a/Utilities/EntityUtils.cs +++ b/Utilities/EntityUtils.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.CalPlayer; +using System; +using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod @@ -20,5 +22,21 @@ namespace CalamityMod return (destination - entity.Center).SafeNormalize(fallback.Value); } + + /// + /// Adds screenshake to the local player, using the given position and range to determine whether the player is able to see the screenshake. + /// + /// The center of the screenshake, where it is most intense. + /// The maximum intensity of the screenshake. + /// The distance from which the screenshake's power becomes zero. + public static void AddScreenshakeAt(Vector2 position, float intensity, float range = 1000) + { + float dist = 1; + dist -= position.Distance(Main.LocalPlayer.Center) / range; + + dist = Math.Max(dist, 0); + + Main.LocalPlayer.GetModPlayer().GeneralScreenShakePower += (intensity * dist); + } } } diff --git a/Utilities/FramedGlowMask.cs b/Utilities/FramedGlowMask.cs new file mode 100644 index 0000000000..5581bf5782 --- /dev/null +++ b/Utilities/FramedGlowMask.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public sealed class FramedGlowMask + { + /// + /// Cached Texture2D reference, null on server + /// + public Texture2D Texture { get; private set; } + + /// + /// X axis's frame count, 0 on server + /// + public int FrameXCount { get; private set; } = 0; + + /// + /// Y axis's frame count, 0 on server + /// + public int FrameYCount { get; private set; } = 0; + + /// + /// Pixel width for each frame + /// + public int FrameWidth { get; private set; } + + /// + /// Pixel height for each frame + /// + public int FrameHeight { get; private set; } + + private static event Action _OnUnload; + private readonly bool[,] _HasGlowContent; + + internal static void UnloadTexCache() + { + _OnUnload?.Invoke(); + } + + public FramedGlowMask(string asset, int frameWidth, int frameHeight, bool pretendEveryFrameHaveGlow = false) + { + FrameWidth = frameWidth; + FrameHeight = frameHeight; + + // Don't do anything further on server + if (Main.dedServ) + return; + + Texture = ModContent.Request(asset, AssetRequestMode.ImmediateLoad).Value; + if (Texture is null) + return; + + _OnUnload += () => + { + Texture = null; + FrameWidth = 0; + FrameHeight = 0; + FrameXCount = 0; + FrameYCount = 0; + }; + + FrameXCount = Texture.Width / frameWidth; + FrameYCount = Texture.Height / frameHeight; + + _HasGlowContent = new bool[FrameXCount, FrameYCount]; + + + if (pretendEveryFrameHaveGlow) + { + for(int x = 0; x + { + var colData = Texture.GetColorsFromTexture(); + Parallel.For(0, FrameXCount * FrameYCount, (i) => + { + int xFrame = i % FrameXCount; + int yFrame = i / FrameXCount; + + int xStart = xFrame * frameWidth; + int xEnd = xStart + frameWidth; + + int yStart = yFrame * frameHeight; + int yEnd = yStart + frameHeight; + + bool frameHasData = false; + for (int x = xStart; x < xEnd; x++) + { + if (frameHasData) + { + break; + } + + for (int y = yStart; y < yEnd; y++) + { + Color col = colData[x, y]; + if (col.A >= 1) + { + frameHasData = true; + break; + } + } + } + + _HasGlowContent[xFrame, yFrame] = frameHasData; + }); + }); + } + } + + public bool HasContentInFrameIndex(int xFrame, int yFrame) + { + if (Texture is null) + return false; + + return _HasGlowContent[xFrame, yFrame]; + } + + public bool HasContentInFramePos(int xPos, int yPos) + { + if (Texture is null) + return false; + + return _HasGlowContent[xPos / FrameWidth, yPos / FrameHeight]; + } + } +} diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 1813494294..47c72cfafb 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Microsoft.Xna.Framework; using Terraria; @@ -88,6 +89,8 @@ namespace CalamityMod /// The second point. public static float ManhattanDistance(this Vector2 a, Vector2 b) => Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y); + public static int ManhattanDistance(this Point a, Point b) => Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y); + /// /// Wraps an angle between -90 and 90 degrees. If an angle goes past this range it'll go back to the other end. /// @@ -359,5 +362,160 @@ namespace CalamityMod } #endregion + + #region A* Search Algorithm + + public class Node(Point position, Node parent = null) + { + public Point Position { get; set; } = position; + + /// + /// Cost from start to the current node. + /// + public int Cost { get; set; } + + /// + /// Heuristic cost from the current node to the goal. + /// + public int HeuristicCost { get; set; } + + public int TotalCost => Cost + HeuristicCost; + + public Node Parent { get; set; } = parent; + + public override bool Equals(object obj) => obj is Node node && Position == node.Position; + + public override int GetHashCode() => Position.X.GetHashCode() ^ Position.Y.GetHashCode(); + } + + public class AStar(List grid, Point start, Point goal) + { + private List grid = grid; + private Node goal = new(goal); + private List openList = new() { new(start) }; + private HashSet closedList = new(); + + public static List GetPath(List grid, Point start, Point goal) + { + var pathfinding = new AStar(grid, start, goal); + return pathfinding.FindPath(); + } + + public static List GetPath(List grid, Vector2 start, Vector2 goal) + { + var pathfinding = new AStar(grid, start.ToTileCoordinates(), goal.ToTileCoordinates()); + return pathfinding.FindPath(); + } + + private List FindPath() + { + while (openList.Count > 0) + { + var currentNode = openList.OrderBy(node => node.TotalCost).First(); + + if (currentNode.Equals(goal)) + return ReconstructPath(currentNode); + + openList.Remove(currentNode); + closedList.Add(currentNode); + + foreach (var neighbor in GetNeighbors(currentNode)) + { + // Ignore the neighbor which is already evaluated. + if (closedList.Contains(neighbor)) + continue; + + int tentativeScore = currentNode.Cost + currentNode.Position.ManhattanDistance(neighbor.Position); + + // Discover a new node. + if (!openList.Contains(neighbor)) + openList.Add(neighbor); + + // This is not a better path. + else if (tentativeScore >= neighbor.Cost) + continue; + + neighbor.Parent = currentNode; + neighbor.Cost = tentativeScore; + neighbor.HeuristicCost = neighbor.Position.ManhattanDistance(goal.Position); + } + } + + return null; + } + + private List ReconstructPath(Node node) + { + var path = new List(); + while (node != null) + { + path.Add(node.Position.ToWorldCoordinates()); + node = node.Parent; + } + path.Reverse(); + return path; + } + + private List GetNeighbors(Node node) + { + var neighbors = new List(); + + foreach (var direction in Directions) + { + Point newPoint = new(node.Position.X + (int)direction.X, node.Position.Y + (int)direction.Y); + + if (!Main.tile[newPoint].IsTileSolid() && grid.Contains(newPoint)) + neighbors.Add(new Node(newPoint, node)); + } + + return neighbors; + } + + public static List MakeGenericGrid(Vector2 position, float size, Func adjacentTileValidation = null) + { + adjacentTileValidation ??= GenericAdjacentTileValidation; + + List grid = new(); + + Point topLeftCorner = ToSafeTileCoordinates(position + new Vector2(-size, -size)); + Point bottomRightCorner = ToSafeTileCoordinates(position + new Vector2(size, size)); + + for (int coordY = topLeftCorner.Y; coordY <= bottomRightCorner.Y; coordY++) + { + for (int coordX = topLeftCorner.X; coordX <= bottomRightCorner.X; coordX++) + { + Point point = new(coordX, coordY); + + if (Main.tile[point].IsTileSolid() || Main.tile[point].LiquidAmount != 255 || !adjacentTileValidation.Invoke(point)) + continue; + + grid.Add(point); + } + } + + return grid; + } + + private static bool GenericAdjacentTileValidation(Point point) + { + Vector2[] adjacents = new Vector2[12] + { + Vector2.UnitX, -Vector2.UnitX, Vector2.UnitY, -Vector2.UnitY, + new(1f, 1f), new(1f, -1f), new(-1f, -1f), new(-1f, 1f), + Vector2.UnitX * 2f, -Vector2.UnitX * 2f, Vector2.UnitY * 2f, -Vector2.UnitY * 2f + }; + + foreach (var adjacent in adjacents) + { + Point adjacentPoint = new(point.X + (int)adjacent.X, point.Y + (int)adjacent.Y); + if (Main.tile[adjacentPoint].IsTileSolid()) + return false; + } + + return true; + } + } + + #endregion } } diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 3654c3679a..08ab4456c4 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Tools.ClimateChange; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; @@ -37,6 +38,7 @@ namespace CalamityMod return -1; } + public static bool ChangeIngredientStack(this Recipe r, int itemID, int stack) { int idx = r.IngredientIndex(itemID); @@ -195,7 +197,7 @@ namespace CalamityMod sfx.Volume = MathHelper.Clamp(sfx.Volume * volumeMultiplier, 0f, 1f); } - public static void StartRain(bool torrentialTear = false, bool maxSeverity = false) + public static void StartRain(bool torrentialTear = false, bool maxSeverity = false, bool worldSync = true) { int framesInDay = 86400; int framesInHour = framesInDay / 24; @@ -245,7 +247,20 @@ namespace CalamityMod Main.raining = true; if (torrentialTear) TorrentialTear.AdjustRainSeverity(maxSeverity); - CalamityNetcode.SyncWorld(); + + if (worldSync) + CalamityNetcode.SyncWorld(); + } + + public static void StopRain(bool clearWeather = false, bool worldSync = true) + { + if (clearWeather) + Main.StopRain(); + else + Main.raining = false; + + if (worldSync) + CalamityNetcode.SyncWorld(); } public static void StartSandstorm() @@ -254,22 +269,21 @@ namespace CalamityMod // 0.6f is the minimum for vanilla but Calamity changes it to 0.2f // Windy days occur when wind speed is at least 0.5f (0.4f in vanilla) so this should never cause a windy day float windSpeed = 0f; - if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) - if (Main.windSpeedCurrent == 0f) - { - windSpeed = Main.rand.NextFloat(0.2f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); - } - else if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) - { - windSpeed = Main.rand.NextFloat(0.2f, 0.4f); - } - else if (Main.windSpeedCurrent > -0.2f && Main.windSpeedCurrent < 0f) - { - windSpeed = Main.rand.NextFloat(-0.4f, -0.2f); - } + if (Main.windSpeedCurrent == 0f) + { + windSpeed = Main.rand.NextFloat(0.3f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); + } + else if (Main.windSpeedCurrent < 0.3f && Main.windSpeedCurrent > 0f) + { + windSpeed = Main.rand.NextFloat(0.3f, 0.4f); + } + else if (Main.windSpeedCurrent > -0.3f && Main.windSpeedCurrent < 0f) + { + windSpeed = Main.rand.NextFloat(-0.4f, -0.3f); + } if (windSpeed != 0f) { - Main.windSpeedCurrent = windSpeed < 0f ? -0.2f : 0.2f; + Main.windSpeedCurrent = windSpeed < 0f ? -0.3f : 0.3f; Main.windSpeedTarget = windSpeed; } Sandstorm.StartSandstorm(); @@ -277,7 +291,10 @@ namespace CalamityMod public static void StopSandstorm() { - Terraria.GameContent.Events.Sandstorm.Happening = false; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Sandstorm.StopSandstorm(); + } } public static void AddWithCondition(this List list, T type, bool condition) diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index d147204c86..0fc8ef0947 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -144,9 +144,10 @@ namespace CalamityMod private static readonly int[] sunkenSeaEnemyImmunities = new int[2] { ModContent.BuffType(), ModContent.BuffType() }; private static readonly int[] abyssEnemyImmunities = new int[2] { ModContent.BuffType(), ModContent.BuffType() }; private static readonly int[] cragEnemyImmunities = new int[3] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType() }; + private static readonly int[] scalImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), ModContent.BuffType() }; private static readonly int[] astralEnemyImmunities = new int[2] { BuffID.Poisoned, ModContent.BuffType() }; private static readonly int[] plagueEnemyImmunities = new int[3] { BuffID.Poisoned, BuffID.Venom, ModContent.BuffType() }; - private static readonly int[] holyEnemyImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), ModContent.BuffType() }; + private static readonly int[] holyEnemyImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), BuffID.Daybreak }; #endregion #region Load/Unload @@ -164,6 +165,7 @@ namespace CalamityMod Tuple sunkenSea = new(GeneralImmunityStatus.None, sunkenSeaEnemyImmunities); Tuple abyss = new(GeneralImmunityStatus.None, abyssEnemyImmunities); Tuple crags = new(GeneralImmunityStatus.None, cragEnemyImmunities); + Tuple scal = new(GeneralImmunityStatus.None, scalImmunities); Tuple astral = new(GeneralImmunityStatus.None, astralEnemyImmunities); Tuple plague = new(GeneralImmunityStatus.None, plagueEnemyImmunities); Tuple holy = new(GeneralImmunityStatus.None, holyEnemyImmunities); @@ -252,6 +254,7 @@ namespace CalamityMod { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, @@ -269,7 +272,7 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType(), ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType(), ModContent.BuffType(), ModContent.BuffType() }) }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, @@ -292,11 +295,11 @@ namespace CalamityMod { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, - { ModContent.NPCType(), crags }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, + { ModContent.NPCType(), scal }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, @@ -338,11 +341,8 @@ namespace CalamityMod { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, - { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, + { ModContent.NPCType(), sunkenSea }, { ModContent.NPCType(), abyss }, { ModContent.NPCType(), abyss }, diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 303e492a5d..5ef418449a 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -771,6 +771,31 @@ namespace CalamityMod } } + public static void ProduceGoldCritterDust(this NPC npc) + { + npc.position += npc.netOffset; + Color color = Lighting.GetColor((int)npc.Center.X / 16, (int)npc.Center.Y / 16); + if (color.R > 20 || color.B > 20 || color.G > 20) + { + int colorVal = color.R; + if (color.G > colorVal) + { + colorVal = color.G; + } + if (color.B > colorVal) + { + colorVal = color.B; + } + colorVal /= 30; + if (Main.rand.Next(300) < colorVal) + { + int golddust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDustLighted, 0f, 0f, 254, new Color(255, 255, 0), 0.5f); + Main.dust[golddust].velocity *= 0f; + } + } + npc.position -= npc.netOffset; + } + public static NPCShop AddWithCustomValue(this NPCShop shop, int itemType, int customValue, params Condition[] conditions) { var item = new Item(itemType) diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 70e80b71ea..08128135fb 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; using static Terraria.Player; @@ -223,6 +224,8 @@ namespace CalamityMod light += 1; if (mp.jellyfishNecklace && underwater) // inherited by jellyfish diving gear and higher light += 1; + if (mp.reaverExplore) + light += 2; if (mp.lumenousAmulet && underwater) light += 2; if (mp.shine) @@ -890,6 +893,42 @@ namespace CalamityMod /// The player using the holdout. /// Returns if the player CAN'T use the item. public static bool CantUseHoldout(this Player player, bool needsToHold = true) => player == null || !player.active || player.dead || (!player.channel && needsToHold) || player.CCed || player.noItems; + + /// + /// A shorthand bool to check if the held item should trigger Calamity's summon damage penalty. + /// + /// The player to check. + /// The current held item. + /// Returns if the held item should trigger the summon damage penalty. + public static bool ShouldTriggerSummonPenalty(Player player, Item item) + { + var modPlayer = player.Calamity(); + + bool forbiddenWithMagicWeapon = player.armor[0].type == ItemID.AncientBattleArmorHat && player.armor[1].type == ItemID.AncientBattleArmorShirt && player.armor[2].type == ItemID.AncientBattleArmorPants && item.CountsAsClass(); + bool gemTechBlueGem = modPlayer.GemTechSet && modPlayer.GemTechState.IsBlueGemActive; + + bool crossClassNerfDisabled = forbiddenWithMagicWeapon || modPlayer.fearmongerSet || gemTechBlueGem || modPlayer.profanedCrystalBuffs || DD2Event.Ongoing; + + if (item.type > ItemID.None && !crossClassNerfDisabled) + { + bool heldItemIsClassedWeapon = !item.CountsAsClass() && ( + item.CountsAsClass() || + item.CountsAsClass() || + item.CountsAsClass() || + item.CountsAsClass() + ); + + bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !CalamityLists.BlacklistedWeaponsWithToolPower.Contains(item.type); + bool heldItemCanBeUsed = item.useStyle != ItemUseStyleID.None; + bool heldItemIsAccessoryOrAmmo = item.accessory || item.ammo != AmmoID.None; + bool heldItemIsExcludedByModCall = CalamityLists.DisabledSummonerNerfItems.Contains(item.type); + + if (heldItemIsClassedWeapon && heldItemCanBeUsed && !heldItemIsTool && !heldItemIsAccessoryOrAmmo && !heldItemIsExcludedByModCall) + return true; + } + return false; + } + /// /// Makes the given player send the given packet to all appropriate receivers.
diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 5979a32adb..c253626482 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -691,6 +691,25 @@ namespace CalamityMod } } + public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Vector2 scale, Texture2D? texture = null, Rectangle? frame = null, Vector2? offset = null) + { + texture ??= TextureAssets.Projectile[projectile.type].Value; + + // Use a fallback for the frame. + frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame); + + Vector2 drawPosition = projectile.Center - Main.screenPosition; + Vector2 origin = frame.Value.Size() * 0.5f; + Color backAfterimageColor = backglowColor * projectile.Opacity; + for (int i = 0; i < 10; i++) + { + Vector2 off = Vector2.Zero; + if (offset != null) off += offset.Value; + Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea; + Main.spriteBatch.Draw(texture, drawPosition + drawOffset + off, frame, backAfterimageColor, projectile.rotation, origin, scale, 0, 0f); + } + } + public static void DrawProjectileWithBackglow(this Projectile projectile, Color backglowColor, Color lightColor, float backglowArea, Texture2D? texture = null, Rectangle? frame = null) { texture ??= TextureAssets.Projectile[projectile.type].Value; @@ -707,7 +726,7 @@ namespace CalamityMod public static void DrawStarTrail(this Projectile projectile, Color outer, Color inner, float auraHeight = 10f) { - Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; + Texture2D aura = Request("CalamityMod/Projectiles/StarTrail").Value; Vector2 offsets = new Vector2(0f, projectile.gfxOffY) - Main.screenPosition; Rectangle auraRec = aura.Frame(); float auraRotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index 4508e9c84c..3e5fae0989 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -77,7 +77,7 @@ namespace CalamityMod // This check is done twice because the draw order matters. We want to draw the background icon before any text. if (item.stack > 0) { - if (item.type == ModContent.ItemType()) + if (item.type == ItemType()) { slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Blood").Value; } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 7f9f60001e..d1ef6278ea 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -280,6 +280,34 @@ namespace CalamityMod } return true; } + public static bool IsTileExposedToAir(int x, int y) => IsTileExposedToAir(x, y, out _); + + public static bool IsTileExposedToAir(int x, int y, out float? angleToOpenAir) + { + angleToOpenAir = null; + if (!ParanoidTileRetrieval(x - 1, y).HasTile) + { + angleToOpenAir = MathHelper.Pi; + return true; + } + if (!ParanoidTileRetrieval(x + 1, y).HasTile) + { + angleToOpenAir = 0f; + return true; + } + if (!ParanoidTileRetrieval(x, y - 1).HasTile) + { + angleToOpenAir = MathHelper.PiOver2; + return true; + } + if (!ParanoidTileRetrieval(x, y + 1).HasTile) + { + angleToOpenAir = -MathHelper.PiOver2; + return true; + } + + return false; + } public static bool TileActiveAndOfType(int x, int y, int type) { @@ -696,10 +724,10 @@ namespace CalamityMod if (ignoreAbyss) { - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); } return !Main.tileContainer[tile.TileType] && !tileExcludeList.Contains(tile.TileType); diff --git a/Walls/AstralDirtWall.cs b/Walls/AstralDirtWall.cs index 96a302952f..ae80a7a4dd 100644 --- a/Walls/AstralDirtWall.cs +++ b/Walls/AstralDirtWall.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Walls { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; + WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralDirtWallSafe.cs b/Walls/AstralDirtWallSafe.cs index 90f3544a23..ad181c7504 100644 --- a/Walls/AstralDirtWallSafe.cs +++ b/Walls/AstralDirtWallSafe.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Walls // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; Main.wallHouse[Type] = true; + WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralIceWall.cs b/Walls/AstralIceWall.cs index 400e8a51af..4c0802f5a5 100644 --- a/Walls/AstralIceWall.cs +++ b/Walls/AstralIceWall.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Walls { // TODO -- Change this dust to be one more befitting Astral Ice. DustType = DustID.Shadowflame; + WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); } diff --git a/Walls/AstralIceWallSafe.cs b/Walls/AstralIceWallSafe.cs index 7edf50c851..cd32b73a99 100644 --- a/Walls/AstralIceWallSafe.cs +++ b/Walls/AstralIceWallSafe.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Walls // TODO -- Change this dust to be one more befitting Astral Ice. Main.wallHouse[Type] = true; DustType = DustID.Shadowflame; - + WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); } diff --git a/Walls/AstralSnowWall.cs b/Walls/AstralSnowWall.cs index 0b0d852f7f..586060389a 100644 --- a/Walls/AstralSnowWall.cs +++ b/Walls/AstralSnowWall.cs @@ -1,5 +1,6 @@  using Microsoft.Xna.Framework; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -8,7 +9,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = ModContent.DustType(); - + WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralSnowWallSafe.cs b/Walls/AstralSnowWallSafe.cs index 5089358e68..933c29befd 100644 --- a/Walls/AstralSnowWallSafe.cs +++ b/Walls/AstralSnowWallSafe.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { @@ -10,7 +11,7 @@ namespace CalamityMod.Walls { DustType = ModContent.DustType(); Main.wallHouse[Type] = true; - + WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index f4881eb777..5e4ef10005 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -11,13 +11,13 @@ namespace CalamityMod.Walls { public class VoidstoneWall : ModWall { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; - GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; + GlowMask = new("CalamityMod/Walls/VoidstoneWall_Glowmask", 36, 36); + Main.wallHouse[Type] = true; AddMapEntry(new Color(0, 0, 0)); } @@ -29,37 +29,44 @@ namespace CalamityMod.Walls public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = Main.tile[i, j]; int xLength = 32; int xOff = 0; - Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); Color drawcolor; drawcolor = WorldGen.paintColor(tile.WallColor); drawcolor.A = 255; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawcolor *= brightness; - if (Main.drawToScreen) zero = Vector2.Zero; Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; - Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Color glowColor = drawcolor * 0.4f; - for (int k = 0; k < 3; k++) + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + Color glowColor = drawcolor * 0.4f; + + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } } } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 5f7348b9ee..0f0b24ea66 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -11,11 +11,14 @@ namespace CalamityMod.Walls { public class VoidstoneWallUnsafe : ModWall { - internal static Texture2D GlowTexture; + internal static FramedGlowMask GlowMask; public override void SetStaticDefaults() { - GlowTexture = ModContent.Request("CalamityMod/Walls/VoidstoneWall_Glowmask", AssetRequestMode.ImmediateLoad).Value; + // We basically have same copy in VoidstoneWall + // But leaving this in case of changing to Unsafe variant specific glowmask + GlowMask = new("CalamityMod/Walls/VoidstoneWall_Glowmask", 36, 36); + DustType = 187; AddMapEntry(new Color(0, 0, 0)); } @@ -34,37 +37,46 @@ namespace CalamityMod.Walls public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) { - if (GlowTexture is null) + if (GlowMask.Texture is null) return; Tile tile = Main.tile[i, j]; int xLength = 32; int xOff = 0; - Rectangle frame = new Rectangle(tile.WallFrameX + xOff, tile.WallFrameY, xLength, 32); + int xPos = tile.WallFrameX + xOff; + int yPos = tile.WallFrameY; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); Color drawcolor; drawcolor = WorldGen.paintColor(tile.WallColor); drawcolor.A = 255; Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - float brightness = 1f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; - brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); - drawcolor *= brightness; - if (Main.drawToScreen) zero = Vector2.Zero; Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; - Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); - Color glowColor = drawcolor * 0.4f; - for (int k = 0; k < 3; k++) + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + if (GlowMask.HasContentInFramePos(xPos, yPos)) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + float brightness = 1f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f; + brightness *= (float)MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness *= (float)MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + drawcolor *= brightness; + Color glowColor = drawcolor * 0.4f; + + // For now checking for glowing frames greatly reducing the bottleneck + // But maybe we could squeeze bit more by removing the loop + for (int k = 0; k < 3; k++) + { + Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; + spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } } } diff --git a/Waters/SunkenSeaBurrowsWater.cs b/Waters/SunkenSeaBurrowsWater.cs index c7bd8974e5..c01f2bbcc6 100644 --- a/Waters/SunkenSeaBurrowsWater.cs +++ b/Waters/SunkenSeaBurrowsWater.cs @@ -29,5 +29,12 @@ namespace CalamityMod.Waters { return Color.Blue; } + + public override void LightColorMultiplier(ref float r, ref float g, ref float b) + { + r = 1.02f; + g = 1.03f; + b = 1.075f; + } } } diff --git a/World/Abyss.cs b/World/Abyss.cs index 7dd9c746a4..54b16021f0 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -324,8 +324,7 @@ namespace CalamityMod.World AbyssIsland(abyssChasmX, Main.remixWorld ? 105 : AbyssChasmBottom + 5, 65, 75, 40, 45, ModContent.TileType(), false, false, false); //place terminus shrine - UndergroundShrines.SpecialHut((ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.WallType(), UndergroundShrines.UndergroundShrineType.Abyss, abyssChasmX, Main.remixWorld ? 100 : AbyssChasmBottom); + UndergroundShrines.PlaceAbyssShrine(abyssChasmX, Main.remixWorld ? 100 : AbyssChasmBottom); //place islands in the sulphuric depths layer //start placing islands at the world surface so the abyss hole isnt completely empty diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index bc1389ee03..b38c4b12b4 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -723,6 +723,7 @@ namespace CalamityMod.World case TileID.Lead: case TileID.Tungsten: case TileID.Platinum: + case TileID.Meteorite: if (convertOre) { Main.tile[x, y].TileType = (ushort)ModContent.TileType(); diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 10573d76b6..0f4734b77d 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -57,7 +57,7 @@ namespace CalamityMod.World for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) { WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); - Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); } } diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index ae21089ff5..731bba40fd 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -16,7 +16,6 @@ namespace CalamityMod.World public static class CalamityWorld { #region Vars - public static int ArmoredDiggerSpawnCooldown = 0; public static int MoneyStolenByBandit = 0; public static int Reforges; public static bool IsWorldAfterDraedonUpdate = false; diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index c6c1f1601c..69a981f3fc 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -256,7 +256,11 @@ namespace CalamityMod.World { int underworldTop = Main.UnderworldLayer; //gen opposite to the brimstone crags - int placementPositionX = (Main.dungeonX > Main.maxTilesX / 2) ? WorldGen.genRand.Next((int)(Main.maxTilesX / 12), (int)(Main.maxTilesX / 9)) : WorldGen.genRand.Next((int)(Main.maxTilesX * 0.82), (int)(Main.maxTilesX * 0.925)); + //has more wiggle room in seeds with modified hell gen + bool dungeonRight = Main.dungeonX > Main.maxTilesX / 2; + int midLeft = Main.drunkWorld || Main.remixWorld ? 6 : 9; + float midRight = Main.drunkWorld || Main.remixWorld ? 0.6f : 0.82f; + int placementPositionX = dungeonRight ? WorldGen.genRand.Next((int)(Main.maxTilesX / 12), (int)(Main.maxTilesX / midLeft)) : WorldGen.genRand.Next((int)(Main.maxTilesX * midRight), (int)(Main.maxTilesX * 0.925)); int placementPositionY = WorldGen.genRand.Next(Main.maxTilesY - 150, Main.maxTilesY - 125); placementPoint = new Point(placementPositionX, placementPositionY); @@ -514,6 +518,11 @@ namespace CalamityMod.World } } } + // Jungle overlaps a lot with snow on drunk/gfb worlds so it needs a bit of extra help + if (Main.drunkWorld) + { + jungleTilesInArea *= 3; + } if (!canGenerateInLocation || nearbyOtherWorkshop || jungleTilesInArea < totalTiles * 0.4f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) { tries++; diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index b761b4656f..51487e5f4c 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -61,13 +61,8 @@ namespace CalamityMod.World Tile tileUp4 = Main.tile[i, j - 4]; Tile tileUp5 = Main.tile[i, j - 5]; - int[] DungeonWalls = { 7, 94, 95, 8, 98, 99, 9, 96, 97 }; - //if (Main.tileDungeon[tile.TileType] && DungeonWalls.Contains(tileUp.WallType) && !tileUp.HasTile) - if (Main.tileDungeon[tile.TileType] && !tileUp1.HasTile && !tileUp2.HasTile && !tileUp3.HasTile && !tileUp4.HasTile && !tileUp5.HasTile) { - //i += WorldGen.dungeonSide * -16; - //determine the archive brick color if (tile.TileType == TileID.BlueDungeonBrick) dungeonArchiveColor = 0; @@ -77,7 +72,6 @@ namespace CalamityMod.World dungeonArchiveColor = 2; placedArchive = true; - break; } } @@ -88,20 +82,19 @@ namespace CalamityMod.World if (dungeonArchiveColor == 0) { - SchematicManager.PlaceSchematic(SchematicManager.BlueArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + PlaceSchematic(BlueArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } if (dungeonArchiveColor == 1) { - SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + PlaceSchematic(GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } if (dungeonArchiveColor == 2) { - SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + PlaceSchematic(PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } - break; } } diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index f413f99e1e..ddf4982220 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.FurnitureAncient; +using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; @@ -489,5 +490,37 @@ namespace CalamityMod.World } } #endregion + + #region Auric Land Mines + public static void GenerateAuricLandMines() + { + int landMineID = ModContent.TileType(); + int landMineChance = Main.zenithWorld ? 150 : 300; + float maxDepth = Main.maxTilesY * (Main.zenithWorld ? 0.75f : 0.5f); // depth increased in gfb due to the evil columns that extend further downward + for (int x = 0; x < Main.maxTilesX; x++) + { + for (int y = 0; y < maxDepth; y++) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); + Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + if (t != null) + { + if (above != null) + { + // Yharim killed the gods with auric land mines obviously + if ((t.TileType == TileID.Ebonstone || t.TileType == TileID.Crimstone) && !above.HasTile) + { + if (WorldGen.genRand.NextBool(landMineChance)) + { + WorldGen.SlopeTile(x, y); + WorldGen.PlaceTile(x, y - 1, landMineID); + } + } + } + } + } + } + } + #endregion } } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 9459d720a1..4be60296e5 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -4,9 +4,8 @@ using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Walls; using Microsoft.Xna.Framework; +using ReLogic.Threading; using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent.Generation; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -29,132 +28,368 @@ namespace CalamityMod.World { int biomeSize = 250 + (Main.maxTilesX / 180); - //place a box of circles to serve as the main "area" for the biome - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 25) + // + // Places a trapezoid of circles to serve as the main area for the biome. + // + const float steepness = 15f; + static float trapezoidLateralSteep(float x) { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y += 20) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } + if (x <= 1f / steepness) + return steepness * x; + else if (x > 1f / steepness && x < 1f - 1f / steepness) + return 1f; + else + return -steepness * x + steepness; } + FastParallel.For(startPosX - biomeSize - 20, startPosX + biomeSize + 20, (start, end, _) => + { + for (int X = start; X <= end; X += 15) + { + float height = MathHelper.Lerp( + startPosY + 50, + startPosY - 35, + trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); + + for (int Y = startPosY + 50; Y >= height; Y -= 10) + { + ShapeData circle = new ShapeData(); + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + { + new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } + } + }); + + // + // Makes the bottom borders of the Timeless Shores curved downwards. + // + const int totalCuveDepth = 40; + FastParallel.For(startPosX - biomeSize - 20, startPosX - biomeSize + 200, (start, end, _) => + { + for (int x = start; x <= end; x += 10) + { + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); + + for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + { + ShapeData circle = new(); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + { + new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), + })); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } + } + }); + FastParallel.For(startPosX + biomeSize - 200, startPosX + biomeSize + 20, (start, end, _) => + { + for (int x = start; x <= end; x += 5) + { + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); + + for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + { + ShapeData circle = new(); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + { + new Modifiers.RadialDither(1, 30).Output(circle), + new Modifiers.Blotches().Output(circle), + })); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } + } + }); //clear a smaller square out of the center where the biomes stuff will be - for (int X = startPosX - biomeSize + 35; X <= startPosX + biomeSize - 35; X++) + FastParallel.For(startPosX - biomeSize + 35, startPosX + biomeSize - 35, (start, end, _) => { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) + for (int X = start; X <= end; X++) { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 5)), Actions.Chain(new GenAction[] + for (int Y = startPosY - 65; Y <= startPosY + 50; Y++) { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear() - })); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 5)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear() + })); + } } - } + }); - //place little islands - for (int MoundX = startPosX - biomeSize + 35; MoundX <= startPosX + biomeSize - 35; MoundX += WorldGen.genRand.Next(60, 120)) + // + // Places slopes at the sides of the shores to actually make shores. + // + FastParallel.For(startPosX - biomeSize + 20, startPosX - biomeSize + 200, (start, end, _) => { - int MoundY = startPosY + 60; - - ShapeData mound = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(MoundX, MoundY), new Shapes.Mound(30, 45), Actions.Chain(new GenAction[] - { - blotchMod.Output(mound) - })); - WorldUtils.Gen(new Point(MoundX, MoundY), new ModShapes.All(mound), Actions.Chain(new GenAction[] - { - new Actions.Clear(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - - //place a wall pillar above an island - PlaceShoresWallPillar(startPosY, MoundX); - } - - //clear the tops off of the mounds so they have flat surfaces the player can walk on - for (int MoundClearX = startPosX - biomeSize + 37; MoundClearX <= startPosX + biomeSize - 37; MoundClearX++) - { - for (int MoundClearY = startPosY - 35; MoundClearY <= startPosY + 35; MoundClearY++) + for (int moundX = start; moundX <= end; moundX += 20) { - WorldGen.KillTile(MoundClearX, MoundClearY); + ShapeData mound = new(); + GenAction blotchMod = new Modifiers.Blotches().Output(mound); + int moundY = startPosY + 60; + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize + 27, startPosX - biomeSize + 200, moundX))); + + WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); } - } + }); + FastParallel.For(startPosX + biomeSize - 200, startPosX + biomeSize - 20, (start, end, _) => + { + for (int moundX = start; moundX <= end; moundX += 20) + { + ShapeData mound = new(); + GenAction blotchMod = new Modifiers.Blotches().Output(mound); + int moundY = startPosY + 60; + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize - 27, startPosX + biomeSize - 200, moundX))); + + WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + } + }); + + // + // Makes a large platform in the middle of the Timeless Shores. + // + const int platformSize = 130; + const int platformHeight = 35; // Remember that because of Terraria's coordinate system, making it lower actually makes it higher. + const int platformDepth = 20; // How deep it goes. Like above, the higher it is, the lower it goes. + FastParallel.For(startPosX - platformSize / 2, startPosX + platformSize / 2, (start, end, _) => + { + for (int platformX = start; platformX <= end; platformX += 5) + { + // This makes the "stem" of the platform be thinner towards the base and then expand on the top. + int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; + + for (int platformY = startPosY + platformHeight; platformY <= startPosY + thickness; platformY++) + { + WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] + { + new Actions.Clear(), // Clears all tiles and walls. + new Actions.PlaceTile((ushort)ModContent.TileType()) // Places tiles. + })); + } + } + }); + FastParallel.For(startPosX - platformSize / 2, startPosX + platformSize / 2, (start, end, _) => + { + for (int x = start; x <= end; x++) + { + float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, x, true)); + int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); + WorldUtils.Gen(new Point(x, startPosY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); + } + }); + + // + // Makes a hole into the actual Sunken Sea at the botoom-left and bottom-right of the middle platform of the Timeless Shores. + // + const int furthestDistanceFromCenter = 80; + const int shortestDistanceFromCenter = 25; + const int holeStart = 53; + const int holeDepth = 37; + FastParallel.For(startPosX - furthestDistanceFromCenter, startPosX - shortestDistanceFromCenter, (start, end, _) => + { + for (int holeX = start; holeX <= end; holeX++) + { + for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) + { + ShapeData circle = new(); + + // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. + int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 5); + + GenAction dither = new Modifiers.RadialDither(2 * sizeIncrement, 5 * sizeIncrement); + + // We set the shape to a circle with radial dithering. + WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(WorldGen.genRand.Next(4, 10) * sizeIncrement), Actions.Chain(new GenAction[] + { + dither.Output(circle) + })); + + WorldUtils.Gen(new Point(holeX, holeY), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), // The shape removes tiles. + new Actions.SetLiquid() // The shape adds liquid (Default to max water). + })); + } + } + }); + FastParallel.For(startPosX + shortestDistanceFromCenter, startPosX + furthestDistanceFromCenter, (start, end, _) => + { + for (int holeX = start; holeX <= end; holeX++) + { + for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) + { + ShapeData circle = new(); + + // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. + int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 5); + + GenAction dither = new Modifiers.RadialDither(2 * sizeIncrement, 5 * sizeIncrement); + + // We set the shape to a circle with radial dithering. + WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(WorldGen.genRand.Next(4, 10) * sizeIncrement), Actions.Chain(new GenAction[] + { + dither.Output(circle) + })); + + WorldUtils.Gen(new Point(holeX, holeY), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), // The shape removes tiles. + new Actions.SetLiquid() // The shape adds liquid (Default to max water). + })); + } + } + }); //place water below the clear barrier for the islands so that theres water inbetween them - for (int WaterX = startPosX - biomeSize + 35; WaterX <= startPosX + biomeSize - 35; WaterX++) + FastParallel.For(startPosX - biomeSize + 35, startPosX + biomeSize - 35, (start, end, _) => { - for (int WaterY = startPosY + 37; WaterY <= startPosY + 50; WaterY++) + for (int WaterX = start; WaterX <= end; WaterX++) { - Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; - Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; + for (int WaterY = startPosY + 37; WaterY <= startPosY + 60; WaterY++) + { + Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; + Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; + } } - } + }); //slope tiles - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++) + FastParallel.For(startPosX - biomeSize, startPosX + biomeSize, (start, end, _) => { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) + for (int X = start; X <= end; X++) { - Tile.SmoothSlope(X, Y); + for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) + { + Tile.SmoothSlope(X, Y); + } } - } + }); //place layer of sand on valid runestone blocks - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++) + FastParallel.For(startPosX - biomeSize, startPosX + biomeSize, (start, end, _) => { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) + for (int X = start; X <= end; X++) { - bool canPlaceSand = false; - - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) { - canPlaceSand = true; - } + bool canPlaceSand = false; - if (canPlaceSand) - { - PlaceSand(X, Y, 5, ModContent.TileType()); + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); + } } } - } - } + }); - //places a pillar of walls along the height of the timeless shores biome - public static void PlaceShoresWallPillar(int startPosY, int XPosition) - { - for (int Y = startPosY - 55; Y <= startPosY + 50; Y++) + // + // Generates pillars made out of walls at random points in the Timeless Shores. + // + FastParallel.For(startPosX - biomeSize, startPosX + biomeSize, (start, end, _) => { - int RandomX = + WorldGen.genRand.Next(-8, 8); + for (int wallPillarX = start; wallPillarX <= end; wallPillarX += 1000) + { + int randomDisplacementX = WorldGen.genRand.Next(-10, 30); - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(XPosition + RandomX, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] + for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 70; wallPillarY += 10) + { + // Along the height of the pillar, it becomes shorter the more closer to the center we get. + int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - 75, startPosY + 50, wallPillarY)) * 25); + + ShapeData rectangle = new ShapeData(); + GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); + GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 40, startPosY + 70, wallPillarY) + 0.25, 1)); + + WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 12), Actions.Chain(new GenAction[] + { + ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. + blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. + })); + + WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. + })); + } + } + }); + + // + // Makes the transition area to the Timeless Shores. + // Replaces tiles, walls, and places some water spots. + // + FastParallel.For(startPosX - biomeSize - 25, startPosX + biomeSize + 25, (start, end, _) => + { + for (int x = start; x <= end; x += 20) { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(XPosition + RandomX, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - } + for (int y = startPosY - 70; y >= startPosY - 320; y -= 15) + { + float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 320, y, true); + float ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.Sand, TileID.HardenedSand), + new Modifiers.Dither(ditherStrength), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), + new Modifiers.Dither(ditherStrength), + new Actions.ClearWall(), + new Actions.PlaceWall((ushort)ModContent.WallType()), + })); + + interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 220, y, true); + ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.Sandstone), + new Modifiers.Dither(ditherStrength), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) + WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); + + if (WorldGen.genRand.NextBool(5) && y < startPosY - 100) + { + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new GenAction[] + { + new Modifiers.IsNotSolid().Output(new()), + new Actions.SetLiquid(), + })); + } + } + } + }); } //sides of the sunken sea (radiant reefs) @@ -182,60 +417,63 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; //first, place a basalt barrier on the left and right of the biome - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - if (Y > origin.Y - 60) - { - if (LeftSideBarrier) - { - if (X <= origin.X && Main.tile[X - 40, Y].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + float percent = dist / constant; + float blurPercent = 0.99f; - WorldUtils.Gen(new Point(X - 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X - 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else + if (percent > blurPercent) + { + if (Y > origin.Y - 60) { - if (X >= origin.X && Main.tile[X + 40, Y].TileType != ModContent.TileType()) + if (LeftSideBarrier) { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X + 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] + if (X <= origin.X && Main.tile[X - 40, Y - 25].TileType != ModContent.TileType()) { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X + 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X - 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X - 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + else + { + if (X >= origin.X && Main.tile[X + 40, Y - 25].TileType != ModContent.TileType()) { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X + 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X + 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } } } } } } } - } + }); //generate the actual caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -295,91 +533,100 @@ namespace CalamityMod.World } //cleanup - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - WorldGen.KillTile(X, Y); - } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } } } } - } + }); //place layer of sand blocks on valid surfaces - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - bool canPlaceSand = false; - - //place sand clumps on top of exposed shellstone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - canPlaceSand = true; - } + bool canPlaceSand = false; - if (canPlaceSand) - { - PlaceSand(X, Y, 5, ModContent.TileType()); + //place sand clumps on top of exposed shellstone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); + } } } } - } + }); //cleanup again - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - WorldGen.KillTile(X, Y); - } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } - Tile.SmoothSlope(X, Y); + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); + } } } - } + }); } //middle of the sunken sea (polyp forest) @@ -477,91 +724,100 @@ namespace CalamityMod.World } //cleanup - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - WorldGen.KillTile(X, Y); - } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } } } } - } + }); //place extra tiles - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - bool canPlaceSand = false; - - //place sand clumps on top of exposed limestone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - canPlaceSand = true; - } + bool canPlaceSand = false; - if (canPlaceSand) - { - PlaceSand(X, Y, 5, ModContent.TileType()); + //place sand clumps on top of exposed limestone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); + } } } } - } - + }); + //cleanup again - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { - WorldGen.KillTile(X, Y); - } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } - Tile.SmoothSlope(X, Y); + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); + } } } - } + }); } //bottom of the biome (gleaming burrows) @@ -588,36 +844,39 @@ namespace CalamityMod.World Vector2 bottomFoci = center + fociOffset; //place another barrier so the gleaming burrows doesnt just burst into the gully - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X += 10) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y += 2) + for (int X = start; X <= end; X += 10) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y += 2) { - float percent = dist / constant; - float blurPercent = 0.98f; - - if (percent > blurPercent) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { - if (Y > origin.Y + 20) + float percent = dist / constant; + float blurPercent = 0.98f; + + if (percent > blurPercent) { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y + 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] + if (Y > origin.Y + 20) { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y + 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y + 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y + 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } } } } } - } + }); //place the gleaming burrows caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -696,54 +955,60 @@ namespace CalamityMod.World } //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { - WorldGen.KillTile(X, Y); - } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } } } } - } + }); //place extra tiles - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + FastParallel.For(origin.X - biomeSize - 3, origin.X + biomeSize + 3, (start, end, _) => { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int X = start; X <= end; X++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { - canPlaceSand = true; - } + bool canPlaceSand = false; - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); + //place sand clumps on top of exposed navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 4, ModContent.TileType()); + } } } } - } + }); //cleanup again, also place geodes for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -804,7 +1069,7 @@ namespace CalamityMod.World int radius = WorldGen.genRand.Next(30, 45); int RandomX = Main.rand.Next(-25, 25); - + WorldUtils.Gen(new Point(XLeft, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] { blotchMod.Output(circle) @@ -831,36 +1096,42 @@ namespace CalamityMod.World } //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - for (int X = startPosX - biomeSize - 25; X <= startPosX + biomeSize + 25; X++) + FastParallel.For(startPosX - biomeSize - 25, startPosX + biomeSize + 25, (start, end, _) => { - for (int Y = startPosY - 30; Y <= Main.maxTilesY - 250; Y++) + for (int X = start; X <= end; X++) { - Main.tile[X, Y].ClearEverything(); - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); - WorldGen.PlaceWall(X, Y, WallID.LavaUnsafe1); + for (int Y = startPosY - 30; Y <= Main.maxTilesY - 250; Y++) + { + Main.tile[X, Y].ClearEverything(); + WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + WorldGen.PlaceWall(X, Y, WallID.LavaUnsafe1); + } } - } + }); //place another wall of circles along the bottom of the biome so it doesnt just end unnaturally - for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 20) + FastParallel.For(startPosX - biomeSize, startPosX + biomeSize, (start, end, _) => { - int Y = Main.maxTilesY - 250; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] + for (int X = start; X <= end; X += 20) { - blotchMod.Output(circle) - })); + int Y = Main.maxTilesY - 250; - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - } + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall(WallID.LavaUnsafe1) + })); + } + }); //place caverns and lava for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) @@ -887,55 +1158,61 @@ namespace CalamityMod.World } //place sand blocks - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + FastParallel.For(startPosX - biomeSize - (Main.maxTilesX / 25), startPosX + biomeSize + (Main.maxTilesX / 25), (start, end, _) => { - for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + for (int X = start; X <= end; X++) { - bool canPlaceSand = false; - - //place sand clumps on top of exposed basalt - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile) + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) { - canPlaceSand = true; - } + bool canPlaceSand = false; - if (canPlaceSand) - { - PlaceSand(X, Y, 3, ModContent.TileType()); + //place sand clumps on top of exposed basalt + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 3, ModContent.TileType()); + } } } - } + }); //cleanup - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + FastParallel.For(startPosX - biomeSize - (Main.maxTilesX / 25), startPosX + biomeSize + (Main.maxTilesX / 25), (start, end, _) => { - for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + for (int X = start; X <= end; X++) { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) { - WorldGen.KillTile(X, Y); - } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } } } - } + }); } //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it @@ -1038,7 +1315,7 @@ namespace CalamityMod.World //small navystone piles if (WorldGen.genRand.NextBool(5)) { - ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), + ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); @@ -1085,7 +1362,7 @@ namespace CalamityMod.World //small navystone piles if (WorldGen.genRand.NextBool()) { - ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), + ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); @@ -1098,7 +1375,7 @@ namespace CalamityMod.World //multi-colored corals if (WorldGen.genRand.NextBool(3)) { - ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), + ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(ColoredCorals)); @@ -1129,7 +1406,7 @@ namespace CalamityMod.World //misc corals if (WorldGen.genRand.NextBool()) { - ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), + ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); @@ -1151,11 +1428,11 @@ namespace CalamityMod.World //wall corals if (Main.tile[X, Y].TileType == ModContent.TileType()) - { + { if (WorldGen.genRand.NextBool(5) && !Main.tile[X + 1, Y].HasTile) { - ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceTile(X + 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); @@ -1163,8 +1440,8 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(5) && !Main.tile[X - 1, Y].HasTile) { - ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; WorldGen.PlaceTile(X - 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); @@ -1273,12 +1550,12 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), }; - + void getAttachedPoints(int x, int y, List points) { Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); Point p = new(x, y); - + if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) { return; @@ -1292,27 +1569,30 @@ namespace CalamityMod.World getAttachedPoints(x, y - 1, points); } - for (int x = 20; x < Main.maxTilesX - 20; x++) + FastParallel.For(20, Main.maxTilesX - 20, (start, end, _) => { - for (int y = 20; y < Main.maxTilesY - 20; y++) + for (int x = start; x < end; x++) { - List chunkPoints = new(); - getAttachedPoints(x, y, chunkPoints); - - int cutoffLimit = 75; - if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) + for (int y = 20; y < Main.maxTilesY - 20; y++) { - foreach (Point p in chunkPoints) + List chunkPoints = new(); + getAttachedPoints(x, y, chunkPoints); + + int cutoffLimit = 75; + if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) { - WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] + foreach (Point p in chunkPoints) { + WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] + { new Actions.ClearTile(true), new Actions.SetLiquid() - })); + })); + } } } } - } + }); } //method to make sure things only generate in each biome circle diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index d109e2340b..adda47c705 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -3,11 +3,15 @@ using System.Collections.Generic; using CalamityMod.Items.Accessories; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Schematics; using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Walls; using Microsoft.Xna.Framework; @@ -16,6 +20,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.Schematics.SchematicManager; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.World { @@ -37,10 +42,10 @@ namespace CalamityMod.World { return true; } - if (tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType() || - tile.WallType == ModContent.WallType() || - tile.WallType == ModContent.WallType()) + if (tile.TileType == TileType() || + tile.TileType == TileType() || + tile.WallType == WallType() || + tile.WallType == WallType()) { return true; } @@ -54,7 +59,7 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.BattlePotion, ItemID.HunterPotion, ItemID.TrapsightPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.RottenChunk, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CorruptionKey, 1), new ChestItem(ItemID.CorruptTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -65,10 +70,10 @@ namespace CalamityMod.World if (Main.zenithWorld) { - int evil = Utils.SelectRandom(WorldGen.genRand, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); + int evil = Utils.SelectRandom(WorldGen.genRand, ItemType(), ItemType(), ItemType()); contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.RottenChunk, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CorruptionKey, 1), new ChestItem(ItemID.CorruptTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -144,7 +149,7 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.BattlePotion, ItemID.HunterPotion, ItemID.TrapsightPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.Vertebrae, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CrimsonKey, 1), new ChestItem(ItemID.CrimsonTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -159,12 +164,12 @@ namespace CalamityMod.World //Cannot modify the return value of List.this[int] because its not a variable so gotta do this instead contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.Vertebrae, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CrimsonKey, 1), new ChestItem(ItemID.CrimsonTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 2 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(2, 2 + 1)), new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), new ChestItem(ItemID.GasTrap, 1), }; @@ -237,8 +242,8 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ShinePotion, ItemID.MiningPotion, ItemID.BuilderPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.DungeonDesertKey, 1), new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -250,12 +255,12 @@ namespace CalamityMod.World int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge, ItemID.GasTrap); contents = new List() { - new ChestItem(ModContent.ItemType(), 1), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.DungeonDesertKey, 1), new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), new ChestItem(golfClub, 1), //Implying that the golfer messed with the loot but forgot this, OR its trapped }; @@ -321,7 +326,7 @@ namespace CalamityMod.World List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.Geode, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.BlueTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -343,8 +348,10 @@ namespace CalamityMod.World do { - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionX = Main.rand.NextBool() ? WorldGen.genRand.Next((int)(Main.maxTilesX * 0.55f), Main.maxTilesX - WorldGen.beachDistance) : WorldGen.genRand.Next(WorldGen.beachDistance, (int)(Main.maxTilesX * 0.45f)); + int placementPositionY = WorldGen.genRand.Next((int)GenVars.rockLayer + 20, Main.maxTilesY - 220); + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)GenVars.worldSurface + 100, (int)GenVars.rockLayer); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -361,9 +368,10 @@ namespace CalamityMod.World canGenerateInLocation = false; //The granite geode is supposed to fully float in free air. No tile replacements - if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.remixWorld) + if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.drunkWorld) graniteWallsInArea++; - else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.remixWorld) //Get fixed boi makes it generate in marble biomes + // Drunk world variant + else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.drunkWorld) graniteWallsInArea++; } } @@ -374,8 +382,45 @@ namespace CalamityMod.World else { bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillGraniteShrineChest)); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, Main.drunkWorld ? new Action(FillMarbleShrineChest) : new Action(FillGraniteShrineChest)); CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Drunk world: turns into a Marble Geode + if (Main.drunkWorld) + { + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + switch (tile.TileType) + { + case TileID.Granite: // Granite Block --> Marble Block + tile.TileType = TileID.Marble; + break; + case TileID.GraniteBlock: // Smooth Granite Block --> Smooth Marble Block + tile.TileType = TileID.MarbleBlock; + break; + case TileID.Containers: // Granite Chest --> Marble Chest + tile.TileFrameX += 36; + break; + case TileID.ExposedGems: // Sapphire --> Diamond + tile.TileFrameX += 54; + break; + } + switch (tile.WallType) + { + case WallID.Granite: // Granite Wall --> Marble Wall + tile.WallType = WallID.Marble; + break; + case WallID.SapphireGemspark: // Sapphire Gemspark Wall --> Diamond Gemspark Wall + tile.WallType = WallID.DiamondGemspark; + tile.WallColor = PaintID.None; + break; + } + } + } + } break; } @@ -389,7 +434,7 @@ namespace CalamityMod.World int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -402,13 +447,13 @@ namespace CalamityMod.World { contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), new ChestItem(ItemID.Eggnog, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(200, 349 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(200, 349 + 1)), new ChestItem(Main.rand.NextBool() ? ItemID.GasTrap : ItemID.Marshmallow, 1) }; } @@ -474,7 +519,7 @@ namespace CalamityMod.World potionType = ItemID.RedPotion; List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.WhiteTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -496,8 +541,10 @@ namespace CalamityMod.World do { - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionX = Main.rand.NextBool() ? WorldGen.genRand.Next((int)(Main.maxTilesX * 0.55f), Main.maxTilesX - WorldGen.beachDistance) : WorldGen.genRand.Next(WorldGen.beachDistance, (int)(Main.maxTilesX * 0.45f)); + int placementPositionY = WorldGen.genRand.Next((int)GenVars.rockLayer + 20, Main.maxTilesY - 220); + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)GenVars.worldSurface + 100, (int)GenVars.rockLayer); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -516,9 +563,10 @@ namespace CalamityMod.World //Marble biomes either have blocks or walls, occasionally both //This should be near maximum to prevent the structure from overextending - if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.zenithWorld) + if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.drunkWorld) marbleStuffInArea++; - else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.zenithWorld) //Generates in granite in gfb + // Drunk world variant + else if ((tile.TileType == TileID.Granite || tile.WallType == WallID.GraniteUnsafe) && Main.drunkWorld) marbleStuffInArea++; //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone @@ -536,8 +584,48 @@ namespace CalamityMod.World else { bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillMarbleShrineChest)); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, Main.drunkWorld ? new Action(FillGraniteShrineChest) : new Action(FillMarbleShrineChest)); CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Drunk world: turns into a Granite Column + if (Main.drunkWorld) + { + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + switch (tile.TileType) + { + case TileID.Marble: // Marble Block --> Granite Block + tile.TileType = TileID.Granite; + break; + case TileID.MarbleBlock: // Smooth Marble Block --> Smooth Granite Block + tile.TileType = TileID.GraniteBlock; + break; + case TileID.MarbleColumn: // Marble Column --> Granite Column + tile.TileType = TileID.GraniteColumn; + break; + case TileID.Containers: // Marble Chest --> Granite Chest + tile.TileFrameX -= 36; + break; + case TileID.Platforms: // Marble Platform --> Granite Platform + tile.TileFrameY -= 18; + break; + } + switch (tile.WallType) + { + case WallID.Marble: // Marble Wall --> Granite Wall + tile.WallType = WallID.Granite; + break; + case WallID.MarbleBlock: // Smooth Marble Wall --> Smooth Granite Wall + tile.WallType = WallID.GraniteBlock; + tile.WallColor = PaintID.None; + break; + } + } + } + } break; } @@ -551,7 +639,7 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ShinePotion, ItemID.MiningPotion, ItemID.BuilderPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.TruffleWorm, 3), new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -565,11 +653,11 @@ namespace CalamityMod.World //"Cannot modify the return value of List.this[int] because its not a variable" so gotta do this instead, I could add a bunch of bools but I feel this is better for how much is changed contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.TruffleWorm, 3), new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(50, 60 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 3 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(2, 3 + 1)), new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), new ChestItem(ItemID.GasTrap, 1) }; @@ -658,7 +746,7 @@ namespace CalamityMod.World potionType = ItemID.Sake; List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.PinkGel, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(50, 60 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), @@ -787,298 +875,90 @@ namespace CalamityMod.World } #endregion - //Enums and generation methods for old shrines - //Currently still used for Abyss (Terminus) shrine - #region Enumeration - public enum UndergroundShrineType + #region Abyss Shrine + public static void PlaceAbyssShrine(int chestLeftX, int chestTopY) { - Surface, - Cavern, - WorldEvil, - Ice, - Desert, - Mushroom, - Granite, - Marble, - Abyss - } - #endregion + // Shrine position + int shrineLeftX = chestLeftX - 5; + int shrineRightX = chestLeftX + 4; + int shrineTopY = chestTopY - 5; + int shrineBottomY = chestTopY + 3; - #region Hut Outline Creation - - // Special Hut: Takes arguments of tile type 1, tile type 2, wall type, hut type (useful if you use this method to generate different huts), and location of the shrine (x and y) - public static void SpecialHut(ushort tile, ushort tile2, ushort wall, UndergroundShrineType hutType, int shrineLocationX, int shrineLocationY) - { - // Random variables for shrine size - int randomX = WorldGen.genRand.Next(2, 4); - int randomY = WorldGen.genRand.Next(2, 4); - - // Replace tiles in shrine area with shrine tile type 1 - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + // Creates a solid box of Smooth Voidstone + for (int x = shrineLeftX; x <= shrineRightX; x++) { - for (int y = shrineLocationY - randomY - 1; y <= shrineLocationY + randomY + 1; y++) + for (int y = shrineTopY; y <= shrineBottomY; y++) { Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileType = tile; + Main.tile[x, y].TileType = (ushort)TileType(); Main.tile[x, y].Get().Slope = SlopeType.Solid; - Main.tile[x, y].LiquidAmount = 0; Main.tile[x, y].Get().LiquidType = LiquidID.Water; } } - // Replace walls in shrine area with shrine wall type - for (int x = shrineLocationX - randomX; x <= shrineLocationX + randomX; x++) + // Carve out the inner room to make the above box hollow + for (int x = shrineLeftX + 1; x <= shrineRightX - 1; x++) { - for (int y = shrineLocationY - randomY; y <= shrineLocationY + randomY; y++) - { - Main.tile[x, y].Get().HasTile = false; - Main.tile[x, y].WallType = wall; - } - } - - // Remove tiles from the inner part of the shrine area - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) - { - for (int y = shrineLocationY + randomY - 2; y <= shrineLocationY + randomY; y++) - Main.tile[x, y].Get().HasTile = false; - } - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) - { - for (int y = shrineLocationY + randomY - 2; y <= shrineLocationY + randomY - 1; y++) + for (int y = shrineTopY + 1; y <= shrineBottomY - 1; y++) Main.tile[x, y].Get().HasTile = false; } - // Replace tiles from bottom of shrine area with shrine tile type 2 - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + // Carve out the entrance + for (int x = shrineLeftX; x <= shrineRightX; x++) { - int verticalOffset = 4; - int y = shrineLocationY + randomY + 2; - while (!Main.tile[x, y].HasTile && y < Main.maxTilesY && verticalOffset > 0) - { - Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileType = tile2; - Main.tile[x, y].Get().Slope = SlopeType.Solid; - y++; - verticalOffset--; - } + for (int y = shrineBottomY - 3; y <= shrineBottomY - 1; y++) + Main.tile[x, y].Get().HasTile = false; } - // Replace tiles from top of shrine with shrine tile type 1 - randomX -= WorldGen.genRand.Next(1, 3); - int num21 = shrineLocationY - randomY - 2; - while (randomX > -1) + // Add in the pyramid-like hat + int yTop = shrineTopY - 1; + int halfWidth = 4; + while (halfWidth > -1) { - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + halfWidth -= WorldGen.genRand.Next(1, 3); // Random step distance + for (int x = chestLeftX - halfWidth - 1; x <= chestLeftX + halfWidth; x++) { - Main.tile[x, num21].Get().HasTile = true; - Main.tile[x, num21].TileType = tile; + Main.tile[x, yTop].Get().HasTile = true; + Main.tile[x, yTop].TileType = (ushort)TileType(); } - randomX -= WorldGen.genRand.Next(1, 3); - num21--; + yTop--; } - // Place shrine chest - CalamityWorld.SChestX[(int)hutType] = shrineLocationX; - CalamityWorld.SChestY[(int)hutType] = shrineLocationY; - SpecialChest(hutType); + // Place the chest and fill it + Chest chest = MiscWorldgenRoutines.AddChestWithLoot(chestLeftX, chestTopY, (ushort)TileType()); + if (chest != null) + FillAbyssShrineChest(chest); } - #endregion - #region Chest Creation - // Special Chest: Used for placing shrine chests, takes argument of the shrine type which dictates what item will spawn in the first slot of this chest - public static void SpecialChest(UndergroundShrineType shrineType) + public static void FillAbyssShrineChest(Chest chest) { - int item = 0; - //1.4 chests are dubious and use another ID type, so there's 2 now - int chestType = 21; - int chestSubType = 0; - - switch (shrineType) + int dropType = Utils.SelectRandom(WorldGen.genRand, ItemType(), ItemType(), ItemType()); + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.PotionOfReturn, ItemID.LuckPotionGreater); + if (Main.zenithWorld) { - case UndergroundShrineType.Surface: - item = ModContent.ItemType(); //Default chest - break; - case UndergroundShrineType.Cavern: - item = ModContent.ItemType(); - chestSubType = 44; //Obsidian - break; - case UndergroundShrineType.WorldEvil: - item = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); - chestType = WorldGen.crimson ? 21 : 467; //Flesh and Lesion - chestSubType = WorldGen.crimson ? 43 : 3; - break; - case UndergroundShrineType.Ice: - item = ModContent.ItemType(); - chestSubType = 47; //Glass - break; - case UndergroundShrineType.Desert: - item = ModContent.ItemType(); - chestType = 467; - chestSubType = 10; //Sandstone - break; - case UndergroundShrineType.Mushroom: - item = ModContent.ItemType(); - chestSubType = 32; //Mushroom - break; - case UndergroundShrineType.Granite: - item = ModContent.ItemType(); - chestSubType = 50; //Granite - break; - case UndergroundShrineType.Marble: - item = ModContent.ItemType(); - chestSubType = 51; //Marble - break; - case UndergroundShrineType.Abyss: - item = ModContent.ItemType(); - chestType = ModContent.TileType(); - break; + dropType = ItemID.OldShoe; + potionType = ItemID.RedPotion; } - - // Destroy tiles in chest spawn location - for (int j = CalamityWorld.SChestX[(int)shrineType] - 1; j <= CalamityWorld.SChestX[(int)shrineType] + 1; j++) + List contents = new List() { - for (int k = CalamityWorld.SChestY[(int)shrineType]; k <= CalamityWorld.SChestY[(int)shrineType] + 2; k++) - WorldGen.KillTile(j, k, false, false, false); - } + new ChestItem(ItemType(), 1), + new ChestItem(dropType, 1), + new ChestItem(ItemType(), WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; - // Attempt to fix sloped tiles under the chest to prevent the chest from killing itself (literally) - for (int l = CalamityWorld.SChestX[(int)shrineType] - 1; l <= CalamityWorld.SChestX[(int)shrineType] + 1; l++) + if (Main.zenithWorld) + contents.Add(new ChestItem(ItemID.GasTrap, 1)); + + for (int i = 0; i < contents.Count; i++) { - for (int m = CalamityWorld.SChestY[(int)shrineType]; m <= CalamityWorld.SChestY[(int)shrineType] + 3; m++) - { - if (m < Main.maxTilesY) - { - Main.tile[l, m].Get().Slope = SlopeType.Solid; - Main.tile[l, m].Get().IsHalfBlock = false; - } - } + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); + chest.item[i].stack = contents[i].Stack; } - - // Place the chest, finally - WorldGen.AddBuriedChest(CalamityWorld.SChestX[(int)shrineType], CalamityWorld.SChestY[(int)shrineType], item, false, chestSubType, false, (ushort)(chestType)); } #endregion - - #region Direct Gen - /*public static void PlaceShrines() - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - double shrineChance = 100E-05; - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Surface Shrine - { - int tilesX = WorldGen.genRand.Next((int)(x * 0.35), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.65)); - int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Dirt || Main.tile[tilesX, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].TileType == TileID.Dirt || Main.tile[tilesX2, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Evil Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); - - if (Main.tile[tilesX, tilesY].TileType == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) - { - SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, - WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, - WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, UndergroundShrineType.WorldEvil, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern - { - int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.7)); - int tilesY = WorldGen.genRand.Next((int)(y * 0.55f), (int)(y * 0.8f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX2, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Ice Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.IceBlock) - { - SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, UndergroundShrineType.Ice, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Desert Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.DesertFossil) - { - SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, UndergroundShrineType.Desert, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Mushroom Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.MushroomGrass) - { - SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, UndergroundShrineType.Mushroom, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Granite Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Granite) - { - SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, UndergroundShrineType.Granite, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Marble Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Marble) - { - SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, UndergroundShrineType.Marble, tilesX, tilesY); - break; - } - } - }*/ - #endregion } }