using System; using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Summon; using CalamityMod.Cooldowns; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.SummonItems; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; using CalamityMod.Particles; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Summon.Umbrella; using CalamityMod.Systems; using CalamityMod.UI; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.IO; using Terraria.Localization; using Terraria.ModLoader; using static CalamityMod.Downed; using static Terraria.ModLoader.ModContent; namespace CalamityMod { internal class Downed { public static readonly Func DownedDesertScourge = () => DownedBossSystem.downedDesertScourge; public static readonly Func DownedGiantClam = () => DownedBossSystem.downedCLAM; public static readonly Func DownedCrabulon = () => DownedBossSystem.downedCrabulon; public static readonly Func DownedHiveMind = () => DownedBossSystem.downedHiveMind; public static readonly Func DownedPerforators = () => DownedBossSystem.downedPerforator; public static readonly Func DownedSlimeGod = () => DownedBossSystem.downedSlimeGod; public static readonly Func DownedCryogen = () => DownedBossSystem.downedCryogen; public static readonly Func DownedBrimstoneElemental = () => DownedBossSystem.downedBrimstoneElemental; public static readonly Func DownedAquaticScourge = () => DownedBossSystem.downedAquaticScourge; public static readonly Func DownedCragmawMire = () => DownedBossSystem.downedCragmawMire; public static readonly Func DownedCalClone = () => DownedBossSystem.downedCalamitasClone; // This function is not used anywhere in Calamity, but to be safe, don't remove it. Other mods may depend on it existing. public static readonly Func NotDownedCalClone = () => !DownedBossSystem.downedCalamitasClone; public static readonly Func DownedGSS = () => DownedBossSystem.downedGSS; public static readonly Func DownedLeviathan = () => DownedBossSystem.downedLeviathan; public static readonly Func DownedAureus = () => DownedBossSystem.downedAstrumAureus; public static readonly Func DownedPBG = () => DownedBossSystem.downedPlaguebringer; public static readonly Func DownedRavager = () => DownedBossSystem.downedRavager; public static readonly Func DownedDeus = () => DownedBossSystem.downedAstrumDeus; public static readonly Func DownedGuardians = () => DownedBossSystem.downedGuardians; public static readonly Func DownedDragonfolly = () => DownedBossSystem.downedDragonfolly; public static readonly Func DownedProvidence = () => DownedBossSystem.downedProvidence; public static readonly Func DownedCeaselessVoid = () => DownedBossSystem.downedCeaselessVoid; public static readonly Func DownedStormWeaver = () => DownedBossSystem.downedStormWeaver; public static readonly Func DownedSignus = () => DownedBossSystem.downedSignus; public static readonly Func DownedPolterghast = () => DownedBossSystem.downedPolterghast; public static readonly Func DownedMauler = () => DownedBossSystem.downedMauler; public static readonly Func DownedNuclearTerror = () => DownedBossSystem.downedNuclearTerror; public static readonly Func DownedOldDuke = () => DownedBossSystem.downedBoomerDuke; public static readonly Func DownedDoG = () => DownedBossSystem.downedDoG; public static readonly Func DownedYharon = () => DownedBossSystem.downedYharon; public static readonly Func DownedExoMechs = () => DownedBossSystem.downedExoMechs; public static readonly Func DownedCalamitas = () => DownedBossSystem.downedCalamitas; public static readonly Func DownedPrimordialWyrm = () => DownedBossSystem.downedPrimordialWyrm; public static readonly Func DownedAcidRainInitial = () => DownedBossSystem.downedEoCAcidRain; public static readonly Func DownedAcidRainHardmode = () => DownedBossSystem.downedAquaticScourgeAcidRain; // T3 Acid Rain is considered beaten when you beat Old Duke public static readonly Func DownedBossRush = () => DownedBossSystem.downedBossRush; } internal class WeakReferenceSupport { public const string CalamityWikiURLOld = "calamitymod.wiki.gg"; public const string CalamityWikiURL = "https://calamitymod.wiki.gg/wiki/{}"; private const string loreItemPage = "Lore#Lore_Items"; /// /// Vanilla main bosses:
/// 1.0 = King Slime
/// 2.0 = Eye of Cthulhu
/// 3.0 = Eater of Worlds / Brain of Cthulhu
/// 4.0 = Queen Bee
/// 5.0 = Skeletron
/// 6.0 = Deerclops
/// 7.0 = Wall of Flesh
/// 8.0 = Queen Slime
/// 9.0 = The Twins
/// 10.0 = The Destroyer
/// 11.0 = Skeletron Prime
/// 12.0 = Plantera
/// 13.0 = Golem
/// 14.0 = Duke Fishron
/// 15.0 = Empress of Light
/// 16.0 = Betsy
/// 17.0 = Lunatic Cultist
/// 18.0 = Moon Lord ///
private static readonly Dictionary BossChecklistProgressionValues = new() { { "DesertScourge", 1.6f }, { "GiantClam", 1.61f }, { "AcidRainT1", 2.67f }, { "Crabulon", 2.7f }, { "HiveMind", 3.98f }, { "Perforators", 3.99f }, { "SlimeGod", 6.7f }, // Thorium Granite Energy Storm is 6.4f, Buried Champion is 6.5f, and Star Scouter is 6.9f { "Cryogen", 8.5f }, { "AquaticScourge", 9.5f }, { "AcidRainT2", 9.51f }, { "CragmawMire", 9.52f }, { "BrimstoneElemental", 10.5f }, { "CalamitasClone", 11.7f }, // Thorium Lich is 11.6f { "GreatSandShark", 12.09f }, { "Leviathan", 12.8f }, { "AstrumAureus", 12.81f }, { "PlaguebringerGoliath", 14.5f }, { "Ravager", 16.5f }, { "AstrumDeus", 17.5f }, { "ProfanedGuardians", 18.5f }, { "Dragonfolly", 18.6f }, { "Providence", 19f }, // Thorium Primordials (Ragnarok) is 19.5f { "CeaselessVoid", 19.6f }, { "StormWeaver", 19.61f }, { "Signus", 19.62f }, { "Polterghast", 20f }, { "AcidRainT3", 20.49f }, { "Mauler", 20.491f }, { "NuclearTerror", 20.492f }, { "OldDuke", 20.5f }, { "DevourerofGods", 21f }, { "Yharon", 22f }, { "ExoMechs", 22.99f }, { "Calamitas", 23f }, // { "PrimordialWyrm", 23.5f }, { "BossRush", 25.99f }, // { "Yharim", 24f }, // { "Noxus", 25f }, // { "Xeroc", 26f }, }; public static void Setup() { BossChecklistSupport(); FargosSupport(); DialogueTweakSupport(); SummonersAssociationSupport(); ColoredDamageTypesSupport(); LuminanceSupport(); // done here to assure that all other mods have already loaded so that Calamity can automatically grab any of these types they may have if (!Main.dedServ) { GeneralParticleHandler.LoadModParticleInstances(); CooldownRegistry.RegisterModCooldowns(); PopupGUIManager.LoadGUIs(); } } #region BiomeLava public static void LavaStytleToBiomeLava() { CalamityMod calamity = GetInstance(); Mod biomelava = calamity.biomeLava; if (biomelava == null) return; foreach (ModLavaStyle item in LavaStylesLoader.Content) { int type = item.Slot; ModLavaStyle lavaStyle = LavaStylesLoader.Get(type); if (lavaStyle != null) { Func GetSplashDust = lavaStyle.GetSplashDust; Func GetDropletGore = lavaStyle.GetDropletGore; Func ModifyLightFunc = ModifyLight; Func IsLavaActive = lavaStyle.IsLavaActive; Func lavafallGlowmask = lavaStyle.LavafallGlowmask; Func InflictDebuffFunc = InflictDebuff; Func yes = InflictsOnFire; Vector3 ModifyLight(int x, int y, float r, float g, float b) { lavaStyle.ModifyLight(x, y, ref r, ref g, ref b); return new Vector3(r, g, b); } Action InflictDebuff(Player player, NPC npc, int onfireDuration) { if (player != null && npc == null) { lavaStyle.InflictDebuff(player, onfireDuration); } return null; } bool InflictsOnFire() { return true; } biomelava.Call("ModLavaStyle", calamity, lavaStyle.Name, lavaStyle.Texture, lavaStyle.BlockTexture, lavaStyle.SlopeTexture, lavaStyle.WaterfallTexture, GetSplashDust, GetDropletGore, ModifyLightFunc, IsLavaActive, lavafallGlowmask, InflictDebuffFunc, yes); } } } #endregion #region WikiThis // This is a separate function because it only runs clientside public static void WikiThisSupport() { // Wikithis is a clientside mod if (Main.netMode == NetmodeID.Server) return; CalamityMod calamity = GetInstance(); Mod wiki = calamity.wikithis; if (wiki is null) return; bool oldVersion = wiki.Version < new Version(2, 4, 7, 5); wiki.Call("AddModURL", calamity, oldVersion ? CalamityWikiURLOld : CalamityWikiURL); wiki.Call(0, calamity, oldVersion ? CalamityWikiURLOld : CalamityWikiURL); wiki.Call("AddWikiTexture", calamity, Request("CalamityMod/ModSupport/WikiThisIcon")); wiki.Call(3, calamity, Request("CalamityMod/ModSupport/WikiThisIcon")); // Clear up name conflicts void ItemRedirect(int item, string pageName) => wiki.Call(1, item, pageName); void EnemyRedirect(int item, string pageName) => wiki.Call(2, item, pageName); // Items ItemRedirect(ItemType(), "Blood Orange (calamity)"); ItemRedirect(ItemType(), "Elderberry (calamity)"); ItemRedirect(ItemType(), "Pineapple (calamity)"); ItemRedirect(ItemType(), "Trash Can (pet)"); ItemRedirect(ItemType(), "Sandstorm (weapon)"); ItemRedirect(ItemType(), "Thunderstorm (weapon)"); // Lore items ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); ItemRedirect(ItemType(), loreItemPage); // Enemies EnemyRedirect(NPCType(), "Hive (enemy)"); EnemyRedirect(NPCType(), "Crown Jewels"); EnemyRedirect(NPCType(), "Crown Jewels"); EnemyRedirect(NPCType(), "Crown Jewels"); EnemyRedirect(NPCType(), "Tooth Ball (Old Duke)"); EnemyRedirect(NPCType(), "Enchantment"); EnemyRedirect(NPCType(), "%3F%3F%3F"); } #endregion #region Subworld Library // Wrapper function to detect if a subworld is in use for Subworld Library. internal static bool InAnySubworld() { if (CalamityMod.Instance.subworldLibrary is null) return false; foreach (Mod mod in ModLoader.Mods) { if (mod.Name.Equals(CalamityMod.Instance.subworldLibrary.Name)) continue; bool anySubworldForMod = (CalamityMod.Instance.subworldLibrary.Call("AnyActive", mod) as bool?) ?? false; if (anySubworldForMod) return true; } return false; } #endregion #region Boss Checklist // Wrapper function to add bosses to Boss Checklist. private static void AddBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, Func downed, object npcTypes, Dictionary extraInfo) => bossChecklist.Call("LogBoss", hostMod, name, difficulty, downed, npcTypes, extraInfo); // Wrapper function to add minibosses to Boss Checklist. private static void AddMiniBoss(Mod bossChecklist, Mod hostMod, string name, float difficulty, Func downed, int npcType, Dictionary extraInfo) => bossChecklist.Call("LogMiniBoss", hostMod, name, difficulty, downed, npcType, extraInfo); // Wrapper function to add events to Boss Checklist. private static void AddEvent(Mod bossChecklist, Mod hostMod, string name, float difficulty, Func downed, List npcTypes, Dictionary extraInfo) => bossChecklist.Call("LogEvent", hostMod, name, difficulty, downed, npcTypes, extraInfo); // Shorthands to grab localization keys for Boss Checklist entries. private static LocalizedText GetDisplayName(string entryName) => CalamityUtils.GetText($"BossChecklistIntegration.{entryName}.EntryName"); private static LocalizedText GetSpawnInfo(string entryName) => CalamityUtils.GetText($"BossChecklistIntegration.{entryName}.SpawnInfo"); private static LocalizedText GetDespawnMessage(string entryName) => CalamityUtils.GetText($"BossChecklistIntegration.{entryName}.DespawnMessage"); private static void BossChecklistSupport() { CalamityMod calamity = GetInstance(); Mod bossChecklist = calamity.bossChecklist; if (bossChecklist is null) return; // Adds every single Calamity boss and miniboss to Boss Checklist's Boss Log. AddCalamityBosses(bossChecklist, calamity); // Adds every single Calamity invasion to the Boss Checklist's Invasion Log. AddCalamityEvents(bossChecklist, calamity); // Registers Calamity's special loot (ie. Lore items) and alternate spawn items to Boss Checklist's Boss Log. RegisterCalamityExtraInfo(bossChecklist, calamity); } #region Boss Checklist: Bosses and Minibosses private static void AddCalamityBosses(Mod bossChecklist, Mod calamity) { // Desert Scourge { string entryName = "DesertScourge"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/DesertScourge/DesertScourge_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedDesertScourge, segments, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Giant Clam { string entryName = "GiantClam"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType() }; AddMiniBoss(bossChecklist, calamity, entryName, order, DownedGiantClam, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["collectibles"] = collection }); } // Crabulon { string entryName = "Crabulon"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedCrabulon, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Hive Mind { string entryName = "HiveMind"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); Func IsCorruption = () => !WorldGen.crimson || Main.drunkWorld; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedHiveMind, type, new Dictionary() { ["availability"] = IsCorruption, ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["overrideHeadTextures"] = "CalamityMod/NPCs/HiveMind/HiveMindP2_Head_Boss" }); } // Perforators { string entryName = "Perforators"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); Func IsCrimson = () => WorldGen.crimson || Main.drunkWorld; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedPerforators, type, new Dictionary() { ["availability"] = IsCrimson, ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["displayName"] = GetDisplayName(entryName), }); } // Slime God { string entryName = "SlimeGod"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedSlimeGod, bosses, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Cryogen { string entryName = "Cryogen"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedCryogen, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["overrideHeadTextures"] = "CalamityMod/NPCs/Cryogen/Cryogen_Phase1_Head_Boss" }); } // Aquatic Scourge { string entryName = "AquaticScourge"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedAquaticScourge, segments, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Cragmaw Mire { string entryName = "CragmawMire"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType() }; AddMiniBoss(bossChecklist, calamity, entryName, order, DownedCragmawMire, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["availability"] = DownedAcidRainInitial }); } // Brimstone Elemental { string entryName = "BrimstoneElemental"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedBrimstoneElemental, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Calamitas Clone { string entryName = "CalamitasClone"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedCalClone, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Great Sand Shark { string entryName = "GreatSandShark"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemID.MusicBoxSandstorm }; AddMiniBoss(bossChecklist, calamity, entryName, order, DownedGSS, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Anahita and Leviathan { string entryName = "Leviathan"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/Leviathan/AnahitaLevi_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedLeviathan, bosses, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Astrum Aureus { string entryName = "AstrumAureus"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedAureus, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Plaguebringer Goliath { string entryName = "PlaguebringerGoliath"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/PlaguebringerGoliath/PlaguebringerGoliath_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedPBG, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Ravager { string entryName = "Ravager"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/Ravager/Ravager_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedRavager, segments, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Astrum Deus { string entryName = "AstrumDeus"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; List summons = new List() { ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/AstrumDeus/AstrumDeus_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedDeus, segments, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = summons, ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Profaned Guardians { string entryName = "ProfanedGuardians"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardians_BossChecklist").Value; float scale = 0.7f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddBoss(bossChecklist, calamity, entryName, order, DownedGuardians, type, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/NPCs/ProfanedGuardians/ProfanedGuardianCommander_Head_Boss" }); } // Dragonfolly { string entryName = "Dragonfolly"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedDragonfolly, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Providence { string entryName = "Providence"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/Providence/Providence_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedProvidence, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Ceaseless Void { string entryName = "CeaselessVoid"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedCeaselessVoid, bosses, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Storm Weaver { string entryName = "StormWeaver"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List segments = new List() { NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedStormWeaver, segments, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/NPCs/StormWeaver/StormWeaverHead_Head_Boss" }); } // Signus { string entryName = "Signus"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedSignus, type, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Polterghast { string entryName = "Polterghast"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedPolterghast, bosses, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Mauler { string entryName = "Mauler"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType() }; AddMiniBoss(bossChecklist, calamity, entryName, order, DownedMauler, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["availability"] = DownedAcidRainHardmode }); } // Nuclear Terror { string entryName = "NuclearTerror"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType() }; AddMiniBoss(bossChecklist, calamity, entryName, order, DownedNuclearTerror, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["availability"] = DownedAcidRainHardmode }); } // Old Duke { string entryName = "OldDuke"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedOldDuke, type, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Devourer of Gods { string entryName = "DevourerofGods"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist").Value; Vector2 centered = new Vector2(rect.Center.X - (texture.Width / 2), rect.Center.Y - (texture.Height / 2)); sb.Draw(texture, centered, color); }; AddBoss(bossChecklist, calamity, entryName, order, DownedDoG, type, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss" }); } // Yharon { string entryName = "Yharon"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedYharon, type, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), ["collectibles"] = collection }); } // Exo Mechs { string entryName = "ExoMechs"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist").Value; float scale = 0.7f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddBoss(bossChecklist, calamity, entryName, order, DownedExoMechs, bosses, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["collectibles"] = collection, ["customPortrait"] = portrait }); } // Calamitas { string entryName = "Calamitas"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); List summons = new List() { ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedCalamitas, type, new Dictionary() { ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = summons, ["collectibles"] = collection, ["overrideHeadTextures"] = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon" }); } } #endregion #region Boss Checklist: Events and Invasions private static void AddCalamityEvents(Mod bossChecklist, Mod calamity) { // Initial Acid Rain { string entryName = "AcidRainT1"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = AcidRainEvent.PossibleEnemiesPreHM.Select(enemy => enemy.Key).ToList(); Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/Events/AcidRainT1_BossChecklist").Value; float scale = 1f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddEvent(bossChecklist, calamity, entryName, order, DownedAcidRainInitial, enemies, new Dictionary() { ["spawnItems"] = ItemType(), ["collectibles"] = ItemType(), ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/UI/MiscTextures/AcidRainIcon" }); } // Post-Aquatic Scourge Acid Rain { string entryName = "AcidRainT2"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = AcidRainEvent.PossibleEnemiesAS.Select(enemy => enemy.Key).ToList(); enemies.Add(NPCType()); enemies.AddRange(AcidRainEvent.PossibleMinibossesAS.Select(miniboss => miniboss.Key)); List collection = new List() { ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/Events/AcidRainT2_BossChecklist").Value; float scale = 0.9f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddEvent(bossChecklist, calamity, entryName, order, DownedAcidRainHardmode, enemies, new Dictionary() { ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/UI/MiscTextures/AcidRainIcon", ["availability"] = DownedAcidRainInitial }); } // Post-Polterghast Acid Rain { string entryName = "AcidRainT3"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = AcidRainEvent.PossibleEnemiesPolter.Select(enemy => enemy.Key).ToList(); enemies.AddRange(AcidRainEvent.PossibleMinibossesPolter.Select(miniboss => miniboss.Key)); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/Events/AcidRainT3_BossChecklist").Value; float scale = 0.9f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddEvent(bossChecklist, calamity, entryName, order, DownedOldDuke, enemies, new Dictionary() { ["spawnItems"] = ItemType(), ["collectibles"] = collection, ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/UI/MiscTextures/AcidRainIcon", ["availability"] = DownedAcidRainHardmode }); } // Boss Rush { string entryName = "BossRush"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); List enemies = new List() { NPCID.None }; // This is for loot purposes, which no bosses give during the event Action portrait = (SpriteBatch sb, Rectangle rect, Color color) => { Texture2D texture = Request("CalamityMod/Skies/XerocEye").Value; float scale = 0.5f; Vector2 centered = new Vector2(rect.Center.X - texture.Width * scale / 2, rect.Center.Y - texture.Height * scale / 2); sb.Draw(texture, centered, null, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); }; AddEvent(bossChecklist, calamity, entryName, order, DownedBossRush, enemies, new Dictionary() { ["spawnItems"] = ItemType(), ["collectibles"] = ItemType(), ["customPortrait"] = portrait, ["overrideHeadTextures"] = "CalamityMod/UI/MiscTextures/BossRushIcon" }); } } #endregion #region Boss Checklist: Vanilla Edits private static void RegisterCalamityExtraInfo(Mod bossChecklist, Mod calamity) { // Calamity spawn items which spawn vanilla bosses. bossChecklist.Call("SubmitEntrySpawnItems", calamity, new Dictionary() { { "Terraria Plantera", ItemType() }, { "Terraria Golem", ItemType() }, { "Terraria CultistBoss", ItemType() } }); // Collectibles which drop from vanilla bosses. // These are lore items, Hermit's Box, and the thank you painting. bossChecklist.Call("SubmitEntryCollectibles", calamity, new Dictionary() { { "Terraria KingSlime", new List() { ItemType(), ItemType() } }, { "Terraria EyeofCthulhu", new List() { ItemType(), ItemType() } }, { "Terraria EaterofWorlds", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria BrainofCthulhu", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria QueenBee", new List() { ItemType(), ItemType() } }, { "Terraria Skeletron", new List() { ItemType(), ItemType() } }, { "Terraria WallofFlesh", new List() { ItemType(), ItemType(), ItemType(), ItemType() } }, { "Terraria QueenSlimeBoss", new List() { ItemType(), ItemType() } }, { "Terraria TheTwins", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria TheDestroyer", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria SkeletronPrime", new List() { ItemType(), ItemType(), ItemType() } }, { "Terraria Plantera", new List() { ItemType(), ItemType() } }, { "Terraria Golem", new List() { ItemType(), ItemType() } }, { "Terraria HallowBoss", new List() { ItemType(), ItemType() } }, { "Terraria DukeFishron", new List() { ItemType(), ItemType() } }, { "Terraria CultistBoss", new List() { ItemType(), ItemType() } }, { "Terraria MoonLord", new List() { ItemType(), ItemType() } } }); } #endregion #endregion #region Fargo's Mutant Mod private static void FargosSupport() { Mod fargos = GetInstance().fargos; if (fargos is null) return; // Stat Sheet support double Damage(DamageClass damageClass) => Math.Round(Main.LocalPlayer.GetTotalDamage(damageClass).Additive * Main.LocalPlayer.GetTotalDamage(damageClass).Multiplicative * 100 - 100); int Crit(DamageClass damageClass) => (int)Main.LocalPlayer.GetTotalCritChance(damageClass); int rogueItem = ModContent.ItemType(); DamageClass rogueDamageClass = ModContent.GetInstance(); Func rogueDamage = () => $"Rogue Damage: {Damage(rogueDamageClass)}%"; Func rogueCrit = () => $"Rogue Critical: {Crit(rogueDamageClass)}%"; fargos.Call("AddStat", rogueItem, rogueDamage); fargos.Call("AddStat", rogueItem, rogueCrit); void AddToMutantShop(string bossName, string summonItemName, Func downed, int price) { BossChecklistProgressionValues.TryGetValue(bossName, out float order); fargos.Call("AddSummon", order, "CalamityMod", summonItemName, downed, price); } fargos.Call("AbominationnClearEvents", "CalamityMod", AcidRainEvent.AcidRainEventIsOngoing, true); AddToMutantShop("OldDuke", "BloodwormItem", DownedOldDuke, Item.buyPrice(platinum: 2)); } #endregion #region Dialogue Tweaks private static void DialogueTweakSupport() { Mod dialogueMod = GetInstance().dialogueTweak; if (dialogueMod != null) { dialogueMod.Call("ReplaceShopButtonIcon", NPCType(), "Head"); } } #endregion #region Summoner's Association private static void SummonersAssociationSupport() { Mod sAssociation = GetInstance().summonersAssociation; if (sAssociation is null) return; void RegisterSummon(int summonItem, int summonBuff, int summonProjectile) { sAssociation.Call("AddMinionInfo", summonItem, summonBuff, summonProjectile); } RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List> { new Dictionary() { ["ProjID"] = ProjectileType(), ["Slot"] = 1-(1f/3f) }, new Dictionary() { ["ProjID"] = ProjectileType(), ["Slot"] = 2f/3f }, new Dictionary() { ["ProjID"] = ProjectileType(), ["Slot"] = 2f/3f } }); //Entropy's Vigil is a bruh moment sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List> { new Dictionary() { ["ProjID"] = ProjectileType() }, new Dictionary() { ["ProjID"] = ProjectileType() } }); sAssociation.Call("AddMinionInfo", ItemType(), BuffType(), new List> { new Dictionary() { ["ProjID"] = ProjectileType() }, new Dictionary() { ["ProjID"] = ProjectileType() } }); } #endregion #region Colored Damage Types // These are vanilla Terraria's colors for tooltips and damage private static Color DefaultTooltipColor = Color.White; private static Color DefaultDamageColor = new(255, 160, 80); private static Color DefaultCritColor = new(255, 100, 30); // These are Colored Damage Types' colors for the Melee class private static Color MeleeTooltipColor = new(254, 121, 2); private static Color MeleeDamageColor = new(254, 121, 2); private static Color MeleeCritColor = new(253, 62, 3); private static Color RogueTooltipColor = new(206, 132, 227); private static Color RogueDamageColor = new(206, 132, 227); private static Color RogueCritColor = new(194, 38, 212); private static Color StealthTooltipColor = RogueTooltipColor; private static Color StealthDamageColor = new(185, 105, 250); private static Color StealthCritColor = new(144, 33, 235); public static void ColoredDamageTypesSupport() { Mod coloredDamageTypes = GetInstance().coloredDamageTypes; if (coloredDamageTypes is null) return; // Anything that directly uses AverageDamageClass uses the default vanilla colors. coloredDamageTypes.Call("AddDamageType", AverageDamageClass.Instance, DefaultTooltipColor, DefaultDamageColor, DefaultCritColor); // True melee uses the same colorations as regular Melee. coloredDamageTypes.Call("AddDamageType", TrueMeleeDamageClass.Instance, MeleeTooltipColor, MeleeDamageColor, MeleeCritColor); coloredDamageTypes.Call("AddDamageType", TrueMeleeNoSpeedDamageClass.Instance, MeleeTooltipColor, MeleeDamageColor, MeleeCritColor); // Rogue has its own lavender color. Stealth strikes are hued towards violet so they stick out more. // They would be hued towards magenta, but that would make them collide with Nebula-colored Magic in Colored Damage Types config. coloredDamageTypes.Call("AddDamageType", RogueDamageClass.Instance, RogueTooltipColor, RogueDamageColor, RogueCritColor); coloredDamageTypes.Call("AddDamageType", StealthDamageClass.Instance, StealthTooltipColor, StealthDamageColor, StealthCritColor); } #endregion #region Luminance private static void RegisterWorldInfoIcon(Mod luminance, string texturePath, string hoverTextKey, Func shouldAppear, byte priority) => luminance.Call("RegisterWorldInfoIcon", texturePath, hoverTextKey, shouldAppear, priority); public static void LuminanceSupport() { Mod luminance = GetInstance().luminance; if (luminance is null) return; Func deathEnabled = data => { if (!data.TryGetHeaderData(out var tagData)) return false; return tagData.ContainsKey("DeathMode") && tagData.GetBool("DeathMode"); }; Func revengeanceEnabled = data => { if (!data.TryGetHeaderData(out var tagData)) return false; return tagData.ContainsKey("RevengeanceMode") && tagData.GetBool("RevengeanceMode") && !(tagData.ContainsKey("DeathMode") && tagData.GetBool("DeathMode")); }; RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Death", "Mods.CalamityMod.UI.DeathEnabled", deathEnabled, 50); RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Rev", "Mods.CalamityMod.UI.RevengeanceEnabled", revengeanceEnabled, 50); } #endregion } }