From d3bf29112b6770151565e3c968d715b6ca064ef9 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Tue, 1 Aug 2023 18:54:09 -0600 Subject: [PATCH 01/12] Gfb shrine loot changes: All buff potions are replaced with 1-3 Red Potions All healing potions are replaced with something funny Mushroom Shrine_ Odd Mushrooms; nerfed Mushroom shrine's other loot due to its ease of locating in Gfb Crimson shrine: 2-3 Bloody Maries Corruption shrine has a rev boss item drop (Laudanum, Stress pills or HoD) Desert has Spelunker amulet and a wedge golf club Granite and Marble shrines' generation is swapped Ice Biome has a fuckton of Delicious meat instead of other foods and eggnog instead of healing potions Surface has potions replaced by Sake and healing potions replaced with restoration potions, no tunnel will generate in remix or gfb --- World/UndergroundShrines.cs | 182 +++++++++++++++++++++++++++--------- 1 file changed, 136 insertions(+), 46 deletions(-) diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index b4e9bdca2d..375b17aac3 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,21 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; + if (Main.getGoodWorld) + { + 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)), + }; + } + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -136,6 +153,22 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; + //Gfb loot change + if (Main.getGoodWorld) + { + //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)), + }; + } + for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); @@ -211,6 +244,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.getGoodWorld) + { + int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge); + 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(golfClub, 1), //Implying that the golfer messed with the loot but forgot this + new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), + }; + } for (int i = 0; i < contents.Count; i++) { @@ -267,6 +315,9 @@ namespace CalamityMod.World public static void FillGraniteShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + if (Main.getGoodWorld) + potionType = ItemID.RedPotion; + List contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -274,7 +325,7 @@ 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.getGoodWorld ? 1 : 10, (Main.getGoodWorld ? 2 : 12) + 1)), }; for (int i = 0; i < contents.Count; i++) @@ -308,8 +359,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.getGoodWorld) + graniteWallsInArea++; + else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.getGoodWorld) //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 +377,7 @@ namespace CalamityMod.World break; } - } while (tries <= 20000); + } while (tries <= 30000); } #endregion @@ -332,6 +385,8 @@ namespace CalamityMod.World public static void FillIceShrineChest(Chest chest) { int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); + if (Main.getGoodWorld) + foodType = ModContent.ItemType(); List contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -339,8 +394,8 @@ namespace CalamityMod.World 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.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(foodType, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(Main.getGoodWorld ? ItemID.Eggnog :ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(foodType, WorldGen.genRand.Next(Main.getGoodWorld ? 200 : 10, (Main.getGoodWorld ? 349 : 12) + 1)), }; for (int i = 0; i < contents.Count; i++) @@ -400,6 +455,8 @@ namespace CalamityMod.World public static void FillMarbleShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); + if (Main.getGoodWorld) + potionType = ItemID.RedPotion; List contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -407,7 +464,7 @@ 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.getGoodWorld ? 1 : 10, (Main.getGoodWorld ? 2 : 12) + 1)) }; for (int i = 0; i < contents.Count; i++) @@ -443,7 +500,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.getGoodWorld) + marbleStuffInArea++; + else if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && Main.getGoodWorld) //Generates like 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 +525,7 @@ namespace CalamityMod.World break; } - } while (tries <= 20000); + } while (tries <= 30000); } #endregion @@ -475,14 +534,30 @@ 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.getGoodWorld) + { + //"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)), + }; + } + for (int i = 0; i < contents.Count; i++) { @@ -500,8 +575,8 @@ 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 - if (Main.getGoodWorld) + // Gfb and remix + if (Main.remixWorld) { // Ensure that the shrine doesn't generate too close to the center of the world do @@ -543,7 +618,7 @@ namespace CalamityMod.World { tries++; } - else if (!canGenerateInLocation && Main.getGoodWorld) //GFB 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,13 +637,15 @@ namespace CalamityMod.World public static void FillSurfaceShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.RecallPotion, ItemID.CalmingPotion, ItemID.SwiftnessPotion); + if (Main.getGoodWorld) + 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.getGoodWorld ? ItemID.LesserRestorationPotion : ItemID.LesserHealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; @@ -598,6 +675,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.5f), (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 +712,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 { - 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 From d03b2940d74d09a056ae020b109e9dd877560bd0 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Tue, 1 Aug 2023 19:29:51 -0600 Subject: [PATCH 02/12] Fixed Mushroom generating too high Hopefully fixed Marble shrine failing to spawn --- World/UndergroundShrines.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 375b17aac3..46cfb37724 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -342,7 +342,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)); @@ -481,7 +481,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)); @@ -502,7 +502,7 @@ namespace CalamityMod.World //This should be near maximum to prevent the structure from overextending if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.getGoodWorld) marbleStuffInArea++; - else if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && Main.getGoodWorld) //Generates like granite in gfb + else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.getGoodWorld) //Generates in granite in remix marbleStuffInArea++; //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone @@ -584,7 +584,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); From 11bbd040223978bef46fa9cde1c36deea2cd6408 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Wed, 2 Aug 2023 16:00:45 -0600 Subject: [PATCH 03/12] zenithWorld, not for the worthy (although swapping buff potions for Red potions in for the worthy is tempting) --- World/UndergroundShrines.cs | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 46cfb37724..5a114cc858 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -64,7 +64,7 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; - if (Main.getGoodWorld) + if (Main.zenithWorld) { int evil = Utils.SelectRandom(WorldGen.genRand, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); contents = new List() @@ -154,7 +154,7 @@ namespace CalamityMod.World }; //Gfb loot change - if (Main.getGoodWorld) + 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() @@ -244,7 +244,7 @@ namespace CalamityMod.World new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), }; - if (Main.getGoodWorld) + if (Main.zenithWorld) { int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge); contents = new List() @@ -315,7 +315,7 @@ namespace CalamityMod.World public static void FillGraniteShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); - if (Main.getGoodWorld) + if (Main.zenithWorld) potionType = ItemID.RedPotion; List contents = new List() @@ -325,7 +325,7 @@ 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(Main.getGoodWorld ? 1 : 10, (Main.getGoodWorld ? 2 : 12) + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(Main.remixWorld ? 1 : 10, (Main.remixWorld ? 2 : 12) + 1)), }; for (int i = 0; i < contents.Count; i++) @@ -359,9 +359,9 @@ 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 && !Main.getGoodWorld) + if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.remixWorld) graniteWallsInArea++; - else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.getGoodWorld) //Get fixed boi makes it generate in marble biomes + else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.remixWorld) //Get fixed boi makes it generate in marble biomes graniteWallsInArea++; } } @@ -385,7 +385,7 @@ namespace CalamityMod.World public static void FillIceShrineChest(Chest chest) { int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); - if (Main.getGoodWorld) + if (Main.zenithWorld) foodType = ModContent.ItemType(); List contents = new List() { @@ -394,8 +394,8 @@ namespace CalamityMod.World 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(Main.getGoodWorld ? ItemID.Eggnog :ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(foodType, WorldGen.genRand.Next(Main.getGoodWorld ? 200 : 10, (Main.getGoodWorld ? 349 : 12) + 1)), + new ChestItem(Main.zenithWorld ? ItemID.Eggnog :ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(foodType, WorldGen.genRand.Next(Main.remixWorld ? 200 : 10, (Main.zenithWorld ? 349 : 12) + 1)), }; for (int i = 0; i < contents.Count; i++) @@ -455,7 +455,7 @@ namespace CalamityMod.World public static void FillMarbleShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion); - if (Main.getGoodWorld) + if (Main.zenithWorld) potionType = ItemID.RedPotion; List contents = new List() { @@ -464,7 +464,7 @@ 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(Main.getGoodWorld ? 1 : 10, (Main.getGoodWorld ? 2 : 12) + 1)) + new ChestItem(potionType, WorldGen.genRand.Next(Main.zenithWorld ? 1 : 10, (Main.remixWorld ? 2 : 12) + 1)) }; for (int i = 0; i < contents.Count; i++) @@ -500,9 +500,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) && !Main.getGoodWorld) + if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.zenithWorld) marbleStuffInArea++; - else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.getGoodWorld) //Generates in granite in remix + 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 @@ -544,7 +544,7 @@ namespace CalamityMod.World }; // Gfb loot change - if (Main.getGoodWorld) + 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() @@ -614,7 +614,7 @@ namespace CalamityMod.World } } - if ((!canGenerateInLocation || realMushroomsInArea < requiredShrooms || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) && !Main.getGoodWorld) + if ((!canGenerateInLocation || realMushroomsInArea < requiredShrooms || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) && !Main.remixWorld) { tries++; } @@ -637,7 +637,7 @@ namespace CalamityMod.World public static void FillSurfaceShrineChest(Chest chest) { int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.RecallPotion, ItemID.CalmingPotion, ItemID.SwiftnessPotion); - if (Main.getGoodWorld) + if (Main.zenithWorld) potionType = ItemID.Sake; List contents = new List() { @@ -645,7 +645,7 @@ namespace CalamityMod.World 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(Main.getGoodWorld ? ItemID.LesserRestorationPotion : 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)), }; @@ -712,7 +712,7 @@ namespace CalamityMod.World } else { - if (!Main.remixWorld) // Make tunnel if its not remix + if (!Main.remixWorld) // Make tunnel if its not remix or Gfb { Point result; Point shrineTunnelPlacementPoint = new Point(placementPoint.X + (int)(schematicSize.X * 0.5f), placementPoint.Y); From 433f7d3a080243cc0bd739e511dffe99162a63bc Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sat, 5 Aug 2023 18:51:34 -0600 Subject: [PATCH 04/12] Gfb: Chests have a chance to be trapped with gas; Evil, Surface and Mushroom which are guaranteed to be trapped. Some chests have extra stuff that can generate instead of a trap --- World/UndergroundShrines.cs | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 5a114cc858..0393134fab 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -76,6 +76,7 @@ namespace CalamityMod.World 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), }; } @@ -166,6 +167,7 @@ namespace CalamityMod.World 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), }; } @@ -246,7 +248,7 @@ namespace CalamityMod.World }; if (Main.zenithWorld) { - int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge); + int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge, ItemID.GasTrap); contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -255,8 +257,8 @@ namespace CalamityMod.World 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(golfClub, 1), //Implying that the golfer messed with the loot but forgot this 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 }; } @@ -325,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(Main.remixWorld ? 1 : 10, (Main.remixWorld ? 2 : 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++) @@ -385,8 +388,6 @@ namespace CalamityMod.World public static void FillIceShrineChest(Chest chest) { int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); - if (Main.zenithWorld) - foodType = ModContent.ItemType(); List contents = new List() { new ChestItem(ModContent.ItemType(), 1), @@ -394,10 +395,25 @@ namespace CalamityMod.World 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(Main.zenithWorld ? ItemID.Eggnog :ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(foodType, WorldGen.genRand.Next(Main.remixWorld ? 200 : 10, (Main.zenithWorld ? 349 : 12) + 1)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(10, 12 + 1)), + 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); @@ -464,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(Main.zenithWorld ? 1 : 10, (Main.remixWorld ? 2 : 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++) @@ -555,6 +572,7 @@ namespace CalamityMod.World 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) }; } @@ -647,6 +665,7 @@ namespace CalamityMod.World new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 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++) From 1dfccc605b8117067ecee55317eb69e4e35ba71c Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sat, 5 Aug 2023 19:26:11 -0600 Subject: [PATCH 05/12] Surface shrine now generates lower in Gfb --- World/UndergroundShrines.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 0393134fab..88e7c8e8c6 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -696,7 +696,7 @@ namespace CalamityMod.World int placementPositionY = (int)Main.worldSurface + numTilesBelowSurface; if (Main.remixWorld) - placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.5f), (int)(Main.maxTilesY * 0.7f)); //above mushroom layer + 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)); From dde67c5c88bf688df7b609780dd92e0c53cfd807 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sat, 5 Aug 2023 20:55:07 -0500 Subject: [PATCH 06/12] Cirrus Photon Ripper turn slower? --- Projectiles/Boss/CirrusPhotonRipperProjectile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs b/Projectiles/Boss/CirrusPhotonRipperProjectile.cs index c36d645c03..d1ebade1d9 100644 --- a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs +++ b/Projectiles/Boss/CirrusPhotonRipperProjectile.cs @@ -168,11 +168,11 @@ namespace CalamityMod.Projectiles.Boss { Vector2 idealAimDirection = (Main.player[Cirrus.target].Center - cirrusRotatedPosition).SafeNormalize(Vector2.UnitX * Cirrus.direction); - float angularAimVelocity = 0.15f; + float angularAimVelocity = 0.03f; float directionAngularDisparity = Projectile.velocity.AngleBetween(idealAimDirection) / MathHelper.Pi; // Increase the turn speed if close to the ideal direction, since successive linear interpolations are asymptotic. - angularAimVelocity += MathHelper.Lerp(0f, 0.25f, Utils.GetLerpValue(0.28f, 0.08f, directionAngularDisparity, true)); + angularAimVelocity += MathHelper.Lerp(0f, 0.05f, Utils.GetLerpValue(0.28f, 0.08f, directionAngularDisparity, true)); if (directionAngularDisparity > 0.02f) Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealAimDirection, angularAimVelocity); From ca607babdd97f6ca9056e1b58229c82772efe732 Mon Sep 17 00:00:00 2001 From: GinYuH <> Date: Sun, 6 Aug 2023 02:51:56 -0700 Subject: [PATCH 07/12] another pryogen --- Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 77dff1d251..a7d0e850c6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -76,7 +76,7 @@ CryoKey: { Not consumable ''' SpawnNormal: Summons Cryogen when used in the tundra - SpawnGFB: Summons Pryogen...? when used in the tundra + SpawnGFB: Summons Cryogen...? when used in the tundra } DeathWhistle: { From 830d3e61a59c731b1c99ea3a273b6dae076bba62 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 6 Aug 2023 09:43:39 -0500 Subject: [PATCH 08/12] Cirrus drunk shader crash fix. --- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- Skies/DrunkCrabScreenShaderData.cs | 25 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 2939744935..73c57d3bb0 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1279,7 +1279,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (giveUpCounter > 1) { - // Spin around the target and fire a bunch of beams (Sans) while also firing other projectiles + // Spin around the target and fire a bunch of beams (Sans) while also firing other projectiles. int blasterTimer = GiveUpCounterMax - giveUpCounter; Vector2 circleOffset = player.Center + (Vector2.UnitY * 640f).RotatedBy(MathHelper.ToRadians(blasterTimer * 3f)); NPC.Center = circleOffset; diff --git a/Skies/DrunkCrabScreenShaderData.cs b/Skies/DrunkCrabScreenShaderData.cs index ac82d87a10..6eee00117e 100644 --- a/Skies/DrunkCrabScreenShaderData.cs +++ b/Skies/DrunkCrabScreenShaderData.cs @@ -25,38 +25,45 @@ namespace CalamityMod.Skies int CrabType = ModContent.NPCType(); int CirrusType = ModContent.NPCType(); bool shouldCheckForCirrus = false; + bool shouldForceDeactivateCirrusShader = false; if (CalamityGlobalNPC.SCal != -1) { if (Main.npc[CalamityGlobalNPC.SCal].active) { if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + { shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; + shouldForceDeactivateCirrusShader = Main.npc[CalamityGlobalNPC.SCal].ModNPC().giveUpCounter <= 1; + } } } if (shouldCheckForCirrus) { - if (CirrusIndex >= 0 && Main.npc[CirrusIndex].active && Main.npc[CirrusIndex].type == CirrusType) - { + if (CirrusIndex >= 0 && Main.npc[CirrusIndex].active && Main.npc[CirrusIndex].type == CirrusType && !shouldForceDeactivateCirrusShader) return; - } + CirrusIndex = -1; - for (int i = 0; i < Main.npc.Length; i++) + + if (!shouldForceDeactivateCirrusShader) { - if (Main.npc[i].active && Main.npc[i].type == CirrusType) + for (int i = 0; i < Main.npc.Length; i++) { - CirrusIndex = i; - break; + if (Main.npc[i].active && Main.npc[i].type == CirrusType) + { + CirrusIndex = i; + break; + } } } } else { if (CrabIndex >= 0 && Main.npc[CrabIndex].active && Main.npc[CrabIndex].type == CrabType) - { return; - } + CrabIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) { if (Main.npc[i].active && Main.npc[i].type == CrabType) From 79fd40f1f38e74487db8e5c4315d73820eef3205 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 6 Aug 2023 15:26:53 -0500 Subject: [PATCH 09/12] More optimizations... --- CalPlayer/CalamityPlayerDrawEffects.cs | 7 ++-- CalPlayer/DrawLayers/AuricSetTrailLayer.cs | 5 ++- CalPlayer/DrawLayers/CobaltSetTrailLayer.cs | 3 +- CalPlayer/DrawLayers/ForbiddenSignLayer.cs | 6 ++- CalPlayer/DrawLayers/GemTechGemLayer.cs | 18 ++++++--- Cooldowns/SandsmokeBomb.cs | 6 ++- DataStructures/GemTechArmorState.cs | 7 ++-- ILEditing/ILHelperMethods.cs | 32 +++++++++++----- Items/Accessories/AmidiasPendant.cs | 8 ++-- Items/Accessories/MarniteRepulsionShield.cs | 6 ++- Items/Accessories/RoverDrive.cs | 2 +- Items/Armor/LunicCorps/LunicCorpsHelmet.cs | 2 +- Items/Materials/AshesofAnnihilation.cs | 9 +++-- Items/Materials/ExoPrism.cs | 6 ++- Items/Materials/MiracleMatter.cs | 3 +- Items/Materials/PlasmaDriveCore.cs | 3 +- NPCs/CalamityGlobalNPC.cs | 42 +++++++++++---------- Particles/ConstellationRing.cs | 1 - Projectiles/CalamityGlobalProjectile.cs | 6 ++- Utilities/TileFraming.cs | 2 + 20 files changed, 110 insertions(+), 64 deletions(-) diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index c187ea3dce..2a8e2f38c6 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -59,6 +59,7 @@ namespace CalamityMod.CalPlayer Rectangle screenArea = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); int dustDrawn = 0; float maxShroomDust = Main.maxDustToDraw / 2; + Color shroomColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); for (int i = 0; i < Main.maxDustToDraw; i++) { Dust dust = Main.dust[i]; @@ -67,7 +68,7 @@ namespace CalamityMod.CalPlayer // Only draw dust near the screen, for performance reasons. if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(screenArea)) { - dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + dust.color = shroomColor; for (int j = 0; j < 4; j++) { Vector2 dustDrawPosition = dust.position; @@ -84,8 +85,8 @@ namespace CalamityMod.CalPlayer if (j == 0 || j == 1) dustDrawPosition.Y = Player.Center.Y + distanceY; - - else dustDrawPosition.Y = Player.Center.Y - distanceY; + else + dustDrawPosition.Y = Player.Center.Y - distanceY; dustDrawPosition.Y -= 4f; Main.spriteBatch.Draw(TextureAssets.Dust.Value, dustDrawPosition - Main.screenPosition, dust.frame, dust.color, dust.rotation, new Vector2(4f), dust.scale, SpriteEffects.None, 0f); diff --git a/CalPlayer/DrawLayers/AuricSetTrailLayer.cs b/CalPlayer/DrawLayers/AuricSetTrailLayer.cs index 24c742e3de..05ec02fc47 100644 --- a/CalPlayer/DrawLayers/AuricSetTrailLayer.cs +++ b/CalPlayer/DrawLayers/AuricSetTrailLayer.cs @@ -24,11 +24,12 @@ namespace CalamityMod.CalPlayer.DrawLayers { Player drawPlayer = drawInfo.drawPlayer; List existingDrawData = drawInfo.DrawDataCache; - for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i+=0.8f) + float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); + for (float i = 0f; i < drawPlayer.Calamity().OldPositions.Length; i += 0.8f) { float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; float scale = MathHelper.Lerp(1f, 0.7f, completionRatio); - float opacity = MathHelper.Lerp(0.18f, 0.06f, completionRatio) * CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); + float opacity = MathHelper.Lerp(0.18f, 0.06f, completionRatio) * movementSpeedInterpolant; List afterimages = new List(); for (int j = 0; j < existingDrawData.Count; j++) { diff --git a/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs b/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs index 0a8c3bfca5..7c44e6a59b 100644 --- a/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs +++ b/CalPlayer/DrawLayers/CobaltSetTrailLayer.cs @@ -24,11 +24,12 @@ namespace CalamityMod.CalPlayer.DrawLayers { Player drawPlayer = drawInfo.drawPlayer; List existingDrawData = drawInfo.DrawDataCache; + float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); for (int i = 0; i < drawPlayer.Calamity().OldPositions.Length; i++) { float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; float scale = MathHelper.Lerp(1f, 0.5f, completionRatio); - float opacity = MathHelper.Lerp(0.23f, 0.07f, completionRatio) * CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); + float opacity = MathHelper.Lerp(0.23f, 0.07f, completionRatio) * movementSpeedInterpolant; List afterimages = new List(); for (int j = 0; j < existingDrawData.Count; j++) { diff --git a/CalPlayer/DrawLayers/ForbiddenSignLayer.cs b/CalPlayer/DrawLayers/ForbiddenSignLayer.cs index 0e283ad12c..288ee55479 100644 --- a/CalPlayer/DrawLayers/ForbiddenSignLayer.cs +++ b/CalPlayer/DrawLayers/ForbiddenSignLayer.cs @@ -56,10 +56,12 @@ namespace CalamityMod.CalPlayer.DrawLayers drawInfo.DrawDataCache.Add(drawData); // Draw 4 semi-transparent copies. + float timeX4 = sinusoidalTime * 4f; + Vector2 origin = texture.Size() * 0.5f; for (float i = 0f; i < 4f; i++) { - float angle = MathHelper.TwoPi / 4f * i; - drawData = new(glowmask, position + angle.ToRotationVector2() * sinusoidalTime * 4f, null, afterimageColor, drawPlayer.bodyRotation, texture.Size() * 0.5f, 1f, spriteEffects, 0); + float angle = MathHelper.PiOver2 * i; + drawData = new(glowmask, position + angle.ToRotationVector2() * timeX4, null, afterimageColor, drawPlayer.bodyRotation, origin, 1f, spriteEffects, 0); drawInfo.DrawDataCache.Add(drawData); } } diff --git a/CalPlayer/DrawLayers/GemTechGemLayer.cs b/CalPlayer/DrawLayers/GemTechGemLayer.cs index 71dae348e0..4c49822018 100644 --- a/CalPlayer/DrawLayers/GemTechGemLayer.cs +++ b/CalPlayer/DrawLayers/GemTechGemLayer.cs @@ -22,6 +22,9 @@ namespace CalamityMod.CalPlayer.DrawLayers { Player drawPlayer = drawInfo.drawPlayer; CalamityPlayer modPlayer = drawPlayer.Calamity(); + float opacity = MathHelper.Lerp(0.85f, 1.05f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 2.3f) * 0.5f + 0.5f); + float time = Main.GlobalTimeWrappedHourly * 0.61f; + float gemTime = Main.GlobalTimeWrappedHourly * 3.41f; for (int i = 5; i >= 0; i--) { Texture2D gemTexture; @@ -61,11 +64,11 @@ namespace CalamityMod.CalPlayer.DrawLayers if (!modPlayer.GemTechState.GemIsActive(gemType)) continue; - float drawOffsetAngle = modPlayer.GemTechState.CalculateGemOffsetAngle(gemType); - float gemOpacity = MathHelper.Lerp(0.85f, 1.05f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 2.3f) * 0.5f + 0.5f); + float drawOffsetAngle = modPlayer.GemTechState.CalculateGemOffsetAngle(gemType, gemTime); + float gemOpacity = opacity; // Incorporate a sinusoidal pulse into the pulse factor. - pulseFactor *= (float)Math.Cos(Main.GlobalTimeWrappedHourly * 0.61f + drawOffsetAngle); + pulseFactor *= (float)Math.Cos(time + drawOffsetAngle); // Somewhat unorthodox way of creating an illusion of gems being drawn behind the player via orbiting. // Instead of actually messing with a Z position it simply fades away when the sine of the draw @@ -75,12 +78,15 @@ namespace CalamityMod.CalPlayer.DrawLayers Vector2 baseDrawPosition = modPlayer.GemTechState.CalculateGemPosition(gemType) - Main.screenPosition; // Draw back afterimages. + float afterimageTime = Main.GlobalTimeWrappedHourly * 0.47f; + float backAfterImageOpacity = gemOpacity * 0.24f; + Vector2 origin = gemTexture.Size() * 0.5f; for (int j = 0; j < 5; j++) { - Color backAfterimageColor = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.47f + j / 5f) % 1f, 1f, 0.67f); - backAfterimageColor = Color.Lerp(backAfterimageColor, Color.White, 0.64f) * gemOpacity * 0.24f; + Color backAfterimageColor = Main.hslToRgb((afterimageTime + j / 5f) % 1f, 1f, 0.67f); + backAfterimageColor = Color.Lerp(backAfterimageColor, Color.White, 0.64f) * backAfterImageOpacity; Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * j / 5f).ToRotationVector2() * pulseFactor; - DrawData gemBackDrawData = new DrawData(gemTexture, drawPosition, null, backAfterimageColor, 0f, gemTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0); + DrawData gemBackDrawData = new DrawData(gemTexture, drawPosition, null, backAfterimageColor, 0f, origin, 1f, SpriteEffects.None, 0); drawInfo.DrawDataCache.Add(gemBackDrawData); } diff --git a/Cooldowns/SandsmokeBomb.cs b/Cooldowns/SandsmokeBomb.cs index 730ca12fa7..971383af77 100644 --- a/Cooldowns/SandsmokeBomb.cs +++ b/Cooldowns/SandsmokeBomb.cs @@ -31,13 +31,15 @@ namespace CalamityMod.Cooldowns public override void OnCompleted() { + Vector2 playerVelocity = instance.player.velocity / 8f; + Vector2 particleGravity = Vector2.UnitY * 0.03f; for (int i = 0; i < 16; i++) { Vector2 dustDisplace = Main.rand.NextVector2Circular(80f, 50f); Vector2 dustPosition = instance.player.MountedCenter + dustDisplace; - Vector2 dustSpeed = Main.rand.NextVector2Circular(0.5f, 0.5f) + instance.player.velocity / 8f - Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 0.06f; + Vector2 dustSpeed = Main.rand.NextVector2Circular(0.5f, 0.5f) + playerVelocity - Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * 0.06f; dustSpeed.X += 1.4f * (float)Math.Sin(((dustDisplace.X + 80f) / 160f) * MathHelper.Pi) * (Main.rand.NextBool() ? -1 : 1); - Particle dust = new SandyDustParticle(dustPosition, dustSpeed, Color.White, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(20, 50), 0.03f, Vector2.UnitY * 0.03f); + Particle dust = new SandyDustParticle(dustPosition, dustSpeed, Color.White, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(20, 50), 0.03f, particleGravity); GeneralParticleHandler.SpawnParticle(dust); } } diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index adb167e9e2..7626e78b26 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -342,14 +342,15 @@ namespace CalamityMod.DataStructures Owner.manaRegen += GemTechHeadgear.NonMagicItemManaRegenBoost; } - public float CalculateGemOffsetAngle(GemTechArmorGemType gemType) + public float CalculateGemOffsetAngle(GemTechArmorGemType gemType, float time) { - return MathHelper.TwoPi * (int)gemType / 6f + Main.GlobalTimeWrappedHourly * 3.41f; + return MathHelper.TwoPi * (int)gemType / 6f + time; } public Vector2 CalculateGemPosition(GemTechArmorGemType gemType) { - Vector2 baseDrawOffsetDirection = CalculateGemOffsetAngle(gemType).ToRotationVector2() * new Vector2(1f, 0.2f); + float gemTime = Main.GlobalTimeWrappedHourly * 3.41f; + Vector2 baseDrawOffsetDirection = CalculateGemOffsetAngle(gemType, gemTime).ToRotationVector2() * new Vector2(1f, 0.2f); Vector2 gemPosition = Owner.Center + baseDrawOffsetDirection * Owner.width * 1.25f; gemPosition.Y += Owner.gfxOffY; if (Owner.mount?.Active ?? false) diff --git a/ILEditing/ILHelperMethods.cs b/ILEditing/ILHelperMethods.cs index 86408ea30e..167e4bd24a 100644 --- a/ILEditing/ILHelperMethods.cs +++ b/ILEditing/ILHelperMethods.cs @@ -137,18 +137,32 @@ namespace CalamityMod.ILEditing new Vector2(x + 0.5f, y + 0.5f), }; + float lerpAmt = (1f - SulphuricWaterSafeZoneSystem.NearbySafeTiles[closestSafeZone]) * 21f; for (int i = 0; i < 4; i++) { float distanceToClosest = points[i].Distance(closestSafeZone.ToVector2()); - float acidicWaterInterpolant = Utils.GetLerpValue(12f, 20.5f, distanceToClosest + (1f - SulphuricWaterSafeZoneSystem.NearbySafeTiles[closestSafeZone]) * 21f, true); - if (i == 0) - initialColor.TopLeftColor = Color.Lerp(initialColor.TopLeftColor, cleanWaterColor, 1f - acidicWaterInterpolant); - if (i == 1) - initialColor.TopRightColor = Color.Lerp(initialColor.TopRightColor, cleanWaterColor, 1f - acidicWaterInterpolant); - if (i == 2) - initialColor.BottomLeftColor = Color.Lerp(initialColor.BottomLeftColor, cleanWaterColor, 1f - acidicWaterInterpolant); - if (i == 3) - initialColor.BottomRightColor = Color.Lerp(initialColor.BottomRightColor, cleanWaterColor, 1f - acidicWaterInterpolant); + float acidicWaterInterpolant = Utils.GetLerpValue(12f, 20.5f, distanceToClosest + lerpAmt, true); + switch (i) + { + case 0: + initialColor.TopLeftColor = Color.Lerp(initialColor.TopLeftColor, cleanWaterColor, 1f - acidicWaterInterpolant); + break; + + case 1: + initialColor.TopRightColor = Color.Lerp(initialColor.TopRightColor, cleanWaterColor, 1f - acidicWaterInterpolant); + break; + + case 2: + initialColor.BottomLeftColor = Color.Lerp(initialColor.BottomLeftColor, cleanWaterColor, 1f - acidicWaterInterpolant); + break; + + case 3: + initialColor.BottomRightColor = Color.Lerp(initialColor.BottomRightColor, cleanWaterColor, 1f - acidicWaterInterpolant); + break; + + default: + break; + } } } diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs index b77b2b3309..deec0c23ce 100644 --- a/Items/Accessories/AmidiasPendant.cs +++ b/Items/Accessories/AmidiasPendant.cs @@ -43,11 +43,13 @@ namespace CalamityMod.Items.Accessories Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); baseVelocity *= speed2; + int spawnOffset = ShardProjectiles * 15; + float spread = -ShardAngleSpread / 2f; for (int i = 0; i < ShardProjectiles; i++) { Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - (ShardProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-ShardAngleSpread / 2 + (ShardAngleSpread * i / (float)ShardProjectiles))); + spawn.X = spawn.X + i * 30 - spawnOffset; + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(spread + (ShardAngleSpread * i / (float)ShardProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int type = 0; int damage = 0; @@ -67,7 +69,7 @@ namespace CalamityMod.Items.Accessories break; } int finalDamage = (int)player.GetBestClassDamage().ApplyTo(damage); - Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, finalDamage, 5f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, finalDamage, 5f, Main.myPlayer); } } } diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index b269debdfe..d03afe5221 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -109,12 +109,14 @@ namespace CalamityMod.Items.Accessories Vector2 dustDirection = (Vector2.UnitX * -1 * Owner.direction).RotatedByRandom(MathHelper.PiOver2 * 0.93f); dustOrigin += dustDirection * 14f; float spikeSpeed = Main.rand.NextFloat(1f, 3f); + Vector2 dustVelocity = dustDirection * spikeSpeed + Owner.velocity; + Vector2 dustOriginOffset = dustDirection * 4f; for (int i = 0; i < 5; i++) { - Dust dust = Dust.NewDustPerfect(dustOrigin, 229, dustDirection * spikeSpeed + Owner.velocity, 120, Scale: Main.rand.NextFloat(0.6f, 1f)); + Dust dust = Dust.NewDustPerfect(dustOrigin, 229, dustVelocity, 120, Scale: Main.rand.NextFloat(0.6f, 1f)); dust.noGravity = true; - dustOrigin += dustDirection * 4f; + dustOrigin += dustOriginOffset; } } } diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 8dfa6e76d4..bcb757cc18 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Accessories float scale = 0.15f + 0.03f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); - if (playerFound == false) + if (!playerFound) { float shieldStrentgh = forcedVisibility ? 1f : (float)Math.Pow(Main.LocalPlayer.GetModPlayer().ProtectionMatrixDurability / (float)ProtectionMatrixDurabilityMax, 0.5f); float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); diff --git a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs index f110b562b1..a48f245e2f 100644 --- a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs +++ b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor.LunicCorps float scale = 0.11f + 0.022f * (0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.5f + i * 0.2f)); - if (playerFound == false) + if (!playerFound) { float shieldStrentgh = (float)Math.Pow(Main.LocalPlayer.GetModPlayer().masterChefShieldDurability / (float)MasterChefShieldDurabilityMax, 0.5f); float noiseScale = MathHelper.Lerp(0.4f, 0.8f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 0.3f) * 0.5f + 0.5f); diff --git a/Items/Materials/AshesofAnnihilation.cs b/Items/Materials/AshesofAnnihilation.cs index 9ef182d567..7f78bed34a 100644 --- a/Items/Materials/AshesofAnnihilation.cs +++ b/Items/Materials/AshesofAnnihilation.cs @@ -36,11 +36,14 @@ namespace CalamityMod.Items.Materials float outwardness = pulse * baseScale * 8f; Color drawColor = Color.BlueViolet * (float)Math.Sqrt(1f - pulse) * 0.7f; drawColor.A = 0; + float scale = baseScale * MathHelper.Lerp(1f, 1.45f, pulse); + Vector2 drawPositionOffset = Vector2.UnitY * 2f; + float velocity = Item.velocity.X * 0.2f; + Vector2 origin = frame.Size() * 0.5f; for (int i = 0; i < 4; i++) { - float scale = baseScale * MathHelper.Lerp(1f, 1.45f, pulse); - Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * outwardness - Vector2.UnitY * 2f; - spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, Item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * outwardness - drawPositionOffset; + spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, velocity, origin, scale, SpriteEffects.None, 0f); } } diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index 016b682b82..d3dc3348ef 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -31,11 +31,13 @@ namespace CalamityMod.Items.Materials float outwardnessFactor = MathHelper.Lerp(0.9f, 1.3f, pulse); Color drawColor = Color.MintCream * (1f - pulse) * 0.27f; drawColor.A = 0; + float scale = baseScale * outwardnessFactor; + float velocity = Item.velocity.X * 0.2f; + Vector2 origin = frame.Size() * 0.5f; for (int i = 0; i < 4; i++) { - float scale = baseScale * outwardnessFactor; Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 4f; - spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, Item.velocity.X * 0.2f, frame.Size() * 0.5f, scale, SpriteEffects.None, 0f); + spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, velocity, origin, scale, SpriteEffects.None, 0f); } } diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 55c58e03b7..0e77633698 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -43,9 +43,10 @@ namespace CalamityMod.Items.Materials Color drawColor = Color.Lerp(new Color(255, 218, 99), new Color(249, 134, 44), pulse); drawColor *= MathHelper.Lerp(0.35f, 0.67f, CalamityUtils.Convert01To010(pulse)); drawColor.A = 25; + float drawPositionOffset = outwardnessFactor * baseScale * 8f; for (int i = 0; i < 8; i++) { - Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 8f).ToRotationVector2() * outwardnessFactor * baseScale * 8f; + Vector2 drawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 8f).ToRotationVector2() * drawPositionOffset; spriteBatch.Draw(TextureAssets.Item[Item.type].Value, drawPosition, frame, drawColor, 0f, Vector2.Zero, baseScale, SpriteEffects.None, 0f); } } diff --git a/Items/Materials/PlasmaDriveCore.cs b/Items/Materials/PlasmaDriveCore.cs index ba255eecfa..aded54296f 100644 --- a/Items/Materials/PlasmaDriveCore.cs +++ b/Items/Materials/PlasmaDriveCore.cs @@ -37,10 +37,11 @@ namespace CalamityMod.Items.Materials GameShaders.Misc["CalamityMod:BasicTint"].Apply(); float outlineWidth = MathHelper.Lerp(2, 3, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.5f + 0.5f); + float positionOffset = outlineWidth * scale; for (float i = 0; i < 1; i += 0.25f) { - spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * outlineWidth * scale, frame, outlineColor, 0f, origin, scale, 0f, 0f); + spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * positionOffset, frame, outlineColor, 0f, origin, scale, 0f, 0f); } spriteBatch.End(); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e6bd96f69f..b860b689df 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4936,6 +4936,7 @@ namespace CalamityMod.NPCs #region Edit Spawn Pool internal static readonly FieldInfo MaxSpawnsField = typeof(NPC).GetField("maxSpawns", BindingFlags.NonPublic | BindingFlags.Static); + public static void AttemptToSpawnLabCritters(Player player) { if (Main.netMode == NetmodeID.MultiplayerClient) @@ -4949,19 +4950,26 @@ namespace CalamityMod.NPCs if (player.nearbyActiveNPCs >= maxSpawnCount) return; + float playerCenterX = player.Center.X / 16f; + float playerCenterY = player.Center.Y / 16f; + Vector2 sunkenSeaLabCenter = CalamityWorld.SunkenSeaLabCenter / 16f; + Vector2 planetoidLabCenter = CalamityWorld.PlanetoidLabCenter / 16f; + Vector2 jungleLabCenter = CalamityWorld.JungleLabCenter / 16f; + Vector2 hellLabCenter = CalamityWorld.HellLabCenter / 16f; + Vector2 iceLabCenter = CalamityWorld.IceLabCenter / 16f; for (int i = 0; i < 8; i++) { - int checkPositionX = (int)(player.Center.X / 16 + Main.rand.Next(30, 54) * Main.rand.NextBool(2).ToDirectionInt()); - int checkPositionY = (int)(player.Center.Y / 16 + Main.rand.Next(24, 45) * Main.rand.NextBool(2).ToDirectionInt()); + int checkPositionX = (int)(playerCenterX + Main.rand.Next(30, 54) * Main.rand.NextBool(2).ToDirectionInt()); + int checkPositionY = (int)(playerCenterY + Main.rand.Next(24, 45) * Main.rand.NextBool(2).ToDirectionInt()); Vector2 checkPosition = new Vector2(checkPositionX, checkPositionY); Tile aboveSpawnTile = CalamityUtils.ParanoidTileRetrieval(checkPositionX, checkPositionY - 1); - bool nearLab = CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.SunkenSeaLabCenter / 16f) < 180f; - nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.PlanetoidLabCenter / 16f) < 180f; - nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.JungleLabCenter / 16f) < 180f; - nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.HellLabCenter / 16f) < 180f; - nearLab |= CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.IceLabCenter / 16f) < 180f; - bool nearPlagueLab = CalamityUtils.ManhattanDistance(checkPosition, CalamityWorld.JungleLabCenter / 16f) < 180f; + bool nearLab = CalamityUtils.ManhattanDistance(checkPosition, sunkenSeaLabCenter) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, planetoidLabCenter) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, jungleLabCenter) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, hellLabCenter) < 180f; + nearLab |= CalamityUtils.ManhattanDistance(checkPosition, iceLabCenter) < 180f; + bool nearPlagueLab = CalamityUtils.ManhattanDistance(checkPosition, jungleLabCenter) < 180f; bool isLabWall = aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType(); isLabWall |= aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType() || aboveSpawnTile.WallType == WallType(); @@ -5784,6 +5792,8 @@ namespace CalamityMod.NPCs alpha15.G = (byte)(alpha15.G * num212); alpha15.B = (byte)(alpha15.B * num212); alpha15.A = (byte)(alpha15.A * num212); + float xOffset = screenPos.X + npc.width / 2 - TextureAssets.Npc[npc.type].Value.Width * npc.scale / 2f + vector11.X * npc.scale; + float yOffset = screenPos.Y + npc.height - TextureAssets.Npc[npc.type].Value.Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY; for (int num213 = 0; num213 < 4; num213++) { Vector2 position9 = npc.position; @@ -5791,28 +5801,20 @@ namespace CalamityMod.NPCs float num215 = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); if (num213 == 0 || num213 == 2) - { position9.X = Main.LocalPlayer.Center.X + num214; - } else - { position9.X = Main.LocalPlayer.Center.X - num214; - } position9.X -= npc.width / 2; if (num213 == 0 || num213 == 1) - { position9.Y = Main.LocalPlayer.Center.Y + num215; - } else - { position9.Y = Main.LocalPlayer.Center.Y - num215; - } position9.Y -= npc.height / 2; - Main.spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position9.X - screenPos.X + npc.width / 2 - TextureAssets.Npc[npc.type].Value.Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - screenPos.Y + npc.height - TextureAssets.Npc[npc.type].Value.Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position9.X - xOffset, position9.Y - yOffset), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } else @@ -6070,16 +6072,18 @@ namespace CalamityMod.NPCs if ((newAI[3] >= 900f && destroyerLifeRatio < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) { + Color drawColor2 = new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f); for (int i = 0; i < 3; i++) { spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } else { + Color drawColor2 = new Color(255, 255, 255, 0) * (1f - npc.alpha / 255f); spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - new Color(255, 255, 255, 0) * (1f - npc.alpha / 255f), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } } diff --git a/Particles/ConstellationRing.cs b/Particles/ConstellationRing.cs index b5277b1239..9fa016a6e3 100644 --- a/Particles/ConstellationRing.cs +++ b/Particles/ConstellationRing.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Particles for (int i = 0; i < StarAmount; i++) { - float starHeight = (float)Math.Sin(Offset + Main.GlobalTimeWrappedHourly * SpinSpeed + i * MathHelper.TwoPi / (float)StarAmount); float starWidth = (float)Math.Cos(Offset + Main.GlobalTimeWrappedHourly * SpinSpeed + i * MathHelper.TwoPi / (float)StarAmount); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 310e53046e..c0505245b5 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -208,7 +208,7 @@ namespace CalamityMod.Projectiles // Reduce secondary yoyo damage if the player has Yoyo Glove // Brief behavior documentation of yoyo AI: ai[0, 1] are the x, y co-ords and localAI[0] is the airtime in frames // All secondary yoyos are spawned with ai[0] of 1 which tells then tell its AI to do secondary yoyo AI - if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == 99) + if (Main.player[projectile.owner].yoyoGlove && projectile.aiStyle == ProjAIStyleID.Yoyo) { // Store damage on first frame if (projectile.ai[2] == 0f) @@ -2772,6 +2772,8 @@ namespace CalamityMod.Projectiles Color color9 = new(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); Color alpha15 = projectile.GetAlpha(color9); + float offsetX = Main.screenPosition.X + (projectile.width / 2) - texture.Width * projectile.scale / 2f + vector11.X * projectile.scale; + float offsetY = Main.screenPosition.Y + projectile.height - texture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY; for (int num213 = 0; num213 < 4; num213++) { Vector2 position9 = projectile.position; @@ -2795,7 +2797,7 @@ namespace CalamityMod.Projectiles position9.Y -= projectile.height / 2; Main.spriteBatch.Draw(texture, - new Vector2(position9.X - Main.screenPosition.X + (projectile.width / 2) - texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + projectile.height - texture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY), + new Vector2(position9.X - offsetX, position9.Y - offsetY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0); } } diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index b621f6a70c..81c30b5627 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -206,8 +206,10 @@ namespace CalamityMod return false; for (int i = 0; i < PlantCheckAgainst[plant].Length; ++i) + { if (PlantCheckAgainst[plant][i] == check) return false; + } return true; } From dfbad250e7ccf85b37813fffc6ca4b88512c433f Mon Sep 17 00:00:00 2001 From: Xyk Date: Sun, 6 Aug 2023 14:55:20 -0700 Subject: [PATCH 10/12] Buffed GFB Hellkite It sucked too much in GFB --- Items/Weapons/Melee/Hellkite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 7f03619fdf..51accfa0b6 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee } // NOTE: Modded item variants don't seem to be supported as of now, so this is probably temporary (also there is no way around modifiers screwing rarity/value in some way) - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage += (Main.zenithWorld ? (1369f / 180f - 1f) : 0f); + public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage += (Main.zenithWorld ? (1669f / 180f - 1f) : 0f); public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback += (Main.zenithWorld ? 1.5f : 0f); public override float UseSpeedMultiplier(Player player) => Main.zenithWorld ? 2.5f : 1f; public override void ModifyItemScale(Player player, ref float scale) => scale *= (Main.zenithWorld ? 2.5f : 1f); From c25cde86eca5d313f748aa68a81f2d5e7caba8cd Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Mon, 7 Aug 2023 01:08:35 +0200 Subject: [PATCH 11/12] Resprited Archer of Lunamoon Buff. --- Buffs/Pets/ArcherofLunamoon.png | Bin 592 -> 525 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Buffs/Pets/ArcherofLunamoon.png b/Buffs/Pets/ArcherofLunamoon.png index 726d2ab0d51967b67fcde13f460e99dd5b9409bd..a3a5614f8acc4d0d62ced9710f0c8eecbd414418 100644 GIT binary patch delta 487 zcmV9kQ01S@UD zAQDI+Xk}p`q!5Fh*aSfkw9!fvD^nOtBiIBa7FPNTVsSeOx7i^{lPvf(ce^{gck^y$ zcP>Ip4f?AHz)+tb>U@g^z{AC5Xy9aX9e{*sSFMQ&+)C%N0Do*}j-7V0&aJr)oWQW% zp?RJ+o{2OMJ4x*QC1A_;TvOVz)5t`}CWD)=55NNg%`8~%a)L%gV#1b9LI`AhAvxaNej(u9So~I^~q5gxy z2GH_I`}Ue7Yt9Rw0F){*SM}Hb`FH#WnD&EWzkm-g0000EWmrjOO-%qQ d00008000000002eQPe_wt9LGPeEd*nrBiRluYRV2#fje~2g9l+} zM?wZ&QaTw#L5S%snZm*@Q6NYc@y{Wa1s-;)Lx*K_PzefKksXQ&4VS}HdU)TT@;rOr zO*(9k-^=#<^S;mf`#itjv%OZ^`AYzN{kFD84HamKS^y2TTz}L}7O)2}G&td!5P0}Q|#=@BftOxKCi&9`6K`X9dQ71`5XX|)`)Aq_$5ztK{M`v9-WTg}y^r*i*OZt`K-8Jp2B45QTQN^6ZBGAC{MD{AkAOa> z_qy!Qk4_isdoPkMk2(2M@7x#sv{O)Q^9Ypb^9lg5nSbGmX%a6^KLFsC<4;w&{V^bL zL>1qr6?-x{2SA7Ot17)E)AFKJ1WY6#T`Es1C!E&_s8{|v{RV&&rGK`gvGN0$M?j>{ zYh-j8fKbpr=|;ltXZxKGB> Date: Sun, 6 Aug 2023 18:22:36 -0500 Subject: [PATCH 12/12] More optimizations. --- ILEditing/MechanicILChanges.cs | 3 +-- NPCs/CalamityGlobalNPC.cs | 2 +- Utilities/ProjectileUtils.cs | 28 +++++++++++++--------------- Utilities/TileUtils.cs | 32 ++++++++++++++++---------------- Walls/VoidstoneWall.cs | 3 ++- Walls/VoidstoneWallUnsafe.cs | 5 +++-- 6 files changed, 36 insertions(+), 37 deletions(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 78ff25d23e..d29db28d50 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -552,13 +552,12 @@ namespace CalamityMod.ILEditing color = Color.Lerp(color, Color.White, 0.75f); float offsetAngleValue = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6.7f) * 0.99f; - float horizontalAreaValue = (float)horizontalArea * 0.34f; int origin = size / 2; for (int i = -horizontalArea; i <= horizontalArea; i++) { float offsetAngle = offsetAngleValue; - offsetAngle += i / horizontalAreaValue; + offsetAngle += i / (float)horizontalArea * 0.34f; Vector2 velocity = Main.MouseWorld - UIManagementSystem.PreviousMouseWorld; if (velocity.Length() < 64f) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b860b689df..bb5889922e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6076,7 +6076,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < 3; i++) { spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } else diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index f2126c15f8..926bee0dd5 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -479,6 +479,8 @@ namespace CalamityMod maxTrailPoints = (int)projectile.localAI[0]; Vector2 cumulativeOffset = Vector2.Zero; + Color alpha = projectile.GetAlpha(lightColor); + float fixedRotation = projectile.rotation + MathHelper.PiOver2; for (int i = 1; i <= (int)projectile.localAI[0]; i++) { Vector2 velToUseThisIter = projectile.velocity; @@ -493,10 +495,9 @@ namespace CalamityMod } } cumulativeOffset += Vector2.Normalize(velToUseThisIter) * spacer; - Color color = projectile.GetAlpha(lightColor); + Color color = alpha; color *= (maxTrailPoints - (float)i) / maxTrailPoints; color.A = 0; - float fixedRotation = projectile.rotation + MathHelper.PiOver2; Main.spriteBatch.Draw(texture, drawPos - cumulativeOffset, null, color, fixedRotation, origin, projectile.scale, spriteEffects, 0f); } } @@ -548,9 +549,10 @@ namespace CalamityMod float time = Main.player[projectile.owner].miscCounter % 216000f / 60f; Color outerColor = outer * 0.2f; outerColor.A = 0; + float rotation = MathHelper.TwoPi * time; for (int o = 0; o < 6; o += 2) { - Vector2 spinStart = drawStartOuter + spinPoint.RotatedBy(MathHelper.TwoPi * time - MathHelper.Pi * o / 3f); + Vector2 spinStart = drawStartOuter + spinPoint.RotatedBy(rotation - MathHelper.Pi * o / 3f); float scaleMultOuter = 1.5f - o * 0.1f; Main.EntitySpriteDraw(aura, spinStart, auraRec, outerColor, auraRotation, auraOrigin, scaleMultOuter, SpriteEffects.None, 0); } @@ -565,9 +567,8 @@ namespace CalamityMod scaleMult = (scaleMult + i) % 1f; float colorMult = scaleMult * 2f; if (colorMult > 1f) - { colorMult = 2f - colorMult; - } + Main.EntitySpriteDraw(aura, drawStartInner, auraRec, innerColor * colorMult, auraRotation, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); } } @@ -596,11 +597,13 @@ namespace CalamityMod } bool canKillWalls = false; + float projectilePositionX = projectile.position.X / 16f; + float projectilePositionY = projectile.position.Y / 16f; for (int x = minTileX; x <= maxTileX; x++) { for (int y = minTileY; y <= maxTileY; y++) { - Vector2 explodeArea = new Vector2(Math.Abs(x - projectile.position.X / 16f), Math.Abs(y - projectile.position.Y / 16f)); + Vector2 explodeArea = new Vector2(Math.Abs(x - projectilePositionX), Math.Abs(y - projectilePositionY)); float distance = explodeArea.Length(); if (distance < explosionRadius && Main.tile[x, y] != null && Main.tile[x, y].WallType == WallID.None) { @@ -644,7 +647,7 @@ namespace CalamityMod Tile tile = Main.tile[i, j]; bool t = 1 == 1; bool f = 1 == 2; - Vector2 explodeArea = new Vector2(Math.Abs(i - projectile.position.X / 16f), Math.Abs(j - projectile.position.Y / 16f)); + Vector2 explodeArea = new Vector2(Math.Abs(i - projectilePositionX), Math.Abs(j - projectilePositionY)); float distance = explodeArea.Length(); if (distance < explosionRadius) { @@ -654,14 +657,11 @@ namespace CalamityMod if (checkExplosions) { if (Main.tileDungeon[tile.TileType] || explosionCheckList.Contains(tile.TileType)) - { canKillTile = false; - } if (!TileLoader.CanExplode(i, j)) - { canKillTile = false; - } } + if (Main.tileContainer[tile.TileType]) canKillTile = false; if (!TileLoader.CanKillTile(i, j, tile.TileType, ref t) || !TileLoader.CanKillTile(i, j, tile.TileType, ref f)) @@ -673,11 +673,10 @@ namespace CalamityMod { WorldGen.KillTile(i, j, false, false, false); if (!tile.HasTile && Main.netMode != NetmodeID.SinglePlayer) - { NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, i, j, 0f, 0, 0, 0); - } } } + if (canKillTile) { for (int x = i - 1; x <= i + 1; x++) @@ -689,13 +688,12 @@ namespace CalamityMod canExplode = WallLoader.CanExplode(x, y, Main.tile[x, y].WallType); if (wallExcludeList.Any() && wallExcludeList.Contains(Main.tile[x, y].WallType)) canKillWalls = false; + if (Main.tile[x, y] != null && Main.tile[x, y].WallType > WallID.None && canKillWalls && canExplode) { WorldGen.KillWall(x, y, false); if (Main.tile[x, y].WallType == WallID.None && Main.netMode != NetmodeID.SinglePlayer) - { NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 2, x, y, 0f, 0, 0, 0); - } } } } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 24df06d0a1..543f728b5b 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -62,18 +62,16 @@ namespace CalamityMod { if (xIter < 0 || xIter >= Main.maxTilesX) continue; + for (int yIter = y - 1; yIter <= y + 1; yIter++) { if (yIter < 0 || yIter >= Main.maxTilesY) continue; + if (xIter == x && yIter == y) - { WorldGen.TileFrame(x, y, resetFrame, false); - } else - { WorldGen.TileFrame(xIter, yIter, false, false); - } } } } @@ -82,31 +80,27 @@ namespace CalamityMod { int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; + int tileXX18 = 18 * tileX; for (int l = x; l < x + tileX; l++) { for (int m = y; m < y + tileY; m++) { if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == type) { - if (Main.tile[l, m].TileFrameX < (18 * tileX)) - { - Main.tile[l, m].TileFrameX += (short)(18 * tileX); - } + if (Main.tile[l, m].TileFrameX < tileXX18) + Main.tile[l, m].TileFrameX += (short)(tileXX18); else - { - Main.tile[l, m].TileFrameX -= (short)(18 * tileX); - } + Main.tile[l, m].TileFrameX -= (short)(tileXX18); } } } + if (Wiring.running) { for (int k = 0; k < tileX; k++) { for (int l = 0; l < tileY; l++) - { Wiring.SkipWire(x + k, y + l); - } } } } @@ -121,12 +115,13 @@ namespace CalamityMod int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; ulong num190 = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)(uint)i); - + float drawPositionX = i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f; + float drawPositionY = j * 16 - (int)Main.screenPosition.Y; for (int c = 0; c < 7; c++) { float shakeX = Utils.RandomInt(ref num190, -10, 11) * 0.15f; float shakeY = Utils.RandomInt(ref num190, -10, 1) * 0.35f; - Main.spriteBatch.Draw(flameTexture, new Vector2(i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f + shakeX, j * 16 - (int)Main.screenPosition.Y + shakeY + yOffset) + zero, new Rectangle(tile.TileFrameX + offsetX, tile.TileFrameY + offsetY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(flameTexture, new Vector2(drawPositionX + shakeX, drawPositionY + shakeY + yOffset) + zero, new Rectangle(tile.TileFrameX + offsetX, tile.TileFrameY + offsetY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } @@ -171,11 +166,13 @@ namespace CalamityMod { int width = flameTexture.Width; int height = flameTexture.Height; + float drawPositionX = item.position.X - Main.screenPosition.X + item.width * 0.5f; + float drawPositionY = item.position.Y - Main.screenPosition.Y + item.height - flameTexture.Height * 0.5f + 2f; for (int c = 0; c < 7; c++) { float shakeX = Main.rand.Next(-10, 11) * 0.15f; float shakeY = Main.rand.Next(-10, 1) * 0.35f; - Main.spriteBatch.Draw(flameTexture, new Vector2(item.position.X - Main.screenPosition.X + item.width * 0.5f + shakeX, item.position.Y - Main.screenPosition.Y + item.height - flameTexture.Height * 0.5f + 2f + shakeY), new Rectangle(0, 0, width, height), new Color(100, 100, 100, 0), 0f, default, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(flameTexture, new Vector2(drawPositionX + shakeX, drawPositionY + shakeY), new Rectangle(0, 0, width, height), new Color(100, 100, 100, 0), 0f, default, 1f, SpriteEffects.None, 0f); } } @@ -239,6 +236,7 @@ namespace CalamityMod { if (WorldGen.InWorld(i, j)) continue; + if (WorldGen.SolidTile(Framing.GetTileSafely(i, j))) return true; } @@ -254,6 +252,7 @@ namespace CalamityMod { if (!WorldGen.InWorld(i, j)) return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) return false; } @@ -269,6 +268,7 @@ namespace CalamityMod { if (!WorldGen.InWorld(i, j)) return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) return false; } diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 937ec1998b..21170ca508 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -54,10 +54,11 @@ namespace CalamityMod.Walls Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Color glowColor = drawcolor * 0.4f; for (int k = 0; k < 3; k++) { Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 4f88ec3d09..a633899346 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -60,10 +60,11 @@ namespace CalamityMod.Walls Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Color glowColor = drawcolor * 0.4f; for (int k = 0; k < 3; k++) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } }