From 482ae205f0b993d1aee672bdcfd1835755652fb6 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 00:09:09 -0500 Subject: [PATCH 01/29] 1 - Removed ancillary effects of mainline ram shields and toned down defense. 2 - Emphasized debuff immunities in Ankh Shield upgrades. 3 - Removed Shield of the Ocean from Asgard's line 4 - Vastly increased damage of Elysian Aegis and Asgardian Aegis rams. --- CalPlayer/CalamityPlayerDashEffects.cs | 9 ++++- CalPlayer/Dashes/AsgardianAegisDash.cs | 29 +++++--------- CalPlayer/Dashes/AsgardsValorDash.cs | 27 ++++--------- CalPlayer/Dashes/DashHitContext.cs | 14 ++++--- CalPlayer/Dashes/DefaultDash.cs | 2 +- CalPlayer/Dashes/ElysianAegisDash.cs | 27 +++++-------- CalPlayer/Dashes/GodslayerArmorDash.cs | 27 +++++-------- CalPlayer/Dashes/OrnateShieldDash.cs | 21 ++++------ CalPlayer/Dashes/PlaguebringerArmorDash.cs | 23 ++++------- CalPlayer/Dashes/SpeedBlasterDash.cs | 12 +----- CalPlayer/Dashes/StatisVoidSashDash.cs | 2 - Items/Accessories/Abaddon.cs | 4 +- Items/Accessories/AsgardianAegis.cs | 46 +++++++++++++++++----- Items/Accessories/AsgardsValor.cs | 25 ++++++++---- Items/Accessories/ElysianAegis.cs | 24 ++++++++--- Items/Accessories/OrnateShield.cs | 22 +++++------ 16 files changed, 153 insertions(+), 161 deletions(-) diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 6249e17649..0a5cce0e2e 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -88,10 +88,15 @@ namespace CalamityMod.CalPlayer UsedDash.OnHitEffects(Player, n, source, ref hitContext); // Don't bother doing anything if no damage is done. - if (hitContext.Damage <= 0) + if (hitContext.damageClass is null || hitContext.BaseDamage <= 0) continue; - Player.ApplyDamageToNPC(n, hitContext.Damage, hitContext.KnockbackFactor, hitContext.HitDirection, hitContext.CriticalHit); + // Duplicated from the way TML edits vanilla ram dash damage (and Shield of Cthulhu) + int dashDamage = (int)Player.GetTotalDamage(hitContext.damageClass).ApplyTo(hitContext.BaseDamage); + float dashKB = Player.GetTotalKnockback(hitContext.damageClass).ApplyTo(hitContext.BaseKnockback); + bool rollCrit = Main.rand.Next(100) < Player.GetTotalCritChance(hitContext.damageClass); + + Player.ApplyDamageToNPC(n, dashDamage, dashKB, hitContext.HitDirection, rollCrit, hitContext.damageClass, true); if (n.Calamity().dashImmunityTime[Player.whoAmI] < 12) n.Calamity().dashImmunityTime[Player.whoAmI] = 12; diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index 334246d449..2c289ebdab 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -1,10 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -57,31 +54,25 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - float kbFactor = 15f; - bool crit = Main.rand.Next(100) < player.GetCritChance(); - if (player.kbGlove) - kbFactor *= 2f; - if (player.kbBuff) - kbFactor *= 1.5f; - + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); - - // Define hit context variables. - hitContext.CriticalHit = crit; hitContext.HitDirection = hitDirection; - hitContext.KnockbackFactor = kbFactor; hitContext.PlayerImmunityFrames = AsgardianAegis.ShieldSlamIFrames; - hitContext.Damage = (int)player.GetTotalDamage().ApplyTo(300f); - if (player.Calamity().oldFashioned) - hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage); - int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(135); + // Define damage parameters. + int dashDamage = AsgardianAegis.ShieldSlamDamage; + hitContext.damageClass = DamageClass.Melee; + hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; + hitContext.BaseKnockback = AsgardianAegis.ShieldSlamKnockback; + + // TODO -- Asgardian Aegis should probably spawn some god slayer themed explosion instead of a holy attack + int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(AsgardianAegis.RamExplosionDamage); if (player.Calamity().oldFashioned) supremeExplosionDamage = CalamityUtils.CalcOldFashionedDamage(supremeExplosionDamage); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, 20f, Main.myPlayer, 3f, 0f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, AsgardianAegis.RamExplosionKnockback, Main.myPlayer, 3f, 0f); npc.AddBuff(ModContent.BuffType(), 300); } } diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index c929028a13..b36eca28da 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -54,32 +53,20 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - float kbFactor = 9f; - bool crit = Main.rand.Next(100) < player.GetCritChance(); - if (player.kbGlove) - kbFactor *= 2f; - if (player.kbBuff) - kbFactor *= 1.5f; - + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); - - // Define hit context variables. - hitContext.CriticalHit = crit; hitContext.HitDirection = hitDirection; - hitContext.KnockbackFactor = kbFactor; hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames; - hitContext.Damage = (int)player.GetTotalDamage().ApplyTo(100f); - if (player.Calamity().oldFashioned) - hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage); - int holyExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(60); - if (player.Calamity().oldFashioned) - holyExplosionDamage = CalamityUtils.CalcOldFashionedDamage(holyExplosionDamage); + // Define damage parameters. + int dashDamage = AsgardsValor.ShieldSlamDamage; + hitContext.damageClass = DamageClass.Melee; + hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; + hitContext.BaseKnockback = AsgardsValor.ShieldSlamKnockback; - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), holyExplosionDamage, 15f, Main.myPlayer, 0f, 0f); - npc.AddBuff(ModContent.BuffType(), 180); + // TODO -- With the removal of its holy explosion, Asgard's Valor needs better visuals } } } diff --git a/CalPlayer/Dashes/DashHitContext.cs b/CalPlayer/Dashes/DashHitContext.cs index f501e8bfd9..159a3ca6b9 100644 --- a/CalPlayer/Dashes/DashHitContext.cs +++ b/CalPlayer/Dashes/DashHitContext.cs @@ -1,15 +1,17 @@ -namespace CalamityMod.CalPlayer.Dashes +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer.Dashes { public struct DashHitContext { - public int Damage; + public int BaseDamage; + + public float BaseKnockback; + + public DamageClass damageClass; public int PlayerImmunityFrames; public int HitDirection; - - public bool CriticalHit; - - public float KnockbackFactor; } } diff --git a/CalPlayer/Dashes/DefaultDash.cs b/CalPlayer/Dashes/DefaultDash.cs index 1aa81a2b55..8194e287a5 100644 --- a/CalPlayer/Dashes/DefaultDash.cs +++ b/CalPlayer/Dashes/DefaultDash.cs @@ -16,7 +16,7 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - hitContext.Damage = 0; + hitContext.BaseDamage = 0; hitContext.PlayerImmunityFrames = 0; } } diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 2ea0019aed..1910bad531 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -57,31 +56,25 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - float kbFactor = 12f; - bool crit = Main.rand.Next(100) < player.GetCritChance(); - if (player.kbGlove) - kbFactor *= 2f; - if (player.kbBuff) - kbFactor *= 1.5f; - + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); - - // Define hit context variables. - hitContext.CriticalHit = crit; hitContext.HitDirection = hitDirection; - hitContext.KnockbackFactor = kbFactor; hitContext.PlayerImmunityFrames = ElysianAegis.ShieldSlamIFrames; - hitContext.Damage = (int)player.GetTotalDamage().ApplyTo(250f); - if (player.Calamity().oldFashioned) - hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage); - int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(120); + // Define damage parameters. + int dashDamage = ElysianAegis.ShieldSlamDamage; + hitContext.damageClass = DamageClass.Melee; + hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; + hitContext.BaseKnockback = ElysianAegis.ShieldSlamKnockback; + + // On-hit Supreme Holy Explosion + int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(ElysianAegis.RamExplosionDamage); if (player.Calamity().oldFashioned) supremeExplosionDamage = CalamityUtils.CalcOldFashionedDamage(supremeExplosionDamage); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, 15f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, ElysianAegis.RamExplosionKnockback, Main.myPlayer, 1f, 0f); npc.AddBuff(ModContent.BuffType(), 300); } } diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 1c36714003..e87f26fa4c 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -1,9 +1,8 @@ using System; using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; using CalamityMod.Enums; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.GodSlayer; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -11,8 +10,6 @@ using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -127,28 +124,22 @@ namespace CalamityMod.CalPlayer.Dashes dust.noGravity = false; } - float kbFactor = 15f; - bool crit = Main.rand.Next(100) < player.GetCritChance(); - if (player.kbGlove) - kbFactor *= 2f; - if (player.kbBuff) - kbFactor *= 1.5f; - + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); - - // Define hit context variables. - hitContext.CriticalHit = crit; hitContext.HitDirection = hitDirection; - hitContext.KnockbackFactor = kbFactor; + hitContext.PlayerImmunityFrames = AsgardianAegis.ShieldSlamIFrames; + + // Define damage parameters. + int dashDamage = 3000; + hitContext.damageClass = player.GetBestClass(); + hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; + hitContext.BaseKnockback = 15f; // God Slayer Dash intentionally does not use the vanilla function for collision attack iframes. // This is because its immunity is meant to be completely consistent and not subject to vanilla anticheese. hitContext.PlayerImmunityFrames = GodSlayerChestplate.DashIFrames; - hitContext.Damage = (int)player.GetBestClassDamage().ApplyTo(3000f); - if (player.Calamity().oldFashioned) - hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage); npc.AddBuff(ModContent.BuffType(), 300); } diff --git a/CalPlayer/Dashes/OrnateShieldDash.cs b/CalPlayer/Dashes/OrnateShieldDash.cs index 44442b569d..4528237965 100644 --- a/CalPlayer/Dashes/OrnateShieldDash.cs +++ b/CalPlayer/Dashes/OrnateShieldDash.cs @@ -1,7 +1,6 @@ using System; using CalamityMod.Enums; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Potions.Alcohol; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -44,24 +43,18 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - float kbFactor = 3f; - if (player.kbGlove) - kbFactor *= 2f; - if (player.kbBuff) - kbFactor *= 1.5f; - + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); - - // Define hit context variables. - hitContext.CriticalHit = false; hitContext.HitDirection = hitDirection; - hitContext.KnockbackFactor = kbFactor; hitContext.PlayerImmunityFrames = OrnateShield.ShieldSlamIFrames; - hitContext.Damage = (int)player.GetTotalDamage().ApplyTo(50f); - if (player.Calamity().oldFashioned) - hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage); + + // Define damage parameters. + int dashDamage = OrnateShield.ShieldSlamDamage; + hitContext.damageClass = DamageClass.Melee; + hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; + hitContext.BaseKnockback = OrnateShield.ShieldSlamKnockback; npc.AddBuff(BuffID.Frostburn2, 180); //Great, Frostbite is ACTUALLY called Frostburn 2 } diff --git a/CalPlayer/Dashes/PlaguebringerArmorDash.cs b/CalPlayer/Dashes/PlaguebringerArmorDash.cs index 6b938d8c5f..d6792659a5 100644 --- a/CalPlayer/Dashes/PlaguebringerArmorDash.cs +++ b/CalPlayer/Dashes/PlaguebringerArmorDash.cs @@ -1,11 +1,11 @@ using System; using CalamityMod.Enums; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Potions.Alcohol; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes { @@ -55,25 +55,18 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { - float kbFactor = 3f; - bool crit = false; - if (player.kbGlove) - kbFactor *= 2f; - if (player.kbBuff) - kbFactor *= 1.5f; - + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); - - // Define hit context variables. - hitContext.CriticalHit = crit; hitContext.HitDirection = hitDirection; - hitContext.KnockbackFactor = kbFactor; hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames; - hitContext.Damage = (int)player.GetBestClassDamage().ApplyTo(50f); - if (player.Calamity().oldFashioned) - hitContext.Damage = CalamityUtils.CalcOldFashionedDamage(hitContext.Damage); + + // Define damage parameters. + int dashDamage = 50; + hitContext.damageClass = DamageClass.Summon; + hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; + hitContext.BaseKnockback = 3f; } } } diff --git a/CalPlayer/Dashes/SpeedBlasterDash.cs b/CalPlayer/Dashes/SpeedBlasterDash.cs index 40efa99161..9541964367 100644 --- a/CalPlayer/Dashes/SpeedBlasterDash.cs +++ b/CalPlayer/Dashes/SpeedBlasterDash.cs @@ -1,17 +1,7 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Enums; -using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Enums; using CalamityMod.Items.Weapons.Ranged; -using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using CalamityMod.Projectiles.Ranged; -using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes { diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index d36ae9e5ce..c62fca33e6 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -1,10 +1,8 @@ using CalamityMod.Enums; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Particles; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Graphics.Shaders; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index b1152f25ef..f88596d263 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -1,6 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index bc92c4a8c4..2193cc3dc8 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -1,10 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,14 +15,19 @@ namespace CalamityMod.Items.Accessories public class AsgardianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int ShieldSlamDamage = 1000; + public const float ShieldSlamKnockback = 15f; public const int ShieldSlamIFrames = 12; + public const int RamExplosionDamage = 1000; + public const float RamExplosionKnockback = 20f; + public override void SetDefaults() { Item.width = 60; Item.height = 54; Item.value = CalamityGlobalItem.Rarity14BuyPrice; - Item.defense = 28; + Item.defense = 20; Item.accessory = true; Item.rare = ModContent.RarityType(); } @@ -30,15 +35,14 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + + // Asgardian Aegis ram dash modPlayer.DashID = AsgardianAegisDash.ID; player.dashType = 0; + + // Inherited Ankh Shield effects player.noKnockback = true; player.fireWalk = true; - player.statLifeMax2 += 40; - player.lifeRegen++; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[BuffID.Weak] = true; player.buffImmune[BuffID.BrokenArmor] = true; player.buffImmune[BuffID.Bleeding] = true; @@ -50,10 +54,34 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Darkness] = true; player.buffImmune[BuffID.WindPushed] = true; player.buffImmune[BuffID.Stoned] = true; + + // Additional debuff immunities (Counterparts, similar debuffs to vanilla Ankh Shield debuffs, or upgrades thereof) + player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Broken Armor + player.buffImmune[ModContent.BuffType()] = true; // Counterpart to Burning Blood + player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Bleeding + player.buffImmune[BuffID.Venom] = true; // "Stronger" Poisoned + player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Poisoned + player.buffImmune[BuffID.Webbed] = true; // "Stronger" Slow + player.buffImmune[BuffID.Blackout] = true; // "Stronger" Darkness + + // Additional debuff immunities (Everything from Ornate Shield + Asgard's Valor) + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.OnFire3] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[BuffID.Chilled] = true; + player.buffImmune[BuffID.Frozen] = true; + player.buffImmune[BuffID.Frostburn] = true; + player.buffImmune[BuffID.Frostburn2] = true; + + // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.ShadowFlame] = true; + player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; + + // Immune to God Slayer Inferno itself player.buffImmune[ModContent.BuffType()] = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { player.statDefense += 20; } } public override void AddRecipes() diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 7bd143dfc2..a1ec856b4c 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Items.Accessories { @@ -11,6 +12,8 @@ namespace CalamityMod.Items.Accessories public class AsgardsValor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int ShieldSlamDamage = 200; + public const float ShieldSlamKnockback = 9f; public const int ShieldSlamIFrames = 12; public override void SetDefaults() @@ -19,20 +22,21 @@ namespace CalamityMod.Items.Accessories Item.height = 44; Item.value = CalamityGlobalItem.Rarity7BuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 16; + Item.defense = 12; // we buff Ankh Shield to 12 Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + + // Asgard's Valor ram dash modPlayer.DashID = AsgardsValorDash.ID; player.dashType = 0; + + // Inherited Ankh Shield effects player.noKnockback = true; player.fireWalk = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[BuffID.Weak] = true; player.buffImmune[BuffID.BrokenArmor] = true; player.buffImmune[BuffID.Bleeding] = true; @@ -44,9 +48,15 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Darkness] = true; player.buffImmune[BuffID.WindPushed] = true; player.buffImmune[BuffID.Stoned] = true; - player.statLifeMax2 += 20; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { player.statDefense += 16; } + + // Additional debuff immunities (Everything from Ornate Shield + fiery stuff) + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.OnFire3] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[BuffID.Chilled] = true; + player.buffImmune[BuffID.Frozen] = true; + player.buffImmune[BuffID.Frostburn] = true; + player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() @@ -54,7 +64,6 @@ namespace CalamityMod.Items.Accessories CreateRecipe(). AddIngredient(ItemID.AnkhShield). AddIngredient(). - AddIngredient(). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index bd1ec68966..379a59615a 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -2,7 +2,6 @@ using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Rarities; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,28 +12,43 @@ namespace CalamityMod.Items.Accessories public class ElysianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int ShieldSlamDamage = 500; + public const float ShieldSlamKnockback = 12f; public const int ShieldSlamIFrames = 12; + public const int RamExplosionDamage = 500; + public const float RamExplosionKnockback = 15f; + public override void SetDefaults() { Item.width = 48; Item.height = 42; Item.value = CalamityGlobalItem.Rarity12BuyPrice; Item.rare = ModContent.RarityType(); - Item.defense = 18; + Item.defense = 16; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + + // Elysian Aegis ram dash modPlayer.DashID = ElysianAegisDash.ID; player.dashType = 0; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[ModContent.BuffType()] = true; + + // Vaguely inherited Ankh Shield effects I guess player.noKnockback = true; player.fireWalk = true; - player.statLifeMax2 += 30; + + // Debuff immunities + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.OnFire3] = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.ShadowFlame] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[BuffID.Daybreak] = true; + player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index bb55c53147..21337c5858 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -1,9 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.CalPlayer.Dashes; -using CalamityMod.Items.Armor.Daedalus; namespace CalamityMod.Items.Accessories { @@ -11,6 +10,8 @@ namespace CalamityMod.Items.Accessories public class OrnateShield : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public const int ShieldSlamDamage = 50; + public const float ShieldSlamKnockback = 3f; public const int ShieldSlamIFrames = 12; public override void SetDefaults() @@ -25,16 +26,15 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.endurance += 0.08f; - player.statLifeMax2 += 20; - } + // Ornate Shield ram dash player.Calamity().DashID = OrnateShieldDash.ID; player.dashType = 0; + + // Cold debuff immunities (Do not fear, this accessory is post Cryogen!) + player.buffImmune[BuffID.Chilled] = true; + player.buffImmune[BuffID.Frozen] = true; + player.buffImmune[BuffID.Frostburn] = true; + player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() From 1333b0897a6ce54a06209609e26c6fb5f34fe08d Mon Sep 17 00:00:00 2001 From: mochi-angel Date: Wed, 6 Dec 2023 22:02:26 -0800 Subject: [PATCH 02/29] DoG now has a 40% resist to Wave Pounder --- Balancing/BalancingChangesManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index b675be3253..338820b1f8 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -258,9 +258,12 @@ namespace CalamityMod.Balancing // 50% resist to Eidolic Wail. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 40% resist to Wave Pounder. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + // 35% resist to Venusian Trident's explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); - + // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); From 52b8f450e052d296c0ff97123302961341941774 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:32:14 -0500 Subject: [PATCH 03/29] Updated ram accessory tooltips --- .../en-US/Mods.CalamityMod.Items.Accessories.hjson | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 2bd7452524..31f4173a6d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -238,9 +238,7 @@ AsgardianAegis: { ''' Grants immunity to knockback Immune to most debuffs - +40 max life and +0.5 HP/s life regen Grants a cosmic inferno dash which can slam through enemies without taking damage - +20 defense while submerged in liquid ''' } @@ -249,10 +247,8 @@ AsgardsValor: { Tooltip: ''' Grants immunity to knockback - Immune to most debuffs - +16 defense while submerged in liquid - +20 max life - Grants a holy flame dash which can slam through enemies without taking damage + Immune to several debuffs + Grants a holy dash which can slam through enemies without taking damage ''' } @@ -661,8 +657,7 @@ ElysianAegis: { DisplayName: Elysian Aegis Tooltip: ''' - Grants immunity to knockback and the Burning, On Fire!, and Holy Flames debuffs - +30 max life + Grants immunity to knockback and several flame debuffs Grants an enhanced holy flame dash which can slam through enemies without taking damage Blessed by the Profaned Flame ''' From bc11b895d3ad18ed5b705c247c4ffb79de20851b Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 7 Dec 2023 10:51:24 -0500 Subject: [PATCH 04/29] Forbidden Sun --- Items/Weapons/Magic/ForbiddenSun.cs | 2 +- Projectiles/Magic/ForbiddenSunburst.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 876ea9604e..46a57eb643 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ItemRarityID.Yellow; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; + Item.shootSpeed = 13f; } public override void AddRecipes() diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 5db1149a09..6585b0a41d 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = -1; Projectile.timeLeft = 150; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -73,11 +75,7 @@ namespace CalamityMod.Projectiles.Magic } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 8; - target.AddBuff(BuffID.OnFire3, 300); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 300); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); } From ef731163883ceec469ff501602289ca9a0233460 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:01:48 -0500 Subject: [PATCH 05/29] Oops, forgot Ornate Shield --- Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 31f4173a6d..2d3d03d05a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1203,7 +1203,7 @@ OrnateShield: { DisplayName: Ornate Shield Tooltip: ''' - 8% increased damage reduction and +20 health while wearing the Daedalus armor + Grants immunity to Chilled, Frostburn, Frostbite, and Frozen Grants a frost dash which can slam through enemies without taking damage ''' } From 9718ac48e232852452959a78f3f444ecb06ab036 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 16:28:37 -0500 Subject: [PATCH 06/29] sorry CIT, cleaned up the tooltip cleanups --- .../Mods.CalamityMod.Items.Accessories.hjson | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 2d3d03d05a..8bf6ef20b0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -236,9 +236,10 @@ AsgardianAegis: { DisplayName: Asgardian Aegis Tooltip: ''' - Grants immunity to knockback - Immune to most debuffs - Grants a cosmic inferno dash which can slam through enemies without taking damage + Allows the ability to ram dash, empowered by the cosmic inferno + This dash can slam through enemies without taking damage + Grants immunity to knockback and fire blocks + Grants immunity to the vast majority of debuffs, including God Slayer Inferno ''' } @@ -246,9 +247,10 @@ AsgardsValor: { DisplayName: Asgard's Valor Tooltip: ''' - Grants immunity to knockback - Immune to several debuffs - Grants a holy dash which can slam through enemies without taking damage + Allows the ability to ram dash + This dash can slam through enemies without taking damage + Grants immunity to knockback and fire blocks + Grants immunity to most debuffs, including most forms of frost and flame ''' } @@ -657,8 +659,10 @@ ElysianAegis: { DisplayName: Elysian Aegis Tooltip: ''' - Grants immunity to knockback and several flame debuffs - Grants an enhanced holy flame dash which can slam through enemies without taking damage + Allows the ability to ram dash, empowered by holy fire + This dash can slam through enemies without taking damage + Grants immunity to knockback and fire blocks + Grants immunity to most fire debuffs, including Daybreak and Holy Flames Blessed by the Profaned Flame ''' } @@ -1203,8 +1207,9 @@ OrnateShield: { DisplayName: Ornate Shield Tooltip: ''' + Allows the ability to ram dash + This dash can slam through enemies without taking damage Grants immunity to Chilled, Frostburn, Frostbite, and Frozen - Grants a frost dash which can slam through enemies without taking damage ''' } From f99ae1ce35f01ed6a19e915f1bfe7d8cdb07af21 Mon Sep 17 00:00:00 2001 From: Xyk Date: Thu, 7 Dec 2023 15:41:31 -0800 Subject: [PATCH 07/29] Asguard's Valor dash visual and Photo sound reduction Also split Asgardian aegis and elysian aegis explosion projectiles --- CalPlayer/Dashes/AsgardianAegisDash.cs | 8 +- CalPlayer/Dashes/AsgardsValorDash.cs | 56 +++++++++---- Items/Weapons/Ranged/Photoviscerator.cs | 4 +- ...ods.CalamityMod.Projectiles.Typeless.hjson | 1 + Projectiles/Ranged/PhotovisceratorHoldout.cs | 4 +- Projectiles/Typeless/CosmicDashExplosion.cs | 59 +++++++++++++ Projectiles/Typeless/HolyExplosionSupreme.cs | 83 +++++-------------- 7 files changed, 132 insertions(+), 83 deletions(-) create mode 100644 Projectiles/Typeless/CosmicDashExplosion.cs diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index 2c289ebdab..4132e70827 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -67,12 +67,12 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; hitContext.BaseKnockback = AsgardianAegis.ShieldSlamKnockback; - // TODO -- Asgardian Aegis should probably spawn some god slayer themed explosion instead of a holy attack - int supremeExplosionDamage = (int)player.GetBestClassDamage().ApplyTo(AsgardianAegis.RamExplosionDamage); + // Spawn explosion + int explosionDamage = (int)player.GetBestClassDamage().ApplyTo(AsgardianAegis.RamExplosionDamage); if (player.Calamity().oldFashioned) - supremeExplosionDamage = CalamityUtils.CalcOldFashionedDamage(supremeExplosionDamage); + explosionDamage = CalamityUtils.CalcOldFashionedDamage(explosionDamage); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), supremeExplosionDamage, AsgardianAegis.RamExplosionKnockback, Main.myPlayer, 3f, 0f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, AsgardianAegis.RamExplosionKnockback, Main.myPlayer, 3f, 0f); npc.AddBuff(ModContent.BuffType(), 300); } } diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index b36eca28da..a81b4e1b91 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -5,8 +5,10 @@ using CalamityMod.Items.Accessories; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -23,17 +25,7 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnDashEffects(Player player) { - // Spawn fire dust around the player's body. - for (int d = 0; d < 20; d++) - { - Dust holyFireDashDust = Dust.NewDustDirect(player.position, player.width, player.height, 246, 0f, 0f, 100, default, 3f); - holyFireDashDust.position += Main.rand.NextVector2Square(-5f, 5f); - holyFireDashDust.velocity *= 0.2f; - holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - holyFireDashDust.noGravity = true; - holyFireDashDust.fadeIn = 0.5f; - } + // Nothing } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) @@ -41,13 +33,20 @@ namespace CalamityMod.CalPlayer.Dashes // Spawn fire dust around the player's body. for (int d = 0; d < 4; d++) { - Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f); - holyFireDashDust.velocity *= 0.1f; + Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); + holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); holyFireDashDust.noGravity = true; if (Main.rand.NextBool()) - holyFireDashDust.fadeIn = 0.5f; + holyFireDashDust.fadeIn = 0.1f; + } + if (Main.rand.NextBool(3)) + { + Vector2 dustPosition = player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f); + Dust dust = Dust.NewDustPerfect(dustPosition, 222, -player.velocity * Main.rand.NextFloat(0.15f, 0.4f), 0, default, 0.5f); + dust.noGravity = false; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); } } @@ -66,7 +65,34 @@ namespace CalamityMod.CalPlayer.Dashes hitContext.BaseDamage = player.Calamity().oldFashioned ? CalamityUtils.CalcOldFashionedDamage(dashDamage) : dashDamage; hitContext.BaseKnockback = AsgardsValor.ShieldSlamKnockback; - // TODO -- With the removal of its holy explosion, Asgard's Valor needs better visuals + int Dusts = 12; + float radians = MathHelper.TwoPi / Dusts; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)); + for (int k = 0; k < Dusts; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k); + Dust dust = Dust.NewDustPerfect(npc.Center, 296, velocity * 3f, 0, default, 2.5f); + dust.noGravity = true; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + + Dust dust2 = Dust.NewDustPerfect(npc.Center, 158, velocity * 5f, 0, default, 2.2f); + dust2.noGravity = true; + dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + dust2.color = Color.Salmon; + + Dust dust3 = Dust.NewDustPerfect(npc.Center, 169, velocity * 7f, 0, default, 1.9f); + dust3.noGravity = true; + dust3.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + dust3.color = Color.SandyBrown; + + } + for (int k = 0; k < 5; k++) + { + Dust dust = Dust.NewDustPerfect(npc.Center, 222, new Vector2(0, -3.5f).RotatedByRandom(0.7f) * Main.rand.NextFloat(0.8f, 1.4f), 0, default, 1.2f); + dust.noGravity = false; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + } + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.6f, PitchVariance = 0.3f }, npc.position); } } } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 2eb28d7c5d..2bf8005481 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Photoviscerator : ModItem, ILocalizedModType { - public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PhotoUseSound") { Volume = 0.55f }; - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/PhotoHitSound") { Volume = 0.45f }; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PhotoUseSound") { Volume = 0.35f }; + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/PhotoHitSound") { Volume = 0.4f }; public new string LocalizationCategory => "Items.Weapons.Ranged"; // Left-click stats diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index c5c0ddf5e6..51989ca220 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -132,3 +132,4 @@ WulfrumLureSignal.DisplayName: Signal YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism AscendantAura.DisplayName: Ascendant Aura +CosmicDashExplosion.DisplayName: Cosmic Dash Explosion diff --git a/Projectiles/Ranged/PhotovisceratorHoldout.cs b/Projectiles/Ranged/PhotovisceratorHoldout.cs index ef4667fc2e..d26bea597d 100644 --- a/Projectiles/Ranged/PhotovisceratorHoldout.cs +++ b/Projectiles/Ranged/PhotovisceratorHoldout.cs @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.NewProjectile(source, bombPos, bombVel, ProjectileType(), damage, knockback, Projectile.owner, yDirection); } - SoundEngine.PlaySound(HalleysInferno.Hit, Owner.MountedCenter); + SoundEngine.PlaySound(HalleysInferno.Hit with { Volume = 0.5f }, Owner.MountedCenter); } } @@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Ranged dust.scale = Main.rand.NextFloat(1.3f, 1.8f); dust.color = sparkColor; } - SoundEngine.PlaySound(HalleysInferno.Shoot, Owner.MountedCenter); + SoundEngine.PlaySound(HalleysInferno.Shoot with { Volume = 0.4f } , Owner.MountedCenter); int rightClickDamage = (int)(0.5f * damage); Projectile.NewProjectile(source, position, velocity, ProjectileType(), rightClickDamage, knockback, Projectile.owner); diff --git a/Projectiles/Typeless/CosmicDashExplosion.cs b/Projectiles/Typeless/CosmicDashExplosion.cs new file mode 100644 index 0000000000..758b6264ac --- /dev/null +++ b/Projectiles/Typeless/CosmicDashExplosion.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Projectiles.Typeless +{ + public class CosmicDashExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak1") { Volume = 0.3f }; + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 3; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 4; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(Impact with { PitchVariance = 0.3f }, Projectile.position); + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 60; + Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + for (int i = 0; i < 24; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 181, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); + dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + dust.noGravity = true; + } + for (int j = 0; j < 13; j++) + { + Vector2 dustVel = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); + + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 272, dustVel, 0, default, 1f); + dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 226, dustVel, 0, default, 1f); + dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + } + } + } +} diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index 2c8c85e1ed..b14d9a72a5 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -13,8 +13,6 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public Player Owner => Main.player[Projectile.owner]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak1") { Volume = 0.3f }; public override void SetDefaults() { Projectile.width = 60; @@ -30,71 +28,36 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - if (Projectile.ai[0] < 2) + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); + Projectile.width = 60; + Projectile.height = 60; + Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); + Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); + for (int i = 0; i < 5; i++) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 60; - Projectile.height = 60; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) + int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[holyDust].velocity *= 3f; + if (Projectile.ai[0] == 1) + Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + if (Main.rand.NextBool()) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[holyDust].velocity *= 3f; - if (Projectile.ai[0] == 1) - Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 10; j++) - { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - Main.dust[holyDust2].velocity *= 5f; - if (Projectile.ai[0] == 1) - Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].velocity *= 2f; - if (Projectile.ai[0] == 1) - Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + Main.dust[holyDust].scale = 0.5f; + Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - else + for (int j = 0; j < 10; j++) { - SoundEngine.PlaySound(Impact with { PitchVariance = 0.3f }, Projectile.position); - SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.position); - Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 60; - Projectile.height = 60; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 8; i++) - { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 181, 0f, 0f, 100, default, Main.rand.NextFloat(1.2f, 1.8f)); - Main.dust[holyDust].velocity *= 3f; - Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int j = 0; j < 12; j++) - { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 272, 0f, 0f, 100, default, 0.8f); - Main.dust[holyDust2].noGravity = true; - Main.dust[holyDust2].velocity *= 5f; + int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); + Main.dust[holyDust2].noGravity = true; + Main.dust[holyDust2].velocity *= 5f; + if (Projectile.ai[0] == 1) Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 226, 0f, 0f, 100, default, 0.6f); - Main.dust[holyDust2].velocity *= 2f; + holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); + Main.dust[holyDust2].velocity *= 2f; + if (Projectile.ai[0] == 1) Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - } } } } From ae63aafe927b81f7c441bc27deca8674412b0c47 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 18:43:19 -0500 Subject: [PATCH 08/29] 1 - Fixed defense damage healing during iframes. 2 - Added utility for checking for player iframes correctly. 3 - Significant rewrite / refactor of defense damage code. 4 - Defense damage can now exceed your total defense in GFB. Good luck with that. --- CalPlayer/CalamityPlayer.cs | 1 - CalPlayer/CalamityPlayerHitHurt.cs | 89 ++++++++++++------------ CalPlayer/CalamityPlayerMiscEffects.cs | 93 +++++++++++++------------- Utilities/PlayerUtils.cs | 20 ++++++ 4 files changed, 109 insertions(+), 94 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 885e58a505..8a2f552df0 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -26,7 +26,6 @@ using CalamityMod.Items.Dyes; using CalamityMod.Items.Mounts; using CalamityMod.Items.Mounts.Minecarts; using CalamityMod.Items.PermanentBoosters; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.DraedonsArsenal; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 8e5f9d77f2..0c4f70b058 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -18,7 +18,6 @@ using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Mounts; -using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; @@ -1939,10 +1938,7 @@ namespace CalamityMod.CalPlayer #region Actually Dealing Defense Damage // Check if the player has iframes for the sake of avoiding defense damage. - bool hasIFrames = false; - for (int i = 0; i < Player.hurtCooldowns.Length; i++) - if (Player.hurtCooldowns[i] > 0) - hasIFrames = true; + bool hasIFrames = Player.HasIFrames(); // If the player was just hit by something capable of dealing defense damage, then apply defense damage. // Bloodflare Core makes every hit deal defense damage (to enable its function). @@ -1955,11 +1951,11 @@ namespace CalamityMod.CalPlayer int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage; double standardDefenseDamage = netMitigation * defenseDamageRatio; - // If Bloodflare Core is equipped and standard defense damage would be less than half the player's total defense, - // then instead forcibly deal half of the player's total defense as defense damage. + // Bloodflare Core overrides standard defense damage if it would be less than half of the player's total defense. if (bloodflareCore && standardDefenseDamage < halfDefense) { - DealDefenseDamage(hurtInfo, (int)halfDefense, true); + // In this case, forcibly deal half of the player's total defense as defense damage. This ignores ratios. + DealDefenseDamage((int)halfDefense, true); // Set up Bloodflare Core's heal over time. Any in-progress heals are overwritten if they would have a shorter duration. if (bloodflareCoreRemainingHealOverTime < halfDefense) @@ -2747,46 +2743,42 @@ namespace CalamityMod.CalPlayer } #endregion - #region Defense Damage Function + #region Defense Damage Functions /// - /// Deals Calamity defense damage to a player. + /// Deals Calamity defense damage to a player the "normal way", using an incoming hit.
+ /// This is the convenience function which follows all standard Calamity balancing rules for taking a regular hit. ///
/// HurtInfo of the incoming strike to the player. - /// If set to zero or a positive number, ignores the HurtInfo and uses this value as the incoming damage. - /// If true, deals exactly the custom amount defense damage, ignoring the standard ratios and Draedon's Heart.
- /// This also bypasses the - /// This does nothing unless customIncomingDefenseDamage is specified. - public void DealDefenseDamage(Player.HurtInfo hurtInfo, int customIncomingDamage = -1, bool absolute = false) + public void DealDefenseDamage(Player.HurtInfo hurtInfo) { // Legacy safeguard: Skip defense damage if the player is somehow "hit for zero" (this should never happen). if (hurtInfo.Damage <= 0 || hurtInfo.SourceDamage <= 0) return; - double ratioToUse = defenseDamageRatio; - - // Calculate the defense damage taken from this hit. - // If custom incoming defense damage is specified, then ignore the incoming hurt info and use the custom value. - int incomingDamageToUse; - if (customIncomingDamage >= 0) - { - incomingDamageToUse = customIncomingDamage; - // If absolute is specified, then ignore the ratio and always inflict EXACTLY THAT MUCH defense damage. This means it bypasses Draedon's Heart! - if (absolute) - ratioToUse = 1D; - } - - // Standard hits. Defense damage scales with "net mitigation", aka how much damage the player DIDN'T take. + // Under typical circumstances, defense damage scales with "net mitigation", aka how much damage the player DIDN'T take. // Thematically, this means it scales with how much damage the player's defense took instead of them. - else - { - int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage; + int netMitigation = hurtInfo.SourceDamage - hurtInfo.Damage; + int incomingDamageToUse = netMitigation <= 0 ? 0 : netMitigation; - // If the player somehow took amplified damage (their mitigation was negative) then they take no base defense damage. - // The defense damage floor will still apply to them. - incomingDamageToUse = netMitigation <= 0 ? 0 : netMitigation; - } + // Leave it to the direct function to determine how much defense damage is taken. Use standard ratios. + DealDefenseDamage(incomingDamageToUse, false); + } - int defenseDamageTaken = (int)Math.Round(incomingDamageToUse * ratioToUse); + /// + /// Deals Calamity defense damage to a player. This is the direct function, for unusual sources of defense damage. + /// + /// The amount of defense damage to deal. + /// If true, deals exactly the specified defense damage, ignoring the standard ratios and Draedon's Heart.
+ /// Setting this to false is equivalent to considering the first parameter as standard incoming damage to the player.
+ /// Setting this to true bypasses the defense damage floor, and can thus inflict less defense damage than is typically allowed. + public void DealDefenseDamage(int incomingDamage, bool absolute = false) + { + // If absolute is specified, then ignore the ratio and always inflict EXACTLY THAT MUCH defense damage. + // This means it bypasses Draedon's Heart! + double ratioToUse = absolute ? 1D : defenseDamageRatio; + + // Intended amount of defense damage to take. Can round up, but can also be overwritten by the floor. + int defenseDamageTaken = (int)Math.Round(incomingDamage * ratioToUse); // There is a floor on defense damage based on difficulty; i.e. there is a minimum amount of defense damage from any hit that can deal defense damage. // This floor is only applied if bosses are alive, but is bypassed by the absolute flag. @@ -2801,10 +2793,16 @@ namespace CalamityMod.CalPlayer defenseDamageTaken = defenseDamageFloor; } - // - // The amount of defense damage taken is now final. - // - + // The amount of defense damage taken is now final. Apply it. + ApplyDefenseDamageInternal(defenseDamageTaken); + } + + // Actually applies defense damage. Cannot be called externally. + private void ApplyDefenseDamageInternal(int defenseDamage, bool showVisuals = true) + { + // Can be dynamically reduced by Adamantite set bonus and maybe other future effects. + int defenseDamageTaken = defenseDamage; + // Apply incoming defense damage to the Adamantite armor set bonus. if (AdamantiteSetDefenseBoost > 0) { @@ -2843,11 +2841,12 @@ namespace CalamityMod.CalPlayer // Reset the delay between iframes ending and defense damage recovery starting. defenseDamageDelayFrames = DefenseDamageRecoveryDelay; - // Audiovisual effects - ShowDefenseDamageEffects(defenseDamageTaken); + if (showVisuals) + ShowDefenseDamageEffects(defenseDamage); } - private void ShowDefenseDamageEffects(int defDamage) + // Displays visuals for taking defense damage. + private void ShowDefenseDamageEffects(int defenseDamage) { // Play a sound from taking defense damage. if (hurtSoundTimer == 0 && Main.myPlayer == Player.whoAmI) @@ -2857,7 +2856,7 @@ namespace CalamityMod.CalPlayer } // Display text indicating that defense damage was taken. - string text = (-defDamage).ToString(); + string text = (-defenseDamage).ToString(); Color messageColor = Color.LightGray; Rectangle location = new Rectangle((int)Player.position.X, (int)Player.position.Y - 16, Player.width, Player.height); CombatText.NewText(location, messageColor, Language.GetTextValue(text)); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3c2f363405..48d8118832 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3923,19 +3923,16 @@ namespace CalamityMod.CalPlayer // // Current defense damage can be calculated at any time using the accessor property CurrentDefenseDamage. // However, it CANNOT be written to. You can only set the total defense damage. - // CalamityPlayer has a function called DealDefenseDamage to handle everything for you, when dealing defense damage. + // CalamityPlayer has a function called DealDefenseDamage to handle everything for you when dealing defense damage. // // The player's current recovery through defense damage is tracked through two frame counts: // defenseDamageRecoveryFrames = How many more frames the player will still be recovering from defense damage // totalDefenseDamageRecoveryFrames = The total timer for defense damage recovery that the player is undergoing // - // Defense damage heals over a fixed time (CalamityPlayer.DefenseDamageRecoveryTime). - // This is independent of how much defense the player started with, or how much they lost. - // If hit again while recovering from defense damage, that fixed time is ADDED to the current recovery timer - // (in addition to the player taking more defense damage, of course). + // Defense damage does not heal during iframes, and has a delay after they end before it starts recovering. if (totalDefenseDamage > 0) { - // Used to cleanse all defense damage by accessories + // If a Full Cleanse is in effect, then cleanse all defense damage and don't do anything else. if (CleansingEffect == 1) { totalDefenseDamage = 0; @@ -3944,53 +3941,53 @@ namespace CalamityMod.CalPlayer defenseDamageDelayFrames = 0; CleansingEffect = 0; } - - // Defense damage is capped at your maximum defense, no matter what. - if (totalDefenseDamage > Player.statDefense) - totalDefenseDamage = Player.statDefense; - - // You cannot begin recovering from defense damage until your iframes wear off. - bool hasIFrames = false; - for (int i = 0; i < Player.hurtCooldowns.Length; i++) - if (Player.hurtCooldowns[i] > 0) - hasIFrames = true; - - // Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all. - if (!hasIFrames && defenseDamageDelayFrames > 0) - --defenseDamageDelayFrames; - - // Once the delay is up, defense damage recovery occurs. - else if (defenseDamageDelayFrames <= 0) + else { - // Make one frame's worth of progress towards recovery. - --defenseDamageRecoveryFrames; + // Defense damage is capped at your maximum defense, except in GFB. + if (!Main.getGoodWorld && totalDefenseDamage > Player.statDefense) + totalDefenseDamage = Player.statDefense; - // If completely recovered, reset defense damage to nothing. - if (defenseDamageRecoveryFrames <= 0) + // You cannot begin recovering from defense damage until your iframes wear off. + if (!Player.HasIFrames()) { - totalDefenseDamage = 0; - defenseDamageRecoveryFrames = 0; - totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; - defenseDamageDelayFrames = 0; + // Delay before defense damage recovery can start. While this delay is ticking down, defense damage doesn't recover at all. + if (defenseDamageDelayFrames > 0) + --defenseDamageDelayFrames; + + // Once the delay is up, defense damage recovery actually occurs. + else if (defenseDamageDelayFrames <= 0) + { + // Make one frame's worth of progress towards recovery. + --defenseDamageRecoveryFrames; + + // If completely recovered, reset defense damage to nothing. + if (defenseDamageRecoveryFrames <= 0) + { + totalDefenseDamage = 0; + defenseDamageRecoveryFrames = 0; + totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; + defenseDamageDelayFrames = 0; + } + } } + + // Get current amount of defense damage to apply this frame. + int currentDefenseDamage = CurrentDefenseDamage; + + // Apply DR Damage. + // + // DR Damage is applied at exactly the same ratio as defense damage; + // if you lose half your defense to defense damage, you also lose half your DR. + // This is applied first because the math would be wrong if the player's defense was already reduced by defense damage. + if (Player.statDefense > 0 && Player.endurance > 0f) + { + float drDamageRatio = currentDefenseDamage / (float)Player.statDefense; + Player.endurance *= 1f - drDamageRatio; + } + + // Apply defense damage + Player.statDefense -= currentDefenseDamage; } - - // Get current amount of defense damage to apply this frame. - int currentDefenseDamage = CurrentDefenseDamage; - - // Apply DR Damage. - // - // DR Damage is applied at exactly the same ratio as defense damage; - // if you lose half your defense to defense damage, you also lose half your DR. - // This is applied first because the math would be wrong if the player's defense was already reduced by defense damage. - if (Player.statDefense > 0 && Player.endurance > 0f) - { - float drDamageRatio = currentDefenseDamage / (float)Player.statDefense; - Player.endurance *= 1f - drDamageRatio; - } - - // Apply defense damage - Player.statDefense -= currentDefenseDamage; } // Defense can never be reduced below zero, no matter what diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 7c24ac6e90..34e0de9d2c 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -401,6 +401,25 @@ namespace CalamityMod #endregion #region Immunity Frames + /// + /// Checks whether the player has any kind of immunity frames (or "iframes" for short) available. + /// + /// The player whose immunity frames should be checked. + /// Whether or not they are currently in any immunity frames. + public static bool HasIFrames(this Player player) + { + // Check old school iframes first (aka "cooldown timer -1". Regular hits, falling damage, etc.) + if (player.immune || player.immuneTime > 0) + return true; + + // Check more particular iframes. This primarily comes from traps, lava, and bosses. + for (int i = 0; i < player.hurtCooldowns.Length; i++) + if (player.hurtCooldowns[i] > 0) + return true; + + return false; + } + /// /// Gives the player the specified number of immunity frames (or "iframes" for short).
If the player already has more iframes than you want to give them, this function does nothing. ///
@@ -421,6 +440,7 @@ namespace CalamityMod return false; // Apply iframes thoroughly. + // Player.AddImmuneTime does exist, but is equivalent to the below code. player.immune = true; player.immuneNoBlink = !blink; player.immuneTime = frames; From 7cf68f9fd53fd03e8b9e9d541098b78a6e2e8714 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 18:44:57 -0500 Subject: [PATCH 09/29] DR damage is now uncapped in GFB (to match defense damage). --- CalPlayer/CalamityPlayerHitHurt.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0c4f70b058..801fd143a7 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -862,15 +862,16 @@ namespace CalamityMod.CalPlayer contactDamageReduction *= (double)Crumbling.MultiplicativeDamageReductionPlayer; // Contact damage reduction is reduced by DR Damage, which itself is proportional to defense damage + // In GFB, as defense damage is uncapped, DR damage is also uncapped. int currentDefense = Player.GetCurrentDefense(false); if (totalDefenseDamage > 0 && currentDefense > 0) { double drDamageRatio = CurrentDefenseDamage / (double)currentDefense; - if (drDamageRatio > 1D) + if (!Main.getGoodWorld && drDamageRatio > 1D) drDamageRatio = 1D; contactDamageReduction *= 1D - drDamageRatio; - if (contactDamageReduction < 0D) + if (!Main.getGoodWorld && contactDamageReduction < 0D) contactDamageReduction = 0D; } From 366b1e433845493d73c66ecdb4977efedaf73dda Mon Sep 17 00:00:00 2001 From: mochi-angel Date: Thu, 7 Dec 2023 16:16:26 -0800 Subject: [PATCH 10/29] On hit effect nerfs --- CalPlayer/CalamityPlayerHitHurt.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 8e5f9d77f2..121b48d726 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -2503,7 +2503,7 @@ namespace CalamityMod.CalPlayer if (hurtInfo.Damage > 0) { SoundEngine.PlaySound(SoundID.Item74, Player.Center); - int eDamage = (int)Player.GetBestClassDamage().ApplyTo(300); + int eDamage = (int)Player.GetBestClassDamage().ApplyTo(230); if (oldFashioned) eDamage = CalamityUtils.CalcOldFashionedDamage(eDamage); @@ -2521,7 +2521,7 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int sDamage = (int)Player.GetTotalDamage().ApplyTo(90); + int sDamage = (int)Player.GetTotalDamage().ApplyTo(60); if (oldFashioned) sDamage = CalamityUtils.CalcOldFashionedDamage(sDamage); From bc6a04035ba0644d70dc902787292d7e9079a3fd Mon Sep 17 00:00:00 2001 From: Xyk Date: Thu, 7 Dec 2023 16:59:23 -0800 Subject: [PATCH 11/29] Ram visuals and Murasama sound volume reduction Asguardian Aegis and Elysian Aegis ram visuals Murasma sounds lowered in volume --- CalPlayer/Dashes/AsgardianAegisDash.cs | 15 ++++++ CalPlayer/Dashes/AsgardsValorDash.cs | 1 + CalPlayer/Dashes/ElysianAegisDash.cs | 52 ++++++++++++-------- Items/Weapons/Melee/Murasama.cs | 8 +-- Projectiles/Typeless/CosmicDashExplosion.cs | 14 +++--- Projectiles/Typeless/HolyExplosionSupreme.cs | 40 ++++++--------- 6 files changed, 73 insertions(+), 57 deletions(-) diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index 4132e70827..c76ea21fc7 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -18,12 +19,14 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; public int Time = 0; + public bool PostHit = false; public override float CalculateDashSpeed(Player player) => 23.3f; public override void OnDashEffects(Player player) { Time = 0; + PostHit = false; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) @@ -54,6 +57,18 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (!PostHit) + { + player.Calamity().GeneralScreenShakePower = 5f; + PostHit = true; + } + + Particle pulse = new DirectionalPulseRing(npc.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), 0, 0.1f, 0.85f, 36); + GeneralParticleHandler.SpawnParticle(pulse); + + Particle explosion2 = new DetailedExplosion(npc.Center, Vector2.Zero, Color.Magenta, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.65f, 26); + GeneralParticleHandler.SpawnParticle(explosion2); + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index a81b4e1b91..b57cf2bfc6 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 1910bad531..aec4617b7e 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -2,12 +2,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Enums; using CalamityMod.Items.Accessories; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; using Terraria.ModLoader; +using static Humanizer.In; namespace CalamityMod.CalPlayer.Dashes { @@ -18,44 +20,52 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; - + public bool PostHit = false; public override float CalculateDashSpeed(Player player) => 21.5f; public override void OnDashEffects(Player player) { - // Spawn fire dust around the player's body. - for (int d = 0; d < 20; d++) - { - Dust holyFireDashDust = Dust.NewDustDirect(player.position, player.width, player.height, 246, 0f, 0f, 100, default, 3f); - holyFireDashDust.position += Main.rand.NextVector2Square(-5f, 5f); - holyFireDashDust.velocity *= 0.2f; - holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - holyFireDashDust.noGravity = true; - holyFireDashDust.fadeIn = 0.5f; - } + PostHit = false; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { - // Spawn fire dust around the player's body. for (int d = 0; d < 4; d++) { - Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, 246, 0f, 0f, 100, default, 2.75f); - holyFireDashDust.velocity *= 0.1f; - holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - holyFireDashDust.noGravity = true; - if (Main.rand.NextBool()) - holyFireDashDust.fadeIn = 0.5f; - } + Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 222 : 162, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); + hFlameDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + hFlameDust.noGravity = hFlameDust.type == 222 ? false : true; + hFlameDust.fadeIn = 0.5f; + if (hFlameDust.type == 222) + { + hFlameDust.scale = Main.rand.NextFloat(0.8f, 1.2f); + hFlameDust.velocity += new Vector2(0, -2.5f) * Main.rand.NextFloat(0.8f, 1.2f); + } + if (hFlameDust.type == 180) + hFlameDust.scale = Main.rand.NextFloat(1.6f, 2.2f); + Dust dust = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Circular(6, 6) - player.velocity * 2, 228); + dust.velocity = -player.velocity * Main.rand.NextFloat(0.6f, 1.4f); + dust.scale = Main.rand.NextFloat(0.9f, 1.4f); + dust.noGravity = true; + } // Dash at a faster speed than the default value. dashSpeed = 14f; } public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (!PostHit) + { + player.Calamity().GeneralScreenShakePower = 3.5f; + PostHit = true; + } + float particleScale = Main.rand.NextFloat(0.45f, 0.55f); + Particle explosion = new DetailedExplosion(npc.Center, Vector2.Zero, Color.Gray * 0.6f, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, particleScale + 0.07f, 20, false); + GeneralParticleHandler.SpawnParticle(explosion); + Particle explosion2 = new DetailedExplosion(npc.Center, Vector2.Zero, Color.Orange, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, particleScale, 20); + GeneralParticleHandler.SpawnParticle(explosion2); + // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 53991bb63b..e8c4078173 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Weapons.Melee public int frame = 0; public bool IDUnlocked(Player player) => DownedBossSystem.downedDoG; - public static readonly SoundStyle OrganicHit = new("CalamityMod/Sounds/Item/MurasamaHitOrganic") { Volume = 0.6f }; - public static readonly SoundStyle InorganicHit = new("CalamityMod/Sounds/Item/MurasamaHitInorganic") { Volume = 0.65f }; - public static readonly SoundStyle Swing = new("CalamityMod/Sounds/Item/MurasamaSwing") { Volume = 0.3f }; - public static readonly SoundStyle BigSwing = new("CalamityMod/Sounds/Item/MurasamaBigSwing") { Volume = 0.35f }; + public static readonly SoundStyle OrganicHit = new("CalamityMod/Sounds/Item/MurasamaHitOrganic") { Volume = 0.45f }; + public static readonly SoundStyle InorganicHit = new("CalamityMod/Sounds/Item/MurasamaHitInorganic") { Volume = 0.55f }; + public static readonly SoundStyle Swing = new("CalamityMod/Sounds/Item/MurasamaSwing") { Volume = 0.2f }; + public static readonly SoundStyle BigSwing = new("CalamityMod/Sounds/Item/MurasamaBigSwing") { Volume = 0.25f }; public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(2, 13)); diff --git a/Projectiles/Typeless/CosmicDashExplosion.cs b/Projectiles/Typeless/CosmicDashExplosion.cs index 758b6264ac..e7d6fd240d 100644 --- a/Projectiles/Typeless/CosmicDashExplosion.cs +++ b/Projectiles/Typeless/CosmicDashExplosion.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Typeless public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak1") { Volume = 0.3f }; public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 60; + Projectile.width = 140; + Projectile.height = 140; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -34,17 +34,17 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.position); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 60; - Projectile.height = 60; + Projectile.width = 140; + Projectile.height = 140; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 24; i++) + for (int i = 0; i < 35; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, 181, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, 181, new Vector2(4.5f, 4.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); dust.noGravity = true; } - for (int j = 0; j < 13; j++) + for (int j = 0; j < 14; j++) { Vector2 dustVel = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index b14d9a72a5..fcd51060d5 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Typeless public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 60; + Projectile.width = 90; + Projectile.height = 90; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; @@ -28,36 +28,26 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + SoundStyle HitSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact") { Volume = 0.6f }; + SoundEngine.PlaySound(HitSound, Projectile.Center); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y + (float)(Projectile.height / 2); - Projectile.width = 60; - Projectile.height = 60; + Projectile.width = 90; + Projectile.height = 90; Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 24; i++) { - int holyDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[holyDust].velocity *= 3f; - if (Projectile.ai[0] == 1) - Main.dust[holyDust].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - if (Main.rand.NextBool()) - { - Main.dust[holyDust].scale = 0.5f; - Main.dust[holyDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } + Dust dust = Dust.NewDustPerfect(Projectile.Center, 228, new Vector2(4.5f, 4.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.9f), 0, default, Main.rand.NextFloat(1.5f, 2.8f)); + dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + dust.noGravity = true; } - for (int j = 0; j < 10; j++) + for (int j = 0; j < 12; j++) { - int holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 3f); - Main.dust[holyDust2].noGravity = true; - Main.dust[holyDust2].velocity *= 5f; - if (Projectile.ai[0] == 1) - Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); - holyDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 246, 0f, 0f, 100, default, 2f); - Main.dust[holyDust2].velocity *= 2f; - if (Projectile.ai[0] == 1) - Main.dust[holyDust2].shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); + Vector2 dustVel = new Vector2(6, 6).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); + + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel * 2, 259, dustVel, 0, default, 1f); + dust.shader = GameShaders.Armor.GetSecondaryShader(Owner.cShield, Owner); } } } From efc6b543911eade70429be918c0dbe370c45f201 Mon Sep 17 00:00:00 2001 From: Mishiro Usui Date: Fri, 8 Dec 2023 02:44:29 +0000 Subject: [PATCH 12/29] psc whip visual tweak --- Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index fd078bae10..bcd75839b9 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -1296,7 +1296,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.DefaultToWhip(); - Projectile.WhipSettings.Segments = 20; + Projectile.WhipSettings.Segments = 40; Projectile.WhipSettings.RangeMultiplier = 2.25f; } From 67828b93e1f2a23c451a808345f9db96cf990f3b Mon Sep 17 00:00:00 2001 From: Mishiro Usui Date: Fri, 8 Dec 2023 02:53:02 +0000 Subject: [PATCH 13/29] Oracle headphones drop boost adjustment --- NPCs/NormalNPCs/ShockstormShuttle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index ea56e034a8..4de7c16d88 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -414,7 +414,7 @@ namespace CalamityMod.NPCs.NormalNPCs npcLoot.AddIf(() => NPC.downedGolemBoss, ItemID.MartianConduitPlating, 1, 10, 30); npcLoot.Add(ModContent.ItemType(), 2); npcLoot.Add(ModContent.ItemType(), 10); - npcLoot.Add(ModContent.ItemType(), (DateTime.Now.Day == 25 && DateTime.Now.Month == 5) ? 9 : 20); + npcLoot.Add(ModContent.ItemType(), (DateTime.Now.Day == 21 && DateTime.Now.Month == 8) ? 9 : 20); var postML = npcLoot.DefineConditionalDropSet(() => NPC.downedMoonlord); postML.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 8, 12, 11, 16)); } From afac71aad6cf5cf35cf11be5fd741ca8bffa27ed Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 19:24:56 -0500 Subject: [PATCH 14/29] Added new lore heavy Rock tooltip --- Localization/en-US/Mods.CalamityMod.Items.Misc.hjson | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index ab7a52d2b5..c066cdb09a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -285,7 +285,14 @@ RelicOfConvergence: { Rock: { DisplayName: Rock - Tooltip: The first object Xeroc ever created + Tooltip: + ''' + When the battle was finally over, the dust having just began to settle + Where even the stone refused the course of time, there sat a monk + Who dared to question history and stare into fate + 'What is the true price of the past being ever eternal? + Why must our future forever haunt us?' + ''' } SulphurousSeaWorldSideChanger: { From fbe5373acf13399e16cd80523e0f16514ffa6413 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 19:26:30 -0500 Subject: [PATCH 15/29] Added all new and approved Xeroc BR dialogue (not yet implemented in code) --- .../en-US/Mods.CalamityMod.Events.hjson | 60 ++++++++++++++++--- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Events.hjson b/Localization/en-US/Mods.CalamityMod.Events.hjson index 587be559b1..349a1a0dec 100644 --- a/Localization/en-US/Mods.CalamityMod.Events.hjson +++ b/Localization/en-US/Mods.CalamityMod.Events.hjson @@ -2,11 +2,55 @@ AcidRain: Acid Rain AcidRainStart: A toxic downpour falls over the wasteland seas! AcidRainEnd: The sulphuric skies begin to clear... BossRush: Boss Rush -BossRushStartText: Ah, another contender. Very well, may the ritual commence! -BossRushTierOneEndText: Oh, you're still alive? Unexpected, but don't get complacent just yet. -BossRushTierTwoEndText: Persistent, aren't you? Perhaps you have some hope of prosperity, unlike past challengers. -BossRushTierThreeEndText: Your perseverance is truly a trait to behold. You've come further than even the demigods in a short time. -BossRushTierThreeEndText2: May your skills remain sharp for the last challenges. -BossRushTierFourEndText: So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods. -BossRushTierFourEndText2: Go forth and conquer until the ritual's end! -BossRushTierFiveEndText: Hmm? What, you expected a reward beyond this mere pebble? Patience, the true reward will come apparent in time... +// Boss Rush Xeroc Dialogue +// Intro text +BossRushStartText_1: ...How long has it been? Centuries? Perhaps even a millenia? +BossRushStartText_2: I sank this artifact of mine to the deepest depths of the world to prevent it from being used ever again. +BossRushStartText_3: Few are aware of its existence, and those who are? +BossRushStartText_4: They know that the boundless power it was once able to provide can no longer be taken advantage of. +BossRushStartText_5: It is a surprise to see there is another who is courageous enough to have retrieved it, particularly given these circumstances. +BossRushStartText_6: A mortal this time, no less! How interesting... +BossRushStartText_7: What exactly is it that made you go out of your way to claim what is now nothing more than a decaying stone tablet? +BossRushStartText_8: ...Perhaps this is an opportunity. Claiming this relic is no small feat, and I have caught brief glimpses of your journey. +BossRushStartText_9: You, who claimed this artifact that ended an era on your quest to end another... +// Extra text based on defeated bosses +// You should see all of these if you are at the right progression point for Boss Rush +BossRushStartText_DoG: Who slew the nameless serpent... +BossRushStartText_Yharon: Who bested even my old friend, the Phoenix... +BossRushStartText_DraedonSCal: Whose power may match the only mortal who has ever made me doubt my own... +// Further intro text +BossRushStartText_10: I wish to test your strength, using fragments of my Primordial Light taking the form of your past foes. +BossRushStartText_11: It will be no easy task, yet should you prove yourself strong enough, I will have a proposal for you. +BossRushStartText_12: Do you believe yourself capable of conquering such a challenge? +// Shortened intro text for repeat attempts +BossRushStartText_Repeat: Do you wish to face my challenge? +// Player responses. Death is if you somehow die while Xeroc is waiting +BossRushStartText_Decline: I see. Perhaps my faith in you was mistaken. Farewell. +BossRushStartText_Accept: Very well. Let the trial commence! +BossRushStartText_Death: ...Did I truly return for this, of all things? +// Sequential text at the end of Boss Rush Tier 1 +BossRushTierOneEndText_1: A passable display so far, but not nearly enough to meet my expectations. +BossRushTierOneEndText_2: Prepare both your body and soul for what has yet to come. +// Sequential text at the end of Boss Rush Tier 2 +BossRushTierTwoEndText_1: I wasn't mistaken. You are indeed an admirable warrior. +BossRushTierTwoEndText_2: Still, you haven't shown me enough. Shall we escalate things further? +// Sequential text at the end of Boss Rush Tier 3 +BossRushTierThreeEndText_1: Your determination and will to grow stronger... It reminds me of myself, when I was mortal. +BossRushTierThreeEndText_2: But the hardest challenges still await. Do not let your guard down, even for a moment. +// Sequential text at the end of Boss Rush Tier 4 +BossRushTierFourEndText_1: The trial will soon reach its climax. +BossRushTierFourEndText_2: Now is the time to display your conviction, and the true extent of your strength and will. +BossRushTierFourEndText_3: Prove to me that you are capable of surpassing even yourself. +// Victory text +BossRushEndText_1: A truly excellent display. I see that I was correct! You indeed may be this world's mightiest warrior. However... +BossRushEndText_2: It seems as though even that power... it is not enough. I'm afraid I will not be sharing my proposal with you. +BossRushEndText_3: Though, as a consolation prize, I wish for you to take this ancient stone carved from the Aerie. +BossRushEndText_4: I have long held it as a... keepsake, of sorts. +BossRushEndText_5: Though you may have failed to meet my requirements, it is unlikely that this will be the only time our paths cross! +BossRushEndText_6: Continue to seek greater strength, and when we meet again, perhaps you will have grown enough in power to be worthy. +BossRushEndText_7: In the meantime, I have my own matters that I must attend to. +BossRushEndText_8: Farewell, for now. +// Shortened victory text for repeat attempts +BossRushEndText_Repeat: You have proven yourself to be a formidable warrior, yet it is not enough. Seek new heights of power, so that you may one day be worthy. +// Dying during Xeroc's victory monologue gives you this +BossRushEndText_Death: ...I suppose that I was correct in assuming that this world cannot help itself, much less me. From ac8575e2f575eea7f278671f91280c8ba9010f2b Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 22:08:31 -0500 Subject: [PATCH 16/29] Implement all new Xeroc Boss Rush dialogue. Now adding delays. --- Enums/BossRushDialoguePhase.cs | 16 ++ Events/BossRushEvent.cs | 41 ++-- Items/SummonItems/Terminus.cs | 14 +- Projectiles/Typeless/BossRushEffectThing.cs | 9 +- Projectiles/Typeless/TerminusHoldout.cs | 1 - Systems/BossRushDialogueSystem.cs | 197 ++++++++++++++++++++ 6 files changed, 251 insertions(+), 27 deletions(-) create mode 100644 Enums/BossRushDialoguePhase.cs create mode 100644 Systems/BossRushDialogueSystem.cs diff --git a/Enums/BossRushDialoguePhase.cs b/Enums/BossRushDialoguePhase.cs new file mode 100644 index 0000000000..043e760215 --- /dev/null +++ b/Enums/BossRushDialoguePhase.cs @@ -0,0 +1,16 @@ +namespace CalamityMod.Enums +{ + public enum BossRushDialoguePhase : short + { + None = -1, + Start = 0, + TierOneComplete = 1, + TierTwoComplete = 2, + TierThreeComplete = 3, + TierFourComplete = 4, + End = 5, + + StartRepeat = 6, + EndRepeat = 7, + } +} diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 9b420d00f5..c3cdb7d6a5 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -1,8 +1,10 @@ -using CalamityMod.Buffs.StatDebuffs; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.Enums; using CalamityMod.Items.SummonItems; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -17,8 +19,6 @@ using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.ExoMechs; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; -using ApolloBoss = CalamityMod.NPCs.ExoMechs.Apollo.Apollo; -using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; @@ -36,18 +36,17 @@ using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Skies; +using CalamityMod.Systems; using CalamityMod.UI.DraedonSummoning; -using CalamityMod.World; using Microsoft.Xna.Framework; -using System; -using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using ApolloBoss = CalamityMod.NPCs.ExoMechs.Apollo.Apollo; +using ArtemisBoss = CalamityMod.NPCs.ExoMechs.Artemis.Artemis; namespace CalamityMod.Events { @@ -95,7 +94,7 @@ namespace CalamityMod.Events } } - internal static IEntitySource Source => new EntitySource_WorldEvent(); + internal static IEntitySource Source => new EntitySource_WorldEvent("CalamityMod_BossRush"); public static int HostileProjectileKillCounter; public static bool BossRushActive = false; // Whether Boss Rush is active or not. @@ -108,7 +107,7 @@ namespace CalamityMod.Events public static int StartTimer; public static int EndTimer; public static float WhiteDimness; - public static readonly Color XerocTextColor = Color.LightCoral; + public static readonly Color XerocTextColor = new(250, 213, 77); // #FAD54D public const int StartEffectTotalTime = 120; public const int EndVisualEffectTime = 340; public static int ClosestPlayerToWorldCenter => Player.FindClosest(new Vector2(Main.maxTilesX, Main.maxTilesY) * 16f * 0.5f, 1, 1); @@ -402,10 +401,11 @@ namespace CalamityMod.Events BossDeathEffects = new Dictionary>() { + // Wall of Flesh: End of Tier 1 [NPCID.WallofFlesh] = npc => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierOneEndText", XerocTextColor); // "Hmm? Oh, you're still alive. Unexpected, but don't get complacent just yet." CreateTierAnimation(2); + BossRushDialogueSystem.StartDialogue(BossRushDialoguePhase.TierOneComplete); // Teleport players to where they came from for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) @@ -423,25 +423,32 @@ namespace CalamityMod.Events } } }, + // Plantera: End of Tier 2 [NPCID.Plantera] = npc => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierTwoEndText", XerocTextColor); // "Hmm? Persistent aren't you? Perhaps you have some hope of prosperity, unlike past challengers." CreateTierAnimation(3); + BossRushDialogueSystem.StartDialogue(BossRushDialoguePhase.TierTwoComplete); }, + // Moon Lord: End of Tier 3 [NPCID.MoonLordCore] = npc => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierThreeEndText", XerocTextColor); // "Hmm? Your perseverance is truly a trait to behold. You've come further than even the demigods in a short time." CreateTierAnimation(4); + BossRushDialogueSystem.StartDialogue(BossRushDialoguePhase.TierThreeComplete); }, + // Devourer of Gods: End of Tier 4 [ModContent.NPCType()] = npc => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierFourEndText", XerocTextColor); // "Hmm? So you've made it to the final tier, a remarkable feat enviable by even the mightiest of the gods." CreateTierAnimation(5); + BossRushDialogueSystem.StartDialogue(BossRushDialoguePhase.TierFourComplete); }, + // Supreme Calamitas: Ends Boss Rush (also delete all hostile projectiles to be safe) [ModContent.NPCType()] = npc => { CalamityUtils.KillAllHostileProjectiles(); HostileProjectileKillCounter = 3; + + // Display short dialogue if BR has been beaten before. + BossRushDialogueSystem.StartDialogue(DownedBossSystem.downedBossRush ? BossRushDialoguePhase.EndRepeat : BossRushDialoguePhase.End); } }; } @@ -510,6 +517,9 @@ namespace CalamityMod.Events if (!BossRushActive) return; + // Handle dialogue as appropriate. + BossRushDialogueSystem.Tick(); + // Disable the stupid credits sequence. if (CreditsRollEvent.IsEventOngoing) CreditsRollEvent.SetRemainingTimeDirect(1); @@ -555,6 +565,7 @@ namespace CalamityMod.Events return; } + // Projectile deletion, preventing Credits and ML from spawning naturally, and dialogue. MiscUpdateEffects(); // Do boss rush countdown and shit if no boss is alive. diff --git a/Items/SummonItems/Terminus.cs b/Items/SummonItems/Terminus.cs index 48a69855c9..5b1248c360 100644 --- a/Items/SummonItems/Terminus.cs +++ b/Items/SummonItems/Terminus.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Typeless; -using CalamityMod.World; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -58,10 +56,10 @@ namespace CalamityMod.Items.SummonItems return true; } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - // The wiki classifies Boss Rush as an event - itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + // The wiki classifies Boss Rush as an event + itemGroup = ContentSamples.CreativeHelper.ItemGroup.EventItem; + } } } diff --git a/Projectiles/Typeless/BossRushEffectThing.cs b/Projectiles/Typeless/BossRushEffectThing.cs index ef55aedaca..b91fdc6cfc 100644 --- a/Projectiles/Typeless/BossRushEffectThing.cs +++ b/Projectiles/Typeless/BossRushEffectThing.cs @@ -1,5 +1,7 @@ -using CalamityMod.Events; +using CalamityMod.Enums; +using CalamityMod.Events; using CalamityMod.NPCs.ExoMechs; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Events; @@ -61,8 +63,9 @@ namespace CalamityMod.Projectiles.Typeless BossRushEvent.BossRushStage = 0; BossRushEvent.BossRushActive = true; - string key = "Mods.CalamityMod.Events.BossRushStartText"; // "Hmm? Ah, another contender. Very well, may the ritual commence!" - CalamityUtils.DisplayLocalizedText(key, BossRushEvent.XerocTextColor); + + // Play startup dialogue + BossRushDialogueSystem.StartDialogue(DownedBossSystem.downedBossRush ? BossRushDialoguePhase.StartRepeat : BossRushDialoguePhase.Start); CalamityNetcode.SyncWorld(); if (Main.netMode == NetmodeID.Server) diff --git a/Projectiles/Typeless/TerminusHoldout.cs b/Projectiles/Typeless/TerminusHoldout.cs index 06bba85be1..ec89caa8ee 100644 --- a/Projectiles/Typeless/TerminusHoldout.cs +++ b/Projectiles/Typeless/TerminusHoldout.cs @@ -1,7 +1,6 @@ using System; using CalamityMod.Events; using CalamityMod.Items.SummonItems; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Utilities; diff --git a/Systems/BossRushDialogueSystem.cs b/Systems/BossRushDialogueSystem.cs new file mode 100644 index 0000000000..7e0a50ad58 --- /dev/null +++ b/Systems/BossRushDialogueSystem.cs @@ -0,0 +1,197 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Enums; +using CalamityMod.Events; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class BossRushDialogueSystem : ModSystem + { + public static BossRushDialoguePhase Phase = BossRushDialoguePhase.None; + private static BossRushDialogueEvent[] currentSequence = null; + private static int currentSequenceIndex = 0; + + public static int CurrentDialogueDelay = 0; + + internal struct BossRushDialogueEvent + { + private const int DefaultFrameDelay = 180; + + internal int FrameDelay; + internal string LocalizationKey; + internal Func skipCondition; + + public BossRushDialogueEvent() { } + public BossRushDialogueEvent(string key) + { + LocalizationKey = key; + FrameDelay = DefaultFrameDelay; + skipCondition = null; + } + public BossRushDialogueEvent(string key, int delay = DefaultFrameDelay, Func skipFunc = null) + { + LocalizationKey = key; + FrameDelay = delay; + skipCondition = skipFunc; + } + + public readonly bool ShouldDisplay() + { + if (skipCondition is null) + return true; + return !skipCondition.Invoke(); + } + } + + internal static Dictionary BossRushDialogue; + + public override void Load() + { + // Dialogue that occurs the first time you start Boss Rush + BossRushDialogueEvent[] startDialogues = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushStartText_1"), + new("Mods.CalamityMod.Events.BossRushStartText_2"), + new("Mods.CalamityMod.Events.BossRushStartText_3"), + new("Mods.CalamityMod.Events.BossRushStartText_4"), + new("Mods.CalamityMod.Events.BossRushStartText_5"), + new("Mods.CalamityMod.Events.BossRushStartText_6"), + new("Mods.CalamityMod.Events.BossRushStartText_7"), + new("Mods.CalamityMod.Events.BossRushStartText_8"), + new("Mods.CalamityMod.Events.BossRushStartText_9"), + new("Mods.CalamityMod.Events.BossRushStartText_DoG", skipFunc: () => !DownedBossSystem.downedDoG), + new("Mods.CalamityMod.Events.BossRushStartText_Yharon", skipFunc: () => !DownedBossSystem.downedYharon), + new("Mods.CalamityMod.Events.BossRushStartText_DraedonSCal", skipFunc: () => !DownedBossSystem.downedExoMechs || !DownedBossSystem.downedCalamitas), + new("Mods.CalamityMod.Events.BossRushStartText_10"), + new("Mods.CalamityMod.Events.BossRushStartText_11"), + new("Mods.CalamityMod.Events.BossRushStartText_12"), + }; + + // Dialogue that occurs when starting Boss Rush on repeat attempts + BossRushDialogueEvent[] startDialoguesShort = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushStartText_Repeat"), + }; + + // Dialogue that occurs when beating Tier 1 of Boss Rush + BossRushDialogueEvent[] tierOneDialogues = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushTierOneEndText_1"), + new("Mods.CalamityMod.Events.BossRushTierOneEndText_2"), + }; + + // Dialogue that occurs when beating Tier 2 of Boss Rush + BossRushDialogueEvent[] tierTwoDialogues = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushTierTwoEndText_1"), + new("Mods.CalamityMod.Events.BossRushTierTwoEndText_2"), + }; + + // Dialogue that occurs when beating Tier 3 of Boss Rush + BossRushDialogueEvent[] tierThreeDialogues = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushTierThreeEndText_1"), + new("Mods.CalamityMod.Events.BossRushTierThreeEndText_2"), + }; + + // Dialogue that occurs when beating Tier 4 of Boss Rush + BossRushDialogueEvent[] tierFourDialogues = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushTierFourEndText_1"), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_2"), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_3"), + }; + + // Dialogue that occurs the first time you beat Boss Rush + BossRushDialogueEvent[] endDialogues = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushEndText_1"), + new("Mods.CalamityMod.Events.BossRushEndText_2"), + new("Mods.CalamityMod.Events.BossRushEndText_3"), + new("Mods.CalamityMod.Events.BossRushEndText_4"), + new("Mods.CalamityMod.Events.BossRushEndText_5"), + new("Mods.CalamityMod.Events.BossRushEndText_6"), + new("Mods.CalamityMod.Events.BossRushEndText_7"), + new("Mods.CalamityMod.Events.BossRushEndText_8"), + }; + + // Dialogue that occurs the first time you beat Boss Rush + BossRushDialogueEvent[] endDialoguesShort = new BossRushDialogueEvent[] + { + new("Mods.CalamityMod.Events.BossRushEndText_Repeat"), + }; + + BossRushDialogue = new Dictionary() + { + { BossRushDialoguePhase.Start, startDialogues }, + { BossRushDialoguePhase.StartRepeat, startDialoguesShort }, + { BossRushDialoguePhase.TierOneComplete, tierOneDialogues }, + { BossRushDialoguePhase.TierTwoComplete, tierTwoDialogues }, + { BossRushDialoguePhase.TierThreeComplete, tierThreeDialogues }, + { BossRushDialoguePhase.TierFourComplete, tierFourDialogues }, + { BossRushDialoguePhase.End, endDialogues }, + { BossRushDialoguePhase.EndRepeat, endDialoguesShort }, + }; + } + + public override void Unload() + { + BossRushDialogue = null; + } + + public static void StartDialogue(BossRushDialoguePhase phaseToRun) + { + Phase = phaseToRun; + bool validDialogueFound = BossRushDialogue.TryGetValue(Phase, out var dialogueListToUse); + if (validDialogueFound) + { + currentSequence = dialogueListToUse; + currentSequenceIndex = 0; + } + + CurrentDialogueDelay = 4; + } + + internal static void Tick() + { + // If the phase isn't defined properly, don't do anything. + if (Phase == BossRushDialoguePhase.None) + return; + + if (currentSequenceIndex < currentSequence.Length) + { + // If it's time to display dialogue, do so. + if (CurrentDialogueDelay == 0 && currentSequenceIndex < currentSequence.Length) + { + BossRushDialogueEvent line = currentSequence[currentSequenceIndex]; + CalamityUtils.DisplayLocalizedText(line.LocalizationKey, BossRushEvent.XerocTextColor); + CurrentDialogueDelay = line.FrameDelay; + + // Move onto the next dialogue line. + ++currentSequenceIndex; + } + // Otherwise, decrement the existing delay. + else + --CurrentDialogueDelay; + + // Ensure a boss does not attack the player while they are reading dialogue. + // Indefinitely stall the countdown. + if (BossRushEvent.BossRushSpawnCountdown < 180) + BossRushEvent.BossRushSpawnCountdown = CurrentDialogueDelay + 180; + } + + // If the end of a sequence has been reached, stay in this state indefinitely. + // Allow the boss spawn countdown to hit zero and the next boss to appear without showing any dialogue or causing any delays. + + // However, if Boss Rush is not occurring, reset all variables. + if (!BossRushEvent.BossRushActive) + { + Phase = BossRushDialoguePhase.None; + currentSequence = null; + currentSequenceIndex = 0; + CurrentDialogueDelay = 0; + } + } + } +} From 5ca9b1876c3930f970d980842068cbdc02e4421d Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 23:52:26 -0500 Subject: [PATCH 17/29] Minor correction to Aerie stone line by Cei --- Localization/en-US/Mods.CalamityMod.Events.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Events.hjson b/Localization/en-US/Mods.CalamityMod.Events.hjson index 349a1a0dec..e826775bc7 100644 --- a/Localization/en-US/Mods.CalamityMod.Events.hjson +++ b/Localization/en-US/Mods.CalamityMod.Events.hjson @@ -44,7 +44,7 @@ BossRushTierFourEndText_3: Prove to me that you are capable of surpassing even y // Victory text BossRushEndText_1: A truly excellent display. I see that I was correct! You indeed may be this world's mightiest warrior. However... BossRushEndText_2: It seems as though even that power... it is not enough. I'm afraid I will not be sharing my proposal with you. -BossRushEndText_3: Though, as a consolation prize, I wish for you to take this ancient stone carved from the Aerie. +BossRushEndText_3: Though, as a consolation prize, I wish for you to take this ancient stone I carved from the Aerie. BossRushEndText_4: I have long held it as a... keepsake, of sorts. BossRushEndText_5: Though you may have failed to meet my requirements, it is unlikely that this will be the only time our paths cross! BossRushEndText_6: Continue to seek greater strength, and when we meet again, perhaps you will have grown enough in power to be worthy. From f0d705cdc471dfc5beb92518cc46b0df8c405cac Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 23:53:00 -0500 Subject: [PATCH 18/29] 1 - Fix conditional BR dialogue not skipping. 2 - Add hand-timed delays to all of Xeroc's dialogue. 3 - Add Gotta Go Fast Mode, if you are impatient. --- Systems/BossRushDialogueSystem.cs | 120 ++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 39 deletions(-) diff --git a/Systems/BossRushDialogueSystem.cs b/Systems/BossRushDialogueSystem.cs index 7e0a50ad58..b1f3e62ebc 100644 --- a/Systems/BossRushDialogueSystem.cs +++ b/Systems/BossRushDialogueSystem.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Systems { public class BossRushDialogueSystem : ModSystem { + public static bool GottaGoFast = false; + public static int GottaGoFastSpeed = 5; + public static BossRushDialoguePhase Phase = BossRushDialoguePhase.None; private static BossRushDialogueEvent[] currentSequence = null; private static int currentSequenceIndex = 0; @@ -46,80 +49,85 @@ namespace CalamityMod.Systems internal static Dictionary BossRushDialogue; + public override void Load() { + // + // Dialogue times were timed by Ozzatron reading them aloud with a stopwatch. + // + // Dialogue that occurs the first time you start Boss Rush BossRushDialogueEvent[] startDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushStartText_1"), - new("Mods.CalamityMod.Events.BossRushStartText_2"), - new("Mods.CalamityMod.Events.BossRushStartText_3"), - new("Mods.CalamityMod.Events.BossRushStartText_4"), - new("Mods.CalamityMod.Events.BossRushStartText_5"), - new("Mods.CalamityMod.Events.BossRushStartText_6"), - new("Mods.CalamityMod.Events.BossRushStartText_7"), - new("Mods.CalamityMod.Events.BossRushStartText_8"), - new("Mods.CalamityMod.Events.BossRushStartText_9"), - new("Mods.CalamityMod.Events.BossRushStartText_DoG", skipFunc: () => !DownedBossSystem.downedDoG), - new("Mods.CalamityMod.Events.BossRushStartText_Yharon", skipFunc: () => !DownedBossSystem.downedYharon), - new("Mods.CalamityMod.Events.BossRushStartText_DraedonSCal", skipFunc: () => !DownedBossSystem.downedExoMechs || !DownedBossSystem.downedCalamitas), - new("Mods.CalamityMod.Events.BossRushStartText_10"), - new("Mods.CalamityMod.Events.BossRushStartText_11"), - new("Mods.CalamityMod.Events.BossRushStartText_12"), + new("Mods.CalamityMod.Events.BossRushStartText_1", 360), + new("Mods.CalamityMod.Events.BossRushStartText_2", 435), + new("Mods.CalamityMod.Events.BossRushStartText_3", 240), + new("Mods.CalamityMod.Events.BossRushStartText_4", 435), + new("Mods.CalamityMod.Events.BossRushStartText_5", 480), + new("Mods.CalamityMod.Events.BossRushStartText_6", 270), + new("Mods.CalamityMod.Events.BossRushStartText_7", 465), + new("Mods.CalamityMod.Events.BossRushStartText_8", 480), + new("Mods.CalamityMod.Events.BossRushStartText_9", 330), + new("Mods.CalamityMod.Events.BossRushStartText_DoG", 180, skipFunc: () => !DownedBossSystem.downedDoG), + new("Mods.CalamityMod.Events.BossRushStartText_Yharon", 240, skipFunc: () => !DownedBossSystem.downedYharon), + new("Mods.CalamityMod.Events.BossRushStartText_DraedonSCal", 315, skipFunc: () => !DownedBossSystem.downedExoMechs || !DownedBossSystem.downedCalamitas), + new("Mods.CalamityMod.Events.BossRushStartText_10", 420), + new("Mods.CalamityMod.Events.BossRushStartText_11", 420), + new("Mods.CalamityMod.Events.BossRushStartText_12", 270), }; // Dialogue that occurs when starting Boss Rush on repeat attempts BossRushDialogueEvent[] startDialoguesShort = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushStartText_Repeat"), + new("Mods.CalamityMod.Events.BossRushStartText_Repeat", 120), }; // Dialogue that occurs when beating Tier 1 of Boss Rush BossRushDialogueEvent[] tierOneDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierOneEndText_1"), - new("Mods.CalamityMod.Events.BossRushTierOneEndText_2"), + new("Mods.CalamityMod.Events.BossRushTierOneEndText_1", 360), + new("Mods.CalamityMod.Events.BossRushTierOneEndText_2", 255), }; // Dialogue that occurs when beating Tier 2 of Boss Rush BossRushDialogueEvent[] tierTwoDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierTwoEndText_1"), - new("Mods.CalamityMod.Events.BossRushTierTwoEndText_2"), + new("Mods.CalamityMod.Events.BossRushTierTwoEndText_1", 255), + new("Mods.CalamityMod.Events.BossRushTierTwoEndText_2", 300), }; // Dialogue that occurs when beating Tier 3 of Boss Rush BossRushDialogueEvent[] tierThreeDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierThreeEndText_1"), - new("Mods.CalamityMod.Events.BossRushTierThreeEndText_2"), + new("Mods.CalamityMod.Events.BossRushTierThreeEndText_1", 465), + new("Mods.CalamityMod.Events.BossRushTierThreeEndText_2", 330), }; // Dialogue that occurs when beating Tier 4 of Boss Rush BossRushDialogueEvent[] tierFourDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushTierFourEndText_1"), - new("Mods.CalamityMod.Events.BossRushTierFourEndText_2"), - new("Mods.CalamityMod.Events.BossRushTierFourEndText_3"), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_1", 165), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_2", 330), + new("Mods.CalamityMod.Events.BossRushTierFourEndText_3", 300), }; // Dialogue that occurs the first time you beat Boss Rush BossRushDialogueEvent[] endDialogues = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushEndText_1"), - new("Mods.CalamityMod.Events.BossRushEndText_2"), - new("Mods.CalamityMod.Events.BossRushEndText_3"), - new("Mods.CalamityMod.Events.BossRushEndText_4"), - new("Mods.CalamityMod.Events.BossRushEndText_5"), - new("Mods.CalamityMod.Events.BossRushEndText_6"), - new("Mods.CalamityMod.Events.BossRushEndText_7"), - new("Mods.CalamityMod.Events.BossRushEndText_8"), + new("Mods.CalamityMod.Events.BossRushEndText_1", 540), + new("Mods.CalamityMod.Events.BossRushEndText_2", 465), + new("Mods.CalamityMod.Events.BossRushEndText_3", 360), + new("Mods.CalamityMod.Events.BossRushEndText_4", 285), + new("Mods.CalamityMod.Events.BossRushEndText_5", 420), + new("Mods.CalamityMod.Events.BossRushEndText_6", 420), + new("Mods.CalamityMod.Events.BossRushEndText_7", 225), + new("Mods.CalamityMod.Events.BossRushEndText_8", 135), }; // Dialogue that occurs the first time you beat Boss Rush BossRushDialogueEvent[] endDialoguesShort = new BossRushDialogueEvent[] { - new("Mods.CalamityMod.Events.BossRushEndText_Repeat"), + new("Mods.CalamityMod.Events.BossRushEndText_Repeat", 510), }; BossRushDialogue = new Dictionary() @@ -164,12 +172,22 @@ namespace CalamityMod.Systems // If it's time to display dialogue, do so. if (CurrentDialogueDelay == 0 && currentSequenceIndex < currentSequence.Length) { - BossRushDialogueEvent line = currentSequence[currentSequenceIndex]; - CalamityUtils.DisplayLocalizedText(line.LocalizationKey, BossRushEvent.XerocTextColor); - CurrentDialogueDelay = line.FrameDelay; + // Skip over all lines that should be skipped to find the first one that should not be skipped. + bool hasMoreDialogue = GetNextUnskippedDialogue(currentSequence, currentSequenceIndex, out int currentIndex); + if (hasMoreDialogue) + { + BossRushDialogueEvent line = currentSequence[currentSequenceIndex]; - // Move onto the next dialogue line. - ++currentSequenceIndex; + // Display dialogue and set appropriate delay, if this dialogue shouldn't be skipped. + if (line.skipCondition is null || !line.skipCondition.Invoke()) + { + CalamityUtils.DisplayLocalizedText(line.LocalizationKey, BossRushEvent.XerocTextColor); + CurrentDialogueDelay = line.FrameDelay; + } + + // Move onto the next dialogue line. + currentSequenceIndex = currentIndex + 1; + } } // Otherwise, decrement the existing delay. else @@ -179,6 +197,10 @@ namespace CalamityMod.Systems // Indefinitely stall the countdown. if (BossRushEvent.BossRushSpawnCountdown < 180) BossRushEvent.BossRushSpawnCountdown = CurrentDialogueDelay + 180; + + // Gotta Go Fast Mode + if (GottaGoFast && CurrentDialogueDelay > GottaGoFastSpeed) + CurrentDialogueDelay = GottaGoFastSpeed; } // If the end of a sequence has been reached, stay in this state indefinitely. @@ -193,5 +215,25 @@ namespace CalamityMod.Systems CurrentDialogueDelay = 0; } } + + private static bool GetNextUnskippedDialogue(BossRushDialogueEvent[] sequence, int index, out int newIndex) + { + int tryIndex = index; + while(tryIndex < sequence.Length) + { + BossRushDialogueEvent lineToTry = currentSequence[tryIndex]; + if (lineToTry.skipCondition is not null && lineToTry.skipCondition.Invoke()) + { + ++tryIndex; + continue; + } + + newIndex = tryIndex; + return true; + } + + newIndex = -1; + return false; + } } } From 0869a528dcd4fe4aa3d0d922d2694e9e56e95031 Mon Sep 17 00:00:00 2001 From: Toasty <74939552+toasty599@users.noreply.github.com> Date: Mon, 4 Dec 2023 18:22:35 +0000 Subject: [PATCH 19/29] Renderer fixes (#12) * - Pull #3 requests. - Safety check for globals in miracle blight renderer to prevent MP crashes. * - Fixed load crash. - Fixed miracle blight effect getting very grainy when using the worldposition. - RealCos -> cos, as cos is now fixed in mojoshader. - Method rename for consistency. * Discard changes to Properties/launchSettings.json * Discard changes to NPCs/CalamityGlobalNPC.cs * Discard changes to NPCs/CalamityGlobalNPC.cs * Update CalamityGlobalNPC.cs * Update RendererManager.cs * - Rename for consistency. - Cached renderers are cleared when unloading. --------- Co-authored-by: tomat --- Effects/MiracleBlight.fx | 18 +-- Effects/MiracleBlight.xnb | Bin 3776 -> 3568 bytes Graphics/Drawers/HolyInfernoDrawer.cs | 77 ------------ Graphics/ManagedRenderTarget.cs | 7 ++ .../BaseRenderer.cs} | 40 +++---- .../DeerclopsShadowRenderer.cs} | 11 +- .../DrawerLayer.cs => Renderers/DrawLayer.cs} | 4 +- Graphics/Renderers/HolyInfernoRenderer.cs | 76 ++++++++++++ .../MiracleBlightRenderer.cs} | 13 ++- .../RendererManager.cs} | 110 +++++++----------- NPCs/CalamityGlobalNPC.cs | 6 +- Utilities/DrawingUtils.cs | 7 -- 12 files changed, 164 insertions(+), 205 deletions(-) delete mode 100644 Graphics/Drawers/HolyInfernoDrawer.cs rename Graphics/{Drawers/BaseDrawer.cs => Renderers/BaseRenderer.cs} (59%) rename Graphics/{Drawers/DeerclopsShadowDrawer.cs => Renderers/DeerclopsShadowRenderer.cs} (89%) rename Graphics/{Drawers/DrawerLayer.cs => Renderers/DrawLayer.cs} (61%) create mode 100644 Graphics/Renderers/HolyInfernoRenderer.cs rename Graphics/{Drawers/MiracleBlightDrawer.cs => Renderers/MiracleBlightRenderer.cs} (87%) rename Graphics/{Drawers/DrawerManager.cs => Renderers/RendererManager.cs} (54%) diff --git a/Effects/MiracleBlight.fx b/Effects/MiracleBlight.fx index 3f4e60c31f..d0a86785e9 100644 --- a/Effects/MiracleBlight.fx +++ b/Effects/MiracleBlight.fx @@ -14,16 +14,6 @@ float2 uImageSize0; float2 uImageSize1; float4 uShaderSpecificData; -// Cosine does not work in shaders in Terraria 1.4. It returns incredibly corrupted values and nobody is sure why. -// This reimplements cosine using trigonometric identities. -// -// Discovery of malfunctioning cosine attributed to ScalarVector from SLR: -// https://discord.com/channels/103110554649894912/445276626352209920/979928448300634175 -float realCos(float value) -{ - return sin(value + 1.57079); -} - // // Based on Devourer of Gods' death animation (by Dominic) // in turn, that was based on ExampleMod's cool death animation @@ -39,7 +29,7 @@ float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0 // Temporal drift to make the sprite slide through the noise texture float2 drift = float2(5 * sin(0.04165 * uTime), 1.1 * uTime); - float2 noiseMapTexCoords = coords + drift + uWorldPosition; + float2 noiseMapTexCoords = coords + drift; float4 noiseColor = tex2D(uImage1, noiseMapTexCoords); // Define thresholds for total pixel erasure and glowing lines. @@ -47,12 +37,12 @@ float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0 // Rapidly flickering sinewave produced by Desmos, loosely based on the Weierstrass function // (infinitely sharp vague sinewave, periodic, continuous everywhere but differentiable nowhere) // https://en.wikipedia.org/wiki/Weierstrass_function - float flickerOne = 0.05 * realCos(7 * uTime); - float flickerTwo = 0.06 * realCos(31 * uTime); + float flickerOne = 0.05 * cos(7 * uTime); + float flickerTwo = 0.06 * cos(31 * uTime); float flickerThree = 0.04 * sin(167 * uTime); float fullErasureThreshold = uOpacity + flickerOne + flickerTwo + flickerThree; float glowThreshold = fullErasureThreshold - 0.1; - + // If the noise over the erasure threshold, completely erase this pixel. if (noiseColor.r > fullErasureThreshold) { diff --git a/Effects/MiracleBlight.xnb b/Effects/MiracleBlight.xnb index 2f31eff42b75a840a53919af57ec387882f5b0ba..8364c8d05e45366741e9bfc6861ef80fd04f1a17 100644 GIT binary patch delta 824 zcmZuv&ubG=5T5t;N8V<4X}}&DZOkejgcQVsT1#cqMAT|g11+R@Xgs8N=phBNnZWxbg>GB;x6!-nEKMMKD zvD_fR&r(I4T$Gr?`ACl9eqwwwfrVHaOI*c9%oz_?`?IfK$=GwNFB7G!+k0+^-?{Gmt#4;rhqBG1&%PI$ ztL~fpg;S@ON3xImS1<3*uee=5!!8vk@+llM(l}%eF%759YfQ(Q$l#zQ@T++dg|T>$ zH)EkS-F6ALL=r92!54YE!I zYmsSC3ILjpckOcv^u6fC36JPHHT1F>^}a`a4+f70e_=Jk3>4D08w}d@9PKmc^QiZj z2r(xt=Ri0-pA!bsz*E8tks)|mkAWOY5pltRoGzr30sRiDG>|hcO(-P?0XG$34W{Zw au*U+8)a`3R(>CqPUEm<%!R0cH?% zn0Fa~MYcSf8~2iJgLT8@H0A)l_}o-sf_Aj)(W&9;oyyp?>fQ0l@#<|@Lbsv-q^zFB z2F>c9Lnk0VSQv`X%}|_fh+t-RJYAf+T2|0%nVQj&_c9oovHC7@OuSpfaVH9v%Ux08snVn4=cZo(!&TYUIE7Z zSiD@4{ov;cTY$sb!2l(jo3#B3^WrF6Q(LBzXB6o*7mQ1`-cG=_U*ll}H%D#|;^E4i utT5*@*W~=BtvGPG*DltfRObceJal7J+`kwBhhRn#?(Nh@O7EtQ1Mn9GvA*vB diff --git a/Graphics/Drawers/HolyInfernoDrawer.cs b/Graphics/Drawers/HolyInfernoDrawer.cs deleted file mode 100644 index 485db764bf..0000000000 --- a/Graphics/Drawers/HolyInfernoDrawer.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.NPCs; -using CalamityMod.NPCs.Providence; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using Rectangle = Microsoft.Xna.Framework.Rectangle; - -namespace CalamityMod.Graphics.Drawers -{ - public class HolyInfernoDrawer : BaseDrawer - { - #region Fields/Properties - - public override DrawerLayer Layer => DrawerLayer.BeforeTiles; - - public Providence Provi => (Main.npc[CalamityGlobalNPC.holyBoss].ModNPC as Providence); - - //Should only draw if not in the main menu, provi is active and the boolean for drawing the border is true. - public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.holyBoss != -1 && - Main.npc[CalamityGlobalNPC.holyBoss].active && Providence.shouldDrawInfernoBorder; - #endregion - - #region Methods - public override void DrawToTarget(SpriteBatch spriteBatch) - { - var npc = Main.npc[CalamityGlobalNPC.holyBoss]; - var borderDistance = Providence.borderRadius; - if (npc.HasValidTarget) - { - var target = Main.player[Main.myPlayer]; - var holyInfernoIntensity = target.Calamity().holyInfernoFadeIntensity; - var prov = Provi; - - //Begin drawing the inferno - var blackTile = TextureAssets.MagicPixel; - var diagonalNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise"); - var upwardPerlinNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Perlin"); - var upwardNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise"); - - var maxOpacity = 1f; - if (prov.Dying) - { - //Death animation timer ends at 345f. - maxOpacity = MathHelper.Lerp(1f, 0f, Utils.GetLerpValue(0f, 344f, prov.DeathAnimationTimer)); - } - - var shader = GameShaders.Misc["CalamityMod:HolyInfernoShader"].Shader; - shader.Parameters["colorMult"].SetValue(Main.dayTime ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour. - shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); - shader.Parameters["radius"].SetValue(borderDistance); - shader.Parameters["anchorPoint"].SetValue(npc.Center); - shader.Parameters["screenPosition"].SetValue(Main.screenPosition); - shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2()); - shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity); - shader.Parameters["playerPosition"].SetValue(target.Center); - shader.Parameters["maxOpacity"].SetValue(maxOpacity); - shader.Parameters["day"].SetValue(Main.dayTime); - - spriteBatch.GraphicsDevice.Textures[1] = diagonalNoise.Value; - spriteBatch.GraphicsDevice.Textures[2] = upwardNoise.Value; - spriteBatch.GraphicsDevice.Textures[3] = upwardPerlinNoise.Value; - - //Manual end begin for the sampler state - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, shader, Main.GameViewMatrix.TransformationMatrix); - Rectangle rekt = new(Main.screenWidth / 2, Main.screenHeight / 2, Main.screenWidth, Main.screenHeight); - spriteBatch.Draw(blackTile.Value, rekt, null, default, 0f, blackTile.Value.Size() * 0.5f, 0, 0f); - //Inferno drawing complete - spriteBatch.ExitShaderRegion(); - } - } - #endregion - } -} diff --git a/Graphics/ManagedRenderTarget.cs b/Graphics/ManagedRenderTarget.cs index 2a3fea5dfe..2d219019d3 100644 --- a/Graphics/ManagedRenderTarget.cs +++ b/Graphics/ManagedRenderTarget.cs @@ -77,6 +77,13 @@ namespace CalamityMod.Graphics RenderTargetManager.ManagedTargets.Add(this); } + /// + /// Sets the current render target to the provided one. + /// + /// The render target to swap to + /// The color to clear the screen with. Transparent by default + public void SwapTo(Color? flushColor = null) => Target.SwapTo(flushColor); + /// /// Automatically called by , do not call! /// diff --git a/Graphics/Drawers/BaseDrawer.cs b/Graphics/Renderers/BaseRenderer.cs similarity index 59% rename from Graphics/Drawers/BaseDrawer.cs rename to Graphics/Renderers/BaseRenderer.cs index 8448be5335..02822bf732 100644 --- a/Graphics/Drawers/BaseDrawer.cs +++ b/Graphics/Renderers/BaseRenderer.cs @@ -1,18 +1,20 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; -namespace CalamityMod.Graphics.Drawers +namespace CalamityMod.Graphics.Renderers { /// /// A class to handle drawing a visual effect to a rendertarget, then drawing the target to the screen at selected layer. /// - public abstract class BaseDrawer + public abstract class BaseRenderer : ModType { #region Fields/Properties /// /// The layer that the target should be drawn at. /// - public abstract DrawerLayer Layer { get; } + public abstract DrawLayer Layer { get; } /// /// Whether the target should draw and be drawn to this frame. @@ -30,27 +32,20 @@ namespace CalamityMod.Graphics.Drawers #endregion #region Methods - public void Load() + protected sealed override void Register() { - MainTarget = new(true, ManagedRenderTarget.CreateScreenSizedTarget); - OnLoad(); + ModTypeLookup.Register(this); + + if (RendererManager.Renderers.Contains(this)) + throw new Exception($"Renderer '{Name}' has already been registered!"); + + RendererManager.Renderers.Add(this); } - /// - /// Called on mod load. - /// - public virtual void OnLoad() - { - } + public sealed override void SetupContent() => SetStaticDefaults(); - /// - /// Called on mod unload. - /// - public virtual void OnUnload() - { - - } + public sealed override void SetStaticDefaults() => MainTarget = new(true, ManagedRenderTarget.CreateScreenSizedTarget); /// /// Draw whatever needed to the target here. @@ -62,10 +57,7 @@ namespace CalamityMod.Graphics.Drawers /// Draw the target here. By default, just draws the target. /// /// - public virtual void DrawTarget(SpriteBatch spriteBatch) - { - spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White); - } + public virtual void DrawTarget(SpriteBatch spriteBatch) => spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White); #endregion } } diff --git a/Graphics/Drawers/DeerclopsShadowDrawer.cs b/Graphics/Renderers/DeerclopsShadowRenderer.cs similarity index 89% rename from Graphics/Drawers/DeerclopsShadowDrawer.cs rename to Graphics/Renderers/DeerclopsShadowRenderer.cs index 2d11717f7f..9a68b630ff 100644 --- a/Graphics/Drawers/DeerclopsShadowDrawer.cs +++ b/Graphics/Renderers/DeerclopsShadowRenderer.cs @@ -4,17 +4,16 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; using Terraria.Graphics.Shaders; -using Rectangle = Microsoft.Xna.Framework.Rectangle; -namespace CalamityMod.Graphics.Drawers +namespace CalamityMod.Graphics.Renderers { - public class DeerclopsShadowDrawer : BaseDrawer + public class DeerclopsShadowRenderer : BaseRenderer { #region Fields/Properties - public override DrawerLayer Layer => DrawerLayer.AfterEverything; + public override DrawLayer Layer => DrawLayer.AfterEverything; - public NPC deerclops => Main.npc[NPC.deerclopsBoss]; + public static NPC Deerclops => Main.npc[NPC.deerclopsBoss]; //Should only draw if not in the main menu, deerclops is active or the border is fading post-death, //it's rev+ and the boolean for drawing the border is true. @@ -27,7 +26,7 @@ namespace CalamityMod.Graphics.Drawers bool shouldDraw; bool deerclopsInactive = false; if (NPC.deerclopsBoss >= 0 && NPC.deerclopsBoss.WithinBounds(Main.npc.Length)) - shouldDraw = true; + shouldDraw = Deerclops.HasValidTarget; else { shouldDraw = DeerclopsAI.borderScalar > 0f; diff --git a/Graphics/Drawers/DrawerLayer.cs b/Graphics/Renderers/DrawLayer.cs similarity index 61% rename from Graphics/Drawers/DrawerLayer.cs rename to Graphics/Renderers/DrawLayer.cs index 9b628f88c4..28c3fa88cb 100644 --- a/Graphics/Drawers/DrawerLayer.cs +++ b/Graphics/Renderers/DrawLayer.cs @@ -1,6 +1,6 @@ -namespace CalamityMod.Graphics.Drawers +namespace CalamityMod.Graphics.Renderers { - public enum DrawerLayer + public enum DrawLayer { AfterEverything, BeforeTiles, diff --git a/Graphics/Renderers/HolyInfernoRenderer.cs b/Graphics/Renderers/HolyInfernoRenderer.cs new file mode 100644 index 0000000000..f6fa8acb1c --- /dev/null +++ b/Graphics/Renderers/HolyInfernoRenderer.cs @@ -0,0 +1,76 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.Providence; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Graphics.Renderers +{ + public class HolyInfernoRenderer : BaseRenderer + { + #region Fields/Properties + + public override DrawLayer Layer => DrawLayer.BeforeTiles; + + public static Providence Provi => Main.npc[CalamityGlobalNPC.holyBoss].ModNPC as Providence; + + //Should only draw if not in the main menu, provi is active and the boolean for drawing the border is true. + public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.holyBoss != -1 && + Main.npc[CalamityGlobalNPC.holyBoss].active && Providence.shouldDrawInfernoBorder; + #endregion + + #region Methods + public override void DrawToTarget(SpriteBatch spriteBatch) + { + var npc = Main.npc[CalamityGlobalNPC.holyBoss]; + var borderDistance = Providence.borderRadius; + if (!npc.HasValidTarget) + return; + + var target = Main.player[Main.myPlayer]; + var holyInfernoIntensity = target.Calamity().holyInfernoFadeIntensity; + var prov = Provi; + + //Begin drawing the inferno + var blackTile = TextureAssets.MagicPixel; + var diagonalNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise"); + var upwardPerlinNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Perlin"); + var upwardNoise = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/MeltyNoise"); + + var maxOpacity = 1f; + if (prov.Dying) + { + //Death animation timer ends at 345f. + maxOpacity = MathHelper.Lerp(1f, 0f, Utils.GetLerpValue(0f, 344f, prov.DeathAnimationTimer)); + } + + var shader = GameShaders.Misc["CalamityMod:HolyInfernoShader"].Shader; + shader.Parameters["colorMult"].SetValue(Main.dayTime ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour. + shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + shader.Parameters["radius"].SetValue(borderDistance); + shader.Parameters["anchorPoint"].SetValue(npc.Center); + shader.Parameters["screenPosition"].SetValue(Main.screenPosition); + shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2()); + shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity); + shader.Parameters["playerPosition"].SetValue(target.Center); + shader.Parameters["maxOpacity"].SetValue(maxOpacity); + shader.Parameters["day"].SetValue(Main.dayTime); + + spriteBatch.GraphicsDevice.Textures[1] = diagonalNoise.Value; + spriteBatch.GraphicsDevice.Textures[2] = upwardNoise.Value; + spriteBatch.GraphicsDevice.Textures[3] = upwardPerlinNoise.Value; + + //Manual end begin for the sampler state + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, shader, Main.GameViewMatrix.TransformationMatrix); + Rectangle rekt = new(Main.screenWidth / 2, Main.screenHeight / 2, Main.screenWidth, Main.screenHeight); + spriteBatch.Draw(blackTile.Value, rekt, null, default, 0f, blackTile.Value.Size() * 0.5f, 0, 0f); + //Inferno drawing complete + spriteBatch.ExitShaderRegion(); + } + #endregion + } +} diff --git a/Graphics/Drawers/MiracleBlightDrawer.cs b/Graphics/Renderers/MiracleBlightRenderer.cs similarity index 87% rename from Graphics/Drawers/MiracleBlightDrawer.cs rename to Graphics/Renderers/MiracleBlightRenderer.cs index 1b4c936abe..feacede2bf 100644 --- a/Graphics/Drawers/MiracleBlightDrawer.cs +++ b/Graphics/Renderers/MiracleBlightRenderer.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs.Ares; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -7,9 +8,9 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Graphics.Drawers +namespace CalamityMod.Graphics.Renderers { - public class MiracleBlightDrawer : BaseDrawer + public class MiracleBlightRenderer : BaseRenderer { #region Fields/Properties /// @@ -41,7 +42,7 @@ namespace CalamityMod.Graphics.Drawers private set; } - public override DrawerLayer Layer => DrawerLayer.NPC; + public override DrawLayer Layer => DrawLayer.NPC; // Unsure whether its more performant to always draw, or to check if any NPC actually has the debuff. public override bool ShouldDraw => true; @@ -69,6 +70,11 @@ namespace CalamityMod.Graphics.Drawers // Draw every npc to a single target that should have the miracle blight visual. foreach (NPC npc in Main.npc) { + // I don't know why this isnt always the case in MP, but if the global npc cant be found then the effect cannot be applied anyway as it is impossible + // to tell if they have miracle blight. + if (!npc.TryGetGlobalNPC(out _)) + continue; + if (ValidToDraw(npc)) Main.instance.DrawNPC(npc.whoAmI, npc.behindTiles); } @@ -83,7 +89,6 @@ namespace CalamityMod.Graphics.Drawers MiscShaderData blightShader = GameShaders.Misc["CalamityMod:MiracleBlight"]; blightShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1); blightShader.UseOpacity(0.7f); - blightShader.Shader.Parameters["uWorldPosition"]?.SetValue(Main.screenPosition); blightShader.Apply(); Main.spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White); diff --git a/Graphics/Drawers/DrawerManager.cs b/Graphics/Renderers/RendererManager.cs similarity index 54% rename from Graphics/Drawers/DrawerManager.cs rename to Graphics/Renderers/RendererManager.cs index f97909a487..236580b370 100644 --- a/Graphics/Drawers/DrawerManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -1,23 +1,22 @@ using System; using System.Collections.Generic; using System.Linq; -using log4net.Util; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Graphics.Drawers +namespace CalamityMod.Graphics.Renderers { - public class DrawerManager : ModSystem + public class RendererManager : ModSystem { #region Fields/Properties - public static List Drawers + public static List Renderers { get; private set; - } + } = new(); #endregion #region Loading @@ -26,29 +25,15 @@ namespace CalamityMod.Graphics.Drawers if (Main.netMode == NetmodeID.Server) return; - Drawers = new(); - Main.QueueMainThreadAction(() => { // This hooks here, because doing it any sooner causes the screen position to be a frame behind. On_Main.CheckMonoliths += DrawToTargets; - On_Main.DrawNPCs += DrawNPCDrawers; - On_Main.DrawProjectiles += DrawProjectileDrawers; - On_Main.DrawPlayers_AfterProjectiles += DrawPlayerDrawers; - On_Main.DrawBackgroundBlackFill += DrawBeforeTileDrawers; - On_Main.DrawInfernoRings += DrawAfterEverythingDrawers; - - var drawerType = typeof(BaseDrawer); - - foreach (var type in Mod.Code.GetTypes()) - { - if (!type.IsAbstract && type.IsSubclassOf(drawerType)) - { - var drawer = Activator.CreateInstance(type) as BaseDrawer; - drawer.Load(); - Drawers.Add(drawer); - } - } + On_Main.DrawNPCs += DrawNPCRenderers; + On_Main.DrawProjectiles += DrawProjectileRenderers; + On_Main.DrawPlayers_AfterProjectiles += DrawPlayerRenderers; + On_Main.DrawBackgroundBlackFill += DrawBeforeTileRenderers; + On_Main.DrawInfernoRings += DrawAfterEverythingRenderers; }); } @@ -57,20 +42,18 @@ namespace CalamityMod.Graphics.Drawers if (Main.netMode == NetmodeID.Server) return; + // Clear the cached renderers, so they can be readded on mod loading when initialized. + Renderers.Clear(); + Main.QueueMainThreadAction(() => { // Supposed to be auto-unloaded, but considering TMods poor track record with actually doing this, manually unload them. On_Main.CheckMonoliths -= DrawToTargets; - On_Main.DrawNPCs -= DrawNPCDrawers; - On_Main.DrawProjectiles -= DrawProjectileDrawers; - On_Main.DrawPlayers_AfterProjectiles -= DrawPlayerDrawers; - On_Main.DrawBackgroundBlackFill -= DrawBeforeTileDrawers; - On_Main.DrawInfernoRings -= DrawAfterEverythingDrawers; - - foreach (var drawer in Drawers) - drawer.OnUnload(); - - Drawers = null; + On_Main.DrawNPCs -= DrawNPCRenderers; + On_Main.DrawProjectiles -= DrawProjectileRenderers; + On_Main.DrawPlayers_AfterProjectiles -= DrawPlayerRenderers; + On_Main.DrawBackgroundBlackFill -= DrawBeforeTileRenderers; + On_Main.DrawInfernoRings -= DrawAfterEverythingRenderers; }); } #endregion @@ -83,74 +66,75 @@ namespace CalamityMod.Graphics.Drawers if (Main.gameMenu) return; - foreach (var drawer in Drawers) + foreach (var renderer in Renderers) { - if (!drawer.ShouldDraw) + if (!renderer.ShouldDraw) continue; - drawer.MainTarget.SwapTo(Color.Transparent); + renderer.MainTarget.SwapTo(Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - drawer.DrawToTarget(Main.spriteBatch); + renderer.DrawToTarget(Main.spriteBatch); Main.spriteBatch.End(); } Main.instance.GraphicsDevice.SetRenderTarget(null); } - private void DrawNPCDrawers(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles) + private void DrawNPCRenderers(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles) { orig(self, behindTiles); if (behindTiles) return; - var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.NPC); + var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.NPC); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); - foreach (var drawer in drawers) - drawer.DrawTarget(Main.spriteBatch); + foreach (var renderer in renderers) + renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.ExitShaderRegion(); } - private void DrawProjectileDrawers(On_Main.orig_DrawProjectiles orig, Main self) + private void DrawProjectileRenderers(On_Main.orig_DrawProjectiles orig, Main self) { orig(self); - var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.Projectile); + var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Projectile); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); - foreach (var drawer in drawers) - drawer.DrawTarget(Main.spriteBatch); + foreach (var renderer in renderers) + renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); } - private void DrawPlayerDrawers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) + private void DrawPlayerRenderers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) { orig(self); - var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.Player); + var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Player); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); - foreach (var drawer in drawers) - drawer.DrawTarget(Main.spriteBatch); + foreach (var renderer in renderers) + renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); } - private void DrawBeforeTileDrawers(On_Main.orig_DrawBackgroundBlackFill orig, Main self) + private void DrawBeforeTileRenderers(On_Main.orig_DrawBackgroundBlackFill orig, Main self) { - var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.BeforeTiles); + var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.BeforeTiles); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); - foreach (var drawer in drawers) - drawer.DrawTarget(Main.spriteBatch); + + foreach (var renderer in renderers) + renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); @@ -158,29 +142,19 @@ namespace CalamityMod.Graphics.Drawers orig(self); } - private void DrawAfterEverythingDrawers(On_Main.orig_DrawInfernoRings orig, Main self) + private void DrawAfterEverythingRenderers(On_Main.orig_DrawInfernoRings orig, Main self) { - var drawers = Drawers.Where(drawer => drawer.ShouldDraw && drawer.Layer is DrawerLayer.AfterEverything); + var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.AfterEverything); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); - foreach (var drawer in drawers) - drawer.DrawTarget(Main.spriteBatch); + foreach (var renderer in renderers) + renderer.DrawTarget(Main.spriteBatch); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); orig(self); } #endregion - - #region Misc Methods - public static T GetDrawer() where T : BaseDrawer - { - if (!Drawers.Any()) - return null; - - return Drawers.First(drawer => drawer.GetType() == typeof(T)) as T; - } - #endregion } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9a9262749c..6a6b631511 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -11,7 +11,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.Events; -using CalamityMod.Graphics.Drawers; +using CalamityMod.Graphics.Renderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; @@ -5701,8 +5701,8 @@ namespace CalamityMod.NPCs VulnerabilityHexFireDrawer = null; // Only draw the NPC if told to by the miracle blight drawer. - if (MiracleBlightDrawer.ValidToDraw(npc)) - return MiracleBlightDrawer.ActuallyDoPreDraw; + if (MiracleBlightRenderer.ValidToDraw(npc)) + return MiracleBlightRenderer.ActuallyDoPreDraw; } // Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event. diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index becea0357c..7976065c70 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -860,13 +860,6 @@ namespace CalamityMod } } - /// - /// Sets the current render target to the provided one. - /// - /// The render target to swap to - /// The color to clear the screen with. Transparent by default - public static void SwapTo(this ManagedRenderTarget target, Color? flushColor = null) => SwapTo(target.Target, flushColor); - /// /// Sets the current render target to the provided one. /// From c9edee954a2e95602fc6194ebce3598619d2085e Mon Sep 17 00:00:00 2001 From: Toasty <74939552+toasty599@users.noreply.github.com> Date: Tue, 5 Dec 2023 20:50:59 +0000 Subject: [PATCH 20/29] Added an interface to allow for shader visuals to be dyed. (#14) - Added IDyeableShaderRenderer. - Moved the current 4 energy shields to use this interface. - Removed Sponge and Rover drive team coloring, and the assosiated tooltips as a result of the above. --- DataStructures/IDyeableShaderRenderer.cs | 39 +++ Graphics/Renderers/BaseRenderer.cs | 16 + .../DeerclopsShadowRenderer.cs | 4 +- .../DyeableShadersRenderer.cs | 180 +++++++++++ .../HolyInfernoRenderer.cs | 4 +- .../MiracleBlightRenderer.cs | 6 +- Graphics/Renderers/RendererManager.cs | 14 + ILEditing/ILChangesLoading.cs | 13 +- Items/Accessories/ProfanedSoulArtifact.cs | 282 ++++++++++-------- Items/Accessories/ProfanedSoulCrystal.cs | 42 ++- Items/Accessories/RoverDrive.cs | 103 +++---- Items/Accessories/TheSponge.cs | 93 ++---- Items/Armor/LunicCorps/LunicCorpsHelmet.cs | 43 ++- .../Mods.CalamityMod.Items.Accessories.hjson | 2 - NPCs/CalamityGlobalNPC.cs | 2 +- 15 files changed, 563 insertions(+), 280 deletions(-) create mode 100644 DataStructures/IDyeableShaderRenderer.cs rename Graphics/Renderers/{ => CalamityRenderers}/DeerclopsShadowRenderer.cs (96%) create mode 100644 Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs rename Graphics/Renderers/{ => CalamityRenderers}/HolyInfernoRenderer.cs (97%) rename Graphics/Renderers/{ => CalamityRenderers}/MiracleBlightRenderer.cs (95%) diff --git a/DataStructures/IDyeableShaderRenderer.cs b/DataStructures/IDyeableShaderRenderer.cs new file mode 100644 index 0000000000..bdae07c587 --- /dev/null +++ b/DataStructures/IDyeableShaderRenderer.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.DataStructures +{ + /// + /// Allows for custom shader drawing used by accessories or armor set bonuses to have dyes applied to them. + /// + public interface IDyeableShaderRenderer + { + #region Layer Constants + public const float RoverDriveDepth = 1f; + public const float HaloShieldDepth = 2f; + public const float ProfanedSoulShieldDepth = 3f; + public const float SpongeShieldDepth = 4f; + #endregion + + /// + /// The draw depth of the renderer. This is used to draw them in descending order; higher values are drawn first. + /// + public float RenderDepth { get; } + + /// + /// Whether this should draw this frame. + /// + public bool ShouldDrawDyeableShader { get; } + + // This exists for things such as the halo shield, where it uses this interface for layering, but shouldn't actually be dyed as its color is a reference. + /// + /// Whether the shader should have dyes applied. + /// + public bool ShaderIsDyeable => true; + + /// + /// Draw the visuals in here. + /// + /// + public void DrawDyeableShader(SpriteBatch spriteBatch); + } +} diff --git a/Graphics/Renderers/BaseRenderer.cs b/Graphics/Renderers/BaseRenderer.cs index 02822bf732..8cdfa0ae6d 100644 --- a/Graphics/Renderers/BaseRenderer.cs +++ b/Graphics/Renderers/BaseRenderer.cs @@ -47,6 +47,22 @@ namespace CalamityMod.Graphics.Renderers public sealed override void SetStaticDefaults() => MainTarget = new(true, ManagedRenderTarget.CreateScreenSizedTarget); + /// + /// Called from . + /// + public virtual void PreUpdate() + { + + } + + /// + /// Called from . + /// + public virtual void PostUpdate() + { + + } + /// /// Draw whatever needed to the target here. /// diff --git a/Graphics/Renderers/DeerclopsShadowRenderer.cs b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs similarity index 96% rename from Graphics/Renderers/DeerclopsShadowRenderer.cs rename to Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs index 9a68b630ff..06675a2b5e 100644 --- a/Graphics/Renderers/DeerclopsShadowRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs @@ -5,7 +5,7 @@ using Terraria; using Terraria.GameContent; using Terraria.Graphics.Shaders; -namespace CalamityMod.Graphics.Renderers +namespace CalamityMod.Graphics.Renderers.CalamityRenderers { public class DeerclopsShadowRenderer : BaseRenderer { @@ -24,7 +24,7 @@ namespace CalamityMod.Graphics.Renderers public override void DrawToTarget(SpriteBatch spriteBatch) { bool shouldDraw; - bool deerclopsInactive = false; + var deerclopsInactive = false; if (NPC.deerclopsBoss >= 0 && NPC.deerclopsBoss.WithinBounds(Main.npc.Length)) shouldDraw = Deerclops.HasValidTarget; else diff --git a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs new file mode 100644 index 0000000000..cef3849b1a --- /dev/null +++ b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; + +namespace CalamityMod.Graphics.Renderers.CalamityRenderers +{ + public class DyeableShadersRenderer : BaseRenderer + { + #region Fields/Properties + public static Dictionary Targets + { + get; + private set; + } + + public static Dictionary Dyes + { + get; + private set; + } + + private static List RenderersToDrawThisFrame; + + public override DrawLayer Layer => DrawLayer.Player; + + // This ignores MainTarget, and handles its own targets, so always call the draw methods. + public override bool ShouldDraw => true; + #endregion + + #region Loading + public override void Load() + { + if (Main.netMode == NetmodeID.Server) + return; + + Targets = new(); + Dyes = new(); + RenderersToDrawThisFrame = new(); + } + + public override void Unload() + { + if (Main.netMode == NetmodeID.Server) + return; + + Targets = null; + Dyes = null; + RenderersToDrawThisFrame = null; + } + #endregion + + #region Detour Stuff + internal static void FindDyesDetour(On_Player.orig_UpdateItemDye orig, Player self, bool isNotInVanitySlot, bool isSetToHidden, Item armorItem, Item dyeItem) + { + orig(self, isNotInVanitySlot, isSetToHidden, armorItem, dyeItem); + + if (armorItem.ModItem is not IDyeableShaderRenderer drawer) + return; + + // Store the dye in the slot. + Dyes[drawer] = GameShaders.Armor.GetShaderFromItemId(dyeItem.type); + } + + internal static void CheckVanityDetour(On_Player.orig_ApplyEquipVanity_Item orig, Player self, Item currentItem) + { + orig(self, currentItem); + CheckIfEquipIsValid(currentItem, false); + } + + internal static void CheckAccessoryDetour(On_Player.orig_ApplyEquipFunctional orig, Player self, Item currentItem, bool hideVisual) + { + orig(self, currentItem, hideVisual); + CheckIfEquipIsValid(currentItem, hideVisual); + } + + internal static void CheckArmorSetsDetour(On_Player.orig_UpdateArmorSets orig, Player self, int i) + { + orig(self, i); + + // Check each armor piece in the same manner as tMod. + // If the entire set is equipped, and it is a renderer, it will be marked as valid. + Item head = self.armor[0]; + Item body = self.armor[1]; + Item legs = self.armor[2]; + + if (head.ModItem != null && head.ModItem.IsArmorSet(head, body, legs) && head.ModItem is IDyeableShaderRenderer renderer) + MarkAsValid(renderer); + + + if (body.ModItem != null && body.ModItem.IsArmorSet(head, body, legs) && body.ModItem is IDyeableShaderRenderer renderer2) + MarkAsValid(renderer2); + + + if (legs.ModItem != null && legs.ModItem.IsArmorSet(head, body, legs) && legs.ModItem is IDyeableShaderRenderer renderer3) + MarkAsValid(renderer3); + } + + private static void CheckIfEquipIsValid(Item item, bool hideVisual) + { + // Difficulty mode checks. + if ((item.expertOnly && !Main.expertMode) || (item.masterOnly && !Main.masterMode)) + return; + + // Item exists, is visible and is a mod item checks. + if (item.IsAir || hideVisual || item.ModItem == null) + return; + + // Item uses the interface check. + if (item.ModItem is not IDyeableShaderRenderer dyeableShaderRenderer) + return; + + MarkAsValid(dyeableShaderRenderer); + } + + private static void MarkAsValid(IDyeableShaderRenderer renderer) + { + // If it doesn't have a dictonary entry, create one. + if (!Targets.ContainsKey(renderer)) + Main.QueueMainThreadAction(() => Targets[renderer] = new(true, ManagedRenderTarget.CreateScreenSizedTarget)); + + // Mark this item as drawable this frame. + RenderersToDrawThisFrame.AddWithCondition(renderer, renderer.ShouldDrawDyeableShader); + } + #endregion + + #region Updates/Drawing + // Clear the list at the beginning of each update, to ensure its only populated by correct ones. + public override void PreUpdate() => RenderersToDrawThisFrame.Clear(); + + public override void DrawToTarget(SpriteBatch spriteBatch) + { + // Leave if nothing to draw. + if (!RenderersToDrawThisFrame.Any()) + return; + + // Sort the list by draw order. + RenderersToDrawThisFrame = RenderersToDrawThisFrame.OrderByDescending(renderer => renderer.RenderDepth).ToList(); + + foreach (var renderer in RenderersToDrawThisFrame) + { + if (!Targets.TryGetValue(renderer, out var target)) + continue; + + // Swap to the assosiated target and call the interface method. + target.SwapTo(); + renderer.DrawDyeableShader(spriteBatch); + } + } + + public override void DrawTarget(SpriteBatch spriteBatch) + { + // Leave if nothing to draw. + if (!RenderersToDrawThisFrame.Any()) + return; + + foreach (var renderer in RenderersToDrawThisFrame) + { + if (!Targets.TryGetValue(renderer, out var target)) + continue; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer); + + // If it is dyeable, and a dye exists, apply it. This has null safety, as dyeShader can be null here. + if (renderer.ShaderIsDyeable && Dyes.TryGetValue(renderer, out var dyeShader)) + dyeShader?.Apply(null, new(target, Vector2.Zero, new Rectangle(0, 0, target.Width, target.Height), Color.White)); + + // Draw the assosiated target that has been drawn to. + spriteBatch.Draw(target, Vector2.Zero, Color.White with { A = 0 }); + } + } + #endregion + } +} diff --git a/Graphics/Renderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs similarity index 97% rename from Graphics/Renderers/HolyInfernoRenderer.cs rename to Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index f6fa8acb1c..79dd43ab77 100644 --- a/Graphics/Renderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -7,7 +7,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.Graphics.Renderers +namespace CalamityMod.Graphics.Renderers.CalamityRenderers { public class HolyInfernoRenderer : BaseRenderer { @@ -18,7 +18,7 @@ namespace CalamityMod.Graphics.Renderers public static Providence Provi => Main.npc[CalamityGlobalNPC.holyBoss].ModNPC as Providence; //Should only draw if not in the main menu, provi is active and the boolean for drawing the border is true. - public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.holyBoss != -1 && + public override bool ShouldDraw => !Main.gameMenu && CalamityGlobalNPC.holyBoss != -1 && Main.npc[CalamityGlobalNPC.holyBoss].active && Providence.shouldDrawInfernoBorder; #endregion diff --git a/Graphics/Renderers/MiracleBlightRenderer.cs b/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs similarity index 95% rename from Graphics/Renderers/MiracleBlightRenderer.cs rename to Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs index feacede2bf..e5e673b989 100644 --- a/Graphics/Renderers/MiracleBlightRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs @@ -8,7 +8,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Graphics.Renderers +namespace CalamityMod.Graphics.Renderers.CalamityRenderers { public class MiracleBlightRenderer : BaseRenderer { @@ -68,7 +68,7 @@ namespace CalamityMod.Graphics.Renderers ActuallyDoPreDraw = true; // Draw every npc to a single target that should have the miracle blight visual. - foreach (NPC npc in Main.npc) + foreach (var npc in Main.npc) { // I don't know why this isnt always the case in MP, but if the global npc cant be found then the effect cannot be applied anyway as it is impossible // to tell if they have miracle blight. @@ -86,7 +86,7 @@ namespace CalamityMod.Graphics.Renderers public override void DrawTarget(SpriteBatch spriteBatch) { // Apply the shader and draw the target. - MiscShaderData blightShader = GameShaders.Misc["CalamityMod:MiracleBlight"]; + var blightShader = GameShaders.Misc["CalamityMod:MiracleBlight"]; blightShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1); blightShader.UseOpacity(0.7f); blightShader.Apply(); diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index 236580b370..e617a1d838 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -58,6 +58,20 @@ namespace CalamityMod.Graphics.Renderers } #endregion + #region Updating + public override void PreUpdateEntities() + { + foreach (var renderer in Renderers) + renderer.PreUpdate(); + } + + public override void PostUpdateEverything() + { + foreach (var renderer in Renderers) + renderer.PostUpdate(); + } + #endregion + #region Drawing private void DrawToTargets(On_Main.orig_CheckMonoliths orig) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 6339908cbb..71d3c12511 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -1,5 +1,6 @@ using System; using System.Reflection; +using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Tiles.DraedonStructures; @@ -50,13 +51,11 @@ namespace CalamityMod.ILEditing On_TileDrawing.Draw += ClearTilePings; On_CommonCode.ModifyItemDropFromNPC += ColorBlightedGel; - // Graphics (Energy shields) - // ORDER MATTERS. Whichever hook is registered last will draw a shield first, blocking all other hooks - // Please order these hooks in the ordering priority you want energy shields to have - On_Main.DrawInfernoRings += RoverDrive.DrawRoverDriveShields; - On_Main.DrawInfernoRings += LunicCorpsHelmet.DrawHaloShields; - On_Main.DrawInfernoRings += ProfanedSoulArtifact.DrawProfanedSoulShields; //both psa and psc - On_Main.DrawInfernoRings += TheSponge.DrawSpongeShields; + // Graphics (dyeable shader stuff) + On_Player.UpdateItemDye += DyeableShadersRenderer.FindDyesDetour; + On_Player.ApplyEquipFunctional += DyeableShadersRenderer.CheckAccessoryDetour; + On_Player.ApplyEquipVanity_Item += DyeableShadersRenderer.CheckVanityDetour; + On_Player.UpdateArmorSets += DyeableShadersRenderer.CheckArmorSetsDetour; // NPC behavior IL_Main.UpdateTime += PermitNighttimeTownNPCSpawning; diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index 443a62a976..73435d4366 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -1,23 +1,24 @@ -using System; -using System.Linq; -using CalamityMod.CalPlayer; -using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; +using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Plates; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Items.Placeables.Plates; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; +using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Effects; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Items.Accessories.ProfanedSoulCrystal; namespace CalamityMod.Items.Accessories { - public class ProfanedSoulArtifact : ModItem, ILocalizedModType + public class ProfanedSoulArtifact : ModItem, ILocalizedModType, IDyeableShaderRenderer { public new string LocalizationCategory => "Items.Accessories"; public static Asset HeatTex; @@ -26,133 +27,41 @@ namespace CalamityMod.Items.Accessories public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(2); public static int ShieldDurabilityMax = 25; + + // Interface stuff. + public float RenderDepth => IDyeableShaderRenderer.ProfanedSoulShieldDepth; + + public bool ShouldDrawDyeableShader + { + get + { + bool result = false; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active || player.outOfRange || player.dead) + continue; + + CalamityPlayer modPlayer = player.Calamity(); + + // Do not render the shield if its visibility is off (or it does not exist) + bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; + bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: + bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; + bool shouldntDraw = !modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists; + result |= !shouldntDraw; + } + return result; + } + } + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; } - // Complex drawcode which draws Profaned Soul shields on ALL players who have it available. Supposedly. - // This is applied as IL (On hook) which draws right before Inferno Ring. - internal static void DrawProfanedSoulShields(On_Main.orig_DrawInfernoRings orig, Main mainObj) - { - // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). - // Profaned Soul shields will be drawn for each player with the Profaned Soul artifact/crystal, yes. - // But there is no guarantee that the shields will be in the right condition for each player. - // Visibility is not net synced, for example. - bool alreadyDrawnShieldForPlayer = false; - - for (int i = 0; i < Main.maxPlayers; i++) - { - Player player = Main.player[i]; - if (player is null || !player.active || player.outOfRange || player.dead) - continue; - - CalamityPlayer modPlayer = player.Calamity(); - - // Do not render the shield if its visibility is off (or it does not exist) - bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; - bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: - bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; - if (!modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists) - continue; - - // Scale the shield is drawn at. - // The "i" parameter is to make different player's shields not be perfectly synced. - float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); - - if (!alreadyDrawnShieldForPlayer) - { - CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity(); - DetermineTransformationEligibility(localModPlayer.Player); - var psState = (int)GetPscStateFor(localModPlayer.Player, localModPlayer.profanedCrystalAnim >= 0); - var psc = localModPlayer.profanedCrystalBuffs || (localModPlayer.profanedCrystalAnim >= 0 && psState >= (int)ProfanedSoulCrystalState.Buffs); - - scale += ((ProfanedSoulCrystalState)psState) == ProfanedSoulCrystalState.Empowered ? 0.05f : psc ? 0.025f : 0f; - if (localModPlayer.profanedCrystalAnim >= 0) - scale = MathHelper.Lerp(0f, scale, ((float)maxPscAnimTime - (float)localModPlayer.profanedCrystalAnim) / (float)maxPscAnimTime); //i don't like casting this many times, i'm not a fucking wizard - - float visualShieldStrength = 1f; - if (!isVanityOnly) - { - float max = psc ? ProfanedSoulCrystal.ShieldDurabilityMax : ShieldDurabilityMax; - float shieldDurabilityRatio = localModPlayer.pSoulShieldDurability / max; - visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); - } - - // The scale used for the noise overlay polygons also grows and shrinks - // This is intentionally out of sync with the shield, and intentionally desynced per player - // Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is. - float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); - - // Define shader parameters - Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; - shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay - shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); - shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); - shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); - - // Shield opacity multiplier slightly changes, this is independent of current shield strength - float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); - float minShieldStrengthOpacityMultiplier = 0.5f; - float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); - shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); - shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - - // Profaned Soul shields are not team specific - - Color shieldColor = GetColorForPsc(psState, Main.dayTime); - if (psState >= (int)(ProfanedSoulCrystalState.Buffs)) - { - bool tester = contributorNames.Any(name => name.Equals(localModPlayer.Player.name)); - shieldColor = tester ? CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25) * 0.8f, 6f) : - GetLerpedColorForPsc(modPlayer); - } - - Color primaryEdgeColor = new Color(230, 199, 102) * 0.8f; - Color secondaryEdgeColor = new Color(249, 231, 217) * 0.8f; - Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); - - // Define shader parameters for shield color - shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); - shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); - - // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS - // yes I copy pasted that comment, I hate end begin that much - // I also copy pasted that comment, this time for consistency :hdfailure: - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); - // Fetch shield heat overlay texture (this is the neutrons fed to the shader) - HeatTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2"); - Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; - Texture2D tex = HeatTex.Value; - Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); - - //The border circle MUST be drawn after otherwise it becomes visually fucked. - float shieldScale = scale * 1.75f; - Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; - Rectangle shieldFrame = shieldTexture.Frame(); - Vector2 origin = shieldFrame.Size() * 0.5f; - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); - Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); - } - - alreadyDrawnShieldForPlayer = true; - modPlayer.drawnAnyShieldThisFrame = true; - } - - if (alreadyDrawnShieldForPlayer) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); - } - - orig(mainObj); - } + public void DrawDyeableShader(SpriteBatch spriteBatch) => DrawProfanedSoulShields(); public override void SetDefaults() { @@ -190,5 +99,124 @@ namespace CalamityMod.Items.Accessories AddTile(TileID.DemonAltar). Register(); } + + // Complex drawcode which draws Profaned Soul shields on ALL players who have it available. Supposedly. + // This is applied as IL (On hook) which draws right before Inferno Ring. + internal static void DrawProfanedSoulShields() + { + // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). + // Profaned Soul shields will be drawn for each player with the Profaned Soul artifact/crystal, yes. + // But there is no guarantee that the shields will be in the right condition for each player. + // Visibility is not net synced, for example. + bool alreadyDrawnShieldForPlayer = false; + + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active || player.outOfRange || player.dead) + continue; + + CalamityPlayer modPlayer = player.Calamity(); + + // Do not render the shield if its visibility is off (or it does not exist) + bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; + bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: + bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; + if (!modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists) + continue; + + // Scale the shield is drawn at. + // The "i" parameter is to make different player's shields not be perfectly synced. + float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); + + if (!alreadyDrawnShieldForPlayer) + { + CalamityPlayer localModPlayer = Main.LocalPlayer.Calamity(); + DetermineTransformationEligibility(localModPlayer.Player); + var psState = (int)GetPscStateFor(localModPlayer.Player, localModPlayer.profanedCrystalAnim >= 0); + var psc = localModPlayer.profanedCrystalBuffs || (localModPlayer.profanedCrystalAnim >= 0 && psState >= (int)ProfanedSoulCrystalState.Buffs); + + scale += ((ProfanedSoulCrystalState)psState) == ProfanedSoulCrystalState.Empowered ? 0.05f : psc ? 0.025f : 0f; + if (localModPlayer.profanedCrystalAnim >= 0) + scale = MathHelper.Lerp(0f, scale, ((float)maxPscAnimTime - (float)localModPlayer.profanedCrystalAnim) / (float)maxPscAnimTime); //i don't like casting this many times, i'm not a fucking wizard + + float visualShieldStrength = 1f; + if (!isVanityOnly) + { + float max = psc ? ProfanedSoulCrystal.ShieldDurabilityMax : ShieldDurabilityMax; + float shieldDurabilityRatio = localModPlayer.pSoulShieldDurability / max; + visualShieldStrength = MathF.Pow(shieldDurabilityRatio, 0.5f); + } + + // The scale used for the noise overlay polygons also grows and shrinks + // This is intentionally out of sync with the shield, and intentionally desynced per player + // Don't put this anywhere less than 0.25f or higher than 1f. The higher it is, the denser / more zoomed out the noise overlay is. + float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); + + // Define shader parameters + Effect shieldEffect = Filters.Scene["CalamityMod:RoverDriveShield"].GetShader().Shader; + shieldEffect.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly * 0.058f); // Scrolling speed of polygonal overlay + shieldEffect.Parameters["blowUpPower"].SetValue(2.8f); + shieldEffect.Parameters["blowUpSize"].SetValue(0.4f); + shieldEffect.Parameters["noiseScale"].SetValue(noiseScale); + + // Shield opacity multiplier slightly changes, this is independent of current shield strength + float baseShieldOpacity = 0.9f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 1.95f); + float minShieldStrengthOpacityMultiplier = 0.5f; + float finalShieldOpacity = baseShieldOpacity * MathHelper.Lerp(minShieldStrengthOpacityMultiplier, 1f, visualShieldStrength); + shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); + shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); + + // Profaned Soul shields are not team specific + Color shieldColor = GetColorForPsc(psState, Main.dayTime); + if (psState >= (int)(ProfanedSoulCrystalState.Buffs)) + { + bool tester = contributorNames.Any(name => name.Equals(localModPlayer.Player.name)); + shieldColor = tester ? CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25) * 0.8f, 6f) : + GetLerpedColorForPsc(modPlayer); + } + + Color primaryEdgeColor = new Color(230, 199, 102) * 0.8f; + Color secondaryEdgeColor = new Color(249, 231, 217) * 0.8f; + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); + + // Define shader parameters for shield color + shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); + shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); + + // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS + // yes I copy pasted that comment, I hate end begin that much + // I also copy pasted that comment, this time for consistency :hdfailure: + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + // Fetch shield heat overlay texture (this is the neutrons fed to the shader) + HeatTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2"); + Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; + Texture2D tex = HeatTex.Value; + Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); + + //The border circle MUST be drawn after otherwise it becomes visually fucked. + float shieldScale = scale * 1.75f; + Texture2D shieldTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleOpenCircle").Value; + Rectangle shieldFrame = shieldTexture.Frame(); + Vector2 origin = shieldFrame.Size() * 0.5f; + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, shieldColor * 0.5f, player.fullRotation, origin, shieldScale, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(shieldTexture, pos, shieldFrame, secondaryEdgeColor * 0.5f, player.fullRotation, origin, shieldScale * 0.95f, SpriteEffects.None, 0f); + } + + alreadyDrawnShieldForPlayer = true; + modPlayer.drawnAnyShieldThisFrame = true; + } + + if (alreadyDrawnShieldForPlayer) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + } + } } } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 5b98d9f708..bde3eb0c38 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -1,25 +1,26 @@ -using System; -using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using System.Collections.Generic; using System.Linq; -using CalamityMod.Buffs.Summon.Whips; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.Potions.Alcohol; namespace CalamityMod.Items.Accessories { //Developer item, dedicatee: Mishiro Usui/Amber Sienna - public class ProfanedSoulCrystal : ModItem, ILocalizedModType + public class ProfanedSoulCrystal : ModItem, ILocalizedModType, IDyeableShaderRenderer { public static string[] contributorNames = new[] { "IbanPlay", "Chen", "Nincity", "Amber", "Mishiro", "LordMetarex", "Memes" }; public static int ShieldDurabilityMax = 125; @@ -31,6 +32,35 @@ namespace CalamityMod.Items.Accessories public const int maxMinionRequirement = 10; public const int maxPscAnimTime = 120; + // Interface stuff. + public float RenderDepth => IDyeableShaderRenderer.ProfanedSoulShieldDepth; + + public bool ShaderIsDyeable => false; + + public bool ShouldDrawDyeableShader + { + get + { + bool result = false; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active || player.outOfRange || player.dead) + continue; + + CalamityPlayer modPlayer = player.Calamity(); + + // Do not render the shield if its visibility is off (or it does not exist) + bool isVanityOnly = modPlayer.pSoulShieldVisible && !modPlayer.pSoulArtifact; + bool shouldNotDraw = modPlayer.andromedaState >= AndromedaPlayerState.LargeRobot; //I am not dealing with drawing that :taxevasion: + bool shieldExists = isVanityOnly || modPlayer.pSoulShieldDurability > 0; + bool shouldntDraw = !modPlayer.pSoulShieldVisible || modPlayer.drawnAnyShieldThisFrame || shouldNotDraw || !shieldExists; + result |= !shouldntDraw; + } + return result; + } + } + public enum ProfanedSoulCrystalState { Vanity, //pre scal/draedon or insufficient minion slots @@ -39,6 +69,8 @@ namespace CalamityMod.Items.Accessories Empowered //psc but no other minions, healer guardian functionality, inherits all other functionality (except vanity) and goes even further beyond, any remaining attack changes are here } + public void DrawDyeableShader(SpriteBatch spriteBatch) => ProfanedSoulArtifact.DrawProfanedSoulShields(); + internal static ProfanedSoulCrystalState GetPscStateFor(Player player, bool ignoreNoBuffs = false) { if (!player.Calamity().profanedCrystalBuffs && !ignoreNoBuffs) diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 50b8d9f733..cb944d74ce 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -1,9 +1,10 @@ -using System; -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; @@ -12,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class RoverDrive : ModItem, ILocalizedModType + public class RoverDrive : ModItem, ILocalizedModType, IDyeableShaderRenderer { public new string LocalizationCategory => "Items.Accessories"; @@ -27,6 +28,32 @@ namespace CalamityMod.Items.Accessories // While active, Rover Drive gives 10 defense public static int ShieldDefenseBoost = 10; + // Interface stuff. + public float RenderDepth => IDyeableShaderRenderer.RoverDriveDepth; + + public bool ShouldDrawDyeableShader + { + get + { + bool result = false; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active || player.outOfRange || player.dead) + continue; + + CalamityPlayer modPlayer = player.Calamity(); + + // Do not render the shield if its visibility is off (or it does not exist) + bool isVanityOnly = modPlayer.roverDriveShieldVisible && !modPlayer.roverDrive; + bool shieldExists = isVanityOnly || modPlayer.RoverDriveShieldDurability > 0; + bool shouldntDraw = (!modPlayer.roverDriveShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists); + result |= !shouldntDraw; + } + return result; + } + } + // Allows item to be extractinated and specifies custom behavior instead of copying an existing item public override void SetStaticDefaults() => ItemID.Sets.ExtractinatorMode[Item.type] = Item.type; @@ -69,7 +96,7 @@ namespace CalamityMod.Items.Accessories // Complex drawcode which draws Rover Drive shields on ALL players who have it available. Supposedly. // This is applied as IL (On hook) which draws right before Inferno Ring. - internal static void DrawRoverDriveShields(On_Main.orig_DrawInfernoRings orig, Main mainObj) + public void DrawDyeableShader(SpriteBatch spriteBatch) { // TODO -- Control flow analysis indicates that this hook is not stable. // Rover Drive shields will be drawn for each player with Rover Drive, yes. @@ -121,63 +148,21 @@ namespace CalamityMod.Items.Accessories shieldEffect.Parameters["shieldOpacity"].SetValue(baseShieldOpacity * (0.5f + 0.5f * shieldStrength)); shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - Color edgeColor; - Color shieldColor; - - // Outside of single player, the shield color is overridden if the player is on a team. - if (Main.netMode != NetmodeID.SinglePlayer && player.team != 0) - { - switch (Main.player[i].team) - { - // Red team - case 1: - shieldColor = new Color(178, 24, 31); - edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.Tomato, Color.Crimson, shieldColor); - break; - - // Green team - case 2: - shieldColor = new Color(194, 255, 67) * 0.7f; - edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.Chartreuse, Color.YellowGreen, new Color(194, 255, 67)); - break; - - // Blue team - case 3: - shieldColor = new Color(64, 207, 200); - edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.MediumSpringGreen, Color.DeepSkyBlue, new Color(64, 207, 200)); - break; - - // Yellow team - case 4: - shieldColor = new Color(176, 156, 45); - edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.Gold, Color.Coral, Color.LightGoldenrodYellow); - break; - - // Pink team or any other team - default: - shieldColor = new Color(173, 111, 221); - edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, Color.DeepPink, Color.MediumOrchid, Color.MediumPurple); - break; - } - } - - // Un-teamed / single player shield colors - else - { - Color blueTint = new Color(51, 102, 255); - Color cyanTint = new Color(71, 202, 255); - Color wulfGreen = new Color(194, 255, 67) * 0.8f; - edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen); - shieldColor = blueTint; - } + // Get the shield color. + Color blueTint = new Color(51, 102, 255); + Color cyanTint = new Color(71, 202, 255); + Color wulfGreen = new Color(194, 255, 67) * 0.8f; + Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, blueTint, cyanTint, wulfGreen); + Color shieldColor = blueTint; + // Define shader parameters for shield color shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3()); shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3()); // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); } @@ -188,16 +173,14 @@ namespace CalamityMod.Items.Accessories NoiseTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/TechyNoise"); Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; Texture2D tex = NoiseTex.Value; - Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); + spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); } if (alreadyDrawnShieldForPlayer) { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } - - orig(mainObj); } } } diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index d6d5e03a1f..0c105a0a3d 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -17,7 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [LegacyName("Sponge")] - public class TheSponge : ModItem, ILocalizedModType + public class TheSponge : ModItem, ILocalizedModType, IDyeableShaderRenderer { public new string LocalizationCategory => "Items.Accessories"; @@ -37,6 +38,31 @@ namespace CalamityMod.Items.Accessories public static int ShieldActiveDefense = 30; public static float ShieldActiveDamageReduction = 0.1f; + public float RenderDepth => IDyeableShaderRenderer.SpongeShieldDepth; + + public bool ShouldDrawDyeableShader + { + get + { + bool result = false; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active || player.outOfRange || player.dead) + continue; + + CalamityPlayer modPlayer = player.Calamity(); + + // Do not render the shield if its visibility is off (or it does not exist) + bool isVanityOnly = modPlayer.spongeShieldVisible && !modPlayer.sponge; + bool shieldExists = isVanityOnly || modPlayer.SpongeShieldDurability > 0; + bool shouldntDraw = !modPlayer.spongeShieldVisible || modPlayer.drawnAnyShieldThisFrame || !shieldExists; + result |= !shouldntDraw; + } + return result; + } + } + public override void SetStaticDefaults() { @@ -137,7 +163,7 @@ namespace CalamityMod.Items.Accessories // Complex drawcode which draws Sponge shields on ALL players who have it available. Supposedly. // This is applied as IL (On hook) which draws right before Inferno Ring. - internal static void DrawSpongeShields(On_Main.orig_DrawInfernoRings orig, Main mainObj) + public void DrawDyeableShader(SpriteBatch spriteBatch) { // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). // Sponge shields will be drawn for each player with the Sponge equipped, yes. @@ -198,64 +224,9 @@ namespace CalamityMod.Items.Accessories shieldEffect.Parameters["shieldOpacity"].SetValue(finalShieldOpacity); shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f); - Color shieldColor, primaryEdgeColor, secondaryEdgeColor; - - // Outside of single player, the shield color is overridden if the player is on a team. - if (Main.netMode != NetmodeID.SinglePlayer && player.team != 0) - { - switch (Main.player[i].team) - { - // Red team - case 1: - shieldColor = new Color(163, 25, 26); // #A3191A - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(196, 51, 31); // #C4331F - break; - - // Green team - case 2: - shieldColor = new Color(13, 143, 22); // #0D8F16 - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(30, 201, 62); // #1EC93E - break; - - // Blue team - case 3: - shieldColor = new Color(18, 57, 163); // #1239A3 - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(38, 110, 191); // #266EBF - break; - - // Yellow team - case 4: - shieldColor = new Color(194, 154, 10); // #C29A0A - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(230, 209, 25); // #E6D119 - break; - - // Pink team - case 5: - shieldColor = new Color(184, 22, 143); // #B8168F - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(220, 40, 213); // #DE28D5 - break; - - // Invalid team - default: - shieldColor = new Color(148, 162, 176); // #94A2B0 - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(193, 197, 201); // #C1C5C9 - break; - } - } - - // Un-teamed / single player shield colors - else - { - shieldColor = new Color(24, 156, 204); // #189CCC - primaryEdgeColor = shieldColor; - secondaryEdgeColor = new Color(34, 224, 227); // #22E0E3 - } + Color shieldColor = new Color(24, 156, 204); // #189CCC + Color primaryEdgeColor = shieldColor; + Color secondaryEdgeColor = new Color(34, 224, 227); // #22E0E3 // Final shield edge color, which lerps about Color edgeColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly * 0.2f, primaryEdgeColor, secondaryEdgeColor); @@ -285,8 +256,6 @@ namespace CalamityMod.Items.Accessories Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } - - orig(mainObj); } } } diff --git a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs index df3993d9be..58a4fa7c33 100644 --- a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs +++ b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,7 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.LunicCorps { [AutoloadEquip(EquipType.Head)] - public class LunicCorpsHelmet : ModItem, ILocalizedModType + public class LunicCorpsHelmet : ModItem, ILocalizedModType, IDyeableShaderRenderer { public new string LocalizationCategory => "Items.Armor.Hardmode"; @@ -30,6 +31,32 @@ namespace CalamityMod.Items.Armor.LunicCorps public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(5); public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(2); + // Interface stuff. + public float RenderDepth => IDyeableShaderRenderer.HaloShieldDepth; + + public bool ShaderIsDyeable => false; + + public bool ShouldDrawDyeableShader + { + get + { + bool result = false; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player player = Main.player[i]; + if (player is null || !player.active || player.outOfRange || player.dead) + continue; + + CalamityPlayer modPlayer = player.Calamity(); + + // Do not render shield if it does not exist + bool shouldntDraw = modPlayer.LunicCorpsShieldDurability <= 0 || modPlayer.drawnAnyShieldThisFrame; + result |= !shouldntDraw; + } + return result; + } + } + public override void SetDefaults() { Item.width = 18; @@ -77,7 +104,7 @@ namespace CalamityMod.Items.Armor.LunicCorps // Complex drawcode which draws Lunic Corps shields on ALL players who have it available. Supposedly. // This is applied as IL (On hook) which draws right before Inferno Ring. - internal static void DrawHaloShields(On_Main.orig_DrawInfernoRings orig, Main mainObj) + public void DrawDyeableShader(SpriteBatch spriteBatch) { // TODO -- Control flow analysis indicates that this hook is not stable (as it was copied from Rover Drive). // Lunic Corps shields will be drawn for each player with the Lunic Corps armor, yes. @@ -142,8 +169,8 @@ namespace CalamityMod.Items.Armor.LunicCorps // GOD I LOVE END BEGIN CAN THIS GAME PLEASE BE SWALLOWED BY THE FIRES OF HELL THANKS // yes I copy pasted that comment, I hate end begin that much - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix); } alreadyDrawnShieldForPlayer = true; @@ -153,16 +180,14 @@ namespace CalamityMod.Items.Armor.LunicCorps NoiseTex ??= ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/VoronoiShapes2"); Vector2 pos = player.MountedCenter + player.gfxOffY * Vector2.UnitY - Main.screenPosition; Texture2D tex = NoiseTex.Value; - Main.spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); + spriteBatch.Draw(tex, pos, null, Color.White, 0, tex.Size() / 2f, scale, 0, 0); } if (alreadyDrawnShieldForPlayer) { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } - - orig(mainObj); } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 8bf6ef20b0..fb59805eb5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1427,7 +1427,6 @@ RoverDrive: { The shield grants 10 defense while active After the shield is broken, it takes 10 seconds to charge back up Being hit again while recharging restarts the charge timer - The shield's color will change to match your team selection as needed Can also be scrapped at an extractinator ''' } @@ -1846,7 +1845,6 @@ TheSponge: { The barrier starts recharging 9 seconds after being hit Recharging from zero to full charge takes 6 seconds Being hit again while recharging restarts the charge timer - The barrier's color will change to match your team selection as needed ''' } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6a6b631511..3181e0645c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -11,7 +11,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.Events; -using CalamityMod.Graphics.Renderers; +using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; From a55f5462a22f06085b664846e54771f7746d4c6c Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 7 Dec 2023 23:59:05 -0500 Subject: [PATCH 21/29] Version bump to 2.0.3.008 --- build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.txt b/build.txt index 9a28e5bb24..cf7f77ec52 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.3.007 +version = 2.0.3.008 displayName = Calamity Mod homepage = https://discord.gg/calamity buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, .github\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes, Effects\Compiler\* From 8705a589ac3dfba9fd358300787f14618b2a22eb Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 Dec 2023 00:06:33 -0500 Subject: [PATCH 22/29] explicitly specify defaults in struct constructor --- Systems/BossRushDialogueSystem.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Systems/BossRushDialogueSystem.cs b/Systems/BossRushDialogueSystem.cs index b1f3e62ebc..1023d4b75e 100644 --- a/Systems/BossRushDialogueSystem.cs +++ b/Systems/BossRushDialogueSystem.cs @@ -25,7 +25,12 @@ namespace CalamityMod.Systems internal string LocalizationKey; internal Func skipCondition; - public BossRushDialogueEvent() { } + public BossRushDialogueEvent() + { + FrameDelay = DefaultFrameDelay; + LocalizationKey = null; + skipCondition = null; + } public BossRushDialogueEvent(string key) { LocalizationKey = key; From 1b9a6930ee375f5221a12e11db28aa6de9f53187 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 Dec 2023 00:42:17 -0500 Subject: [PATCH 23/29] Fix spurious old dialogue code hidden in boss spawn events --- Events/BossRushEvent.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index c3cdb7d6a5..888d86b742 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -294,7 +294,6 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierThreeEndText2", XerocTextColor); // "May your skills remain sharp for the last challenges." NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -371,7 +370,6 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), spawnContext: type => { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierFourEndText2", XerocTextColor); // "Go forth and conquer 'til the ritual's end!" Player player = Main.player[ClosestPlayerToWorldCenter]; SoundEngine.PlaySound(Yharon.FireSound, player.Center); From 7c870a8e96ed8c3ecd83d88481abaeefcd8b9bdc Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 Dec 2023 00:44:39 -0500 Subject: [PATCH 24/29] why does a projectile's onkill spawn dialogue --- .../Typeless/BossRushEndEffectThing.cs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index b2b7c75a08..fdb981ba22 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -45,19 +45,18 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { BossRushEvent.End(); - for (int i = Main.maxPlayers - 1; i >= 0; i--) - { - Player p = Main.player[i]; - if (p is null || !p.active) - continue; - int rock = Item.NewItem(p.GetSource_Misc("CalamityMod_BossRushRock"), (int)p.position.X, (int)p.position.Y, p.width, p.height, ModContent.ItemType()); - if (Main.netMode == NetmodeID.Server) - { - Main.timeItemSlotCannotBeReusedFor[rock] = 54000; - NetMessage.SendData(MessageID.InstancedItem, i, -1, null, rock); - } - } - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Events.BossRushTierFiveEndText", BossRushEvent.XerocTextColor); // "Hmm? You expected a reward beyond this mere pebble? Patience, the true reward will come apparent in time..." + for (int i = Main.maxPlayers - 1; i >= 0; i--) + { + Player p = Main.player[i]; + if (p is null || !p.active) + continue; + int rock = Item.NewItem(p.GetSource_Misc("CalamityMod_BossRushRock"), (int)p.position.X, (int)p.position.Y, p.width, p.height, ModContent.ItemType()); + if (Main.netMode == NetmodeID.Server) + { + Main.timeItemSlotCannotBeReusedFor[rock] = 54000; + NetMessage.SendData(MessageID.InstancedItem, i, -1, null, rock); + } + } } } } From 572b00b2196f4b8803a5a8a42e72d42d17b5ce3a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 8 Dec 2023 10:08:17 -0500 Subject: [PATCH 25/29] Shroomer rebalance --- Items/Weapons/Ranged/Shroomer.cs | 4 ++-- Projectiles/Ranged/Shroom.cs | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index a88e0e277e..3da3e50fb8 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.width = 90; Item.height = 28; - Item.useTime = 27; - Item.useAnimation = 27; + Item.useTime = 35; + Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.75f; diff --git a/Projectiles/Ranged/Shroom.cs b/Projectiles/Ranged/Shroom.cs index 9aa0ef1880..7952c103f4 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,8 +22,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 80; Projectile.penetrate = 2; Projectile.tileCollide = false; - Projectile.timeLeft = 120; + Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; + Projectile.extraUpdates = 1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -33,11 +36,6 @@ namespace CalamityMod.Projectiles.Ranged CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 20f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 5; - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2); From a101937ad66048a9560b6280abf730230f4097b7 Mon Sep 17 00:00:00 2001 From: Mishiro Usui Date: Fri, 8 Dec 2023 17:57:47 +0000 Subject: [PATCH 26/29] Fixed npcs/projectiles not spawning in mp --- Graphics/Renderers/RendererManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index e617a1d838..4844fd81cb 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -61,12 +61,18 @@ namespace CalamityMod.Graphics.Renderers #region Updating public override void PreUpdateEntities() { + if (Main.netMode is NetmodeID.Server) + return; + foreach (var renderer in Renderers) renderer.PreUpdate(); } public override void PostUpdateEverything() { + if (Main.netMode is NetmodeID.Server) + return; + foreach (var renderer in Renderers) renderer.PostUpdate(); } From 209fdfc3c49b1bc9c56a00e69efe7de08566976c Mon Sep 17 00:00:00 2001 From: Mishiro Usui Date: Fri, 8 Dec 2023 17:58:07 +0000 Subject: [PATCH 27/29] Fixed an instant mp error with an IL edit --- ILEditing/MechanicILChanges.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 7e2d9aeb95..79ce1e920d 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -298,8 +298,8 @@ namespace CalamityMod.ILEditing self.velocity = Collision.AdvancedTileCollision(TileID.Sets.ForAdvancedCollision.ForSandshark, cPosition, self.velocity, cWidth, cHeight, fall, fall, 1); return; } - - if (self.active && self.Calamity().ShouldFallThroughPlatforms) + var isNpcValid = self.TryGetGlobalNPC(out CalamityGlobalNPC npc); //why the fuck this errors is anybody's guess, it absolutely shouldn't and yet it does + if (isNpcValid && self.active && npc.ShouldFallThroughPlatforms) fall = true; orig(self, fall, cPosition, cWidth, cHeight); From 1b25dd8eec117c597c40b1f6a336f0a44c517ed0 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 8 Dec 2023 16:48:45 -0500 Subject: [PATCH 28/29] Fix instances of checking lighting color in projectile AIs. This now only occurs client side. --- Projectiles/Magic/RancorFog.cs | 16 +++-- Projectiles/Pets/ChibiiDoggo.cs | 8 ++- Projectiles/Ranged/AuroraFire.cs | 11 ++- Projectiles/Ranged/BlightFlames.cs | 22 +++--- Projectiles/Ranged/PristineSecondary.cs | 9 ++- .../Summon/SmallAresArms/MinionPlasmaGas.cs | 17 +++-- Tiles/Crags/Lily/LavaLily1.cs | 68 +++++++++---------- Tiles/Crags/Lily/LavaLily2.cs | 68 +++++++++---------- Tiles/Crags/Lily/LavaLily3.cs | 68 +++++++++---------- Tiles/Crags/Lily/LavaLily4.cs | 68 +++++++++---------- Tiles/Crags/Lily/LavaLily5.cs | 68 +++++++++---------- Tiles/Crags/Lily/LavaLily6.cs | 68 +++++++++---------- Tiles/Crags/ScorchedRemainsGrass.cs | 13 ++-- Tiles/Crags/Tree/SpineTree.cs | 34 ++++------ 14 files changed, 280 insertions(+), 258 deletions(-) diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index ba132f1e81..1896f3c3ab 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic @@ -33,13 +34,18 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] = 1f; } + Projectile.rotation += Projectile.velocity.X * 0.004f; + Projectile.velocity *= 0.985f; + + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. + if (Main.netMode == NetmodeID.Server) + return; + // Calculate light power. This checks below the position of the fog to check if this fog is underground. // Without this, it may render over the fullblack that the game renders for obscured tiles. float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); Projectile.Opacity = Utils.GetLerpValue(210f, 195f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); - Projectile.rotation += Projectile.velocity.X * 0.004f; - Projectile.velocity *= 0.985f; } public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index c158fe7771..74c7662fbf 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -2,11 +2,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; -using Terraria.Audio; namespace CalamityMod.Projectiles.Pets { @@ -171,6 +170,11 @@ namespace CalamityMod.Projectiles.Pets } //companion cube lighting check and stab + + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. + if (Main.netMode == NetmodeID.Server) + return; + Color color; color = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16); Vector3 vector3_1 = color.ToVector3(); diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index c9998f380e..03b7dec8d9 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -1,9 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -91,7 +92,11 @@ namespace CalamityMod.Projectiles.Ranged OrangeFogRot += MathHelper.ToRadians(1f); BlueFogRot -= MathHelper.ToRadians(1f); Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(450f, 360f, Time, true); - + + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. + if (Main.netMode == NetmodeID.Server) + return; + // Calculate light power. This checks below the position of the fog to check if this fog is underground. // Without this, it may render over the fullblack that the game renders for obscured tiles. float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); diff --git a/Projectiles/Ranged/BlightFlames.cs b/Projectiles/Ranged/BlightFlames.cs index 14c1a94771..09eab2ce60 100644 --- a/Projectiles/Ranged/BlightFlames.cs +++ b/Projectiles/Ranged/BlightFlames.cs @@ -1,13 +1,13 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using CalamityMod.Particles; -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items.Weapons.Ranged; using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -97,15 +97,19 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 0.99f; Projectile.Opacity = Utils.GetLerpValue(30f, 50f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 130f, Projectile.timeLeft, true); - // Calculate light power. This checks below the position of the fog to check if this fog is underground. - // Without this, it may render over the fullblack that the game renders for obscured tiles. - float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); - LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); - if (postEnemyHit && !postTileHit) { CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 25f, 35f); } + + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. + if (Main.netMode == NetmodeID.Server) + return; + + // Calculate light power. This checks below the position of the fog to check if this fog is underground. + // Without this, it may render over the fullblack that the game renders for obscured tiles. + float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); + LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 809e855a17..e6dc9bab85 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -1,8 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -47,6 +48,10 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 0.98f; Projectile.Opacity = Utils.GetLerpValue(150f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. + if (Main.netMode == NetmodeID.Server) + return; + // Calculate light power. This checks below the position of the fog to check if this fog is underground. // Without this, it may render over the fullblack that the game renders for obscured tiles. float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs index eaab11fba0..7c29973d8d 100644 --- a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs @@ -1,7 +1,7 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -43,14 +43,19 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Projectile.localAI[0] = 1f; } - // Calculate light power. This checks below the position of the fog to check if this fog is underground. - // Without this, it may render over the fullblack that the game renders for obscured tiles. - float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); - LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(0f, 60f, Projectile.timeLeft, true); Projectile.rotation += Projectile.velocity.X * 0.004f; Projectile.velocity *= 0.97f; Time++; + + // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. + if (Main.netMode == NetmodeID.Server) + return; + + // Calculate light power. This checks below the position of the fog to check if this fog is underground. + // Without this, it may render over the fullblack that the game renders for obscured tiles. + float lightPowerBelow = Lighting.GetColor((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16 + 6).ToVector3().Length() / (float)Math.Sqrt(3D); + LightPower = MathHelper.Lerp(LightPower, lightPowerBelow, 0.15f); } public void AdditiveDraw(SpriteBatch spriteBatch) diff --git a/Tiles/Crags/Lily/LavaLily1.cs b/Tiles/Crags/Lily/LavaLily1.cs index 8c869b5ef2..e541a9a434 100644 --- a/Tiles/Crags/Lily/LavaLily1.cs +++ b/Tiles/Crags/Lily/LavaLily1.cs @@ -1,31 +1,31 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Lily { - public class LavaLily1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class LavaLily1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileAxe[Type] = true; TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(3, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); MineResist = 3f; AddMapEntry(new Color(153, 100, 176)); DustType = DustID.PurpleMoss; @@ -55,22 +55,22 @@ namespace CalamityMod.Tiles.Crags.Lily public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - //draw the glowmask on the lily base - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Top").Value; - Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1TopGlow").Value; + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1TopGlow").Value; - //draw in the middle of the tile so it doesnt draw more than once - if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) { - DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), false); - DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), true); - } - } - } + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), true); + } + } + } } diff --git a/Tiles/Crags/Lily/LavaLily2.cs b/Tiles/Crags/Lily/LavaLily2.cs index c717a6631b..d392bcc01c 100644 --- a/Tiles/Crags/Lily/LavaLily2.cs +++ b/Tiles/Crags/Lily/LavaLily2.cs @@ -1,31 +1,31 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Lily { - public class LavaLily2 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class LavaLily2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileAxe[Type] = true; TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(3, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); MineResist = 3f; AddMapEntry(new Color(153, 100, 176)); DustType = DustID.PurpleMoss; @@ -55,22 +55,22 @@ namespace CalamityMod.Tiles.Crags.Lily public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - //draw the glowmask on the lily base - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Top").Value; - Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2TopGlow").Value; + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2TopGlow").Value; - //draw in the middle of the tile so it doesnt draw more than once - if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) { - DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), false); - DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), true); - } - } - } + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), true); + } + } + } } diff --git a/Tiles/Crags/Lily/LavaLily3.cs b/Tiles/Crags/Lily/LavaLily3.cs index 3a9899b427..e33eac3bb7 100644 --- a/Tiles/Crags/Lily/LavaLily3.cs +++ b/Tiles/Crags/Lily/LavaLily3.cs @@ -1,31 +1,31 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Lily { - public class LavaLily3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class LavaLily3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileAxe[Type] = true; TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(3, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); MineResist = 3f; AddMapEntry(new Color(153, 100, 176)); DustType = DustID.PurpleMoss; @@ -55,22 +55,22 @@ namespace CalamityMod.Tiles.Crags.Lily public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - //draw the glowmask on the lily base - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Top").Value; - Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3TopGlow").Value; + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3TopGlow").Value; - //draw in the middle of the tile so it doesnt draw more than once - if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) { - DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), false); - DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), true); - } - } - } + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), true); + } + } + } } diff --git a/Tiles/Crags/Lily/LavaLily4.cs b/Tiles/Crags/Lily/LavaLily4.cs index ccaec9fe6e..e922e4efea 100644 --- a/Tiles/Crags/Lily/LavaLily4.cs +++ b/Tiles/Crags/Lily/LavaLily4.cs @@ -1,31 +1,31 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Lily { - public class LavaLily4 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class LavaLily4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileAxe[Type] = true; TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(3, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); MineResist = 3f; AddMapEntry(new Color(153, 100, 176)); DustType = DustID.PurpleMoss; @@ -55,22 +55,22 @@ namespace CalamityMod.Tiles.Crags.Lily public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - //draw the glowmask on the lily base - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Top").Value; - Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4TopGlow").Value; + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4TopGlow").Value; - //draw in the middle of the tile so it doesnt draw more than once - if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) { - DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(96, 191), false); - DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(96, 191), true); - } - } - } + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(96, 191), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(96, 191), true); + } + } + } } diff --git a/Tiles/Crags/Lily/LavaLily5.cs b/Tiles/Crags/Lily/LavaLily5.cs index adf35cef11..57c72e2661 100644 --- a/Tiles/Crags/Lily/LavaLily5.cs +++ b/Tiles/Crags/Lily/LavaLily5.cs @@ -1,31 +1,31 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Lily { - public class LavaLily5 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class LavaLily5 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileAxe[Type] = true; TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(3, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); MineResist = 3f; AddMapEntry(new Color(153, 100, 176)); DustType = DustID.PurpleMoss; @@ -55,22 +55,22 @@ namespace CalamityMod.Tiles.Crags.Lily public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - //draw the glowmask on the lily base - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Top").Value; - Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5TopGlow").Value; + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5TopGlow").Value; - //draw in the middle of the tile so it doesnt draw more than once - if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) { - DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(118, 209), false); - DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(118, 209), true); - } - } - } + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(118, 209), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(118, 209), true); + } + } + } } diff --git a/Tiles/Crags/Lily/LavaLily6.cs b/Tiles/Crags/Lily/LavaLily6.cs index 3b919b7163..bc8fa2c1bd 100644 --- a/Tiles/Crags/Lily/LavaLily6.cs +++ b/Tiles/Crags/Lily/LavaLily6.cs @@ -1,31 +1,31 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using Terraria.DataStructures; -using Terraria.Enums; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.Crags.Lily { - public class LavaLily6 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; + public class LavaLily6 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; Main.tileAxe[Type] = true; TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(3, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); MineResist = 3f; AddMapEntry(new Color(153, 100, 176)); DustType = DustID.PurpleMoss; @@ -55,22 +55,22 @@ namespace CalamityMod.Tiles.Crags.Lily public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - //draw the glowmask on the lily base - Tile tile = Framing.GetTileSafely(i, j); - Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Glow").Value; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); - Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Top").Value; - Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6TopGlow").Value; + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6TopGlow").Value; - //draw in the middle of the tile so it doesnt draw more than once - if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) { - DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(96, 199), false); - DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(96, 199), true); - } - } - } + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(96, 199), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(96, 199), true); + } + } + } } diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index 9508c75ac2..d03865707b 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -1,12 +1,11 @@ -using CalamityMod.Tiles.Ores; -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Tiles.Crags.Lily; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags { @@ -40,10 +39,10 @@ namespace CalamityMod.Tiles.Crags } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 1.82f; - g = 0.56f; - b = 1.07f; + { + r = 1.82f; + g = 0.56f; + b = 1.07f; } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/Crags/Tree/SpineTree.cs b/Tiles/Crags/Tree/SpineTree.cs index a87c5751d0..0438c150b2 100644 --- a/Tiles/Crags/Tree/SpineTree.cs +++ b/Tiles/Crags/Tree/SpineTree.cs @@ -1,17 +1,11 @@ -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.Utilities; -using Terraria.DataStructures; -using Terraria.Audio; +using System; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Crags; -using System; -using System.Linq; -using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Tiles.Crags.Tree { @@ -36,7 +30,7 @@ namespace CalamityMod.Tiles.Crags.Tree public override void SetStaticDefaults() { TileID.Sets.IsATreeTrunk[Type] = true; - Main.tileFrameImportant[Type] = true; + Main.tileFrameImportant[Type] = true; Main.tileAxe[Type] = true; Main.tileMergeDirt[Type] = false; Main.tileSolid[Type] = false; @@ -44,7 +38,7 @@ namespace CalamityMod.Tiles.Crags.Tree Main.tileBlockLight[Type] = false; AddMapEntry(new Color(38, 25, 27), CreateMapEntryName()); DustType = 155; - HitSound = SoundID.DD2_SkeletonHurt; + HitSound = SoundID.DD2_SkeletonHurt; RegisterItemDrop(ModContent.ItemType()); } @@ -186,21 +180,21 @@ namespace CalamityMod.Tiles.Crags.Tree /*private void CheckEntireTree(ref int x, ref int y) { while (Main.tile[x, y].TileType == Type) - { + { y--; - } + } y++; if (Main.tile[x, y].TileFrameX == 16) { for (int k = 0; k < WorldGen.numTreeShakes; k++) - { + { if (WorldGen.treeShakeX[k] == x && WorldGen.treeShakeY[k] == y) - { + { return; - } - } + } + } WorldGen.treeShakeX[WorldGen.numTreeShakes] = x; WorldGen.treeShakeY[WorldGen.numTreeShakes] = y; From 312ce197189bc9de6583746b2eaf89a7e96a63c0 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 8 Dec 2023 18:14:45 -0500 Subject: [PATCH 29/29] Hellborn and Meowthrower resprites --- CalPlayer/DrawLayers/Backpack_Meowthrower.png | Bin 459 -> 442 bytes Items/Weapons/Ranged/Hellborn.cs | 2 +- Items/Weapons/Ranged/Hellborn.png | Bin 992 -> 1431 bytes Items/Weapons/Ranged/Meowthrower.png | Bin 843 -> 899 bytes 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/DrawLayers/Backpack_Meowthrower.png b/CalPlayer/DrawLayers/Backpack_Meowthrower.png index 8e1810a038e3d823d34252ba8ba59cf5e2207b0a..85bb722bc3af68ff83479bc274284633e5e1c582 100644 GIT binary patch delta 400 zcmV;B0dM}x1G)ntiBL{Q4GJ0x0000DNk~Le0000E0000W2nGNE03z;5mysbge@{t7 zK~zXfV+=Nk|IYvfIvTnlilK2u2_u++2I?bv!0N8txD4hqfk`p|3(TgV1V1nhG!bm_ z+6xQ8Hp5&5lV?}}p~$w85$1MV&Z}U7!{4>RG|VqB7op3O??))j@K!z)Odk~T1k)1} zZiDIkTdH7M>)m!R&2Zxyn4;W9e+>&2FnyqRA(*~lEe56!96bi6Cl*_Q>1!0*2n)R+ z21qcU9D7P^})(>nW z44irlNh#>y9>ZMrzjr5Pl0Z6M*nqK*lfdK%Jv3Mix=aYf}0000=q8v(2Z!R+ z!L(WLRWMCE7c8*|0@LUq=EOQMO*L6vK{}5L)&BTQHsHlnJIO zb^(R~$`Zn0d}P^kFoppbA0`h2e-yib1xjOp#7H(U9c&*3rn^>72Gi((da(clu-M33 zT?^(vTd@~ROGP+?=}Do@U>cTJXy*bBQS8C<a?L}akdM?P_zX~jnr1u6)!@#^tB2X3tAg4|cpk6H4$$NucvY;>!cg#lz?@mB+ z;nBx0!1UTDx4<;TE+A+C$Yz-B*Z}pzAXr8X%qIk>76$NiV3;})EMOBQ38rBHJ>I_` zI16P#0QFn|15&(@w2mt*V17UJa4U_<0~mnC3Oaz<3Px)H%UZ6RA_uwbDLzK9kM2ZgMte0FImw15g*5S$CKu&G5~^JA=TX248WFmmH_bb>g@o0bT$US+$xU& zNF;p#Tu4o_2ybkW{hAunKu$w?J=3i3CXyotAf1tUKCkTOb8L-BrBeVnUMH_6si@B> zTH?<2E?j-LkloY%1po&k7u^vdad^PhjM5LF9Gn@gS7y(t(RzY-pW6ftq5-a3&HbN74Xg2O4V zHL==BYkwA?-Y+-WS|vBUV)CoUPSXR2YCrT>4E?Zm!aZM)YLF zhIh1u0BBvi9Dvu_Q`QG|@A?sdsv5Di3xD+GJ;;oh*zP?QzZG=wpDxX}=8tWww5+)m zfR0au__mB_WbqQO3(d?zF7w*{v)ueQT?5uc^_I1xLVQ(a9DvTiEdUJF%>iKH!aIN* z>7~o=1t1&_Tl<|peGY&Jj_(Cvr6-j4fKwZ64GJ~Y*%Q`ET&Fz=fbWC-03@GX1VHA+ zRsfDY`WXO^xV~$G_{m*Q01&!=Hvsb&NCxHmRpPMPj*|I2BetrulfY59qknWLqJ-Npwym6)E2`5ep!LJfBUfCo* zMKi$Ar$YLb$n?Ai9ZPzwjMbn$X=$%;^MPQ8kWQsj#U00;>atP;u=CKVEWj2dm)6Xy zuR}%XzcpSf@iQf2TQ6-sDf_r&Yc~t&x;aw}K<}T?EI@~ITn-|MB4tj%03=hA zLFzkP+rbj?IhVY#EaWsm*Ml8pbY0OBH(EViR4ckaJP^+Uy!lK$08eg}cpWO2o9`Qr zTcp(&sC@mUWNaEO9)C=7_|E-D0XY4akPjHI0q~|IGaK^$dod^)9n9OWwYEf3G*>G% zv!}^^htG{#?|Hwkw79+cm1`bbMZMBr?HGWru-Np|GsJ8D;I&EX>q~9h@k`Auaxr3Q zh>ph-F?Za~;r}a9O}>^CE%7Tgx2q~Hma%n(?bnf3TH4yoNx|DJU~u12P>pYrl@128;1T+ji=BXgr< zg7|o%!1&^00001b5ch_0Itp) z=>Px&nn^@KRA_C&lFcaKI9NQa<0bcljL$Ot7&0)q{+R$Tw>y8CsQd0l7tb~kgSJ$%n)d1t%V|4(`WHO#JL;=jEzE$flYzv|P{Re6V;T@RM14!pr0O;`A z0Jzq(3xLtdlvhuR*G1Bdmwq>H26pw8!ed|Jv+?T2KHpnT*xn8PZxZUC4U?ClYO2T7P`$yA{iLX|EIqj4;>(+?k2DkH&9}wlzRwF2hN21GkV|iAy)$OqqwJE7&G>QC-}n2pj-yX~DJVjz`ehEMSB|7^CvZ`g#C9&i@38s@jy@qW~^-o&_p1 zBNmD%fR#edgQ9N`M!49}1cQHNg5b%yEC3H)9kAM8B<%P~L^I)7A+I1{#0J#GqXRnc z-^l^Rvwbsr6@ZE6_W*cn^$H-R<^V|L7OjcoZjsKf`1$}h&$}q)8!C;f!aM;ZHeHQ>V14=Wbctps7hJVy)9f7OFkunVM)do><$u?!OOxY@#Fkz>w z-2o#Elv`^og?;g;0+?IQ`u6v>Xp{PRe%-D#8Hm#pZP*pk^JNNpzW@DwBVdHV=9*>M zvnot*cTN~3OmM5$l6_7XMhI$!34(wT2HXCwQA%T`9yS5R`i7t_9#;V0mzRNn5jBTu ze%DX{rw;2oLig~32fmKf+x&d3AYg<+)ptcSqkVS+P`tyGT078)8p9ulBxDGHL8_Vn O0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0~kp}K~z{r?U-Lk zQ&Akp@5G0uV$efNsWcUFI+GR*g+=0nu7n6Bl!zb;66ud&SP}JNkqMSk4+UiuJ!qxS z!$5tINrpB_F_)9F)l@X2L=9OF(aP^RztxT&uUoJ8^RUnFTy}rEJNt6axzj1-&3@${ zPB}VxwK_x7F1UN%sY4+WW?w?qKQqmUzFQL#Fdp}MVHx84hDY5iU$2A+ZVd^61YN5r z!GQzSFJO_8A7i{?)DPZ)<6<|#BF|$Y;ma+p@ZPESaCF0Gc(Ib5=dJC5MW}yF_6C@s zB$zA~cwuG+mJw?(z%Hi~4mD9)f>a31p59o5Bqf^nV4UZC2@|d_BfMgmHm36`n5M`D znEF(t{(@WESdtpA--b`0I{_CL6~m*Cdtv&V2y--S&1Zdx0Y?{X&dq~sE>y$BJ)YQO zC9E$|SYU(cJnCcbXb(z|smG6ba9MRYt|dr?WeF-g%zhC=6T1fx^vh1ne}iRA8?#`s zPuigzSmfD_`@CXIMosaGk+$8$E5_&>wz|>rN&jY8#*m>3&g?IOhjr}U6~O%vb6{;` z$(h@^^!gVqK`MltAhmr-*LV~x>qD$Hk!!_cwDM|Y^vZYG=WYwSe!}Eu2^z-e&-dci z5~RYi1c_LtCSfr-rCavl{RflxW1PM&1VU%;4FM; z2ip&2-?|I8EM~w&rQ<5>Q9i7g5H<9LRro$W&sU5IEkP=THQP(b5_GipEKECK*^V_y zNyhn|wg(s!DT!m?MGlwIZKiZ{X{>nf}!LX&Fo(09$-6s zEkP=ToFGchl?;{?f|4^E$5snM_N=pey#;;59Xaj9`)=04S+-PosQn$Bedat|_A?eH zXjQb$y@CVKvZTUmJ3G(b^Az^k>v7#$f>a3o9wa>d2WI|J9W2{th^Qr~uCxFasc!Co zWeIXxcfsL8$sx1^sStL82z~bxUNP31AcB%aIOF-VRnj(Q5zj|R+*e8e+5Atm1g(mq Z{00umE>keWbj|<(002ovPDHLkV1g~*njHWD literal 843 zcmV-R1GM~!P)0R_tu?H5&gfdnTL1jfU6;^&oS{Rd1^e_E7ajDmG$4c#;M&RlQv=e<9RbIv~doU`_F@9kK|#OPa? zoc-rtS1-C-Eo!dy+QsNvhTW)M-iSB757ujE4tP zU2b+>M0=x;ooCHdC|LIMI^c`=c9R$l=0{A79Etczad7R;PX=DKZw6i}KB0Ofm1S=_ zhjmANH*lzb*r+&E_oWwBV?HZyielZpatp??Vyd6^LSZFKrhyZam>_K&0gPZCTrayf+o&Jp2gnt35du>jg)C0i!Br)DuGj*cD7IqR&z{KErjKq{s#eJ#em(jDTwA`kGZ|CZuhDp$UYD>VaCnKNuat9>Fc zaQ_Q%TZ`}`=N2l4xrj;)DaIs5Bxy}zs1PzQN5=QTkExo0C-M@;tU7aTB4YCQ#xEks zen(!PohbU6)p1?Gy1pJ@$J-mKfA-P(75dleTd0^H_a4Kv>s384Ofe=g5;0_!5n%O^ znVg!C2-86Pci{5%Il#~FMU^=17M(9YcDC$vIe*Y4I_1eTMfGU++y)jVEd?^C_4YSM zRE**<0|WWJtXg66G>H*yNQf8`k}^LZ3*%NS6Ojt`E3$$-4|ZcO|5rL*UIzQiH}3-X zl!;v7J%0u0*t-*Wu~JmAT^m;ck5*IytwZC16KorR%rO)Jb4|kUp9XZHy@lr;n zvA?1H{&uh8eHN1#L5(IcdYP6LBkz-ch|==Q-)poQOTG7rm7V;qkYe;6Fj|QD3o5xK VFDe@PfdBvi07*qoM6N<$f&jLcg@XV9