From f78fbfa941536c43db7eb7855118e9b4813c2dc2 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 2 Dec 2024 12:34:19 -0500 Subject: [PATCH 01/15] AotC blast attack is now a constant damage multiplier instead of scaling based on parry charges Also fixed its snip damage multiplier using AotE's variable instead of its own (this has no gameplay difference because their multipliers are the same) --- Items/Weapons/Melee/ArkoftheCosmos.cs | 8 ++++---- .../en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson | 2 +- Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 047789a95c..ef25535417 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -29,17 +29,17 @@ namespace CalamityMod.Items.Weapons.Melee public static float NeedleDamageMultiplier = 0.7f; //Damage on the non-homing needle projectile public static float MaxThrowReach = 760; - public static float snapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap + public static float SnapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap public static float MaxCharge = 15f; // Maximum charge value AKA how much charge you get from a parry public static float chargeDamageMultiplier = 1.35f; //Extra damage from charge public static float chainDamageMultiplier = 0.1f; public static float SnapBoltsDamageMultiplier = 0.1f; - public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier + public static float BlastDamageMultiplier = 2f; //Damage multiplier for the blast attack public static float BlastBoltsDamageMultiplier = 0.2f; - public static float SwirlBoltAmount = 6f; //The amount of cosmic bolts produced during hte swirl attack + public static float SwirlBoltAmount = 6f; //The amount of cosmic bolts produced during the swirl attack public static float SwirlBoltDamageMultiplier = 0.7f; //This is the damage multiplier for ALL THE BOLTS: Aka, said damage multiplier is divided by the amount of bolts in a swirl and the full damage multiplier is gotten if you hit all the bolts public override void ModifyTooltips(List tooltips) @@ -138,7 +138,7 @@ namespace CalamityMod.Items.Weapons.Melee { // Fire the super blast, then set charge back to zero. float angle = velocity.ToRotation(); - Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI, Charge); + Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * BlastDamageMultiplier), 0, player.whoAmI, Charge); Charge = 0; // If the parry holdout has existed for very few frames and hasn't parried something, just delete it. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 3825c9a7ae..60724d75d9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -88,7 +88,7 @@ ArkoftheCosmos: { ''' to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability - You can parry projectiles to make them deal 160 less damage for a short period + You can also parry projectiles to make them deal 160 less damage for a short period Parrying will empower the next 15 swings of the sword ''' BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 48275d38ef..1ffe6aac7a 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -414,7 +414,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Combo == 3f) - modifiers.SourceDamage *= ArkoftheElements.snapDamageMultiplier; + modifiers.SourceDamage *= ArkoftheCosmos.SnapDamageMultiplier; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) From a6301a73b30467a09bceb0ce07ca11cac86c1422 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:32:28 +0700 Subject: [PATCH 02/15] biting embrace feels a little more spacey --- .../Melee/BrokenBiomeBlade_BitingEmbrace.cs | 18 +++++++--- .../MendedBiomeBlade_BitingEmbraceMist.cs | 33 +++++++++++-------- .../MendedBiomeBlade_TrueBitingEmbrace.cs | 13 ++++++-- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index ca5ee67b92..89e09f176e 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -159,18 +159,28 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool()) { - Particle mist = new MediumMistParticle(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); + Color initialColor = Color.Lerp(new Color(172, 238, 255), new Color(230, 172, 255), Main.rand.NextFloat(1f));; + Particle mist = new MediumMistParticle(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, initialColor, new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f); mist.Velocity = (mist.Position - Owner.Center) * 0.2f + Owner.velocity; GeneralParticleHandler.SpawnParticle(mist); } } - else if (Main.rand.NextFloat(0f, 1f) > 0.75f) + else if (Main.rand.NextFloat(0f, 1f) > 0.6f) { Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); - Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); - GeneralParticleHandler.SpawnParticle(snowflake); + if (Main.rand.NextBool()) + { + Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + else + { + float scale = Main.rand.NextFloat(0.5f, 1.8f); + Particle star = new CritSpark(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, Color.Indigo, scale, 30, 0.5f, scale * 2f); + GeneralParticleHandler.SpawnParticle(star); + } } //Make the owner look like theyre holding the sword bla bla diff --git a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs index 9aeed727b0..9a42175e69 100644 --- a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs +++ b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -13,10 +14,8 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Particles/MediumMist"; public Player Owner => Main.player[Projectile.owner]; public Color mistColor; - public int variant = -1; - public override void SetStaticDefaults() - { - } + public int variant = 0; + public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -32,20 +31,31 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { Vector2 size = Projectile.Size * Projectile.scale; - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - size / 2f, size); } + public override void OnSpawn(IEntitySource source) + { + mistColor = Main.hslToRgb(Main.rand.NextFloat(0.5f, 0.8f), 1f, 0.8f); + variant = Main.rand.Next(3); + } + public override void AI() { - if (variant == -1) - variant = Main.rand.Next(3); - if (Main.rand.NextBool(15)&& Projectile.alpha <= 140) //only try to spawn your particles if you're not close to dying { Vector2 particlePosition = Projectile.Center + Main.rand.NextVector2Circular(Projectile.width * Projectile.scale * 0.5f, Projectile.height * Projectile.scale * 0.5f); - Particle snowflake = new SnowflakeSparkle(particlePosition, Vector2.Zero, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); - GeneralParticleHandler.SpawnParticle(snowflake); + if (Main.rand.NextBool()) + { + Particle snowflake = new SnowflakeSparkle(particlePosition, Vector2.Zero, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + else + { + float scale = Main.rand.NextFloat(0.5f, 1.8f); + Particle star = new CritSpark(particlePosition, Vector2.Zero, Color.White, Color.Indigo, scale, 30, 0.5f, scale * 2f); + GeneralParticleHandler.SpawnParticle(star); + } } Projectile.velocity *= 0.85f; @@ -64,11 +74,8 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.alpha >= 170) Projectile.Kill(); - - mistColor = Color.Lerp(new Color(172, 238, 255), new Color(145, 170, 188), MathHelper.Clamp((float)(Projectile.alpha - 100) / 80, 0f, 1f)) * (255 - Projectile.alpha / 255f); } - public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(BlendState.Additive); diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 707b68e657..df0f9e15ce 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -168,8 +168,17 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + direction * 40, rotation.ToRotationVector2() * 5, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); - Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); - GeneralParticleHandler.SpawnParticle(snowflake); + if (Main.rand.NextBool()) + { + Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); + GeneralParticleHandler.SpawnParticle(snowflake); + } + else + { + float scale = Main.rand.NextFloat(0.5f, 1.8f); + Particle star = new CritSpark(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, Color.Indigo, scale, 30, 0.5f, scale * 2f); + GeneralParticleHandler.SpawnParticle(star); + } } } From 70e22cc54b667a47c824eeb789bed07191b03d21 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 01:02:12 +0700 Subject: [PATCH 03/15] statis belt line now inherits magiluminescence no further adjustments for now pretty messy item but probably not final --- Items/Accessories/StatisNinjaBelt.cs | 9 +++++++++ Items/Accessories/StatisVoidSash.cs | 6 ++++++ .../en-US/Mods.CalamityMod.Items.Accessories.hjson | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 0758843f88..3b5dca0d99 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -35,6 +36,12 @@ namespace CalamityMod.Items.Accessories player.Calamity().DashID = StatisNinjaBeltDash.ID; player.spikedBoots = 2; player.accFlipper = true; + player.hasMagiluminescence = true; + + player.MountedCenter.ToTileCoordinates(); + DelegateMethods.v3_1 = new Vector3(0.8f, 0.5f, 1f); + Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); + Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); } public override void AddRecipes() @@ -44,6 +51,7 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.MasterNinjaGear). AddIngredient(ItemID.FrogFlipper). + AddIngredient(ItemID.Magiluminescence). AddIngredient(50). AddIngredient(5). AddTile(TileID.LunarCraftingStation). @@ -53,6 +61,7 @@ namespace CalamityMod.Items.Accessories AddIngredient(ItemID.Tabi). AddIngredient(ItemID.BlackBelt). AddIngredient(ItemID.FrogGear). + AddIngredient(ItemID.Magiluminescence). AddIngredient(50). AddIngredient(5). AddTile(TileID.LunarCraftingStation). diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 6c22ab7e9b..f68a1bc362 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -43,6 +43,12 @@ namespace CalamityMod.Items.Accessories player.dashType = 0; player.spikedBoots = 2; player.accFlipper = true; + player.hasMagiluminescence = true; + + player.MountedCenter.ToTileCoordinates(); + DelegateMethods.v3_1 = new Vector3(0.8f, 0.5f, 1f); + Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); + Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); } public override void AddRecipes() diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index b91cd402a8..2c8039e145 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1649,7 +1649,11 @@ StatisNinjaBelt: { Tooltip: ''' 32% increased jump speed, allows auto-jump, and negates fall damage + Increases movement acceleration and deceleration by 1.75x + Increases movement speed by 1.15x. This bonus applies to running boot accessories Grants the ability to swim, climb walls, dash, and dodge attacks + Provides light when worn + {$Common.AbyssLightLevel1} ''' HoldShiftTooltip: ''' @@ -1664,8 +1668,12 @@ StatisVoidSash: { Tooltip: ''' 32% increased jump speed, allows auto-jump, and negates fall damage + Increases movement acceleration and deceleration by 1.75x + Increases movement speed by 1.15x. This bonus applies to running boot accessories Grants the ability to swim, climb walls, dash, and dodge attacks Dashes leave homing scythes in your wake + Provides light when worn + {$Common.AbyssLightLevel1} ''' HoldShiftTooltip: ''' From 6049dd039979f8370db741205a0682f59576a257 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 01:30:16 +0700 Subject: [PATCH 04/15] turned alcohols into a buff:level relationship dict --- CalPlayer/CalamityPlayer.cs | 28 +--------- CalPlayer/CalamityPlayerLifeRegen.cs | 84 +++------------------------- Systems/Collections/AlcoholsDict.cs | 58 +++++++++++++++++++ Systems/Collections/AlcoholsList.cs | 51 ----------------- 4 files changed, 67 insertions(+), 154 deletions(-) create mode 100644 Systems/Collections/AlcoholsDict.cs delete mode 100644 Systems/Collections/AlcoholsList.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d53694517c..3cd9540b47 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4754,32 +4754,8 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Player.MaxBuffs; i++) { int buff = Player.buffType[i]; - - // TODO -- Alcohol poisoning level is applied through a gigantic if chain - // As such, there is currently no way to externally reference alcohol level through buff type so this is the method instead - if (buff == BuffType()) - Alcohol.Insert(0, new int[] { i, 2 }); - else if (buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffType() - || buff == BuffID.Tipsy) - Alcohol.Insert(0, new int[] { i, 1 }); + if (AlcoholsDict.TryGet(buff, out int level)) + Alcohol.Insert(0, new int[] { i, level }); } int poison = alcoholPoisonLevel; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index cf8aca672f..f14255bf37 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -181,110 +181,40 @@ namespace CalamityMod.CalPlayer #endregion #region Alcohol - // NOTE: This massive if chain is also referenced in CalamityPlayer.PostNurseHeal - // TODO -- Change this into any kind of organized data list in order to eliminate these two if chains + for (int l = 0; l < Player.MaxBuffs; l++) + { + int buff = Player.buffType[l]; + if (AlcoholsDict.TryGet(buff, out var level)) + alcoholPoisonLevel += level; + } if (vodka) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += Vodka.RegenLoss; - } if (redWine) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += baguette ? Baguette.RedWineBuffedRegenLoss : RedWine.RegenLoss; - } - if (grapeBeer) - { - alcoholPoisonLevel++; - } if (moonshine) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += Moonshine.RegenLoss; - } - if (rum) - { - alcoholPoisonLevel++; - } - if (fabsolVodka) - { - alcoholPoisonLevel++; - } if (fireball) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += Fireball.RegenLoss; - } - if (whiskey) - { - alcoholPoisonLevel++; - } if (everclear) - { - alcoholPoisonLevel += 2; totalNegativeLifeRegen += Everclear.RegenLoss; - } if (bloodyMary) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += BloodyMary.RegenLoss; - } if (tequila) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += Tequila.RegenLoss; - } if (tequilaSunrise) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += TequilaSunrise.RegenLoss; - } if (screwdriver) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += Screwdriver.RegenLoss; - } - if (caribbeanRum) - { - alcoholPoisonLevel++; - } - if (cinnamonRoll) - { - alcoholPoisonLevel++; - } - if (oldFashioned) - { - alcoholPoisonLevel++; - } if (margarita) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += Margarita.RegenLoss; - } if (starBeamRye) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += StarBeamRye.RegenLoss; - } if (moscowMule) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += MoscowMule.RegenLoss; - } if (whiteWine) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += WhiteWine.RegenLoss; - } if (evergreenGin) - { - alcoholPoisonLevel++; totalNegativeLifeRegen += EvergreenGin.RegenLoss; - } - if (Player.tipsy) - { - alcoholPoisonLevel++; - } if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) { @@ -701,7 +631,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - lesserEffect = AlcoholsList.List.Contains(hasBuff); + lesserEffect = AlcoholsDict.TryGet(hasBuff, out var a); } if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; diff --git a/Systems/Collections/AlcoholsDict.cs b/Systems/Collections/AlcoholsDict.cs new file mode 100644 index 0000000000..bf7ef08f65 --- /dev/null +++ b/Systems/Collections/AlcoholsDict.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Alcohol; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all alcohol buff's IDs and their corresponding poison level. + /// + public sealed class AlcoholsDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary + { + { BuffID.Tipsy, 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 2 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 } + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + /// + /// A shorthand method to obtain an alcohol buff's poison level from its buff ID. + /// + public static bool TryGet(int buffType, out int poisonLevel) + { + return Dict.TryGetValue(buffType, out poisonLevel); + } + } +} diff --git a/Systems/Collections/AlcoholsList.cs b/Systems/Collections/AlcoholsList.cs deleted file mode 100644 index e4af8ac36e..0000000000 --- a/Systems/Collections/AlcoholsList.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.Alcohol; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all alcohol buff's IDs. - /// - public sealed class AlcoholsList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - BuffID.Tipsy, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check whether or not a buff ID is an alcohol. - /// - public static bool Includes(int buffID) => List.Contains(buffID); - } -} From aefd3a40466a3f3a2660419155ace063660b09da Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 01:55:36 +0700 Subject: [PATCH 05/15] alcohols make you look drunk ...and apparently better at fishing --- Buffs/CalamityGlobalBuff.cs | 6 ++++++ CalPlayer/CalamityPlayerLifeRegen.cs | 11 +++++++++++ CalPlayer/CalamityPlayerMiscEffects.cs | 10 +--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 0d4b39fe67..4d17ef4b27 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -48,6 +48,12 @@ namespace CalamityMod.Buffs { player.moveSpeed -= 0.1f; } + else if (type == BuffID.Tipsy) + { + player.statDefense += 4; + player.GetCritChance() -= 2; + player.GetAttackSpeed() -= 0.1f; + } else if (type == BuffID.WellFed) { player.moveSpeed -= 0.15f; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index f14255bf37..0dbf90f24b 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -216,6 +216,17 @@ namespace CalamityMod.CalPlayer if (evergreenGin) totalNegativeLifeRegen += EvergreenGin.RegenLoss; + // Blanket effect for all alcohols + if (alcoholPoisonLevel > 0) + { + // This applies the tipsy eyes effect + Player.tipsy = true; + + // This one is checked through a buff so we have to counter that + if (!Player.HasBuff(BuffID.Tipsy)) + Player.fishingSkill += 5; + + } if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) { // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3c6b9ea86b..081398fa07 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3133,14 +3133,6 @@ namespace CalamityMod.CalPlayer if (whiteWine) Player.GetDamage() += WhiteWine.MagicDamageBoost; - // Adjustment to the Tipsy debuff - if (Player.tipsy) - { - Player.statDefense += 4; - Player.GetCritChance() -= 2; - Player.GetAttackSpeed() -= 0.1f; - } - if (giantPearl) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -4413,7 +4405,7 @@ namespace CalamityMod.CalPlayer Player.statDefense -= (int)(Player.statDefense * WhiteWine.DefenseLossPercent); } - if (Player.tipsy) + if (Player.HasBuff(BuffID.Tipsy)) { if (Player.statDefense > 0) Player.statDefense -= (int)(Player.statDefense * 0.05); From fca853c6bb919cc020f60e3f60d978d7c9e31eea Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 02:25:58 +0700 Subject: [PATCH 06/15] fixed camper penalizing projectile hits twice --- Projectiles/CalamityGlobalProjectile.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 3f251cd829..591f4fecd5 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3428,9 +3428,6 @@ namespace CalamityMod.Projectiles // //if (modPlayer.deadshotBrooch && projectile.CountsAsClass() && player.heldProj != projectile.whoAmI) - if (modPlayer.camper && !player.StandingStill()) - projectile.damage = (int)(projectile.damage * 0.1); - if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0)) projectile.damage = (int)(projectile.damage * 0.1); From 9977d512403574fa1b6b7b721eb4ff2f29a6a1fe Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 03:36:29 +0700 Subject: [PATCH 07/15] camper regen effect takes place in a different function allows it to work with other natural life regen boosts --- CalPlayer/CalamityPlayerLifeRegen.cs | 45 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 0dbf90f24b..b1ae96d3f6 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -775,29 +775,6 @@ namespace CalamityMod.CalPlayer } #endregion - // The Camper counteracts the regen loss while moving horizontally - if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) - { - // Vanilla base regen rate which gets boosted when resting - // The first 6 boosts increment every 300 frames, up to 6 at 1800 - // Then, the last 3 boosts increment every 600 frames, up to 9 at 3600 which is the cap - int baseRegenRate = (int)(Math.Clamp(Player.lifeRegenTime / 300f, 0f, 6f) + Math.Clamp((Player.lifeRegenTime - 1800f) / 600f, 0f, 3f)); - // Normally 1.25 while resting and 0.5 while not - Player.lifeRegen += (int)(baseRegenRate * 0.75f); - - if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool()) - { - Dust regen = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.HeartCrystal, 0f, 0f, 200, Color.OrangeRed, 1f); - regen.noGravity = true; - regen.fadeIn = 1.3f; - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); - regen.velocity = velocity; - velocity.Normalize(); - velocity *= 34f; - regen.position = Player.Center - velocity; - } - } - // Life regen soft cap. if (Player.statLife < actualMaxLife) { @@ -870,5 +847,27 @@ namespace CalamityMod.CalPlayer } } #endregion + + public override void NaturalLifeRegen(ref float regen) + { + // The Camper counteracts the regen loss while moving horizontally + if (camper && (Player.velocity.X != 0 && Player.grappling[0] <= 0)) + { + // Normally 1.25 while resting and 0.5 while not so we apply this cancelling multiplier + regen *= 2.5f; + + if (Main.rand.Next(30000) < Player.lifeRegenTime || Main.rand.NextBool()) + { + Dust heart = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.HeartCrystal, 0f, 0f, 200, Color.OrangeRed, 1f); + heart.noGravity = true; + heart.fadeIn = 1.3f; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); + heart.velocity = velocity; + velocity.Normalize(); + velocity *= 34f; + heart.position = Player.Center - velocity; + } + } + } } } From cc2b967f1af9b7e728785ea324de22ee0553b728 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 04:11:42 +0700 Subject: [PATCH 08/15] uneven projectile fixingator part 1 --- CalPlayer/CalamityPlayer.cs | 11 +++-------- CalPlayer/CalamityPlayerHitHurt.cs | 11 +++-------- Items/CalamityGlobalItem.cs | 11 +++-------- Items/Weapons/Magic/RecitationoftheBeast.cs | 12 +++--------- 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3cd9540b47..c6b8527e2b 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3078,18 +3078,13 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { var source = Player.GetSource_Misc("1"); - for (int i = 0; i < 8; i++) + for (int i = 0; i < 16; i++) { float ai1 = Main.rand.NextFloat() + 0.5f; - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int soul = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); + Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); + int soul = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); if (soul.WithinBounds(Main.maxProjectiles)) Main.projectile[soul].DamageType = DamageClass.Generic; - int soul2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); - if (soul2.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul2].DamageType = DamageClass.Generic; } } } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index f8f80246ef..8de6d43790 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -2683,17 +2683,12 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - for (int i = 0; i < 8; i++) + for (int i = 0; i < 16; i++) { - float randomSpeed = Main.rand.Next(1, 7); - float randomSpeed2 = Main.rand.Next(1, 7); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int shard = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI, 0f, 0f); - int shard2 = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI, 0f, 0f); + Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); + int shard = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].DamageType = DamageClass.Generic; - if (shard2.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard2].DamageType = DamageClass.Generic; } } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index cdb264521b..50d42de178 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -474,15 +474,10 @@ namespace CalamityMod.Items if (player.whoAmI == Main.myPlayer) { SoundEngine.PlaySound(SoundID.Item20, player.Center); - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 30f * i; - Projectile.NewProjectile(playerSource, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); - Projectile.NewProjectile(playerSource, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); + Vector2 circleVel = (MathHelper.TwoPi * i / 6f + velocity.ToRotation()).ToRotationVector2() * 5f; + Projectile.NewProjectile(playerSource, player.Center, circleVel, flareID, flareDamage, 1f, player.whoAmI); } } } diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index 13596c833d..4b4cf8fedc 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -38,16 +38,10 @@ 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) { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(velocity.X, velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - int i; - for (i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), type, damage, knockback, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), type, damage, knockback, Main.myPlayer, 0f, 0f); + Vector2 circleVel = (MathHelper.TwoPi * i / 6f + velocity.ToRotation()).ToRotationVector2() * 2.2f; + Projectile.NewProjectile(source, player.Center, circleVel, type, damage, knockback, Main.myPlayer); } return false; } From ea26a2faa079ad070df787cf0c1a1edf23bb188e Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:27:39 +0700 Subject: [PATCH 09/15] swaying town --- Tiles/Abyss/SulphurousVines.cs | 8 ++++++++ Tiles/Abyss/ViperVines.cs | 8 ++++++++ Tiles/Astral/AstralVines.cs | 8 ++++++++ Tiles/Furniture/TwinklerInABottleTile.cs | 3 ++- Tiles/FurnitureAbyss/AbyssLantern.cs | 3 ++- Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs | 2 +- Tiles/FurnitureAncient/AncientLantern.cs | 2 +- Tiles/FurnitureAshen/AshenLantern.cs | 2 +- Tiles/FurnitureBotanic/BotanicLantern.cs | 3 ++- Tiles/FurnitureCosmilite/CosmiliteLantern.cs | 3 ++- Tiles/FurnitureEutrophic/EutrophicLantern.cs | 3 ++- Tiles/FurnitureExo/ExoLanternTile.cs | 2 +- Tiles/FurnitureMarnite/MarniteLantern.cs | 3 ++- Tiles/FurnitureMonolith/MonolithLantern.cs | 2 +- Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs | 3 ++- Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs | 3 ++- Tiles/FurnitureProfaned/ProfanedLantern.cs | 2 +- .../EyeOfTheAccursedBannerTile.cs | 3 ++- .../OccultLegionnaireBannerTile.cs | 3 ++- .../SacrilegiousLanternTile.cs | 2 +- Tiles/FurnitureSilva/SilvaLantern.cs | 3 ++- Tiles/FurnitureStatigel/StatigelLantern.cs | 2 +- Tiles/FurnitureStratus/StratusLantern.cs | 3 ++- Tiles/FurnitureVoid/VoidLantern.cs | 3 ++- Tiles/FurnitureWulfrum/WulfrumLantern.cs | 2 +- Tiles/MonsterBanner.cs | 3 ++- Utilities/FurnitureSetupUtils.cs | 14 +------------- Utilities/TileUtils.cs | 9 +++++++++ 28 files changed, 71 insertions(+), 36 deletions(-) diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 1d49774fce..7bde6900b1 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -1,7 +1,9 @@ using System; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; @@ -29,6 +31,12 @@ namespace CalamityMod.Tiles.Abyss TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.instance.TilesRenderer.CrawlToTopOfVineAndAddSpecialPoint(j, i); + return false; + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index d3ce6d3043..adca8b1c5f 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -21,6 +23,12 @@ namespace CalamityMod.Tiles.Abyss DustType = 2; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.instance.TilesRenderer.CrawlToTopOfVineAndAddSpecialPoint(j, i); + return false; + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Astral/AstralVines.cs b/Tiles/Astral/AstralVines.cs index 45c6249fb2..3eaaae5300 100644 --- a/Tiles/Astral/AstralVines.cs +++ b/Tiles/Astral/AstralVines.cs @@ -1,8 +1,10 @@ using System; using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.Localization; @@ -32,6 +34,12 @@ namespace CalamityMod.Tiles.Astral AddMapEntry(new Color(65, 56, 83)); } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Main.instance.TilesRenderer.CrawlToTopOfVineAndAddSpecialPoint(j, i); + return false; + } + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { //GIVE VINE ROPE IF SPECIAL VINE BOOK diff --git a/Tiles/Furniture/TwinklerInABottleTile.cs b/Tiles/Furniture/TwinklerInABottleTile.cs index 0eaa5947fd..7c7a04ed05 100644 --- a/Tiles/Furniture/TwinklerInABottleTile.cs +++ b/Tiles/Furniture/TwinklerInABottleTile.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +17,7 @@ namespace CalamityMod.Tiles.Furniture AdjTiles = new int[] { TileID.HangingLanterns, TileID.FireflyinaBottle, TileID.LightningBuginaBottle }; } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override void AnimateTile(ref int frame, ref int frameCounter) { diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 0e175cb6f2..870a1e2b71 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public class AbyssLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index caa6941efc..4cad230406 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public class AcidwoodLanternTile : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index 523137a9d2..00ac4b6fd0 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public class AncientLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index 3d039ecd85..ec7f983270 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public class AshenLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index c1de59b565..ff61750358 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public class BotanicLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index de5f0a9f36..a220cc5230 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public class CosmiliteLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureEutrophic/EutrophicLantern.cs index 4c9d41174f..a238668f28 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureEutrophic/EutrophicLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public class EutrophicLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureExo/ExoLanternTile.cs b/Tiles/FurnitureExo/ExoLanternTile.cs index 7b3d0660b2..30c1883ff0 100644 --- a/Tiles/FurnitureExo/ExoLanternTile.cs +++ b/Tiles/FurnitureExo/ExoLanternTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureExo public class ExoLanternTile : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/FurnitureMarnite/MarniteLantern.cs b/Tiles/FurnitureMarnite/MarniteLantern.cs index 53e82d7535..808673bd37 100644 --- a/Tiles/FurnitureMarnite/MarniteLantern.cs +++ b/Tiles/FurnitureMarnite/MarniteLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public class MarniteLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureMonolith/MonolithLantern.cs b/Tiles/FurnitureMonolith/MonolithLantern.cs index c77208df7e..c5a2cc2c2e 100644 --- a/Tiles/FurnitureMonolith/MonolithLantern.cs +++ b/Tiles/FurnitureMonolith/MonolithLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public class MonolithLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs index 4b710c4096..919c12d846 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public class OtherworldlyLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 1917926843..98a049ecd6 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public class PlaguedPlateLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 229ad1e00d..7435eaccba 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public class ProfanedLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs index dff5f15e7c..91f7ed6e09 100644 --- a/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs +++ b/Tiles/FurnitureSacrilegious/EyeOfTheAccursedBannerTile.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; @@ -37,6 +38,6 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Banner")); } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); } } diff --git a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs index 30ad06d0e1..ec3269d7c3 100644 --- a/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs +++ b/Tiles/FurnitureSacrilegious/OccultLegionnaireBannerTile.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); TileObjectData.newTile.LavaDeath = false; @@ -37,6 +38,6 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious AddMapEntry(new Color(43, 19, 42), Language.GetText("MapObject.Banner")); } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); } } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs index ce4ead0866..3b46b8500e 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public class SacrilegiousLanternTile : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index e0b314a458..50b226b3fd 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public class SilvaLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index 7beb0067ee..5d09bb13e9 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public class StatigelLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 1d1d371aef..be68e423d0 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public class StratusLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 0d0c1d666b..64c198cd39 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public class VoidLantern : ModTile { public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.cs b/Tiles/FurnitureWulfrum/WulfrumLantern.cs index 1d01fa6eed..01b9749e60 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLantern.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLantern.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum AdjTiles = new int[] { TileID.HangingLanterns }; } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CanExplode(int i, int j) => false; diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index fea7ff6959..be6cbcc224 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Tiles Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = true; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); TileObjectData.newTile.Height = 3; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; @@ -62,7 +63,7 @@ namespace CalamityMod.Tiles } } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) => CalamityUtils.PlatformHangOffset(i, j, ref offsetY); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public static int GetBannerNPC(int style) { diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index 61898018c4..dca47da7bc 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -1251,6 +1251,7 @@ namespace CalamityMod Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; TileID.Sets.DisableSmartCursor[mt.Type] = true; + TileID.Sets.MultiTileSway[mt.Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); TileObjectData.newTile.LavaDeath = !lavaImmune; TileObjectData.newTile.LavaPlacement = lavaImmune ? LiquidPlacement.Allowed : LiquidPlacement.NotAllowed; @@ -1270,19 +1271,6 @@ namespace CalamityMod mt.AdjTiles = new int[] { TileID.HangingLanterns }; } - // Allow hanging lanterns to move up when hung on platforms - internal static void PlatformHangOffset(int i, int j, ref int offsetY) - { - Tile tile = Main.tile[i, j]; - TileObjectData data = TileObjectData.GetTileData(tile); - int topLeftX = i - tile.TileFrameX / 18 % data.Width; - int topLeftY = j - tile.TileFrameY / 18 % data.Height; - if (WorldGen.IsBelowANonHammeredPlatform(topLeftX, topLeftY)) - { - offsetY -= 8; - } - } - /// /// Extension which initializes a ModTile to be a piano. /// diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index b4582f43ec..b473b2e383 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -22,6 +22,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -112,6 +113,14 @@ namespace CalamityMod NetMessage.SendTileSquare(-1, x, y, tileX, tileY); } + public static bool DrawSwayingMultiTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + if (TileObjectData.IsTopLeft(tile)) + Main.instance.TilesRenderer.AddSpecialPoint(i, j, TileDrawing.TileCounterType.MultiTileVine); + return false; + } + public static void DrawFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) { Tile tile = Main.tile[i, j]; From be80c12551c0eb0c4df4315339e49579818270cf Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:21:19 +0700 Subject: [PATCH 10/15] chandelier sway --- Tiles/FurnitureAbyss/AbyssChandelier.cs | 3 +++ Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs | 2 ++ Tiles/FurnitureAshen/AshenChandelier.cs | 2 ++ Tiles/FurnitureBotanic/BotanicChandelier.cs | 3 +++ Tiles/FurnitureCosmilite/CosmiliteChandelier.cs | 3 +++ Tiles/FurnitureEutrophic/EutrophicChandelier.cs | 3 +++ Tiles/FurnitureExo/ExoChandelierTile.cs | 2 ++ Tiles/FurnitureMarnite/MarniteChandelier.cs | 3 +++ Tiles/FurnitureMonolith/MonolithChandelier.cs | 2 ++ Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs | 3 +++ Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs | 3 +++ Tiles/FurnitureProfaned/ProfanedChandelier.cs | 3 +++ Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs | 2 ++ Tiles/FurnitureSilva/SilvaChandelier.cs | 3 +++ Tiles/FurnitureStatigel/StatigelChandelier.cs | 2 ++ Tiles/FurnitureStratus/StratusChandelier.cs | 2 ++ Tiles/FurnitureVoid/VoidChandelier.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumChandelier.cs | 3 +++ Utilities/FurnitureSetupUtils.cs | 1 + 19 files changed, 48 insertions(+) diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index bc9ca99128..f766e03cc8 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); diff --git a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs index 0d71135c72..5707586091 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.WoodFurniture, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index d924e95579..877855977d 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Tiles.FurnitureAshen AnimationFrameHeight = 54; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index 3a21c53662..5c09783ac6 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 936a449250..01e4933808 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs index 74b2bd8f00..c98b6590b7 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureEutrophic { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); diff --git a/Tiles/FurnitureExo/ExoChandelierTile.cs b/Tiles/FurnitureExo/ExoChandelierTile.cs index af8d1ee90e..6292d83cc9 100644 --- a/Tiles/FurnitureExo/ExoChandelierTile.cs +++ b/Tiles/FurnitureExo/ExoChandelierTile.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureExo { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureMarnite/MarniteChandelier.cs b/Tiles/FurnitureMarnite/MarniteChandelier.cs index 7277e2ead7..1e979e48c4 100644 --- a/Tiles/FurnitureMarnite/MarniteChandelier.cs +++ b/Tiles/FurnitureMarnite/MarniteChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureMarnite { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Granite, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureMonolith/MonolithChandelier.cs b/Tiles/FurnitureMonolith/MonolithChandelier.cs index b0ffa854c5..45753af8b7 100644 --- a/Tiles/FurnitureMonolith/MonolithChandelier.cs +++ b/Tiles/FurnitureMonolith/MonolithChandelier.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureMonolith { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs index aa79b1dacc..7180331195 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,8 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(125, 94, 128), 1f); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 469a785fbf..ff026cfb60 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.BubbleBurst_Green, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index 770ca87660..c832c859ce 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.GoldCoin, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs index 1c45c5d278..07e16cb3d6 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index ad6a0e8867..effeefc0c4 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,8 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, ModContent.DustType(), 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index 06f8b15c1c..affdc54698 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkSlime, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index 28a737cc49..c8b6e76bca 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Stone, 0f, 0f, 1, new Color(100, 130, 150), 1f); diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index 46887dfd37..eb73bf5328 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +10,8 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CreateDust(int i, int j, ref int type) { Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.DungeonSpirit, 0f, 0f, 1, new Color(255, 255, 255), 1f); diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs index b215a6ebce..24089c07cd 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; + TileID.Sets.MultiTileSway[Type] = true; TileObjectData.newTile.Width = 3; TileObjectData.newTile.Height = 2; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; @@ -32,6 +33,8 @@ namespace CalamityMod.Tiles.FurnitureWulfrum AdjTiles = new int[] { TileID.Chandeliers }; } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type) diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index dca47da7bc..c5cb3cd6d2 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -934,6 +934,7 @@ namespace CalamityMod Main.tileNoAttach[mt.Type] = true; Main.tileLavaDeath[mt.Type] = !lavaImmune; Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.MultiTileSway[mt.Type] = true; TileObjectData.newTile.Width = 3; TileObjectData.newTile.Height = 3; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; From 96881afa9b95f20a95e035ec4c958883212a397f Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:14:32 +0700 Subject: [PATCH 11/15] Prismatic Breaker aims for Unreal first as Legendary is no longer obtainable with CIT's rework --- Utilities/ItemUtils.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index db1a3c7a32..9a59edd218 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -112,6 +112,7 @@ namespace CalamityMod // This is the hardcoded value to "do nothing", and is thus the default choice. int prefix = -1; + bool supportsLegendary = PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] || (item.ModItem != null && item.ModItem.MeleePrefix()); // ACCESSORIES if (item.accessory) @@ -139,7 +140,8 @@ namespace CalamityMod } // MELEE (includes tools and whips) - else if (item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass()) + // Melee-ranged hybrid weapons prioritize Legendary if available, otherwise go for Unreal + else if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary)) { // Terrarian (has its own special "Legendary" for marketing reasons) // Other items that want to use Legendary2 are also compatible @@ -156,7 +158,7 @@ namespace CalamityMod } // Swords, Whips, Tools, other items that support the Legendary modifier - else if (PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] || (item.ModItem != null && item.ModItem.MeleePrefix())) + else if (supportsLegendary) { int[][] meleeReforgeTiers = new int[][] { From e58286afeeb28380082abbf4e720c4d63b8ab337 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:25:54 +0700 Subject: [PATCH 12/15] beam sword velocity redistribution to fix the aim bug --- Items/CalamityGlobalItemTweaks.cs | 2 +- Projectiles/CalamityGlobalProjectileTweaks.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 5db9290955..43887cb1f2 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items { ItemID.AquaScepter, Do(DamageRatio(0.9f)) }, // Uses ratios due to remix seed { ItemID.Bananarang, Do(DamageExact(76), UseExact(14)) }, { ItemID.BatScepter, Do(DamageExact(50)) }, - { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(131), UseAnimationExact(40), ShootSpeedExact(23f), KnockbackExact(8)) }, + { ItemID.BeamSword, Do(UseMeleeSpeed, DamageExact(131), UseAnimationExact(40), KnockbackExact(8)) }, { ItemID.BeeGun, Do(DamageExact(11), ManaExact(4)) }, { ItemID.BeeKeeper, Do(UseTurn, DamageExact(32)) }, { ItemID.Beenade, Do(DamageExact(11), UseTimeExact(22), ShootSpeedExact(10f)) }, diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 276dfe1fbd..9ea349ad0f 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -205,7 +205,7 @@ namespace CalamityMod.Projectiles { ProjectileID.StardustDrill, standardDrillTweaks }, { ProjectileID.StarWrath, Do(NoPiercing) }, { ProjectileID.Sunfury, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(1)) }, // Beam Sword projectile + { ProjectileID.SwordBeam, Do(ExtraUpdatesExact(2)) }, // Beam Sword projectile { ProjectileID.Terragrim, Do(TrueMeleeNoSpeed, ScaleExact(1.25f)) }, { ProjectileID.ThunderStaffShot, Do(PiercingExact(3)) }, //Thunder Zapper projectile { ProjectileID.TitaniumChainsaw, standardChainsawTweaks }, From d002e1c95ed30f2ffdcbd1deea4d6ed2cea2847e Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:05:20 +0700 Subject: [PATCH 13/15] Parries cancel hits Note that Cancelled HurtInfo automatically do not run hooks --- CalPlayer/CalamityPlayerHitHurt.cs | 9 +++------ .../en-US/Mods.CalamityMod.Items.Accessories.hjson | 4 ++-- NPCs/Providence/Providence.cs | 3 +++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 8de6d43790..3f175fd86a 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -896,8 +896,6 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref Player.HurtModifiers modifiers) { - // TODO -- Evolution dodge isn't actually a dodge and you'll still get hit for 1. - // This should probably be changed so that when the evolution reflects it gives you 1 frame of guaranteed free dodging everything. if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { double dodgeDamageGateValuePercent = 0.05; @@ -929,7 +927,7 @@ namespace CalamityMod.CalPlayer int evolutionIFrames = Player.ComputeReflectIFrames(); Player.GiveUniversalIFrames(evolutionIFrames, true); - modifiers.SetMaxDamage(1); + modifiers.Cancel(); evolutionLifeRegenCounter = 300; projTypeJustHitBy = proj.type; @@ -1506,8 +1504,7 @@ namespace CalamityMod.CalPlayer theBeeCooldown = TheBee.CooldownLength; } - // TODO: If possible, find a way to make it so parries don't activate the hit - if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0 && hurtInfo.Damage > 1) + if (rOfResilienceCooldown == 0 && rOfResilienceEffect > 0) { int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600); rOfResilienceCooldown = cooldownTime; @@ -1812,7 +1809,7 @@ namespace CalamityMod.CalPlayer blazingCoreEmpoweredParry = true; - modifiers.SetMaxDamage(1); //ONLY REDUCE DAMAGE IF NOT ON COOLDOWN + modifiers.Cancel(); modifiers.DisableSound(); //prevents hurt sound from playing, had no idea this was a thing } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 2c8039e145..d25aca3d4c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -310,7 +310,7 @@ BlazingCore: { The searing core of the Profaned Goddess Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal Being hit shortly after encasement will shatter the crystal - Upon shattering, holy stars spiral outwards and you only take 1 damage + Upon shattering, holy stars spiral outwards and damage taken is negated After shattering, this damage reduction effect goes on cooldown Damage parried whilst on cooldown summons additional healing stars, and will not be reduced {$Common.AbyssLightLevel2} @@ -1863,7 +1863,7 @@ TheEvolution: { DisplayName: The Evolution Tooltip: ''' - Reflects projectiles that hit you, reducing their damage to 1 and dealing 10x damage to enemies + Reflects projectiles that hit you, negating their damage 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 diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 94546146a0..28c8278993 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -2929,6 +2929,9 @@ namespace CalamityMod.NPCs.Providence // Shortcut function for applying Burden Breaker-like negative healing to GFB Providence public static void ApplyGFBDamage(Projectile proj, int BaseDuration, int NegativeHealValue) { + if (!Main.zenithWorld) + return; + int index = Player.FindClosest(proj.position, proj.width, proj.height); Player player = Main.player[index]; if (player is null) From f0e65a8fe87e8690be32fd04ca7d139998f91080 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 4 Dec 2024 20:41:04 -0500 Subject: [PATCH 14/15] Moved currently undocumented Brimstone Heart Celestus resist to BalancingChangesManager --- Balancing/BalancingChangesManager.cs | 3 +++ NPCs/SupremeCalamitas/BrimstoneHeart.cs | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index c9116b809f..3afbc4ee95 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -506,6 +506,9 @@ namespace CalamityMod.Balancing #endregion #region Supreme Calamitas: Brimstone Hearts + // 34% resist to Celestus' mini scythes. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.66f, ProjectileType()))); + // 30% resist to Supernova. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType()))); diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index bae53cbcbc..1939c891d7 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -157,12 +157,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.instance.DrawCacheNPCsBehindNonSolidTiles.Add(index); } - public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) - { - if (projectile.type == ModContent.ProjectileType()) - modifiers.SourceDamage *= 0.66f; - } - public override bool CheckActive() => false; } } From dc527149cf1fe6a5b83c9aed33791b59193c7bb2 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Dec 2024 17:55:16 -0500 Subject: [PATCH 15/15] More Giant Pearl work because I wasn't satisfied --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- Items/Accessories/GiantPearl.cs | 19 +++++++----- .../Mods.CalamityMod.Items.Accessories.hjson | 2 +- NPCs/CalamityGlobalNPC.cs | 29 ++++++++++++++----- Particles/CustomPulse.cs | 6 ++-- Projectiles/Typeless/PearlAuraShard.cs | 6 ++-- Utilities/NPCDebuffs.cs | 4 --- 7 files changed, 42 insertions(+), 26 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 081398fa07..ef562b99c3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3142,7 +3142,7 @@ namespace CalamityMod.CalPlayer if (npc.friendly || npc.dontTakeDamage) continue; float distance = (npc.Center - Player.Center).Length(); - if (distance < 120f) + if (distance < GiantPearl.AuraRadius) npc.AddBuff(ModContent.BuffType(), 20, false); } } diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index c80f33d6a8..ac689310a9 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Accessories public class GiantPearl : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const float AuraRadius = 120f; public override void SetDefaults() { Item.width = 42; @@ -38,19 +39,23 @@ namespace CalamityMod.Items.Accessories if (currentNPCDist < npcDistCompare) npcDistCompare = currentNPCDist; } - float opacity = Utils.Remap(npcDistCompare, 120f, 640f, 1f, 0f); + float opacity = Utils.Remap(npcDistCompare, AuraRadius, AuraRadius * 5f, 1f, 0f); - if (opacity > 0.7f) + if (opacity >= 1f) { - for (int d = 0; d < 3; d++) + for (int d = 0; d < 2; 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); + WaterGlobParticle water = new(player.Center, Main.rand.NextVector2CircularEdge(13.5f, 13.5f), 0.32f, 0f, 35); + GeneralParticleHandler.SpawnParticle(water); } } - 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); + SemiCircularSmearFade smearBorder = new(player.Center, player.velocity, new Color(75, 164, 191) * opacity, player.miscCounter * (MathHelper.Pi / 30f), AuraRadius * 0.01125f, Vector2.One, 2, true); + GeneralParticleHandler.SpawnParticle(smearBorder); + smearBorder = new(player.Center, player.velocity, new Color(75, 164, 191) * opacity, player.miscCounter * (MathHelper.Pi / 30f) + MathHelper.Pi, AuraRadius * 0.01125f, Vector2.One, 2, true); + GeneralParticleHandler.SpawnParticle(smearBorder); + + CustomPulse auraVisual = new(player.Center, player.velocity, new Color(75, 164, 191), "CalamityMod/Particles/BloomRing", Vector2.One, 0f, AuraRadius * 0.0105f, AuraRadius * 0.0105f, 2, true, opacity, false); GeneralParticleHandler.SpawnParticle(auraVisual); } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index d25aca3d4c..fa13fe286f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -840,7 +840,7 @@ GiantPearl: { ''' You have a light aura around you Enemies within the aura are slowed down - You release homing prism shards while an enemy is slowed + Enemies that remain within the aura are bombarded by homing prism shards {$Common.AbyssLightLevel1} ''' } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2ce7eefbbd..a053cec900 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5488,9 +5488,6 @@ namespace CalamityMod.NPCs npc.ai[3] = 0f; } - // Incremement Giant Pearl's pearl shard counter - pearlAuraCounter++; - // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; @@ -5719,13 +5716,29 @@ namespace CalamityMod.NPCs // Pearl Aura shard spawning // Slowing is handled in the general slowing code below - if (pearlAura > 0 && pearlAuraCounter % 12 == 0) + if (pearlAura > 0) { - SoundEngine.PlaySound(SoundID.Item49, Main.LocalPlayer.Center); - Vector2 shardVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 7.5f; - int damage = 20; - Projectile.NewProjectile(npc.GetSource_FromThis(), Main.LocalPlayer.Center, shardVel, ProjectileType(), damage, 5f, Main.myPlayer); + pearlAuraCounter++; + if (pearlAuraCounter >= 45) + { + pearlAuraCounter = 0; + SoundEngine.PlaySound(SoundID.Item49, npc.Center); + + // Prevent things from getting too crazy + if (CalamityUtils.CountProjectiles(ProjectileType()) <= 3) + { + for (int i = 0; i < 3; i++) + { + Vector2 shardPos = npc.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-500f, -650f)); + Vector2 shardVel = Vector2.Normalize(npc.Center - shardPos).RotatedByRandom(MathHelper.Pi / 55f) * 20f; + int damage = 20; + Projectile.NewProjectile(npc.GetSource_FromThis(), shardPos, shardVel, ProjectileType(), damage, 5f, Main.myPlayer); + } + } + } } + else + pearlAuraCounter = 0; // Queen Bee is completely immune to having her movement impaired if not in a high difficulty mode. if (npc.type == NPCID.QueenBee && !CalamityWorld.revenge && !BossRushEvent.BossRushActive) diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index 415faf1555..ee6649cf23 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -20,10 +20,11 @@ namespace CalamityMod.Particles private float FinalScale; private float BaseOpacity; private float opacity; + private bool FadeOut; 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, float baseOpacity = 1f) + 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, bool fade = true) { Position = position; Velocity = velocity; @@ -34,6 +35,7 @@ namespace CalamityMod.Particles Scale = originalScale; Lifetime = lifeTime; BaseOpacity = baseOpacity; + FadeOut = fade; Squish = squish; Rotation = rotation; UseAltVisual = UseAdditiveBlend; @@ -44,7 +46,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) * BaseOpacity; + opacity = (FadeOut ? (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) : 1f) * BaseOpacity; Color = BaseColor * opacity; Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); diff --git a/Projectiles/Typeless/PearlAuraShard.cs b/Projectiles/Typeless/PearlAuraShard.cs index cf3d4d7526..6953d1f41b 100644 --- a/Projectiles/Typeless/PearlAuraShard.cs +++ b/Projectiles/Typeless/PearlAuraShard.cs @@ -16,17 +16,17 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 220; + Projectile.timeLeft = 150; Projectile.tileCollide = false; } public override void AI() { - if (Projectile.timeLeft < 210) + if (Projectile.timeLeft < 140) 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; + Projectile.rotation = Projectile.velocity.ToRotation() - (MathHelper.PiOver2 * Projectile.spriteDirection); 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); diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index d14b07c8dc..a2c9d1ca90 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -99,10 +99,6 @@ namespace CalamityMod // PART 2: Specific other cases that can't be neatly fit into the database // - // All bosses and several enemies are automatically immune to Pearl Aura. - if (EnemyImmunitiesList.Includes(npc.type) || npc.boss) - NPCID.Sets.SpecificDebuffImmunity[npc.type][ModContent.BuffType()] = true; - // Make all Cal NPCs immune to confused unless otherwise specified // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). bool cal = npc.ModNPC != null && npc.ModNPC.Mod.Name.Equals(ModContent.GetInstance().Name);