2 - Buffed DSA and DoG Lore by reducing the incrased damage taken. DSA went from 25% to 15% and DoG Lore went from 10% to 5%. 3 - Reduced Affliction damage boost by 2%. 4 - Trinket of Chi now gives its buff in 1 second instead of 2 seconds. 5 - Alchemical Flask and Plague Hive now disable the Plague debuff darkness effect. 6 - Increased Yharim's Insignia melee damage boost by 5%. 7 - Bloodworms have an increased chance to spawn and only spawn after the player has met the Old Duke at the end of the Acid Rain Tier 3. 8 - Amalgamated Brain damage boost decreased by 2% and the shade rain now triggers every 6 frames instead of at random. 9 - Void of Calamity now reduces damage reduction by 10% instead of 15% and the flames now rain down every 10 frames instead of at random. 10 - Heart of the Elements now boosts damage by 5% instead of 8% (7% if boobs are disabled). 11 - Rotten Brain now rains shade every 6 frames instead of at random. 12 - Amalgamated and Rotten Brain and Amalgam shade rain no longer penetrate. 13 - Samurai Badge downside removed. 14 - The Amalgam now rains shade and fire every 8 frames instead of at random. 15 - Void of Extinction rains fire down every 10 frames instead of at random. 16 - Removed Badge of Bravery from Yharim's Insignia recipe and Yharim's Insignia now takes Divine Geodes to craft. 17 - Buffed Galactus Blade damage by 25. 18 - Reduced Luxor's Gift projectile damage scaling values, the caps are still the same. 19 - Reduced Astrum Aureus HP by about 12.5%. 20 - Ceaseless Void Dark Energies now spread out. 21 - Desert Scourge out of desert enrage is more noticeable. 22 - DoG phase 1 and 2, Destroyer, Astrum Deus and Cosmic Guardians greatly increase speed when far away from their target. 23 - Hive Mind Hive Blobs die immediately when phase 1 dies. 24 - Leviathan and Anahita enrage is more noticeable. 25 - Plaguebringer Goliath Mines emit some light. 26 - Polter Clone turns invisible, aside from its glowmask, when it's lining up for its charge to convey that it doesn't deal contact damage. 27 - Ravager Flame Pillars spawn further away from the player. 28 - Detached Ravager Head stays further away from the player. 29 - SCal brothers move up and down more quickly. 30 - Cal Clone enrage is more noticeable. 31 - Astrum Aureus enrage is more noticeable. 32 - Made Eye of Cthulhu, Brain of Cthulhu, Twins and Eater of Worlds enrages more noticeable. 33 - Fixed Destroyer coiling issue. 34 - Destroyer changes color to purple during flight phase. 35 - Skeletron Prime rockets are slower. 36 - Moon Lord Phantasmal Eyes spawn slower and have a lower max velocity. 37 - Reduced damage of post-DoG moon enemies, post-Yharon eclipse enemies and post-ML dungeon enemies. 38 - Reduced many Cal Clone and Brimstone Elemental projectile-inflicted debuff durations. 39 - Cryogen projectiles turn blue during daytime. 40 - Made Ravager homing laser things hopefully more visible. 41 - Aegis Blade, Grand Guardian and Lion Heart true melee explosions deal less damage on each subsequent hit. 42 - Brimlash split projectiles home in quicker. 43 - Omage Biome Blade projectiles have less range. 44 - Death Mode Astral shader intensity reduced. 45 - Brimtone Elemental beam darts have larger gaps between them and now collide with tiles.
247 lines
12 KiB
C#
247 lines
12 KiB
C#
using CalamityMod.NPCs.AcidRain;
|
|
using CalamityMod.World;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
|
|
namespace CalamityMod.Events
|
|
{
|
|
public enum AcidRainSpawnRequirement
|
|
{
|
|
Water,
|
|
Land,
|
|
Anywhere
|
|
}
|
|
public struct AcidRainSpawnData
|
|
{
|
|
public int InvasionContributionPoints { get; set; }
|
|
public float SpawnRate { get; set; }
|
|
public AcidRainSpawnRequirement SpawnRequirement { get; set; }
|
|
public AcidRainSpawnData(int totalPoints, float spawnRate, AcidRainSpawnRequirement spawnRequirement)
|
|
{
|
|
InvasionContributionPoints = totalPoints;
|
|
SpawnRate = spawnRate;
|
|
SpawnRequirement = spawnRequirement;
|
|
}
|
|
}
|
|
public class AcidRainEvent
|
|
{
|
|
public static int MaxNuclearToadCount = 5; // To prevent the things from spamming. This happens frequently in pre-HM.
|
|
|
|
// 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.
|
|
public static Dictionary<int, AcidRainSpawnData> PossibleEnemiesPreHM = new Dictionary<int, AcidRainSpawnData>()
|
|
{
|
|
{ ModContent.NPCType<NuclearToad>(), new AcidRainSpawnData(1, 0.75f, AcidRainSpawnRequirement.Anywhere) },
|
|
{ ModContent.NPCType<AcidEel>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Radiator>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Skyfin>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<WaterLeech>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) }
|
|
};
|
|
|
|
// Note: Irradiated Slimes spawn naturally
|
|
public static Dictionary<int, AcidRainSpawnData> PossibleEnemiesAS = new Dictionary<int, AcidRainSpawnData>()
|
|
{
|
|
{ ModContent.NPCType<Radiator>(), new AcidRainSpawnData(0, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<AcidEel>(), new AcidRainSpawnData(0, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<NuclearToad>(), new AcidRainSpawnData(0, 0.75f, AcidRainSpawnRequirement.Anywhere) },
|
|
{ ModContent.NPCType<FlakCrab>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Orthocera>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Skyfin>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Trilobite>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<WaterLeech>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<SulfurousSkater>(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) }
|
|
};
|
|
|
|
public static Dictionary<int, AcidRainSpawnData> PossibleEnemiesPolter = new Dictionary<int, AcidRainSpawnData>()
|
|
{
|
|
{ ModContent.NPCType<Radiator>(), new AcidRainSpawnData(0, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<AcidEel>(), new AcidRainSpawnData(0, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<NuclearToad>(), new AcidRainSpawnData(0, 0.75f, AcidRainSpawnRequirement.Anywhere) },
|
|
{ ModContent.NPCType<FlakCrab>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Orthocera>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Skyfin>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<Trilobite>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<WaterLeech>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<SulfurousSkater>(), new AcidRainSpawnData(1, 0.4f, AcidRainSpawnRequirement.Anywhere) },
|
|
{ ModContent.NPCType<GammaSlime>(), new AcidRainSpawnData(1, 1f, AcidRainSpawnRequirement.Anywhere) }
|
|
};
|
|
|
|
public static Dictionary<int, AcidRainSpawnData> PossibleMinibossesAS = new Dictionary<int, AcidRainSpawnData>()
|
|
{
|
|
{ ModContent.NPCType<CragmawMire>(), new AcidRainSpawnData(5, 0.08f, AcidRainSpawnRequirement.Water) }
|
|
};
|
|
|
|
public static Dictionary<int, AcidRainSpawnData> PossibleMinibossesPolter = new Dictionary<int, AcidRainSpawnData>()
|
|
{
|
|
{ ModContent.NPCType<CragmawMire>(), new AcidRainSpawnData(4, 0.08f, AcidRainSpawnRequirement.Water) },
|
|
{ ModContent.NPCType<NuclearTerror>(), new AcidRainSpawnData(8, 0.05f, AcidRainSpawnRequirement.Anywhere) }
|
|
};
|
|
|
|
public static readonly List<int> AllMinibosses = PossibleMinibossesAS.Select(miniboss => miniboss.Key).ToList().Concat(PossibleMinibossesPolter.Select(miniboss => miniboss.Key)).Distinct().ToList();
|
|
|
|
public static bool AnyRainMinibosses
|
|
{
|
|
get
|
|
{
|
|
for (int i = 0; i < Main.npc.Length; i++)
|
|
{
|
|
if (Main.npc[i].active && (PossibleMinibossesAS.Select(miniboss => miniboss.Key).Contains(Main.npc[i].type) ||
|
|
PossibleMinibossesPolter.Select(miniboss => miniboss.Key).Contains(Main.npc[i].type)))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Broadcasts some text from a given localization key.
|
|
/// </summary>
|
|
/// <param name="localizationKey">The key to write</param>
|
|
public static void BroadcastEventText(string localizationKey) => CalamityUtils.DisplayLocalizedText(localizationKey, TextColor);
|
|
public static int NeededEnemyKills
|
|
{
|
|
get
|
|
{
|
|
int playerCount = 0;
|
|
for (int i = 0; i < Main.player.Length; i++)
|
|
{
|
|
if (Main.player[i].active)
|
|
{
|
|
playerCount++;
|
|
}
|
|
}
|
|
if (CalamityWorld.downedPolterghast)
|
|
return (int)(140 * Math.Log(playerCount + Math.E - 1));
|
|
else if (CalamityWorld.downedAquaticScourge)
|
|
return (int)(115 * Math.Log(playerCount + Math.E - 1));
|
|
else
|
|
return (int)(90 * Math.Log(playerCount + Math.E - 1));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Attempts to start the Acid Rain event. Will fail if there is another invasion or boss rush going on. It will also fail if the EoC, WoF, or AS has not been killed yet.
|
|
/// </summary>
|
|
public static void TryStartEvent(bool forceRain = false)
|
|
{
|
|
if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode && !CalamityWorld.downedAquaticScourge) || BossRushEvent.BossRushActive)
|
|
return;
|
|
int playerCount = 0;
|
|
for (int i = 0; i < Main.player.Length; i++)
|
|
{
|
|
if (Main.player[i].active)
|
|
{
|
|
playerCount++;
|
|
}
|
|
}
|
|
if (playerCount > 0)
|
|
{
|
|
CalamityWorld.rainingAcid = true;
|
|
CalamityWorld.acidRainPoints = NeededEnemyKills;
|
|
|
|
// Make it rain normally
|
|
if (forceRain)
|
|
{
|
|
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;
|
|
CalamityWorld.forcedDownpourWithTear = true;
|
|
CalamityNetcode.SyncWorld();
|
|
}
|
|
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!
|
|
}
|
|
/// <summary>
|
|
/// Updates the invasion, checking to see if it has ended.
|
|
/// </summary>
|
|
public static void UpdateInvasion(bool win = true)
|
|
{
|
|
// If the custom invasion is up
|
|
if (CalamityWorld.rainingAcid)
|
|
{
|
|
// End invasion if we've defeated all the enemies, including Old Duke
|
|
if (CalamityWorld.acidRainPoints <= 0)
|
|
{
|
|
CalamityWorld.rainingAcid = false;
|
|
BroadcastEventText("Mods.CalamityMod.AcidRainEnd"); // The sulphuric skies begin to clear...
|
|
CalamityWorld.acidRainExtraDrawTime = 40;
|
|
|
|
// Turn off the rain from the event
|
|
Main.numCloudsTemp = Main.rand.Next(5, 20 + 1);
|
|
Main.numClouds = Main.numCloudsTemp;
|
|
Main.windSpeedTemp = Main.rand.NextFloat(0.04f, 0.25f);
|
|
Main.windSpeedSet = Main.windSpeedTemp;
|
|
Main.maxRaining = 0f;
|
|
if (win)
|
|
{
|
|
CalamityWorld.downedEoCAcidRain = true;
|
|
CalamityWorld.downedAquaticScourgeAcidRain = CalamityWorld.downedAquaticScourge;
|
|
}
|
|
CalamityWorld.triedToSummonOldDuke = false;
|
|
CalamityMod.StopRain();
|
|
}
|
|
CalamityNetcode.SyncWorld();
|
|
|
|
// You will be tempted to turn this into a single if conditional.
|
|
// Don't do this. Doing so has caused so much misery, with various things being read instead
|
|
// of the correct thing, like booleans being mixed up in the sending and receiving process.
|
|
// In short, leave this alone.
|
|
if (Main.netMode == NetmodeID.Server)
|
|
{
|
|
var netMessage = CalamityMod.Instance.GetPacket();
|
|
netMessage.Write((byte)CalamityModMessageType.AcidRainSync);
|
|
netMessage.Write(CalamityWorld.rainingAcid);
|
|
netMessage.Write(CalamityWorld.acidRainPoints);
|
|
netMessage.Write(CalamityWorld.timeSinceAcidRainKill);
|
|
netMessage.Send();
|
|
}
|
|
if (Main.netMode == NetmodeID.Server)
|
|
{
|
|
var netMessage = CalamityMod.Instance.GetPacket();
|
|
netMessage.Write((byte)CalamityModMessageType.AcidRainUIDrawFadeSync);
|
|
netMessage.Write(CalamityWorld.acidRainExtraDrawTime);
|
|
netMessage.Send();
|
|
}
|
|
if (Main.netMode == NetmodeID.Server)
|
|
{
|
|
var netMessage = CalamityMod.Instance.GetPacket();
|
|
netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync);
|
|
netMessage.Write(CalamityWorld.triedToSummonOldDuke);
|
|
netMessage.Send();
|
|
}
|
|
if (Main.netMode == NetmodeID.Server)
|
|
{
|
|
var netMessage = CalamityMod.Instance.GetPacket();
|
|
netMessage.Write((byte)CalamityModMessageType.EncounteredOldDukeSync);
|
|
netMessage.Write(CalamityWorld.encounteredOldDuke);
|
|
netMessage.Send();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|