diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index 11b86c7d67..b3399fee89 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Backgrounds if (Main.dedServ) return; - SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG0"); - SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG1"); - SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG2"); - SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG3"); + SSBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); } public override void FillTextureArray(int[] textureSlots) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index a4e1f00cb0..5a31c53ed0 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -92,11 +92,6 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges = new List(); - #region Desert Scourge - // 20% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(DesertScourgeIDList.List, Do(ResistTrueMelee(0.8f)))); - #endregion - #region Crabulon // 20% resist to true melee. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.8f))); diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 8ebeea298b..7e2d165718 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -242,6 +242,16 @@ internal static readonly float TrueMeleeRipperReductionFactor = 0.5f; // True melee benefits less from rippers to prevent excessive melting. #endregion + #region Pierce Resistance + // Both of the below variables only apply when an NPC has universal pierce resistance enabled via attribute. + // Projectiles may be marked as exempt from this pierce resistance by using an attribute. + + /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. + public const float PierceResistHarshness = 0.12f; + /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. + public const float PierceResistCap = 0.8f; + #endregion + // TODO -- NPC classification is not done consistently with predictable thresholds. // These variables should be used in general to classify "enemies" vs "non-enemies" as well. // See NPCUtils.IsAnEnemy @@ -253,6 +263,13 @@ internal const int UnreasonableHealthThreshold = 25000000; // 25 million #endregion + #region Multiplayer Boss Health Scaling Overrides + // These values are used to replace the vanilla 1.35f and 1.9166666666666666f for the 2-player and 3-player cases, respectively. + // Editing them via reflection or otherwise will apply to newly spawned bosses during gameplay. + public static float ExpertHealthScalingOverride_2Players = 1.75f; + public static float ExpertHealthScalingOverride_3Players = 2.25f; + #endregion + // TODO -- Add all balance related constants here that don't belong in other files. // Review all constants and static readonlys in the entire mod to find things to add. } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 725efc9dec..6f9f164430 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -302,6 +302,10 @@ namespace CalamityMod.CalPlayer public bool despoilerNerf = false; /// Variable used to trigger Molten Amputator's stealth effect on right-click. public int amputatorBuff = 0; + /// Variable used to track the fuel of Pristine Fury right click + public int furyFuelMax = 1800; + public int furyFuel = 1800; + public float furyRefuelTimer = 0; public int rOfResilienceCooldown = 0; public int rOfResilienceEffect = 0; public int rOfResilienceOrbitOffset = 0; @@ -837,7 +841,7 @@ namespace CalamityMod.CalPlayer public bool aBrain = false; public bool amalgam = false; public bool raiderTalisman = false; - public float raiderCritLifespan = 0f; + public int raiderCritLifespan = 0; public int raiderSoundCooldown = 0; public bool gSabaton = false; public int gSabatonHotkeyHoldTime = 0; @@ -2839,7 +2843,7 @@ namespace CalamityMod.CalPlayer spiritOriginCritBoost = 0; rage = 0f; adrenaline = 0f; - raiderCritLifespan = 0f; + raiderCritLifespan = 0; raiderSoundCooldown = 0; gSabatonHotkeyHoldTime = 0; gSabatonFall = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 188e338e1b..5ac2219239 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -203,6 +203,16 @@ namespace CalamityMod.CalPlayer rage = 0f; } + if (furyFuel < furyFuelMax && furyRefuelTimer >= 0) + { + furyFuel += (int)furyRefuelTimer; + furyRefuelTimer = MathHelper.Lerp(furyRefuelTimer, 25, 0.01f); + if (furyFuel > furyFuelMax) + furyFuel = furyFuelMax; + } + else if (furyRefuelTimer < 0) + furyRefuelTimer++; + // De-equipping Draedon's Heart deletes all Adrenaline. if (!draedonsHeart && hadNanomachinesLastFrame) { @@ -307,7 +317,7 @@ namespace CalamityMod.CalPlayer { if (dashStart) { - Player.velocity.X *= 3f; // +200% dash speed + Player.velocity.X *= 2.2f; // +120% dash speed int damage = (int)Player.GetBestClassDamage().ApplyTo(LeviathanAmbergris.ambergrisDashDamage); Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } @@ -1264,7 +1274,7 @@ namespace CalamityMod.CalPlayer if (holdingDown && Player.ControlsEnabled() && notInLiquid && notOnRope && notGrappling && airborne && !Player.Calamity().gSabatonFalling) //Player cannot further increase their ridiculous gravity during a Gravistar Slam { Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); - if (Player.Calamity().gSabaton) + if (Player.Calamity().gSabaton && !Player.gravControl2) { Player.maxFallSpeed *= 1.5f; } @@ -1960,7 +1970,7 @@ namespace CalamityMod.CalPlayer if (vortexBoosterStealthDelay > 0) { vortexBoosterStealthDelay--; - if (vortexBoosterStealthDelay == 1) + if (vortexBoosterStealthDelay == 1 && Player.setVortex) Player.vortexStealthActive = true; } if (statisPenaltyTimer > 0) @@ -2331,8 +2341,10 @@ namespace CalamityMod.CalPlayer } // Raider Talisman bonus - if (raiderTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + if (raiderTalisman && !vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) Player.GetCritChance() += RaidersTalisman.RaiderBonus; + if (vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + Player.GetCritChance() += VampiricTalisman.RaiderBonus; if (kamiBoost) Player.GetDamage() += YanmeisKnife.DamageBoost; @@ -4212,6 +4224,10 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() += 10; } + + if (Player.portableStoolInfo.IsInUse) + Player.GetCritChance(DamageClass.Generic) += 5; + // Amalgam boosts if (Main.myPlayer == Player.whoAmI) { diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 0a0d1df195..5ee8e4dcba 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -755,7 +755,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < 2; l++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int leafDamage = (int)(0.25f * proj.damage); + int leafDamage = CalamityUtils.DamageSoftCap((int)(0.25f * proj.damage), 150); int leaf = Projectile.NewProjectile(source, position, velocity, ProjectileID.Leaf, leafDamage, 0f, Player.whoAmI); if (leaf.WithinBounds(Main.maxProjectiles)) { @@ -768,7 +768,7 @@ namespace CalamityMod.CalPlayer for (int projCount = 0; projCount < 2; projCount++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int energyDamage = (int)(0.33f * proj.damage); + int energyDamage = CalamityUtils.DamageSoftCap((int)(0.33f * proj.damage), 200); Projectile.NewProjectile(source, proj.Center, velocity, ProjectileType(), energyDamage, 0f, proj.owner); } } @@ -1099,6 +1099,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); + Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, vampiricTalisman ? "Bloodfeast" : "default"); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1303,11 +1304,19 @@ namespace CalamityMod.CalPlayer if (vampiricTalisman && proj.CountsAsClass() && crit) { - int heal = (int)Math.Round(damage * 0.015); + int heal = (int)Math.Round(damage * (Main.zenithWorld ? 0.01 : 0.008)); + if (proj.Calamity().stealthStrike) + { + heal /= 2; //stealth strikes heal half due to generally dealing far more dmg + + if (Main.zenithWorld) + heal *= -2; // IT YEARNS FOR MORE BLOOD + } if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(1f, heal)) + // Heals more if the ability is active + if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile((raiderCritLifespan > 0) ? 1.5f : 1f, heal)) CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index 2d03a45fbe..fa4d3f04a2 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -25,7 +25,7 @@ namespace CalamityMod.CalPlayer.Dashes public bool strongVisuals = true; public int lastDashDir = 0; - public override float CalculateDashSpeed(Player player) => (75f * player.moveSpeed); + public override float CalculateDashSpeed(Player player) => (70f * player.moveSpeed); public override void OnDashEffects(Player player) { diff --git a/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs b/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs index 84f3cfd089..b751a90295 100644 --- a/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs +++ b/Cooldowns/DaawnlightSpiritOriginExtraCrit.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.Cooldowns // If the player doesn't have DSO, this cooldown should not appear. public override bool ShouldDisplay => instance.player.GetModPlayer().spiritOrigin; - private float ExtraCritChance => instance.player.GetModPlayer().spiritOriginCritBoost; + private float ExtraCritChance => Math.Min(instance.player.GetModPlayer().spiritOriginCritBoost, CritHardCap); private float TextXOffset => (ExtraCritChance > 99 ? -24 : ExtraCritChance > 9 ? -20 : -16) * TextScale; private Vector2 TextPosition => new(TextXOffset , 25); diff --git a/Cooldowns/FuryFuel.cs b/Cooldowns/FuryFuel.cs new file mode 100644 index 0000000000..0df9315cc6 --- /dev/null +++ b/Cooldowns/FuryFuel.cs @@ -0,0 +1,45 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class FuryFuel : CooldownHandler + { + public float CompletionPercentage => MathF.Round(instance.Completion * 100); + private bool IsEmpty => CompletionPercentage == 100; + private float TextXOffset => -5.4f; + private Vector2 TextPosition => new(TextXOffset, 15); + private Color TextColor => Color.White; + private Color TextBorderColor = Color.Violet; + + public static new string ID => "FuryFuel"; + public override bool CanTickDown => false; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.Orchid, Color.SlateGray, instance.Completion); + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + } + } +} diff --git a/Cooldowns/FuryFuel.png b/Cooldowns/FuryFuel.png new file mode 100644 index 0000000000..6820cf90a0 Binary files /dev/null and b/Cooldowns/FuryFuel.png differ diff --git a/Cooldowns/FuryFuelOutline.png b/Cooldowns/FuryFuelOutline.png new file mode 100644 index 0000000000..9f65a9db98 Binary files /dev/null and b/Cooldowns/FuryFuelOutline.png differ diff --git a/Cooldowns/FuryFuelOverlay.png b/Cooldowns/FuryFuelOverlay.png new file mode 100644 index 0000000000..834115ddfb Binary files /dev/null and b/Cooldowns/FuryFuelOverlay.png differ diff --git a/Cooldowns/RaiderBoost.cs b/Cooldowns/RaiderBoost.cs new file mode 100644 index 0000000000..79bb9ae02d --- /dev/null +++ b/Cooldowns/RaiderBoost.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class RaiderBoost : CooldownHandler + { + public static new string ID => "RaidersBoost"; + + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + + public override string Texture => "CalamityMod/Cooldowns/" + skinTexture; + public override Color OutlineColor => outlineColor; + public override Color CooldownStartColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + public override Color CooldownEndColor => Color.Lerp(cooldownColorStart, cooldownColorEnd, 1 - instance.Completion); + + //It's the same cooldown with different skins each time, basically. + public string skinTexture; + public Color outlineColor; + public Color cooldownColorStart; + public Color cooldownColorEnd; + + public RaiderBoost() : this("") { } + public RaiderBoost(string skin) + { + switch (skin) + { + case "Bloodfeast": + skinTexture = "VampiricTalismanBoost"; + outlineColor = new Color(143, 27, 27); + cooldownColorStart = new Color(133, 5, 5); + cooldownColorEnd = new Color(255, 0, 0); + break; + + default: + skinTexture = "RaiderBoost"; + outlineColor = new Color(122, 97, 77); + cooldownColorStart = new Color(168, 122, 86); + cooldownColorEnd = new Color(74, 60, 49); + break; + } + } + } +} diff --git a/Cooldowns/RaiderBoost.png b/Cooldowns/RaiderBoost.png new file mode 100644 index 0000000000..9e34eeb520 Binary files /dev/null and b/Cooldowns/RaiderBoost.png differ diff --git a/Cooldowns/RaiderBoostOutline.png b/Cooldowns/RaiderBoostOutline.png new file mode 100644 index 0000000000..f2964069b8 Binary files /dev/null and b/Cooldowns/RaiderBoostOutline.png differ diff --git a/Cooldowns/RaiderBoostOverlay.png b/Cooldowns/RaiderBoostOverlay.png new file mode 100644 index 0000000000..630cad2d91 Binary files /dev/null and b/Cooldowns/RaiderBoostOverlay.png differ diff --git a/Cooldowns/VampiricTalismanBoost.png b/Cooldowns/VampiricTalismanBoost.png new file mode 100644 index 0000000000..fa87b4b68c Binary files /dev/null and b/Cooldowns/VampiricTalismanBoost.png differ diff --git a/Cooldowns/VampiricTalismanBoostOutline.png b/Cooldowns/VampiricTalismanBoostOutline.png new file mode 100644 index 0000000000..7cf25cffc7 Binary files /dev/null and b/Cooldowns/VampiricTalismanBoostOutline.png differ diff --git a/Cooldowns/VampiricTalismanBoostOverlay.png b/Cooldowns/VampiricTalismanBoostOverlay.png new file mode 100644 index 0000000000..85ed189dba Binary files /dev/null and b/Cooldowns/VampiricTalismanBoostOverlay.png differ diff --git a/Fonts/CodebreakerDialog.xnb b/Fonts/CodebreakerDialog.xnb index eef588aef5..45515ed30f 100644 Binary files a/Fonts/CodebreakerDialog.xnb and b/Fonts/CodebreakerDialog.xnb differ diff --git a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index 800ad701fe..409ff05a3e 100644 --- a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers } var shader = GameShaders.Misc["CalamityMod:HolyInfernoShader"].Shader; - shader.Parameters["colorMult"].SetValue(Main.IsItDay() ? 7.35f : 7.65f); //I want you to know it took considerable restraint to deliberately misspell colour. + shader.Parameters["colorMult"].SetValue(prov.hasBeenGivenFullPower ? 7.65f : 7.35f); //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); @@ -74,7 +74,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity); shader.Parameters["playerPosition"].SetValue(target.Center); shader.Parameters["maxOpacity"].SetValue(maxOpacity); - shader.Parameters["day"].SetValue(Main.IsItDay()); + shader.Parameters["day"].SetValue(!prov.hasBeenGivenFullPower); spriteBatch.GraphicsDevice.Textures[1] = diagonalNoise.Value; spriteBatch.GraphicsDevice.Textures[2] = upwardNoise.Value; diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index e5a655113b..41291522ae 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -58,6 +58,11 @@ namespace CalamityMod.Items.Accessories // Special search radius for coin ricoshots that only applies to DSO targets. public static readonly float RicoshotSearchDistance = 2800f; + /// + /// The maximum amount of extra critical strike chance you can get from this accessory. + /// + public static readonly int CritHardCap = 100; + #endregion public override void SetDefaults() @@ -115,7 +120,7 @@ namespace CalamityMod.Items.Accessories modPlayer.spiritOriginCritBoost = currentCritBoost; // Actually give the crit boost as a direct increase to ranged critical strike chance. - player.GetCritChance() += modPlayer.spiritOriginCritBoost; + player.GetCritChance() += Math.Min(modPlayer.spiritOriginCritBoost, CritHardCap); // Display the current crit boost on a cooldown. if (modPlayer.cooldowns.TryGetValue(DaawnlightSpiritOriginExtraCrit.ID, out var cooldown)) diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 7d73cda868..f37b4fbf5f 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nanotech = true; - modPlayer.raiderTalisman = true; modPlayer.electricianGlove = true; modPlayer.filthyGlove = true; modPlayer.bloodyGlove = true; @@ -36,7 +35,6 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(4). diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 7ded8661aa..775a842fa1 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 10f; - public const int RaiderCooldown = 10; + public const float RaiderBonus = 15f; + public const int RaiderCooldown = 10; //seconds public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); public override void SetDefaults() diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 387cfa5b86..1289b42d86 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -64,8 +64,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 38; - Item.height = 26; + Item.width = 34; + Item.height = 30; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Accessories/RoverDrive.png b/Items/Accessories/RoverDrive.png index dc5b42b8ba..6ee7811338 100644 Binary files a/Items/Accessories/RoverDrive.png and b/Items/Accessories/RoverDrive.png differ diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index 4f6d09983b..d5d2f6e118 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -3,11 +3,23 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Accessories { - public class VampiricTalisman : ModItem, ILocalizedModType + public class VampiricTalisman : ModItem, ILocalizedModType, IHoldShiftTooltipItem { + internal const int ArmorCrunchDebuffTime = 150; + internal const int HeavyBleedingDebuffTime = 300; + internal const float StealthStrikeDamageMultiplier = 0.08f; + public const float RaiderBonus = 15f; + + public bool ShowExtensionIndicator => false; + + // Easter egg has a special tooltip key and color. + public string TooltipExtensionKey => "YearningForBlood"; + public Color? TooltipExtensionColor => Color.Red; + public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -22,14 +34,22 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.vampiricTalisman = true; - player.GetDamage() += 0.12f; + modPlayer.raiderTalisman = true; + modPlayer.rottenDogTooth = true; + player.Calamity().bonusStealthDamage += StealthStrikeDamageMultiplier; + + //get fixed boi funny + if (Main.zenithWorld) + player.lifeRegen -= 10; //Never ending thirst } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(10). + AddIngredient(ItemID.BrokenBatWing). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/WulfrumBattery.png b/Items/Accessories/WulfrumBattery.png index ada5ddef24..f2559fc5f6 100644 Binary files a/Items/Accessories/WulfrumBattery.png and b/Items/Accessories/WulfrumBattery.png differ diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index 135be89269..3fd7557773 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -8,20 +9,18 @@ namespace CalamityMod.Items.Ammo { public class HyperiusBullet : ModItem, ILocalizedModType { + public static float overflowEfficency = 1.15f; // Multiplier applied to overflow damage done by other damage sources + public static readonly SoundStyle hit = new("CalamityMod/Sounds/Item/HyperiusOverflow"); public new string LocalizationCategory => "Items.Ammo"; - - public static int SplitBulletBonusDamage = 16; - public override void SetStaticDefaults() { Item.ResearchUnlockCount = 99; } - public override void SetDefaults() { Item.width = 24; Item.height = 30; - Item.damage = 13; + Item.damage = 8; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; @@ -35,8 +34,8 @@ namespace CalamityMod.Items.Ammo public override void AddRecipes() { - CreateRecipe(150). - AddIngredient(ItemID.MusketBall, 150). + CreateRecipe(333). + AddIngredient(ItemID.MusketBall, 333). AddIngredient(). AddTile(TileID.MythrilAnvil). Register(); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index aa46204ec2..c076fe6817 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -7,6 +7,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; @@ -906,6 +907,31 @@ namespace CalamityMod.Items } #endregion + public override void OnHitNPC(Item item, Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + // Hyperius Overflow + if (target.Calamity().hyperiusMarked) + { + int damage = 0; + if (target.Calamity().hyperiusDamage < damageDone) + damage = damageDone - target.Calamity().hyperiusDamage; + else + damage = damageDone; + target.Calamity().hyperiusDamage -= damage; + + // Spawn overflow hit + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, player.whoAmI, target.whoAmI); + overflow.DamageType = item.DamageType; + overflow.ArmorPenetration = item.ArmorPenetration; // Takes the armor pen from what did the hit + + if (target.Calamity().hyperiusDamage <= 0) + { + target.Calamity().hyperiusDamage = 0; + target.Calamity().hyperiusMarked = false; + } + } + } + #region Armor Set Changes public override string IsArmorSet(Item head, Item body, Item legs) { @@ -1292,7 +1318,16 @@ namespace CalamityMod.Items if (item.type == ItemID.TerrasparkBoots) player.buffImmune[BuffID.OnFire] = true; - else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water + if (item.type == ItemID.GravityGlobe) + { + player.jumpSpeedBoost += 1.6f; + if (player.controlDown) + player.maxFallSpeed *= 1.5f; + else + player.maxFallSpeed *= 1.2f; + } + + if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water { if (player.IsUnderwater()) player.gills = true; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 298f055625..bfb8475015 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -569,6 +569,13 @@ namespace CalamityMod.Items if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotionMultiplier != 1f) EditTooltipByName("HealLife", (line) => line.Text = Language.GetOrRegister("CommonItemTooltip.RestoresLife").Format((int)(item.healLife * Main.LocalPlayer.Calamity().healingPotionMultiplier))); + + if (item.type == ItemID.GravityGlobe) + EditTooltipByName("Tooltip1", (line) => line.Text = EditedTooltip("GravityGlobe")); + + + if (item.type == ItemID.PortableStool) + EditTooltipByName("Tooltip0", (line) => line.Text += AddedTooltip("Stepstool")); #endregion // For boss summon item clarity diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..cfa4f34b81 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class ChargedWulfrumWallMountedBulb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType ()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png new file mode 100644 index 0000000000..e948233679 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..50db216abe --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Plates; +using CalamityMod.Tiles.DraedonStructures.CagedLights; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum +{ + public class WulfrumWallMountedBulb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType ()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.png b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.png new file mode 100644 index 0000000000..fa3672d7d4 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.png differ diff --git a/Items/Placeables/SunkenSea/Driftwood.png b/Items/Placeables/SunkenSea/Driftwood.png index 25ff08f299..b32a47fe74 100644 Binary files a/Items/Placeables/SunkenSea/Driftwood.png and b/Items/Placeables/SunkenSea/Driftwood.png differ diff --git a/Items/Placeables/SunkenSea/RuneSand.cs b/Items/Placeables/SunkenSea/Dunesand.cs similarity index 75% rename from Items/Placeables/SunkenSea/RuneSand.cs rename to Items/Placeables/SunkenSea/Dunesand.cs index b5c6ead314..af03dbc96c 100644 --- a/Items/Placeables/SunkenSea/RuneSand.cs +++ b/Items/Placeables/SunkenSea/Dunesand.cs @@ -3,7 +3,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea { - public class RuneSand : ModItem, ILocalizedModType + [LegacyName("RuneSand")] + public class Dunesand : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() @@ -12,6 +13,6 @@ namespace CalamityMod.Items.Placeables.SunkenSea ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); } } diff --git a/Items/Placeables/SunkenSea/RuneSand.png b/Items/Placeables/SunkenSea/Dunesand.png similarity index 100% rename from Items/Placeables/SunkenSea/RuneSand.png rename to Items/Placeables/SunkenSea/Dunesand.png diff --git a/Items/Placeables/SunkenSea/Shellstone.cs b/Items/Placeables/SunkenSea/Shellstone.cs index 321018307f..ad69d66322 100644 --- a/Items/Placeables/SunkenSea/Shellstone.cs +++ b/Items/Placeables/SunkenSea/Shellstone.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); diff --git a/Items/Placeables/Walls/EutrophicGlassWall.cs b/Items/Placeables/Walls/EutrophicGlassWall.cs new file mode 100644 index 0000000000..64ab1c799f --- /dev/null +++ b/Items/Placeables/Walls/EutrophicGlassWall.cs @@ -0,0 +1,25 @@ +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class EutrophicGlassWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/EutrophicGlassWall.png b/Items/Placeables/Walls/EutrophicGlassWall.png new file mode 100644 index 0000000000..9f7cfe4799 Binary files /dev/null and b/Items/Placeables/Walls/EutrophicGlassWall.png differ diff --git a/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs index faea180c98..539bda7c35 100644 --- a/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs +++ b/Items/Placeables/Walls/RoundedAnodizedWulfrumPanelWall.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.FurnitureWulfrum; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; @@ -19,8 +20,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { CreateRecipe(8). - AddIngredient(). - AddIngredient(). + AddIngredient(). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Walls/WulfrumSheetWall.cs b/Items/Placeables/Walls/WulfrumSheetWall.cs new file mode 100644 index 0000000000..91c9471ddc --- /dev/null +++ b/Items/Placeables/Walls/WulfrumSheetWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumSheetWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumSheetWall.png b/Items/Placeables/Walls/WulfrumSheetWall.png new file mode 100644 index 0000000000..c9a8e72a7a Binary files /dev/null and b/Items/Placeables/Walls/WulfrumSheetWall.png differ diff --git a/Items/Placeables/Walls/WulfrumSidingWall.cs b/Items/Placeables/Walls/WulfrumSidingWall.cs new file mode 100644 index 0000000000..f444611ee7 --- /dev/null +++ b/Items/Placeables/Walls/WulfrumSidingWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class WulfrumSidingWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + } + + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/WulfrumSidingWall.png b/Items/Placeables/Walls/WulfrumSidingWall.png new file mode 100644 index 0000000000..6657ef206b Binary files /dev/null and b/Items/Placeables/Walls/WulfrumSidingWall.png differ diff --git a/Items/Weapons/DraedonsArsenal/CompactRailgun.cs b/Items/Weapons/DraedonsArsenal/CompactRailgun.cs index 066ab31401..2c4adfc31a 100644 --- a/Items/Weapons/DraedonsArsenal/CompactRailgun.cs +++ b/Items/Weapons/DraedonsArsenal/CompactRailgun.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 70; Item.height = 30; Item.DamageType = DamageClass.Ranged; - Item.damage = 60; + Item.damage = 69; Item.knockBack = 7f; Item.useTime = Item.useAnimation = 8; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs index c5a4bc2220..a260077562 100644 --- a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs +++ b/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 26; Item.height = 78; Item.DamageType = DamageClass.Ranged; - Item.damage = 57; + Item.damage = 50; Item.knockBack = 0.8f; Item.useTime = Item.useAnimation = 14; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index e0a0bbacfb..0f0ad89be9 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/PulseRifleFire") { Volume = 0.8f }; - private int BaseDamage = 990; public int FiringTimer = 30; public override void SetDefaults() @@ -29,7 +28,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 100; Item.height = 32; Item.DamageType = DamageClass.Ranged; - Item.damage = BaseDamage; + Item.damage = 720; Item.useAnimation = Item.useTime = 55; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/DraedonsArsenal/ScattershotSkewer.cs b/Items/Weapons/DraedonsArsenal/ScattershotSkewer.cs index 6c3f6ac653..f8dc2c493b 100644 --- a/Items/Weapons/DraedonsArsenal/ScattershotSkewer.cs +++ b/Items/Weapons/DraedonsArsenal/ScattershotSkewer.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 64; Item.height = 36; Item.DamageType = DamageClass.Ranged; - Item.damage = 135; + Item.damage = 150; Item.knockBack = 4f; Item.useTime = 30; Item.useAnimation = 30; diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index 61de44955a..fcf8c4aeb8 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -8,13 +8,13 @@ namespace CalamityMod.Items.Weapons.Magic public class GloriousEnd : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - public static int PlayerExplosionDmgMin = 50; - public static int PlayerExplosionDmgMax = 60; + public static int PlayerExplosionDmgMin = 60; + public static int PlayerExplosionDmgMax = 80; public override void SetDefaults() { Item.width = 30; Item.height = 58; - Item.damage = 120; + Item.damage = 100; Item.knockBack = 10f; Item.useAnimation = Item.useTime = 30; Item.mana = 20; diff --git a/Items/Weapons/Magic/PhotosynthesisGlow.png b/Items/Weapons/Magic/PhotosynthesisGlow.png index dc3a8eeab5..ca021b33a5 100644 Binary files a/Items/Weapons/Magic/PhotosynthesisGlow.png and b/Items/Weapons/Magic/PhotosynthesisGlow.png differ diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index ac5bfb214c..05109ea63c 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -1,11 +1,14 @@ -using CalamityMod.Items.BaseItems; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; -using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -18,6 +21,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; public static readonly SoundStyle GrandDadEasterEggSound = new("CalamityMod/Sounds/Custom/GFB/GrandDad"); + public Vector2 oldVel = Vector2.Zero; + public int time = 0; + public float highestSpeed = 0; + public bool hitFloor = false; public override void SetDefaults() { Item.width = 124; @@ -57,7 +64,70 @@ namespace CalamityMod.Items.Weapons.Melee AddTile(TileID.LunarCraftingStation). Register(); } + public override void OnSpawn(IEntitySource source) + { + time = 0; + hitFloor = false; + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + Vector2 place = Item.Center + Vector2.UnitY * 48; + if (time == 0 && Item.velocity.Y != 0) + { + oldVel = Item.velocity; + Item.velocity = new Vector2(Math.Sign(Item.velocity.X) * 20, -10); + } + if (oldVel.Y != 0 && Item.velocity.Y == 0) + { + time = 0; + float power = Utils.GetLerpValue(35, 75, highestSpeed, true) * 2; + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3.5f * power) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3.5f * power; + if (power > 0.25f) + { + float blastSize = 150 * power; + float minMultiplier = 0.3f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), place, Vector2.Zero, ModContent.ProjectileType(), (int)(Item.damage * 2 * power), -35 * power, -1, blastSize, minMultiplier, hitsToMinMult); + blast.timeLeft = 5; + int particleNumber = (int)Math.Max(15 * power, 2); + for (int i = -particleNumber; i <= particleNumber; i++) + { + Particle sparks = new AltSparkParticle(place, (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, false, Main.rand.Next(17, 30 + 1), Main.rand.NextFloat(0.2f, 0.8f), Main.rand.NextBool() ? Color.Lerp(Color.Blue, Color.DodgerBlue, 0.3f) : Color.Gold); + GeneralParticleHandler.SpawnParticle(sparks); + Dust dust = Dust.NewDustPerfect(place, ModContent.DustType(), (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, 0, default, Main.rand.NextFloat(0.85f, 1.2f) * power); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.Blue : Color.DodgerBlue; + } + + SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(sound with { Volume = 0.6f * power, Pitch = Main.rand.NextFloat(0.4f, 0.6f) }, Item.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(sound2 with { Volume = 0.45f * power, Pitch = -0.2f }, Item.Center); + } + + highestSpeed = 0; + } + if (Item.velocity.Y != 0) + { + if (Item.velocity.Y > 0 && Item.velocity.Y < 75) + { + Item.velocity.X *= 0.98f; + Item.velocity.Y += 0.35f; + Item.velocity.Y *= 1.15f; + } + else + Item.velocity.Y += 0.55f; + time++; + if (highestSpeed < Item.velocity.Y) + highestSpeed = Item.velocity.Y; + } + + gravity = 0; + maxFallSpeed = 75; + oldVel = Item.velocity; + } public override void OnCreated(ItemCreationContext context) { if (Main.zenithWorld) diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 7f7c60844b..f6152e10a7 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public class AcesHigh : ModItem, ILocalizedModType { + public int shots = 0; public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { @@ -42,7 +43,12 @@ namespace CalamityMod.Items.Weapons.Ranged { return new Vector2(-5, 0); } - + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 80) + return false; + return true; + } public override void AddRecipes() { CreateRecipe(). @@ -56,13 +62,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { - type = Utils.SelectRandom(Main.rand, new int[] + shots++; + switch (shots) { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); + case 4: + type = ModContent.ProjectileType(); + shots = 0; + break; + case 3: + type = ModContent.ProjectileType(); + break; + case 2: + type = ModContent.ProjectileType(); + break; + default: + type = ModContent.ProjectileType(); + break; + } } } } diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index 45ca6ba331..53c2f43411 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.DamageType = DamageClass.Ranged; Item.damage = 740; Item.knockBack = 16f; - Item.useTime = 84; - Item.useAnimation = 84; + Item.useTime = Item.useAnimation = 74; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Shoot; diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 8ac9e7131e..73019a111a 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; @@ -8,6 +9,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Ranged { @@ -19,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public bool Trail = true; public int shotCount = 0; - public static int boomTime = 60; + public static int boomTime = 6; public override Color? TooltipExtensionColor => new Color(255, 140, 0); @@ -56,20 +58,40 @@ namespace CalamityMod.Items.Weapons.Ranged // Right click consumes ammo at the same rate but faster at spewing public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.5f : 1f; - + public override void HoldItem(Player player) + { + int max = player.Calamity().furyFuelMax; + if (player.Calamity().cooldowns.TryGetValue(FuryFuel.ID, out var cooldown)) + { + cooldown.timeLeft = max - player.Calamity().furyFuel; + } + else + { + player.AddCooldown(FuryFuel.ID, max); + } + } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + return (player.altFunctionUse != 2); // Right click doesn't use ammo, it's crystal powder not gel + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) { - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); - Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int) (damage * 0.7f), knockback, player.whoAmI); //.7x base damage + player.Calamity().furyRefuelTimer = -50; + if (player.Calamity().furyFuel > 0) + { + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); + Projectile.NewProjectile(source, position, newVel, ModContent.ProjectileType(), (int)(damage * 0.25f), knockback, player.whoAmI); //.25x base damage - Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); - dust.noGravity = true; - dust.color = Color.Orchid; + Dust dust = Dust.NewDustPerfect(position + velocity * 3f + new Vector2(0, -3), ModContent.DustType(), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.5f, 2.5f), 0, default, Main.rand.NextFloat(0.4f, 0.8f)); + dust.noGravity = true; + dust.color = Color.Orchid; - CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Color.White, Color.Orchid, 0.9f, 18, 2f, 2.2f); - GeneralParticleHandler.SpawnParticle(spark); + CritSpark spark = new CritSpark(position + velocity * 3f + new Vector2(0, -3), velocity.RotatedBy(0.25f * player.direction).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.2f, 1.8f), Color.White, Color.Orchid, 0.9f, 18, 2f, 2.2f); + GeneralParticleHandler.SpawnParticle(spark); + player.Calamity().furyFuel -= 15; + } } else { diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index cb31b705a1..0c8764a770 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 74; Item.height = 126; - Item.damage = 116; + Item.damage = 101; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 25; diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 2dec620a10..d88653ec1f 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 150; Item.height = 48; - Item.damage = 2000; + Item.damage = 2150; Item.knockBack = 9.5f; Item.DamageType = DamageClass.Ranged; Item.useTime = 60; diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 67845293c8..bd82b8169e 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1599,6 +1599,12 @@ YoungDukeBuff: { } // Misc + +HyperiusCollapse: { + DisplayName: Hyperius Collapse + Description: You should never see this... +} + PopoBuff: { DisplayName: Popo Description: You are a snowman now! diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 5e2f13bea1..7864f67968 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1042,7 +1042,7 @@ LeviathanAmbergris: { DisplayName: Leviathan Ambergris Tooltip: ''' - 200% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration + 120% increased initial dash velocity, 33% faster dash cooldown, and greatly increased dash deceleration Your dashes are empowered by water, knocking back and damaging nearby enemies with viscous currents Visual effects are reduced if visibility is disabled ''' @@ -1402,7 +1402,7 @@ RadiantOoze: { RaidersTalisman: { DisplayName: Raider's Talisman - Tooltip: Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds + Tooltip: Stealth strikes grant 15% critical strike chance to non-stealth strikes for 10 seconds } RampartofDeities: { @@ -1463,7 +1463,7 @@ RottenBrain: { RottenDogtooth: { DisplayName: Rotten Dogtooth - Tooltip: Stealth strikes inflict Crumbling and deal 8% more damage + Tooltip: Stealth strikes inflict Crumbling for 2.5 seconds and deal 8% more damage } RoverDrive: { @@ -1975,8 +1975,11 @@ VampiricTalisman: { Tooltip: ''' Rogue critical strikes steal enemy life - 12% increased rogue damage + Stealth strikes grant 15% critical strike chance and increased lifesteal to non-stealth strikes for 10 seconds + Stealth strikes inflict Heavy Bleeding and Armor Crunch, and deal 8% more damage + 'Possessing the talisman makes you yearn for blood' ''' + YearningForBlood: THIS ENDLESS HUNGER WON'T END } VeneratedLocket: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson index 31f7ee1828..69bc72edca 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Ammo.hjson @@ -99,7 +99,14 @@ HolyFireBullet: { HyperiusBullet: { DisplayName: Hyperius Bullet - Tooltip: Dazzling multicolor bullets that split into swirling lights on impact + Tooltip: + ''' + Dazzling multicolor bullets that split into swirling lights on impact + Damage that would be dealt from the bullets is instead stored on the target + As more damage is stored, it will begin to overflow, slowly releasing and damaging the enemy + Attacks from sources other than Hyperius Bullets will release some of the charge + Releasing charge in this way deals 15% more damage + ''' } IcicleArrow: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 355c44ffd3..2e345a6c29 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -4283,3 +4283,33 @@ WulfrumPanelWall: { DisplayName: Wulfrum Panel Wall Tooltip: "" } + +ChargedWulfrumWallMountedBulb: { + DisplayName: Mods.CalamityMod.Items.Placeables.ChargedWulfrumWallMountedBulb.DisplayName + Tooltip: "" +} + +WulfrumWallMountedBulb: { + DisplayName: Mods.CalamityMod.Items.Placeables.WulfrumWallMountedBulb.DisplayName + Tooltip: "" +} + +WulfrumSheetWall: { + DisplayName: Wulfrum Sheet Wall + Tooltip: "" +} + +WulfrumSidingWall: { + DisplayName: Wulfrum Siding Wall + Tooltip: "" +} + +Dunesand: { + DisplayName: Dunesand + Tooltip: "" +} + +EutrophicGlassWall: { + DisplayName: Eutrophic Glass Wall + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index f4cbfe288e..d4036cd346 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -7,6 +7,7 @@ AcesHigh: { Spades pierce enemies Diamonds violently explode Clubs split into three + 80% chance to save ammo ''' } @@ -988,7 +989,7 @@ PristineFury: { Tooltip: ''' Fires an intense helix of flames that burst into a column of smoke - to disperse flammable crystalline powder + to disperse a limited supply of flammable crystalline powder that restores over time Powder can be ignited, causuing it to explode for extra damage Both helix flames and other nearby explosions can ignite the powder Uses gel for ammo diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index f6af7b2cf0..055c2e0367 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -107,7 +107,7 @@ HydraHead.DisplayName: Hydra Head HydraHeadLaunch.DisplayName: Hydra Head HydrasBlood.DisplayName: Hydra's Blood HyperiusBulletProj.DisplayName: Hyperius Bullet -HyperiusSplit.DisplayName: Hyperius Bad Time +HyperiusSplit.DisplayName: Hyperius Fragment IcicleArrowProj.DisplayName: Icicle Arrow HailstormBulletProj.DisplayName: Hailstorm Bullet HallowPointRoundProj.DisplayName: Hallow-Point Round diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 2d02702f5b..31c9d81b13 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -78,6 +78,8 @@ HydrothermalSmoke.DisplayName: Smoke HydrothermicFlare.DisplayName: Hydrothermic Flare HydrothermicFlareRogue.DisplayName: Hydrothermic Flare HydrothermicSphere.DisplayName: Hydrothermic Sphere +HyperiusDamage.DisplayName: Hyperius Overflow +HyperiusBleed.DisplayName: Hyperius Bleed JewelSpike.DisplayName: Spike KelvinCatalystStar.DisplayName: Kelvin Catalyst Star LeviAmberDash.DisplayName: Riptide Slam diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 9934224d3d..172f171a73 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -20,7 +20,7 @@ StealthInfoText: ''' // Difficulty UI DifficultyStatusText: "{0} is {1}." -ModeAppend: " Mode" +ModeAppend: "{0} Mode" Active: Active NotActive: Not active DifficultyShiftText: "[c/737373:Hold the 'Shift' key for more information]" @@ -92,6 +92,7 @@ Cooldowns: { DSOCritCooldown: Extra Critical Strike Chance ParryCooldown: Parry Ability Cooldown FleshTotem: Contact Damage Halving Cooldown + FuryFuel: Crystal Powder GaelsRage: Gael's Greatsword Rage Cooldown GlobalDodge: Dodge Cooldown GodSlayerDash: God Slayer Dash Cooldown @@ -114,6 +115,7 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge + RaiderBoost: Extra Critical Chance RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown @@ -587,6 +589,8 @@ Lecherous: { Disenchant: Disenchant // Worldgen Tasks +BetterUnderworld: Creating a smoother underworld +AshIslandLavaRemoval: Removing lava from ash island EvilIslandCorrupt: Adding a putrid floating island EvilIslandCrimson: Adding a grotesque floating island AstralChest: Placing an astral chest diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 198423a825..e5915809b6 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -29,6 +29,7 @@ AddedTooltip: { WarmthPotion: Greatly reduces the duration of Chilled, Frozen, and Glacial State HandWarmer: Provides a regeneration boost while wearing the Snow armor GoldenFishingRod: Its fishing line will never break + Stepstool: Standing on the stool grants 5% increased critical strike chance Tombstones: ''' 13 of any tombstone turns the surrounding area into a graveyard @@ -274,6 +275,12 @@ EditedTooltip: { ApprenticeAltHead: 10% increased summon & magic damage ApprenticeAltShirt: 15% increased summon damage and 10% increased magic damage ApprenticeAltPants: 10% increased summon damage + GravityGlobe: + ''' + Provides 32% increased jump speed and increased fall speed + Press UP to change gravity + Press DOWN to fall faster + ''' } // Buff Descriptions diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index fa66f19776..b0db3298e4 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeBody : ModNPC { diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 9ef8a4450b..ae65703e57 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeBodyAlt : ModNPC { diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index d40200466a..211fbafc4d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -34,6 +34,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class AquaticScourgeHead : ModNPC { diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 0c7761be5b..989e090678 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AquaticScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AquaticScourgeHead))] public class AquaticScourgeTail : ModNPC { diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 67d8668cfb..6287515398 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -121,9 +121,12 @@ namespace CalamityMod.NPCs.Astral { NPC.ai[1] = 0f; - int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); - Main.npc[n].Center = spawnPoint; - Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : CalamityWorld.revenge ? 11f : 10f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int n = NPC.NewNPC(NPC.GetSource_FromAI(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); + Main.npc[n].Center = spawnPoint; + Main.npc[n].velocity = vector * (CalamityWorld.death ? 12f : CalamityWorld.revenge ? 11f : 10f); + } } else if (NPC.ai[1] >= 140f) //oozin dust at the "mouth" { diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 20bc8703cc..6f7ae30efc 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -35,6 +35,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumAureus { [AutoloadBossHead] + [HasPierceResist(singleHitbox: true)] public class AstrumAureus : ModNPC { public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/AureusHit", 4); diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 48520d3f9e..3df41fe42e 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AstrumDeusHead))] public class AstrumDeusBody : ModNPC { diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index e1e14712ef..a7a5e2a516 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -35,6 +35,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class AstrumDeusHead : ModNPC { diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index df4cda8149..ef3f821a1f 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumDeus { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(AstrumDeusHead))] public class AstrumDeusTail : ModNPC { diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index 4ae6fd1ae2..c7144fd7be 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -864,8 +864,15 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } } + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, npc.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < resistanceTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 0f)) + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) calamityGlobalNPC.newAI[1] += 1f; // Calculate contact damage based on velocity diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2518ca4ffb..3fe1377ae9 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -72,7 +72,9 @@ using CalamityMod.UI; using CalamityMod.UI.DebuffSystem; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; +using Microsoft.Build.Evaluation; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Operations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoMod.Utils; @@ -350,6 +352,13 @@ namespace CalamityMod.NPCs public int laserBurnTimer = 0; public int laserBurnStacks = 0; + public bool hyperiusMarked = false; + public int hyperiusDamage = 0; + public static int hyperiusOverflowTime = 100; + public int hyperiusOverflowTimer = hyperiusOverflowTime; + public static float hyperiusLifePercentThreshold = 0.07f; // The % of max life the damage stacks must reach before they start to overflow + public int hyperiusFxTimer = 0; + /// /// Tracks the strength of Calamity's cursor effect; increments by 2 on every frame.
/// If this value reaches , the enemy is afflicted with True Vulnerability Hex. @@ -616,6 +625,15 @@ namespace CalamityMod.NPCs myClone.veriumDoomTimer = veriumDoomTimer; myClone.veriumDoomStacks = veriumDoomStacks; myClone.veriumDoomMarked = veriumDoomMarked; + myClone.laserBurnDamage = laserBurnDamage; + myClone.laserBurnMarked = laserBurnMarked; + myClone.laserBurnStacks = laserBurnStacks; + myClone.laserBurnTimer = laserBurnTimer; + myClone.laserBurnType = laserBurnType; + myClone.hyperiusDamage = hyperiusDamage; + myClone.hyperiusMarked = hyperiusMarked; + myClone.hyperiusOverflowTimer = hyperiusOverflowTimer; + myClone.hyperiusFxTimer = hyperiusFxTimer; myClone.cursorFocus = cursorFocus; myClone.demonSwordImpales = demonSwordImpales; myClone.impalePacketTimer = impalePacketTimer; @@ -3630,6 +3648,16 @@ namespace CalamityMod.NPCs #endregion #region Scale Expert Multiplayer Stats + private const float VanillaScalingFactor_2Players = 1.35f; + private const float VanillaScalingFactor_3Players = 1.9166666666666666f; + + /// + /// Applies Calamity's adjustments to difficulty-based player count stat scaling for NPCs. Calamity only adjusts the health of NPCs and does not touch any other stats. + /// + /// The NPC which is having its stats adjusted. + /// The number of players considered active for the purposes of stat scaling. + /// The vanilla Expert+ multiplayer health scalar value. + /// An arbitrary float to make Master Mode easier. On Master Mode, it is 0.85, otherwise it is 1.0. public override void ApplyDifficultyAndPlayerScaling(NPC npc, int numPlayers, float balance, float bossAdjustment) { // Do absolutely nothing in single player, or in multiplayer with only one player connected. @@ -3640,43 +3668,72 @@ namespace CalamityMod.NPCs bool scalesLikeBoss = countsAsBoss || BossHPScalingList.List.Contains(npc.type); bool isCalamityNPC = npc.ModNPC != null && npc.ModNPC.Mod == CalamityMod.Instance; - // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. - if (scalesLikeBoss || isCalamityNPC) + // 14APR2025: Ozzatron: Reworked how Calamity changes the health of Expert+ multiplayer bosses + // Non-boss enemies that receive scaling in Expert+ are still reduced via the old formula + // + // TL;DR: + // - 2 players goes from 135% health to 175% health + // - 3 players goes from 191.6% health to 225% health + // - 4 players and beyond are unedited (4 players is 262.8% for reference) + + // This case applies to all bosses: vanilla, Calamity, and other mods, and anything that is supposed to scale like a boss. + if (countsAsBoss || scalesLikeBoss) { - double scalar; - switch (numPlayers) // Decrease HP in multiplayer before vanilla scaling - { - case 1: - scalar = 1.0; - break; + double adjustmentFactor = 1.0; - case 2: - scalar = 0.9; // 1.8 - break; + // The 2-player boss case is too easy; 1.35x health does not even come close to justify being able to respawn. + if (numPlayers == 2) + adjustmentFactor = BalancingConstants.ExpertHealthScalingOverride_2Players / VanillaScalingFactor_2Players; - case 3: - scalar = 0.82; // 2.46 - break; + // Similarly, the 3-player boss case is too easy, given the considerably higher damage output available. + else if (numPlayers == 3) + adjustmentFactor = BalancingConstants.ExpertHealthScalingOverride_3Players / VanillaScalingFactor_3Players; - case 4: - scalar = 0.76; // 3.04 - break; + // Cases beyond 3 players are already sufficiently scaled by vanilla and continue to scale harder with more players. - case 5: - scalar = 0.71; // 3.55 - break; - - case 6: - scalar = 0.67; // 4.02 - break; - - default: - scalar = 0.64; // 4.48 + 0.64 per player beyond 7 - break; - } - - npc.lifeMax = (int)Math.Round(npc.lifeMax * scalar); + // Apply the adjustment factor, if any. No other changes are made to bosses or boss-like NPCs. + npc.life = (int)Math.Round(npc.life * adjustmentFactor); + return; } + + // Do not touch non-boss NPCs from vanilla or other mods. + if (!isCalamityNPC) + return; + + // Reduction to multiplayer HP scaling for non-boss Calamity enemies in Expert+ + double scalar; + switch (numPlayers) + { + case 1: + scalar = 1.0; + break; + + case 2: + scalar = 0.9; // 1.8 + break; + + case 3: + scalar = 0.82; // 2.46 + break; + + case 4: + scalar = 0.76; // 3.04 + break; + + case 5: + scalar = 0.71; // 3.55 + break; + + case 6: + scalar = 0.67; // 4.02 + break; + + default: + scalar = 0.64; // 4.48 + 0.64 per player beyond 7 + break; + } + + npc.lifeMax = (int)Math.Round(npc.lifeMax * scalar); } #endregion @@ -5829,6 +5886,45 @@ namespace CalamityMod.NPCs spark.penetrate = 3; } } + if (hyperiusMarked) + { + if (hyperiusFxTimer < 20) + hyperiusFxTimer++; + else if (hyperiusFxTimer > 20) + hyperiusFxTimer = (int)Utils.Lerp(hyperiusFxTimer, 20, 0.2f); + + float threshold = ((float)(hyperiusDamage) / (float)(npc.lifeMax)); + int overflowSpeed = (int)Utils.Remap(threshold, hyperiusLifePercentThreshold, 0.35f, 1, 34); + if (threshold > hyperiusLifePercentThreshold) // If the stored damage is greater than the life % cap of the target's max health, rapily deal a % of the stored damage to the enemy to drain it + { + bool enemyIsNotArmored = (npc.defense < 1000 && !unbreakableDR && DR <= 0.9f && !npc.dontTakeDamage && !npc.immortal); + if (enemyIsNotArmored) + hyperiusOverflowTimer -= overflowSpeed; + if (hyperiusOverflowTimer <= 0) + { + hyperiusOverflowTimer = hyperiusOverflowTime; + + float damagePercent = 0.07f; // The % of stacks drained when you're over the cap + int damage = (int)Math.Max((int)((float)(hyperiusDamage) * damagePercent), 1); + hyperiusDamage -= damage; + + // Spawn "bleed" hit + // Uses a seperate projectile so that the hit takes defense and DR into account + Projectile overflow = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), damage, 0, -1, npc.whoAmI); + overflow.DamageType = DamageClass.Ranged; + if (hyperiusFxTimer >= 20) + hyperiusFxTimer = 35; + + if (hyperiusDamage <= 0) + { + hyperiusDamage = 0; + hyperiusMarked = false; + } + } + } + } + else if (hyperiusFxTimer > 0) + hyperiusFxTimer--; if ((laserBurnTimer <= 0 || laserBurnDamage >= npc.life * 1.5f) && laserBurnMarked && laserBurnType > 0) { @@ -6508,9 +6604,6 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.4f; } - if (PierceResistList.Includes(npc.type)) - PierceResistGlobal(projectile, npc, ref modifiers); - if (modPlayer.camper && !player.StandingStill()) modifiers.SourceDamage *= 0.1f; @@ -6520,29 +6613,8 @@ namespace CalamityMod.NPCs if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) EditWhipTagDamage(projectile, npc, ref modifiers); } + #endregion - // Generalized pierce resistance that stacks with all other resistances for some specific bosses defined in a list. - // The actual resistance formula isn't really a problem, but the implementation of this desperately needs refactoring. - private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) - { - // Thanatos segments do not trigger pierce resistance if they are closed - if (ThanatosIDList.Includes(npc.type) && unbreakableDR) - return; - - // Isolates projectiles which ignore pierce resist only on Leviathan and Astrum Aureus - if ((npc.type == NPCType() || npc.type == NPCType()) && PierceResistExceptionLeviAureusList.Includes(projectile.type)) - return; - - float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; - if (damageReduction > CalamityGlobalProjectile.PierceResistCap) - damageReduction = CalamityGlobalProjectile.PierceResistCap; - - modifiers.FinalDamage *= 1f - damageReduction; - - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo) - projectile.Calamity().timesPierced++; - } - #endregion #region OnHitBy overrides public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { @@ -6550,17 +6622,29 @@ namespace CalamityMod.NPCs { CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); } - } - - public override void OnHitByItem(NPC npc, Player player, Item item, NPC.HitInfo hit, int damagedone) - { - if (IsArmored()) + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) { - CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); + float rate = (Main.GlobalTimeWrappedHourly * 3f); + List eColors = new List() + { + Color.Yellow, + Color.Magenta, + Color.Red, + Color.Cyan, + Color.Lime + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + CombatText.NewText(npc.Hitbox, usedColor, damagedone, hit.Crit, true); } + } #endregion - #region Whip Tag + + #region Whip Tag // Make whip tags multiplicative, by effectively reversing the process done to it private void EditWhipTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) { @@ -6677,7 +6761,8 @@ namespace CalamityMod.NPCs NPCType() }); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, randomType); + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, randomType); } } @@ -7261,6 +7346,19 @@ namespace CalamityMod.NPCs DeerclopsAI.outerBorder = DeerclopsAI.maxDRIncreaseDistance * 5f; } + // Despawn Blazing Wheels and Spike Balls when a boss spawns so they're not annoying and stay in the arena + if (npc.boss) + { + foreach (NPC n in Main.ActiveNPCs) + { + if (n.type == NPCID.BlazingWheel || n.type == NPCID.SpikeBall) + { + n.active = false; + n.netUpdate = true; + } + } + } + if (npc.type != NPCID.VoodooDemon) return; @@ -7384,9 +7482,69 @@ namespace CalamityMod.NPCs if (heavybleeding > 0) HeavyBleeding.DrawEffects(npc, ref drawColor); + if (hyperiusFxTimer > 0) + { + float rate = (Main.GlobalTimeWrappedHourly * 5); + List eColors = new List() + { + Color.Yellow, + Color.Magenta, + Color.Red, + Color.Cyan, + Color.Lime + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Texture2D tex2 = Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D sparkle = Request("CalamityMod/Particles/BloomLineSoftEdge").Value; + Vector2 drawPosition = npc.Center - Main.screenPosition; + float drawRotation = npc.rotation + (npc.spriteDirection == -1 ? MathHelper.Pi : 0f); + + float power = (float)(Math.Pow(Utils.GetLerpValue(0, 20, hyperiusFxTimer, true), 3)) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 100, 1.4f, 0.5f); + for (int i = 0; i < 4; i++) + { + float iMult = (1 + 0.25f * i); + Main.EntitySpriteDraw(tex2, drawPosition, null, Color.Lerp(usedColor, Color.White, i * 0.1f) with { A = 0 } * 0.6f, Main.rand.NextFloat(-5f, 5f), tex2.Size() * 0.5f, new Vector2(1f, 0.8f) * 0.35f * Main.rand.NextFloat(0.9f, 1.1f) * iMult * power * (Utils.GetLerpValue(0, 20, hyperiusFxTimer)), SpriteEffects.None); + + for (int b = -1; b <= 1; b += 2) + { + float uncappedSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 8f / MathHelper.Pi); + float sine = MathHelper.Lerp(Math.Abs(uncappedSine), 0.75f, 0.75f); + Vector2 scale = new Vector2((0.25f / iMult) + (0.7f * (1 - sine)), 1.1f * sine * iMult) * power * 0.05f; + float rotation = MathHelper.PiOver4 * b * uncappedSine; + Main.EntitySpriteDraw(sparkle, drawPosition, null, Color.Lerp(usedColor, Color.White, i * 0.1f) with { A = 0 }, rotation, sparkle.Size() * 0.5f, scale, SpriteEffects.None); + } + } + } + if (laceration > 0) Laceration.DrawEffects(npc, ref drawColor); + if (laserBurnTimer > 0) + { + int particleChance = Math.Max(3, 10 - (laserBurnStacks / 3)); + if (laserBurnTimer % particleChance == 0) + { + Vector2 randPosition = new Vector2(npc.position.X + Main.rand.Next(0, npc.width), npc.position.Y + Main.rand.Next(0, npc.height)); + + Dust dust = Dust.NewDustPerfect(randPosition, Effects.ArsenalEffects.ArsenalLaserDust); + dust.velocity = ((Vector2.UnitX * 3 * (laserBurnStacks * 0.03f)).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1f)) + npc.velocity * 0.5f; + dust.scale = Main.rand.NextFloat(0.55f, 0.7f) + laserBurnStacks * 0.01f; + dust.noGravity = true; + dust.color = Color.Red; + dust.fadeIn = laserBurnStacks * 0.3f; + } + if (laserBurnType == 0) + { + Main.NewText("No Burn Type Set", Color.OrangeRed); + laserBurnMarked = false; + laserBurnTimer = 0; + } + } + // These draw effects do not include Miracle Blight's shader if (miracleBlight > 0) MiracleBlight.DrawEffects(npc, ref drawColor); @@ -7430,28 +7588,6 @@ namespace CalamityMod.NPCs } } - if (laserBurnTimer > 0) - { - int particleChance = Math.Max(3, 10 - (laserBurnStacks / 3)); - if (laserBurnTimer % particleChance == 0) - { - Vector2 randPosition = new Vector2(npc.position.X + Main.rand.Next(0, npc.width), npc.position.Y + Main.rand.Next(0, npc.height)); - - Dust dust = Dust.NewDustPerfect(randPosition, Effects.ArsenalEffects.ArsenalLaserDust); - dust.velocity = ((Vector2.UnitX * 3 * (laserBurnStacks * 0.03f)).RotatedByRandom(100) * Main.rand.NextFloat(0.85f, 1f)) + npc.velocity * 0.5f; - dust.scale = Main.rand.NextFloat(0.55f, 0.7f) + laserBurnStacks * 0.01f; - dust.noGravity = true; - dust.color = Color.Red; - dust.fadeIn = laserBurnStacks * 0.3f; - } - if (laserBurnType == 0) - { - Main.NewText("No Burn Type Set", Color.OrangeRed); - laserBurnMarked = false; - laserBurnTimer = 0; - } - } - if (voidfrost > 0) Voidfrost.DrawEffects(npc, ref drawColor); diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 7971485fc8..404345f96e 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -142,6 +142,7 @@ namespace CalamityMod.NPCs "Mihai", // <@!373941893467209730> (cmihaii.) "Cooler Kevin", // <@!614126424751603714> (exellent.) "Dinkleberg", // <@!581993958037520404> (hyperionzx) + "Wamy", }; private static readonly string[] MechanicNames = { @@ -225,6 +226,7 @@ namespace CalamityMod.NPCs private static readonly string[] TaxCollectorNames = { "Emmett", + "Casino King Gray", // <@!555512087711973390> (eternalgrayson) }; private static readonly string[] TravelingMerchantNames = { diff --git a/NPCs/CalamityPierceResistance.cs b/NPCs/CalamityPierceResistance.cs new file mode 100644 index 0000000000..c69f0b3ad7 --- /dev/null +++ b/NPCs/CalamityPierceResistance.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using CalamityMod.Balancing; +using CalamityMod.Items.Accessories; +using CalamityMod.Projectiles; +using CalamityMod.Systems.Collections; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Core; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs +{ + public sealed class PierceResistNPC : GlobalNPC + { + private static HashSet exemptProjectiles; + private static HashSet pierceResistNPC; + private static HashSet singleHitboxNPC; + private static Dictionary singleHitboxExemptProjectiles; + + public override void Load() + { + exemptProjectiles = new(); + pierceResistNPC = new(); + singleHitboxNPC = new(); + singleHitboxExemptProjectiles = new(); + } + + public override void Unload() + { + exemptProjectiles?.Clear(); + exemptProjectiles = null; + pierceResistNPC?.Clear(); + pierceResistNPC = null; + singleHitboxNPC?.Clear(); + singleHitboxNPC = null; + singleHitboxExemptProjectiles?.Clear(); + singleHitboxExemptProjectiles = null; + } + + public override void SetStaticDefaults() + { + // Specific vanilla NPC's with pierce resistance + pierceResistNPC.Add(NPCID.EaterofWorldsHead); + pierceResistNPC.Add(NPCID.EaterofWorldsBody); + pierceResistNPC.Add(NPCID.EaterofWorldsTail); + pierceResistNPC.Add(NPCID.Creeper); + pierceResistNPC.Add(NPCID.TheDestroyer); + pierceResistNPC.Add(NPCID.TheDestroyerBody); + pierceResistNPC.Add(NPCID.TheDestroyerTail); + + // Specific vanilla projectile exemptions + exemptProjectiles.Add(ProjectileID.Arkhalis); + exemptProjectiles.Add(ProjectileID.ChargedBlasterLaser); + exemptProjectiles.Add(ProjectileID.ClingerStaff); + exemptProjectiles.Add(ProjectileID.FinalFractal); + exemptProjectiles.Add(ProjectileID.FlyingKnife); + exemptProjectiles.Add(ProjectileID.LastPrismLaser); + exemptProjectiles.Add(ProjectileType()); // Included here as it does not have a projectile + exemptProjectiles.Add(ProjectileID.MonkStaffT3); + exemptProjectiles.Add(ProjectileID.PiercingStarlight); + exemptProjectiles.Add(ProjectileID.SandnadoFriendly); + exemptProjectiles.Add(ProjectileID.Terragrim); + + // Specific vanilla projectile single hitbox exemptions + singleHitboxExemptProjectiles[ProjectileID.NettleBurstEnd] = true; + singleHitboxExemptProjectiles[ProjectileID.NettleBurstLeft] = true; + singleHitboxExemptProjectiles[ProjectileID.NettleBurstRight] = true; + singleHitboxExemptProjectiles[ProjectileID.PrincessWeapon] = true; + + var projectileTypes = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code) + .Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ModProjectile))); + + foreach (var type in projectileTypes) + { + try + { + var pierceResistException = type.GetCustomAttribute(); + if (pierceResistException == null) + continue; + + var projectileTypeMethod = typeof(ModContent).GetMethod(nameof(ModContent.ProjectileType)); + var projectileTypeActualMethod = projectileTypeMethod.MakeGenericMethod(type); + int projectileType = (int)projectileTypeActualMethod.Invoke(null, null); + + if (pierceResistException.OnlyForSingleHitbox) + { + singleHitboxExemptProjectiles[projectileType] = true; + continue; + } + else + { + exemptProjectiles.Add(projectileType); + } + } + catch (Exception e) + { + CalamityMod.Instance.Logger.Error($"Exception thrown while evaluating type \"{type.Name}\": {e}"); + } + } + + var npcTypes = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code) + .Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ModNPC))); + + foreach (var type in npcTypes) + { + try + { + var hasPierceResist = type.GetCustomAttribute(); + if (hasPierceResist == null) + continue; + + var npcTypeMethod = typeof(ModContent).GetMethod(nameof(ModContent.NPCType)); + var npcTypeActualMethod = npcTypeMethod.MakeGenericMethod(type); + int npcType = (int)npcTypeActualMethod.Invoke(null, null); + + pierceResistNPC.Add(npcType); + if (hasPierceResist.SingleHitbox) + singleHitboxNPC.Add(npcType); + } + catch (Exception e) + { + CalamityMod.Instance.Logger.Error($"Exception thrown while evaluating type \"{type.Name}\": {e}"); + } + } + } + + public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref NPC.HitModifiers modifiers) + { + // Skip if NPC does not have pierce resistance or projectile is exempt + if (!pierceResistNPC.Contains(npc.type) || exemptProjectiles.Contains(projectile.type)) + return; + + // Skip if the projectile is exempt on single hitboxes and the NPC is a single hitbox + if (singleHitboxExemptProjectiles.TryGetValue(projectile.type, out bool isSingleHitboxExempt) && isSingleHitboxExempt && singleHitboxNPC.Contains(npc.type)) + return; + + PierceResistGlobal(projectile, npc, ref modifiers); + } + + // Generalized pierce resistance that stacks with all other resistances for some specific bosses defined in a list. + private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) + { + // Thanatos segments do not trigger pierce resistance if they are closed + if (ThanatosIDList.Includes(npc.type) && npc.GetGlobalNPC().unbreakableDR) + return; + + float damageReduction = projectile.Calamity().timesPierced * BalancingConstants.PierceResistHarshness; + if (damageReduction > BalancingConstants.PierceResistCap) + damageReduction = BalancingConstants.PierceResistCap; + + modifiers.FinalDamage *= 1f - damageReduction; + + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo) + projectile.Calamity().timesPierced++; + } + } +} diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 52c4728c43..52f34259d9 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.CeaselessVoid { + [HasPierceResist] public class DarkEnergy : ModNPC { private bool start = true; diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 32cbca922b..4127344037 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -214,8 +214,8 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.ai[0] < 2f) { - int mushBombAmt = phase4 ? 12 : phase3 ? 6 : phase2 ? 3 : 1; - float fireRate = phase4 ? 6f : phase3 ? 4f : phase2 ? 2f : 1f; + int mushBombAmt = phase4 ? 6 : phase3 ? 3 : phase2 ? 2 : 1; + float fireRate = phase4 ? 6f : phase3 ? 3f : phase2 ? 2f : 1f; NPC.localAI[3] += fireRate; if (NPC.ai[3] == 0f) { @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.Crabulon if (Main.netMode != NetmodeID.MultiplayerClient) { - float yVelocity = death ? 1f : expertMode ? 2.5f : 5f; + float yVelocity = death ? 1f : expertMode ? 2.5f : 4f; Vector2 projectileVelocity = (Vector2.Normalize(player.Center - NPC.Center) * mushBombSpeed) - Vector2.UnitY * yVelocity; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); } @@ -257,12 +257,12 @@ namespace CalamityMod.NPCs.Crabulon if (phase2) NPC.ai[1] += 1f; if (phase3) - NPC.ai[1] += 2f; + NPC.ai[1] += 1f; if (NPC.Distance(player.Center) < 160f) NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; // Gets tired easily in final phase. - Fabsol - float idleTime = phase4 ? 480f : death ? 30f : expertMode ? 60f : 120f; + float idleTime = phase4 ? 480f : death ? 60f : expertMode ? 90f : 120f; if (NPC.ai[1] >= idleTime) { bool deathModeTripleStomp = Main.rand.NextBool() && death && phase2; @@ -283,9 +283,9 @@ namespace CalamityMod.NPCs.Crabulon if (phase2) walkingVelocity += 0.5f; if (phase3) - walkingVelocity += 1f; + walkingVelocity += 0.75f; if (phase4) - walkingVelocity += 1.5f; + walkingVelocity += 1f; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) walkingVelocity *= 2f; @@ -320,11 +320,11 @@ namespace CalamityMod.NPCs.Crabulon Vector2 collisionCheckPosition = new Vector2(NPC.Center.X - 40, NPC.position.Y + NPC.height - 20); bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f; - float acceleration = death ? 0.1f : expertMode ? 0.05f : 0.025f; - float acceleration2 = death ? 0.8f : expertMode ? 0.4f : 0.2f; + float acceleration = death ? 0.075f : expertMode ? 0.05f : 0.03f; + float acceleration2 = death ? 0.6f : expertMode ? 0.4f : 0.25f; if (fallDownOnTopOfTarget) { - float fallSpeed = death ? 2f : expertMode ? 1f : 0.5f; + float fallSpeed = death ? 1.5f : expertMode ? 1f : 0.5f; NPC.velocity.Y += fallSpeed; } else if (Collision.SolidCollision(collisionCheckPosition, 80, 20)) @@ -337,7 +337,7 @@ namespace CalamityMod.NPCs.Crabulon else NPC.velocity.Y -= acceleration2; - float upwardSpeedCap = death ? 16f : expertMode ? 8f : 4f; + float upwardSpeedCap = death ? 9f : expertMode ? 6f : 4f; if (NPC.velocity.Y < -upwardSpeedCap) NPC.velocity.Y = -upwardSpeedCap; } @@ -357,7 +357,7 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.Distance(player.Center) < 160f) NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; - float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 120f * (1f - lifeRatio) : 0f); + float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f); if (NPC.ai[1] >= stompPhaseGateValue) { NPC.noGravity = false; @@ -417,7 +417,7 @@ namespace CalamityMod.NPCs.Crabulon } else if (NPC.ai[1] == -1f) { - float maxVelocityXIncrease = death ? 6f : 4f; + float maxVelocityXIncrease = death ? 4f : 3f; float maxVelocityYIncrease = death ? 3f : 2f; float velocityX = 6f + (expertMode ? (maxVelocityXIncrease * (1f - lifeRatio)) : 0f); float velocityY = 12f + (expertMode ? (maxVelocityYIncrease * (1f - lifeRatio)) : 0f); @@ -531,7 +531,7 @@ namespace CalamityMod.NPCs.Crabulon destination *= projectileVelocity; // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol - int numProj = bossRush ? 32 : phase4 ? 18 : CalamityWorld.death ? (phase3 ? 12 : 20) : 16; + int numProj = bossRush ? 24 : phase4 ? 14 : CalamityWorld.death ? (phase3 ? 10 : 16) : 12; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { @@ -556,7 +556,7 @@ namespace CalamityMod.NPCs.Crabulon destination *= projectileVelocity; // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol - int numProj = bossRush ? 20 : phase4 ? 10 : (phase3 && death) ? 6 : 10; + int numProj = bossRush ? 16 : phase4 ? 8 : (phase3 && death) ? 6 : 8; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { @@ -636,21 +636,21 @@ namespace CalamityMod.NPCs.Crabulon if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) { - float slowDownMultiplier = death ? 0.84f : expertMode ? 0.92f : 0.96f; + float slowDownMultiplier = death ? 0.9f : expertMode ? 0.93f : 0.96f; NPC.velocity.X *= slowDownMultiplier; - float fallSpeedIncrease = phase4 ? 0.36f : death ? 0.24f : expertMode ? 0.12f : 0.06f; + float fallSpeedIncrease = phase4 ? 0.2f : death ? 0.15f : expertMode ? 0.12f : 0.09f; NPC.velocity.Y += fallSpeedIncrease; } else { - float velocityX = (death ? 0.2f : expertMode ? 0.15f : 0.1f) + 0.05f * enrageScale; + float velocityX = (death ? 0.15f : expertMode ? 0.125f : 0.1f) + 0.05f * enrageScale; if (NPC.direction < 0) NPC.velocity.X -= velocityX; else if (NPC.direction > 0) NPC.velocity.X += velocityX; - float maxVelocityXIncrease = death ? 6f : 4f; + float maxVelocityXIncrease = death ? 4f : 3f; float maxVelocityX = 6f + (expertMode ? (maxVelocityXIncrease * (1f - lifeRatio)) : 0f); if (revenge) @@ -713,19 +713,21 @@ namespace CalamityMod.NPCs.Crabulon if (!player.dead && player.active && Math.Abs(NPC.Center.X - player.Center.X) / 16f <= despawnDistanceInTiles) center = player.Center; - center.Y -= 480f; + center.Y -= 320f + Math.Abs(player.Center.Y - NPC.Center.Y); center.X += Math.Abs(player.Center.X - NPC.Center.X) * ((player.Center.X - NPC.Center.X > 0f) ? 1 : -1); NPC.ai[2] = 1f; NPC.ai[3] = NPC.Bottom.Y; NPC.noTileCollide = true; + + float leapVelocity = bossRush ? 24f : death ? 18f : 16f; NPC.velocity = center - NPC.Center; NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero); - NPC.velocity *= bossRush ? 24f : death ? 21f : 18f; + NPC.velocity *= leapVelocity; - float jumpVelocityMin = -12f; - if (NPC.velocity.Y > jumpVelocityMin) - NPC.velocity.Y = jumpVelocityMin; + float velocityMinY = -leapVelocity; + if (NPC.velocity.Y > velocityMinY) + NPC.velocity.Y = velocityMinY; NPC.ForceNetUpdate(); } @@ -757,8 +759,12 @@ namespace CalamityMod.NPCs.Crabulon } } + // Collide with tiles if falling and beyond a certain threshold + if (NPC.velocity.Y >= 0f && NPC.Bottom.Y >= NPC.ai[3] - NPC.height) + NPC.noTileCollide = false; + // Impact and create lines of mushrooms that spread out along the ground (similar to an old Providence attack) - if (NPC.Bottom.Y >= NPC.ai[3] - NPC.height && NPC.velocity.Y >= 0f) + if (NPC.Bottom.Y >= NPC.ai[3] || NPC.velocity.Y == 0f) { SoundEngine.PlaySound(SlamSound, NPC.Center); @@ -766,7 +772,6 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] = 0f; NPC.ai[2] = 0f; NPC.ai[3] = 0f; - NPC.noTileCollide = false; NPC.netUpdate = true; int type = ModContent.ProjectileType(); @@ -775,7 +780,7 @@ namespace CalamityMod.NPCs.Crabulon if (Main.netMode != NetmodeID.MultiplayerClient) { float xVelocity = death ? 2f : 1f; - int numProj = 5; + int numProj = death ? 5 : 3; Vector2 initialVelocity = Vector2.UnitX * xVelocity; Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(0f, 8f); @@ -821,6 +826,8 @@ namespace CalamityMod.NPCs.Crabulon } } } + else + NPC.velocity.X *= 0.8f; } // Stomp three times quickly, creating lines of mushrooms and a column of mushrooms that slowly fall down diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index a784898e74..3dd7b59380 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -20,10 +20,10 @@ namespace CalamityMod.NPCs.DesertScourge public bool flies = false; private bool tailSpawned = false; - public const float SegmentVelocity_Expert = 14f; - public const float SegmentVelocity_Master = 16.5f; + public const float SegmentVelocity_Expert = 11f; + public const float SegmentVelocity_Master = 13.5f; public const float SegmentVelocity_GoodWorld = 19f; - public const float SegmentVelocity_ZenithSeed = 21.5f; + public const float SegmentVelocity_ZenithSeed = 22f; public const float OpenMouthForBiteDistance = 220f; @@ -140,12 +140,12 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining. float lifeRatio = NPC.life / (float)NPC.lifeMax; - float speed = death ? 0.18f : 0.16f; - float turnSpeed = death ? 0.26f : 0.22f; + float speed = death ? 0.105f : 0.085f; + float turnSpeed = death ? 0.21f : 0.17f; speed += speed * 0.4f * (1f - lifeRatio); turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); - speed += 0.16f * enrageScale; - turnSpeed += 0.22f * enrageScale; + speed += 0.085f * enrageScale; + turnSpeed += 0.17f * enrageScale; if (Main.getGoodWorld) { @@ -455,7 +455,7 @@ namespace CalamityMod.NPCs.DesertScourge } Vector2 destination = Main.player[NPC.target].Center; - if (NPC.Distance(destination) > 1000f) + if (NPC.Distance(destination) > (getMad ? 750f : 1000f)) NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; // Calculate contact damage based on velocity diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index d6cd2de839..08784a1e62 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -22,8 +22,8 @@ namespace CalamityMod.NPCs.DesertScourge public bool flies = false; private bool tailSpawned = false; - public const float SegmentVelocity_Expert = 12f; - public const float SegmentVelocity_Master = 14f; + public const float SegmentVelocity_Expert = 10f; + public const float SegmentVelocity_Master = 12f; public const float SegmentVelocity_GoodWorld = 16f; public const float SegmentVelocity_ZenithSeed = 18f; @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.DesertScourge bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - float enrageScale = bossRush ? 1f : getMad ? 0.25f : 0f; + float enrageScale = bossRush ? 1f : getMad ? 0.5f : 0f; if (biomeEnraged) { NPC.Calamity().CurrentlyEnraged = !bossRush; @@ -136,12 +136,12 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining. float lifeRatio = NPC.life / (float)NPC.lifeMax; - float speed = death ? 0.16f : 0.14f; - float turnSpeed = death ? 0.24f : 0.2f; + float speed = death ? 0.09f : 0.07f; + float turnSpeed = death ? 0.18f : 0.14f; speed += speed * 0.4f * (1f - lifeRatio); turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); - speed += 0.14f * enrageScale; - turnSpeed += 0.2f * enrageScale; + speed += 0.07f * enrageScale; + turnSpeed += 0.14f * enrageScale; if (Main.getGoodWorld) { @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.alpha < 0) NPC.alpha = 0; - if (getMad && NPC.Distance(Main.player[NPC.target].Center) > 240f) + if (NPC.Distance(Main.player[NPC.target].Center) > 360f) { if ((Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) NPC.Calamity().newAI[0] += 1f; @@ -171,8 +171,8 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (revenge ? 10f : 8f); - int numProj = death ? 6 : 4; - int spread = masterMode ? 28 : 20; + int numProj = death ? 6 : getMad ? 4 : 3; + int spread = masterMode ? 28 : getMad ? 22 : 20; if (masterMode) { numProj += 2; @@ -496,7 +496,7 @@ namespace CalamityMod.NPCs.DesertScourge } Vector2 destination = Main.player[NPC.target].Center; - if (NPC.Distance(destination) > 1000f) + if (NPC.Distance(destination) > (getMad ? 750f : 1000f)) NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; // Calculate contact damage based on velocity diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 4f71aff1f7..522dbcd0ef 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(DesertScourgeHead))] public class DesertScourgeBody : ModNPC { diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index bdcf8bfb0d..b9edf2b11a 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -32,6 +32,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class DesertScourgeHead : ModNPC { @@ -39,9 +40,9 @@ namespace CalamityMod.NPCs.DesertScourge private bool tailSpawned = false; public bool playRoarSound = false; - public const float SegmentVelocity_Normal = 12f; - public const float SegmentVelocity_Expert = 15f; - public const float SegmentVelocity_Master = 18f; + public const float SegmentVelocity_Normal = 10f; + public const float SegmentVelocity_Expert = 12.5f; + public const float SegmentVelocity_Master = 15f; public const float SegmentVelocity_GoodWorld = 21f; public const float SegmentVelocity_ZenithSeed = 24f; @@ -239,23 +240,23 @@ namespace CalamityMod.NPCs.DesertScourge float burrowDistance = hide ? BurrowDistance_Hide : bossRush ? BurrowDistance_BossRush : BurrowDistance; - float speed = death ? 0.15f : 0.12f; - float turnSpeed = death ? 0.3f : 0.24f; + float speed = death ? 0.105f : 0.085f; + float turnSpeed = death ? 0.21f : 0.17f; if (expertMode) { - speed += speed * 0.2f * (1f - lifeRatio); - turnSpeed += turnSpeed * 0.2f * (1f - lifeRatio); + speed += speed * 0.4f * (1f - lifeRatio); + turnSpeed += turnSpeed * 0.4f * (1f - lifeRatio); } if (revenge) { - speed += (death ? 0.05f : 0.04f) * (1f - lifeRatio); - turnSpeed += (death ? 0.1f : 0.08f) * (1f - lifeRatio); + speed += (death ? 0.03f : 0.02f) * (1f - lifeRatio); + turnSpeed += (death ? 0.06f : 0.04f) * (1f - lifeRatio); } - speed += 0.12f * enrageScale; - turnSpeed += 0.24f * enrageScale; + speed += 0.085f * enrageScale; + turnSpeed += 0.17f * enrageScale; if (Main.getGoodWorld) { diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 31d98c95c6..b969562016 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DesertScourge { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(DesertScourgeHead))] public class DesertScourgeTail : ModNPC { diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 51946e7d4c..c7d8ed7d33 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -13,6 +13,7 @@ using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))] public class CosmicGuardianBody : ModNPC { diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index d85e147d7e..1a9b1bd130 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [HasPierceResist] [LongDistanceNetSync] public class CosmicGuardianHead : ModNPC { diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 7bcc59229f..be71961cd5 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -13,6 +13,7 @@ using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.DevourerofGods { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))] public class CosmicGuardianTail : ModNPC { diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 8e1b589f00..c21a63a533 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -41,6 +41,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { [AutoloadBossHead] + [HasPierceResist] public class AresBody : ModNPC { // Used for loot diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 752a7ab409..7234ce1600 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresGaussNuke : ModNPC { public enum Phase diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 6d284046cd..81107f0d5a 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -21,6 +21,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresLaserCannon : ModNPC { public enum Phase diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index a74ca1699b..65d8a89c91 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -20,6 +20,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresPlasmaFlamethrower : ModNPC { public enum Phase diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index c288552f89..50617f35d7 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -19,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { + [HasPierceResist] public class AresTeslaCannon : ModNPC { public enum Phase diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index e5cdfab281..e2eda50072 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosBody1 : ModNPC { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 5d63ecff3b..411630ec67 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosBody2 : ModNPC { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index edd68d41ba..3c7fa5266d 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -22,6 +22,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync] public class ThanatosHead : ModNPC { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index f94c77c2ff..8faffda3d8 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(ThanatosHead))] public class ThanatosTail : ModNPC { diff --git a/NPCs/HasPierceResistAttribute.cs b/NPCs/HasPierceResistAttribute.cs new file mode 100644 index 0000000000..6c568d6568 --- /dev/null +++ b/NPCs/HasPierceResistAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + /// + /// This attribute gives an NPC universal pierce resistance + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public sealed class HasPierceResistAttribute : Attribute + { + /// + /// Set this to true to indicate this NPC has a single large hitbox which typical piercing projectiles can hit multiple times. Certain weapons are exempt from pierce resistance on single-hitbox targets. + /// + public bool SingleHitbox { get; } + + public HasPierceResistAttribute(bool singleHitbox = false) + { + SingleHitbox = singleHitbox; + } + } +} diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 3e991ea360..ee17a56ea4 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -34,6 +34,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Leviathan { [AutoloadBossHead] + [HasPierceResist(singleHitbox: true)] public class Leviathan : ModNPC { private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 74f2e628bc..cbc5e97425 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadLarge))] public class PerforatorBodyLarge : ModNPC { diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 308d4425cf..6678323c28 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadMedium))] public class PerforatorBodyMedium : ModNPC { diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 9adad9028d..da460fae1f 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadSmall))] public class PerforatorBodySmall : ModNPC { diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index dccf72a1a0..03e673b126 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class PerforatorHeadLarge : ModNPC { diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 966f472478..3307d11b13 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -16,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class PerforatorHeadMedium : ModNPC { diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 469c3bb75b..e833168040 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -17,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] + [HasPierceResist] [LongDistanceNetSync] public class PerforatorHeadSmall : ModNPC { diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index aac8b21f32..a16079a3c2 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadLarge))] public class PerforatorTailLarge : ModNPC { diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 1d3528dd39..66712f3c70 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -15,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadMedium))] public class PerforatorTailMedium : ModNPC { diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 516c5a83d1..433f7586b5 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(PerforatorHeadSmall))] public class PerforatorTailSmall : ModNPC { diff --git a/NPCs/PierceResistExceptionAttribute.cs b/NPCs/PierceResistExceptionAttribute.cs new file mode 100644 index 0000000000..f4a410ab94 --- /dev/null +++ b/NPCs/PierceResistExceptionAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + /// + /// This attribute makes projectiles exempt from pierce resistance + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] + public sealed class PierceResistExceptionAttribute : Attribute + { + /// + /// Set this to true to indicate this projectile is only exempt from piercing resistance when attacking NPCs with a single large hitbox. + /// + public bool OnlyForSingleHitbox { get; } + + public PierceResistExceptionAttribute(bool onlyForSingleHitbox = false) + { + OnlyForSingleHitbox = onlyForSingleHitbox; + } + } +} diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index cf2bb60939..34c3782b94 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ProfanedGuardians { + [HasPierceResist] public class ProfanedRocks : ModNPC { private bool start = true; diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index d891497c47..720ecc8c7e 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerClawLeft : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index 731b46802d..01abdb3fb5 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerClawRight : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index e181a9e65d..ecdcb25659 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerHead : ModNPC { public static readonly SoundStyle MissileSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileLaunch"); diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 14e5723fe7..6c55b7750e 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerLegLeft : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index b3be683e4a..41f8232445 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Ravager { + [HasPierceResist] public class RavagerLegRight : ModNPC { public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.RavagerBody.DisplayName"); diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 90e0b51f13..e3683fc811 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -14,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(StormWeaverHead))] public class StormWeaverBody : ModNPC { diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 6132f87145..13884e212b 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -33,6 +33,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [HasPierceResist] [LongDistanceNetSync] public class StormWeaverHead : ModNPC { diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 13bc6f7fc9..0d33b1f0a0 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.StormWeaver { + [HasPierceResist] [LongDistanceNetSync(SyncWith = typeof(StormWeaverHead))] public class StormWeaverTail : ModNPC { diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index adca018fa0..e571268cbe 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.SupremeCalamitas { + [HasPierceResist] public class BrimstoneHeart : ModNPC { public int ChainHeartIndex => (int)NPC.ai[0]; diff --git a/NPCs/TownNPCs/Cirrus.cs b/NPCs/TownNPCs/Cirrus.cs index de718c50e0..cc9e7b0623 100644 --- a/NPCs/TownNPCs/Cirrus.cs +++ b/NPCs/TownNPCs/Cirrus.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.TownNPCs bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; bool workoutOutfit = Main.dayTime && beLessDrunk; if (workoutOutfit) - frameHeight = WorkoutTexture.Height() / Main.npcFrameCount[Type]; + frameHeight = 50; int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); if (NPC.velocity.Y == 0f) diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index ee6649cf23..cebbf59dee 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -56,7 +56,20 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { Texture2D tex = ModContent.Request(NewTexture).Value; - spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(tex.Size().X / joke.Size().X, tex.Size().Y / joke.Size().Y, 0.5f)); + Main.NewText(scaleMult); + tex = joke; + UseAltVisual = true; + } + } + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish * scaleMult, SpriteEffects.None, 0); } } diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs index eec7780240..568fddfbe1 100644 --- a/Particles/CustomSpark.cs +++ b/Particles/CustomSpark.cs @@ -91,6 +91,19 @@ namespace CalamityMod.Particles Vector2 scale = Stretch * Scale; Texture2D texture = ModContent.Request(NewTexture).Value; + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + AltVisual = true; + } + } + Color col = Color; if (AffectedByLight) @@ -98,9 +111,9 @@ namespace CalamityMod.Particles col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); } - spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); } } } diff --git a/Particles/GlowSparkParticle.cs b/Particles/GlowSparkParticle.cs index 7e81b9a9c4..c2f7729ba3 100644 --- a/Particles/GlowSparkParticle.cs +++ b/Particles/GlowSparkParticle.cs @@ -66,9 +66,21 @@ namespace CalamityMod.Particles Vector2 scale = Squash * Scale; Texture2D texture = ModContent.Request(Texture).Value; - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); if (Glowing) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f), 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.White, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * new Vector2(0.45f, 1f) * scaleMult, 0, 0f); } } } diff --git a/Particles/MammothParticle.png b/Particles/MammothParticle.png new file mode 100644 index 0000000000..7d4f3fbb7f Binary files /dev/null and b/Particles/MammothParticle.png differ diff --git a/Particles/VelChangingSpark .cs b/Particles/VelChangingSpark .cs index f917530522..6329ef2c06 100644 --- a/Particles/VelChangingSpark .cs +++ b/Particles/VelChangingSpark .cs @@ -96,9 +96,22 @@ namespace CalamityMod.Particles col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); } - spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + float scaleMult = 1; + if (Main.zenithWorld) + { + DateTime day = DateTime.Now; + if (day.DayOfWeek == DayOfWeek.Tuesday) + { + Texture2D joke = ModContent.Request("CalamityMod/Particles/MammothParticle").Value; + scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f)); + texture = joke; + AltVisual = true; + } + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale * scaleMult, 0, 0f); if (GlowCenter) - spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * 0.8f * scaleMult, 0, 0f); } } } diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index 8ff63ebb1e..b432ef06c5 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -42,18 +42,11 @@ namespace CalamityMod.Projectiles.Boss Time++; if (Time == TotalRitualTime - PulseTime) { - int idx = NPC.NewNPC(Projectile.GetSource_FromThis(), (int)Projectile.Center.X, (int)Projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); - if (idx != -1) + if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, Projectile.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { + int idx = NPC.NewNPC(Projectile.GetSource_FromThis(), (int)Projectile.Center.X, (int)Projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); + if (idx != -1) CalamityUtils.BossAwakenMessage(idx); - } - else - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); - } } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 707183fea6..4d91d08a39 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -12,6 +12,7 @@ using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Ammo; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; @@ -73,11 +74,6 @@ namespace CalamityMod.Projectiles /// Constant variable used as a speed cap for boss laser projectiles with 2 extra updates. public const float AcceleratingBossLaserVelocityCap = 8f; - /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. - public const float PierceResistHarshness = 0.12f; - /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. - public const float PierceResistCap = 0.8f; - /// /// Used for executing frame one hacks. Things set during this include: ///
* Reducing projectile damage for Hardmode enemies and in Master Mode. @@ -4147,8 +4143,13 @@ namespace CalamityMod.Projectiles if (forcedCrit) modifiers.SetCrit(); - if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike) + if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike && !modPlayer.vampiricTalisman) target.AddBuff(BuffType(), RottenDogtooth.ArmorCrunchDebuffTime); + else if (modPlayer.vampiricTalisman && projectile.Calamity().stealthStrike) + { + target.AddBuff(BuffType(), VampiricTalisman.ArmorCrunchDebuffTime); + target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); + } if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) target.AddBuff(BuffType(), VulnerabilityHex.AflameDuration); @@ -4221,11 +4222,33 @@ namespace CalamityMod.Projectiles #region On Hit NPC public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone) { + // Hyperius Overflow + if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) + { + int damage = 0; + if (target.Calamity().hyperiusDamage < damageDone) + damage = damageDone - target.Calamity().hyperiusDamage; + else + damage = damageDone; + target.Calamity().hyperiusDamage -= damage; + + // Spawn overflow hit + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, projectile.owner, target.whoAmI); + overflow.DamageType = projectile.DamageType; + overflow.ArmorPenetration = projectile.ArmorPenetration; // Takes the armor pen from what did the hit + + if (target.Calamity().hyperiusDamage <= 0) + { + target.Calamity().hyperiusDamage = 0; + target.Calamity().hyperiusMarked = false; + } + } + // Implementation of shared static iframes. // If this projectile does not use static iframes, or is not registered to share them, then do nothing. if (!projectile.usesIDStaticNPCImmunity || !SharedStaticIFrames.Includes(projectile.type)) return; - + // Get the set of shared static iframe projectile types. // If it's empty, then do nothing. IList sharedWithProjectiles = SharedStaticIFrames.GetSharedStaticIFrames(projectile.type); diff --git a/Projectiles/DraedonsArsenal/CompactRailgunHoldout.cs b/Projectiles/DraedonsArsenal/CompactRailgunHoldout.cs index 08bd52f06e..d193ec2ca7 100644 --- a/Projectiles/DraedonsArsenal/CompactRailgunHoldout.cs +++ b/Projectiles/DraedonsArsenal/CompactRailgunHoldout.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public ref float shootingTimer => ref Projectile.ai[0]; public ref float chargeTimer => ref Projectile.ai[1]; public int fireRate => Owner.HeldItem.useAnimation; - public int chargeRate => 222; + public int chargeRate => 222; // It's spesifically this to line up with the charge sound public int time = 0; public float lightSine = 0; float charge = 0; // multiplier for vfx based on charge of the weapon @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Owner.AddCooldown(ArsenalPower.ID, 540); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - int chargeDamage = (int)(Projectile.damage * 55); + int chargeDamage = (int)(Projectile.damage * 33); Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 6, ModContent.ProjectileType(), chargeDamage, 0, Projectile.owner); SoundStyle sound = new("CalamityMod/Sounds/Item/GaussRailgunBigShot"); diff --git a/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs b/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs index 9d521ae495..479e02ab99 100644 --- a/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs +++ b/Projectiles/DraedonsArsenal/GaussRailgunBigShot.cs @@ -2,6 +2,7 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -78,10 +79,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.numHits--; modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); float minMult = 0.25f; int hitsToMinMult = 7; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; + modifiers.SourceDamage *= damageMult + critDamage; Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); float launchPower = 20; diff --git a/Projectiles/DraedonsArsenal/ImmolationSpray.cs b/Projectiles/DraedonsArsenal/ImmolationSpray.cs index cd48e5136c..d30ccaafbd 100644 --- a/Projectiles/DraedonsArsenal/ImmolationSpray.cs +++ b/Projectiles/DraedonsArsenal/ImmolationSpray.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.DamageType = DamageClass.Ranged; Projectile.timeLeft = 300; Projectile.extraUpdates = 3; - Projectile.penetrate = -1; + Projectile.penetrate = 4; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 4594581636..f864cef1ff 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -6,6 +6,7 @@ using CalamityMod.Graphics.Primitives; using CalamityMod.Items; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,6 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { + [PierceResistException] public class PhaseslayerProjectile : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/DraedonsArsenal/ScattershotSkewerHoldout.cs b/Projectiles/DraedonsArsenal/ScattershotSkewerHoldout.cs index ce3fa169f3..f8f2a9f519 100644 --- a/Projectiles/DraedonsArsenal/ScattershotSkewerHoldout.cs +++ b/Projectiles/DraedonsArsenal/ScattershotSkewerHoldout.cs @@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Owner.AddCooldown(ArsenalPower.ID, 300); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - int chargeDamage = (int)(Projectile.damage * (50 + (didDash ? 10 : 0))); // Seems high but its on a cooldown and is a melee attack so might be okay + int chargeDamage = (int)(Projectile.damage * (35 + (didDash ? 10 : 0))); // Used to be 50x - 60x, skewed the damage way too much to the lance even with it being the special float chargeKB = Projectile.knockBack * 3f; Projectile skewer = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity * 2, ModContent.ProjectileType(), chargeDamage, chargeKB, Projectile.owner,0,0, (didDash ? 5 : 0)); skewer.timeLeft = (didDash ? 25 : 10); diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index 4caa43adb9..17c3d4b9c5 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Cooldowns; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { + [PierceResistException] public class TaserHook : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Misc"; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index c6715aca3f..4ea805ae55 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -63,24 +63,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Time++; - if (Time == 5) + if (Time == 5 && !Projectile.Calamity().stealthStrike) Projectile.tileCollide = true; if (Time < 100 && Time > 10 && Projectile.Calamity().stealthStrike) Projectile.velocity = Projectile.velocity.RotatedBy(-0.029f * Projectile.ai[2]); - if (false) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.rotation.ToRotationVector2() * 5, Effects.ArsenalEffects.ArsenalLaserDust); - dust.velocity = Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.1f, 0.2f); - dust.scale = Main.rand.NextFloat(0.35f, 0.8f); - dust.noGravity = true; - dust.color = Color.Red; - dust.fadeIn = 10; - dust.noLight = true; - dust.noLightEmittence = true; - } - - if (!ReturningToPlayer) { if (Time >= 55f) diff --git a/Projectiles/Magic/AcidicSaxBubble.cs b/Projectiles/Magic/AcidicSaxBubble.cs index 75a229df18..ffb9068575 100644 --- a/Projectiles/Magic/AcidicSaxBubble.cs +++ b/Projectiles/Magic/AcidicSaxBubble.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class AcidicSaxBubble : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 3aa60a7fb8..2c779ac44d 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Magic; +using CalamityMod.NPCs; using CalamityMod.Systems; using Microsoft.Xna.Framework; using System; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException(onlyForSingleHitbox: true)] public class AnahitasArpeggioNote : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 7aa7bea46c..d78e533df4 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -1,11 +1,13 @@ using System; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class ApotheosisEnergy : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index 466ecab9ca..3ca467c977 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -3,6 +3,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class ApotheosisWorm : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/AtlantisSpear.cs b/Projectiles/Magic/AtlantisSpear.cs index 6c8a87d6fe..25ea685675 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException(onlyForSingleHitbox: true)] public class AtlantisSpear : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 98e2af8c09..6275230bf5 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using rail; using Terraria; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class BlushieStaffProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 242551db4a..fe351407b1 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class DarkSparkBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index 23316f5c74..a4795ab8e4 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -1,11 +1,13 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class EidolicWailSoundwave : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index b857ad36cf..d0e09f1117 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -4,6 +4,7 @@ using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -13,6 +14,7 @@ using Terraria.WorldBuilding; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class RancorLaserbeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index f024feb401..edcd3fe031 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Magic; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class Snowflake : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index 4a6cbb038c..54a4b578af 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class SparklingLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/SpiritCongregation.cs b/Projectiles/Magic/SpiritCongregation.cs index ba7385356e..312b9f501c 100644 --- a/Projectiles/Magic/SpiritCongregation.cs +++ b/Projectiles/Magic/SpiritCongregation.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Graphics.Metaballs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class SpiritCongregation : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index c01869a4b3..71f6acda5e 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class Teslabeam : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index c1f057a06d..3dbd357902 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Magic public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int time = 0; public int direction = 0; + public Vector2 lastPos; public override void SetDefaults() { Projectile.width = 16; @@ -44,6 +45,7 @@ namespace CalamityMod.Projectiles.Magic if (time == 0) { direction = Main.rand.NextBool() ? 1 : -1; + lastPos = Projectile.Center; } if (time > 3) @@ -51,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic if (time > 3 && targetDist < 1400) { - Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.3f, false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 0.7f), false, true); + Particle spark = new GlowSparkParticle(Projectile.Center, Utils.DirectionTo(Projectile.Center, lastPos), false, (int)(15 * MathHelper.Clamp(Projectile.ai[2], 0.5f, 1f)), 0.07f * MathHelper.Clamp(Projectile.ai[2], 0.25f, 1f), Color.Chartreuse, new Vector2(1, 1.4f), false, true); GeneralParticleHandler.SpawnParticle(spark); if (Main.rand.NextBool((int)(MathHelper.Clamp((1 - Projectile.ai[2]) * 5, 1, 15)))) @@ -64,6 +66,7 @@ namespace CalamityMod.Projectiles.Magic } } time++; + lastPos = Projectile.Center; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index a07c9598a1..277a9241a8 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class WaterLeechProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 105a0a852e..d9a8f4bb10 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { + [PierceResistException] public class YharimsCrystalBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; diff --git a/Projectiles/Melee/BasherHoldout.cs b/Projectiles/Melee/BasherHoldout.cs index defc0b40a2..8f4c752090 100644 --- a/Projectiles/Melee/BasherHoldout.cs +++ b/Projectiles/Melee/BasherHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class BasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 765c4831b3..41c5b560a3 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class BonebreakerProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index ab6c6ec2b2..8a5e54dcfd 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class CometQuasherHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index fa6111816e..16d5f599b0 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -23,6 +24,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DevilsDevastationHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index 959f4b8f4d..cab7c87dbf 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DevilsSunriseCyclone : ModProjectile, ILocalizedModType { public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 1.25f, PitchVariance = 0.15f }; diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index 5a440b6883..3f72eacbf0 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DevilsSunriseProj : ModProjectile { public static readonly SoundStyle HitSound = new SoundStyle("CalamityMod/Sounds/Item/MantisSwipe", 2) with { Pitch = 0.8f }; diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 01ec734e1f..29a8413530 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class DragonRageStaff : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index d99e94e7c0..62e7694000 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Runtime.ConstrainedExecution; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class EarthHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 419ee0d10a..e69e5f6157 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -19,6 +20,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class ExaltedOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index 1f480881c6..fe3d3bdd40 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Packets.Entities; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -19,6 +20,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class ForbiddenOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index da3aea142e..12efa56e57 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -3,6 +3,7 @@ using System.IO; using System.Runtime.CompilerServices; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -17,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class GrandDadHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -211,10 +213,6 @@ namespace CalamityMod.Projectiles.Melee if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) Projectile.numHits -= 1; - SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); - SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center); - SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); - SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType() && Main.rand.NextBool(5)) { SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8); @@ -223,6 +221,10 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.numHits == 0) { Owner.Calamity().GeneralScreenShakePower = 6.5f; + SoundStyle fire = new("CalamityMod/Sounds/NPCHit/ThanatosHitOpen1"); + SoundEngine.PlaySound(fire with { Volume = 0.75f, Pitch = -0.1f }, Projectile.Center); + SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center); } int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20)); diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 41156a4121..2dc1197cbc 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; @@ -17,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class GrandGuardianHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index f9fc98014c..87e4127d6d 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -14,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class HellkiteHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); @@ -418,10 +420,11 @@ namespace CalamityMod.Projectiles.Melee if (chargedSwing) modifiers.SetCrit(); + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); float minMult = 0.25f; int hitsToMinMult = 10; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 3f * (GFBMulti) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? (3f * (GFBMulti) + critDamage) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index d342eee4c5..ae4988b83b 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class HolyColliderHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index 19356cd8b4..2fb89841b5 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class InsidiousHarpoon : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 17eb3bd5ad..43b21f426c 100644 --- a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Melee; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.MaceFlails { + [PierceResistException] public class UrchinMaceProj : BaseMaceFlailProjectile { // The entire chain is on the mace sprite, in which the player swings diff --git a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs index 1073486d6b..9972b1baee 100644 --- a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs +++ b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Projectiles.BaseProjectiles; using Terraria; using Terraria.ID; @@ -6,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.MaceFlails { + [PierceResistException] public class YateveoBloomMace : BaseMaceFlailProjectile { public override int AssociatedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 0e1d75a86c..b480b723bc 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class MajesticGuardHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 8cf521594d..62c4e42c16 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class MurasamaSlash : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index d2b6619595..de9eff766d 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class OldLordClaymoreHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index d7bb4b4043..8e9ef1d4ae 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class OmnibladeSwing : ModProjectile, ILocalizedModType { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index d587a822c6..749fb11172 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class PhotonRipperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/PrismaticRay.cs b/Projectiles/Melee/PrismaticRay.cs index c10c472e13..28d99875b9 100644 --- a/Projectiles/Melee/PrismaticRay.cs +++ b/Projectiles/Melee/PrismaticRay.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class PrismaticRay : BaseLaserbeamProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs index 5e691dfb7b..d999e088e3 100644 --- a/Projectiles/Melee/RespiteblockHoldout.cs +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -1,7 +1,8 @@ using System; -using CalamityMod.Enums; -using CalamityMod.Particles; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class RespiteblockHoldout : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index eb41fb2dde..e362c1c7f4 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class SkytideDragoonHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index 6b1346c954..715ba348bc 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -14,6 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class StellarStrikerHoldout : BaseCustomUseStyleProjectile, ILocalizedModType { public override int AssignedItemID => ModContent.ItemType(); diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 851b4a2cd1..17cf90d7a2 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Enums; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class TyphonsGreedStaff : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 2da1fa70aa..0bd714b8fa 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { + [PierceResistException] public class ViolenceThrownProjectile : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Ranged/AcidRocket.cs b/Projectiles/Ranged/AcidRocket.cs index 982bd2cb2c..152b457953 100644 --- a/Projectiles/Ranged/AcidRocket.cs +++ b/Projectiles/Ranged/AcidRocket.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; @@ -15,6 +16,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] public class AcidRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; diff --git a/Projectiles/Ranged/AuricBullet.cs b/Projectiles/Ranged/AuricBullet.cs index 9a2f524c55..61d6186699 100644 --- a/Projectiles/Ranged/AuricBullet.cs +++ b/Projectiles/Ranged/AuricBullet.cs @@ -103,5 +103,6 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(0.3f, 0.9f); } } + public override bool? CanHitNPC(NPC target) => target.CanBeChasedBy() ? null : false; } } diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index 42d6af0c6d..cef1f3c346 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException(onlyForSingleHitbox: true)] public class AuroraFire : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; diff --git a/Projectiles/Ranged/BlissfulBombardierHoldout.cs b/Projectiles/Ranged/BlissfulBombardierHoldout.cs index 8304e5168a..6f063208e3 100644 --- a/Projectiles/Ranged/BlissfulBombardierHoldout.cs +++ b/Projectiles/Ranged/BlissfulBombardierHoldout.cs @@ -152,10 +152,12 @@ namespace CalamityMod.Projectiles.Ranged } // Spawns the projectile. - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); - PostFireCooldown = Owner.itemAnimationMax; - Owner.Calamity().GeneralScreenShakePower = 5f; - + if (Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootDirection * projSpeed * velocityMultiplier, ProjectileType(), damage, knockback, Projectile.owner, rocketType); + PostFireCooldown = Owner.itemAnimationMax; + Owner.Calamity().GeneralScreenShakePower = 5f; + } // Inside here go all the things that dedicated servers shouldn't spend resources on. // Like visuals and sounds. diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 34900bde02..4726639c39 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index e6f934e331..79d2f8c695 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index 2d02ef5959..368d219ab7 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; } diff --git a/Projectiles/Ranged/CardSpade.cs b/Projectiles/Ranged/CardSpade.cs index b0addec51c..f8b82c043d 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 1; + Projectile.extraUpdates = 3; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Ranged/ChromaticFire.cs b/Projectiles/Ranged/ChromaticFire.cs index a97a221ad5..3c33792693 100644 --- a/Projectiles/Ranged/ChromaticFire.cs +++ b/Projectiles/Ranged/ChromaticFire.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - Projectile.width = Projectile.height = 12; + Projectile.width = Projectile.height = 52; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs index 23d7c8f793..b0a56381e5 100644 --- a/Projectiles/Ranged/CondemnationArrowHoming.cs +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 90; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.arrow = true; Projectile.extraUpdates = 2; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index a2756431ff..1adf47bc8f 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -2,8 +2,10 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -23,6 +25,7 @@ namespace CalamityMod.Projectiles.Ranged private float storedVelocity = 1f; public const float velocityMultiplier = 1.2f; public bool homing = false; + public bool playShootSound = true; public override void KillHoldoutLogic() { @@ -35,6 +38,12 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Kill(); return; } + if (homing && playShootSound) + { + SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot with { Pitch = 0.2f, MaxInstances = 2 }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_BallistaTowerShot with { Pitch = -0.4f, MaxInstances = 2 }, Projectile.Center); + playShootSound = false; + } // Fire one charged arrow every frame until you're out of arrows. ShootProjectiles(homing); @@ -84,11 +93,13 @@ namespace CalamityMod.Projectiles.Ranged FramesToLoadNextArrow = MathHelper.Clamp(FramesToLoadNextArrow--, 1f, HeldItem.useAnimation); // Play a sound for additional notification that an arrow has been loaded. - var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.3f }); + var loadSound = SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.4f, Pitch = -0.3f + ArrowsLoaded * 0.1f }); if (ArrowsLoaded >= Condemnation.MaxLoadedArrows) { - SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameRecharge")); + SoundStyle fire = new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameRecharge"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = i * 0.25f, MaxInstances = 3 }); homing = true; } } @@ -154,9 +165,32 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * storedVelocity; int ArrowType = homing ? ModContent.ProjectileType() : ModContent.ProjectileType(); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ArrowType, Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ArrowType, (int)(Projectile.damage * 1.35f), Projectile.knockBack, Projectile.owner); } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0, -3); + float randSize = Main.rand.NextFloat(0.9f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + if (homing) + { + for (int i = 0; i < 22; i++) + { + Color auraColor = Color.Lerp(Color.Red, Color.White, i * 0.01f) with { A = 0 } * 0.6f; + Vector2 drawOffset = ((MathHelper.TwoPi * i / 22f).ToRotationVector2() * 5) + Main.rand.NextVector2Circular(7, 7); + Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, auraColor, drawRotation, rotationPoint, Projectile.scale * Main.rand.NextFloat(0.7f, 1.1f), flipSprite); + } + } + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + return false; + } public override void SendExtraAIHoldout(BinaryWriter writer) { writer.Write(FramesToLoadNextArrow); diff --git a/Projectiles/Ranged/ExoFlareCluster.cs b/Projectiles/Ranged/ExoFlareCluster.cs index f8fd95b5d8..a607bb74fa 100644 --- a/Projectiles/Ranged/ExoFlareCluster.cs +++ b/Projectiles/Ranged/ExoFlareCluster.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] // Photoviscerator right click main projectile (invisible flare cluster bomb) public class ExoFlareCluster : ModProjectile, ILocalizedModType { diff --git a/Projectiles/Ranged/HellbornHoldout.cs b/Projectiles/Ranged/HellbornHoldout.cs index a5f285ee5a..8896cebac8 100644 --- a/Projectiles/Ranged/HellbornHoldout.cs +++ b/Projectiles/Ranged/HellbornHoldout.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] public class HellbornHoldout : BaseGunHoldoutProjectile { public override int AssociatedItemID => ModContent.ItemType(); diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 5bf58ceb15..084f5a7ab9 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -1,7 +1,11 @@ using System; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -18,36 +22,38 @@ namespace CalamityMod.Projectiles.Ranged public bool dustWave = false; public float variance = 0.8f; public Vector2 lastPos; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - + public int slowdownTime = 7; + public bool tileTouched = false; public override void SetDefaults() { - Projectile.width = 6; - Projectile.height = 6; + Projectile.width = 15; + Projectile.height = 15; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.penetrate = 1; + Projectile.penetrate = -1; Projectile.timeLeft = 1200; - Projectile.extraUpdates = 7; + Projectile.extraUpdates = 25; + Projectile.tileCollide = false; AIType = ProjectileID.Bullet; Projectile.ignoreWater = true; Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, slowdownTime * Projectile.extraUpdates, Projectile.timeLeft, true), 1); if (currentColor == Color.Black) { + slowdownTime = Main.rand.Next(6, 9 + 1); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 20; variance = Main.rand.NextFloat(0.7f, 1f); - dustWave = Main.rand.NextBool(); + dustAngle = Main.rand.NextFloat(-0.43f, 0.43f); + dustWave = Math.Sign(dustAngle) == 1; Projectile.scale = 1.5f; Projectile.velocity *= 0.3f; lastPos = Projectile.velocity; @@ -80,85 +86,86 @@ namespace CalamityMod.Projectiles.Ranged } dustAngle += (growing ? 0.07f * variance : -0.07f * variance); - Projectile.localAI[0] += 1f; - Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); - if (Projectile.localAI[0] > 12f && targetDist < 1200f) + if (Collision.SolidCollision(Projectile.Center, 4, 4) && !tileTouched && Projectile.numHits == 0) { - CustomSpark orb = new CustomSpark(orbPos, Utils.DirectionTo(lastPos, orbPos), "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.2f, currentColor, new Vector2(1 + MathF.Abs(dustAngle * 0.6f), 1), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.7f), 0.7f, 0.8f); + tileTouched = true; + OnHitEffects(null); + } + if (Projectile.numHits > 0 || tileTouched) + { + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5 * Math.Max(timeleftFade, 0.01f); + if (Projectile.timeLeft > slowdownTime * Projectile.extraUpdates) + Projectile.timeLeft = slowdownTime * Projectile.extraUpdates; + } + + Projectile.ai[2]++; + Vector2 orbPos = Projectile.Center + (Projectile.velocity.RotatedBy((dustWave ? 1 : -1) * dustAngle) * 4.5f - Projectile.velocity * 5); + if (Projectile.ai[2] > 15 && targetDist < 1200f) + { + CustomSpark orb = new CustomSpark(orbPos - Utils.DirectionTo(lastPos, orbPos) * timeleftFade, Utils.DirectionTo(lastPos, orbPos) * 0.1f, "CalamityMod/Particles/BloomCircle", false, 5, (0.55f + MathF.Abs(dustAngle * 0.65f)) * 0.15f * timeleftFade, currentColor, new Vector2(1 - MathF.Abs(dustAngle * 0.2f), 2 - (1 - MathF.Abs(dustAngle))), true, true, 0, false, false, 0.8f - MathF.Abs(dustAngle * 0.6f), 0.7f, 0.8f); GeneralParticleHandler.SpawnParticle(orb); - if (Main.rand.NextBool(7)) + if (Main.rand.NextBool(8)) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.8f, 1.3f)); + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), -Projectile.velocity.RotatedByRandom(0.15f) * Main.rand.NextFloat(0.9f, 1.8f)); dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.5f, 0.8f); + dust.scale = Main.rand.NextFloat(1.2f, 1.9f) * timeleftFade; dust.color = currentColor; dust.noLightEmittence = true; + dust.fadeIn = 1.4f; } } lastPos = orbPos; } - - // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) + public override bool? CanHitNPC(NPC target) { - return currentColor; + return (Projectile.numHits > 0 ? false : null); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + CalamityGlobalNPC modNPC = target.Calamity(); + if (!modNPC.hyperiusMarked) + modNPC.hyperiusMarked = true; + + Player Owner = Main.player[Projectile.owner]; + // Hits can crit and the collapse damage will take that into account + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); + modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); + + modifiers.DisableCrit(); + Projectile.damage = 1; + modifiers.HideCombatText(); + + OnHitEffects(target); + } + private void OnHitEffects(NPC target) + { + if (Projectile.owner == Main.myPlayer) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); + for (int b = 0; b < 2; b++) + { + Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7 * (tileTouched ? -1 : 1)).RotatedByRandom(0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)Math.Max(Projectile.originalDamage * 0.05f, 1), 0, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); + } + } + } public override bool PreDraw(ref Color lightColor) { - if (Projectile.localAI[0] > 25f) + Asset orb = ModContent.Request("CalamityMod/Particles/GlowSpark"); + int startTime = 9; + int endTime = 35; + float timeleftFade = (float)Math.Pow(Utils.GetLerpValue(0, slowdownTime * Projectile.extraUpdates, Projectile.timeLeft, true), 1); + + for (int i = 0; i < 4; i++) { - CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor); + Vector2 squash = new Vector2(Utils.Remap(Projectile.ai[2], startTime, endTime, 0.2f, 0.6f + i * 0.2f), Utils.Remap(Projectile.ai[2], startTime, endTime, 1f, 3f - i * 0.4f)); + Color orbColor = Color.Lerp(currentColor, Color.White, i * 0.2f) with { A = 0 } * 0.9f; + Vector2 scale = Projectile.scale * timeleftFade * squash * (0.05f - i * 0.008f) * 0.3f; + Main.EntitySpriteDraw(orb.Value, Projectile.Center - Main.screenPosition + Projectile.velocity * i * 1.3f, null, orbColor, Projectile.rotation, orb.Size() * 0.5f, scale, SpriteEffects.None); } return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.owner == Main.myPlayer) - { - for (int b = 0; b < 3; b++) - { - Vector2 vel = (-oldVelocity.SafeNormalize(Vector2.UnitX) * 5); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vel.RotatedByRandom(0.5f) * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); - } - } - return true; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - OnHitEffects(target.Center); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - OnHitEffects(target.Center); - } - - private void OnHitEffects(Vector2 targetPos) - { - if (Projectile.owner == Main.myPlayer) - { - for (int b = 0; b < 3; b++) - { - Vector2 velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5).RotatedByRandom(0.5f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity * 0.7f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 2f, Projectile.owner, 0f, 0f, Main.rand.Next(0, 4 + 1)); - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ShadowboltWallHit") with { Volume = 0.25f, Pitch = Main.rand.NextFloat(0.6f, 1f), MaxInstances = -1 }, Projectile.Center); - for (int b = 0; b < 4; b++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.7f, 1.4f); - dust.color = currentColor; - dust.noLightEmittence = true; - } - } } } diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index a6605021e9..97dd241aa7 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -1,4 +1,7 @@ -using CalamityMod.Items.Ammo; +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Ammo; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,11 +19,7 @@ namespace CalamityMod.Projectiles.Ranged private int rotDirection = 1; private float rotIntensity; private bool rotPhase2 = false; - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 20; - ProjectileID.Sets.TrailingMode[Type] = 2; - } + public bool photosen = CalamityClientConfig.Instance.Photosensitivity; public override void SetDefaults() { Projectile.width = 12; @@ -29,11 +28,11 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.tileCollide = false; - Projectile.penetrate = 2; + Projectile.penetrate = 4; Projectile.timeLeft = 500; Projectile.extraUpdates = 4; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.extraUpdates; + Projectile.localNPCHitCooldown = -1; Projectile.alpha = 255; Projectile.ignoreWater = true; AIType = ProjectileID.Bullet; @@ -42,65 +41,82 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.localAI[0]++; + int trailLifetime = 8; if (currentColor == Color.Black) { + Player Owner = Main.player[Projectile.owner]; + Projectile.scale = 0.015f; Projectile.alpha = 255; rotDirection = Main.rand.NextBool() ? 1 : -1; - rotIntensity = Main.rand.NextFloat(0.5f, 1.5f); + rotIntensity = Main.rand.NextFloat(0.3f, 1.1f); Projectile.timeLeft = Main.rand.Next(250, 300 + 1); switch (Projectile.ai[2]) { case 4: // Yellow shot - currentColor = Color.Yellow * 0.65f; + currentColor = Color.Yellow; break; case 3: // Magenta shot - currentColor = Color.Magenta * 0.65f; + currentColor = Color.Magenta; break; case 2: // Red shot - currentColor = Color.Red * 0.65f; + currentColor = Color.Red; break; case 1: // Blue shot - currentColor = Color.Cyan * 0.65f; + currentColor = Color.Cyan; break; default: // Green shot - currentColor = Color.Lime * 0.65f; + currentColor = Color.Lime; break; } } + if (Projectile.localAI[0] > 4 && Projectile.localAI[0] % 2 == 0 && !photosen) + { + Particle trail = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 9, -Projectile.velocity * 0.01f, "CalamityMod/Particles/BloomCircle", false, trailLifetime, 0.15f, currentColor, new Vector2(0.8f, 1.3f), true, true, shrinkSpeed: 0.6f / rotIntensity, glowCenterScale: 0.8f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (Projectile.timeLeft == 180) rotPhase2 = true; if (rotPhase2) { - rotIntensity *= 1.001f; - Projectile.velocity *= 0.997f; - Projectile.velocity = Projectile.velocity.RotatedBy(-0.025f * rotIntensity * rotDirection); + rotIntensity *= 1.003f; + Projectile.velocity *= 0.995f; + Projectile.velocity = Projectile.velocity.RotatedBy(-0.04f * rotIntensity * rotDirection); } else { - Projectile.velocity = Projectile.velocity.RotatedBy(0.015f * rotIntensity * rotDirection); + Projectile.velocity = Projectile.velocity.RotatedBy(0.02f * rotIntensity * rotDirection); } } public override void OnKill(int timeLeft) { - for (int b = 0; b < 2; b++) - { - GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), false, 5, Main.rand.NextFloat(0.35f, 0.45f), currentColor, true, true); - GeneralParticleHandler.SpawnParticle(orb); - } + } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12, targetHitbox); public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.Lerp(currentColor, Color.White, 0.15f) with { A = 0 }, 1, texture, true, true); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, currentColor with { A = 0 } * (photosen ? 0.4f : 1), Projectile.rotation, texture.Size() * 0.5f, new Vector2(0.9f, 1.5f) * Projectile.scale, SpriteEffects.None); return false; } - public override bool? CanDamage() => Projectile.localAI[0] < 20 ? false : null; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + CalamityGlobalNPC modNPC = target.Calamity(); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage.Flat += HyperiusBullet.SplitBulletBonusDamage; + if (!modNPC.hyperiusMarked) + modNPC.hyperiusMarked = true; + + Player Owner = Main.player[Projectile.owner]; + // Hits can crit and the collapse damage will take that into account + bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType); + modNPC.hyperiusDamage += Math.Max(Projectile.damage * (crit ? 2 : 1) - 1, 1); + + modifiers.DisableCrit(); + Projectile.damage = 1; + modifiers.HideCombatText(); + } } } diff --git a/Projectiles/Ranged/KingsbaneHoldout.cs b/Projectiles/Ranged/KingsbaneHoldout.cs index 9dd0bb0edc..be93d8c4ff 100644 --- a/Projectiles/Ranged/KingsbaneHoldout.cs +++ b/Projectiles/Ranged/KingsbaneHoldout.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged Owner.Calamity().GeneralScreenShakePower = 1.85f; //recoil Owner.velocity += -Projectile.velocity * fullRevShots * (Main.zenithWorld ? 0.028f : 0.013f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition + Projectile.velocity * 5 + Main.rand.NextVector2Circular(7, 7), shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), ModContent.ProjectileType(), (int)(Projectile.damage), Projectile.knockBack, Projectile.owner); SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmall"); if (fullRevShots % 2 == 0) SoundEngine.PlaySound(fire with { Volume = 0.7f }, Projectile.Center); @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Ranged float interpolant = Utils.GetLerpValue(0f, 55f, Owner.Distance(Main.MouseWorld), true); Vector2 oldVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), 0.185f).SafeNormalize(Vector2.UnitY); + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(Main.MouseWorld), (discharging ? 0.2f : 0.45f)).SafeNormalize(Vector2.UnitY); if (Projectile.velocity != oldVelocity) Projectile.ForceNetUpdate(); } diff --git a/Projectiles/Ranged/NukeOfBliss.cs b/Projectiles/Ranged/NukeOfBliss.cs index a8ff6adc94..70729aa744 100644 --- a/Projectiles/Ranged/NukeOfBliss.cs +++ b/Projectiles/Ranged/NukeOfBliss.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged if (rainDownTimer >= 80) { bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); - if (rainDownTimer % 15 == 0) + if (rainDownTimer % 15 == 0 && Main.myPlayer == Projectile.owner) { SoundStyle fire = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); SoundEngine.PlaySound(fire with { Volume = 0.45f, Pitch = (0 - 0.3f * Utils.GetLerpValue(0, 300, rainDownTimer, true)) }, Projectile.Center); diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index 355ee730d8..f8b4aeb2c1 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -50,7 +50,8 @@ namespace CalamityMod.Projectiles.Ranged { // Xyk: "This is probably too much lol" // Yeah I'd say 7x base damage is a bit much - Projectile.damage *= (int) 5.5; + // Xyk: Follow up, the inital damage is nerfed AND it has a "cooldown" 7x should now be fine... + Projectile.damage *= (int)7; FogColor = Color.Lerp(Color.OrangeRed, Color.Goldenrod, Main.rand.NextFloat()); SoundStyle ignite = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 10ffcec20c..f15ce7e8f6 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -339,72 +339,74 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (!stuckInTarget && canStick) + if (!target.Calamity().pacified) { - for (int i = 0; i <= 8; i++) + if (!stuckInTarget && canStick) { - Vector2 sparkVelocity = Projectile.velocity * 0.5f; - - float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); - Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); - Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); - GeneralParticleHandler.SpawnParticle(spark1); - - float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); - Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); - Particle spark2 = new LineParticle(Projectile.Center, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); - GeneralParticleHandler.SpawnParticle(spark2); - - Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, sparkvelocity2, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); - dust.noGravity = true; - } - - time = 1; - collideWithTiles = false; - canDamage = false; - placementDistance = -Vector2.Distance(target.Center, Projectile.Center); - placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); - placementCenter = placementVelocity * (placementDistance * 0.01f); - chosenTarget = target; - stuckInTarget = true; - canStick = false; - storedVelocity = Projectile.velocity; - Projectile.velocity = Vector2.Zero; - SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); - SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); - - if (pullCheckValid) - { - chosenTarget.velocity += storedVelocity * (strongEnemy ? 0.3f : 1.5f); - hasLatchedTarget = true; - if ((chosenTarget.lifeMax >= Projectile.damage * 28f) || chosenTarget.boss) - strongEnemy = true; - SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); - SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); - if (strongEnemy) + for (int i = 0; i <= 8; i++) { - SoundStyle sound8 = new("CalamityMod/Sounds/Item/MetalEcho"); - SoundEngine.PlaySound(sound8 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.8f, 0.9f) }, Projectile.Center); + Vector2 sparkVelocity = Projectile.velocity * 0.5f; + + float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f); + Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f); + Particle spark1 = new LineParticle(Projectile.Center, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark1); + + float sparkScale2 = Main.rand.NextFloat(0.4f, 1f); + Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f); + Particle spark2 = new LineParticle(Projectile.Center, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? bColor : Color.Green); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, 5, sparkvelocity2, 100, default, Main.rand.NextFloat(0.8f, 1.4f)); + dust.noGravity = true; } + + time = 1; + collideWithTiles = false; + canDamage = false; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + canStick = false; + storedVelocity = Projectile.velocity; + Projectile.velocity = Vector2.Zero; + SoundStyle sound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2"); + SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + + if (pullCheckValid) + { + chosenTarget.velocity += storedVelocity * (strongEnemy ? 0.3f : 1.5f); + hasLatchedTarget = true; + if ((chosenTarget.lifeMax >= Projectile.damage * 28f) || chosenTarget.boss) + strongEnemy = true; + SoundStyle sound5 = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact"); + SoundEngine.PlaySound(sound5 with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + if (strongEnemy) + { + SoundStyle sound8 = new("CalamityMod/Sounds/Item/MetalEcho"); + SoundEngine.PlaySound(sound8 with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.8f, 0.9f) }, Projectile.Center); + } + } + else + normalHit = true; } - else - normalHit = true; - } - bool hitTarget = chosenTarget != null && target == chosenTarget; - modifiers.SourceDamage *= hitTarget ? (ripped ? 2 : Projectile.numHits < 1 ? 0.01f : 1) : 0.2f; - if (hitTarget && pullingTarget) - { - chosenTarget.velocity = -storedVelocity * 3; - modifiers.SetInstantKill(); - } + bool hitTarget = chosenTarget != null && target == chosenTarget; + modifiers.SourceDamage *= hitTarget ? (ripped ? 2 : Projectile.numHits < 1 ? 0.01f : 1) : 0.2f; + if (hitTarget && pullingTarget) + { + chosenTarget.velocity = -storedVelocity * 3; + modifiers.SetInstantKill(); + } - if (!pullCheckValid) - target.AddBuff(ModContent.BuffType(), 180); + if (!pullCheckValid) + target.AddBuff(ModContent.BuffType(), 180); + } } public override bool? CanDamage() => canDamage ? null : false; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 25 * (!spawnPullBlood ? 4 : 1), targetHitbox); - public override bool PreDraw(ref Color lightColor) { Player Owner = Main.player[Projectile.owner]; diff --git a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs index 30c4c325b1..c5ab4cae17 100644 --- a/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs +++ b/Projectiles/Ranged/StarmageddonBinaryStarCenter.cs @@ -1,6 +1,7 @@ using System; using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.NPCs.CalClone; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { + [PierceResistException] public class StarmageddonBinaryStarCenter : ModProjectile, ILocalizedModType { private const float TimeBeforeHoming = 30f; diff --git a/Projectiles/Rogue/BallisticPoisonCloud.cs b/Projectiles/Rogue/BallisticPoisonCloud.cs index efd74924e6..51cb7e8104 100644 --- a/Projectiles/Rogue/BallisticPoisonCloud.cs +++ b/Projectiles/Rogue/BallisticPoisonCloud.cs @@ -1,10 +1,12 @@ using System; +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException(onlyForSingleHitbox: true)] public class BallisticPoisonCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index d10b880aa1..d845c88fe8 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -10,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class DoomsdayDeviceProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index be9d2ec200..9c4201d233 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,7 +1,10 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { + [PierceResistException(onlyForSingleHitbox: true)] public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 2ea50cc720..29d036ba82 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.NPCs; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class EclipsesStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 6c32ebf15d..a81963a004 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -11,6 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class EradicatorProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 86102bdd3f..1dea82d896 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -344,9 +344,9 @@ namespace CalamityMod.Projectiles.Rogue searchedTarget.active = false; } - SoundStyle gfb = new("CalamityMod/Sounds/Item/HolyBurst"); - for (int i = 0; i < 7; i++) - SoundEngine.PlaySound(gfb with { Volume = 1f, Pitch = 0.2f * i, MaxInstances = 7 }, Projectile.Center); + SoundStyle gong = new("CalamityMod/Sounds/Custom/GFB/Jesus"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(gong with { Volume = 1f, MaxInstances = 2 }, Projectile.Center); } else { diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index ccbb12405c..378c484662 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -1,10 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class FantasyTalismanProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index c15729eb34..9be29c003d 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -1,10 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class FantasyTalismanStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index d0834ef778..e397a9457c 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -1,12 +1,14 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class GodsParanoiaProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index 25b55a5c37..ccb092aea0 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class JawsProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 85a6f13add..2851230620 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class LeviathanTooth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index c048eb3b75..7d5cb2ecae 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class LionfishProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index 0310ef4f94..83d25aece6 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -1,4 +1,4 @@ - +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class MetalShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 492b0a54db..68580e9028 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class NastyChollaBol : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/PlaguedFuelPackCloud.cs b/Projectiles/Rogue/PlaguedFuelPackCloud.cs index a543c97c8b..24e2dfa9d1 100644 --- a/Projectiles/Rogue/PlaguedFuelPackCloud.cs +++ b/Projectiles/Rogue/PlaguedFuelPackCloud.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class PlaguedFuelPackCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index a2989bbd16..f926019b56 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class ReaperProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 8da92c9fc3..2942d3ed40 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -6,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SacrificeProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index f84567151f..2aff8e2686 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -1,11 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SnapClamProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index a7dd3b8d1c..12ddd3ee4b 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -1,11 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class SnapClamStealth : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index d874b1ee34..e2e73954eb 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistException] public class UrchinStingerProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Summon/SeashineSwordProj.cs b/Projectiles/Summon/SeashineSwordProj.cs index 3e5862a8e1..61917656be 100644 --- a/Projectiles/Summon/SeashineSwordProj.cs +++ b/Projectiles/Summon/SeashineSwordProj.cs @@ -255,7 +255,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Summon/SeashineSword").Value; + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Summon/SeashineHilt").Value; Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; Texture2D tex3 = ModContent.Request("CalamityMod/Particles/FullStar").Value; diff --git a/Projectiles/Typeless/ArtifactOfResilienceShards.cs b/Projectiles/Typeless/ArtifactOfResilienceShards.cs index 7e75dadd3c..119154d277 100644 --- a/Projectiles/Typeless/ArtifactOfResilienceShards.cs +++ b/Projectiles/Typeless/ArtifactOfResilienceShards.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class ArtifactOfResilienceShards : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 4a534b93c1..440c655f07 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class BlunderBoosterAura : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/CoralBubble.cs b/Projectiles/Typeless/CoralBubble.cs index 9d4cd5e92e..8162bb748b 100644 --- a/Projectiles/Typeless/CoralBubble.cs +++ b/Projectiles/Typeless/CoralBubble.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -63,7 +64,16 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { + Vector3 lightCol = new(85f / 255f, 151f / 255f, 196f / 255f); + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + lightCol *= brightness; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Lighting.AddLight(Projectile.position, lightCol); return false; } diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index d6bc051dae..ec264285ad 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -66,7 +67,16 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { + Vector3 lightCol = new(85f / 255f, 151f / 255f, 196f / 255f); + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + lightCol *= brightness; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + Lighting.AddLight(Projectile.position, lightCol); return false; } diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index d32a00d7f5..e3e6320565 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class CryonicShield : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 49f7b51a74..5094d26e31 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Balancing; using CalamityMod.CalPlayer; +using CalamityMod.NPCs; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Terraria; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class FungalClumpMinion : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/HyperiusBleed.cs b/Projectiles/Typeless/HyperiusBleed.cs new file mode 100644 index 0000000000..173f4a5787 --- /dev/null +++ b/Projectiles/Typeless/HyperiusBleed.cs @@ -0,0 +1,20 @@ +using CalamityMod.Items.Ammo; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HyperiusBleed : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + + modifiers.HideCombatText(); // Has special combat text + + SoundEngine.PlaySound(HyperiusBullet.hit with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f), MaxInstances = 10 }, Projectile.Center); + } + } +} diff --git a/Projectiles/Typeless/HyperiusDamage.cs b/Projectiles/Typeless/HyperiusDamage.cs new file mode 100644 index 0000000000..bb700a296e --- /dev/null +++ b/Projectiles/Typeless/HyperiusDamage.cs @@ -0,0 +1,22 @@ +using CalamityMod.Items.Ammo; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class HyperiusDamage : DirectStrike, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + Player Owner = Main.player[Projectile.owner]; + + modifiers.HideCombatText(); // Has special combat text + modifiers.SourceDamage *= 0; + modifiers.FinalDamage.Flat = Projectile.damage; // Always does the exact damage of the hit so that it doesn't double scale with defense and dr + + SoundEngine.PlaySound(HyperiusBullet.hit with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f), MaxInstances = 10 }, Projectile.Center); + } + } +} diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index ef4a20ab8e..6a575b5809 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -1,4 +1,5 @@ using CalamityMod.Balancing; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class OmegaBlueTentacle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index cc5b122fa2..831a4ae3f5 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -4,6 +4,7 @@ using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -17,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class RelicOfDeliveranceSpear : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 26e2976644..9984be55a6 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class TeslaAura : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Projectiles/Typeless/TransformerBlob.cs b/Projectiles/Typeless/TransformerBlob.cs index 3184708412..b012f5def2 100644 --- a/Projectiles/Typeless/TransformerBlob.cs +++ b/Projectiles/Typeless/TransformerBlob.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +14,7 @@ using Terraria.ModLoader.IO; namespace CalamityMod.Projectiles.Typeless { + [PierceResistException] public class TransformerBlob : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; diff --git a/Sounds/Custom/GFB/Jesus.ogg b/Sounds/Custom/GFB/Jesus.ogg new file mode 100644 index 0000000000..4cc26fb6f7 Binary files /dev/null and b/Sounds/Custom/GFB/Jesus.ogg differ diff --git a/Sounds/Item/HyperiusOverflow.ogg b/Sounds/Item/HyperiusOverflow.ogg new file mode 100644 index 0000000000..772d253f6a Binary files /dev/null and b/Sounds/Item/HyperiusOverflow.ogg differ diff --git a/Sounds/Item/MagicBlast.ogg b/Sounds/Item/MagicBlast.ogg new file mode 100644 index 0000000000..e8e088d672 Binary files /dev/null and b/Sounds/Item/MagicBlast.ogg differ diff --git a/Systems/Collections/NPCs/PierceResistList.cs b/Systems/Collections/NPCs/PierceResistList.cs deleted file mode 100644 index efbe96843f..0000000000 --- a/Systems/Collections/NPCs/PierceResistList.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PierceResistList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/PierceResistExceptionLeviAureusList.cs b/Systems/Collections/PierceResistExceptionLeviAureusList.cs deleted file mode 100644 index 4c3f202da1..0000000000 --- a/Systems/Collections/PierceResistExceptionLeviAureusList.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PierceResistExceptionLeviAureusList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.NettleBurstEnd, - ProjectileID.NettleBurstLeft, - ProjectileID.NettleBurstRight, - ProjectileID.PrincessWeapon, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int projectileType) => List.Contains(projectileType); - } -} diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs deleted file mode 100644 index 95dc2ecceb..0000000000 --- a/Systems/Collections/PierceResistExceptionList.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.MaceFlails; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Typeless; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PierceResistExceptionList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.Arkhalis, - ProjectileID.ChargedBlasterLaser, - ProjectileID.ClingerStaff, - ProjectileID.FinalFractal, - ProjectileID.FlyingKnife, - ProjectileID.LastPrismLaser, - ProjectileID.MonkStaffT3, - ProjectileID.PiercingStarlight, - ProjectileID.Terragrim, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int projectileType) => List.Contains(projectileType); - } -} diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a1df771ab7..a72f2cdd96 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -793,7 +793,6 @@ namespace CalamityMod.Systems var edits = new Dictionary, Action>(128) { - { Vanilla(ItemID.EnchantedBoomerang), Disable }, // Calamity adds its own recipe { Vanilla(ItemID.MiniNukeI), Disable }, { Vanilla(ItemID.MiniNukeII), Disable }, @@ -845,6 +844,9 @@ namespace CalamityMod.Systems { Vanilla(ItemID.PumpkinMoonMedallion), RemoveIngredient(ItemID.HallowedBar) }, { Vanilla(ItemID.NaughtyPresent), RemoveIngredient(ItemID.SoulofFright) }, + // Make Enchanted Boomerang slightly harder to obtain + { Vanilla(ItemID.EnchantedBoomerang), EnchantedBoomerangRecipeEdit }, + // Add 20 Souls of Flight to vanilla Luminite wings { VanillaEach(ItemID.WingsSolar, ItemID.WingsVortex, ItemID.WingsNebula, ItemID.WingsStardust), LunarWingsRecipeEdits }, @@ -1011,6 +1013,24 @@ namespace CalamityMod.Systems r.requiredItem[2] = r.requiredItem[1]; r.requiredItem[1] = store; } + + private static void EnchantedBoomerangRecipeEdit(Recipe r) + { + // Add Any Gold Bar and make it crafted at an Anvil + r.AddRecipeGroup(AnyGoldBar, 8); + r.AddTile(TileID.Anvils); + + // Then move it to the proper spot + if (r.requiredItem.Count < 3) + return; + + var store = r.requiredItem[1]; + r.requiredItem[1] = r.requiredItem[2]; + r.requiredItem[2] = store; + + // Increase amount of Fallen Stars used + r.requiredItem[2].stack = 6; + } #endregion #region Shimmer Recipes @@ -1438,9 +1458,8 @@ namespace CalamityMod.Systems // Desert Minecart r = Recipe.Create(ItemID.DesertMinecart); + r.AddIngredient(ItemID.Minecart); r.AddIngredient(ItemID.SandstoneBrick, 20); - r.AddRecipeGroup("AnyGoldBar", 6); - r.AddRecipeGroup("IronBar", 3); r.AddTile(TileID.Anvils); r.Register(); r.DisableDecraft(); @@ -1540,15 +1559,6 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Enchanted Boomerang - r = Recipe.Create(ItemID.EnchantedBoomerang); - r.AddIngredient(ItemID.WoodenBoomerang); - r.AddIngredient(ItemID.FallenStar, 6); - r.AddRecipeGroup(AnyGoldBar, 8); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - // Enchanted Sword r = Recipe.Create(ItemID.EnchantedSword); r.AddIngredient(10); diff --git a/Systems/Tile/BiomeTileCounterSystem.cs b/Systems/Tile/BiomeTileCounterSystem.cs index e66ed5837c..bd77177433 100644 --- a/Systems/Tile/BiomeTileCounterSystem.cs +++ b/Systems/Tile/BiomeTileCounterSystem.cs @@ -55,8 +55,8 @@ namespace CalamityMod.Systems public override void TileCountsAvailable(ReadOnlySpan tileCounts) { BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/Tile/TileFramingSystem.cs b/Systems/Tile/TileFramingSystem.cs index e55bedb771..8294009f1b 100644 --- a/Systems/Tile/TileFramingSystem.cs +++ b/Systems/Tile/TileFramingSystem.cs @@ -92,6 +92,7 @@ namespace CalamityMod.Systems (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), ]; private static int[][] PlantValidGrounds; diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 58ff723779..ef10be5563 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -36,6 +36,14 @@ namespace CalamityMod.Systems #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref double totalWeight) { + // Better Underworld (similar to Don't Dig Up seed but with some adjustments) + int UnderworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); + tasks[UnderworldIndex] = new PassLegacy("Underworld", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; + CustomUnderworld.NewUnderworld(); + }); + // Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); if (islandIndex != -1) @@ -71,7 +79,7 @@ namespace CalamityMod.Systems FloralParadiseMinibiome.GenerateInstances(); })); - // Improved Golem arena + // Improved Golem Arena int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => { @@ -82,7 +90,7 @@ namespace CalamityMod.Systems Main.tileSolid[232] = false; }); - // Better Lihzahrd altar (consistency?) + // Better Lihzahrd Altar (consistency?) int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => { @@ -90,7 +98,7 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTempleLihzahrdAltar(); }); - // Giant beehive + // Big Hive int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); if (giantHiveIndex != -1) { @@ -143,7 +151,7 @@ namespace CalamityMod.Systems })); } - // Vernal pass + // Vernal Pass int vernalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Muds Walls In Jungle")); if (vernalIndex != -1) { @@ -154,7 +162,7 @@ namespace CalamityMod.Systems })); } - // sunken sea + // Sunken Sea int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); if (SunkenSeaIndex != -1) { @@ -173,14 +181,14 @@ namespace CalamityMod.Systems }; // place each piece of the sunken sea based on the above positons - SunkenSea.PlaceRadiantReefs(sunkenSeaX - 100, sunkenSeaY + 75, true); - SunkenSea.PlaceRadiantReefs(sunkenSeaX + 100, sunkenSeaY + 75, false); - SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceRadiantReefs(sunkenSeaX, sunkenSeaY + 110); + SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - SunkenSea.PlaceSunkenSeaAmbience(); - SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); + SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceSunkenSeaAmbience(); })); } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index 48bfde5d53..a4670f5322 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.Abyss Tile up2 = Main.tile[i, j - 2]; // Place kelp - if (WorldGen.genRand.NextBool(5)&& !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(5) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index 698c1b4422..e34c381cb3 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.Abyss public class PyreMantle : ModTile { public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; diff --git a/Tiles/Abyss/SulphurousSand.png b/Tiles/Abyss/SulphurousSand.png index 200e715bfc..cbfcee2433 100644 Binary files a/Tiles/Abyss/SulphurousSand.png and b/Tiles/Abyss/SulphurousSand.png differ diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index 1ecdc028b3..d526aaff48 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Tiles.Abyss Tile up2 = Main.tile[i, j - 2]; // Place sulphur tentacle corals - if (WorldGen.genRand.NextBool(10)&& !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.NextBool(10) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index 232125a4e6..bd3732bb9c 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -69,39 +69,39 @@ namespace CalamityMod.Tiles.Abyss } public override void RandomUpdate(int i, int j) - { - Tile tileBelow = Framing.GetTileSafely(i, j + 1); - if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) { - bool PlaceVine = false; - int Test = j; - while (Test > j - 10) + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) { - Tile testTile = Framing.GetTileSafely(i, Test); - if (testTile.BottomSlope) + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) { - break; - } - else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) { - Test--; - continue; - } - PlaceVine = true; - break; - } - - if (PlaceVine) + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) { - tileBelow.TileType = Type; - tileBelow.HasTile = true; - WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.dedServ) + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) { - NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); - } - } - } - } + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index e9ce5af903..4c2f9f609c 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.Abyss Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileBrick[Type] = true; + Main.tileBrick[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithAbyss(Type); diff --git a/Tiles/Astral/AstralDirt.png b/Tiles/Astral/AstralDirt.png index 47b54336de..0a6f5d2d23 100644 Binary files a/Tiles/Astral/AstralDirt.png and b/Tiles/Astral/AstralDirt.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 724f3f159c..854b2e295e 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Tiles public static List GrowthTiles = new List() { TileType(), + TileType(), + TileType(), TileType(), TileType(), TileType(), diff --git a/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs b/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs index 544b0fcab8..a196adc55a 100644 --- a/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs +++ b/Tiles/FurnitureMarnite/PolishedMarniteBlock.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void SetStaticDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; Main.tileShine[Type] = 3500; diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..41a4aeb59a --- /dev/null +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using CalamityMod.Systems; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class ChargedWulfrumWallMountedBulb : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 84f / 255f; + g = 212f / 255f; + b = 233f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.094f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + float transparency = 0.05f + wave1angle; + + Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow").Value; + + Tile tile = Main.tile[i, j]; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png new file mode 100644 index 0000000000..575501ad39 Binary files /dev/null and b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.png differ diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow.png b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow.png new file mode 100644 index 0000000000..24567bc279 Binary files /dev/null and b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs new file mode 100644 index 0000000000..17e276d470 --- /dev/null +++ b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Items.Placeables.DraedonStructures.CagedLights; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using Terraria.Audio; +using CalamityMod.Systems; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.FurnitureWulfrum +{ + public class WulfrumWallMountedBulb : ModTile + { + public static readonly SoundStyle MinePlatingSound = new("CalamityMod/Sounds/Custom/PlatingMine", 3); + + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = false; + + HitSound = MinePlatingSound; + DustType = 299; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(92, 187, 99), CalamityUtils.GetItemName()); + + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 10; // total 10 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 2; // only 1 placement alternative per row + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(2); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(4); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(6); + + // Attach to wall + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 141f / 255f; + g = 219f / 255f; + b = 84f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); + + float time = Main.GameUpdateCount; + float waveScale1 = time * 0.094f; + int scalar = i - (j / 2); + float wave1 = waveScale1 * -50 + scalar * 12; + float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); + + float transparency = 0.05f + wave1angle; + + Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow").Value; + + Tile tile = Main.tile[i, j]; + Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); + } + } +} diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.png b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.png new file mode 100644 index 0000000000..3c4658b0ee Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow.png b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow.png new file mode 100644 index 0000000000..b46c72f818 Binary files /dev/null and b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow.png differ diff --git a/Tiles/Merges/PolypSandMerge.cs b/Tiles/Merges/PolypSandMerge.cs new file mode 100644 index 0000000000..572ab6505e --- /dev/null +++ b/Tiles/Merges/PolypSandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class PolypSandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/PolypSandMerge.png b/Tiles/Merges/PolypSandMerge.png new file mode 100644 index 0000000000..9b36426426 Binary files /dev/null and b/Tiles/Merges/PolypSandMerge.png differ diff --git a/Tiles/Merges/RunestoneMerge.cs b/Tiles/Merges/RunestoneMerge.cs new file mode 100644 index 0000000000..08ef656bb0 --- /dev/null +++ b/Tiles/Merges/RunestoneMerge.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using Terraria.ID; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class RunestoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/RunestoneMerge.png b/Tiles/Merges/RunestoneMerge.png new file mode 100644 index 0000000000..084eb1d80a Binary files /dev/null and b/Tiles/Merges/RunestoneMerge.png differ diff --git a/Tiles/Merges/ScarletSeaGrassTileMerge.cs b/Tiles/Merges/ScarletSeaGrassTileMerge.cs new file mode 100644 index 0000000000..78e03fbe21 --- /dev/null +++ b/Tiles/Merges/ScarletSeaGrassTileMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class ScarletSeaGrassTileMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/ScarletSeaGrassTileMerge.png b/Tiles/Merges/ScarletSeaGrassTileMerge.png new file mode 100644 index 0000000000..9b36426426 Binary files /dev/null and b/Tiles/Merges/ScarletSeaGrassTileMerge.png differ diff --git a/Tiles/Merges/ShellstoneMerge.cs b/Tiles/Merges/ShellstoneMerge.cs new file mode 100644 index 0000000000..a01e3366e8 --- /dev/null +++ b/Tiles/Merges/ShellstoneMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class ShellstoneMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/ShellstoneMerge.png b/Tiles/Merges/ShellstoneMerge.png new file mode 100644 index 0000000000..30e9733f65 Binary files /dev/null and b/Tiles/Merges/ShellstoneMerge.png differ diff --git a/Tiles/Ores/ScoriaOre.cs b/Tiles/Ores/ScoriaOre.cs index d29d32726f..66f4d09ea4 100644 --- a/Tiles/Ores/ScoriaOre.cs +++ b/Tiles/Ores/ScoriaOre.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.Ore[Type] = true; DustType = 105; - AddMapEntry(new Color(210, 101, 28), CreateMapEntryName()); + AddMapEntry(new Color(167, 80, 22), CreateMapEntryName()); MineResist = 3f; MinPick = 210; HitSound = SoundID.Tink; diff --git a/Tiles/SunkenSea/Ambient/BrainCoral.cs b/Tiles/SunkenSea/Ambient/BrainCoral.cs index f3f73b002f..c115b322ca 100644 --- a/Tiles/SunkenSea/Ambient/BrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/BrainCoral.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); TileObjectData.addTile(Type); - DustType = 253; + DustType = DustID.SailfishBoots; AddMapEntry(new Color(36, 61, 111)); base.SetStaticDefaults(); @@ -44,8 +44,19 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { if (Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && Main.tile[i, tileLocationY - 2].LiquidAmount == 255) { + for (int t = 0; t < 5; t++) + { + Dust dust = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.BlueTorch, 0, 0, 1, default, 1.5f); + dust.velocity *= 0.2f; + dust.noGravity = true; + dust.noLight = true; + dust.noLightEmittence = true; + } + Dust dust2 = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.MagicMirror, 0, 0, 1, Color.LightSkyBlue, 0.5f); + dust2.velocity *= 0.2f; + if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 1f, Main.myPlayer); } } } diff --git a/Tiles/SunkenSea/Ambient/BranchCoral.cs b/Tiles/SunkenSea/Ambient/BranchCoral.cs new file mode 100644 index 0000000000..773d7d5f07 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/BranchCoral.cs @@ -0,0 +1,73 @@ +using System; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using CalamityMod.Items.Weapons.Melee; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class BranchCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileSpelunker[Type] = false; + + HitSound = SoundID.Dig; + DustType = DustID.CrimsonPlants; + + AddMapEntry(new Color(210, 66, 90)); + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 32; // total 32 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 8; // only 1 placement alternative per row + TileObjectData.newTile.RandomStyleRange = 8; // 8 different style will be selected upon placing + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(16); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(24); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 232 / 500f; + g = 122 / 500f; + b = 122 / 500f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/BranchCoral.png b/Tiles/SunkenSea/Ambient/BranchCoral.png new file mode 100644 index 0000000000..5661d35858 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BranchCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral.cs b/Tiles/SunkenSea/Ambient/DigitateCoral.cs new file mode 100644 index 0000000000..bd9961dd72 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DigitateCoral.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DigitateCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(48, 201, 214)); + DustType = DustID.IceGolem; + + base.SetStaticDefaults(); + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + + public class DigitateCoral2 : DigitateCoral + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + + public class DigitateCoral3 : DigitateCoral + { + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral.png b/Tiles/SunkenSea/Ambient/DigitateCoral.png new file mode 100644 index 0000000000..4af501b5ec Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DigitateCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral2.png b/Tiles/SunkenSea/Ambient/DigitateCoral2.png new file mode 100644 index 0000000000..7012604abd Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DigitateCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral3.png b/Tiles/SunkenSea/Ambient/DigitateCoral3.png new file mode 100644 index 0000000000..53d503eb5f Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DigitateCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs new file mode 100644 index 0000000000..9c278f7bc6 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs @@ -0,0 +1,138 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DriftwoodAmbient1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 4); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + + public class DriftwoodAmbient2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 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); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + 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); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient5 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } + public class DriftwoodAmbient6 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png new file mode 100644 index 0000000000..ed3ac19385 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png new file mode 100644 index 0000000000..4b1ae8d4cc Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png new file mode 100644 index 0000000000..b786e79bc1 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png new file mode 100644 index 0000000000..528c3ab92b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png new file mode 100644 index 0000000000..498e6e8bd4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png new file mode 100644 index 0000000000..a723c9116b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png differ diff --git a/Tiles/SunkenSea/Ambient/FryCoral.cs b/Tiles/SunkenSea/Ambient/FryCoral.cs new file mode 100644 index 0000000000..9002d177a9 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/FryCoral.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class FryCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(79, 196, 149)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 235f / 400f; + g = 146f / 400f; + b = 146f / 400f; + } + } + + public class FryCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(79, 196, 149)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 235f / 400f; + g = 146f / 400f; + b = 146f / 400f; + } + } + public class FryCoral3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + 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); + AddMapEntry(new Color(79, 196, 149)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 235f / 400f; + g = 146f / 400f; + b = 146f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/FryCoral.png b/Tiles/SunkenSea/Ambient/FryCoral.png new file mode 100644 index 0000000000..99e82a386d Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FryCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/FryCoral2.png b/Tiles/SunkenSea/Ambient/FryCoral2.png new file mode 100644 index 0000000000..82f4c7858a Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FryCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/FryCoral3.png b/Tiles/SunkenSea/Ambient/FryCoral3.png new file mode 100644 index 0000000000..830b4e0432 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FryCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs new file mode 100644 index 0000000000..827579e20d --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs @@ -0,0 +1,60 @@ +using System; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LongScarletSeagrass : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); + DustType = DustID.CrimsonPlants; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -30; + height = 48; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png new file mode 100644 index 0000000000..2cef1eb725 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs b/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs new file mode 100644 index 0000000000..169776c86a --- /dev/null +++ b/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class NavystoneAmbient : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(59, 136, 146)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } + + public class NavystoneAmbient2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(59, 136, 146)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } + public class NavystoneAmbient3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + 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); + AddMapEntry(new Color(59, 136, 146)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient.png new file mode 100644 index 0000000000..9b93ad7195 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystoneAmbient.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png new file mode 100644 index 0000000000..08f3a3845b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png new file mode 100644 index 0000000000..891b37d87d Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png differ diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs new file mode 100644 index 0000000000..eb442b6f1b --- /dev/null +++ b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs @@ -0,0 +1,127 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class RefractiveHangingCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoFail[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileNoSunLight[Type] = false; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.VineThreads[Type] = true; + AddMapEntry(new Color(96, 109, 154)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Framing.GetTileSafely(i, j + 1); + if (tile.HasTile && tile.TileType == Type) + { + WorldGen.KillTile(i, j + 1); + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + int type = -1; + if (tileAbove.HasTile && !tileAbove.BottomSlope) + { + type = tileAbove.TileType; + } + + if (type == ModContent.TileType() || type == Type) + { + return true; + } + + WorldGen.KillTile(i, j); + return true; + } + public override void NearbyEffects(int i, int j, bool closer) + { + // Light Cyan + if (closer && Main.rand.NextBool(600)) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(136, 206, 215), 1.7f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + //Lilac + if (closer && Main.rand.NextBool(600)) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, DustID.Firefly, 0.23255825f, 10f, 0, new Color(236, 194, 252), 1.6f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.9f; + brightness += 0.6f; + brightness = MathHelper.Clamp(brightness, 0.5f, 0.9f); + brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.01f + i); + Color lilac = new Color(236, 194, 252); + Color mint = new Color(163, 252, 195); + Color value = Color.Lerp(lilac, mint, (MathF.Sin(j / 30f + Main.GameUpdateCount * 0.017f + -i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(lilac, mint, (MathF.Sin((-j - 100) / 40f + Main.GameUpdateCount * 0.014f + i / 20f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + + public override void RandomUpdate(int i, int j) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + { + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) + { + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) + { + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + { + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) + { + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } + } +} diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.png b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.png new file mode 100644 index 0000000000..cd49838375 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/SeaAnemone.cs b/Tiles/SunkenSea/Ambient/SeaAnemone.cs index fe95a937cc..3986a6af4c 100644 --- a/Tiles/SunkenSea/Ambient/SeaAnemone.cs +++ b/Tiles/SunkenSea/Ambient/SeaAnemone.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -10,12 +12,13 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public override void SetStaticDefaults() { + Main.tileLighted[Type] = true; AnimationFrameHeight = 36; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - DustType = 253; + DustType = DustID.TsunamiInABottle; AddMapEntry(new Color(54, 69, 72)); base.SetStaticDefaults(); @@ -26,6 +29,21 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient num = fail ? 1 : 3; } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.4f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 85f / 255f; + b = 151f / 255f; + g = 196f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; diff --git a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs index 6013e6ac73..5b39be26bd 100644 --- a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - DustType = 253; + DustType = DustID.SailfishBoots; AddMapEntry(new Color(36, 61, 111)); base.SetStaticDefaults(); @@ -45,6 +45,17 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { if (Main.tile[i, tileLocationY].LiquidAmount == 255 && Main.tile[i, tileLocationY - 1].LiquidAmount == 255 && Main.tile[i, tileLocationY - 2].LiquidAmount == 255) { + for (int t = 0; t < 5; t++) + { + Dust dust = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.BlueTorch, 0, 0, 1, default, 1.5f); + dust.velocity *= 0.2f; + dust.noGravity = true; + dust.noLight = true; + dust.noLightEmittence = true; + } + Dust dust2 = Dust.NewDustDirect(new Vector2(i, j + 0.5f) * 16, 16, 16, DustID.MagicMirror, 0, 0, 1, Color.LightSkyBlue, 0.5f); + dust2.velocity *= 0.2f; + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(new EntitySource_WorldEvent(), i * 16 + 16, tileLocationY * 16 + 16, 0f, -0.1f, ModContent.ProjectileType(), 0, 1f, Main.myPlayer); } diff --git a/Tiles/SunkenSea/Ambient/StalkCoral.cs b/Tiles/SunkenSea/Ambient/StalkCoral.cs new file mode 100644 index 0000000000..0ad633d405 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/StalkCoral.cs @@ -0,0 +1,113 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class StalkCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 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); + AddMapEntry(new Color(156, 87, 57)); + DustType = DustID.t_PearlWood; + HitSound = SoundID.Dig; + + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 192f / 450f; + g = 173f / 450f; + b = 166f / 450f; + } + } + + public class StalkCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 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); + AddMapEntry(new Color(156, 87, 57)); + DustType = DustID.t_PearlWood; + HitSound = SoundID.Dig; + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 192f / 450f; + g = 173f / 450f; + b = 166f / 450f; + } + } + public class StalkCoral3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + 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); + AddMapEntry(new Color(156, 87, 57)); + DustType = DustID.t_PearlWood; + HitSound = SoundID.Dig; + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 192f / 450f; + g = 173f / 450f; + b = 166f / 450f; + } + } + +} diff --git a/Tiles/SunkenSea/Ambient/StalkCoral.png b/Tiles/SunkenSea/Ambient/StalkCoral.png new file mode 100644 index 0000000000..63624ae860 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/StalkCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/StalkCoral2.png b/Tiles/SunkenSea/Ambient/StalkCoral2.png new file mode 100644 index 0000000000..b252e86203 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/StalkCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/StalkCoral3.png b/Tiles/SunkenSea/Ambient/StalkCoral3.png new file mode 100644 index 0000000000..cab856dd66 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/StalkCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral.cs b/Tiles/SunkenSea/Ambient/TallDigitateCoral.cs new file mode 100644 index 0000000000..9f1a283578 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/TallDigitateCoral.cs @@ -0,0 +1,137 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class TallDigitateCoral : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 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); + AddMapEntry(new Color(48, 201, 214)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + + public class TallDigitateCoral2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 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); + AddMapEntry(new Color(48, 201, 214)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + public class TallDigitateCoral3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 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); + AddMapEntry(new Color(48, 201, 214)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } + public class TallDigitateCoral4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 6; + TileObjectData.newTile.Origin = new Point16(2, 3); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 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); + AddMapEntry(new Color(48, 201, 214)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 56f / 400f; + g = 164f / 400f; + b = 180f / 400f; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral.png new file mode 100644 index 0000000000..432a9bfed7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral2.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral2.png new file mode 100644 index 0000000000..2602cb0363 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral2.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral3.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral3.png new file mode 100644 index 0000000000..d7898fe9c4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral3.png differ diff --git a/Tiles/SunkenSea/Ambient/TallDigitateCoral4.png b/Tiles/SunkenSea/Ambient/TallDigitateCoral4.png new file mode 100644 index 0000000000..b1b1bca49a Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TallDigitateCoral4.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs new file mode 100644 index 0000000000..587ed2f77e --- /dev/null +++ b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs @@ -0,0 +1,161 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class WideScarletSeagrass : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(187, 43, 44)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public class WideScarletSeagrass2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 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); + AddMapEntry(new Color(187, 43, 44)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + public class WideScarletSeagrass3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + 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); + AddMapEntry(new Color(187, 43, 44)); + DustType = 96; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + public class WideScarletSeagrass4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(2, 3); + 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); + AddMapEntry(new Color(187, 43, 44)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; + brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); + brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); + brightness += 0.7f; + brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png new file mode 100644 index 0000000000..6e040b11de Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png new file mode 100644 index 0000000000..ef6e26701f Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png new file mode 100644 index 0000000000..a3620da034 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png new file mode 100644 index 0000000000..ca8367022c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png differ diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs index 66801b9ce7..6e309e5123 100644 --- a/Tiles/SunkenSea/Basalt.cs +++ b/Tiles/SunkenSea/Basalt.cs @@ -1,5 +1,4 @@ -using CalamityMod.Systems; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,18 +26,24 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - DustType = 36; + DustType = DustID.Ash; HitSound = SoundID.Tink; AddMapEntry(new Color(58, 55, 70)); MinPick = 110; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool CreateDust(int i, int j, ref int type) @@ -53,10 +58,5 @@ namespace CalamityMod.Tiles.SunkenSea frameYOffset = j % 4 * sheetHeight; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - // 02JUN2024: Ozzatron: unclear if this is the correct framing strategy for Basalt - return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); - } } } diff --git a/Tiles/SunkenSea/Basalt.png b/Tiles/SunkenSea/Basalt.png index 05a9bf9830..4341da810c 100644 Binary files a/Tiles/SunkenSea/Basalt.png and b/Tiles/SunkenSea/Basalt.png differ diff --git a/Tiles/SunkenSea/BlackPearlPile.cs b/Tiles/SunkenSea/BlackPearlPile.cs index 0dcf0cfa49..5bc5af6bb7 100644 --- a/Tiles/SunkenSea/BlackPearlPile.cs +++ b/Tiles/SunkenSea/BlackPearlPile.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,18 +22,23 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Shatter; - DustType = 82; + DustType = DustID.Lead; AddMapEntry(new Color(29, 33, 38)); TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/CyanCoral.cs b/Tiles/SunkenSea/CyanCoral.cs index 962a945c95..596a66cc9c 100644 --- a/Tiles/SunkenSea/CyanCoral.cs +++ b/Tiles/SunkenSea/CyanCoral.cs @@ -26,17 +26,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.HallowSpray; AddMapEntry(new Color(92, 168, 198)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/Driftwood.cs b/Tiles/SunkenSea/Driftwood.cs index d8b24dbb9d..2912e3a13a 100644 --- a/Tiles/SunkenSea/Driftwood.cs +++ b/Tiles/SunkenSea/Driftwood.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; HitSound = SoundID.Dig; - DustType = 121; + DustType = DustID.Shadewood_Tree; AddMapEntry(new Color(136, 129, 154)); - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + // 02JUN2024: Ozzatron: Dunesand has no merge + // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); diff --git a/Tiles/SunkenSea/RuneSand.cs b/Tiles/SunkenSea/Dunesand.cs similarity index 93% rename from Tiles/SunkenSea/RuneSand.cs rename to Tiles/SunkenSea/Dunesand.cs index 41e23b8165..ddf287c5f5 100644 --- a/Tiles/SunkenSea/RuneSand.cs +++ b/Tiles/SunkenSea/Dunesand.cs @@ -6,7 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.SunkenSea { - public class RuneSand : ModTile + [LegacyName("RuneSand")] + public class Dunesand : ModTile { public override void SetStaticDefaults() { @@ -23,7 +24,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; Main.tileShine2[Type] = true; - DustType = 147; + DustType = DustID.Hive; AddMapEntry(new Color(210, 124, 45)); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/RuneSand.png b/Tiles/SunkenSea/Dunesand.png similarity index 100% rename from Tiles/SunkenSea/RuneSand.png rename to Tiles/SunkenSea/Dunesand.png diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 9638735706..586129ae10 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -27,14 +27,16 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here Main.tileShine[Type] = 1800; - Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - DustType = 108; - AddMapEntry(new Color(158, 203, 234)); + DustType = DustID.Titanium; + AddMapEntry(new Color(163, 194, 212)); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index ce710bc265..c85a907006 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - DustType = 108; + DustType = DustID.Titanium; AddMapEntry(new Color(61, 151, 194)); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); diff --git a/Tiles/SunkenSea/LimeCoral.cs b/Tiles/SunkenSea/LimeCoral.cs index b4536f301a..72fb3e4bfc 100644 --- a/Tiles/SunkenSea/LimeCoral.cs +++ b/Tiles/SunkenSea/LimeCoral.cs @@ -21,17 +21,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Terra; AddMapEntry(new Color(139, 206, 56)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/Limestone.cs b/Tiles/SunkenSea/Limestone.cs index 2b154ba374..6c05789b43 100644 --- a/Tiles/SunkenSea/Limestone.cs +++ b/Tiles/SunkenSea/Limestone.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Merges; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -19,14 +20,12 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; - DustType = 22; + DustType = DustID.Pot; AddMapEntry(new Color(154, 119, 119)); - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/MagentaCoral.cs b/Tiles/SunkenSea/MagentaCoral.cs index 85794d1b39..327b375883 100644 --- a/Tiles/SunkenSea/MagentaCoral.cs +++ b/Tiles/SunkenSea/MagentaCoral.cs @@ -26,17 +26,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Ice_Pink; AddMapEntry(new Color(206, 56, 123)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs new file mode 100644 index 0000000000..bb01d56583 --- /dev/null +++ b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs @@ -0,0 +1,92 @@ +using System; +using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ObjectData; +using CalamityMod.Items.Weapons.Melee; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class MediumSeaPrismCrystal : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileObsidianKill[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + HitSound = SoundID.Item27; + DustType = DustID.IceRod; + MinPick = 55; + + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + + // Attach to ground + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 32; // total 32 frames, all should be same "itemStyle" + TileObjectData.newTile.StyleWrapLimit = 8; // only 1 placement alternative per row + TileObjectData.newTile.RandomStyleRange = 8; // 8 different style will be selected upon placing + TileObjectData.newTile.Origin = new Point16(0, 1); + + // Attach to side (right) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.addAlternate(8); + + // Attach to ceiling + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile | AnchorType.SolidBottom, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(16); + + // Attach to side (left) + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.AnchorBottom = AnchorData.Empty; + TileObjectData.newAlternate.Origin = new Point16(0, 0); + TileObjectData.addAlternate(24); + TileObjectData.addTile(Type); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + var tile = Main.tile[i, j]; + bool lessLightDueToLowWater = tile.LiquidAmount > 50 && tile.LiquidType == LiquidID.Water; + + //Blue + Color blue = new Color(202, 236, 238); + Color darkviolet = new Color(18, 67, 116); + Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 10) / 50f + Main.GameUpdateCount * 0.064f + -i / 30f) + 1f) / 2f); + r = lessLightDueToLowWater ? 0.27f : 0.36f; + g = lessLightDueToLowWater ? 0.405f : 0.54f; + b = lessLightDueToLowWater ? 0.405f : 0.54f; + r *= (value.R + value1.R) / 300f; + g *= (value.G + value1.G) / 300f; + b *= (value.B + value1.B) / 300f; + } + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType(), 4); + } + } +} diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.png b/Tiles/SunkenSea/MediumSeaPrismCrystal.png new file mode 100644 index 0000000000..e087780707 Binary files /dev/null and b/Tiles/SunkenSea/MediumSeaPrismCrystal.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index d982d24e92..f599048eec 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -18,14 +18,13 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - DustType = 96; + DustType = DustID.BlueMoss; AddMapEntry(new Color(17, 53, 77)); HitSound = SoundID.Tink; - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/OrangeCoral.cs b/Tiles/SunkenSea/OrangeCoral.cs index d1b7a8e2e4..b9a4a0c5b5 100644 --- a/Tiles/SunkenSea/OrangeCoral.cs +++ b/Tiles/SunkenSea/OrangeCoral.cs @@ -21,17 +21,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Pixie; AddMapEntry(Color.Orange); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/PinkPearlPile.cs b/Tiles/SunkenSea/PinkPearlPile.cs index 3bafcf5afb..2e6b07a060 100644 --- a/Tiles/SunkenSea/PinkPearlPile.cs +++ b/Tiles/SunkenSea/PinkPearlPile.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -19,20 +20,25 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Shatter; - DustType = 119; + DustType = DustID.Ice_Pink; AddMapEntry(new Color(204, 143, 174)); Main.tileShine[Type] = 3500; Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/PolypSand.cs b/Tiles/SunkenSea/PolypSand.cs index 8f819b128d..4910ac35f5 100644 --- a/Tiles/SunkenSea/PolypSand.cs +++ b/Tiles/SunkenSea/PolypSand.cs @@ -1,9 +1,15 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; + + namespace CalamityMod.Tiles.SunkenSea { public class PolypSand : ModTile @@ -13,7 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.GeneralPlacementTiles[Type] = false; Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = false; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); @@ -21,11 +27,11 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - Main.tileShine2[Type] = true; - DustType = 147; + DustType = DustID.Ice_Red; AddMapEntry(new Color(221, 180, 182)); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); diff --git a/Tiles/SunkenSea/Runestone.cs b/Tiles/SunkenSea/Runestone.cs index dc2d5cbcb6..7108f7d9ed 100644 --- a/Tiles/SunkenSea/Runestone.cs +++ b/Tiles/SunkenSea/Runestone.cs @@ -21,17 +21,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; - DustType = 22; + DustType = DustID.Pot; AddMapEntry(new Color(152, 89, 78)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/Tiles/SunkenSea/Runestone.png b/Tiles/SunkenSea/Runestone.png index 610bdefa21..a0f612e995 100644 Binary files a/Tiles/SunkenSea/Runestone.png and b/Tiles/SunkenSea/Runestone.png differ diff --git a/Tiles/SunkenSea/RunestoneTerracotta.png b/Tiles/SunkenSea/RunestoneTerracotta.png new file mode 100644 index 0000000000..610bdefa21 Binary files /dev/null and b/Tiles/SunkenSea/RunestoneTerracotta.png differ diff --git a/Tiles/SunkenSea/ScarletSeaGrass.png b/Tiles/SunkenSea/ScarletSeaGrass.png new file mode 100644 index 0000000000..4054602dfb Binary files /dev/null and b/Tiles/SunkenSea/ScarletSeaGrass.png differ diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.cs b/Tiles/SunkenSea/ScarletSeaGrassTile.cs new file mode 100644 index 0000000000..b413e27f6a --- /dev/null +++ b/Tiles/SunkenSea/ScarletSeaGrassTile.cs @@ -0,0 +1,276 @@ +using System; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + + + +namespace CalamityMod.Tiles.SunkenSea +{ + public class ScarletSeaGrassTile : ModTile + { + private int extraFrameHeight = 36; + private int extraFrameWidth = 90; + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = false; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + + DustType = DustID.Hive; + AddMapEntry(new Color(187, 43, 44)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) + { + if (Main.tile[i - 1, j - 1].TileType != Type || Main.tile[i, j - 1].TileType != Type || Main.tile[i + 1, j - 1].TileType != Type || + Main.tile[i - 1, j - 2].TileType != Type || Main.tile[i, j - 2].TileType != Type || Main.tile[i + 1, j - 2].TileType != Type) + { + try + { + Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j); + } + catch { } + } + } + private Color GetDrawColour(int i, int j) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) + { + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Color drawColour = GetDrawColour(i, j); + Texture2D leaves = ModContent.Request("CalamityMod/Tiles/SunkenSea/ScarletSeaGrass").Value; + + DrawExtraTop(i, j, leaves, drawOffset, drawColour); + DrawExtraWallEnds(i, j, leaves, drawOffset, drawColour); + DrawExtraDrapes(i, j, leaves, drawOffset, drawColour); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float brightness = 0.7f; + brightness *= (float)MathF.Sin(-i / 40f + Main.GameUpdateCount * 0.01f + j); + brightness += 0.5f; + r = 187f / 255f; + g = 43f / 255f; + b = 44f / 255f; + r *= brightness; + g *= brightness; + b *= brightness; + } + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + // Place LongScarletSeagrass + if (WorldGen.genRand.NextBool(1) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + // 16 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.dedServ) + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + + #region 'Extra Drapes' Drawing + private void DrawExtraTop(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + If the tile directly above this tile is not otherworldly stone, or if it is, there is air to both sides of that tile, draw the Extra surface + */ + if ( + CheckTile(Type, false, 0, 1, i, j) || + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, true, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + DrawExtraOverhang(i, j, extras, drawOffset, drawColour); + } + } + private bool CheckTile(int type, bool equal, int x, int y, int i, int j) + { + //Subtract y so that y is vertical for ease of readability + return Main.tile[i + x, j - y].TileType == type == equal; + } + private void DrawExtraWallEnds(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Ending the Extra when a wall is reached + */ + + //Left + if ( + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right + if ( + CheckTile(Type, true, -1, 0, i, j) && CheckTile(Type, false, -1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + (CheckTile(Type, true, 1, 1, i, j) || CheckTile(Type, false, 1, 0, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(0f, 16f), new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + private void DrawExtraOverhang(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Called from DrawExtraTop(). Ending the Extra when the edge of the tile is reached + */ + + //Left + if ( + CheckTile(Type, false, -1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(-16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i, j), GetExtraPattern(i - 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right + if ( + CheckTile(Type, false, 1, 0, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 0f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1), 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(extras, drawOffset + new Vector2(16f, 16f), new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i, j), GetExtraPattern(i + 1) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + private void DrawExtraDrapes(int i, int j, Texture2D extras, Vector2 drawOffset, Color drawColour) + { + /* + Hanging 'drapes' of the extra element + */ + + //Base + if ( + (CheckTile(Type, true, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j)) || + (CheckTile(Type, true, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, true, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("middle") + GetExtraVariant(i, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Left Wall + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, -1, 2, i, j) || CheckTile(Type, false, -1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right Wall + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, -1, 2, i, j) && CheckTile(Type, true, 0, 2, i, j) && + (CheckTile(Type, true, 1, 2, i, j) || CheckTile(Type, false, 1, 1, i, j)) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("wallEndRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Left Overhang + if ( + CheckTile(Type, true, 1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, 1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangLeft") + GetExtraVariant(i + 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + //Right Overhang + if ( + CheckTile(Type, true, -1, 1, i, j) && CheckTile(Type, false, 0, 1, i, j) && CheckTile(Type, false, 0, 2, i, j) && CheckTile(Type, false, -1, 2, i, j) + ) + { + Main.spriteBatch.Draw(extras, drawOffset, new Rectangle?(new Rectangle(GetExtraState("overhangRight") + GetExtraVariant(i - 1, j - 1), GetExtraPattern(i) + 18, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + + private int GetExtraState(string type) + { + switch (type) + { + case "middle": + return 36; + case "overhangLeft": + return 18; + case "overhangRight": + return 54; + case "wallEndLeft": + return 0; + case "wallEndRight": + return 72; + default: + Main.NewText(type.ToString() + " is not a valid Extra sheet state"); + return 0; + } + } + + private int GetExtraPattern(int i) + { + return i % 3 * extraFrameHeight; + } + + private int GetExtraVariant(int i, int j) + { + return Main.tile[i, j].TileFrameNumber * extraFrameWidth; + } + } +} +#endregion diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.png b/Tiles/SunkenSea/ScarletSeaGrassTile.png new file mode 100644 index 0000000000..561c962c9e Binary files /dev/null and b/Tiles/SunkenSea/ScarletSeaGrassTile.png differ diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index e588164a13..3c3f1ae585 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -9,28 +9,30 @@ namespace CalamityMod.Tiles.SunkenSea { public class SeaPrism : ModTile { - private const short subsheetWidth = 450; - private const short subsheetHeight = 198; + private const short subsheetWidth = 468; + private const short subsheetHeight = 90; public override void SetStaticDefaults() { Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; + Main.tileBlockLight[Type] = false; + TileID.Sets.HasSlopeFrames[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); Main.tileLighted[Type] = true; - Main.tileShine[Type] = 3500; + Main.tileShine[Type] = 5000; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; - DustType = 33; + DustType = DustID.Water; AddMapEntry(new Color(97, 212, 223)); HitSound = SoundID.Tink; Main.tileSpelunker[Type] = true; MinPick = 55; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -40,20 +42,20 @@ namespace CalamityMod.Tiles.SunkenSea public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - // (i & 0b0001) = (i % 2) - frameXOffset = (i & 0b0001) * subsheetWidth; - frameYOffset = (j & 0b0001) * subsheetHeight; + frameXOffset = i % 8 * subsheetWidth; + frameYOffset = j % 8 * subsheetHeight; } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { float brightness = 0.9f; - Color blue = new Color(67, 187, 204); - Color darkviolet = new Color(18, 67, 116); + Color blue = new Color(162, 216, 218); + Color darkviolet = new Color(18, 78, 96); Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 900f; - g = (value.G + value1.G) / 900f; - b = (value.B + value1.B) / 900f; + r = (value.R + value1.R) / 800f; + g = (value.G + value1.G) / 800f; + b = (value.B + value1.B) / 800f; r *= brightness; g *= brightness; b *= brightness; @@ -61,7 +63,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/SeaPrism.png b/Tiles/SunkenSea/SeaPrism.png index 7729be3702..7e6c12266c 100644 Binary files a/Tiles/SunkenSea/SeaPrism.png and b/Tiles/SunkenSea/SeaPrism.png differ diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs index fc65591926..fc2dc12221 100644 --- a/Tiles/SunkenSea/Shellstone.cs +++ b/Tiles/SunkenSea/Shellstone.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,20 +22,35 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; - DustType = 17; - AddMapEntry(new Color(113, 117, 160)); + DustType = DustID.CorruptPlants; + AddMapEntry(new Color(123, 127, 170)); - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - - this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); - this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); - this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + public override void RandomUpdate(int i, int j) + { + Tile Tile = Framing.GetTileSafely(i, j); + Tile Below = Framing.GetTileSafely(i, j + 1); + Tile Above = Framing.GetTileSafely(i, j - 1); + + if (!Below.HasTile && Below.LiquidType <= 0 && !Tile.BottomSlope) + { + if (Main.rand.NextBool(10)) + { + Below.TileType = (ushort)ModContent.TileType(); + Below.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/SunkenSea/ShellstoneSlab.cs b/Tiles/SunkenSea/ShellstoneSlab.cs index 19caa0a57f..bb2f5c706e 100644 --- a/Tiles/SunkenSea/ShellstoneSlab.cs +++ b/Tiles/SunkenSea/ShellstoneSlab.cs @@ -17,8 +17,12 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; HitSound = SoundID.Tink; - DustType = 17; + DustType = DustID.CorruptPlants; AddMapEntry(new Color(156, 191, 199)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/SmoothSeaPrism.png b/Tiles/SunkenSea/SmoothSeaPrism.png new file mode 100644 index 0000000000..de3c3f7ec7 Binary files /dev/null and b/Tiles/SunkenSea/SmoothSeaPrism.png differ diff --git a/Tiles/SunkenSea/SunkenKelp.png b/Tiles/SunkenSea/SunkenKelp.png new file mode 100644 index 0000000000..d6ef19a3c6 Binary files /dev/null and b/Tiles/SunkenSea/SunkenKelp.png differ diff --git a/Tiles/SunkenSea/VolcanicSand.cs b/Tiles/SunkenSea/VolcanicSand.cs index cd48e6d175..a184ad68d5 100644 --- a/Tiles/SunkenSea/VolcanicSand.cs +++ b/Tiles/SunkenSea/VolcanicSand.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - DustType = 147; + DustType = DustID.t_PearlWood; AddMapEntry(new Color(117, 79, 97)); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/WhitePearlPile.cs b/Tiles/SunkenSea/WhitePearlPile.cs index 6bd9a076bb..7ddecd594e 100644 --- a/Tiles/SunkenSea/WhitePearlPile.cs +++ b/Tiles/SunkenSea/WhitePearlPile.cs @@ -1,4 +1,5 @@ using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -22,18 +23,23 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileShine2[Type] = true; HitSound = SoundID.Shatter; - DustType = 149; + DustType = DustID.Slush; AddMapEntry(new Color(217, 209, 213)); TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/YellowCoral.cs b/Tiles/SunkenSea/YellowCoral.cs index c098f500ce..687b972091 100644 --- a/Tiles/SunkenSea/YellowCoral.cs +++ b/Tiles/SunkenSea/YellowCoral.cs @@ -21,17 +21,13 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; - DustType = 119; + DustType = DustID.Firework_Yellow; AddMapEntry(new Color(198, 169, 24)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - // 02JUN2024: Ozzatron: RuneSand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); - // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); - + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index fd25bce7b1..acc4d7cb1b 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -218,9 +218,9 @@ namespace CalamityMod.UI.ModeIndicator anyActiveMode = true; } } - string modeStr = CalamityUtils.GetTextValue("UI.ModeAppend"); + string modeStr = CalamityUtils.GetText("UI.ModeAppend").Format(modeToDisplay); string activeText = CalamityUtils.GetTextValue("UI." + (anyActiveMode ? "Active" : "NotActive")); - text = CalamityUtils.GetText("UI.DifficultyStatusText").WithFormatArgs(modeToDisplay + modeStr, activeText.ToLower()); + text = CalamityUtils.GetText("UI.DifficultyStatusText").WithFormatArgs(modeStr, activeText.ToLower()); } } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 6caeb211e3..83c3e8e955 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -444,7 +444,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), - TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -524,7 +524,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), - TileType(), + TileType(), TileType(), TileType(), TileType(), diff --git a/Walls/DriftwoodWall.png b/Walls/DriftwoodWall.png index f33778a6fe..8e691a4d26 100644 Binary files a/Walls/DriftwoodWall.png and b/Walls/DriftwoodWall.png differ diff --git a/Walls/EutrophicGlassWall.cs b/Walls/EutrophicGlassWall.cs new file mode 100644 index 0000000000..a3faeb192f --- /dev/null +++ b/Walls/EutrophicGlassWall.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class EutrophicGlassWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + Main.BackgroundEnabled = true; + Main.wallLight[Type] = true; + + AddMapEntry(new Color(23, 39, 48)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Chlorophyte, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.RedTorch, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + + frameYOffset = (j % 10) * 180; + frameXOffset = (i % 10) * 468; + } + } +} diff --git a/Walls/EutrophicGlassWall.png b/Walls/EutrophicGlassWall.png new file mode 100644 index 0000000000..983a2380b9 Binary files /dev/null and b/Walls/EutrophicGlassWall.png differ diff --git a/Walls/GiantHiveWall.cs b/Walls/GiantHiveWall.cs new file mode 100644 index 0000000000..7af1f8f648 --- /dev/null +++ b/Walls/GiantHiveWall.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class GiantHiveWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + + AddMapEntry(new Color(155, 85, 15)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Hive, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; + } + } +} diff --git a/Walls/GiantHiveWall.png b/Walls/GiantHiveWall.png new file mode 100644 index 0000000000..2ea5425a9f Binary files /dev/null and b/Walls/GiantHiveWall.png differ diff --git a/Walls/PyreMantleWallSafe.cs b/Walls/PyreMantleWallSafe.cs index 59dc08ee04..09c4f0a539 100644 --- a/Walls/PyreMantleWallSafe.cs +++ b/Walls/PyreMantleWallSafe.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; + +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; diff --git a/Walls/RunestoneTerracottaWall.png b/Walls/RunestoneTerracottaWall.png new file mode 100644 index 0000000000..9a5db46bc6 Binary files /dev/null and b/Walls/RunestoneTerracottaWall.png differ diff --git a/Walls/RunestoneWall.png b/Walls/RunestoneWall.png index 9a5db46bc6..cbe470da4c 100644 Binary files a/Walls/RunestoneWall.png and b/Walls/RunestoneWall.png differ diff --git a/Walls/ScarletSeaGrassWall.cs b/Walls/ScarletSeaGrassWall.cs new file mode 100644 index 0000000000..75ea6d474c --- /dev/null +++ b/Walls/ScarletSeaGrassWall.cs @@ -0,0 +1,48 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ScarletSeaGrassWall : ModWall, IVisibleThroughWater + { + public static Asset leafTexture = null; + int IVisibleThroughWater.WaterMapEntry { get; set; } + public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + + public override void SetStaticDefaults() + { + // 18APR2025: Ozzatron: guessed a red dust for scarlet sea grass + DustType = DustID.CrimsonPlants; + + WallID.Sets.Conversion.Grass[Type] = true; + + AddMapEntry(new Color(103, 24, 24)); + this.AddMapEntryWithWaterVisibility(new Color(89, 49, 108)); + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/ScarletSeaGrassWall_Leaves"); + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) + { + Texture2D tex = leafTexture.Value; + var rand = new Random(i + (j * 100000)); + + float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; + float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + + spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, + new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/ScarletSeaGrassWall.png b/Walls/ScarletSeaGrassWall.png new file mode 100644 index 0000000000..5e0085193a Binary files /dev/null and b/Walls/ScarletSeaGrassWall.png differ diff --git a/Walls/ScarletSeaGrassWall_Leaves.png b/Walls/ScarletSeaGrassWall_Leaves.png new file mode 100644 index 0000000000..4db2083f0f Binary files /dev/null and b/Walls/ScarletSeaGrassWall_Leaves.png differ diff --git a/Walls/WulfrumComplexPanelWall.cs b/Walls/WulfrumComplexPanelWall.cs index 7106dee681..f6f0b2af06 100644 --- a/Walls/WulfrumComplexPanelWall.cs +++ b/Walls/WulfrumComplexPanelWall.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Walls GlowMask = new("CalamityMod/Walls/WulfrumComplexPanelWall_Glow", 36, 36); Main.wallHouse[Type] = true; - Main.wallLight[Type] = true; AddMapEntry(new Color(28, 28, 29)); } diff --git a/Walls/WulfrumSheetWall.cs b/Walls/WulfrumSheetWall.cs new file mode 100644 index 0000000000..6ebe16c96e --- /dev/null +++ b/Walls/WulfrumSheetWall.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class WulfrumSheetWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(73, 59, 48)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 2) * 468; + frameYOffset = (j % 2) * 180; + } + } +} diff --git a/Walls/WulfrumSheetWall.png b/Walls/WulfrumSheetWall.png new file mode 100644 index 0000000000..4acc4c0d2b Binary files /dev/null and b/Walls/WulfrumSheetWall.png differ diff --git a/Walls/WulfrumSidingWall.cs b/Walls/WulfrumSidingWall.cs new file mode 100644 index 0000000000..355c128989 --- /dev/null +++ b/Walls/WulfrumSidingWall.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class WulfrumSidingWall : ModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + AddMapEntry(new Color(77, 92, 65)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.TerraBlade, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/WulfrumSidingWall.png b/Walls/WulfrumSidingWall.png new file mode 100644 index 0000000000..9848731066 Binary files /dev/null and b/Walls/WulfrumSidingWall.png differ diff --git a/Waters/SunkenSeaBurrowsWater.png b/Waters/SunkenSeaBurrowsWater.png index eab9dc5435..1dd5bd9f12 100644 Binary files a/Waters/SunkenSeaBurrowsWater.png and b/Waters/SunkenSeaBurrowsWater.png differ diff --git a/Waters/SunkenSeaBurrowsWater_Block.png b/Waters/SunkenSeaBurrowsWater_Block.png index 975fbe6dee..bbf43cea00 100644 Binary files a/Waters/SunkenSeaBurrowsWater_Block.png and b/Waters/SunkenSeaBurrowsWater_Block.png differ diff --git a/Waters/SunkenSeaBurrowsWaterflow.png b/Waters/SunkenSeaBurrowsWaterflow.png index 4a4540f32f..f2ea06818a 100644 Binary files a/Waters/SunkenSeaBurrowsWaterflow.png and b/Waters/SunkenSeaBurrowsWaterflow.png differ diff --git a/Waters/SunkenSeaPolypWater.png b/Waters/SunkenSeaPolypWater.png index ff90d56704..682fb25774 100644 Binary files a/Waters/SunkenSeaPolypWater.png and b/Waters/SunkenSeaPolypWater.png differ diff --git a/Waters/SunkenSeaPolypWater_Block.png b/Waters/SunkenSeaPolypWater_Block.png index 31eaa237d0..1f823d0ea9 100644 Binary files a/Waters/SunkenSeaPolypWater_Block.png and b/Waters/SunkenSeaPolypWater_Block.png differ diff --git a/Waters/SunkenSeaPolypWater_Slope.png b/Waters/SunkenSeaPolypWater_Slope.png index 8c28641b1b..9404893b7c 100644 Binary files a/Waters/SunkenSeaPolypWater_Slope.png and b/Waters/SunkenSeaPolypWater_Slope.png differ diff --git a/Waters/SunkenSeaPolypWaterflow.png b/Waters/SunkenSeaPolypWaterflow.png index 7632d15e9a..ee3de90b50 100644 Binary files a/Waters/SunkenSeaPolypWaterflow.png and b/Waters/SunkenSeaPolypWaterflow.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index 9bb6d96d14..a92bb1d4d9 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -755,7 +755,7 @@ namespace CalamityMod.World } //pots - if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) && Y > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) { if (WorldGen.genRand.NextBool(5)) @@ -1235,12 +1235,12 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), }; - + void getAttachedPoints(int x, int y, List points) { Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); Point p = new(x, y); - + if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) { return; diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs new file mode 100644 index 0000000000..e9b62f002d --- /dev/null +++ b/World/CustomUnderworld.cs @@ -0,0 +1,1040 @@ +using System; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; +using Terraria.ID; +using Terraria.WorldBuilding; +using static tModPorter.ProgressUpdate; + +namespace CalamityMod.World +{ + public class CustomUnderworld + { + private const int MaxIslands = 8; + + public static void NewUnderworld() + { + // Generate lower Underworld ash + int ashDepth = Main.maxTilesY - WorldGen.genRand.Next(150, 190); + for (int x = 0; x < Main.maxTilesX; x++) + { + ashDepth += WorldGen.genRand.Next(-3, 4); + if (ashDepth < Main.maxTilesY - 190) + ashDepth = Main.maxTilesY - 190; + + if (ashDepth > Main.maxTilesY - 160) + ashDepth = Main.maxTilesY - 160; + + for (int y = ashDepth - 20 - WorldGen.genRand.Next(3); y < Main.maxTilesY; y++) + { + if (y >= ashDepth) + { + Main.tile[x, y].Get().HasTile = false; + Main.tile[x, y].Get().LiquidType = LiquidID.Water; + } + else + Main.tile[x, y].TileType = TileID.Ash; + } + } + + // Generate lava + int lavaDepth = Main.maxTilesY - WorldGen.genRand.Next(40, 70); + for (int x = 10; x < Main.maxTilesX - 10; x++) + { + lavaDepth += WorldGen.genRand.Next(-10, 11); + if (lavaDepth > Main.maxTilesY - 60) + lavaDepth = Main.maxTilesY - 60; + + if (lavaDepth < Main.maxTilesY - 110) + lavaDepth = Main.maxTilesY - 110; + + for (int y = lavaDepth; y < Main.maxTilesY - 10; y++) + { + if (!Main.tile[x, y].HasTile) + { + Main.tile[x, y].Get().LiquidType = LiquidID.Lava; + Main.tile[x, y].LiquidAmount = byte.MaxValue; + } + } + } + + // Ash splotches + for (int x = 0; x < Main.maxTilesX; x++) + { + if (WorldGen.genRand.NextBool(50)) + { + int y = Main.maxTilesY - 65; + while (!Main.tile[x, y].HasTile && y > Main.maxTilesY - 135) + y--; + + WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), y + WorldGen.genRand.Next(20, 50), WorldGen.genRand.Next(15, 20), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); + } + } + + // Some cursed water function + Liquid.QuickWater(-2); + + // More Ash splotches + for (int x = 0; x < Main.maxTilesX; x++) + { + if (WorldGen.genRand.NextBool(13)) + { + int y = Main.maxTilesY - 65; + while ((Main.tile[x, y].LiquidAmount > 0 || Main.tile[x, y].HasTile) && y > Main.maxTilesY - 140) + y--; + + if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) + WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(5, 30), 1000, TileID.Ash, addTile: true, 0D, WorldGen.genRand.Next(1, 3), noYChange: true); + + double ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); + if (WorldGen.genRand.NextBool(3)) + ashSplotchSizeAdjustment *= 0.5; + + if (WorldGen.genRand.NextBool(3) || !(x > Main.maxTilesX * 0.4) || !(x < Main.maxTilesX * 0.6)) + { + if (WorldGen.genRand.NextBool(2)) + WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, 1D, 0.3); + + if (WorldGen.genRand.NextBool(2)) + { + ashSplotchSizeAdjustment = WorldGen.genRand.Next(1, 3); + WorldGen.TileRunner(x, y - WorldGen.genRand.Next(2, 5), (int)(WorldGen.genRand.Next(5, 15) * ashSplotchSizeAdjustment), (int)(WorldGen.genRand.Next(10, 15) * ashSplotchSizeAdjustment), TileID.Ash, addTile: true, -1D, 0.3); + } + } + + WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(5, 15), WorldGen.genRand.Next(5, 10), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); + if (WorldGen.genRand.NextBool(3)) + WorldGen.TileRunner(x + WorldGen.genRand.Next(-10, 10), y + WorldGen.genRand.Next(-10, 10), WorldGen.genRand.Next(10, 30), WorldGen.genRand.Next(10, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); + + if (WorldGen.genRand.NextBool(5)) + WorldGen.TileRunner(x + WorldGen.genRand.Next(-15, 15), y + WorldGen.genRand.Next(-15, 10), WorldGen.genRand.Next(15, 30), WorldGen.genRand.Next(5, 20), -2, addTile: false, WorldGen.genRand.Next(-1, 3), WorldGen.genRand.Next(-1, 3)); + } + } + + // Cursed lava placement tile runner, thanks redigit + for (int i = 0; i < Main.maxTilesX; i++) + WorldGen.TileRunner(WorldGen.genRand.Next(20, Main.maxTilesX - 20), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(2, 7), -2); + + // Another cursed lava placement tile runner...seriously, why the fuck is this? + for (int i = 0; i < Main.maxTilesX * 2; i++) + WorldGen.TileRunner(WorldGen.genRand.Next((int)(Main.maxTilesX * 0.35), (int)(Main.maxTilesX * 0.65)), WorldGen.genRand.Next(Main.maxTilesY - 180, Main.maxTilesY - 10), WorldGen.genRand.Next(5, 20), WorldGen.genRand.Next(5, 10), -2); + + // Place two lines of lava at maxTilesY - 145 and maxTilesY - 144 + if (Main.zenithWorld) + { + for (int x = 0; x < Main.maxTilesX; x++) + { + if (!Main.tile[x, Main.maxTilesY - 145].HasTile) + { + Main.tile[x, Main.maxTilesY - 145].LiquidAmount = byte.MaxValue; + Main.tile[x, Main.maxTilesY - 145].Get().LiquidType = LiquidID.Lava; + } + + if (!Main.tile[x, Main.maxTilesY - 144].HasTile) + { + Main.tile[x, Main.maxTilesY - 144].LiquidAmount = byte.MaxValue; + Main.tile[x, Main.maxTilesY - 144].Get().LiquidType = LiquidID.Lava; + } + } + } + + // Place hellstone splotches + for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 0.0008); i++) + WorldGen.TileRunner(WorldGen.genRand.Next(Main.maxTilesX), WorldGen.genRand.Next(Main.maxTilesY - 140, Main.maxTilesY), WorldGen.genRand.Next(2, 7), WorldGen.genRand.Next(3, 7), TileID.Hellstone); + + // Remix world stuff, the Ash islands in the middle + + // Start generating islands at this point + int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.38 : 0.36)); + + // Stop generating islands at this point + int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.62 : 0.64)); + + // Ash island gen limits + int ashIslandDepthLimit = Main.maxTilesY - 135; + int ashIslandHeightLimit = Main.maxTilesY - 160; + + // Multiple islands in non-remix + if (!WorldGen.remixWorldGen) + { + // Large = 8, Medium = 6, Small = 4 + int numIslands = (int)(Main.maxTilesX / 4200f * 4f); + + // Total extra distance between islands for lava lakes + int totalExtraDistanceBetweenAshIslands = (int)((double)Main.maxTilesX * 0.04); + + // Extra distance per island + // Due to this being done on both sides of each island, it is divided by 2 + int extraDistanceBetweenAshIslands = totalExtraDistanceBetweenAshIslands / numIslands / 2; + + // Calculate distance between islands + int distanceBetweenIslands = (ashIslandX2 - ashIslandX) / numIslands; + + // Used for island height randomization + int[] randomHeightAdjustmentLimits = new int[MaxIslands] + { + 28, + 24, + 20, + 16, + 12, + 8, + 4, + 0 + }; + + // Used for island edge drop off randomization + // Taller islands have steeper drop offs + // This is also used to decrease the width of the islands + int[] randomDropOffAdjustmentLimits = new int[MaxIslands] + { + 3, + 4, + 5, + 7, + 9, + 11, + 15, + 19 + }; + + // Loop to gen the islands + int chosenIslandSize; + int previouslyChosenIslandSize = -1; + for (int i = 0; i < numIslands; i++) + { + // Do not repeat the same island size twice in a row + do chosenIslandSize = WorldGen.genRand.Next(MaxIslands); + while (previouslyChosenIslandSize == chosenIslandSize); + previouslyChosenIslandSize = chosenIslandSize; + + int randomizedIslandDropOffAdjustment = randomDropOffAdjustmentLimits[chosenIslandSize]; + int randomizedIslandHeightAdjustment = randomHeightAdjustmentLimits[chosenIslandSize]; + int randomizedAshIslandDepthLimit = ashIslandDepthLimit + randomizedIslandHeightAdjustment; + int randomizedAshIslandHeightLimit = ashIslandHeightLimit + randomizedIslandHeightAdjustment; + + int ashIslandXAdjustment = distanceBetweenIslands * i; + int ashIslandX2Adjustment = distanceBetweenIslands * (numIslands - i - 1); + + // Decrease the width of each island randomly + // Taller islands have a greater reduction in width + int randomWidthReduction_LeftSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); + int randomWidthReduction_RightSide = WorldGen.genRand.Next(11) + (randomizedIslandDropOffAdjustment - 4); + int ashIslandTilePlacementX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands + randomWidthReduction_LeftSide; + int ashIslandTilePlacementX2 = ashIslandX2 - ashIslandX2Adjustment - extraDistanceBetweenAshIslands - randomWidthReduction_RightSide; + int ashIslandGenLimiter = Main.maxTilesY - 1; + bool ashIslandGenLimitHit = false; + Liquid.QuickWater(-2); + for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) + { + // Less random ash island terrain to make unmodified traversal less annoying + if (!ashIslandGenLimitHit) + { + // Steeper ash island edges + ashIslandGenLimiter -= WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); + if (ashIslandGenLimiter < randomizedAshIslandDepthLimit) + ashIslandGenLimitHit = true; + } + else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) + { + // Steeper ash island edges + ashIslandGenLimiter += WorldGen.genRand.Next(1, randomizedIslandDropOffAdjustment); + if (ashIslandGenLimiter > Main.maxTilesY - 1) + ashIslandGenLimiter = Main.maxTilesY - 1; + } + else + { + if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) + { + // More randomized terrain depending on island type + // Lower islands have smoother terrain + switch (chosenIslandSize) + { + default: + case 0: + case 1: + if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(8)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + break; + + case 2: + case 3: + if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(9)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + + case 4: + case 5: + if (WorldGen.genRand.NextBool()) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + + case 6: + case 7: + if (WorldGen.genRand.NextBool()) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(4)) + ashIslandGenLimiter += WorldGen.genRand.Next(-3, 4); + break; + } + } + + if (ashIslandGenLimiter < randomizedAshIslandHeightLimit) + ashIslandGenLimiter = randomizedAshIslandHeightLimit; + + if (ashIslandGenLimiter > randomizedAshIslandDepthLimit) + ashIslandGenLimiter = randomizedAshIslandDepthLimit; + } + + for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) + Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; + + for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) + { + Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); + Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; + Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; + } + } + + // This is necessary due to earlier calculations + int startX = ashIslandX + ashIslandXAdjustment + extraDistanceBetweenAshIslands + randomWidthReduction_LeftSide; + + // Lava holes in ash islands + + // Small holes + double holeFrequency = 0.00005 / numIslands; + for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * holeFrequency); j++) + WorldGen.TileRunner(WorldGen.genRand.Next(startX, ashIslandTilePlacementX2), WorldGen.genRand.Next(randomizedAshIslandHeightLimit + 30, Main.maxTilesY), WorldGen.genRand.Next(4, 7), WorldGen.genRand.Next(4, 7), -2); + + // Place smaller hellstone splotches in the ash island + // I don't want there to be too many here because I don't want to encourage players to destroy the environmental Wall of Flesh arena + double hellstoneFrequency = 0.0002 / numIslands; + for (int j = 0; j < (int)((double)(Main.maxTilesX * Main.maxTilesY) * hellstoneFrequency); j++) + WorldGen.TileRunner(WorldGen.genRand.Next(startX, ashIslandTilePlacementX2), WorldGen.genRand.Next(randomizedAshIslandHeightLimit, Main.maxTilesY), WorldGen.genRand.Next(1, 5), WorldGen.genRand.Next(2, 5), TileID.Hellstone); + } + } + else + { + int ashIslandTilePlacementX = ashIslandX; + int ashIslandTilePlacementX2 = ashIslandX2; + int ashIslandGenLimiter = Main.maxTilesY - 1; + bool ashIslandGenLimitHit = false; + Liquid.QuickWater(-2); + for (; ashIslandGenLimiter < Main.maxTilesY - 1 || ashIslandTilePlacementX < ashIslandTilePlacementX2; ashIslandTilePlacementX++) + { + // Less random ash island terrain to make unmodified traversal less annoying + if (!ashIslandGenLimitHit) + { + // Steeper ash island edges + ashIslandGenLimiter -= WorldGen.genRand.Next(1, 4); + if (ashIslandGenLimiter < ashIslandDepthLimit) + ashIslandGenLimitHit = true; + } + else if (ashIslandTilePlacementX >= ashIslandTilePlacementX2) + { + // Steeper ash island edges + ashIslandGenLimiter += WorldGen.genRand.Next(1, 4); + if (ashIslandGenLimiter > Main.maxTilesY - 1) + ashIslandGenLimiter = Main.maxTilesY - 1; + } + else + { + if ((ashIslandTilePlacementX <= Main.maxTilesX / 2 - 5 || ashIslandTilePlacementX >= Main.maxTilesX / 2 + 5) && WorldGen.genRand.NextBool(4)) + { + if (WorldGen.genRand.NextBool(3)) + ashIslandGenLimiter += WorldGen.genRand.Next(-1, 2); + else if (WorldGen.genRand.NextBool(6)) + ashIslandGenLimiter += WorldGen.genRand.Next(-2, 3); + else if (WorldGen.genRand.NextBool(8)) + ashIslandGenLimiter += WorldGen.genRand.Next(-4, 5); + } + + if (ashIslandGenLimiter < ashIslandHeightLimit) + ashIslandGenLimiter = ashIslandHeightLimit; + + if (ashIslandGenLimiter > ashIslandDepthLimit) + ashIslandGenLimiter = ashIslandDepthLimit; + } + + for (int y = ashIslandGenLimiter; y > ashIslandGenLimiter - 10; y--) + Main.tile[ashIslandTilePlacementX, y].LiquidAmount = 0; + + for (int y = ashIslandGenLimiter; y < Main.maxTilesY; y++) + { + Main.tile[ashIslandTilePlacementX, y].Clear(TileDataType.All); + Main.tile[ashIslandTilePlacementX, y].Get().HasTile = true; + Main.tile[ashIslandTilePlacementX, y].TileType = TileID.Ash; + } + } + } + + // More cursed magic water function + Liquid.QuickWater(-2); + + // Create grass on ash + for (int x = ashIslandX; x < ashIslandX2 + 15; x++) + { + for (int y = Main.maxTilesY - 300; y < ashIslandDepthLimit + 30; y++) + { + Main.tile[x, y].LiquidAmount = 0; + + if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && + (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || + !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || + !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || + !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) + Main.tile[x, y].TileType = TileID.AshGrass; + } + } + + // Place ash trees + for (int x = ashIslandX; x < ashIslandX2 + 15; x++) + { + for (int y = Main.maxTilesY - 200; y < ashIslandDepthLimit + 30; y++) + { + if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) + WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); + } + } + + // Obsidian and hellstone towers... + AddHellHouses(); + + // Drunk world ash grass and trees + if (WorldGen.drunkWorldGen) + { + for (int x = 25; x < Main.maxTilesX - 25; x++) + { + for (int y = Main.maxTilesY - 300; y < Main.maxTilesY - 100 + WorldGen.genRand.Next(-1, 2); y++) + { + if (Main.tile[x, y].TileType == TileID.Ash && Main.tile[x, y].HasTile && + (!Main.tile[x - 1, y - 1].HasTile || !Main.tile[x, y - 1].HasTile || + !Main.tile[x + 1, y - 1].HasTile || !Main.tile[x - 1, y].HasTile || + !Main.tile[x + 1, y].HasTile || !Main.tile[x - 1, y + 1].HasTile || + !Main.tile[x, y + 1].HasTile || !Main.tile[x + 1, y + 1].HasTile)) + Main.tile[x, y].TileType = TileID.AshGrass; + } + } + + for (int x = 25; x < Main.maxTilesX - 25; x++) + { + for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 50; y++) + { + if (Main.tile[x, y].TileType == TileID.AshGrass && Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile && WorldGen.genRand.NextBool(3)) + WorldGen.TryGrowingTreeByType(TileID.TreeAsh, x, y); + } + } + } + } + + private static void AddHellHouses() + { + // Original tower gen area was the outer quarters of the underworld + // New tower gen area is the outer thirds of the underworld + int towerGenArea = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.25 : 0.33)); + + // Generate towers + for (int i = 100; i < Main.maxTilesX - 100; i++) + { + if (i > towerGenArea && i < Main.maxTilesX - towerGenArea) + continue; + + int hellFortGenY = Main.maxTilesY - 40; + while (Main.tile[i, hellFortGenY].HasTile || Main.tile[i, hellFortGenY].LiquidAmount > 0) + hellFortGenY--; + + if (Main.tile[i, hellFortGenY + 1].HasTile) + { + ushort hellFortTileType = (ushort)WorldGen.genRand.Next(TileID.ObsidianBrick, TileID.HellstoneBrick + 1); + ushort wallType = WallID.HellstoneBrickUnsafe; + if (WorldGen.genRand.Next(5) > 0) + hellFortTileType = TileID.ObsidianBrick; + + if (hellFortTileType == TileID.ObsidianBrick) + wallType = WallID.ObsidianBrickUnsafe; + + if (WorldGen.getGoodWorldGen) + hellFortTileType = TileID.HellstoneBrick; + + // Place tower + WorldGen.HellFort(i, hellFortGenY, hellFortTileType, (byte)wallType); + + // Move index further along to keep towers spread apart + // Original min and max values were, respectively, 30 and 130 + // New min and max values are, respectively, 30 and 60 + i += WorldGen.genRand.Next(30, WorldGen.remixWorldGen ? 130 : 60); + + // Randomly add more distance between towers + // Original max value was 200 + // New max value is 50 + if (WorldGen.genRand.NextBool(10)) + i += WorldGen.genRand.Next(WorldGen.remixWorldGen ? 200 : 50); + } + } + + if (!WorldGen.remixWorldGen) + { + // Generate some small houses on the ash island + int ashIslandX = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.38 : 0.36)); + int ashIslandX2 = (int)((double)Main.maxTilesX * (WorldGen.remixWorldGen ? 0.62 : 0.64)); + int ashIslandDistance = ashIslandX2 - ashIslandX; + int flatDistanceBetweenHellHouses = ashIslandDistance / 3; + + // Keep track of world size to adjust house distances + float houseDistanceMult = Main.maxTilesX / 4200f; + int maxRandomDistanceBetweenHouses = (int)(75 * houseDistanceMult); + + // ashIslandX + 100 places the first hell house at the perfect position on the left shore of the ash island + // Add some random variance so that it doesn't feel so artificial + int firstHouseLocation = ashIslandX + 100 + WorldGen.genRand.Next(maxRandomDistanceBetweenHouses); + + // Max amount of houses generated on ash island + int maxHouses = 3; + int placedHouses = 0; + for (int i = firstHouseLocation; i < ashIslandX2 - 100; i++) + { + // Start searching at Main.maxTilesY - 130 because ashIsland's max depth is Main.maxTilesY - 135 + int hellHouseGenY = Main.maxTilesY - 130; + while (Main.tile[i, hellHouseGenY].HasTile || Main.tile[i, hellHouseGenY].LiquidAmount > 0) + hellHouseGenY--; + + if (Main.tile[i, hellHouseGenY + 1].HasTile) + { + // Place house + // TODO -- Stip's houses will be generated here eventually + //WorldGen.HellHouse(i, hellHouseGenY); + + // Move index further along to keep houses spread apart + i += flatDistanceBetweenHellHouses + WorldGen.genRand.Next(maxRandomDistanceBetweenHouses); + + // Increment placed houses index and break loop once enough are placed + placedHouses++; + if (placedHouses >= maxHouses) + break; + } + } + } + + // Placing torches in towers + float torchAmountMult = Main.maxTilesX / 4200f; + for (int torchIndex = 0; (float)torchIndex < 200f * torchAmountMult; torchIndex++) + { + int attempts = 0; + bool placedTorch = false; + while (!placedTorch) + { + attempts++; + int x = WorldGen.genRand.Next((int)((double)Main.maxTilesX * 0.2), (int)((double)Main.maxTilesX * 0.8)); + int y = WorldGen.genRand.Next(Main.maxTilesY - 300, Main.maxTilesY - 20); + if (Main.tile[x, y].HasTile && (Main.tile[x, y].TileType == TileID.ObsidianBrick || Main.tile[x, y].TileType == TileID.HellstoneBrick)) + { + int xOffset = 0; + if (Main.tile[x - 1, y].WallType > 0) + xOffset = -1; + else if (Main.tile[x + 1, y].WallType > 0) + xOffset = 1; + + if (!Main.tile[x + xOffset, y].HasTile && !Main.tile[x + xOffset, y + 1].HasTile) + { + // Check if a torch has already been placed in this location + bool torchAlreadyPlaced = false; + for (int k = x - 8; k < x + 8; k++) + { + for (int l = y - 8; l < y + 8; l++) + { + if (Main.tile[k, l].HasTile && TileID.Sets.Torch[Main.tile[k, l].TileType]) + { + torchAlreadyPlaced = true; + break; + } + } + } + + // Place the torch + if (!torchAlreadyPlaced) + { + WorldGen.PlaceTile(x + xOffset, y, TileID.Torches, mute: true, forced: true, -1, 7); + placedTorch = true; + } + } + } + + if (attempts > 1000) + placedTorch = true; + } + } + + // Place furniture in the towers + double furnitureAmount = 4200000D / (double)Main.maxTilesX; + for (int furnitureIndex = 0; (double)furnitureIndex < furnitureAmount; furnitureIndex++) + { + int attempts = 0; + int furniturePlacementX = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); + int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + while ((Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) + { + furniturePlacementX = WorldGen.genRand.NextBool(2) ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); + y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + + attempts++; + if (attempts > 100000) + break; + } + + if (attempts > 100000 || (Main.tile[furniturePlacementX, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[furniturePlacementX, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[furniturePlacementX, y].HasTile) + continue; + + for (; !WorldGen.SolidTile(furniturePlacementX, y) && y < Main.maxTilesY - 20; y++) + { + } + + y--; + int placementAdjustment = furniturePlacementX; + int placementAdjustment2 = furniturePlacementX; + while (!Main.tile[placementAdjustment, y].HasTile && WorldGen.SolidTile(placementAdjustment, y + 1)) + placementAdjustment--; + + placementAdjustment++; + for (; !Main.tile[placementAdjustment2, y].HasTile && WorldGen.SolidTile(placementAdjustment2, y + 1); placementAdjustment2++) + { + } + + placementAdjustment2--; + int placementSpaceLimit = placementAdjustment2 - placementAdjustment; + int x = (placementAdjustment2 + placementAdjustment) / 2; + if (Main.tile[x, y].HasTile || (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || !WorldGen.SolidTile(x, y + 1)) + continue; + + // Different styles of houses + int style = 16; + int style2 = 13; + int style3 = 14; + int style4 = 49; + int style5 = 4; + int style6 = 8; + int style7 = 15; + int style8 = 9; + int style9 = 10; + int style10 = 17; + int style11 = 25; + int style12 = 25; + int style13 = 23; + int style14 = 25; + int styleChoice = WorldGen.genRand.Next(13); + int sizeX = 0; + int sizeY = 0; + if (styleChoice == 0) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 1) + { + sizeX = 4; + sizeY = 3; + } + + if (styleChoice == 2) + { + sizeX = 3; + sizeY = 5; + } + + if (styleChoice == 3) + { + sizeX = 4; + sizeY = 6; + } + + if (styleChoice == 4) + { + sizeX = 3; + sizeY = 3; + } + + if (styleChoice == 5) + { + sizeX = 5; + sizeY = 3; + } + + if (styleChoice == 6) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 7) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 8) + { + sizeX = 5; + sizeY = 4; + } + + if (styleChoice == 9) + { + sizeX = 3; + sizeY = 5; + } + + if (styleChoice == 10) + { + sizeX = 5; + sizeY = 3; + } + + if (styleChoice == 11) + { + sizeX = 2; + sizeY = 4; + } + + if (styleChoice == 12) + { + sizeX = 3; + sizeY = 3; + } + + // Check if there are any tiles in the way of furniture placement + for (int placementIndexX = x - sizeX; placementIndexX <= x + sizeX; placementIndexX++) + { + for (int placementIndexY = y - sizeY; placementIndexY <= y; placementIndexY++) + { + if (Main.tile[placementIndexX, placementIndexY].HasTile) + { + styleChoice = -1; + break; + } + } + } + + // Check if there is enough space to place furniture + if ((double)placementSpaceLimit < (double)sizeX * 1.75) + styleChoice = -1; + + switch (styleChoice) + { + case 0: + WorldGen.PlaceTile(x, y, TileID.Tables, mute: true, forced: false, -1, style2); + int candlePlacementX = WorldGen.genRand.Next(6); + if (candlePlacementX < 3) + WorldGen.PlaceTile(x + candlePlacementX, y - 2, TileID.Candles, mute: true, forced: false, -1, style12); + + if (!Main.tile[x, y].HasTile) + break; + + if (!Main.tile[x - 2, y].HasTile) + { + WorldGen.PlaceTile(x - 2, y, TileID.Chairs, mute: true, forced: false, -1, style); + if (Main.tile[x - 2, y].HasTile) + { + Main.tile[x - 2, y].TileFrameX += 18; + Main.tile[x - 2, y - 1].TileFrameX += 18; + } + } + + if (!Main.tile[x + 2, y].HasTile) + WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); + + break; + + case 1: + WorldGen.PlaceTile(x, y, TileID.WorkBenches, mute: true, forced: false, -1, style3); + int candlePlacementX2 = WorldGen.genRand.Next(4); + if (candlePlacementX2 < 2) + WorldGen.PlaceTile(x + candlePlacementX2, y - 1, TileID.Candles, mute: true, forced: false, -1, style12); + + if (!Main.tile[x, y].HasTile) + break; + + if (WorldGen.genRand.NextBool()) + { + if (!Main.tile[x - 1, y].HasTile) + { + WorldGen.PlaceTile(x - 1, y, TileID.Chairs, mute: true, forced: false, -1, style); + if (Main.tile[x - 1, y].HasTile) + { + Main.tile[x - 1, y].TileFrameX += 18; + Main.tile[x - 1, y - 1].TileFrameX += 18; + } + } + } + else if (!Main.tile[x + 2, y].HasTile) + WorldGen.PlaceTile(x + 2, y, TileID.Chairs, mute: true, forced: false, -1, style); + + break; + + case 2: + WorldGen.PlaceTile(x, y, TileID.Statues, mute: true, forced: false, -1, style4); + break; + + case 3: + WorldGen.PlaceTile(x, y, TileID.Bookcases, mute: true, forced: false, -1, style5); + break; + + case 4: + + if (WorldGen.genRand.NextBool()) + { + WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); + Main.tile[x, y].TileFrameX += 18; + Main.tile[x, y - 1].TileFrameX += 18; + } + else + WorldGen.PlaceTile(x, y, TileID.Chairs, mute: true, forced: false, -1, style); + + break; + + case 5: + if (WorldGen.genRand.NextBool()) + WorldGen.Place4x2(x, y, TileID.Beds, 1, style6); + else + WorldGen.Place4x2(x, y, TileID.Beds, -1, style6); + break; + + case 6: + WorldGen.PlaceTile(x, y, TileID.Pianos, mute: true, forced: false, -1, style7); + break; + + case 7: + WorldGen.PlaceTile(x, y, TileID.Dressers, mute: true, forced: false, -1, style8); + break; + + case 8: + WorldGen.PlaceTile(x, y, TileID.Benches, mute: true, forced: false, -1, style9); + break; + + case 9: + WorldGen.PlaceTile(x, y, TileID.GrandfatherClocks, mute: true, forced: false, -1, style10); + break; + + case 10: + if (WorldGen.genRand.NextBool()) + WorldGen.Place4x2(x, y, TileID.Bathtubs, 1, style14); + else + WorldGen.Place4x2(x, y, TileID.Bathtubs, -1, style14); + break; + + case 11: + WorldGen.PlaceTile(x, y, TileID.Lamps, mute: true, forced: false, -1, style13); + break; + + case 12: + WorldGen.PlaceTile(x, y, TileID.Candelabras, mute: true, forced: false, -1, style11); + break; + } + } + + // Place paintings in the towers + furnitureAmount = 420000D / (double)Main.maxTilesX; + for (int paintingIndex = 0; (double)paintingIndex < furnitureAmount; paintingIndex++) + { + int attempts = 0; + int x = WorldGen.genRand.Next(towerGenArea, Main.maxTilesX - towerGenArea); + int y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + while ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile) + { + x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); + y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + + attempts++; + if (attempts > 100000) + break; + } + + if (attempts > 100000) + continue; + + int paintingPlacementX = x; + int paintingPlacementX2 = x; + int paintingPlacementY = y; + int paintingPlacementY2 = y; + int sizeY = 0; + for (int num32 = 0; num32 < 2; num32++) + { + paintingPlacementX = x; + paintingPlacementX2 = x; + while (!Main.tile[paintingPlacementX, y].HasTile && (Main.tile[paintingPlacementX, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX, y].WallType == WallID.ObsidianBrickUnsafe)) + paintingPlacementX--; + + paintingPlacementX++; + for (; !Main.tile[paintingPlacementX2, y].HasTile && (Main.tile[paintingPlacementX2, y].WallType == WallID.HellstoneBrickUnsafe || Main.tile[paintingPlacementX2, y].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementX2++) + { + } + + paintingPlacementX2--; + x = (paintingPlacementX + paintingPlacementX2) / 2; + paintingPlacementY = y; + paintingPlacementY2 = y; + while (!Main.tile[x, paintingPlacementY].HasTile && (Main.tile[x, paintingPlacementY].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY].WallType == WallID.ObsidianBrickUnsafe)) + paintingPlacementY--; + + paintingPlacementY++; + for (; !Main.tile[x, paintingPlacementY2].HasTile && (Main.tile[x, paintingPlacementY2].WallType == WallID.HellstoneBrickUnsafe || Main.tile[x, paintingPlacementY2].WallType == WallID.ObsidianBrickUnsafe); paintingPlacementY2++) + { + } + + paintingPlacementY2--; + y = (paintingPlacementY + paintingPlacementY2) / 2; + } + + paintingPlacementX = x; + paintingPlacementX2 = x; + while (!Main.tile[paintingPlacementX, y].HasTile && !Main.tile[paintingPlacementX, y - 1].HasTile && !Main.tile[paintingPlacementX, y + 1].HasTile) + paintingPlacementX--; + + paintingPlacementX++; + for (; !Main.tile[paintingPlacementX2, y].HasTile && !Main.tile[paintingPlacementX2, y - 1].HasTile && !Main.tile[paintingPlacementX2, y + 1].HasTile; paintingPlacementX2++) + { + } + + paintingPlacementX2--; + paintingPlacementY = y; + paintingPlacementY2 = y; + while (!Main.tile[x, paintingPlacementY].HasTile && !Main.tile[x - 1, paintingPlacementY].HasTile && !Main.tile[x + 1, paintingPlacementY].HasTile) + paintingPlacementY--; + + paintingPlacementY++; + for (; !Main.tile[x, paintingPlacementY2].HasTile && !Main.tile[x - 1, paintingPlacementY2].HasTile && !Main.tile[x + 1, paintingPlacementY2].HasTile; paintingPlacementY2++) + { + } + + paintingPlacementY2--; + x = (paintingPlacementX + paintingPlacementX2) / 2; + y = (paintingPlacementY + paintingPlacementY2) / 2; + int sizeX = paintingPlacementX2 - paintingPlacementX; + sizeY = paintingPlacementY2 - paintingPlacementY; + if (sizeX <= 7 || sizeY <= 5) + continue; + + if (!WorldGen.nearPicture2(x, y)) + { + PaintingEntry paintingEntry = WorldGen.RandHellPicture(); + if (!WorldGen.nearPicture(x, y)) + WorldGen.PlaceTile(x, y, paintingEntry.tileType, mute: true, forced: false, -1, paintingEntry.style); + } + } + + // An array used for banner styles + int[] bannerArray = new int[3] + { + WorldGen.genRand.Next(16, 22), + WorldGen.genRand.Next(16, 22), + WorldGen.genRand.Next(16, 22) + }; + + while (bannerArray[1] == bannerArray[0]) + bannerArray[1] = WorldGen.genRand.Next(16, 22); + + while (bannerArray[2] == bannerArray[0] || bannerArray[2] == bannerArray[1]) + bannerArray[2] = WorldGen.genRand.Next(16, 22); + + // Place hanging tiles + furnitureAmount = 420000D / (double)Main.maxTilesX; + for (int hangingTileIndex = 0; (double)hangingTileIndex < furnitureAmount; hangingTileIndex++) + { + int attempts = 0; + int x; + int y; + do + { + x = WorldGen.genRand.NextBool() ? WorldGen.genRand.Next(Main.maxTilesX - towerGenArea, Main.maxTilesX - 50) : WorldGen.genRand.Next(50, towerGenArea); + y = WorldGen.genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 20); + attempts++; + } + while (attempts <= 100000 && ((Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) || Main.tile[x, y].HasTile)); + + if (attempts > 100000) + continue; + + while (!WorldGen.SolidTile(x, y) && y > 10) + y--; + + y++; + if (Main.tile[x, y].WallType != WallID.HellstoneBrickUnsafe && Main.tile[x, y].WallType != WallID.ObsidianBrickUnsafe) + continue; + + int hangingTileType = WorldGen.genRand.Next(3); + int chandelierStyle = 32; + int lanternStyle = 32; + int hangingTileSizeX; + int hangingTileSizeY; + switch (hangingTileType) + { + default: + hangingTileSizeX = 1; + hangingTileSizeY = 3; + break; + case 1: + hangingTileSizeX = 3; + hangingTileSizeY = 3; + break; + case 2: + hangingTileSizeX = 1; + hangingTileSizeY = 2; + break; + } + + for (int placementIndexX = x - 1; placementIndexX <= x + hangingTileSizeX; placementIndexX++) + { + for (int placementIndexY = y; placementIndexY <= y + hangingTileSizeY; placementIndexY++) + { + Tile tile = Main.tile[x, y]; + if (placementIndexX < x || placementIndexX == x + hangingTileSizeX) + { + if (tile.HasTile) + { + switch (tile.TileType) + { + case TileID.ClosedDoor: + case TileID.OpenDoor: + case TileID.Chandeliers: + case TileID.HangingLanterns: + case TileID.Banners: + hangingTileType = -1; + break; + } + } + } + else if (tile.HasTile) + hangingTileType = -1; + } + } + + switch (hangingTileType) + { + case 0: + WorldGen.PlaceTile(x, y, TileID.Banners, mute: true, forced: false, -1, bannerArray[WorldGen.genRand.Next(3)]); + break; + case 1: + WorldGen.PlaceTile(x, y, TileID.Chandeliers, mute: true, forced: false, -1, chandelierStyle); + break; + case 2: + WorldGen.PlaceTile(x, y, TileID.HangingLanterns, mute: true, forced: false, -1, lanternStyle); + break; + } + } + } + } +} diff --git a/World/GiantHive.cs b/World/GiantHive.cs index 96b8e31331..7845fa730c 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -11,6 +11,7 @@ using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.FurnitureAncient; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; @@ -86,7 +87,7 @@ namespace CalamityMod.World //place living mahogany leaves at the end of each branch foreach (Point item in list) { - WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), + WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(2, 5), WorldGen.genRand.Next(3, 5)), new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(TileID.LivingMahoganyLeaves), new Actions.SetFrames(frameNeighbors: true))); } } @@ -172,13 +173,20 @@ namespace CalamityMod.World Vector2 movingLarvaLocation = larvaLocation; int hiveTunnelTries = WorldGen.genRand.Next(2, 5); for (int j = 0; j < hiveTunnelTries; j++) - movingLarvaLocation = CreateHiveTunnel((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + movingLarvaLocation = MakeCell((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); larvaLocation = movingLarvaLocation; array[arrayInc] = (int)larvaLocation.X; array2[arrayInc] = (int)larvaLocation.Y; arrayInc++; } + for (int i = 0; i < numHiveTunnels; i++) + { + int hiveTunnelTries = WorldGen.genRand.Next(1, 2); + MakeCellHoney((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + } + MakeOuterCell((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand); + FrameOutAllHiveContents(origin, 50); @@ -206,7 +214,6 @@ namespace CalamityMod.World x += treeIndentDirection; if (!SpotActuallyNotInHive(x, y)) { - CreateBlockedHoneyCube(x, y); CreateDentForHoneyFall(x, y, treeIndentDirection); } } @@ -234,34 +241,51 @@ namespace CalamityMod.World // Honey chests Vector2 honeyChestLocation = default; - for (int l = 0; l < maxAttempts; l++) - { - Vector2 newStructureLocation = larvaLocation; - newStructureLocation.X += WorldGen.genRand.Next(-100, 101); - newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); - if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) - { - honeyChestLocation = newStructureLocation; - CreateStandAndPlaceHoneyChest(newStructureLocation); - break; - } - } - for (int l = 0; l < maxAttempts; l++) - { - Vector2 newStructureLocation = larvaLocation; - newStructureLocation.X += WorldGen.genRand.Next(-100, 101); - newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); - if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && Vector2.Distance(honeyChestLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) - { - CreateStandAndPlaceHoneyChest(newStructureLocation); - break; - } - } + //for (int l = 0; l < maxAttempts; l++) + //{ + // Vector2 newStructureLocation = larvaLocation; + // newStructureLocation.X += WorldGen.genRand.Next(-100, 101); + // newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); + // if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) + // { + // honeyChestLocation = newStructureLocation; + // CreateStandAndPlaceHoneyChest(newStructureLocation); + // break; + // } + //} + //for (int l = 0; l < maxAttempts; l++) + //{ + // Vector2 newStructureLocation = larvaLocation; + // newStructureLocation.X += WorldGen.genRand.Next(-100, 101); + // newStructureLocation.Y += WorldGen.genRand.Next(-100, 101); + // if (WorldGen.InWorld((int)newStructureLocation.X, (int)newStructureLocation.Y) && Vector2.Distance(larvaLocation, newStructureLocation) > 10f && Vector2.Distance(secondLarvaLocation, newStructureLocation) > 10f && Vector2.Distance(honeyChestLocation, newStructureLocation) > 10f && !Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].HasTile && Main.tile[(int)newStructureLocation.X, (int)newStructureLocation.Y].WallType == WallID.HiveUnsafe) + // { + // CreateStandAndPlaceHoneyChest(newStructureLocation); + // break; + // } + //} CalamityUtils.AddProtectedStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return true; } + public static bool PlaceLayer(int X, int Y, int height, int tileType) + { + for (int j = Y; j <= Y + height; j++) + { + if (Main.tile[X, j].HasTile && Main.tile[X, j + 1].HasTile && Main.tile[X, j + 2].HasTile && Main.tile[X, j + 3].HasTile && + Main.tile[X - 1, j + 3].HasTile && Main.tile[X + 1, j + 3].HasTile) + { + Main.tile[X, j].TileType = (ushort)tileType; + } + else + { + return false; + } + } + + return true; + } private static void FrameOutAllHiveContents(Point origin, int squareHalfWidth) { int maxXsize = Math.Max(10, origin.X - squareHalfWidth); @@ -272,125 +296,334 @@ namespace CalamityMod.World { for (int j = maxYSize; j < minYSize; j++) { - Tile tile = Main.tile[i, j]; - if (tile.HasTile && tile.TileType == TileID.Hive) - WorldGen.SquareTileFrame(i, j); + //Tile tile = Main.tile[i, j]; + //if (tile.HasTile && tile.TileType == TileID.Hive) + // WorldGen.SquareTileFrame(i, j); - if (tile.WallType == WallID.HiveUnsafe) - WorldGen.SquareWallFrame(i, j); + //if (tile.WallType == WallID.HiveUnsafe) + // WorldGen.SquareWallFrame(i, j); + bool canPlaceSand = false; + + if (Main.tile[i, j].TileType == TileID.Hive && !Main.tile[i, j - 1].HasTile && !Main.tile[i, j - 2].HasTile && !Main.tile[i, j - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceLayer(i, j, WorldGen.genRand.Next(2, 3), TileID.HoneyBlock); + } } } } - - private static Vector2 CreateHiveTunnel(int i, int j, UnifiedRandom random) + public static void CreateTunnel(int startX, int startY, int endX, int endY, int width = 6, int tileType = TileID.Hive) { - double randOffset = random.Next(20, 26); - float tunnelPlacementAttempts = random.Next(30, 41); - float miniMaxXTiles = Main.maxTilesX / 4200; - miniMaxXTiles = (miniMaxXTiles + 1f) / 2f; - randOffset *= (double)miniMaxXTiles; - tunnelPlacementAttempts *= miniMaxXTiles; + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - double randOffsetCopy = randOffset; - Vector2 result = default; - result.X = i; - result.Y = j; - Vector2 defaultTunnelPos = default; - defaultTunnelPos.X = random.Next(-10, 11) * 0.2f; - defaultTunnelPos.Y = random.Next(-10, 11) * 0.2f; - while (randOffset > 0.0 && tunnelPlacementAttempts > 0f) + for (int i = 0; i <= steps; i++) { - if (result.Y > (Main.maxTilesY - 250)) - tunnelPlacementAttempts = 0f; + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); - randOffset = randOffsetCopy * (double)(1f + random.Next(-20, 20) * 0.01f); - tunnelPlacementAttempts -= 1f; - int mainXOffset = (int)(result.X - randOffset); - int maxXOffset = (int)(result.X + randOffset); - int minYOffset = (int)(result.Y - randOffset); - int maxYOffset = (int)(result.Y + randOffset); - if (mainXOffset < 1) - mainXOffset = 1; - - if (maxXOffset > Main.maxTilesX - 1) - maxXOffset = Main.maxTilesX - 1; - - if (minYOffset < 1) - minYOffset = 1; - - if (maxYOffset > Main.maxTilesY - 1) - maxYOffset = Main.maxTilesY - 1; - - for (int k = mainXOffset; k < maxXOffset; k++) + // Draw a small circular path + for (int xi = -width; xi <= width; xi++) { - for (int l = minYOffset; l < maxYOffset; l++) + for (int yi = -width; yi <= width; yi++) { - if (!WorldGen.InWorld(k, l, 50)) + if (xi * xi + yi * yi <= width * width) { - tunnelPlacementAttempts = 0f; - } - else - { - if (Main.tile[k - 10, l].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; + int tileX = x + xi; + int tileY = y + yi; - if (Main.tile[k + 10, l].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; - - if (Main.tile[k, l - 10].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; - - if (Main.tile[k, l + 10].WallType == WallID.LihzahrdBrickUnsafe) - tunnelPlacementAttempts = 0f; - } - - if (l < Main.worldSurface && Main.tile[k, l - 5].WallType == WallID.None) - tunnelPlacementAttempts = 0f; - - float tileXDist = Math.Abs(k - result.X); - float tileYDist = Math.Abs(l - result.Y); - double tileDistance = Math.Sqrt(tileXDist * tileXDist + tileYDist * tileYDist); - if (tileDistance < randOffsetCopy * 0.4 * (1.0 + random.Next(-10, 11) * 0.005)) - { - Main.tile[k, l].LiquidAmount = byte.MaxValue; - Main.tile[k, l].Get().LiquidType = LiquidID.Honey; - Main.tile[k, l].WallType = WallID.HiveUnsafe; - Main.tile[k, l].Get().HasTile = false; - Main.tile[k, l].Get().IsHalfBlock = false; - Main.tile[k, l].Get().Slope = SlopeType.Solid; - } - else if (tileDistance < randOffsetCopy * 0.75 * (1.0 + random.Next(-10, 11) * 0.005)) - { - Main.tile[k, l].LiquidAmount = 0; - if (Main.tile[k, l].WallType != WallID.HiveUnsafe) + if (WorldGen.InWorld(tileX, tileY)) { - Main.tile[k, l].Get().HasTile = true; - Main.tile[k, l].Get().IsHalfBlock = false; - Main.tile[k, l].Get().Slope = SlopeType.Solid; - Main.tile[k, l].TileType = TileID.Hive; - } - } - - if (tileDistance < randOffsetCopy * 0.6 * (1.0 + random.Next(-10, 11) * 0.005)) - { - Main.tile[k, l].WallType = WallID.HiveUnsafe; - if (random.NextBool()) - { - Main.tile[k, l].LiquidAmount = byte.MaxValue; - Main.tile[k, l].Get().LiquidType = LiquidID.Honey; + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); } } } } + } + } + public static void ClearTunnel(int startX, int startY, int endX, int endY, int width = 3) + { + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - result += defaultTunnelPos; - tunnelPlacementAttempts -= 1f; - defaultTunnelPos.Y += random.Next(-10, 11) * 0.05f; - defaultTunnelPos.X += random.Next(-10, 11) * 0.05f; + for (int i = 0; i <= steps; i++) + { + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); + + for (int xi = -width; xi <= width; xi++) + { + for (int yi = -width; yi <= width; yi++) + { + if (xi * xi + yi * yi <= width * width) + { + int tileX = x + xi; + int tileY = y + yi; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + tTile.WallType = (ushort)ModContent.WallType(); + tTile.LiquidAmount = 0; + + WorldGen.SquareWallFrame(tileX, tileY); + + // Optional: Add honey with low chance + if (WorldGen.genRand.NextBool(10)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + } + } + public static void CreateHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + if (!doWalls) + { + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); + } + else + { + tTile.WallType = WallID.HiveUnsafe; + WorldGen.SquareWallFrame(tileX, tileY); + } + } + } + } + } + public static void CreateGiantHiveHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + if (!doWalls) + { + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); + } + else + { + tTile.WallType = (ushort)ModContent.WallType(); + WorldGen.SquareWallFrame(tileX, tileY); + } + } + } + } + } + public static void ClearHexagon(int centerX, int centerY, int hexagonSize) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + tTile.WallType = WallID.HiveUnsafe; + tTile.LiquidAmount = 0; + WorldGen.SquareWallFrame(tileX, tileY); + if (WorldGen.genRand.NextBool(15)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + public static void GiantHiveWallHexagon(int centerX, int centerY, int hexagonSize) + { + int halfHexagonSize = hexagonSize / 2; + + for (int x = -halfHexagonSize; x <= halfHexagonSize; x++) + { + int y1 = Math.Abs(x) / 2; + int y2 = hexagonSize - Math.Abs(x) / 2; + + for (int y = y1; y < y2; y++) + { + int tileX = centerX + x; + int tileY = centerY + y; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + tTile.WallType = (ushort)ModContent.WallType(); + tTile.LiquidAmount = 0; + WorldGen.SquareWallFrame(tileX, tileY); + if (WorldGen.genRand.NextBool(15)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = LiquidID.Honey; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + public static Vector2 MakeCell(int x, int y, UnifiedRandom random) + { + CreateHexagon(x, y - 30, 110, TileID.Hive); + CreateGiantHiveHexagon(x, y - 30, 108, TileID.Hive, true); + GiantHiveWallHexagon(x, y - 22, 90); + + + + return new Vector2(x, y); + } + public static Vector2 MakeCellHoney(int x, int y, UnifiedRandom random) + { + int attempts = 0; + int hexagonsToPlace = WorldGen.genRand.Next(1, 3); // number of honey hexagons to place + + while (attempts < 100 && hexagonsToPlace > 0) + { + attempts++; + + int offsetX = WorldGen.genRand.Next(-60, 60); + int offsetY = WorldGen.genRand.Next(-50, 50); + + int targetX = x + offsetX; + int targetY = y + offsetY; + + // Check a 3x3 area for mostly Hive tiles to confirm it's inside the hive + bool valid = true; + for (int i = -1; i <= 1 && valid; i++) + { + for (int j = -1; j <= 1 && valid; j++) + { + int checkX = targetX + i; + int checkY = targetY + j; + + if (!WorldGen.InWorld(checkX, checkY)) + valid = false; + else if (!Main.tile[checkX, checkY].HasTile || Main.tile[checkX, checkY].TileType != TileID.Hive) + valid = false; + } + } + + if (valid) + { + int radius = WorldGen.genRand.Next(7, 10); + CreateHexagon(targetX, targetY, radius, TileID.HoneyBlock); + hexagonsToPlace--; + } } - return result; + return new Vector2(x, y); } + public static Vector2 MakeOuterCell(int x, int y, UnifiedRandom random) + { + int numConnections = WorldGen.genRand.Next(3, 6); + List placedHexes = new List(); + int chestsPlaced = 0; + int chestMax = 4; // Number of chests to spawn in outer cells + + for (int i = 0; i < numConnections; i++) + { + bool placed = false; + int attempts = 0; + + while (!placed && attempts < 10) + { + attempts++; + + float angle = MathHelper.ToRadians(WorldGen.genRand.Next(0, 180)); + float distance = WorldGen.genRand.Next(80, 120); + + int newX = x + (int)(Math.Cos(angle) * distance); + int newY = y + (int)(Math.Sin(angle) * distance); + Vector2 newPos = new Vector2(newX, newY); + + bool overlaps = placedHexes.Any(pos => Vector2.Distance(pos, newPos) < 60); + + if (!overlaps) + { + int hexRadius = WorldGen.genRand.Next(30, 45); + CreateGiantHiveHexagon(newX, newY - 15, hexRadius - 1, TileID.Hive, true); + CreateHexagon(newX, newY - 15, hexRadius, TileID.Hive); + ClearTunnel(x, y + 30, newX, newY, 5); + CreateTunnel(x, y + 30, newX, newY); + ClearTunnel(x, y + 30, newX, newY, 3); + GiantHiveWallHexagon(newX, newY - 10, WorldGen.genRand.Next(19, 26)); + + // Place honey chest in this cell with a small chance + if (chestsPlaced < chestMax) + { + CreateStandAndPlaceHoneyChest(new Vector2(newX, newY)); + chestsPlaced++; + } + + placedHexes.Add(newPos); + placed = true; + } + } + } + + GiantHiveWallHexagon(x, y - 22, 90); + ClearHexagon(x, y - 18, 80); + + return new Vector2(x, y); + } + private static bool TooCloseToImportantLocations(Point origin) { @@ -441,26 +674,26 @@ namespace CalamityMod.World } } - private static void CreateBlockedHoneyCube(int x, int y) - { - for (int i = x - 1; i <= x + 2; i++) - { - for (int j = y - 1; j <= y + 2; j++) - { - if (i >= x && i <= x + 1 && j >= y && j <= y + 1) - { - Main.tile[i, j].Get().HasTile = false; - Main.tile[i, j].LiquidAmount = byte.MaxValue; - Main.tile[i, j].Get().LiquidType = LiquidID.Honey; - } - else - { - Main.tile[i, j].Get().HasTile = true; - Main.tile[i, j].TileType = TileID.Hive; - } - } - } - } + //private static void CreateBlockedHoneyCube(int x, int y) + //{ + // for (int i = x - 1; i <= x + 2; i++) + // { + // for (int j = y - 1; j <= y + 2; j++) + // { + // if (i >= x && i <= x + 1 && j >= y && j <= y + 1) + // { + // Main.tile[i, j].Get().HasTile = false; + // Main.tile[i, j].LiquidAmount = byte.MaxValue; + // Main.tile[i, j].Get().LiquidType = LiquidID.Honey; + // } + // else + // { + // Main.tile[i, j].Get().HasTile = true; + // Main.tile[i, j].TileType = TileID.Hive; + // } + // } + // } + //} private static bool SpotActuallyNotInHive(int x, int y) { diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index b8a0091c89..f36f8899d5 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -7,7 +7,9 @@ using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Walls; using Microsoft.Xna.Framework; using ReLogic.Threading; +using ReLogic.Utilities; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -29,15 +31,14 @@ namespace CalamityMod.World /* ena todo - fix the fucking forest being shaved + fix the fucking forest being shaved (done - HPU) cut a half oval out of the top of forest in anticipation of structure placement - change the type of noise both reefs and forest use (reefs more jagged, forest more flat) - cut a curve out of the top of shores (the desert part) + change the type of noise both reefs and forest use (reefs more jagged, forest more flat) (done - HPU) + cut a curve out of the top of shores (the desert part) (done - HPU) extend basalt to hell - DONE - convert normal terrain blocks below basalt into basalt + convert normal terrain blocks below basalt into basalt (maybe??? - HPU) BLOTCHES EVERYWHERE */ - public static void NormalForLoop(int fromInclusive, int toExclusive, int step, Action action) { for (int i = fromInclusive; i < toExclusive; i += step) @@ -80,7 +81,7 @@ namespace CalamityMod.World // // Places a trapezoid of circles to serve as the main area for the biome. // - const float steepness = 15f; + const float steepness = 25f; static float trapezoidLateralSteep(float x) { if (x <= 1f / steepness) @@ -90,14 +91,14 @@ namespace CalamityMod.World else return -steepness * x + steepness; } - ForLoop.Invoke(startPosX - biomeSize - 20, startPosX + biomeSize + 20, 15, (X) => + ForLoop.Invoke(startPosX - biomeSize - 5, startPosX + biomeSize + 20, 15, (X) => { float height = MathHelper.Lerp( - startPosY + 50, - startPosY - 35, + startPosY + 35, //top + startPosY - 15, //bottom trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); - for (int Y = startPosY + 50; Y >= height; Y -= 10) + for (int Y = startPosY + 25; Y >= height; Y -= 10) { ShapeData circle = new ShapeData(); WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] @@ -112,18 +113,18 @@ namespace CalamityMod.World // // Makes the bottom borders of the Timeless Shores curved downwards. // - const int totalCuveDepth = 40; - ForLoop.Invoke(startPosX - biomeSize - 20, startPosX - biomeSize + 200, 10, (x) => + const int totalCuveDepth = 90; + ForLoop.Invoke(startPosX - biomeSize - 10, startPosX - biomeSize + 200, 10, (x) => { int curveDepth = (int)MathHelper.Lerp( totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); - for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] { //new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle), @@ -131,17 +132,17 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); } }); - ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 20, 5, (x) => + ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 10, 5, (x) => { int curveDepth = (int)MathHelper.Lerp( totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); - for (int y = startPosY + 50; y <= startPosY + 50 + curveDepth; y += 5) + for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] { //new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle), @@ -151,18 +152,28 @@ namespace CalamityMod.World }); //clear a smaller square out of the center where the biomes stuff will be - ForLoop.Invoke(startPosX - biomeSize + 35, startPosX + biomeSize - 35, 1, (X) => + //Added curves to the top of the biome via curve depth -hpu 02/19/25 + ForLoop.Invoke(startPosX - biomeSize + 10, startPosX + biomeSize - 10, 1, (X) => { - for (int Y = startPosY - 65; Y <= startPosY + 50; Y++) + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, X, true))); + int random = WorldGen.genRand.Next(-40, 10); + for (int Y = startPosY - 25 + curveDepth + curveDepth2; Y <= startPosY + 50; Y++) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 5)), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + random), new Shapes.Mound(WorldGen.genRand.Next(7, 10),5), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + random), new ModShapes.All(circle), Actions.Chain(new GenAction[] { new Actions.Clear() })); @@ -172,26 +183,29 @@ namespace CalamityMod.World // // Places slopes at the sides of the shores to actually make shores. // - ForLoop.Invoke(startPosX - biomeSize + 20, startPosX - biomeSize + 200, 20, (moundX) => + ForLoop.Invoke(startPosX - biomeSize - 15, startPosX - biomeSize + 200, 20, (moundX) => { + int RandomX = Main.rand.Next(15, 20); ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startPosY + 60; + int moundY = startPosY + 75; int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize + 27, startPosX - biomeSize + 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); - ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 20, 20, (moundX) => + ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 15, 20, (moundX) => { ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startPosY + 60; + int moundY = startPosY + 75; int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize - 27, startPosX + biomeSize - 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); }); + // // Makes a large platform in the middle of the Timeless Shores. @@ -208,7 +222,7 @@ namespace CalamityMod.World { WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] { - new Actions.Clear(), // Clears all tiles and walls. + new Actions.ClearTile(), // Clears all tiles new Actions.PlaceTile((ushort)ModContent.TileType()) // Places tiles. })); } @@ -218,49 +232,39 @@ namespace CalamityMod.World float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, x, true)); int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); WorldUtils.Gen(new Point(x, startPosY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); - }); - - // - // Makes a hole into the actual Sunken Sea at the botoom-left and bottom-right of the middle platform of the Timeless Shores. - // - const int furthestDistanceFromCenter = 55; - const int shortestDistanceFromCenter = 35; - const int holeStart = 50; - const int holeDepth = 35; - ForLoop.Invoke(startPosX - furthestDistanceFromCenter, startPosX - shortestDistanceFromCenter, 1, (holeX) => + }); + const int furthestDistanceFromCenter = 100; + const int shortestDistanceFromCenter = 60; + const int holeStart = 10; + const int holeDepth = 80; + // Platu + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => { - for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) + int randomDisplacement = WorldGen.genRand.Next(-27, 46); + int RandomX = Main.rand.Next(15, 20); + int RandomH = Main.rand.Next(20, 35); + + for (int wallPillarY = startPosY + RandomH; wallPillarY <= startPosY + 60; wallPillarY += 10) { - ShapeData circle = new(); + // Along the height of the pillar, it becomes shorter the more closer to the center we get. + int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - RandomH, startPosY + 45, wallPillarY)) * 25); - // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. - int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 20); + ShapeData rectangle = new ShapeData(); + GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); + GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 30, startPosY + 70, wallPillarY) + 0.25, 1)); - // may or may not be useful later - //GenAction dither = new Modifiers.RadialDither(2 * sizeIncrement, 5 * sizeIncrement); - - WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(sizeIncrement), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Circle(RandomX - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] { - new Actions.ClearTile(), // The shape removes tiles. - new Actions.SetLiquid() // The shape adds liquid (Default to max water). + blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. })); - } - }); - ForLoop.Invoke(startPosX + shortestDistanceFromCenter, startPosX + furthestDistanceFromCenter, 1, (holeX) => - { - for (int holeY = startPosY + holeStart; holeY <= startPosY + holeStart + holeDepth; holeY += 3) - { - ShapeData circle = new(); - // As the hole gets deeper, we want the holes to be bigger and more blurry, so it's not so monotonous. - int sizeIncrement = (int)Utils.Remap(holeY, startPosY + holeStart, startPosY + holeStart + holeDepth, 1, 20); - - WorldUtils.Gen(new Point(holeX, holeY), new Shapes.Circle(sizeIncrement), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { - new Actions.ClearTile(), // The shape removes tiles. - new Actions.SetLiquid() // The shape adds liquid (Default to max water). - })); + new Actions.SetTile((ushort)ModContent.TileType()) + })) + ; } + }); //place water below the clear barrier for the islands so that theres water inbetween them @@ -272,44 +276,15 @@ namespace CalamityMod.World Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; } }); - - //slope tiles - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => - { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) - { - Tile.SmoothSlope(X, Y); - } - }); - - //place layer of sand on valid runestone blocks - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => - { - for (int Y = startPosY - 50; Y <= startPosY + 50; Y++) - { - bool canPlaceSand = false; - - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 5, ModContent.TileType()); - } - } - }); - // // Generates pillars made out of walls at random points in the Timeless Shores. // - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => + ForLoop.Invoke(startPosX - (biomeSize / 2) - furthestDistanceFromCenter, startPosX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => { - int randomDisplacementX = WorldGen.genRand.Next(-10, 30); + int randomDisplacementX = WorldGen.genRand.Next(-10, 10); + int RandomX = Main.rand.Next(3, 6); - for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 70; wallPillarY += 10) + for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 80; wallPillarY += 10) { // Along the height of the pillar, it becomes shorter the more closer to the center we get. int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - 75, startPosY + 50, wallPillarY)) * 25); @@ -318,7 +293,7 @@ namespace CalamityMod.World GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 40, startPosY + 70, wallPillarY) + 0.25, 1)); - WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 12), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 15), Actions.Chain(new GenAction[] { ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. @@ -327,7 +302,8 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. - })); + })) + ; } }); @@ -335,25 +311,33 @@ namespace CalamityMod.World // Makes the transition area to the Timeless Shores. // Replaces tiles, walls, and places some water spots. // - ForLoop.Invoke(startPosX - biomeSize - 25, startPosX + biomeSize + 25, 20, (x) => + ForLoop.Invoke(startPosX - biomeSize - 30, startPosX + biomeSize + 30, 20, (x) => { - for (int y = startPosY - 70; y >= startPosY - 200; y -= 15) + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 30, startPosX + biomeSize - 200, x, true))); + int curveDepth2 = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 30, startPosX - biomeSize + 200, x, true))); + for (int y = startPosY - 5; y >= startPosY - 149; y -= 15) { float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - float ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + float ditherStrength = MathHelper.Lerp(0f, 0.0f, interpolator); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles(TileID.Sand, TileID.HardenedSand), - new Modifiers.Dither(ditherStrength + 0.2f), + new Modifiers.Dither(ditherStrength + 0f), new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceTile((ushort)ModContent.TileType()), })); // changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. still looks nice imo :) interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 200, y, true); - ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); + ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), new Modifiers.Dither(ditherStrength), @@ -363,14 +347,23 @@ namespace CalamityMod.World // i forgot to change this one. :peepotired: interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - ditherStrength = MathHelper.Lerp(0f, 0.95f, interpolator); - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(15), Actions.Chain(new GenAction[] + ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles(TileID.Sandstone), new Modifiers.Dither(ditherStrength), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); + interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); + ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Modifiers.Dither(ditherStrength), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); @@ -384,12 +377,79 @@ namespace CalamityMod.World })); } } + + //place layer of sand on valid runestone blocks + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + { + for (int Y = startPosY - 100; Y <= startPosY + 100; Y++) + { + bool canPlaceSand = false; + + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 5, ModContent.TileType()); + } + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + //Timeless Shores ambiant tiles + //if (Main.tile[X, Y].TileType == ModContent.TileType()) + //{ + // //Driftwood Ambiance + // if (WorldGen.genRand.NextBool(150)) + // { + // ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + // WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + // } + //} + //if (Main.tile[X, Y].TileType == ModContent.TileType()) + //{ + // //Driftwood Ambiance + // if (WorldGen.genRand.NextBool(150)) + // { + // ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + // WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + // } + //} + } + + }); + + + //slope tiles + ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + { + for (int Y = startPosY - 300; Y <= startPosY + 200; Y++) + { + Tile.SmoothSlope(X, Y); + } + }); }); } //sides of the sunken sea (radiant reefs) - //LeftSideBarrier is used to make the barrier of basalt either on the left or right, since the sunken sea is meant to have barriers on both sides and the reefs is generated twice - public static void PlaceRadiantReefs(int startPosX, int startPosY, bool LeftSideBarrier) + public static void PlaceRadiantReefs(int startPosX, int startPosY) { int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); @@ -397,78 +457,23 @@ namespace CalamityMod.World Point origin = new Point(startPosX, startPosY); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - float angle = MathHelper.Pi * 0.15f; + float angle = MathHelper.Pi * 0.20f; float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 180 + (Main.maxTilesX / 180); + int biomeSize = 280 + (Main.maxTilesX / 180); float actualSize = biomeSize * 16f; float constant = actualSize * 2f / (float)Math.Sin(angle); float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); + int verticalRadius = (int)(constant / 20f); Vector2 fociOffset = Vector2.UnitY * fociSpacing; Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - //first, place a basalt barrier on the left and right of the biome - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 60) - { - if (LeftSideBarrier) - { - if (X <= origin.X && Main.tile[X - 40, Y - 25].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X - 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X - 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - if (X >= origin.X && Main.tile[X + 40, Y - 25].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X + 40, Y - 25), new Shapes.Circle(60), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X + 40, Y - 25), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - } - } - } - } - }); - + bool runonce = false; // this is used to make the wall on the left side go boom on the second run //generate the actual caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -476,11 +481,21 @@ namespace CalamityMod.World { float percent = dist / constant; float blurPercent = 0.99f; + if (percent > blurPercent) { + if (runonce = false) //place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + { + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + runonce = true; + } + if (runonce = true) + //place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + { + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), false, 0f, 0f, true, true); + } } else { @@ -488,11 +503,11 @@ namespace CalamityMod.World Main.tile[X, Y].ClearEverything(); //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, unchecked(cavePerlinSeed - 1)) + 0.5f; float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.280f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.380f; //kill or place tiles depending on the noise map if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) @@ -504,11 +519,13 @@ namespace CalamityMod.World WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); } + + //place walls in the biome using a different "seed" so it differs from the cave generation //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 750f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 2, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; @@ -516,6 +533,10 @@ namespace CalamityMod.World { WorldGen.PlaceWall(X, Y, ModContent.WallType()); } + if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) + { + WorldGen.KillTile(X, Y); + } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; @@ -618,13 +639,13 @@ namespace CalamityMod.World int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(startPosX, startPosY); + Point origin = new Point(startPosX, startPosY - 200); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); float angle = MathHelper.Pi * 0.15f; float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 120 + (Main.maxTilesX / 180); + int biomeSize = 150 + (Main.maxTilesX / 180); float actualSize = biomeSize * 16f; float constant = actualSize * 2f / (float)Math.Sin(angle); @@ -638,9 +659,10 @@ namespace CalamityMod.World //place the polyp forest caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + // Modify this part so that the generation happens from bottom to top + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { float percent = dist / constant; float blurPercent = 0.98f; @@ -648,11 +670,12 @@ namespace CalamityMod.World //biome "blending" on the edges (disabled for now) if (percent > blurPercent) { + if (Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) { ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + GenAction blotchMod = new Modifiers.Blotches(4, 0.7); + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); @@ -670,8 +693,8 @@ namespace CalamityMod.World //generate perlin noise caves float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; @@ -688,8 +711,8 @@ namespace CalamityMod.World //place walls in the biome using a different "seed" so it differs from the cave generation //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 700f, Y / 650f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.235f; @@ -699,6 +722,10 @@ namespace CalamityMod.World WorldGen.PlaceWall(X, Y, ModContent.WallType()); } + if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) + { + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; } @@ -751,11 +778,35 @@ namespace CalamityMod.World if (canPlaceSand) { - PlaceSand(X, Y, 5, ModContent.TileType()); + PlaceSand(X, Y, 4, ModContent.TileType()); + } + + } + } + }); + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + { + bool canPlaceGrass = false; + + //place sand clumps on top of exposed limestone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && + !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) + { + canPlaceGrass = true; + } + + if (canPlaceGrass) + { + PlaceSand(X, Y, 0, ModContent.TileType()); } } } }); + //cleanup again ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => @@ -793,7 +844,6 @@ namespace CalamityMod.World } }); } - //bottom of the biome (gleaming burrows) public static void PlaceGleamingBurrows(int startPosX, int startPosY) { @@ -834,11 +884,11 @@ namespace CalamityMod.World ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(10, 0.4); - WorldUtils.Gen(new Point(X, Y - 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + 5), new Shapes.Rectangle(10, 10), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); - WorldUtils.Gen(new Point(X, Y - 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y + 5), new ModShapes.All(circle), Actions.Chain(new GenAction[] { new Actions.Clear(), new Actions.PlaceTile((ushort)ModContent.TileType()) @@ -849,6 +899,8 @@ namespace CalamityMod.World } }); + + //place the gleaming burrows caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { @@ -872,7 +924,7 @@ namespace CalamityMod.World { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); @@ -925,6 +977,7 @@ namespace CalamityMod.World } } + //cleanup the perlin caves ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { @@ -952,6 +1005,7 @@ namespace CalamityMod.World } }); + //place extra tiles ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => { @@ -1018,52 +1072,210 @@ namespace CalamityMod.World } } + //Very bottom of the biome (Clam Den) + public static void PlaceClamDen(int startPosX, int startPosY) + { + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(startPosX, startPosY); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.70f; + float otherAngle = MathHelper.PiOver2 - angle; + + int biomeSize = 80 + (Main.maxTilesX / 180); + float actualSize = biomeSize * 16f; + float constant = actualSize * 2f / (float)Math.Sin(angle); + + float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); + int verticalRadius = (int)(constant / 10f); + + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; + + //place the Clam Den caverns + for (int X = origin.X - biomeSize - 190; X <= origin.X + biomeSize + 190; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) + { + if (Y > origin.Y - 50) + { + //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + } + //place clean transition between the burrows and the other biomes + if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + else + { + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //place walls in the biome using a different "seed" so it differs from the cave generation + //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; + + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) + { + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + } + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + + //cleanup the perlin caves + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + } + } + }); + + + //place extra tiles + ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + bool canPlaceSand = false; + + //place sand clumps on top of exposed navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 4, ModContent.TileType()); + } + } + } + }); + + //cleanup again + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(X, Y); + } + } + } + } + //basalt biome underneath the sunken sea public static void PlaceBasaltGully(int startPosX, int startPosY) { - int biomeSize = 200 + (Main.maxTilesX / 180); - - int XLeft = GenVars.UndergroundDesertLocation.Left + 30; - int XRight = GenVars.UndergroundDesertLocation.Right - 30; - - //place circles of basalt along the 2 edges of the area - for (int Y = startPosY - 60; Y <= Main.maxTilesY - 230; Y += 20) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - int radius = WorldGen.genRand.Next(30, 45); - int RandomX = Main.rand.Next(-25, 25); - - WorldUtils.Gen(new Point(XLeft, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(XLeft, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - - WorldUtils.Gen(new Point(XRight, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(XRight, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - } + int biomeSize = 250 + (Main.maxTilesX / 180); + int XLeft = GenVars.UndergroundDesertLocation.Left + 40; + int XRight = GenVars.UndergroundDesertLocation.Right - 70; //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - ForLoop.Invoke(startPosX - biomeSize - 25, startPosX + biomeSize + 25, 1, (X) => + ForLoop.Invoke(startPosX - biomeSize - 60, startPosX + biomeSize + 60, 1, (X) => { - for (int Y = startPosY - 30; Y <= Main.maxTilesY - 200; Y++) + //const int totalCuveDepth = -120; + //const int totalCuveDepth2 = 120; + int basaltbordernoise = Main.rand.Next(180, 185); + int basaltbordernoisetop = Main.rand.Next(645, 650); + const int totalCuveDepth = -220; + const int totalCuveDepth2 = 90; + int curveDepth = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 60, startPosX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp( + totalCuveDepth, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 60, startPosX - biomeSize + 200, X, true))); + int curveDepthtop = (int)MathHelper.Lerp( + totalCuveDepth2, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 60, startPosX + biomeSize - 200, X, true))); + int curveDepth2top = (int)MathHelper.Lerp( + totalCuveDepth2, + 0f, + MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 60, startPosX - biomeSize + 200, X, true))); + + for (int Y = startPosY - 650 + curveDepthtop + curveDepth2top; Y <= Main.maxTilesY - 185 + curveDepth + curveDepth2; Y++) { Main.tile[X, Y].ClearEverything(); WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); @@ -1071,31 +1283,10 @@ namespace CalamityMod.World } }); - //place another wall of circles along the bottom of the biome so it doesnt just end unnaturally - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 20, (X) => - { - int Y = Main.maxTilesY - 250; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(25), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WallID.LavaUnsafe1) - })); - }); - //place caverns and lava for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startPosY; Y <= Main.maxTilesY - 190; Y++) { if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1195,6 +1386,7 @@ namespace CalamityMod.World } } + //place all the ambient tiles in the sunken sea public static void PlaceSunkenSeaAmbience() { @@ -1207,15 +1399,15 @@ namespace CalamityMod.World for (int Y = 20; Y <= Main.maxTilesY - 20; Y++) { //place coral blobs in the radiant reefs - if (WorldGen.genRand.NextBool(100) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || + if (WorldGen.genRand.NextBool(1000) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) { ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - + ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(2, 4)), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] { blotchMod.Output(circle) })); @@ -1225,7 +1417,27 @@ namespace CalamityMod.World new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Corals)) })); } + //Timeless Shores ambiant tiles + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(100)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(100)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } + } //gleaming burrows ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1274,8 +1486,32 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); } } - if (Main.tile[X, Y].TileType == ModContent.TileType()) + if (Main.tile[X, Y].TileType == ModContent.TileType()) { + //Medium Sea Prism down + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 7); + } + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 5); + } + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 4); + } + if (WorldGen.genRand.NextBool(9)) + { + ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 2); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { //stalactites if (WorldGen.genRand.NextBool(10)) { @@ -1289,6 +1525,7 @@ namespace CalamityMod.World { WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } + //stalagmites if (WorldGen.genRand.NextBool(12)) @@ -1320,11 +1557,168 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); } + if (WorldGen.genRand.NextBool(8)) + { + ushort[] NavystoneAmbients = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(NavystoneAmbients)); + } + } + //Polyp Forest Ambient tiles + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + //BranchCoralsOnLimestone + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 7); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 1); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 5); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 4); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 2); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 6); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(50) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType(),(ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + //BranchCoralsOnSand + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 1); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 5); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 4); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 2); + } + if (WorldGen.genRand.NextBool(55)) + { + ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 8); + } + if (WorldGen.genRand.NextBool(30)) + { + ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DigitateCorals)); + } + if (WorldGen.genRand.NextBool(15)) + { + ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); + } + if (WorldGen.genRand.NextBool(8)) + { + ushort[] WideScarletSeagrasss = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(WideScarletSeagrasss)); + } + if (WorldGen.genRand.NextBool(8)) + { + ushort[] StalkCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(StalkCorals)); + } + if (WorldGen.genRand.NextBool(10)) + { + ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); + } + if (WorldGen.genRand.NextBool(10)) + { + ushort[] TallDigitateCorals = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(TallDigitateCorals)); + } + + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(15)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } } //radiant reefs ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { + if (WorldGen.genRand.NextBool(100) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(7), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(15)) + { + ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + } //multi-colored corals if (WorldGen.genRand.NextBool(3)) { @@ -1365,14 +1759,23 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); } } + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + if (WorldGen.genRand.NextBool(1)) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } //grow depth vines on navystone if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) { - if (WorldGen.genRand.NextBool(7)) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } + // 18APR2025: Ozzatron: removed guaranteed RNG check here, since it was intended to be guaranteed + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1400,6 +1803,27 @@ namespace CalamityMod.World WorldGen.PlaceTile(X - 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); } } + // Pearl Autism + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(50) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + } } } } @@ -1450,6 +1874,7 @@ namespace CalamityMod.World ShapeData circle3 = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + GenAction blotchMod2 = new Modifiers.Blotches(1, 0.1); //first circle of navystone WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] @@ -1476,7 +1901,7 @@ namespace CalamityMod.World //clear out the middle of the circle WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 9), Actions.Chain(new GenAction[] { - blotchMod.Output(circle3) + blotchMod2.Output(circle3) })); WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle3), Actions.Chain(new GenAction[] { @@ -1502,6 +1927,12 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), }; void getAttachedPoints(int x, int y, List points) @@ -1545,6 +1976,7 @@ namespace CalamityMod.World }); } + //method to make sure things only generate in each biome circle public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false, bool collapseBottom = false) {