diff --git a/Buffs/StatBuffs/GreenJellyRegen.cs b/Buffs/StatBuffs/GreenJellyRegen.cs new file mode 100644 index 0000000000..79347cf7ef --- /dev/null +++ b/Buffs/StatBuffs/GreenJellyRegen.cs @@ -0,0 +1,20 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class GreenJellyRegen : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().GreenJellyRegen = true; + } + } +} diff --git a/Buffs/StatBuffs/GreenJellyRegen.png b/Buffs/StatBuffs/GreenJellyRegen.png new file mode 100644 index 0000000000..b5cd1f4743 Binary files /dev/null and b/Buffs/StatBuffs/GreenJellyRegen.png differ diff --git a/Buffs/StatBuffs/PinkJellyRegen.cs b/Buffs/StatBuffs/PinkJellyRegen.cs new file mode 100644 index 0000000000..37cb15cc06 --- /dev/null +++ b/Buffs/StatBuffs/PinkJellyRegen.cs @@ -0,0 +1,20 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class PinkJellyRegen : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().PinkJellyRegen = true; + } + } +} diff --git a/Buffs/StatBuffs/PinkJellyRegen.png b/Buffs/StatBuffs/PinkJellyRegen.png new file mode 100644 index 0000000000..6dd75f8c34 Binary files /dev/null and b/Buffs/StatBuffs/PinkJellyRegen.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 08e56b803c..443da481a2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -58,6 +58,7 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Typless; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -73,6 +74,7 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; +using static Terraria.ModLoader.PlayerDrawLayer; namespace CalamityMod.CalPlayer { @@ -83,6 +85,8 @@ namespace CalamityMod.CalPlayer #region No Category public static bool areThereAnyDamnBosses = false; public static bool areThereAnyDamnEvents = false; + public bool potionSick = false; + public int timePotionSick; public bool drawBossHPBar = true; public float stealthUIAlpha = 1f; public float SulphWaterUIOpacity = 1f; @@ -230,6 +234,8 @@ namespace CalamityMod.CalPlayer public int auralisAurora = 0; public int necroReviveCounter = -1; public int hideOfDeusTimer = 0; + public int giantShellPostHit = 0; + public int tortShellPostHit = 0; public int spiritOriginBullseyeShootCountdown = 0; public int spiritOriginConvertedCrit = 0; public int RustyMedallionCooldown = 0; @@ -270,6 +276,7 @@ namespace CalamityMod.CalPlayer public static readonly SoundStyle IjiDeathSound = new("CalamityMod/Sounds/Custom/IjiDies"); public static readonly SoundStyle DrownSound = new("CalamityMod/Sounds/Custom/AbyssDrown"); public static readonly SoundStyle LeonDeathNoiseRE4_ForGFB = new("CalamityMod/Sounds/Custom/GFB/LeonDeathNoiseRE4"); + public static readonly SoundStyle CrabClawHit = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak2") { Volume = 0.7f }; #endregion #region Rogue @@ -460,6 +467,7 @@ namespace CalamityMod.CalPlayer public bool dAmulet = false; public bool fCarapace = false; public bool gShell = false; + public bool tortShell = false; public bool absorber = false; public bool aAmpoule = false; public bool sponge = false; @@ -493,6 +501,10 @@ namespace CalamityMod.CalPlayer public bool toxicHeart = false; public bool abaddon = false; public bool aeroStone = false; + public bool lifejelly = false; + public bool cleansingjelly = false; + public bool GrandGelatin = false; + public int CleansingEffect = 0; public bool community = false; public bool shatteredCommunity = false; public bool fleshTotem = false; @@ -521,6 +533,9 @@ namespace CalamityMod.CalPlayer public bool spiritOrigin = false; public bool spiritOriginVanity = false; public bool darkSunRing = false; + public bool crawCarapace = false; + public bool crabClaw = false; + public bool HasReducedDashFirstFrame = false; public bool voidOfCalamity = false; public bool voidOfExtinction = false; public bool eArtifact = false; @@ -825,6 +840,8 @@ namespace CalamityMod.CalPlayer public bool flaskBrimstone = false; public bool fabsolVodka = false; public bool mushy = false; + public bool PinkJellyRegen = false; + public bool GreenJellyRegen = false; public bool shellBoost = false; public bool cFreeze = false; public bool shine = false; @@ -1537,6 +1554,7 @@ namespace CalamityMod.CalPlayer dAmulet = false; fCarapace = false; gShell = false; + tortShell = false; absorber = false; aAmpoule = false; sponge = false; @@ -1563,6 +1581,9 @@ namespace CalamityMod.CalPlayer toxicHeart = false; abaddon = false; aeroStone = false; + lifejelly = false; + GrandGelatin = false; + cleansingjelly = false; community = false; shatteredCommunity = false; stressPills = false; @@ -1580,6 +1601,10 @@ namespace CalamityMod.CalPlayer harpyWingBoost = false; //harpy wings + harpy ring fleshKnuckles = false; darkSunRing = false; + crawCarapace = false; + crabClaw = false; + gShell = false; + tortShell = false; voidOfCalamity = false; voidOfExtinction = false; eArtifact = false; @@ -1829,6 +1854,8 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; + PinkJellyRegen = false; + GreenJellyRegen = false; shellBoost = false; cFreeze = false; tRegen = false; @@ -2264,6 +2291,8 @@ namespace CalamityMod.CalPlayer shine = false; anechoicCoating = false; mushy = false; + PinkJellyRegen = false; + GreenJellyRegen = false; enraged = false; shellBoost = false; cFreeze = false; @@ -3197,6 +3226,21 @@ namespace CalamityMod.CalPlayer if (Player.accRunSpeed < accRunSpeedMin) Player.accRunSpeed = accRunSpeedMin; + //Life Jelly regen aura spawn when using a healing potion + if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && lifejelly && !GrandGelatin) + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + + //Cleansing Jelly cleansing aura spawn when using a healing potion + if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && cleansingjelly && !GrandGelatin) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + } + //Grand Gellatin regen and cleansing aura spawn when using a healing potion + if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && GrandGelatin) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + } + if (snowman) { if (Player.whoAmI == Main.myPlayer && !snowmanNoseless) @@ -3360,8 +3404,18 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer && CalamityConfig.Instance.VanillaCooldownDisplay) { + if (Player.whoAmI == Main.myPlayer && Player.potionDelay != 0) + potionSick = true; + else + potionSick = false; + + if (!potionSick) + timePotionSick = 0; + else + timePotionSick++; + // Add a cooldown display for potion sickness if the player has the vanilla counter ticking - if (Player.potionDelay > 0 && !Player.HasCooldown(PotionSickness.ID)) + if (potionSick && !Player.HasCooldown(PotionSickness.ID)) Player.AddCooldown(PotionSickness.ID, Player.potionDelay, false); if (cooldowns.TryGetValue(PotionSickness.ID, out CooldownInstance cd)) @@ -4840,7 +4894,32 @@ namespace CalamityMod.CalPlayer if (NPC.AnyNPCs(ModContent.NPCType())) { Player.AddBuff(ModContent.BuffType(), 15, true); - } + } + + if (crawCarapace) + { + npc.AddBuff(ModContent.BuffType(), 720); + SoundEngine.PlaySound(SoundID.NPCHit33 with { Volume = 0.5f }, Player.Center); + } + + if (crabClaw) + { + npc.AddBuff(ModContent.BuffType(), 1800); + SoundEngine.PlaySound(CrabClawHit, Player.Center); + Vector2 bloodSpawnPosition = Player.Center + Main.rand.NextVector2Circular(Player.width, Player.height) * 0.04f; + Vector2 splatterDirection = (Player.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); + for (int i = 0; i < 9; i++) + { + int sparkLifetime = Main.rand.Next(12, 18); + float sparkScale = Main.rand.NextFloat(0.8f, 1f) * 0.955f; + Color sparkColor = Color.Lerp(Color.RoyalBlue, Color.DarkBlue, Main.rand.NextFloat(0.7f)); + sparkColor = Color.Lerp(sparkColor, Color.RoyalBlue, Main.rand.NextFloat()); + Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); + sparkVelocity.Y -= 5.5f; + SparkParticle spark = new SparkParticle(Player.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } } public override void OnHitByProjectile(Projectile proj, Player.HurtInfo hurtInfo) @@ -5762,9 +5841,15 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item96, Player.Center); } - if ((gShell || flameLickedShell) && !Player.panic) + if ((flameLickedShell) && !Player.panic) Player.AddBuff(ModContent.BuffType(), 180); + if (gShell) //5 seconds of no dash reduction and reduced defense + giantShellPostHit = 300; + + if (tortShell) //5 seconds of no dash reduction and reduced defense + tortShellPostHit = 300; + if (abyssalDivingSuitPlates && hurtInfo.Damage > 50) { if (abyssalDivingSuitPlateHits < 3) diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 2a8e2f38c6..4b43fdb7ea 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.CalPlayer.DrawLayers; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -517,6 +518,22 @@ namespace CalamityMod.CalPlayer fullBright = true; } } + if (calamityPlayer.PinkJellyRegen) + { + if (Main.rand.NextBool(24) && drawInfo.shadow == 0f) + { + Particle Plus = new HealingPlus(Player.Center, Main.rand.NextFloat(0.5f, 1.2f), Color.HotPink, Color.LightPink, Main.rand.Next(10, 15)); + GeneralParticleHandler.SpawnParticle(Plus); + } + } + if (calamityPlayer.GreenJellyRegen) + { + if (Main.rand.NextBool(16) && drawInfo.shadow == 0f) + { + Particle Plus = new HealingPlus(Player.Center, Main.rand.NextFloat(0.6f, 1.3f), Color.Lime, Color.LimeGreen, Main.rand.Next(10, 15)); + GeneralParticleHandler.SpawnParticle(Plus); + } + } if (calamityPlayer.bloodfinBoost) { if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index b281824a10..9381515936 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -660,6 +660,12 @@ namespace CalamityMod.CalPlayer if (sRegen) Player.lifeRegen += 2; + if (PinkJellyRegen) + Player.lifeRegen += 4; + + if (GreenJellyRegen) + Player.lifeRegen += 6; + if (hallowedRegen) Player.lifeRegen += 3; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5c42254e92..ae594420aa 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -238,6 +238,36 @@ namespace CalamityMod.CalPlayer //Todo - Move this back to the wulfrum set class whenever statmodifiers are implemented for stats other than damage if (WulfrumHat.PowerModeEngaged(Player, out _)) Player.moveSpeed *= 0.8f; + + if (gShell) + { + //reduce player dash velocity as long as you didn't just get hit + if (Player.dashDelay == -1 && giantShellPostHit == 0) + { + if (!HasReducedDashFirstFrame) + { + Player.velocity.X *= 0.9f; + HasReducedDashFirstFrame = true; + } + } + else + HasReducedDashFirstFrame = false; + } + + if (tortShell) + { + //reduce player dash velocity as long as you didn't just get hit + if (Player.dashDelay == -1 && tortShellPostHit == 0) + { + if (!HasReducedDashFirstFrame) + { + Player.velocity.X *= 0.85f; + HasReducedDashFirstFrame = true; + } + } + else + HasReducedDashFirstFrame = false; + } } #endregion @@ -2485,6 +2515,48 @@ namespace CalamityMod.CalPlayer Player.statDefense += Main.eclipse ? 10 : 20; } + if (crawCarapace) + Player.GetDamage() += 0.05f; + + if (crabClaw) + Player.GetDamage() += 0.08f; + + if (gShell) + { + if (giantShellPostHit == 1) + SoundEngine.PlaySound(SoundID.Zombie58, Player.Center); + + if (giantShellPostHit > 0) + { + Player.statDefense -= 5; + giantShellPostHit--; + } + if (giantShellPostHit < 0) + { + giantShellPostHit = 0; + } + } + + if (tortShell) + { + if (tortShellPostHit == 1) + SoundEngine.PlaySound(SoundID.NPCHit24 with {Volume = 0.5f}, Player.Center); + + if (tortShellPostHit > 0) + { + Player.statDefense -= 10; + tortShellPostHit--; + } + else + Player.endurance += 0.05f; + + if (tortShellPostHit < 0) + { + tortShellPostHit = 0; + } + } + + // Ancient Chisel nerf if (Player.chiselSpeed) Player.pickSpeed += 0.1f; @@ -3570,6 +3642,16 @@ namespace CalamityMod.CalPlayer // (in addition to the player taking more defense damage, of course). if (totalDefenseDamage > 0) { + //Used to cleanse all defense damage by accessories + if (CleansingEffect == 1) + { + totalDefenseDamage = 0; + defenseDamageRecoveryFrames = 0; + totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; + defenseDamageDelayFrames = 0; + CleansingEffect = 0; + } + // Defense damage is capped at your maximum defense, no matter what. if (totalDefenseDamage > Player.statDefense) totalDefenseDamage = Player.statDefense; diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/CleansingJelly.cs similarity index 65% rename from Items/Accessories/ManaJelly.cs rename to Items/Accessories/CleansingJelly.cs index 3f978e6527..3a1611de7a 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/CleansingJelly.cs @@ -2,10 +2,12 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { - public class ManaJelly : ModItem, ILocalizedModType + [LegacyName("ManaJelly")] + public class CleansingJelly : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -19,11 +21,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.manaRegenBonus += 4; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.cleansingjelly = true; } } } diff --git a/Items/Accessories/ManaJelly.png b/Items/Accessories/CleansingJelly.png similarity index 100% rename from Items/Accessories/ManaJelly.png rename to Items/Accessories/CleansingJelly.png diff --git a/Items/Accessories/CrabClaw.cs b/Items/Accessories/CrabClaw.cs new file mode 100644 index 0000000000..9ccf7d2baf --- /dev/null +++ b/Items/Accessories/CrabClaw.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; + +namespace CalamityMod.Items.Accessories +{ + public class CrabClaw : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 30; + Item.height = 28; + Item.value = CalamityGlobalItem.Rarity7BuyPrice; + Item.rare = ItemRarityID.Lime; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.crabClaw = true; + player.thorns += 1.1f; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(12). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Accessories/CrabClaw.png b/Items/Accessories/CrabClaw.png new file mode 100644 index 0000000000..d74f81963c Binary files /dev/null and b/Items/Accessories/CrabClaw.png differ diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index 4e01739f08..b66e9f9f1d 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -9,7 +10,6 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 5; Item.width = 28; Item.height = 28; Item.value = CalamityGlobalItem.Rarity1BuyPrice; @@ -19,7 +19,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.thorns += 0.5f; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.crawCarapace = true; + player.thorns += 0.25f; } } } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 7b56586c36..3d6c009bac 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed -= 0.15f; CalamityPlayer modPlayer = player.Calamity(); modPlayer.gShell = true; } diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index a962d5a46d..b058933739 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -2,6 +2,8 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -10,7 +12,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.defense = 14; + Item.defense = 15; Item.width = 20; Item.height = 24; Item.value = CalamityGlobalItem.Rarity4BuyPrice; @@ -20,9 +22,16 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed -= 0.1f; - player.thorns += 0.25f; - player.buffImmune[ModContent.BuffType()] = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.tortShell = true; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.TurtleShell). + AddTile(TileID.Anvils). + Register(); } } } diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 5c9271d321..2668c59e0d 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,21 +20,16 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.GrandGelatin = true; player.moveSpeed += 0.1f; player.jumpSpeedBoost += 0.5f; - player.statLifeMax2 += 20; - player.statManaMax2 += 20; - if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) - { - player.lifeRegen += 4; - player.manaRegenBonus += 4; - } } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(ItemID.SoulofLight, 2). diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index dea425b790..0c4d0719e6 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { @@ -19,11 +20,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statLifeMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.lifeRegen += 4; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.lifejelly = true; } } } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 6fdd27deab..8a452a0c22 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -36,17 +36,7 @@ namespace CalamityMod.Items.Accessories { CreateRecipe(). AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(5). - AddTile(TileID.LunarCraftingStation). - Register(); - - CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(5). AddTile(TileID.LunarCraftingStation). diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8b86e9e46a..a7e0fd96bc 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -36,6 +36,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Utilities; +using CalamityMod.Projectiles.Typless; namespace CalamityMod.Items { diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index a736cbca9a..76cde644df 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Balancing; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; @@ -1371,6 +1372,11 @@ namespace CalamityMod.Items shimmerTransmute[ItemID.LunarOre] = ModContent.ItemType(); shimmerTransmute[ItemID.ChlorophyteOre] = ModContent.ItemType(); shimmerTransmute[ItemID.CobaltOre] = ModContent.ItemType(); + + //Fuck vanilla's stupid Giant Shelly, Crawdad, and Salamander exclusivity + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); + } #endregion } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 765c1974c6..657bcfc6fa 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1470,4 +1470,14 @@ WitherBlossomsBuff: { WulfrumDroidBuff: { DisplayName: Wulfrum Droid Description: The wulfrum droid will protect you +} + +PinkJellyRegen: { + DisplayName: Pink Jelly Regen + Description: The power of goo refreshes you, life regen increased by 4 +} + +GreenJellyRegen: { + DisplayName: Green Jelly Regen + Description: The regenerative goo empowers you, life regen increased by 6 } \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 0befec8143..9410e576ce 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -418,7 +418,20 @@ CounterScarf: { CrawCarapace: { DisplayName: Craw Carapace - Tooltip: Enemies take damage when they touch you + Tooltip: + ''' + 5% increased damage + Enemies that hit you take damage and are inflicted with Armor Crunch + ''' +} + +CrabClaw: { + DisplayName: Crab Claw + Tooltip: + ''' + 8% increased damage + Enemies that hit you take high damage and are inflicted with Armor Crunch for a long time + ''' } CrimsonFlask: { @@ -799,8 +812,8 @@ GiantShell: { DisplayName: Giant Shell Tooltip: ''' - 15% reduced movement speed - Taking a hit will make you move very fast for a short time + 10% reduced dash velocity + Taking a hit will remove the dash penalty and reduce defense for 5 seconds ''' } @@ -808,9 +821,9 @@ GiantTortoiseShell: { DisplayName: Giant Tortoise Shell Tooltip: ''' - 10% decreased movement speed - Enemies take damage when they hit you - Grants immunity to Armor Crunch + 5% increased damage reduction + 15% reduced dash velocity + Taking a hit will remove the dash penalty and reduce defense and damage reduction for 5 seconds ''' } @@ -851,9 +864,10 @@ GrandGelatin: { DisplayName: Grand Gelatin Tooltip: ''' - 10% increased movement and jump speed - +20 max life and mana - Standing still boosts life and mana regen + 10% increased movement speed and jump speed + Using a healing potion will spawn a cleansing aura + Walking into the aura removes all debuffs and defense damage one time + The aura provides increased life regen for all players inside for 8 seconds ''' } @@ -987,8 +1001,8 @@ LifeJelly: { DisplayName: Life Jelly Tooltip: ''' - +20 max life - Standing still boosts life regen + Using a healing potion will spawn a lingering aura + The aura provides increased life regen for all players inside for 5 seconds ''' } @@ -1021,12 +1035,12 @@ LuxorsGift: { ''' } -ManaJelly: { - DisplayName: Mana Jelly +CleansingJelly: { + DisplayName: Cleansing Jelly Tooltip: ''' - +20 max mana - Standing still boosts mana regen + Using a healing potion will spawn a cleansing aura + Walking into the aura removes all debuffs and defense damage one time ''' } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index dd2b8e65d5..81425f34d7 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.Abyss postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); npcLoot.Add(ItemID.JellyfishNecklace, 10); } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 5b07cc7353..5896d91767 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -255,9 +255,9 @@ namespace CalamityMod.NPCs break; // Blue Jellyfish - // Mana Jelly @ 14.29% Normal, 25% Expert+ + // Cleansing Jelly @ 14.29% Normal, 25% Expert+ case NPCID.BlueJellyfish: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); break; // Green Jellyfish @@ -359,12 +359,6 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); break; - // Giant Tortoise - // Giant Tortoise Shell @ 14.29% Normal, 25% Expert+ - case NPCID.GiantTortoise: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); - break; - // Angry Trapper // Trapper Bulb @ 50% Normal, 100% Expert+ case NPCID.AngryTrapper: @@ -1786,6 +1780,7 @@ namespace CalamityMod.NPCs // First kill: Notify of Abyss chests being unlocked. if (!NPC.downedBoss3) { + World.Abyss.AbleToUnlockChests = true; World.Abyss.UnlockAllAbyssChests(); string keysk = "Mods.CalamityMod.Status.Progression.SkeletronAbyssChestNotification"; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 5d61ee310f..1682b7eb5a 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1425,7 +1425,9 @@ namespace CalamityMod.NPCs { shop.AddWithCustomValue(ItemType(), Item.buyPrice(silver: 25), potionSells) .Add(ItemID.MilkCarton) - .AddWithCustomValue(ItemID.Marrow, Item.buyPrice(gold: 25), Condition.Hardmode); + .AddWithCustomValue(ItemID.Marrow, Item.buyPrice(gold: 25), Condition.Hardmode) + .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 12)) + .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 12)); } if (type == NPCID.Golfer) diff --git a/Particles/HealingPlus.cs b/Particles/HealingPlus.cs new file mode 100644 index 0000000000..3d812d2f54 --- /dev/null +++ b/Particles/HealingPlus.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using System; +using static Terraria.ModLoader.PlayerDrawLayer; + +namespace CalamityMod.Particles +{ + public class HealingPlus : Particle + { + public override string Texture => "CalamityMod/Particles/HealingPlus"; + public override bool UseAdditiveBlend => true; + public override bool UseCustomDraw => true; + public override bool SetLifetime => true; + + public Player Owner; + public Color StartColor; + public Color EndColor; + public Vector2 OverridePosition; + public float Opacity; + + public HealingPlus(Vector2 position, float scale, Color colorStart, Color colorEnd, int lifetime) + { + Position = position; + Scale = scale; + Velocity.X = 0; + Velocity.Y = Main.rand.NextFloat(-2f, -5f); + Rotation = 0; + StartColor = colorStart; + EndColor = colorEnd; + Color = colorStart; + Lifetime = lifetime; + } + + public override void Update() + { + Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion); + Lighting.AddLight(Position, Color.ToVector3() * 0.2f); + Opacity -= 0.05f; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + + Vector2 Size = new Vector2 (Scale); + + Vector2 origin = new Vector2(tex.Width, tex.Height); + + Vector2 PositionAdjust = new Vector2(-16, -40); + + spriteBatch.Draw(tex, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, origin, Size, SpriteEffects.None, 0); + + } + } +} diff --git a/Particles/HealingPlus.png b/Particles/HealingPlus.png new file mode 100644 index 0000000000..f864d8d77c Binary files /dev/null and b/Particles/HealingPlus.png differ diff --git a/Particles/HighResHollowCircleHardEdge.png b/Particles/HighResHollowCircleHardEdge.png new file mode 100644 index 0000000000..709ae95924 Binary files /dev/null and b/Particles/HighResHollowCircleHardEdge.png differ diff --git a/Particles/StaticPulseRing.cs b/Particles/StaticPulseRing.cs new file mode 100644 index 0000000000..27649de303 --- /dev/null +++ b/Particles/StaticPulseRing.cs @@ -0,0 +1,53 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using static CalamityMod.CalamityUtils; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class StaticPulseRing : Particle + { + public override string Texture => "CalamityMod/Particles/HighResHollowCircleHardEdge"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + private float OriginalScale; + private float FinalScale; + private Vector2 Squish; + private Color BaseColor; + + //Basically DirectionalPulseRing, but doesn't move or change opacity + public StaticPulseRing(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime) + { + Position = position; + Velocity = velocity; + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + Scale = originalScale; + Lifetime = lifeTime; + Squish = squish; + Rotation = rotation; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); + + Color = BaseColor; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + Velocity *= 0; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0); + } + + } +} diff --git a/Projectiles/Healing/BlueJellyAura.cs b/Projectiles/Healing/BlueJellyAura.cs new file mode 100644 index 0000000000..c681b6d31b --- /dev/null +++ b/Projectiles/Healing/BlueJellyAura.cs @@ -0,0 +1,149 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using System.Collections.Generic; + +namespace CalamityMod.Projectiles.Typless +{ + public class BlueJellyAura : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float Radius = 160f; + public int ShinkGrow = 0; + public int Framecounter = 0; + public int CleanseOnce = 1; + public int PulseOnce = 1; + public int PulseOnce2 = 1; + public int PulseOnce3 = 1; + public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal1") { Volume = 0.5f }; + public ref int CleansingEffect => ref Main.player[Projectile.owner].Calamity().CleansingEffect; + public List cleanseList = new List(new bool[Main.maxPlayers]); + + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 336; + Projectile.height = 336; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Default; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2710; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Framecounter++; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + + //Remove the players debuffs and defense damage, but only once per aura + if (targetDist < 155f && cleanseList[playerIndex] == false) + { + cleanseList[playerIndex] = true; + CleansingEffect = 1; + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + { + player.buffTime[l] *= 0; + } + } + for (int i = 0; i < 55; i++) + { + int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, 187, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 5.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.5f; + } + + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); + } + } + + if (ShinkGrow == 0) + { + if (PulseOnce == 1) + { + Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.RoyalBlue, new Vector2(1f, 1f), 0f, 0f, 0.152f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + PulseOnce = 0; + } + + if (Framecounter == 10) + { + ShinkGrow = 1; + } + } + if (ShinkGrow == 1) + { + if (PulseOnce2 == 1) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.RoyalBlue, new Vector2(1f, 1f), 0f, 0.152f, 0.152f, 2700); + GeneralParticleHandler.SpawnParticle(pulse2); + PulseOnce2 = 0; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 187); + dust.scale = Main.rand.NextFloat(2.2f, 3.3f); + dust.noGravity = true; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(150f, 150f), 187); + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.noGravity = true; + } + + if (Framecounter == 2710) + { + ShinkGrow = 2; + } + } + if (ShinkGrow == 2) + { + if (PulseOnce3 == 1) + { + Particle pulse3 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.RoyalBlue, new Vector2(1f, 1f), 0f, 0.152f, 0f, 10); + GeneralParticleHandler.SpawnParticle(pulse3); + PulseOnce3 = 0; + } + } + } + + public override bool? CanCutTiles() + { + return false; + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + + } +} diff --git a/Projectiles/Healing/GreenJellyAura.cs b/Projectiles/Healing/GreenJellyAura.cs new file mode 100644 index 0000000000..2e8e87b847 --- /dev/null +++ b/Projectiles/Healing/GreenJellyAura.cs @@ -0,0 +1,151 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using System.Collections.Generic; + +namespace CalamityMod.Projectiles.Typless +{ + public class GreenJellyAura : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float Radius = 160f; + public int ShinkGrow = 0; + public int Framecounter = 0; + public int CleanseOnce = 1; + public int PulseOnce = 1; + public int PulseOnce2 = 1; + public int PulseOnce3 = 1; + public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal3") { Volume = 0.5f }; + public List cleanseList = new List(new bool[Main.maxPlayers]); + public ref int CleansingEffect => ref Main.player[Projectile.owner].Calamity().CleansingEffect; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 336; + Projectile.height = 336; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Default; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2710; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Framecounter++; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + + //Remove the players debuffs and defense damage, but only once per aura + if (targetDist < 232f) + { + player.AddBuff(ModContent.BuffType(), 480); + if (cleanseList[playerIndex] == false) + { + cleanseList[playerIndex] = true; + CleansingEffect = 1; + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + { + player.buffTime[l] *= 0; + } + } + for (int i = 0; i < 55; i++) + { + int dust = Dust.NewDust(player.Center, player.width + 4, player.height + 4, 298, player.velocity.X * 0.2f, player.velocity.Y * 0.2f, 100, default, 5.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.5f; + Main.dust[dust].velocity.Y -= 0.5f; + } + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); + } + } + } + + if (ShinkGrow == 0) + { + if (PulseOnce == 1) + { + Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(1f, 1f), 0f, 0f, 0.225f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + PulseOnce = 0; + } + + if (Framecounter == 10) + { + ShinkGrow = 1; + } + } + if (ShinkGrow == 1) + { + if (PulseOnce2 == 1) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(1f, 1f), 0f, 0.225f, 0.225f, 2700); + GeneralParticleHandler.SpawnParticle(pulse2); + PulseOnce2 = 0; + } + + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(232f, 232f), 298); + dust.scale = Main.rand.NextFloat(2.2f, 3.3f); + dust.noGravity = true; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(225f, 225f), 298); + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.noGravity = true; + } + + if (Framecounter == 2710) + { + ShinkGrow = 2; + } + } + if (ShinkGrow == 2) + { + if (PulseOnce3 == 1) + { + Particle pulse3 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(1f, 1f), 0f, 0.225f, 0f, 10); + GeneralParticleHandler.SpawnParticle(pulse3); + PulseOnce3 = 0; + } + } + } + + public override bool? CanCutTiles() + { + return false; + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + + } +} diff --git a/Projectiles/Healing/PinkJellyAura.cs b/Projectiles/Healing/PinkJellyAura.cs new file mode 100644 index 0000000000..75f5ce63f7 --- /dev/null +++ b/Projectiles/Healing/PinkJellyAura.cs @@ -0,0 +1,124 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typless +{ + public class PinkJellyAura : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Healing"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float Radius = 160f; + public int ShinkGrow = 0; + public int Framecounter = 0; + public int PulseOnce = 1; + public int PulseOnce2 = 1; + public int PulseOnce3 = 1; + public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal1") { Volume = 0.5f }; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 336; + Projectile.height = 336; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Default; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2710; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Framecounter++; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + if (targetDist < 155f) + { + player.AddBuff(ModContent.BuffType(), 300); + } + } + + if (ShinkGrow == 0) + { + if (PulseOnce == 1) + { + Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 0f, 0.152f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); + PulseOnce = 0; + } + + if (Framecounter == 10) + { + ShinkGrow = 1; + } + } + if (ShinkGrow == 1) + { + if (PulseOnce2 == 1) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 0.152f, 0.152f, 2700); + GeneralParticleHandler.SpawnParticle(pulse2); + PulseOnce2 = 0; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 242); + dust.scale = Main.rand.NextFloat(2.2f, 3.3f); + dust.noGravity = true; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(150f, 150f), 242); + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.noGravity = true; + } + + if (Framecounter == 2710) + { + ShinkGrow = 2; + } + } + if (ShinkGrow == 2) + { + if (PulseOnce3 == 1) + { + Particle pulse3 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 0.152f, 0f, 10); + GeneralParticleHandler.SpawnParticle(pulse3); + PulseOnce3 = 0; + } + } + } + + public override bool? CanCutTiles() + { + return false; + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + + } +} diff --git a/Tiles/Abyss/AbyssTreasureChest.cs b/Tiles/Abyss/AbyssTreasureChest.cs index 8605571cf4..fc1d013cdd 100644 --- a/Tiles/Abyss/AbyssTreasureChest.cs +++ b/Tiles/Abyss/AbyssTreasureChest.cs @@ -26,7 +26,15 @@ namespace CalamityMod.Tiles.Abyss // Locked Chest stuff public override bool IsLockedChest(int i, int j) => Main.tile[i, j].TileFrameX / 36 == 1; - public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) => true; + public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) + { + //Skeletron must be dead, NPC.downedBoss3 is added as a safety measure for worlds generated before this was placed or in case the first bool gets cleared + // since tmod has not fixed the modded data disappearing bug + if (World.Abyss.AbleToUnlockChests || NPC.downedBoss3) + return true; + else + return false; + } public override bool RightClick(int i, int j) { diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 42091111ee..84df43188b 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -1798,11 +1798,6 @@ namespace CalamityMod r.AddTile(TileID.CrystalBall); r.Register(); - // Turtle Shell with Giant Tortoise Shell - r = Recipe.Create(ItemID.TurtleShell); - r.AddIngredient(ModContent.ItemType()); - r.Register(); - // Pulse Bow r = Recipe.Create(ItemID.PulseBow); r.AddIngredient(ItemID.ShroomiteBar, 16); diff --git a/World/Abyss.cs b/World/Abyss.cs index 58c8efe080..36921246e3 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -36,6 +36,7 @@ namespace CalamityMod.World public static bool AtLeftSideOfWorld = false; public static int AbyssChasmBottom = 0; + public static bool AbleToUnlockChests = false; //used for unlocking chests during skeletron's death and so that they cannot be opened beforehand public static void PlaceAbyss() { int x = Main.maxTilesX; diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index a508bee98e..88e7c8e8c6 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -15,6 +15,8 @@ using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.Schematics.SchematicManager; +using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Potions; namespace CalamityMod.World { @@ -62,6 +64,22 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; + if (Main.zenithWorld) + { + int evil = Utils.SelectRandom(WorldGen.genRand, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); + contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.RottenChunk, WorldGen.genRand.Next(24, 28 + 1)), + new ChestItem(ItemID.CorruptionKey, 1), + new ChestItem(ItemID.CorruptTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(evil, 1), + new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), + new ChestItem(ItemID.GasTrap,1), + }; + } + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -136,6 +154,23 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; + //Gfb loot change + if (Main.zenithWorld) + { + //Cannot modify the return value of List.this[int] because its not a variable so gotta do this instead + contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.Vertebrae, WorldGen.genRand.Next(24, 28 + 1)), + new ChestItem(ItemID.CrimsonKey, 1), + new ChestItem(ItemID.CrimsonTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 2 + 1)), + new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), + new ChestItem(ItemID.GasTrap, 1), + }; + } + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -211,6 +246,21 @@ namespace CalamityMod.World new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; + if (Main.zenithWorld) + { + int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge, ItemID.GasTrap); + contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemID.DungeonDesertKey, 1), + new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), + new ChestItem(golfClub, 1), //Implying that the golfer messed with the loot but forgot this, OR its trapped + }; + } for (int i = 0; i < contents.Count; i++) { @@ -267,6 +317,9 @@ namespace CalamityMod.World public static void FillGraniteShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + if (Main.zenithWorld) + potionType = ItemID.RedPotion; + List contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -274,7 +327,8 @@ namespace CalamityMod.World new ChestItem(ItemID.BlueTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(Main.zenithWorld ? 1 : 10, (Main.zenithWorld ? 2 : 12) + 1)), + new ChestItem((Main.rand.NextBool(2) && Main.zenithWorld) ? ItemID.GasTrap : ItemID.Granite, Main.zenithWorld ? 1 : WorldGen.genRand.Next(7,15+1)), }; for (int i = 0; i < contents.Count; i++) @@ -291,7 +345,7 @@ namespace CalamityMod.World do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.3f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -308,8 +362,10 @@ namespace CalamityMod.World canGenerateInLocation = false; //The granite geode is supposed to fully float in free air. No tile replacements - if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile) - graniteWallsInArea++; + if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.remixWorld) + graniteWallsInArea++; + else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.remixWorld) //Get fixed boi makes it generate in marble biomes + graniteWallsInArea++; } } if (!canGenerateInLocation || graniteWallsInArea < totalTiles * 0.95f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) @@ -324,7 +380,7 @@ namespace CalamityMod.World break; } - } while (tries <= 20000); + } while (tries <= 30000); } #endregion @@ -343,6 +399,21 @@ namespace CalamityMod.World new ChestItem(foodType, WorldGen.genRand.Next(10, 12 + 1)), }; + if (Main.zenithWorld) + { + contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemID.FrozenKey, 1), + new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemID.Eggnog, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(200, 349 + 1)), + new ChestItem(Main.rand.NextBool(2) ? ItemID.GasTrap : ItemID.Marshmallow, 1) + }; + } + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -400,6 +471,8 @@ namespace CalamityMod.World public static void FillMarbleShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + if (Main.zenithWorld) + potionType = ItemID.RedPotion; List contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -407,7 +480,8 @@ namespace CalamityMod.World new ChestItem(ItemID.WhiteTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(Main.zenithWorld ? 1 : 10, (Main.zenithWorld ? 2 : 12) + 1)), + new ChestItem((Main.rand.NextBool(2) && Main.zenithWorld) ? ItemID.GasTrap : ItemID.Marble, Main.zenithWorld ? 1 : WorldGen.genRand.Next(7,15+1)), }; for (int i = 0; i < contents.Count; i++) @@ -424,7 +498,7 @@ namespace CalamityMod.World do { int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.3f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -443,7 +517,9 @@ namespace CalamityMod.World //Marble biomes either have blocks or walls, occasionally both //This should be near maximum to prevent the structure from overextending - if (tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) + if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.zenithWorld) + marbleStuffInArea++; + else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.zenithWorld) //Generates in granite in gfb marbleStuffInArea++; //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone @@ -466,7 +542,7 @@ namespace CalamityMod.World break; } - } while (tries <= 20000); + } while (tries <= 30000); } #endregion @@ -475,14 +551,31 @@ namespace CalamityMod.World { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ShinePotion, ItemID.MiningPotion, ItemID.BuilderPotion); List contents = new List() - { + { new ChestItem(ModContent.ItemType(), 1), new ChestItem(ItemID.TruffleWorm, 3), new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), - }; + }; + + // Gfb loot change + if (Main.zenithWorld) + { + //"Cannot modify the return value of List.this[int] because its not a variable" so gotta do this instead, I could add a bunch of bools but I feel this is better for how much is changed + contents = new List() + { + new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemID.TruffleWorm, 3), + new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(50, 60 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), + new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 3 + 1)), + new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), + new ChestItem(ItemID.GasTrap, 1) + }; + } + for (int i = 0; i < contents.Count; i++) { @@ -500,7 +593,7 @@ namespace CalamityMod.World int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2f), (int)(Main.maxTilesX * 0.8f)); int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); - // Gfb and Dont Dig up + // Gfb and remix if (Main.remixWorld) { // Ensure that the shrine doesn't generate too close to the center of the world @@ -509,7 +602,7 @@ namespace CalamityMod.World placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2f), (int)(Main.maxTilesX * 0.8f)); } while (placementPositionX > (int)(Main.maxTilesX * 0.4f) && placementPositionX < (int)(Main.maxTilesX * 0.6f)); - placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.8f), (int)(Main.maxTilesY * 0.85f)); //Mushroom layer + placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.85f), (int)(Main.maxTilesY * 0.9f)); //Mushroom layer } Point placementPoint = new Point(placementPositionX, placementPositionY); @@ -543,7 +636,7 @@ namespace CalamityMod.World { tries++; } - else if (!canGenerateInLocation && Main.remixWorld) //GFB nor dont dig up will not give a shit about mushrooms or the rectangle + else if (!canGenerateInLocation && Main.remixWorld) //GFB and remix will not give a shit about mushrooms or the rectangle { tries++; } @@ -562,14 +655,17 @@ namespace CalamityMod.World public static void FillSurfaceShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.RecallPotion, ItemID.CalmingPotion, ItemID.SwiftnessPotion); + if (Main.zenithWorld) + potionType = ItemID.Sake; List contents = new List() { new ChestItem(ModContent.ItemType(), 1), new ChestItem(ItemID.PinkGel, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(50, 60 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), - new ChestItem(ItemID.LesserHealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(Main.zenithWorld ? ItemID.RestorationPotion : ItemID.LesserHealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(Main.zenithWorld ? ItemID.GasTrap : ItemID.Mushroom, Main.zenithWorld ? 1 : WorldGen.genRand.Next(5,9+1)), }; for (int i = 0; i < contents.Count; i++) @@ -598,6 +694,9 @@ namespace CalamityMod.World //use Main.worldSurface and not WorldGen.WorldSurface, i believe that is why it was genning on the surface so much int placementPositionY = (int)Main.worldSurface + numTilesBelowSurface; + + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.65f), (int)(Main.maxTilesY * 0.7f)); //above mushroom layer Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -632,49 +731,59 @@ namespace CalamityMod.World } else { - Point result; - Point shrineTunnelPlacementPoint = new Point(placementPoint.X + (int)(schematicSize.X * 0.5f), placementPoint.Y); - bool flag = WorldUtils.Find(shrineTunnelPlacementPoint, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result); - if (WorldUtils.Find(shrineTunnelPlacementPoint, Searches.Chain(new Searches.Up(shrineTunnelPlacementPoint.Y - result.Y), new Conditions.IsTile(TileID.Sand)), out Point _)) + if (!Main.remixWorld) // Make tunnel if its not remix or Gfb { - tries++; - } - else if (!flag) - { - tries++; - } - else - { - result.Y += numTilesBelowSurface; - - bool[] array = new bool[TileID.Sets.GeneralPlacementTiles.Length]; - for (int i = 0; i < array.Length; i++) - array[i] = TileID.Sets.GeneralPlacementTiles[i]; - - array[TileID.Containers] = false; - array[TileID.Containers2] = false; - - if (!structures.CanPlace(new Rectangle(shrineTunnelPlacementPoint.X, result.Y + 10, 1, shrineTunnelPlacementPoint.Y - result.Y - 9), array, 2)) + Point result; + Point shrineTunnelPlacementPoint = new Point(placementPoint.X + (int)(schematicSize.X * 0.5f), placementPoint.Y); + bool flag = WorldUtils.Find(shrineTunnelPlacementPoint, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result); + if (WorldUtils.Find(shrineTunnelPlacementPoint, Searches.Chain(new Searches.Up(shrineTunnelPlacementPoint.Y - result.Y), new Conditions.IsTile(TileID.Sand)), out Point _)) + { + tries++; + } + else if (!flag) { tries++; } else { - bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillSurfaceShrineChest)); - structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + result.Y += numTilesBelowSurface; - // Generate entrance tunnel - ShapeData data = new ShapeData(); - WorldUtils.Gen(new Point(shrineTunnelPlacementPoint.X, result.Y + 10), new Shapes.Rectangle(1, shrineTunnelPlacementPoint.Y - result.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Modifiers.SkipTiles(TileID.LivingWood, TileID.LeafBlock), new Actions.ClearTile().Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(TileID.Sand), new Actions.SetTile(TileID.HardenedSand).Output(data))); - WorldUtils.Gen(new Point(shrineTunnelPlacementPoint.X, result.Y + 10), new ModShapes.All(data), new Actions.SetFrames(frameNeighbors: true)); + bool[] array = new bool[TileID.Sets.GeneralPlacementTiles.Length]; + for (int i = 0; i < array.Length; i++) + array[i] = TileID.Sets.GeneralPlacementTiles[i]; - break; + array[TileID.Containers] = false; + array[TileID.Containers2] = false; + + if (!structures.CanPlace(new Rectangle(shrineTunnelPlacementPoint.X, result.Y + 10, 1, shrineTunnelPlacementPoint.Y - result.Y - 9), array, 2)) + { + tries++; + } + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillSurfaceShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Generate entrance tunnel + ShapeData data = new ShapeData(); + WorldUtils.Gen(new Point(shrineTunnelPlacementPoint.X, result.Y + 10), new Shapes.Rectangle(1, shrineTunnelPlacementPoint.Y - result.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Modifiers.SkipTiles(TileID.LivingWood, TileID.LeafBlock), new Actions.ClearTile().Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(TileID.Sand), new Actions.SetTile(TileID.HardenedSand).Output(data))); + WorldUtils.Gen(new Point(shrineTunnelPlacementPoint.X, result.Y + 10), new ModShapes.All(data), new Actions.SetFrames(frameNeighbors: true)); + + break; + } } + } else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillSurfaceShrineChest)); + structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + break; } + } - } while (tries <= 20000); + } while (tries <= 30000); } #endregion