Couple of sulph sea adjustments (see description)
- Made the acid rain depend on whether the rain is active. - Made the acid rain go away after 4 minutes if no enemies are killed in that time period. - Prevented natural tiles from forming a clump above the sulph sea during worldgen - Cut a good amount of of lag from the sulph sea generation process. - Changed the 98% completion to 99% when Old Duke appears.
This commit is contained in:
1 parent
7339ed9e56
commit
52ffc8cb19
6 files changed
+97
-42
No files matched your search
@@ -3743,6 +3743,7 @@ namespace CalamityMod
|
||||
case CalamityModMessageType.AcidRainSync:
|
||||
CalamityWorld.rainingAcid = reader.ReadBoolean();
|
||||
CalamityWorld.acidRainPoints = reader.ReadInt32();
|
||||
CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32();
|
||||
break;
|
||||
case CalamityModMessageType.AcidRainUIDrawFadeSync:
|
||||
CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32();
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace CalamityMod.Events
|
||||
// A partially bright pale-ish cyan with a hint of yellow.
|
||||
public static readonly Color TextColor = new Color(115, 194, 147);
|
||||
|
||||
public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed.
|
||||
|
||||
public const float BloodwormSpawnRate = 0.1f;
|
||||
|
||||
// Not a readonly collection so that if anyone else wants to add stuff in here with their own mod, they can.
|
||||
@@ -168,17 +170,16 @@ namespace CalamityMod.Events
|
||||
Main.numClouds = Main.numCloudsTemp;
|
||||
Main.windSpeedTemp = 0.72f;
|
||||
Main.windSpeedSet = Main.windSpeedTemp;
|
||||
Main.weatherCounter = 600;
|
||||
Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion.
|
||||
Main.rainTime = Main.weatherCounter;
|
||||
Main.maxRaining = 0.89f;
|
||||
CalamityWorld.forcedDownpourWithTear = true;
|
||||
CalamityMod.UpdateServerBoolean();
|
||||
}
|
||||
if (CalamityWorld.startAcidicDownpour)
|
||||
{
|
||||
Main.raining = true;
|
||||
}
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case.
|
||||
}
|
||||
|
||||
UpdateInvasion();
|
||||
BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas!
|
||||
}
|
||||
@@ -223,6 +224,7 @@ namespace CalamityMod.Events
|
||||
netMessage.Write((byte)CalamityModMessageType.AcidRainSync);
|
||||
netMessage.Write(CalamityWorld.rainingAcid);
|
||||
netMessage.Write(CalamityWorld.acidRainPoints);
|
||||
netMessage.Write(CalamityWorld.timeSinceAcidRainKill);
|
||||
netMessage.Send();
|
||||
}
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining);
|
||||
return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining || CalamityWorld.rainingAcid);
|
||||
}
|
||||
|
||||
public override bool UseItem(Player player)
|
||||
@@ -48,22 +48,10 @@ namespace CalamityMod.Items.Tools.ClimateChange
|
||||
Main.rainTime = 3600;
|
||||
AdjustRainSeverity(true);
|
||||
}
|
||||
if (CalamityWorld.rainingAcid)
|
||||
{
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.raining = false;
|
||||
if (CalamityWorld.rainingAcid)
|
||||
{
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
}
|
||||
|
||||
CalamityMod.UpdateServerBoolean();
|
||||
|
||||
@@ -1623,16 +1623,18 @@ namespace CalamityMod.NPCs
|
||||
private void AcidRainProgression(NPC npc)
|
||||
{
|
||||
Dictionary<int, AcidRainSpawnData> possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM;
|
||||
|
||||
if (CalamityWorld.downedAquaticScourge)
|
||||
possibleEnemies = AcidRainEvent.PossibleEnemiesAS;
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
possibleEnemies = AcidRainEvent.PossibleEnemiesPolter;
|
||||
|
||||
if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type) && CalamityWorld.rainingAcid)
|
||||
{
|
||||
CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints;
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke.
|
||||
CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke.
|
||||
}
|
||||
}
|
||||
Dictionary<int, AcidRainSpawnData> possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS;
|
||||
@@ -1641,7 +1643,7 @@ namespace CalamityMod.NPCs
|
||||
CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints;
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
{
|
||||
CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke.
|
||||
CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1654,6 +1656,7 @@ namespace CalamityMod.NPCs
|
||||
CalamityWorld.triedToSummonOldDuke = false;
|
||||
CalamityWorld.acidRainPoints = 0;
|
||||
}
|
||||
CalamityWorld.timeSinceAcidRainKill = 0;
|
||||
AcidRainEvent.UpdateInvasion();
|
||||
}
|
||||
#endregion
|
||||
|
||||
+37
-8
@@ -72,6 +72,7 @@ namespace CalamityMod.World
|
||||
GenerateUpperSea();
|
||||
CreateWater();
|
||||
GenerateHardenedSandstone();
|
||||
RemoveStupidTilesAboveSea();
|
||||
SettleWater(); // The island Y spawn position calculations are relative to water. Settling the water before doing these calculations is ideal.
|
||||
GenerateIslands();
|
||||
GenerateVentsAndFossils();
|
||||
@@ -326,13 +327,6 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (WorldGen.genRand.NextBool(10))
|
||||
{
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
TileLoader.RandomUpdate(trueX, y, Main.tile[trueX, y].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -758,9 +752,30 @@ namespace CalamityMod.World
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Removal of stupid Tiles above the Sea
|
||||
public static void RemoveStupidTilesAboveSea()
|
||||
{
|
||||
for (int x = 0; x < BiomeWidth; x++)
|
||||
{
|
||||
int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x;
|
||||
for (int y = YStart - 100; y < YStart + 60; y++)
|
||||
{
|
||||
if (YStartWhitelist.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type))
|
||||
{
|
||||
if (Main.tile[trueX, y] == null)
|
||||
Main.tile[trueX, y] = new Tile();
|
||||
Main.tile[trueX, y].active(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Misc Functions
|
||||
public static List<int> YStartWhitelist = new List<int>()
|
||||
{
|
||||
TileID.Stone,
|
||||
TileID.Dirt,
|
||||
TileID.Sand,
|
||||
TileID.Ebonsand,
|
||||
TileID.Crimsand,
|
||||
@@ -777,12 +792,26 @@ namespace CalamityMod.World
|
||||
TileID.Tungsten,
|
||||
TileID.Crimstone,
|
||||
TileID.Ebonstone,
|
||||
TileID.HardenedSand,
|
||||
TileID.CorruptHardenedSand,
|
||||
TileID.CrimsonHardenedSand,
|
||||
TileID.Coral,
|
||||
TileID.BeachPiles,
|
||||
TileID.Plants,
|
||||
TileID.Plants2,
|
||||
TileID.SmallPiles,
|
||||
TileID.LargePiles,
|
||||
TileID.LargePiles2,
|
||||
TileID.Trees,
|
||||
TileID.Vines,
|
||||
TileID.CrimsonVines,
|
||||
TileID.Containers,
|
||||
TileID.JungleGrass // Yes, this can happen on rare occasion
|
||||
};
|
||||
public static void DetermineYStart()
|
||||
{
|
||||
int maxHeight = 0;
|
||||
for (int i = 0; i < BiomeWidth; i++)
|
||||
for (int i = 0; i < BiomeWidth - 18; i++)
|
||||
{
|
||||
int xCheck = CalamityWorld.abyssSide ?
|
||||
BiomeWidth - i :
|
||||
|
||||
+46
-14
@@ -111,6 +111,8 @@ namespace CalamityMod.World
|
||||
public static bool forcedRainAlready = false;
|
||||
public static bool forcedDownpourWithTear = false;
|
||||
public static int forceRainTimer = 0;
|
||||
public static int timeSinceAcidRainKill = 0;
|
||||
public static int timeSinceAcidStarted = 0;
|
||||
public static float AcidRainCompletionRatio
|
||||
{
|
||||
get
|
||||
@@ -967,6 +969,17 @@ namespace CalamityMod.World
|
||||
|
||||
if (rainingAcid)
|
||||
{
|
||||
timeSinceAcidRainKill++;
|
||||
timeSinceAcidStarted++;
|
||||
|
||||
// If enough time has passed, and no enemy has been killed, end the invasion early.
|
||||
// The player almost certainly does not want to deal with it.
|
||||
if (timeSinceAcidRainKill >= AcidRainEvent.InvasionNoKillPersistTime)
|
||||
{
|
||||
acidRainPoints = 0;
|
||||
triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
if (!startAcidicDownpour)
|
||||
{
|
||||
int sulphSeaWidth = Abyss.BiomeWidth;
|
||||
@@ -984,6 +997,8 @@ namespace CalamityMod.World
|
||||
(player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !abyssSide)) &&
|
||||
player2.Calamity().ZoneSulphur)
|
||||
{
|
||||
// Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea)
|
||||
// You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!!
|
||||
startAcidicDownpour = true;
|
||||
CalamityMod.UpdateServerBoolean();
|
||||
break;
|
||||
@@ -992,22 +1007,37 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
|
||||
// Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea)
|
||||
// You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!!
|
||||
if ((startAcidicDownpour || forcedDownpourWithTear) && !NPC.AnyNPCs(ModContent.NPCType<OldDuke>()))
|
||||
// Stop the rain if the Old Duke is present for visibility during the fight.
|
||||
if (Main.raining && NPC.AnyNPCs(ModContent.NPCType<OldDuke>()))
|
||||
{
|
||||
Main.raining = true;
|
||||
Main.cloudBGActive = 1f;
|
||||
Main.numCloudsTemp = Main.cloudLimit;
|
||||
Main.numClouds = Main.numCloudsTemp;
|
||||
Main.windSpeedTemp = 0.72f;
|
||||
Main.windSpeedSet = Main.windSpeedTemp;
|
||||
Main.weatherCounter = 600;
|
||||
Main.maxRaining = 0.89f;
|
||||
}
|
||||
Main.raining = false;
|
||||
CalamityMod.UpdateServerBoolean();
|
||||
}
|
||||
|
||||
// If the rain stops for whatever reason, end the invasion.
|
||||
// This is primarily done for compatibility, so that if another mod wants to manipulate the weather,
|
||||
// they can without having to deal with endless rain.
|
||||
if (!Main.raining && !NPC.AnyNPCs(ModContent.NPCType<OldDuke>()) && timeSinceAcidStarted > 20)
|
||||
{
|
||||
acidRainPoints = 0;
|
||||
triedToSummonOldDuke = false;
|
||||
AcidRainEvent.UpdateInvasion(false);
|
||||
}
|
||||
else if (timeSinceAcidStarted < 20)
|
||||
{
|
||||
Main.raining = true;
|
||||
Main.cloudBGActive = 1f;
|
||||
Main.numCloudsTemp = Main.cloudLimit;
|
||||
Main.numClouds = Main.numCloudsTemp;
|
||||
Main.windSpeedTemp = 0.72f;
|
||||
Main.windSpeedSet = Main.windSpeedTemp;
|
||||
Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion.
|
||||
Main.rainTime = Main.weatherCounter;
|
||||
Main.maxRaining = 0.89f;
|
||||
}
|
||||
|
||||
// Summon Old Duke tornado post-Polter as needed
|
||||
if (downedPolterghast && acidRainPoints == 2)
|
||||
if (downedPolterghast && acidRainPoints == 1)
|
||||
{
|
||||
if (!NPC.AnyNPCs(ModContent.NPCType<OldDuke>()) &&
|
||||
CalamityUtils.CountProjectiles(ModContent.ProjectileType<OverlyDramaticDukeSummoner>()) <= 0)
|
||||
@@ -1033,7 +1063,9 @@ namespace CalamityMod.World
|
||||
}
|
||||
else
|
||||
{
|
||||
startAcidicDownpour = false;
|
||||
if (timeSinceAcidStarted != 0)
|
||||
timeSinceAcidStarted = 0;
|
||||
startAcidicDownpour = false;
|
||||
}
|
||||
|
||||
// Lumenyl crystal, tenebris spread and sea prism crystal spawn rates
|
||||
|
||||
Reference in new issue
Block a user