diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c1c52f4c6a..367cf1b8fa 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -828,12 +828,12 @@ namespace CalamityMod.CalPlayer // Death Mode effects caveDarkness = 0f; - if (CalamityWorld.death) + if (CalamityWorld.death || Main.getGoodWorld) { if (Player.whoAmI == Main.myPlayer) { // Thorn and spike effects - // 10 = crimson/corruption thorns, 17 = jungle thorns, 40 = dungeon spikes, 60 = temple spikes + // 10 = crimson/corruption thorns, 17 = jungle thorns, 80 = temple spikes Vector2 tileType; if (!Player.mount.Active || !Player.mount.Cart) tileType = Collision.HurtTiles(Player.position, Player.velocity, Player.width, Player.height, Player.fireWalk); diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index cb3df0eb56..4a54a15362 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -169,7 +169,7 @@ namespace CalamityMod.ILEditing return; } cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, 100); + cursor.Emit(OpCodes.Ldc_I4, 200); if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(20))) { @@ -177,7 +177,7 @@ namespace CalamityMod.ILEditing return; } cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, 100); + cursor.Emit(OpCodes.Ldc_I4, 200); if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(20))) { @@ -185,7 +185,7 @@ namespace CalamityMod.ILEditing return; } cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, 100); + cursor.Emit(OpCodes.Ldc_I4, 200); if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(20))) { @@ -193,7 +193,7 @@ namespace CalamityMod.ILEditing return; } cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, 100); + cursor.Emit(OpCodes.Ldc_I4, 200); } #endregion diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index fee64e6ca6..5ab2914603 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -2745,6 +2745,7 @@ namespace CalamityMod.NPCs // Set jump velocity, reset and set AI to next phase (Stomp) float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X; npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; + calamityGlobalNPC.newAI[3] = npc.direction; // The limit for how much Aureus can multiply its jump velocity float speedMultLimit = 1f; @@ -2918,8 +2919,6 @@ namespace CalamityMod.NPCs npc.velocity.X *= 0.8f; - calamityGlobalNPC.newAI[3] = 1f; - if (npc.Bottom.Y < player.position.Y) { // Make sure Aureus falls rather quickly @@ -2959,7 +2958,11 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] > 0f) velocityXCap *= calamityGlobalNPC.newAI[1] + 1f; - if (calamityGlobalNPC.newAI[3] == 1f) + float playerLocation = npc.Center.X - player.Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; + + if (slowDown) velocityXCap *= 0.333f; if (npc.velocity.X < -velocityXCap) diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 51c7e26c39..e6a9613819 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -423,6 +423,7 @@ namespace CalamityMod.NPCs.Ravager float playerLocation = NPC.Center.X - player.Center.X; NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.ai[2] = NPC.direction; NPC.velocity.X = velocityX * NPC.direction; NPC.velocity.Y = velocityY; @@ -570,8 +571,6 @@ namespace CalamityMod.NPCs.Ravager { NPC.velocity.X *= 0.8f; - NPC.ai[2] = 1f; - if (NPC.Bottom.Y < player.position.Y) { float fallSpeedBoost = !anyHeadActive ? 0.9f : death ? 0.9f * (1f - lifeRatio) : 0.6f * (1f - lifeRatio); @@ -615,7 +614,11 @@ namespace CalamityMod.NPCs.Ravager else if (NPC.direction > 0) NPC.velocity.X += velocityXChange; - if (NPC.ai[2] == 1f) + float playerLocation = NPC.Center.X - player.Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != NPC.ai[2]; + + if (slowDown) velocityXCap *= 0.333f; if (NPC.velocity.X < -velocityXCap) diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs index 47651a1093..ee2178b89b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs @@ -236,6 +236,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (enrage) velocityX *= 1.5f; + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + calamityGlobalNPC.newAI[1] = npc.direction; + npc.velocity.X = velocityX * npc.direction; float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); @@ -255,10 +259,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = 1f; npc.noTileCollide = true; - npc.netUpdate = true; npc.ai[0] = 1f; npc.ai[1] = 0f; + + npc.netUpdate = true; + npc.SyncExtraAI(); } } @@ -358,12 +364,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.velocity.X *= 0.8f; - if (calamityGlobalNPC.newAI[1] == 0f) - { - calamityGlobalNPC.newAI[1] = 1f; - npc.SyncExtraAI(); - } - if (npc.Bottom.Y < Main.player[npc.target].position.Y) { float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); @@ -387,7 +387,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (enrage) velocityXCap *= 1.5f; - if (calamityGlobalNPC.newAI[1] == 1f) + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[1]; + + if (slowDown) velocityXCap *= 0.5f; if (npc.velocity.X < -velocityXCap) diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index f584965b15..8484691ef3 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -21,9 +21,9 @@ namespace CalamityMod.World.Planets private ushort[] oreTypes = new ushort[] { WorldGen.copperBar == TileID.Copper ? (Main.getGoodWorld ? TileID.Palladium : TileID.Tin) : (Main.getGoodWorld ? TileID.Cobalt : TileID.Copper), - WorldGen.ironBar == TileID.Iron ? (Main.getGoodWorld ? TileID.Orichalcum : TileID.Lead) : (Main.getGoodWorld ? TileID.Mythril : TileID.Iron), - WorldGen.silverBar == TileID.Silver ? (Main.getGoodWorld ? TileID.Titanium : TileID.Tungsten) : (Main.getGoodWorld ? TileID.Adamantite : TileID.Silver), - WorldGen.goldBar == TileID.Gold ? (Main.getGoodWorld ? (ushort)ModContent.TileType() : TileID.Platinum) : (Main.getGoodWorld ? (ushort)ModContent.TileType() : TileID.Gold) + WorldGen.ironBar == TileID.Iron ? (Main.getGoodWorld ? TileID.Palladium : TileID.Lead) : (Main.getGoodWorld ? TileID.Cobalt : TileID.Iron), + WorldGen.silverBar == TileID.Silver ? (Main.getGoodWorld ? TileID.Orichalcum : TileID.Tungsten) : (Main.getGoodWorld ? TileID.Mythril : TileID.Silver), + WorldGen.goldBar == TileID.Gold ? (Main.getGoodWorld ? TileID.Titanium : TileID.Platinum) : (Main.getGoodWorld ? TileID.Adamantite : TileID.Gold) }; public override bool Place(Point origin, StructureMap structures) @@ -66,7 +66,7 @@ namespace CalamityMod.World.Planets //Place layers WorldUtils.Gen(origin, new ModShapes.All(core), Actions.Chain(new GenAction[] { - new Actions.PlaceTile(TileID.Stone), + new Actions.PlaceTile(Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone), new Actions.PlaceWall(WallID.Cave2Unsafe) })); WorldUtils.Gen(origin, new ModShapes.All(crust), Actions.Chain(new GenAction[] @@ -87,7 +87,7 @@ namespace CalamityMod.World.Planets x = _random.Next(origin.X - radius, origin.X + radius + 1); y = _random.Next(origin.Y - radius, origin.Y + radius + 1); } - WorldGen.TileRunner(x, y, _random.NextFloat(4.6f, 7.6f), _random.Next(7, 16), TileID.Stone); + WorldGen.TileRunner(x, y, _random.NextFloat(4.6f, 7.6f), _random.Next(7, 16), Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone); } for (int i = 0; i < randDirt; i++) { @@ -192,7 +192,7 @@ namespace CalamityMod.World.Planets //Clear dirt walls on outer edge because of stone / ore WorldUtils.Gen(origin, new ModShapes.InnerOutline(crust), Actions.Chain(new GenAction[] { - new Modifiers.OnlyTiles(new ushort[] { TileID.Stone, oreType }), + new Modifiers.OnlyTiles(new ushort[] { Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone, oreType }), new Modifiers.IsTouchingAir(true), new Modifiers.OnlyWalls(WallID.DirtUnsafe), new Actions.ClearWall(true) diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index 83262f1dbe..9b05d6bf7f 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -54,7 +54,7 @@ namespace CalamityMod.World.Planets WorldUtils.Gen(origin, new Shapes.Circle((int)(radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.45).Output(outerCoreShape), - new Actions.SetTile(TileID.Stone, true), + new Actions.SetTile(Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone, true), new Actions.ClearWall(), new Actions.PlaceWall(WallID.CaveUnsafe) })); @@ -64,7 +64,7 @@ namespace CalamityMod.World.Planets while (numStone > 0) { Point p = outerCore.RandomPointOnCircleEdge().ToTileCoordinates(); - WorldGen.TileRunner(p.X, p.Y, _random.NextFloat(3f, 6f), _random.Next(5, 15), TileID.Stone); + WorldGen.TileRunner(p.X, p.Y, _random.NextFloat(3f, 6f), _random.Next(5, 15), Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone); numStone--; } int numDirt = _random.Next(80, 110); @@ -147,7 +147,7 @@ namespace CalamityMod.World.Planets if (Vector2.Distance(planetCenter, new Vector2(x * 16 + 8, startY * 16 + 8)) > radius * 16f - 64) { _tiles[x, startY].Get().HasTile = true; - _tiles[x, startY].TileType = TileID.Stone; + _tiles[x, startY].TileType = Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone; } } } diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs index 41b58a43e5..44a0a18bb9 100644 --- a/World/Planets/MudPlanet.cs +++ b/World/Planets/MudPlanet.cs @@ -49,7 +49,7 @@ namespace CalamityMod.World.Planets { int x = _random.Next(origin.X - radius + 3, origin.X + radius - 2); int y = _random.Next(origin.Y - radius + 3, origin.Y + radius - 2); - WorldGen.TileRunner(x, y, _random.NextFloat(5f, 9f), _random.Next(5, 15), TileID.Stone); + WorldGen.TileRunner(x, y, _random.NextFloat(5f, 9f), _random.Next(5, 15), Main.getGoodWorld ? TileID.WoodenSpikes : TileID.Stone); } //Place grass, remove wall and occasionally smooth diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index 61511893ef..12fd551d9b 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -74,6 +74,20 @@ namespace CalamityMod.World.Planets MudPlanetoidCount--; i++; } + + // Checkerboard of Spikes and Wooden Spikes. + if (Main.getGoodWorld) + { + for (int j = 0; j < Main.maxTilesX; j++) + { + for (int k = 0; k < (int)(Main.maxTilesY * 0.2f); k++) + { + bool convertToRegularSpikes = (j % 2 == 0 && k % 2 == 0) || (j % 2 != 0 && k % 2 != 0); + if (Main.tile[j, k].TileType == TileID.WoodenSpikes && convertToRegularSpikes) + Main.tile[j, k].TileType = TileID.Spikes; + } + } + } } public static bool InvalidSkyPlacementArea(Rectangle area)