diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index bb3f83cdf7..e63c75cdb3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -63,6 +63,7 @@ using Terraria.ID; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; using CalamityMod.Items.Armor.Wulfrum; +using CalamityMod.Tiles.Abyss.AbyssAmbient; namespace CalamityMod.CalPlayer { @@ -493,6 +494,7 @@ namespace CalamityMod.CalPlayer int astralOreID = ModContent.TileType(); int auricOreID = ModContent.TileType(); int scoriaOreID = ModContent.TileType(); + int abyssKelpID = ModContent.TileType(); int auricRejectionDamage = 300; float auricRejectionKB = Player.noKnockback ? 20f : 40f; @@ -503,6 +505,19 @@ namespace CalamityMod.CalPlayer if (!tile.HasTile || !tile.HasUnactuatedTile) continue; + if (tile.TileType == abyssKelpID) + { + if (Player.velocity.Length() == 0) + { return; } + + Dust dust; + dust = Main.dust[Dust.NewDust(Player.Center, 16, 16, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + + // Ores below here // Astral Ore inflicts Astral Infection briefly on contact if (tile.TileType == astralOreID) Player.AddBuff(ModContent.BuffType(), 2); diff --git a/Dusts/CinderBlossomDust.png b/Dusts/CinderBlossomDust.png index aeb183ae75..abfbb39119 100644 Binary files a/Dusts/CinderBlossomDust.png and b/Dusts/CinderBlossomDust.png differ diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 66d7d36798..1ceca3a512 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1544,8 +1544,8 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.JourneymanBait, NPC.downedBoss3); SetShopItem(ref shop, ref nextSlot, ItemID.MasterBait, NPC.downedPlantBoss); SetShopItem(ref shop, ref nextSlot, ItemID.AngelStatue, NPC.FindFirstNPC(NPCType()) != -1, Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemID.Burger, happy, Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemID.Hotdog, happy, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Burger, happy && NPC.downedBoss3, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Hotdog, happy && Main.hardMode, Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.CoffeeCup, happy, Item.buyPrice(0, 2)); } @@ -1606,14 +1606,14 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.JungleRose, price: Item.buyPrice(0, 2)); SetShopItem(ref shop, ref nextSlot, ItemID.NaturesGift, price: Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, ItemType()); - SetShopItem(ref shop, ref nextSlot, ItemID.Grapes, happy, Item.buyPrice(0, 2, 50)); + SetShopItem(ref shop, ref nextSlot, ItemID.Grapes, happy && NPC.downedBoss3, Item.buyPrice(0, 2, 50)); } if (type == NPCID.GoblinTinkerer) { SetShopItem(ref shop, ref nextSlot, ItemID.StinkPotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); - SetShopItem(ref shop, ref nextSlot, ItemID.Spaghetti, happy, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Spaghetti, happy && NPC.downedBoss3, Item.buyPrice(0, 5)); } if (type == NPCID.Mechanic) @@ -1687,7 +1687,7 @@ namespace CalamityMod.NPCs if (type == NPCID.PartyGirl) { SetShopItem(ref shop, ref nextSlot, ItemID.GenderChangePotion, CalamityConfig.Instance.PotionSelling, Item.buyPrice(0, 1, 0, 0)); - SetShopItem(ref shop, ref nextSlot, ItemID.Pizza, happy, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Pizza, happy && NPC.downedBoss3, Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.CreamSoda, happy, Item.buyPrice(0, 2, 50)); } @@ -1697,7 +1697,6 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemID.AppleJuice, NPC.FindFirstNPC(NPCType()) != -1); SetShopItem(ref shop, ref nextSlot, ItemID.FruitJuice, NPC.FindFirstNPC(NPCType()) != -1); - SetShopItem(ref shop, ref nextSlot, ItemID.GrapeJuice, NPC.FindFirstNPC(NPCType()) != -1); SetShopItem(ref shop, ref nextSlot, ItemID.Lemonade, NPC.FindFirstNPC(NPCType()) != -1); SetShopItem(ref shop, ref nextSlot, ItemID.PrismaticPunch, NPC.FindFirstNPC(NPCType()) != -1); SetShopItem(ref shop, ref nextSlot, ItemID.SmoothieofDarkness, NPC.FindFirstNPC(NPCType()) != -1); @@ -1718,7 +1717,7 @@ namespace CalamityMod.NPCs if (type == NPCID.BestiaryGirl) { - SetShopItem(ref shop, ref nextSlot, ItemID.Steak, happy, Item.buyPrice(0, 5)); + SetShopItem(ref shop, ref nextSlot, ItemID.Steak, happy && Main.hardMode, Item.buyPrice(0, 5)); } } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index fea0cebcd3..773db47e9b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -97,6 +97,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -108,6 +109,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) @@ -122,6 +124,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBoss = NPC.whoAmI; + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); // Projectile and dust spawn location variables @@ -229,7 +233,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = NPC.lifeMax / 20; + int healAmt = NPC.lifeMax / 10; if (healAmt > NPC.lifeMax - NPC.life) healAmt = NPC.lifeMax - NPC.life; @@ -332,6 +336,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians } // Charge variables + float moveToOtherSideInPhase1GateValue = 900f; + float timeBeforeMoveToOtherSideInPhase1Reset = moveToOtherSideInPhase1GateValue * 2f; + float totalGoLowDuration = 240f; + float goLowDuration = totalGoLowDuration * 0.5f; + float goLowDistance = 480f; float chargeVelocityMult = 0.25f; float maxChargeVelocity = (bossRush || biomeEnraged) ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; if (Main.getGoodWorld) @@ -351,6 +360,27 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] == 0f) { + // Dictates when the commander and defender will swap to the other side in phase 1 + if (healerAlive) + NPC.localAI[3] += 1f; + else + NPC.localAI[3] = 0f; + + // Go low just before moving to the other side to avoid bullshit hits + bool goLow = (NPC.localAI[3] > moveToOtherSideInPhase1GateValue - goLowDuration && NPC.localAI[3] <= moveToOtherSideInPhase1GateValue + goLowDuration) || + NPC.localAI[3] > timeBeforeMoveToOtherSideInPhase1Reset - goLowDuration || NPC.localAI[3] < 0f; + + // Swap from side to side over time + if (NPC.localAI[3] > moveToOtherSideInPhase1GateValue) + { + if (NPC.localAI[3] > timeBeforeMoveToOtherSideInPhase1Reset) + NPC.localAI[3] = -goLowDuration; + + calamityGlobalNPC.newAI[0] = -1f; + } + else + calamityGlobalNPC.newAI[0] = 1f; + // Face the target if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -371,8 +401,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians inertia *= 0.5f; velocity *= 1.5f; } + if (goLow) + { + inertia *= 0.75f; + velocity *= 1.25f; + } + + Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * -NPC.direction * calamityGlobalNPC.newAI[0]; + if (goLow) + destination.Y += goLowDistance; - Vector2 destination = player.Center + Vector2.UnitX * distanceToStayAwayFromTarget * -NPC.direction; Vector2 targetVector = destination - NPC.Center; Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; float phaseGateValue = (bossRush || biomeEnraged) ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 065b97fbf9..922e39f580 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -194,7 +194,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians healTimer = 0; if (Main.netMode != NetmodeID.MultiplayerClient) { - int healAmt = NPC.lifeMax / 20; + int healAmt = NPC.lifeMax / 10; if (healAmt > NPC.lifeMax - NPC.life) healAmt = NPC.lifeMax - NPC.life; diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index d81d0c31ee..233ac456fd 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -413,9 +413,12 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 50, 0); nextSlot++; - shop.item[nextSlot].SetDefaults(ItemID.Fries); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); - nextSlot++; + if (NPC.downedBoss1) + { + shop.item[nextSlot].SetDefaults(ItemID.Fries); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + } } } } diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs index 91512d672d..9b021a9f2e 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -34,6 +34,17 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient base.SetStaticDefaults(); } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + 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) { diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs index f6939534ba..fad6775091 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -45,6 +45,17 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient b = 30f / 255f; } } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs index 9dee8245d8..d74e225dce 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -45,6 +45,17 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient b = 30f / 255f; } } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(100) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(117, 55, 15), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 66c4c42473..69201690fb 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -155,11 +155,10 @@ namespace CalamityMod.Tiles.Abyss frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false); return false; } } -} \ No newline at end of file +} diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index bd15f7826a..3f19ec8a55 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -58,6 +58,17 @@ namespace CalamityMod.Tiles.Abyss } } } + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer && Main.rand.NextBool(200) && j > Main.worldSurface) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 274, 279, 304, 0.23255825f, 10f, 0, new Color(22, 255, 0), 1.5116279f)]; + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 2.5813954f; + } + } // Ozzatron 01JUL2022: heavily refactored this code to not suck. also, sulphurous vines won't grow in honey anymore. private const int MaxVineHeight = 10; diff --git a/Tiles/Astral/AstralClay.cs b/Tiles/Astral/AstralClay.cs index 92e8eb708f..f1213d9f95 100644 --- a/Tiles/Astral/AstralClay.cs +++ b/Tiles/Astral/AstralClay.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/Astral/AstralDirt.cs b/Tiles/Astral/AstralDirt.cs index a7bc84a6f7..1e957ab8ab 100644 --- a/Tiles/Astral/AstralDirt.cs +++ b/Tiles/Astral/AstralDirt.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false); return false; } @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.Astral Tile down = Main.tile[i, j + 1]; Tile left = Main.tile[i - 1, j]; Tile right = Main.tile[i + 1, j]; - if (WorldGen.genRand.Next(3) == 0 && (up.TileType == ModContent.TileType() || down.TileType == ModContent.TileType() || left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) + if (WorldGen.genRand.NextBool(3) && (up.TileType == ModContent.TileType() || down.TileType == ModContent.TileType() || left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) { WorldGen.SpreadGrass(i, j, Type, ModContent.TileType(), false); } diff --git a/Tiles/Astral/AstralStone.cs b/Tiles/Astral/AstralStone.cs index a0c2e0c75f..6222d12fb4 100644 --- a/Tiles/Astral/AstralStone.cs +++ b/Tiles/Astral/AstralStone.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/Astral/NovaeSlag.cs b/Tiles/Astral/NovaeSlag.cs index f2cad769e7..dbcf9e730c 100644 --- a/Tiles/Astral/NovaeSlag.cs +++ b/Tiles/Astral/NovaeSlag.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.Astral public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/AstralDesert/AstralSand.cs b/Tiles/AstralDesert/AstralSand.cs index db773b22b1..7589a5532f 100644 --- a/Tiles/AstralDesert/AstralSand.cs +++ b/Tiles/AstralDesert/AstralSand.cs @@ -54,13 +54,13 @@ namespace CalamityMod.Tiles.AstralDesert } } // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } public override bool HasWalkDust() { - return Main.rand.Next(3) == 0; + return Main.rand.NextBool(3); } public override void WalkDust(ref int dustType, ref bool makeDust, ref Color color) diff --git a/Tiles/AstralDesert/AstralSandstone.cs b/Tiles/AstralDesert/AstralSandstone.cs index 67a1a9ba3a..7872e56bae 100644 --- a/Tiles/AstralDesert/AstralSandstone.cs +++ b/Tiles/AstralDesert/AstralSandstone.cs @@ -1,4 +1,4 @@ - + using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.AstralDesert public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/AstralDesert/HardenedAstralSand.cs b/Tiles/AstralDesert/HardenedAstralSand.cs index 7b85530714..21926ac0bc 100644 --- a/Tiles/AstralDesert/HardenedAstralSand.cs +++ b/Tiles/AstralDesert/HardenedAstralSand.cs @@ -1,4 +1,4 @@ - + using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.AstralDesert public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } diff --git a/Tiles/AstralSnow/AstralSnow.cs b/Tiles/AstralSnow/AstralSnow.cs index 4708b7110b..cb16c83920 100644 --- a/Tiles/AstralSnow/AstralSnow.cs +++ b/Tiles/AstralSnow/AstralSnow.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.AstralSnow public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { // CustomTileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false, false, resetFrame); - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index aa6904d286..c9deb8c69f 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -158,7 +158,7 @@ namespace CalamityMod.Tiles if (WorldGen.IsTileALeafyTreeTop(treeX, treeY) && !Collision.SolidTiles(treeX - 2, treeX + 2, treeY - 2, treeY + 2)) { - int randomAmt = WorldGen.genRand.Next(2, 4); + int randomAmt = WorldGen.genRand.Next(1, 3); for (int z = 0; z < randomAmt; z++) { int treeDropItemType = 0; diff --git a/Tiles/DraedonStructures/LaboratoryPipePlating.cs b/Tiles/DraedonStructures/LaboratoryPipePlating.cs index 4d4d7b63bf..c0d4c1052c 100644 --- a/Tiles/DraedonStructures/LaboratoryPipePlating.cs +++ b/Tiles/DraedonStructures/LaboratoryPipePlating.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), false, false, false); return false; } } diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index 605b7ef17e..e7cca19b3c 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.Ores } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud, false, false, false); return false; } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs index 45f3896d46..b8436a156b 100644 --- a/Tiles/Ores/AerialiteOreDisenchanted.cs +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Tiles.Ores } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud, false, false, false); return false; } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 2e1bf72c59..85642511f6 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -40,6 +41,22 @@ namespace CalamityMod.Tiles.Ores TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.DoesntGetReplacedWithTileReplacement[Type] = true; } + public override void NearbyEffects(int i, int j, bool closer) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + if (closer && Main.rand.NextBool(60) && !up.HasTile && !up2.HasTile && j < Main.worldSurface) + { + //Cyan Cinders below + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, ModContent.DustType(), -0.4651165f, 0f, 17, new Color(0, 255, 244), 1.5f)]; + + //Orange Cinders below + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, ModContent.DustType(), -0.4651165f, 0f, 17, new Color(255, 255, 255), 1.5f)]; + + } + } public override bool CanKillTile(int i, int j, ref bool blockDamaged) { @@ -56,14 +73,6 @@ namespace CalamityMod.Tiles.Ores num = fail ? 1 : 3; } - public override void RandomUpdate(int i, int j) - { - if (Main.rand.Next(7) <= 2) - { - Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, 156, Main.rand.NextFloat(-0.05f, 0.05f), Main.rand.NextFloat(-0.05f, -0.001f)); - } - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { float brightness = 0.7f; diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index 456e23b51e..6e2541c3f4 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.Ores public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.SnowBlock); + TileFraming.CustomMergeFrame(i, j, Type, TileID.SnowBlock, false, false, false); return false; } diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs index 3d9bf924b2..02b2dee863 100644 --- a/Tiles/Ores/HallowedOre.cs +++ b/Tiles/Ores/HallowedOre.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.Ores } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, TileID.Pearlstone); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Pearlstone, false, false, false); return false; } diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 76de8bbc09..3ffbdf967a 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -36,7 +36,10 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFraming.BrimstoneFraming(i, j, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Sandstone, true, false, false); + return false; + + //return TileFraming.BrimstoneFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 1e3075ffcf..4767c2f632 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.SunkenSea CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - CalamityUtils.SetMerge(Type, ModContent.TileType()); + //CalamityUtils.SetMerge(Type, ModContent.TileType()); TileID.Sets.ChecksForMerge[Type] = true; DustType = 96; @@ -33,7 +33,10 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFraming.BrimstoneFraming(i, j, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), true, true, false); + return false; + + //return TileFraming.BrimstoneFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index f3cd0f7d34..5d1ce43dd2 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -45,7 +45,10 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFraming.BrimstoneFraming(i, j, resetFrame); + TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType(), true, true, false); + return false; + + //return TileFraming.BrimstoneFraming(i, j, resetFrame); } } } diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 13219f6d0d..0fd3d9b924 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -1132,7 +1132,7 @@ namespace CalamityMod r = Recipe.Create(ItemID.Bacon); r.AddIngredient(ModContent.ItemType()); - r.AddTile(TileID.CookingPots); + r.AddTile(TileID.Hellforge); r.Register(); r = Recipe.Create(ItemID.BowlofSoup); @@ -1143,7 +1143,7 @@ namespace CalamityMod r = Recipe.Create(ItemID.ApplePie); r.AddIngredient(ItemID.Apple, 3); - r.AddTile(TileID.Furnaces); + r.AddTile(TileID.Hellforge); r.Register(); r = Recipe.Create(ItemID.BananaSplit); @@ -1156,7 +1156,7 @@ namespace CalamityMod r = Recipe.Create(ItemID.BBQRibs); r.AddIngredient(ItemID.FleshBlock, 6); r.AddIngredient(ItemID.Bone, 6); - r.AddTile(TileID.Furnaces); + r.AddTile(TileID.Hellforge); r.Register(); r = Recipe.Create(ItemID.MilkCarton); diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index 4b90dc68f3..a7499120c9 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -1,5 +1,4 @@ using CalamityMod.Tiles.Abyss; -using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; @@ -63,7 +62,6 @@ namespace CalamityMod PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; - PlantCheckAgainst[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; VineToGrass = new Dictionary { @@ -566,7 +564,9 @@ namespace CalamityMod return true; } - internal static bool BrimstoneFraming(int x, int y, bool resetFrame) + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Added parameters to force a merge in a direction for use in the merge frame function + internal static bool BrimstoneFraming(int x, int y, bool resetFrame, bool forceSameDown = false, bool forceSameUp = false, bool forceSameRight = false, bool forceSameLeft = false) { if (x < 0 || x >= Main.maxTilesX) return false; @@ -581,6 +581,12 @@ namespace CalamityMod GetAdjacentTiles(x, y, out bool up, out bool down, out bool left, out bool right, out bool upLeft, out bool upRight, out bool downLeft, out bool downRight); + // Implement forced connections + up = forceSameUp || up; + down = forceSameDown || down; + left = forceSameLeft || left; + right = forceSameRight || right; + // Reset the tile's random frame style if the frame is being reset. int randomFrame; if (resetFrame) @@ -1166,9 +1172,14 @@ namespace CalamityMod #endregion #region Generic Custom Framing Code + + // New Variables (rename as fitting): + // myTypeBrimFrame - Whether the tile that this function is framing should use brimstone framing + // overrideBrimStates - Used in a situation where a brimstone state and a merge state could each be used, setting this to true will use the merge state, and setting this to false will use the brimstone state + internal static void CustomMergeFrameExplicit(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, - bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) + bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true, bool myTypeBrimFrame = false, bool overrideBrimStates = false) { if (x < 0 || x >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY) { @@ -1176,6 +1187,20 @@ namespace CalamityMod return; } + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Used when set to prioritize brimstone states over blend states + // This will try to preserve the brimstone tile's own tiling, though it might produce some strange blending with the tile it merges with + if (myTypeBrimFrame && !overrideBrimStates) + { + // BrimstoneFraming returns false if the tile uses a custom tile state, and true if it should use default tile framing + bool usedBrimstoneFrame = BrimstoneFraming(x, y, resetFrame, forceSameDown, forceSameUp, forceSameRight, forceSameLeft); + if (!usedBrimstoneFrame) + { + mergedUp = mergedLeft = mergedRight = mergedDown = false; + return; + } + } + // Disable vanilla trying to merge these tiles automtaically. Main.tileMerge[myType][mergeType] = false; @@ -1712,13 +1737,26 @@ namespace CalamityMod SetFrameAt(x, y, 216, 18 * randomFrame); return; #endregion + + // BRIMSTONE COMPATIBILITY IMPLEMENTATION + // Used when set to prioritize blend states over brimstone states. + // This will create smoother blending with other tiles, though it will most likely result in unpleasant tiling between blend and non-blend states. Test to see if it looks good + // The tile frame checks are to see whether the tile that frame that has been picked out is a blend state (in which case a brimstone state isn't used) or a 'default' state (in which case a brimstone state might be used instead) + if (myTypeBrimFrame && overrideBrimStates && (Main.tile[x, y].TileFrameX < 234 && Main.tile[x, y].TileFrameY < 90)) + { + BrimstoneFraming(x, y, resetFrame, forceSameDown, forceSameUp, forceSameRight, forceSameLeft); + } } internal static void CustomMergeFrame(int x, int y, int myType, int mergeType, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true) => CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame); - internal static void CustomMergeFrame(int x, int y, int myType, int mergeType) + // New Variables (rename as fitting): + // myTypeBrimFrame - Whether the tile that this function is framing uses brimstone framing + // mergeTypeBrimFrame - Whether the tile that this tile merges with uses brimstone framing + // overrideBrimStates - Used in a situation where a brimstone state and a merge state could each be used, setting this to true will use the merge state, and setting this to false will use the brimstone state + internal static void CustomMergeFrame(int x, int y, int myType, int mergeType, bool myTypeBrimFrame = false, bool mergeTypeBrimFrame = false, bool overrideBrimStates = false) { if (x < 0 || x >= Main.maxTilesX) return; @@ -1741,8 +1779,8 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, north.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x, y - 1, north.TileType, myType, out _, out _, out _, out forceSameUp, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x, y - 1, north.TileType, myType, out _, out _, out _, out forceSameUp, false, false, false, false, false, mergeTypeBrimFrame, false); } if (west != null && west.HasTile && tileMergeTypes[myType][west.TileType]) { @@ -1750,8 +1788,8 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, west.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x - 1, y, west.TileType, myType, out _, out _, out forceSameLeft, out _, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x - 1, y, west.TileType, myType, out _, out _, out forceSameLeft, out _, false, false, false, false, false, mergeTypeBrimFrame, false); } if (east != null && east.HasTile && tileMergeTypes[myType][east.TileType]) { @@ -1759,8 +1797,8 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, east.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x + 1, y, east.TileType, myType, out _, out forceSameRight , out _, out _, false, false, false, false, false, mergeTypeBrimFrame, false); } if (south != null && south.HasTile && tileMergeTypes[myType][south.TileType]) { @@ -1768,12 +1806,12 @@ namespace CalamityMod CalamityUtils.SetMerge(myType, south.TileType, false); TileID.Sets.ChecksForMerge[myType] = true; - // Properly frame the tile given this constraint. - CustomMergeFrameExplicit(x, y + 1, south.TileType, myType, out forceSameDown, out _, out _, out _, false, false, false, false, false); + // Properly frame the adjacent tile given this constraint. + CustomMergeFrameExplicit(x, y + 1, south.TileType, myType, out forceSameDown, out _, out _, out _, false, false, false, false, false, mergeTypeBrimFrame, false); } // With all constraints determined, properly frame the tile a final time. - CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, true); + CustomMergeFrameExplicit(x, y, myType, mergeType, out _, out _, out _, out _, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, true, myTypeBrimFrame, overrideBrimStates); } #endregion }