diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index bc5e77636c..5162067c07 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1413,13 +1413,7 @@ namespace CalamityMod.CalPlayer percentMaxLifeIncrease += 10; if (community) - { - float BoostAtZeroBosses = 0.05f; - float BoostPostYharon = 0.2f; - float floatTypeBoost = MathHelper.Lerp(BoostAtZeroBosses, BoostPostYharon, TheCommunity.CalculatePower()); - int integerTypeBoost = (int)(floatTypeBoost * 50f); - percentMaxLifeIncrease += integerTypeBoost; - } + percentMaxLifeIncrease += (int)(TheCommunity.CalculatePower() * TheCommunity.HealthMultiplier); // Shattered Community gives the same max health boost as normal full-power Community (10%) if (shatteredCommunity) @@ -7016,7 +7010,7 @@ namespace CalamityMod.CalPlayer double ratioToUse = DefenseDamageRatio; if (draedonsHeart) - ratioToUse *= 0.5; + ratioToUse *= DraedonsHeart.DefenseDamageMultiplier; // Calculate the defense damage taken from this hit. int defenseDamageTaken = (int)(damage * ratioToUse); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 029ff4babb..b281824a10 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -740,18 +740,12 @@ namespace CalamityMod.CalPlayer if (community) { - float BoostAtZeroBosses = 0.05f; - float BoostPostYharon = 0.2f; - float floatTypeBoost = MathHelper.Lerp(BoostAtZeroBosses, BoostPostYharon, TheCommunity.CalculatePower()); - int integerTypeBoost = (int)(floatTypeBoost * 50f); - int regenBoost = 1 + (integerTypeBoost / 5); + int regenBoost = 1 + (int)(TheCommunity.CalculatePower() * TheCommunity.RegenMultiplier); bool lesserEffect = false; for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - bool shouldAffect = CalamityLists.alcoholList.Contains(hasBuff); - if (shouldAffect) - lesserEffect = true; + lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); } if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index edce2a57ad..68efa50ebf 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2658,22 +2658,15 @@ namespace CalamityMod.CalPlayer if (blueCandle) Player.moveSpeed += 0.1f; - // TODO -- crit is a float now, and knockback can be boosted for all classes if (community) { - float BoostAtZeroBosses = 0.05f; - float BoostPostYharon = 0.2f; - float floatTypeBoost = MathHelper.Lerp(BoostAtZeroBosses, BoostPostYharon, TheCommunity.CalculatePower()); - int integerTypeBoost = (int)(floatTypeBoost * 50f); - int critBoost = integerTypeBoost / 2; - float damageBoost = floatTypeBoost * 0.5f; - Player.endurance += floatTypeBoost * 0.25f; - Player.statDefense += integerTypeBoost; - Player.GetDamage() += damageBoost; - Player.GetCritChance() += critBoost; - Player.GetKnockback() += floatTypeBoost; - Player.moveSpeed += floatTypeBoost * 0.5f; - flightTimeMult += floatTypeBoost; + float baseBoost = TheCommunity.CalculatePower(); + Player.endurance += baseBoost * TheCommunity.DRMultiplier; + Player.statDefense += (int)(baseBoost * TheCommunity.DefenseMultiplier); + Player.GetDamage() += baseBoost * TheCommunity.DamageMultiplier; + Player.GetCritChance() += baseBoost * TheCommunity.CritMultiplier; + Player.moveSpeed += baseBoost * TheCommunity.SpeedMultiplier; + flightTimeMult += baseBoost * TheCommunity.FlightMultiplier; } // Shattered Community gives the same wing time boost as normal Community if (shatteredCommunity) @@ -2910,7 +2903,7 @@ namespace CalamityMod.CalPlayer if (yInsignia) { - Player.GetDamage() += 0.1f; + Player.GetDamage() += 0.15f; if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) Player.GetDamage() += 0.1f; } diff --git a/CalamityMod.cs b/CalamityMod.cs index c1930408e4..b9a63989fa 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -151,7 +151,6 @@ namespace CalamityMod internal Mod ancientsAwakened = null; internal Mod bossChecklist = null; - internal Mod census = null; internal Mod crouchMod = null; internal Mod dialogueTweak = null; internal Mod fargos = null; @@ -182,8 +181,6 @@ namespace CalamityMod ModLoader.TryGetMod("AAMod", out ancientsAwakened); bossChecklist = null; ModLoader.TryGetMod("BossChecklist", out bossChecklist); - census = null; - ModLoader.TryGetMod("Census", out census); crouchMod = null; ModLoader.TryGetMod("CrouchMod", out crouchMod); dialogueTweak = null; @@ -422,7 +419,6 @@ namespace CalamityMod ancientsAwakened = null; bossChecklist = null; - census = null; crouchMod = null; dialogueTweak = null; fargos = null; diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index c3c99b5821..7c5517f380 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -654,6 +654,7 @@ namespace CalamityMod { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 54, 96, 136, 152, 210 } }, // 144 in non-rev master mode { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 62, 108, 160, 176, 234 } }, // 162 in non-rev master mode { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, + { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 176, 234 } }, { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossRainbowStreak), new int[] { 90, 120, 160, 176, 234 } }, { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenSunDance), new int[] { 100, 140, 184, 200, 270 } }, diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 2e77102ae5..5b9c0bd473 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -9,6 +9,20 @@ namespace CalamityMod.ILEditing { public partial class ILChanges { + #region Rod of Harmony Changes + + private static bool ChangeRodOfHarmonyShimmerRequirement(On_Item.orig_CanShimmer orig, Item item) + { + //Rod of Harmony requires Draedong and SCal dead instead of Moon Lord. + if (item.type == ItemID.RodofDiscord) + { + return DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs; + } + return orig(item); + } + + #endregion + #region Soaring Insignia Changes private static void RemoveSoaringInsigniaInfiniteWingTime(ILContext il) { diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index ccd01ddf82..1ed0654dfc 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -118,6 +118,7 @@ namespace CalamityMod.ILEditing IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; + On_Item.CanShimmer += ChangeRodOfHarmonyShimmerRequirement; // TODO -- Beat Lava Slimes once and for all // IL.Terraria.NPC.VanillaHitEffect += RemoveLavaDropsFromExpertLavaSlimes; @@ -144,6 +145,7 @@ namespace CalamityMod.ILEditing { VanillaSpawnTownNPCs = null; labDoorOpen = labDoorClosed = aLabDoorOpen = aLabDoorClosed = exoDoorClosed = exoDoorOpen = -1; + On_Item.CanShimmer -= ChangeRodOfHarmonyShimmerRequirement; } } } diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index 6f9cc997b7..a4817de3e4 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -3,7 +3,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -27,15 +26,7 @@ namespace CalamityMod.Items.Accessories Item.Calamity().devItem = true; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.AngelicAllianceHotKey.TooltipHotkeyString(); - - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip4"); - - if (line != null) - line.Text = "Press " + hotkey + " to grace yourself in divinity for 15 seconds"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AngelicAllianceHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 4eaaf6b997..cbfea5be52 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -5,7 +5,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,14 +27,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ModContent.RarityType(); } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.AegisHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip5"); - - if (line != null) - line.Text = "Press " + hotkey + " to activate buffs to all damage, crit chance, and defense"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AegisHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index fe1cb3df6b..c5b266e111 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -3,7 +3,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,14 +22,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ModContent.RarityType(); } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.AstralArcanumUIHotkey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); - - if (line != null) - line.Text = "Press " + hotkey + " to toggle teleportation UI while no bosses are alive"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AstralArcanumUIHotkey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 84f83b2e3a..8f7caa4dbd 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -32,14 +31,7 @@ namespace CalamityMod.Items.Accessories player.Calamity().stealthGenMoving += 0.1f; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.PlaguePackHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); - - if (line != null) - line.Text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of lightning bolts"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.PlaguePackHotKey); public override void AddRecipes() { diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index 910d2730a3..565496846d 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -22,14 +21,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.AstralTeleportHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); - - if (line != null) - line.Text = "Press " + hotkey + " to teleport to a random location while no bosses are alive"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AstralTeleportHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 02e08a8f20..52a6af9b54 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -3,10 +3,10 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; using CalamityMod.World; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; private const double ContactDamageReduction = 0.15D; + public const double DefenseDamageMultiplier = 0.5D; // Duration of Nanomachines in frames. internal static readonly int NanomachinesDuration = 120; @@ -23,17 +24,17 @@ namespace CalamityMod.Items.Accessories // Duration of time where Nanomachines won't accumulate after taking damage, in frames. internal static readonly int NanomachinePauseAfterDamage = 60; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs( + (ContactDamageReduction * 100).ToString("N0"), + (100 - (DefenseDamageMultiplier * 100)).ToString("N0"), + NanomachinesHealPerFrame * NanomachinesDuration, + NanomachinesDuration / 60); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 11)); ItemID.Sets.AnimatesAsSoul[Type] = true; - - string seconds = NanomachinePauseAfterDamage == 60 ? "second" : "seconds"; - string pauseDurationTooltip = $"{NanomachinePauseAfterDamage / 60} {seconds}"; - string totalHealTooltip = $"{NanomachinesHealPerFrame * NanomachinesDuration}"; - string healDurationTooltip = $"{NanomachinesDuration / 60}"; - - } + } public override void SetDefaults() { @@ -62,35 +63,16 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { - // The 3rd tooltip line "Replaces Adrenaline..." is replaced on Normal or Expert - TooltipLine nanomachineMeterLine = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); - if (nanomachineMeterLine != null && !CalamityWorld.revenge) - nanomachineMeterLine.Text = "Adds the Nanomachines meter"; + // Add the hotkey + list.IntegrateHotkey(CalamityKeybinds.AdrenalineHotKey); - // The 4th tooltip line "Unlike Adrenaline..." is replaced on Normal or Expert - TooltipLine doesntStopOnDamageLine = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip3"); - if (doesntStopOnDamageLine != null && !CalamityWorld.revenge) - doesntStopOnDamageLine.Text = "Nanomachines accumulate over time while fighting bosses\n" + - $"Taking damage stops the accumulation for {NanomachinePauseAfterDamage / 60} seconds"; + // Add the proper description which changes depending on world difficulty + string desc = this.GetLocalization(CalamityWorld.revenge ? "NanomachinesReplace" : "NanomachinesAdd").Format(NanomachinePauseAfterDamage / 60); + list.FindAndReplace("[NANODESC]", desc); - // The 5th tooltip line "With full Nanomachines" has the & replaced with the hotkey. - string adrenKey = CalamityKeybinds.AdrenalineHotKey.TooltipHotkeyString(); - TooltipLine hotkeyLine = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip4"); - if (hotkeyLine != null) - { - string tooltipWithHotkey = hotkeyLine.Text.Replace("&", adrenKey); - hotkeyLine.Text = tooltipWithHotkey; - } - - // The 6th tooltip line "While healing..." has the @ replaced with full adrenaline DR. - // For whatever reason this method overrides the entire line instead of replacing the character as intended, so we duplicate the line. + // Add the proper DR value string fullAdrenDRString = (100f * BalancingConstants.FullAdrenalineDR).ToString("N0"); - TooltipLine healingDRLine = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip5"); - if (healingDRLine != null) - { - string tooltipWithDR = fullAdrenDRString.Replace("@", fullAdrenDRString); - healingDRLine.Text = "While healing, you take " + tooltipWithDR + "% less damage"; - } + list.FindAndReplace("[DR]", fullAdrenDRString); } } } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 0b368c56d8..83f40a72a0 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -3,7 +3,6 @@ using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Rarities; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,14 +25,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.AegisHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip5"); - - if (line != null) - line.Text = "Press " + hotkey + " to activate buffs to all damage, crit chance and defense"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AegisHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 28b53e1399..e79f53f15a 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -2,7 +2,6 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -31,13 +30,6 @@ namespace CalamityMod.Items.Accessories player.Calamity().stealthGenMoving += 0.1f; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.PlaguePackHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); - - if (line != null) - line.Text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of plagued clouds"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.PlaguePackHotKey); } } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 8e73812169..558a71a377 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); @@ -79,66 +79,18 @@ namespace CalamityMod.Items.Accessories bool draedon = DownedBossSystem.downedExoMechs; if (!scal || !draedon) { - string rejectionReason = (!draedon) ? "The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations" : "The soul within this crystal has been defiled by the powerful magic of a supreme witch"; //there might be a better way to word the draedon line, not sure - - TooltipLine lineLock = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - if (lineLock != null) - { - lineLock.Text = rejectionReason; - lineLock.OverrideColor = new Color(240, 90, 90); - } - int insertIndex = tooltips.FindIndex(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); - if (insertIndex != -1) - { - TooltipLine rejectLine = new TooltipLine(this.Mod, "CalamityMod:RejectLine", "Merchants will reject a defiled soul such as this."); - tooltips.Insert(insertIndex + 1, rejectLine); - } + string reject = this.GetLocalizedValue(!draedon ? "ExoMechsLock" : "CalamitasLock") + "\n" + this.GetLocalizedValue("Reject"); + tooltips.FindAndReplace("[STATUS]", reject); TooltipLine linePrice = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Sell price"); if (linePrice != null) linePrice.Text = ""; - } - else { - TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - int manaCost = (int)(100 * Main.player[Main.myPlayer].manaCost); - - if (line != null) - line.Text = "Requires 10 minion slots to use in order to grant the following effects\n" + - "All non-summon weapons are converted into powerful summon variations\n" + - "Falling below 50% life will empower these attacks"; - - int insertIndex = tooltips.FindIndex(x => x.Name == "Tooltip1" && x.Mod == "Terraria"); - if (insertIndex != -1) - { - TooltipLine meleeAttack = new TooltipLine(this.Mod, "CalamityMod:MeleeAttack", "Transforms Melee attacks into a barrage of spears"); - meleeAttack.OverrideColor = new Color(240, 90, 90); - tooltips.Insert(insertIndex + 1, meleeAttack); - - TooltipLine mageAttack = new TooltipLine(this.Mod, "CalamityMod:MageAttack", $"Transforms Magic attacks into a powerful splitting fireball for {manaCost} mana per cast"); - mageAttack.OverrideColor = new Color(58, 131, 228); - tooltips.Insert(insertIndex + 2, mageAttack); - - TooltipLine rangedAttack = new TooltipLine(this.Mod, "CalamityMod:RangedAttack", "Transforms Ranged attacks into a flurry of fireballs and meteors"); - rangedAttack.OverrideColor = new Color(133, 224, 146); - tooltips.Insert(insertIndex + 3, rangedAttack); - - TooltipLine rogueAttack = new TooltipLine(this.Mod, "CalamityMod:RogueAttack", "Transforms Rogue attacks into a deadly crystalline spiral"); - rogueAttack.OverrideColor = new Color(233, 116, 81); - tooltips.Insert(insertIndex + 4, rogueAttack); - - TooltipLine remainingTip = new TooltipLine(this.Mod, "CalamityMod:RemainingTip", "Summons and empowers the profaned babs to fight alongside you\n" + - "You are no longer affected by burn out when hit\n" + - "Provides buffs depending on the time of day\n" + - "Thinking back, it was a boring life"); - tooltips.Insert(insertIndex + 5, remainingTip); - - TooltipLine purityTip = new TooltipLine(this.Mod, "CalamityMod:PurityTip", "And so we burn it all in the name of purity"); - purityTip.OverrideColor = new Color(255, 191, 73); - tooltips.Insert(insertIndex + 6, purityTip); - } + string manaCost = (100 * Main.player[Main.myPlayer].manaCost).ToString("N0"); + string full = this.GetLocalization("FullTooltip").Format(manaCost); + tooltips.FindAndReplace("[STATUS]", full); } } diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 113a88dc28..5cf41613f3 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -2,7 +2,6 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; -using System.Linq; namespace CalamityMod.Items.Accessories { @@ -19,14 +18,7 @@ namespace CalamityMod.Items.Accessories Item.defense = 2; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.SandCloakHotkey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - - if (line != null) - line.Text = "Press " + hotkey + " to consume 10% of your maximum stealth to create a protective dust veil which provides +6 defense and +2 life regen"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SandCloakHotkey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index 1cca709bd7..f9e25adc93 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 5)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(7, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; } @@ -102,42 +102,32 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List tooltips) { - // Stat tooltips are added dynamically. - StringBuilder sb = new StringBuilder(256); + // Add the proper description which changes depending on world difficulty + string desc = CalamityWorld.revenge ? this.GetLocalizedValue("RageModified") : this.GetLocalization("RageAdd").Format(CalamityKeybinds.RageHotKey.TooltipHotkeyString()); + tooltips.FindAndReplace("[RAGEDESC]", desc); - // Line 5: If not on Rev+, note that the accessory enables Rage. - TooltipLine rageOverTimeLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip4"); - if (rageOverTimeLine != null && !CalamityWorld.revenge) - rageOverTimeLine.Text = "Adds the Rage meter\n" + rageOverTimeLine.Text; + // Add the current level + tooltips.FindAndReplace("[LEVEL]", level.ToString()); - // Line 9: Current level - sb.Append("Current level: "); - sb.Append(level); - sb.Append(" (+"); - sb.Append(level); - sb.Append("% Rage Mode damage)"); - tooltips.Add(new TooltipLine(Mod, "Tooltip8", sb.ToString())); - sb.Clear(); - - if (level < MaxLevel) + // Add the progress + string progressKey = "[PROGRESS]"; + TooltipLine progressLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Text.Contains(progressKey)); + if (progressLine != null) { - long progressToNextLevel = totalRageDamage - CumulativeLevelCost(level); - long totalToNextLevel = LevelCost(level + 1); - double ratio = (double)progressToNextLevel / totalToNextLevel; - string percent = (100D * ratio).ToString("0.00"); - - // Line 10: Progress to next level - sb.Append("Progress to next level: "); - sb.Append(percent); - sb.Append('%'); - tooltips.Add(new TooltipLine(Mod, "Tooltip9", sb.ToString())); - sb.Clear(); + if (level < MaxLevel) + { + long progressToNextLevel = totalRageDamage - CumulativeLevelCost(level); + long totalToNextLevel = LevelCost(level + 1); + double ratio = (double)progressToNextLevel / totalToNextLevel; + string percent = (100D * ratio).ToString("0.00"); + progressLine.Text = progressLine.Text.Replace(progressKey, percent); + } + else + progressLine.Text = string.Empty; } - // Line 11: Total damage dealt - sb.Append("Total Rage Mode damage: "); - sb.Append(totalRageDamage); - tooltips.Add(new TooltipLine(Mod, "Tooltip10", sb.ToString())); + // Add the current cumulative damage + tooltips.FindAndReplace("[DAMAGE]", totalRageDamage.ToString()); } public override void SaveData(TagCompound tag) @@ -228,7 +218,7 @@ namespace CalamityMod.Items.Accessories // Display a level up text notification. Rectangle textArea = new Rectangle((int)Player.Center.X, (int)Player.Center.Y, 1, 1); Color textColor = new Color(236, 209, 236); - CombatText.NewText(textArea, textColor, "The Community cracks...", false, false); + CombatText.NewText(textArea, textColor, CalamityUtils.GetTextValueFromModItem("LevelUpText"), false, false); } } } diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index 930ddd4ba7..f0fd52a994 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -1,6 +1,5 @@ using CalamityMod.Rarities; using System.Collections.Generic; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,14 +19,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.SpectralVeilHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - - if (line != null) - line.Text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a mid-range teleport and render you momentarily invulnerable"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SpectralVeilHotKey); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index 7a1a8dd6e0..ccd0f1b00a 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 10)); + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 10)); ItemID.Sets.AnimatesAsSoul[Type] = true; } @@ -39,9 +39,10 @@ namespace CalamityMod.Items.Accessories // Community and Shattered Community are mutually exclusive public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().shatteredCommunity; - // Returns the total power of the Community, from 0.0 to 1.0 (0% to 100%), based on bosses defeated in the world. + // Returns the total power of the Community, from 0.05 to 0.2, scaling based on bosses defeated in the world. + // Returns the percentage of bosses killed (from 0.0 to 1.0) instead if killsOnly is true private static readonly int TotalCountedBosses = 42; - internal static float CalculatePower() + internal static float CalculatePower(bool killsOnly = false) { int numBosses = 0; numBosses += NPC.downedSlimeKing.ToInt(); @@ -86,35 +87,40 @@ namespace CalamityMod.Items.Accessories numBosses += DownedBossSystem.downedYharon.ToInt(); // 40 numBosses += DownedBossSystem.downedExoMechs.ToInt(); numBosses += DownedBossSystem.downedCalamitas.ToInt(); - return numBosses / (float)TotalCountedBosses; + float bossDownedRatio = numBosses / (float)TotalCountedBosses; + return killsOnly ? bossDownedRatio : MathHelper.Lerp(0.05f, 0.2f, bossDownedRatio); } + // Damage stat boosts + public const float DamageMultiplier = 0.5f; // 2.5% to 10% (x100) + public const float CritMultiplier = 25f; // 1.25% to 5% + + // Defensive stat boosts + public const float HealthMultiplier = 50f; // 2% to 10% (rounded down) + public const float DRMultiplier = 0.25f; // 1.25% to 5% (x100) + public const float DefenseMultiplier = 50f; // 2 to 10 (rounded down) + + // Only while affected by DoT + public const float RegenMultiplier = 10f; // 0 to 2 (rounded down), +1 added independently of the multiplier + + // Mobility stat boosts + public const float SpeedMultiplier = 0.5f; // 2.5% to 10% (x100) + public const float FlightMultiplier = 1f; // 5% to 20% (x100) + public override void ModifyTooltips(List list) { - float communityPower = CalculatePower(); - float maxHealthIncrease = MathHelper.Lerp(0.025f, 0.1f, communityPower); - int lifeRegenIncrease = (int)(MathHelper.Lerp(0.005f, 0.02f, communityPower)*100); - float critChanceIncrease = MathHelper.Lerp(0.0125f, 0.05f, communityPower); - float damageIncrease = MathHelper.Lerp(0.025f, 0.1f, communityPower); - float damageReductionIncrease = MathHelper.Lerp(0.0125f, 0.05f, communityPower); - int defenseIncrease = (int)(MathHelper.Lerp(0.025f, 0.1f, communityPower)*100); - float summonKnockbackIncrease = MathHelper.Lerp(0.05f, 0.2f, communityPower); - float moveSpeedIncrease = MathHelper.Lerp(0.025f, 0.1f, communityPower); - float flightTimeIncrease = MathHelper.Lerp(0.05f, 0.2f, communityPower); - - TooltipLine line = list.LastOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip4"); - - if (line != null) - line.Text += - "\nMax health increased by " + (maxHealthIncrease*100).ToString("n1") + "%\n" + - "Life regeneration increased by " + (1+lifeRegenIncrease) + "\n" + - "Critical strike chance increased by " + (critChanceIncrease*100).ToString("n1") + "%\n" + - "Damage increased by " + (damageIncrease*100).ToString("n1") + "%\n" + - "Damage reduction increased by " + (damageReductionIncrease*100).ToString("n1") + "%\n" + - "Defense increased by " + defenseIncrease + "\n" + - "Minion knockback increased by " + (summonKnockbackIncrease*100).ToString("n1") + "%\n" + - "Movement speed increased by " + (moveSpeedIncrease*100).ToString("n1") + "%\n" + - "Flight time increased by " + (flightTimeIncrease*100).ToString("n1") + "%"; + float power = CalculatePower(); + string statList = this.GetLocalization("StatsList").Format( + (DamageMultiplier * power * 100).ToString("N1"), + (CritMultiplier * power).ToString("N0"), + (int)(HealthMultiplier * power), + (DRMultiplier * power * 100).ToString("N2"), + (int)(DefenseMultiplier * power), + 1 + (int)(RegenMultiplier * power), + (SpeedMultiplier * power * 100).ToString("N1"), + (FlightMultiplier * power * 100).ToString("N1"), + (CalculatePower(true) * 100).ToString("N0")); + list.FindAndReplace("[STATS]", statList); } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 49a709374b..4e907b1f30 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -28,17 +28,6 @@ namespace CalamityMod.Items.Accessories.Wings Item.rare = ItemRarityID.Lime; Item.accessory = true; } - public override void ModifyTooltips(List tooltips) - { - string down = PlayerInput.GenerateInputTag_ForCurrentGamemode(true, "Down"); - string jump = PlayerInput.GenerateInputTag_ForCurrentGamemode(true, "Jump"); - string up = PlayerInput.GenerateInputTag_ForCurrentGamemode(true, "Up"); - string hoverText = Player.Settings.HoverControl == Player.Settings.HoverControlMode.Hold ? "Hold " + down + " and " + jump + " to hover" : "Press " + down + " to toggle hover\nPress " + up + " to deactivate hover"; - - TooltipLine hover = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - if (hover != null) - hover.Text = hoverText; - } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index c29601bcca..ed57a5b00b 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.yInsignia = true; - player.GetAttackSpeed() += 0.1f; - player.GetDamage() += 0.1f; + player.GetDamage() += 0.15f; } public override void AddRecipes() diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index dfef3831b6..6bdf9b5265 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -1,5 +1,4 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -39,7 +38,6 @@ namespace CalamityMod.Items.Armor.Auric public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); - modPlayer.fBarrier = true; player.statLifeMax2 += 100; player.GetDamage() += 0.08f; player.GetCritChance() += 5; @@ -51,7 +49,6 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(18). AddTile(). Register(); @@ -60,7 +57,6 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). AddIngredient(18). AddTile(). Register(); diff --git a/Items/Mounts/ExoThrone.cs b/Items/Mounts/ExoThrone.cs index 57cb522535..28cae8a07d 100644 --- a/Items/Mounts/ExoThrone.cs +++ b/Items/Mounts/ExoThrone.cs @@ -1,6 +1,5 @@ using CalamityMod.Rarities; using System.Collections.Generic; -using System.Linq; using Terraria.ID; using Terraria.ModLoader; @@ -23,14 +22,6 @@ namespace CalamityMod.Items.Mounts Item.rare = ModContent.RarityType(); } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.ExoChairSlowdownHotkey.TooltipHotkeyString(); - - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - - if (line != null) - line.Text = $"Hold {hotkey} while sitting in the throne to move slower for more precision"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.ExoChairSlowdownHotkey); } } diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index 70850bbaf5..d6b3a81e34 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -6,7 +6,6 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using System.Linq; namespace CalamityMod.Items { @@ -28,14 +27,7 @@ namespace CalamityMod.Items Item.Calamity().donorItem = true; } - public override void ModifyTooltips(List list) - { - string hotkey = CalamityKeybinds.NormalityRelocatorHotKey.TooltipHotkeyString(); - TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip1"); - - if (line != null) - line.Text = "Press " + hotkey + " to teleport to the position of the mouse"; - } + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.NormalityRelocatorHotKey); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index d266b6737e..640bd9d4dc 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "AquaSG", "Atalya", "Ben-TK", - "Blastitle", "Cei", "Cooper", "CrabBar", @@ -108,6 +107,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Amadis", "AstroKnight", "Blast", + "Blastitle", "Blockaroz", "Boffin", "Bravioli", diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index 3d2df47ba3..e3b102d464 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -95,11 +95,11 @@ namespace CalamityMod.Items.Weapons.Summon if (!sufficientSpace) { Rectangle displayZone = player.Hitbox; - CombatText.NewText(displayZone, new Color(203, 157, 255), "Insufficient space!", true); + CombatText.NewText(displayZone, new Color(203, 157, 255), CalamityUtils.GetTextValueFromModItem("NoSpaceTextBottom"), true); displayZone.Y -= 30; - CombatText.NewText(displayZone, new Color(59, 194, 255), "Cannot Deploy", true); + CombatText.NewText(displayZone, new Color(59, 194, 255), CalamityUtils.GetTextValueFromModItem("NoSpaceTextTop"), true); return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 7ef3b1e914..0a4f46d36a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -98,11 +98,11 @@ HadarianWings: { DisplayName: Hadarian Wings Tooltip: ''' - This line gets modified below Horizontal speed: 9.00 Acceleration multiplier: 1.75 Good vertical speed Flight time: 90 + {$CommonItemTooltip.PressDownToHover} Powered by the Astral Infection ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 8050c2cee3..0b062e05d1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -153,7 +153,7 @@ AngelicAlliance: { Courage, Enlightenment, Bliss. United in Judgement +2 max minions, 15% increased summon damage, and 8% increased damage to all other classes Life regeneration is boosted while jumping - This line is modified in the code below. If you can read this, someone probably did something wrong (It was Ben) + Press [KEY] to grace yourself in divinity for 15 seconds While under the effects of Divine Bless, for every minion you have, an archangel shall be summoned to aid you in combat Each spawned angel will instantly heal you for two health All minion attacks inflict Banishing Fire and you are granted a flat health boost of four health per second @@ -221,7 +221,7 @@ AsgardianAegis: { +40 max life and increased life regeneration Grants a supreme god slayer flame dash Can be used to ram enemies - TOOLTIP LINE HERE + Press [KEY] to activate buffs to all damage, crit chance, and defense Activating this buff will reduce your movement speed and increase enemy aggro +20 defense while submerged in liquid ''' @@ -246,7 +246,7 @@ AstralArcanum: { Provides immunity to the astral infection debuff Boosts life regen even while under the effects of a damaging debuff While under the effects of a damaging debuff you will gain 15 defense - TOOLTIP LINE HERE + Press [KEY] to toggle teleportation UI while no bosses are alive ''' } @@ -330,7 +330,7 @@ BlunderBooster: { 12% increased rogue damage and 15% increased rogue projectile velocity Stealth generates 10% faster Summons a red lightning aura to surround the player and electrify nearby enemies - TOOLTIP LINE HERE + Press [KEY] to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of lightning bolts This effect has a 1 second cooldown before it can be used again ''' } @@ -352,7 +352,7 @@ CelestialJewel: { ''' Boosts life regen even while under the effects of a damaging debuff While under the effects of a damaging debuff you will gain 11 defense - TOOLTIP LINE HERE + Press [KEY] to teleport to a random location while no bosses are alive ''' } @@ -541,14 +541,24 @@ DraedonsHeart: { DisplayName: Draedon's Heart Tooltip: ''' - 15% reduced contact damage from enemies - Reduces defense damage taken by 50% - Replaces Adrenaline with the Nanomachines meter - Unlike Adrenaline, you lose no Nanomachines when you take damage, but they stop accumulating for 1 second - With full Nanomachines, press & to heal 360 health over 2 seconds - While healing, you gain 50% damage reduction + {0}% reduced contact damage from enemies + Reduces defense damage taken by {1}% + [NANODESC] + With full Nanomachines, press [KEY] to heal {2} health over {3} {^3:second;seconds} + While healing, you take [DR]% less damage 'Nanomachines, son' ''' + NanomachinesAdd: + ''' + Adds the Nanomachines meter + Nanomachines accumulate over time while fighting bosses + Taking damage stops the accumulation for {0} {^0:second;seconds} + ''' + NanomachinesReplace: + ''' + Replaces Adrenaline with the Nanomachines meter + Unlike Adrenaline, you lose no Nanomachines when you take damage, but they stop accumulating for {0} {^0:second;seconds} + ''' } DragonScales: { @@ -640,7 +650,7 @@ ElysianAegis: { +30 max life Grants a supreme holy flame dash Can be used to ram enemies - TOOLTIP LINE HERE + Press [KEY] to activate buffs to all damage, crit chance and defense Activating this buff will reduce your movement speed and increase enemy aggro Blessed by the Profaned Flame ''' @@ -1215,7 +1225,7 @@ PlaguedFuelPack: { ''' 8% increased rogue damage and 15% increased rogue projectile velocity Stealth generates 10% faster - TOOLTIP LINE HERE + Press [KEY] to consume 25% of your maximum stealth to perform a swift upwards/diagonal dash which leaves a trail of plagued clouds This effect has a 1 second cooldown before it can be used again ''' } @@ -1247,7 +1257,24 @@ ProfanedSoulCrystal: { Tooltip: ''' Transforms you into an emissary of the profaned goddess - This tooltip gets modified + [STATUS] + ''' + ExoMechsLock: "[c/F05A5A:The soul within this crystal has been defiled by overwhelming energy waves from dangerous mechanations]" + CalamitasLock: "[c/F05A5A:The soul within this crystal has been defiled by the powerful magic of a supreme witch]" + Reject: Merchants will reject a defiled soul such as this. + FullTooltip: + ''' + Requires 10 minion slots to use in order to grant the following effects + All non-summon weapons are converted into powerful summon variations + Falling below 50% life will empower these attacks + [c/F05A5A:Transforms Melee attacks into a barrage of spears] + [c/3A83E4:Transforms Magic attacks into a powerful splitting fireball for {0} mana per cast] + [c/85E092:Transforms Ranged attacks into a flurry of fireballs and meteors] + [c/E94571:Transforms Rogue attacks into a deadly crystalline spiral] + Summons and empowers the profaned babs to fight alongside you + Provides buffs depending on the time of day + Thinking back, it was a boring life + [c/FFBF49:And so we burn it all in the name of purity] ''' } @@ -1371,7 +1398,7 @@ SandCloak: { Tooltip: ''' 5% increased movement speed - TOOLTIP LINE HERE + Press [KEY] to consume 10% of your maximum stealth to create a protective dust veil which provides +6 defense and +2 life regen This effect has a 30 second cooldown before it can be used again ''' } @@ -1402,11 +1429,21 @@ ShatteredCommunity: { Increases damage by 10% and critical strike chance by 5% Increases max health by 10%, damage reduction by 5%, defense by 10 and life regen by 2 Increases movement speed by 10% and flight time by 20% - You generate rage over time and rage does not fade away out of combat + [RAGEDESC] Taking damage gives rage, this effect is not hindered by your defensive stats While Rage Mode is active, taking damage gives only half as much rage Deal damage with Rage Mode to further empower your wrath + Current level: [LEVEL] (+[LEVEL]% Rage Mode damage) + Progress to next level: [PROGRESS]% + Total Rage Mode damage: [DAMAGE] ''' + RageAdd: + ''' + Adds the Rage meter, which generates over time + Rage generates faster when in proximity of enemies + When Rage is maxed, press {0} for a temporary damage boost + ''' + RageModified: You generate rage over time and rage does not fade out of combat } ShieldoftheHighRuler: { @@ -1451,7 +1488,7 @@ SpectralVeil: { DisplayName: Spectral Veil Tooltip: ''' - TOOLTIP LINE HERE + Press [KEY] to consume 25% of your maximum stealth to perform a mid-range teleport and render you momentarily invulnerable If you dodge something while invulnerable, you instantly gain full stealth Teleportation is disabled while Chaos State is active Stealth generates 15% faster @@ -1625,12 +1662,18 @@ TheCommunity: { DisplayName: The Community Tooltip: ''' - Starts off with weak buffs to all of your stats - The stat buffs become more powerful as you defeat bosses - Reduces the DoT effects of harmful debuffs inflicted on you + [STATS] 'The heart of (most of) the Terraria community' [c/b00ba5:Thank you to all of my supporters who made this mod a reality!] ''' + StatsList: + ''' + Increases damage by {0}% and critical strike chance by {1}% + Increases max health by {2}%, damage reduction by {3}%, and defense by {4} + Increases life regen by {5} while under damage over time effects + Increases movement speed by {6}% and flight time by {7}% + Become more powerful as you defeat bosses ({8}% Power) + ''' } TheEvolution: { @@ -1846,8 +1889,7 @@ YharimsInsignia: { Tooltip: ''' 10% increased damage when under 50% life - 10% increased melee speed - 10% increased melee and true melee damage + 15% increased melee and true melee damage All melee attacks inflict Holy Flames Increased melee knockback ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 8683b24959..af5cceaa09 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -4,7 +4,6 @@ AuricTeslaBodyArmor: { ''' +100 max life 8% increased damage and 5% increased critical strike chance - You will freeze enemies near you when you are struck ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 9ecc2f0a00..8d3d2fc4a2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -255,7 +255,7 @@ NormalityRelocator: { DisplayName: Normality Relocator Tooltip: ''' - This line is modified below + Press [KEY] to teleport to the position of the mouse Fall speed is doubled for 30 frames after teleporting Teleportation is disabled while Chaos State is active Works while in the inventory diff --git a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson index 7a1d03b70f..7d16630028 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson @@ -8,7 +8,7 @@ ExoThrone: { Tooltip: ''' Materializes a quite cozy and extremely nimble flying Exo throne - Replaced + Hold [KEY] while sitting in the throne to move slower for more precision 'A comfortable gamer is a dangerous gamer' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 6f9f6399b4..a0c618d0da 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -145,18 +145,6 @@ Cnidarian: { ''' } -GlacialEmbrace: { - DisplayName: Glacial Embrace - Tooltip: - ''' - Summons the power of the ancient ice castle - For each minion slot used, you will gain an additional orbiting shield spike - These spikes accelerate rapidly towards a nearby enemy to inflict heavy damage - They take some time to regenerate after launching themselves at the target, however - On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding - ''' -} - CorroslimeStaff: { DisplayName: Corroslime Staff Tooltip: Summons a corro slime to fight for you @@ -334,6 +322,8 @@ EyeOfNight: { FlamsteedRing: { DisplayName: Flamsteed Ring + NoSpaceTextTop: Cannot Deploy + NoSpaceTextBottom: Insufficient space! Tooltip: ''' Summons a colossal controllable mech @@ -400,6 +390,18 @@ GastricBelcherStaff: { ''' } +GlacialEmbrace: { + DisplayName: Glacial Embrace + Tooltip: + ''' + Summons the power of the ancient ice castle + For each minion slot used, you will gain an additional orbiting shield spike + These spikes accelerate rapidly towards a nearby enemy to inflict heavy damage + They take some time to regenerate after launching themselves at the target, however + On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding + ''' +} + GodspawnHelixStaff: { DisplayName: Godspawn Helix Staff Tooltip: Summons astral probes to protect you diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 94604d30ab..5eb601d4b4 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -35,9 +35,20 @@ PlanetoidSchematicRecipeCondition: Place a schematic from the lab in the large p JungleSchematicRecipeCondition: Place a schematic from the lab deep within the jungle in your inventory at least once UnderworldSchematicRecipeCondition: Place a schematic from the lab near the edges of the underworld in your inventory at least once IceSchematicRecipeCondition: Place a schematic from the lab within the frozen caverns in your inventory at least once -// Item Messages +// Other CombatText uses and Item Messages ShiftToExpand: Hold SHIFT to see an expanded description LearnedSchematic: You learned how to create new things! +CragmawVibeCheck: Vibe check. +AutocannonHot: OUCH! HOT! +NoComputer: No decryption computer installed +ArkParry: Parry! +ClockworkTick: Tick +ClockworkTock: Tock +SevensJackpot: Jackpot!!! +SevensBust: Bust! +SevensDoubles: Doubles! +SevensTriples: Triples! +StylishHammerHit: Stylish! ThirdSageBlessingText: You have been blessed by the Third Sage! ThirdSageBlessingText2: The Third Sage has rescinded its blessing... GenericConsumedText: "[c/8a8a8a:You have already consumed this item]" diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index c85a80f3c5..df51c5a56b 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -576,6 +576,7 @@ AndroombaFriendly.DisplayName: Androomba Pal DILF: { DisplayName: Archmage + Census.SpawnCondition: Defeat Cryogen Name.Permafrost: Permafrost Chat: { @@ -614,6 +615,7 @@ DILF: { FAP: { DisplayName: Drunk Princess + Census.SpawnCondition: Have {$Mods.CalamityMod.Items.Potions.FabsolsVodka.DisplayName} [i:CalamityMod/FabsolsVodka] in your inventory in Hardmode Name.Cirrus: Cirrus Chat: { @@ -708,6 +710,7 @@ FAP: { SEAHOE: { DisplayName: Sea King + Census.SpawnCondition: Defeat a Giant Clam after defeating the Desert Scourge Name.Amidias: Amidias Chat: { @@ -792,6 +795,7 @@ SEAHOE: { THIEF: { DisplayName: Bandit + Census.SpawnCondition: Have a {$ItemName.PlatinumCoin} [i:PlatinumCoin] in your inventory after defeating Skeletron Name: { Laura: Laura @@ -872,6 +876,7 @@ THIEF: { WITCH: { DisplayName: Brimstone Witch + Census.SpawnCondition: Defeat Supreme Witch, Calamitas Name.Calamitas: Calamitas Chat: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 01e95cce7f..006f1ce5c0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -72,6 +72,8 @@ HolyFire2.DisplayName: Holy Fire HolyFlare.DisplayName: Holy Flare HolyLight.DisplayName: Holy Light HolySpear.DisplayName: Holy Spear +HomingGasBulb.DisplayName: Homing Gas Bulb +HomingGasBulbSporeGas.DisplayName: Homing Gas Bulb Spore Gas IceBlast.DisplayName: Ice Blast IceBomb.DisplayName: Ice Bomb IceRain.DisplayName: Ice Rain @@ -138,6 +140,7 @@ SwirlingFire.DisplayName: Fire ThanatosBeamStart.DisplayName: T Hanos Beam ThanatosBeamTelegraph.DisplayName: Gamma Disintegration Beam Telegraph ThanatosLaser.DisplayName: Exo Pulse Laser +ThornBallSpike.DisplayName: Thorn Ball Spike ToxicCloud.DisplayName: Toxic Cloud UnstableCrimulanGlob.DisplayName: Unstable Crimulan Glob UnstableEbonianGlob.DisplayName: Unstable Ebonian Glob @@ -145,4 +148,6 @@ VileClot.DisplayName: Vile Clot WaterSpear.DisplayName: Water Spear YharonBulletHellVortex.DisplayName: Bullet Hell Vortex YharonFireball.DisplayName: Dragon Fireball -YharonFireball2.DisplayName: Dragon Fireball \ No newline at end of file +YharonFireball2.DisplayName: Dragon Fireball +ThornBallSpike.DisplayName: Thorn Ball Spike +HomingGasBulb.DisplayName: Homing Gas Bulb \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index 37c5e1cea6..a6610b23ae 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -20,9 +20,9 @@ Server: Server Terminal: Terminal // Individual entries // Sulphurous Sea & Abyss -SteamGeyser1.MapEntry: Geyser -AbyssVent1.MapEntry: Steam Vent -ThermalVent1.MapEntry: Thermal Vent +SteamGeyser.MapEntry: Geyser +AbyssVent.MapEntry: Steam Vent +ThermalVent.MapEntry: Thermal Vent // Brimstone Crag SpineSapling.MapEntry: Spine Sapling SpineTree.MapEntry: Giant Spine @@ -46,19 +46,13 @@ UelibloomOre.MapEntry: Uelibloom ArenaTile.MapEntry: Arena AshenChest: { - MapEntry0: "{$ItemName.AshenChest}" - MapEntry1: Locked Ashen Chest + MapEntry0: "{$Mods.CalamityMod.Items.Placeables.AshenChest.DisplayName}" + MapEntry1: Locked {$Mods.CalamityMod.Items.Placeables.AshenChest.DisplayName} } AstralChestLocked: { - MapEntry0: "{$ItemName.AstralChest}" - MapEntry1: Locked Astral Chest + MapEntry0: "{$Mods.CalamityMod.Items.Placeables.AstralChest.DisplayName}" + MapEntry1: Locked {$Mods.CalamityMod.Items.Placeables.AstralChest.DisplayName} } -PlaguedPlateBed.MapEntry: "'Bed'" -SteamGeyser3.MapEntry: Steam Geyser3 -SteamGeyser2.MapEntry: Steam Geyser2 -ThermalVent3.MapEntry: Thermal Vent3 -ThermalVent2.MapEntry: Thermal Vent2 -AbyssVent3.MapEntry: Abyss Vent3 -AbyssVent2.MapEntry: Abyss Vent2 \ No newline at end of file +PlaguedPlateBed.MapEntry: "'Bed'" \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index d77b02dd95..496cb28f5a 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -88,6 +88,8 @@ Cooldowns: { InkBomb: Ink Bomb Cooldown LifeSteal: Life Steal Cooldown LionHeartShield: Energy Shell Cooldown + MasterChefShieldDurability: Energy Shield Durability + MasterChefShieldRecharge: Energy Shield Recharge NebulousCore: Nebulous Core Cooldown OmegaBlueActive: Abyssal Madness OmegaBlueCooldown: Abyssal Madness Cooldown diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index b3b7f37085..168e97d359 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -198,7 +198,6 @@ namespace CalamityMod { BossChecklistSupport(); FargosSupport(); - CensusSupport(); DialogueTweakSupport(); SummonersAssociationSupport(); } @@ -828,7 +827,6 @@ namespace CalamityMod 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() }; - string bossHeadTex = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; AddBoss(bossChecklist, calamity, entryName, order, type, DownedSCal, new Dictionary() { ["spawnItems"] = summons, @@ -973,19 +971,6 @@ namespace CalamityMod AddToMutantShop("OldDuke", "BloodwormItem", DownedBoomerDuke, Item.buyPrice(platinum: 2)); } - private static void CensusSupport() - { - Mod censusMod = GetInstance().census; - if (censusMod != null) - { - censusMod.Call("TownNPCCondition", NPCType(), "Defeat a Giant Clam after defeating the Desert Scourge"); - censusMod.Call("TownNPCCondition", NPCType(), "Have a [i:" + ItemID.PlatinumCoin + "] in your inventory after defeating Skeletron"); - censusMod.Call("TownNPCCondition", NPCType(), "Have [i:" + ItemType() + "] in your inventory in Hardmode"); - censusMod.Call("TownNPCCondition", NPCType(), "Defeat Cryogen"); - censusMod.Call("TownNPCCondition", NPCType(), "Defeat Supreme Witch, Calamitas"); - } - } - private static void DialogueTweakSupport() { Mod dialogueMod = GetInstance().dialogueTweak; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 4145809591..cccac1cd7e 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1278,6 +1278,9 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + // Variables for increasing difficulty bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; @@ -1978,6 +1981,9 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.cataclysm = npc.whoAmI; + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -2282,6 +2288,9 @@ namespace CalamityMod.NPCs CalamityGlobalNPC.catastrophe = npc.whoAmI; + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; @@ -2747,6 +2756,10 @@ namespace CalamityMod.NPCs npc.noGravity = true; } + // Emit light when not Idle + if (npc.ai[0] != 1f) + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); + // Fire projectiles while walking, teleporting, or falling if (npc.ai[0] == 2f || npc.ai[0] >= 5f) { diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 77f0a9f8a6..608431455e 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -11252,194 +11252,5 @@ namespace CalamityMod.NPCs #endregion #endregion - - #region DD2 Event AIs - public static int DD2EventEnemySpawnRate - { - get - { - int enemySpawnRateSpeedup = 0; - if (Main.npc.IndexInRange(CalamityGlobalNPC.DD2CrystalIndex) && Main.npc[CalamityGlobalNPC.DD2CrystalIndex].active) - enemySpawnRateSpeedup = (int)Main.npc[CalamityGlobalNPC.DD2CrystalIndex].ai[2]; - return Utils.Clamp(DD2Event.LaneSpawnRate - enemySpawnRateSpeedup, 15, DD2Event.LaneSpawnRate); - } - } - - public static void DD2PortalAI(NPC npc) - { - // Idly emit light if the portal has completely faded in. - if (npc.alpha == 0) - Lighting.AddLight(npc.Center, 0.5f, 0.1f, 0.3f); - - ref float enemySpawnTimer = ref npc.ai[0]; - ref float fadeOutTimer = ref npc.ai[2]; - ref float fadeInTimer = ref npc.localAI[0]; - ref float idlePlaySoundId = ref npc.localAI[3]; - if (npc.ai[1] == 0f) - { - // Play the portal opening sound at the moment of the portal's creation. - if (fadeInTimer == 0f) - { - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalOpen, npc.Center); - idlePlaySoundId = SlotId.Invalid.ToFloat(); - } - - ActiveSound soundOut; - if (fadeInTimer > 150f && !SoundEngine.TryGetActiveSound(SlotId.FromFloat(idlePlaySoundId), out soundOut)) - idlePlaySoundId = SoundEngine.PlaySound(SoundID.DD2_EtherianPortalIdleLoop, npc.Center).ToFloat(); - - if (!DD2Event.EnemySpawningIsOnHold) - enemySpawnTimer++; - - if (enemySpawnTimer >= DD2EventEnemySpawnRate) - { - if (enemySpawnTimer >= DD2EventEnemySpawnRate * 3) - enemySpawnTimer = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient && (int)enemySpawnTimer % DD2EventEnemySpawnRate == 0) - { - DD2Event.SpawnMonsterFromGate(npc.Bottom); - - // If enemy spawning is on hold, add 1 to the spawn timer to ensure that the above - // modulo doesn't get activated every single frame due to no other change above. - if (DD2Event.EnemySpawningIsOnHold) - enemySpawnTimer++; - } - npc.netUpdate = true; - } - - fadeInTimer++; - - // Begin to fade out of existence if the crystal is gone and the portal is done doing fade-in effects. - if (Main.netMode != NetmodeID.MultiplayerClient && !NPC.AnyNPCs(NPCID.DD2EterniaCrystal) && fadeInTimer >= 180f) - { - npc.ai[1] = 1f; - enemySpawnTimer = 0f; - npc.dontTakeDamage = true; - npc.netUpdate = true; - } - } - - // Fade-out effects. - else if (npc.ai[1] == 1f) - { - fadeOutTimer++; - npc.scale = MathHelper.Lerp(1f, 0.05f, Utils.GetLerpValue(500f, 600f, fadeOutTimer, true)); - - // Reset the idle play sound if it didn't get activated before for some reason. - ActiveSound result; - if (!SoundEngine.TryGetActiveSound(SlotId.FromFloat(idlePlaySoundId), out result)) - idlePlaySoundId = SoundEngine.PlaySound(SoundID.DD2_EtherianPortalIdleLoop, npc.Center).ToFloat(); - - ActiveSound activeSound; - if (SoundEngine.TryGetActiveSound(SlotId.FromFloat(idlePlaySoundId), out activeSound)) - activeSound.Volume = npc.scale; - - // Kill the portal after enough time has passed. - if (fadeOutTimer >= 550f) - { - npc.dontTakeDamage = false; - npc.life = 0; - npc.checkDead(); - npc.netUpdate = true; - if (activeSound != null) - { - activeSound.Stop(); - return; - } - } - } - } - - public static void DD2CrystalExtraAI(NPC npc) - { - CalamityGlobalNPC.DD2CrystalIndex = npc.whoAmI; - - ref float initialClickDelay = ref npc.localAI[3]; - ref float enemySpawnRateSpeedup = ref npc.ai[2]; - ref float animationCountdown = ref npc.ai[3]; - - if (animationCountdown > 0f) - animationCountdown--; - - // This is done to ensure that the initial click on the pedestal is not registered as a click to the crystal itself. - initialClickDelay++; - - bool clickingOnCrystal = Main.mouseRight && Main.mouseRightRelease && CalamityUtils.MouseHitbox.Intersects(npc.Hitbox) && initialClickDelay > 25f; - - // Reset the spawn rate speed-up after the wave is over. - if (Main.netMode != NetmodeID.MultiplayerClient && DD2Event.TimeLeftBetweenWaves > 1 && enemySpawnRateSpeedup != 0f) - { - enemySpawnRateSpeedup = 0f; - npc.netUpdate = true; - } - - if (clickingOnCrystal && npc.WithinRange(Main.LocalPlayer.Center, 285f)) - { - bool changeOccured = false; - - // If the event is waiting for time to pass and a player clicks on the crystal skip the wait. - if (DD2Event.TimeLeftBetweenWaves > 1) - { - DD2Event.TimeLeftBetweenWaves = 1; - if (Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.CrystalInvasionSendWaitTime, -1, -1, null, DD2Event.TimeLeftBetweenWaves); - changeOccured = true; - } - - // Otherwise speed up the portal spawn rate for this wave. - else - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int oldSpawnRate = DD2EventEnemySpawnRate; - enemySpawnRateSpeedup += 8f; - - // Release a circle of dust if a change was made to show that changes are indeed being done - // since the animation might be ongoing when this action is performed. - if (!Main.dedServ && oldSpawnRate != DD2EventEnemySpawnRate) - { - for (int i = 0; i < 55; i++) - { - for (float speed = 6f; speed < 13f; speed += 4f) - { - Vector2 shootDirection = (MathHelper.TwoPi * i / 55f).ToRotationVector2() * new Vector2(1f, 0.6f); - Dust etherealLight = Dust.NewDustPerfect(npc.Center - Vector2.UnitY * 20f + shootDirection * 12f, 264); - etherealLight.velocity = shootDirection * speed; - etherealLight.fadeIn = 0f; - etherealLight.scale = 2.3f; - etherealLight.noGravity = true; - etherealLight.noLight = true; - } - } - changeOccured = true; - } - npc.netUpdate = true; - } - } - - // Play an animation to accompany the change. - if (changeOccured) - { - if (animationCountdown <= 0f) - animationCountdown = 120f; - SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact); - } - - // As well as some indicator text. - if (changeOccured) - { - bool dramaticText = DD2EventEnemySpawnRate <= 25; - Color textColor = dramaticText ? Color.DeepPink : Color.Pink; - string[] potentialTexts = new string[] - { - "The invasion hastens!", - "The ethereal invaders march ever-faster!" - }; - CombatText.NewText(npc.Hitbox, textColor, Main.rand.Next(potentialTexts), dramaticText); - } - } - } - #endregion DD2 Event AIs } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ce171f2459..6ee9179c09 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -255,7 +255,6 @@ namespace CalamityMod.NPCs // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; - public static int DD2CrystalIndex = -1; public static int hiveMind = -1; public static int perfHive = -1; public static int slimeGodPurple = -1; @@ -498,7 +497,6 @@ namespace CalamityMod.NPCs for (int i = 0; i < bobbitWormBottom.Length; i++) ResetSavedIndex(ref bobbitWormBottom[i], NPCType()); - ResetSavedIndex(ref DD2CrystalIndex, NPCID.DD2EterniaCrystal); ResetSavedIndex(ref hiveMind, NPCType()); ResetSavedIndex(ref perfHive, NPCType()); ResetSavedIndex(ref slimeGodPurple, NPCType(), NPCType()); @@ -3784,12 +3782,6 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.DD2LanePortal) - { - CalamityGlobalAI.DD2PortalAI(npc); - return false; - } - return true; } #endregion @@ -4310,9 +4302,6 @@ namespace CalamityMod.NPCs if (pearlAura > 0) npc.velocity *= 0.9f; } - - if (npc.type == NPCID.DD2EterniaCrystal) - CalamityGlobalAI.DD2CrystalExtraAI(npc); } #endregion @@ -5531,6 +5520,17 @@ namespace CalamityMod.NPCs if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); + // Spore Gas vomit color telegraph + if (npc.type == NPCID.Plantera && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) + { + bool startChangingColor = npc.ai[1] > PlanteraAI.SeedGatlingColorChangeGateValue; + if (startChangingColor) + { + float colorChangeAmount = npc.ai[1] - PlanteraAI.SeedGatlingColorChangeGateValue; + return Color.Lerp(drawColor, Color.Green, colorChangeAmount / PlanteraAI.SeedGatlingColorChangeDuration); + } + } + if (npc.type == NPCID.QueenBee && Main.zenithWorld) { if (npc.life / (float)npc.lifeMax < 0.5f) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 999509a5a1..ebc97697d2 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -281,6 +281,9 @@ namespace CalamityMod.NPCs.DesertScourge if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) perturbedSpeed *= Main.rand.NextFloat() + 0.5f; + for (int k = 0; k < 10; k++) + Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); if (Main.zenithWorld) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 3f, perturbedSpeed, type2, damage, 0f, Main.myPlayer); @@ -444,6 +447,10 @@ namespace CalamityMod.NPCs.DesertScourge for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + + for (int k = 0; k < 10; k++) + Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 1af9cf7d68..a4831c2fba 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -742,14 +742,14 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.Opacity >= 1f && (distanceFromTarget > 480f || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) && NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f)) { calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 50f : 150f) && calamityGlobalNPC.newAI[0] % (phase7 ? 30f : 60f) == 0f) + if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : 150f) && calamityGlobalNPC.newAI[0] % ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : phase7 ? 30f : 60f) == 0f) { float fireballSpeed = 8f; Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * fireballSpeed + NPC.velocity * 0.5f; Vector2 dustVelocity = fireballVelocity * 2f; for (int k = 0; k < 50; k++) - Dust.NewDust(NPC.Center, 52, 52, (int)CalamityDusts.PurpleCosmilite, dustVelocity.X, dustVelocity.Y, 0, default, 1f); + Dust.NewDust(NPC.Center, 52, 52, (int)CalamityDusts.PurpleCosmilite, dustVelocity.X, dustVelocity.Y); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 2032f686c9..7da052cd7a 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -638,8 +638,17 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { - projectile.Kill(); - projectile.owner = Main.maxPlayers; + // Prevent splitting and spawn death dust + if (projectile.type == ModContent.ProjectileType()) + { + SpawnApolloFireballKillDust(projectile); + projectile.active = false; + } + else + { + projectile.Kill(); + projectile.owner = Main.maxPlayers; + } } } } @@ -743,8 +752,17 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { - projectile.Kill(); - projectile.owner = Main.maxPlayers; + // Prevent splitting + if (projectile.type == ModContent.ProjectileType()) + { + SpawnApolloFireballKillDust(projectile); + projectile.active = false; + } + else + { + projectile.Kill(); + projectile.owner = Main.maxPlayers; + } } } } @@ -813,8 +831,17 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { - projectile.Kill(); - projectile.owner = Main.maxPlayers; + // Prevent splitting + if (projectile.type == ModContent.ProjectileType()) + { + SpawnApolloFireballKillDust(projectile); + projectile.active = false; + } + else + { + projectile.Kill(); + projectile.owner = Main.maxPlayers; + } } } } @@ -1380,6 +1407,65 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } } + private void SpawnApolloFireballKillDust(Projectile projectile) + { + int height = 90; + projectile.position = projectile.Center; + projectile.width = projectile.height = height; + projectile.Center = projectile.position; + + SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaExplosionSound, projectile.Center); + + for (int i = 0; i < 200; i++) + { + float dustSpeed = 16f; + if (i < 150) + dustSpeed = 12f; + if (i < 100) + dustSpeed = 8f; + if (i < 50) + dustSpeed = 4f; + + int dust = Dust.NewDust(projectile.Center, 6, 6, Main.rand.NextBool(2) ? 107 : 110, 0f, 0f, 100, default, 1f); + float dustVelocityX = Main.dust[dust].velocity.X; + float dustVelocityY = Main.dust[dust].velocity.Y; + + if (dustVelocityX == 0f && dustVelocityY == 0f) + dustVelocityX = 1f; + + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustSpeed / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + + float scale = 1f; + switch ((int)dustSpeed) + { + case 4: + scale = 1.2f; + break; + case 8: + scale = 1.1f; + break; + case 12: + scale = 1f; + break; + case 16: + scale = 0.9f; + break; + default: + break; + } + + Dust dust2 = Main.dust[dust]; + dust2.velocity *= 0.5f; + dust2.velocity.X = dust2.velocity.X + dustVelocityX; + dust2.velocity.Y = dust2.velocity.Y + dustVelocityY; + dust2.scale = scale; + dust2.noGravity = true; + } + } + // Plays the targeting sound from both Exo Twins, indicating that they're syncing up. public static void PlayTargetingSound() { diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 8e879eee81..2aafeb56ca 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -11,6 +11,11 @@ namespace CalamityMod.NPCs.NormalNPCs { public class KingSlimeJewel : ModNPC { + private const int BoltShootGateValue = 75; + private const int BoltShootGateValue_Death = 60; + private const int BoltShootGateValue_BossRush = 45; + private const float LightTelegraphDuration = 30f; + public override void SetStaticDefaults() { NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers(0) { Hide = true }; @@ -41,9 +46,6 @@ namespace CalamityMod.NPCs.NormalNPCs // Setting this in SetDefaults will disable expert mode scaling, so put it here instead NPC.damage = 0; - // Red light - Lighting.AddLight((int)((NPC.position.X + (float)(NPC.width / 2)) / 16f), (int)((NPC.position.Y + (float)(NPC.height / 2)) / 16f), 1f, 0f, 0f); - // Despawn if (!NPC.AnyNPCs(NPCID.KingSlime)) { @@ -105,13 +107,13 @@ namespace CalamityMod.NPCs.NormalNPCs } // Fire projectiles + NPC.ai[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { // Fire bolt every 1.5 seconds - NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= (BossRushEvent.BossRushActive ? 45f : CalamityWorld.death ? 60f : 75f)) + if (NPC.ai[0] >= (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) { - NPC.localAI[0] = 0f; + NPC.ai[0] = 0f; Vector2 npcPos = new Vector2(NPC.Center.X, NPC.Center.Y); float xDist = Main.player[NPC.target].Center.X - npcPos.X; @@ -151,20 +153,26 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, perturbedSpeed, type, damage, 0f, Main.myPlayer); } } else - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, damage, 0f, Main.myPlayer); } } } - public override bool CheckActive() + public override Color? GetAlpha(Color drawColor) { - return false; + float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration; + if (NPC.ai[0] > colorTelegraphGateValue) + drawColor = Color.Lerp(drawColor, Color.White, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); + + return base.GetAlpha(drawColor); } + public override bool CheckActive() => false; + public override void HitEffect(NPC.HitInfo hit) { Dust.NewDust(NPC.position, NPC.width, NPC.height, 90, hit.HitDirection, -1f, 0, default, 1f); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 942d852cd2..44fc7e7764 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -535,10 +535,10 @@ namespace CalamityMod.NPCs.Providence DoDeathAnimation(); return; } - // Trigger the death animation - else if (NPC.life == 1) + else if (NPC.life <= 1) { + NPC.life = 1; DespawnSpecificProjectiles(true); Dying = true; NPC.dontTakeDamage = true; @@ -1844,7 +1844,10 @@ namespace CalamityMod.NPCs.Providence { return false; } - + public override bool CheckDead() + { + return false; + } public override void OnKill() { CalamityGlobalNPC.SetNewBossJustDowned(NPC); diff --git a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs index 74834ec311..9ba225d43b 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses hoverAcceleration += 0.05f; } - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 200f; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 320f; Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * hoverSpeed; npc.SimpleFlyMovement(idealVelocity, hoverAcceleration); @@ -161,11 +161,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 12) { - int num23 = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num23].velocity = servantSpawnVelocity; + int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); + Main.npc[eye].velocity = servantSpawnVelocity; - if (Main.netMode == NetmodeID.Server && num23 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num23, 0f, 0f, 0f, 0, 0, 0); + if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); } SoundEngine.PlaySound(SoundID.NPCHit1, servantSpawnCenter); @@ -182,7 +182,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[1] == 1f) { npc.rotation = num8; - float chargeSpeed = 7.25f; + float chargeSpeed = 8f; chargeSpeed += 5f * enrageScale; if (death) chargeSpeed += 8.5f * (1f - lifeRatio); @@ -370,7 +370,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses hoverAcceleration += 0.04f * (0.75f - lifeRatio); } - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 120f; + Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 160f; float distanceFromHoverDestination = npc.Distance(hoverDestination); if (distanceFromHoverDestination > 400f) @@ -649,12 +649,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity * 10f; if (Main.netMode != NetmodeID.MultiplayerClient) { - int num34 = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num34].velocity.X = servantSpawnVelocity.X; - Main.npc[num34].velocity.Y = servantSpawnVelocity.Y; + int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); + Main.npc[eye].velocity.X = servantSpawnVelocity.X; + Main.npc[eye].velocity.Y = servantSpawnVelocity.Y; - if (Main.netMode == NetmodeID.Server && num34 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34, 0f, 0f, 0f, 0, 0, 0); + if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); if (CalamityWorld.LegendaryMode) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index 6731567983..265757628c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -12,6 +12,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { public static class PlanteraAI { + public const float SeedGatlingGateValue = 900f; + public const float SeedGatlingDuration = 300f; + public const float SeedGatlingColorChangeDuration = 180f; + public const float SeedGatlingStopValue = SeedGatlingGateValue + SeedGatlingDuration; + public const float SeedGatlingColorChangeGateValue = SeedGatlingStopValue - SeedGatlingColorChangeDuration; + public static bool BuffedPlanteraAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -31,7 +37,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases based on HP - bool phase1phase2 = lifeRatio < 0.75f; + bool addThornBallsToGatlingAttack = lifeRatio < 0.9f; + bool addSporeGasBlastToGatlingAttack = lifeRatio < 0.75f; bool phase2 = lifeRatio <= 0.5f; bool phase3 = lifeRatio < 0.35f; bool phase4 = lifeRatio < 0.2f; @@ -128,37 +135,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.Calamity().CurrentlyEnraged = !bossRush && enrage; - // Detect active tiles around Plantera - int radius = 20; // 20 tile radius - int diameter = radius * 2; - int npcCenterX = (int)(npc.Center.X / 16f); - int npcCenterY = (int)(npc.Center.Y / 16f); - Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - int nearbyActiveTiles = 0; // 0 to 1600 - for (int x = area.Left; x < area.Right; x++) - { - for (int y = area.Top; y < area.Bottom; y++) - { - if (Main.tile[x, y] != null) - { - if (Main.tile[x, y].HasUnactuatedTile && Main.tileSolid[Main.tile[x, y].TileType] && !Main.tileSolidTop[Main.tile[x, y].TileType] && !TileID.Sets.Platforms[Main.tile[x, y].TileType]) - nearbyActiveTiles++; - } - } - } - - // Scale multiplier based on nearby active tiles - float tileEnrageMult = 1f; - if (nearbyActiveTiles < 800) - tileEnrageMult += (800 - nearbyActiveTiles) * 0.00075f; // Ranges from 1f to 1.6f - - if (bossRush) - tileEnrageMult = 1.6f; - - // Let hooks and tentacles know how enraged plantera is - npc.ai[3] = tileEnrageMult; - float tentacleEnrageMult = 1f - lifeRatio + (tileEnrageMult - 1f); - // Movement relative to the target and hook positions Vector2 vector91 = new Vector2(num730, num731); float num736 = Main.player[npc.target].Center.X - vector91.X; @@ -177,16 +153,104 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses acceleration += acceleration * 0.25f * (1f - lifeRatio); } - // Increase speed based on nearby active tiles - velocity *= tileEnrageMult; - acceleration *= tileEnrageMult; - if (Main.getGoodWorld) { velocity *= 1.15f; acceleration *= 1.15f; } + // Slow down and fire a gatling of projectiles + // These projectiles are slower than normal + // Glow gradually more green the closer the gatling attack is to ending + bool usingSeedGatling = npc.ai[1] > SeedGatlingGateValue; + if (!phase2) + { + npc.ai[1] += 1f; + if (usingSeedGatling) + { + float currentSeedGatlingTime = npc.ai[1] - SeedGatlingGateValue; + + // Slow down more and more as gatling attack continues + velocity *= MathHelper.Lerp(0.25f, 1f, currentSeedGatlingTime / SeedGatlingDuration); + + // Shoot projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float shootProjectileGateValue = 30f; + if (currentSeedGatlingTime >= 240f) + shootProjectileGateValue = 3f; + else if (currentSeedGatlingTime >= 180f) + shootProjectileGateValue = 5f; + else if (currentSeedGatlingTime >= 120f) + shootProjectileGateValue = 9f; + else if (currentSeedGatlingTime >= 60f) + shootProjectileGateValue = 15f; + + if (npc.ai[1] % shootProjectileGateValue == 0f) + { + bool shootThornBall = npc.ai[1] % 90f == 0f && addThornBallsToGatlingAttack; + bool shootPoisonSeed = npc.ai[1] % 9f == 0f; + float projectileSpeed = 6f; + int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; + int damage = npc.GetProjectileDamage(projectileType); + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 3f, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); + if (projectileType == ProjectileID.ThornBall && (Main.rand.NextBool(2) || !Main.zenithWorld)) + Main.projectile[proj].tileCollide = false; + } + } + } + + if (npc.ai[1] >= SeedGatlingStopValue) + { + // Vomit dense spread of spore gas at the end of the gatling attack + if (Main.netMode != NetmodeID.MultiplayerClient && addSporeGasBlastToGatlingAttack) + { + SoundEngine.PlaySound(SoundID.Item107, npc.Center); + int totalProjectiles = 36; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity2 = CalamityWorld.LegendaryMode ? Main.rand.NextFloat(8f, 12f) : Main.rand.NextFloat(4f, 6f); + Vector2 spinningPoint = new Vector2(0f, -velocity2); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(vector255) * 50f, vector255, type, damage, 0f, Main.myPlayer); + } + } + + npc.ai[1] = -SeedGatlingDuration; + } + } + else + npc.ai[1] = 0f; + + // Move slowly for a bit after finishing gatling attack + bool slowedAfterGatlingAttack = npc.ai[1] < 0f; + if (slowedAfterGatlingAttack) + { + float absValueOfTimer = Math.Abs(npc.ai[1]); + velocity *= MathHelper.Lerp(0.25f, 1f, absValueOfTimer / SeedGatlingDuration); + + // Shoot homing pink bulb projectiles that leave behind lingering pink clouds + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float shootBulbGateValue = death ? 60f : 120f; + if (lifeRatio < 0.75f) + shootBulbGateValue *= 0.5f; + + if (absValueOfTimer % shootBulbGateValue == 0f) + { + float projectileSpeed = 12f; + int projectileType = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(projectileType); + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 3f, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); + } + } + } + // Velocity ranges from 4 to 7.2, Acceleration ranges from 0.04 to 0.072, non-enraged phase 1 // Velocity ranges from 7 to 12.6, Acceleration ranges from 0.07 to 0.126, non-enraged phase 2 // Velocity ranges from 9 to 16.2, Acceleration ranges from 0.07 to 0.126, non-enraged phase 3 @@ -250,13 +314,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y -= acceleration * 2f; } - // Slow down considerably if near player - if (!speedUp && nearbyActiveTiles > 800 && !Collision.SolidCollision(npc.position, npc.width, npc.height) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - if (npc.velocity.Length() > 4f) - npc.velocity *= 0.98f; - } - // Rotation float num740 = Main.player[npc.target].Center.X - npc.Center.X; float num741 = Main.player[npc.target].Center.Y - npc.Center.Y; @@ -265,19 +322,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 1 if (!phase2) { - if (phase1phase2 && Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 2f; - int baseTentacles = death ? 3 : 2; - int totalTentacles = (int)(baseTentacles * tileEnrageMult); - for (int i = 0; i < totalTentacles; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); - } - } - } + // Emit light + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.8f, 0.2f, 0.4f); // Adjust stats calamityGlobalNPC.DR = 0.15f; @@ -286,9 +332,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.damage = npc.defDamage; // Fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient && !usingSeedGatling && !slowedAfterGatlingAttack) { - float shootBoost = 8f * (1f - lifeRatio); + float shootBoost = 2f * (1f - lifeRatio); npc.localAI[1] += 1f + shootBoost; if (enrage) @@ -301,7 +347,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.justHit) npc.localAI[3] = 1f; - if (npc.localAI[1] >= 75f) + float shootProjectileGateValue = death ? 40f : 60f; + if (npc.localAI[1] >= 60f) { npc.localAI[1] = 0f; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); @@ -313,50 +360,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (canHit) { npc.TargetClosest(); - int projectileType = ProjectileID.SeedPlantera; - float projectileVelocity = 17f; - if (Main.rand.NextBool(8)) - { - projectileType = ModContent.ProjectileType(); - projectileVelocity = 3f; - } - else if ((lifeRatio < 0.85f || CalamityWorld.LegendaryMode) && Main.rand.NextBool(4)) - { - npc.localAI[1] = CalamityWorld.LegendaryMode ? -15f : -30f; - projectileType = ProjectileID.PoisonSeedPlantera; - } - else if ((lifeRatio < 0.7f || CalamityWorld.LegendaryMode) && Main.rand.NextBool(2)) - { - int thornBallCount = 0; - int maxThornBalls = CalamityWorld.LegendaryMode ? 10 : 2; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) - thornBallCount++; - - if (thornBallCount > maxThornBalls - 1) - break; - } - if (thornBallCount < maxThornBalls) - { - npc.localAI[1] = CalamityWorld.LegendaryMode ? -60f : -120f; - projectileType = ProjectileID.ThornBall; - } - } - + int projectileType = (CalamityWorld.LegendaryMode || Main.rand.NextBool(4)) ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; + float projectileSpeed = 9f; int damage = npc.GetProjectileDamage(projectileType); - - Vector2 vector93 = npc.Center; - float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = projectileVelocity / num745; - num743 *= num745; - num744 *= num745; - - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector93.X, vector93.Y, num743, num744, projectileType, damage, 0f, Main.myPlayer, 0f, projectileType == ProjectileID.ThornBall ? tileEnrageMult : 0f); + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 3f, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); } } } @@ -365,6 +373,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Phase 2 else { + // Spore dust + if (Main.rand.NextBool(10)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.4f); + dust.fadeIn = 0.7f; + } + // Adjust stats calamityGlobalNPC.DR = 0.15f; calamityGlobalNPC.unbreakableDR = false; @@ -374,27 +389,26 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.localAI[0] == 2f) + if (npc.localAI[0] == 1f) { - npc.localAI[0] = 3f; - int baseTentacles = death ? 10 : 8; - int totalTentacles = (int)(baseTentacles * tileEnrageMult); + npc.localAI[0] = 2f; + int totalTentacles = death ? 10 : 8; if (Main.getGoodWorld) totalTentacles += 6; for (int i = 0; i < totalTentacles; i++) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); if (Main.getGoodWorld) { for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].aiStyle == 52) + if (Main.npc[i].active && Main.npc[i].aiStyle == NPCAIStyleID.PlanteraHook) { for (int j = 0; j < totalTentacles / 2 - 1; j++) { - int num800 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); - Main.npc[num800].ai[3] = i + 1; + int hookIndex = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); + Main.npc[hookIndex].ai[3] = i + 1; } } } @@ -416,59 +430,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn spores - float spawnBoost = 8f * (0.5f - lifeRatio); - npc.localAI[1] += 1f + spawnBoost; - // If hit, fire projectiles even if target is behind tiles if (npc.justHit) calamityGlobalNPC.newAI[2] = 1f; - if (npc.localAI[1] >= 360f) - { - npc.localAI[1] = 0f; - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (calamityGlobalNPC.newAI[2] > 0f) - { - canHit = true; - calamityGlobalNPC.newAI[2] = 0f; - } - if (canHit) - { - float num757 = 4f; - Vector2 vector94 = npc.Center; - float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); - float num759 = Math.Abs(num758 * 0.2f); - - float num760 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector94.Y + Main.rand.Next(-10, 11); - if (num760 > 0f) - num759 = 0f; - - num760 -= num759; - float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; - - int num762 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].dontTakeDamage = bossRush; - Main.npc[num762].netUpdate = true; - } - } - // Fire spread of poison seeds - if (nearbyActiveTiles > 600) - npc.localAI[3] += 0.5f + (0.5f - lifeRatio) * 8f; - else - npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (0.5f - lifeRatio) * 8f; + npc.localAI[3] += 0.5f + (0.5f - lifeRatio) * 8f; // If hit, fire projectiles even if target is behind tiles if (npc.justHit) calamityGlobalNPC.newAI[3] = 1f; - if (npc.localAI[3] >= 360f) + if (npc.localAI[3] >= 450f) { bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (calamityGlobalNPC.newAI[3] > 0f) @@ -478,22 +451,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } if (canHit) { - Vector2 vector93 = npc.Center; - - float num742 = 8f + ((0.5f - lifeRatio) * 8f); // 8f to 12f - if (nearbyActiveTiles < 300) - num742 = 12f; + float projectileSpeed = 8f + ((0.5f - lifeRatio) * 8f); // 8f to 12f if (bossRush) - num742 += 4f; + projectileSpeed += 4f; - float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); bool anyThornBalls = false; for (int i = 0; i < Main.maxProjectiles; i++) @@ -509,16 +471,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses int type = ProjectileID.ThornBall; int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector93.X, vector93.Y, num743, num744, type, damage, 0f, Main.myPlayer, 0f, tileEnrageMult); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 3f, projectileVelocity * projectileSpeed, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; npc.localAI[3] = -240f; } else { int spread = 3 + (int)Math.Round((0.5f - lifeRatio) * 10f); // 3 to 8, wider spread is harder to avoid - if (nearbyActiveTiles < 300) - spread = Main.rand.Next(3, 7) + (int)Math.Round((0.5f - lifeRatio) * 8f); - int numProj = spread / 2; int type = ProjectileID.PoisonSeedPlantera; int damage = npc.GetProjectileDamage(type); @@ -526,8 +486,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector93, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), perturbedSpeed * 3f, perturbedSpeed * projectileSpeed, type, damage, 0f, Main.myPlayer); } npc.localAI[3] = 0f; @@ -539,34 +499,21 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float shootBoost = 2f * (0.5f - lifeRatio); calamityGlobalNPC.newAI[0] += 1f + shootBoost; - float sporeGasGateValue = CalamityWorld.LegendaryMode ? 150f : bossRush ? 300f : 600f; + float sporeGasGateValue = CalamityWorld.LegendaryMode ? 150f : bossRush ? 300f : 720f; if (calamityGlobalNPC.newAI[0] >= sporeGasGateValue) { npc.TargetClosest(); SoundEngine.PlaySound(SoundID.Item20, npc.position); - Vector2 vector93 = npc.Center; - float num742 = 3f; - float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - + float projectileSpeed = 3f; + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * projectileSpeed; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - int numProj = 4; int spread = 30; - if (nearbyActiveTiles <= 300) - spread = Main.rand.NextBool(2) ? 45 : 60; - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; + float baseSpeed = (float)Math.Sqrt(projectileVelocity.X * projectileVelocity.X + projectileVelocity.Y * projectileVelocity.Y); + double startAngle = Math.Atan2(projectileVelocity.X, projectileVelocity.Y) - rotation / 2; double deltaAngle = rotation / numProj; double offsetAngle; @@ -574,7 +521,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { offsetAngle = startAngle + deltaAngle * i; float ai0 = Main.rand.Next(3); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, ai0, 0f); + projectileVelocity = new Vector2(baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle)); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity, projectileVelocity, type, damage, 0f, Main.myPlayer, ai0, 0f); } calamityGlobalNPC.newAI[0] = 0f; @@ -634,7 +582,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.ai[0] = npc.life; if (NPC.CountNPCS(NPCID.PlanterasTentacle) < maxTentacles) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); } } } @@ -665,9 +613,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Main.player[Main.npc[NPC.plantBoss].target].dead && !enrage) despawn = true; - // Tile enrage - float tileEnrageMult = Main.npc[NPC.plantBoss].ai[3]; - // Enrage if Plantera's target is on the surface if (!enrage && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) { @@ -693,7 +638,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Timer dictating whether to pick a new location or not float moveBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - npc.localAI[0] -= (1f + moveBoost) * MathHelper.Lerp(1f, 3.6f, (tileEnrageMult - 1f) * 1.25f); + npc.localAI[0] -= 1f + moveBoost; if (enrage) npc.localAI[0] -= 6f; @@ -762,7 +707,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { // Hook movement velocity float velocityBoost = death ? 6f * (1f - lifeRatio) : 3f * (1f - lifeRatio); - float velocity = (7f + velocityBoost) * tileEnrageMult; + float velocity = 7f + velocityBoost; if (enrage) velocity *= 2f; if (despawn) @@ -808,6 +753,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Spore dust + if (Main.rand.NextBool(10)) + { + Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 44, 0f, 0f, 250, default, 0.2f); + dust.fadeIn = 0.7f; + } + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Main.getGoodWorld) @@ -838,7 +790,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Set Plantera to a variable int num778 = NPC.plantBoss; - float tileEnrageMult = Main.npc[num778].ai[3]; // Movement variables if (Main.netMode != NetmodeID.MultiplayerClient) @@ -852,9 +803,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } // Velocity and acceleration - float num779 = (death ? 2.4f : 1.6f) * tileEnrageMult; + float num779 = death ? 2.4f : 1.6f; float num781 = npc.ai[2]; - float num780 = 100f + (num781 * 150f); + float num780 = 100f + (num781 * 75f); float deceleration = (death ? 0.5f : 0.8f) / (1f + num781); if (Main.getGoodWorld) @@ -923,6 +874,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.spriteDirection = -1; npc.rotation = (float)Math.Atan2(num787, num786) + MathHelper.Pi; } + return false; } } diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs new file mode 100644 index 0000000000..d3855edbb7 --- /dev/null +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -0,0 +1,95 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using System; +using CalamityMod.NPCs.TownNPCs; + +namespace CalamityMod.Projectiles.Boss +{ + public class HomingGasBulb : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 18; + Projectile.height = 18; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + } + + public override void AI() + { + if (Projectile.localAI[0] == 0f) + { + Projectile.localAI[0] = 1f; + SoundEngine.PlaySound(SoundID.Item17, Projectile.Center); + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + + int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); + Vector2 velocity = Main.player[closestPlayer].Center - Projectile.Center; + Projectile.ai[0] += 1f; + if (Projectile.ai[0] >= 30f) + { + if (Projectile.ai[0] < 180f) + { + float scaleFactor2 = Projectile.velocity.Length(); + velocity.Normalize(); + velocity *= scaleFactor2; + Projectile.velocity = (Projectile.velocity * 24f + velocity) / 25f; + Projectile.velocity.Normalize(); + Projectile.velocity *= scaleFactor2; + } + else if (Projectile.velocity.Length() < 18f) + { + Projectile.tileCollide = true; + Projectile.velocity *= 1.02f; + } + } + + if (Projectile.ai[0] % 30f == 0f) + { + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + if (Projectile.owner == Main.myPlayer) + { + int type = ModContent.ProjectileType(); + float ai0 = Main.rand.Next(3); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Normalize(Projectile.velocity) * 0.25f, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer, ai0); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + lightColor = Color.White; + lightColor.A = (byte)Projectile.alpha; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void Kill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + for (int i = 0; i < 15; i++) + { + if (Main.rand.Next(3) != 0) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 166); + else + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 167); + } + } + } +} diff --git a/Projectiles/Boss/HomingGasBulb.png b/Projectiles/Boss/HomingGasBulb.png new file mode 100644 index 0000000000..6aac5f31d0 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulb.png differ diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.cs b/Projectiles/Boss/HomingGasBulbSporeGas.cs new file mode 100644 index 0000000000..2c074a0199 --- /dev/null +++ b/Projectiles/Boss/HomingGasBulbSporeGas.cs @@ -0,0 +1,108 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HomingGasBulbSporeGas : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + Projectile.ai[1] += 1f; + if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 1800f)) + { + Projectile.localAI[0] += 10f; + Projectile.damage = 0; + } + + if (Projectile.localAI[0] > 255f) + { + Projectile.Kill(); + Projectile.localAI[0] = 255f; + } + + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.12f / 255f, (255 - Projectile.alpha) * 0.06f / 255f, (255 - Projectile.alpha) * 0.12f / 255f); + + Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); + Projectile.rotation += Projectile.velocity.X * 0.02f; + Projectile.rotation += Projectile.direction * 0.002f; + + if (Projectile.velocity.Length() > (CalamityWorld.LegendaryMode ? 2f : 0.5f)) + Projectile.velocity *= 0.99f; + } + + public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 1800f) && Projectile.ai[1] > 120f; + + public override Color? GetAlpha(Color lightColor) + { + if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 1800f)) + { + byte b2 = (byte)((26f - (Projectile.ai[1] - (CalamityWorld.LegendaryMode ? 600f : 1800f))) * 10f); + byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); + } + return new Color(255, 255, 255, Projectile.alpha); + } + + public override bool PreDraw(ref Color lightColor) + { + // Changes the texture of the projectile + Texture2D texture = ModContent.Request(Texture).Value; + switch ((int)Projectile.ai[0]) + { + case 0: + break; + case 1: + texture = ModContent.Request("CalamityMod/Projectiles/Boss/HomingGasBulbSporeGas2").Value; + break; + case 2: + texture = ModContent.Request("CalamityMod/Projectiles/Boss/HomingGasBulbSporeGas3").Value; + break; + default: + break; + } + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, texture); + return false; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + if (Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 1800f) && Projectile.ai[1] > 120f) + target.AddBuff(BuffID.Poisoned, 240); + } + } +} diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.png b/Projectiles/Boss/HomingGasBulbSporeGas.png new file mode 100644 index 0000000000..3fb53db305 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulbSporeGas.png differ diff --git a/Projectiles/Boss/HomingGasBulbSporeGas2.png b/Projectiles/Boss/HomingGasBulbSporeGas2.png new file mode 100644 index 0000000000..1cbbe626e1 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulbSporeGas2.png differ diff --git a/Projectiles/Boss/HomingGasBulbSporeGas3.png b/Projectiles/Boss/HomingGasBulbSporeGas3.png new file mode 100644 index 0000000000..3e01bd6413 Binary files /dev/null and b/Projectiles/Boss/HomingGasBulbSporeGas3.png differ diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 122910d135..7ef3a21af4 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss public class MushBomb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -22,6 +23,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 14; Projectile.hostile = true; Projectile.tileCollide = false; + Projectile.Opacity = 0f; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.aiStyle = ProjAIStyleID.Arrow; @@ -30,6 +32,32 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (Projectile.velocity.Y > 0f) + { + if (Projectile.Opacity == 0f) + { + Projectile.Opacity = 1f; + SoundEngine.PlaySound(SoundID.Item44, Projectile.Center); + int dustAmount = 36; + for (int i = 0; i < dustAmount; i++) + { + Vector2 dustSpawnPosition = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + dustSpawnPosition = dustSpawnPosition.RotatedBy((double)((float)(i - (dustAmount / 2 - 1)) * MathHelper.TwoPi / (float)dustAmount), default) + Projectile.Center; + Vector2 dustVelocity = dustSpawnPosition - Projectile.Center; + int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, 56, dustVelocity.X, dustVelocity.Y); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = dustVelocity; + } + } + } + else + { + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + } + Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -47,6 +75,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X *= 0.995f; } + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; + public override Color? GetAlpha(Color drawColor) => Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 727ced2331..bd394334b7 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Boss public class MushBombFall : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -24,12 +25,39 @@ namespace CalamityMod.Projectiles.Boss Projectile.height = 14; Projectile.hostile = true; Projectile.tileCollide = false; + Projectile.Opacity = 0f; Projectile.penetrate = 1; Projectile.timeLeft = 600; } public override void AI() { + if (Projectile.velocity.Y > 0f) + { + if (Projectile.Opacity == 0f) + { + Projectile.Opacity = 1f; + SoundEngine.PlaySound(SoundID.Item44, Projectile.Center); + int dustAmount = 36; + for (int i = 0; i < dustAmount; i++) + { + Vector2 dustSpawnPosition = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + dustSpawnPosition = dustSpawnPosition.RotatedBy((double)((float)(i - (dustAmount / 2 - 1)) * MathHelper.TwoPi / (float)dustAmount), default) + Projectile.Center; + Vector2 dustVelocity = dustSpawnPosition - Projectile.Center; + int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, 56, dustVelocity.X, dustVelocity.Y); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = dustVelocity; + } + } + } + else + { + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 56, 0f, 0f, 100, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; + } + Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -55,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X *= 0.995f; } - public override bool CanHitPlayer(Player target) => Projectile.velocity.Y >= 0f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; public override Color? GetAlpha(Color drawColor) => Main.zenithWorld ? new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha) : new Color(255, 255, 255, Projectile.alpha); diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index abe8723dd1..0608774646 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -30,30 +30,15 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (Projectile.ai[1] == 0f) - { - for (int num621 = 0; num621 < 2; num621++) - { - int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - Projectile.ai[1] = 1f; - } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; Projectile.Opacity += 0.1f; if (Projectile.Opacity > 1f) Projectile.Opacity = 1f; - int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 0.8f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 85, 0f, 0f, 100, default, 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index ee074cc430..ad1ff09261 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation += Projectile.velocity.X * 0.02f; Projectile.rotation += Projectile.direction * 0.002f; - if (Projectile.velocity.Length() > (CalamityWorld.LegendaryMode ? 2f : 0.5f)) - Projectile.velocity *= 0.98f; + if (Projectile.velocity.Length() > (CalamityWorld.LegendaryMode ? 4f : 2f)) + Projectile.velocity *= 0.99f; } public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 1800f) && Projectile.ai[1] > 120f; diff --git a/Projectiles/Boss/ThornBallSpike.cs b/Projectiles/Boss/ThornBallSpike.cs new file mode 100644 index 0000000000..37a85835e3 --- /dev/null +++ b/Projectiles/Boss/ThornBallSpike.cs @@ -0,0 +1,56 @@ +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ThornBallSpike : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + private const float MaxVelocity = 12f; + private const int TimeLeft = 600; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.hostile = true; + Projectile.penetrate = 1; + Projectile.timeLeft = TimeLeft; + } + + public override void AI() + { + if (Projectile.velocity.Length() < MaxVelocity) + { + Projectile.velocity *= 1.05f; + if (Projectile.velocity.Length() > MaxVelocity) + { + Projectile.velocity.Normalize(); + Projectile.velocity *= MaxVelocity; + } + } + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Poisoned, 90); + + public override bool PreDraw(ref Color lightColor) + { + lightColor = Color.White; + lightColor.A = (byte)Projectile.alpha; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Boss/ThornBallSpike.png b/Projectiles/Boss/ThornBallSpike.png new file mode 100644 index 0000000000..a1be17ccd9 Binary files /dev/null and b/Projectiles/Boss/ThornBallSpike.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index ac67560d72..10bf658fee 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1267,7 +1267,7 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.PoisonSeedPlantera) + else if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera) { projectile.frameCounter++; if (projectile.frameCounter > 1) @@ -1293,8 +1293,6 @@ namespace CalamityMod.Projectiles projectile.ai[0] += 1f; if (projectile.ai[0] >= 120f) { - projectile.ai[0] = 120f; - if (projectile.velocity.Length() < 18f) projectile.velocity *= 1.01f; } @@ -1304,12 +1302,12 @@ namespace CalamityMod.Projectiles if (projectile.timeLeft > 600) projectile.timeLeft = 600; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; return false; } - else if (projectile.type == ProjectileID.ThornBall) + else if (projectile.type == ProjectileID.ThornBall && !projectile.tileCollide) { if (projectile.alpha > 0) { @@ -1318,36 +1316,79 @@ namespace CalamityMod.Projectiles projectile.alpha = 0; } - int num147 = Player.FindClosest(projectile.Center, 1, 1); - float num146 = 7.5f * projectile.ai[1] + Vector2.Distance(Main.player[num147].Center, projectile.Center) * 0.01f; - Vector2 vector12 = Main.player[num147].Center - projectile.Center; - vector12.Normalize(); - vector12 *= num146; - int num148 = 200; - projectile.velocity.X = (projectile.velocity.X * (num148 - 1) + vector12.X) / num148; - - if (projectile.velocity.Length() > 16f) + Point point = projectile.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point); + bool stickOnCollision = tileSafely.HasUnactuatedTile && Main.tileSolid[tileSafely.TileType]; + if (stickOnCollision) { - projectile.velocity.Normalize(); - projectile.velocity *= 16f; - } - - projectile.ai[0] += 1f; - if (projectile.ai[0] > 15f) - { - if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + projectile.velocity = Vector2.Zero; + projectile.ai[1] += 1f; + float explodeGateValue = 600f; + if (projectile.ai[1] >= explodeGateValue) { - projectile.velocity.X *= 0.97f; - if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) - projectile.Kill(); + if (projectile.owner == Main.myPlayer) + { + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 1f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy((radians + projectile.rotation) * k); + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center + Vector2.Normalize(velocity2) * 16f, velocity2, type, (int)Math.Round(projectile.damage * 0.8), 0f, Main.myPlayer); + } + } + + SoundEngine.PlaySound(SoundID.Item17, projectile.position); + + for (int i = 0; i < 8; i++) + { + int randomDustType = Main.rand.NextBool(2) ? 125 : 148; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 0, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int i = 0; i < 10; i++) + { + int randomDustType = Main.rand.NextBool(2) ? 125 : 148; + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 0, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, randomDustType, 0f, 0f, 0, default, 2f); + Main.dust[dust].velocity *= 2f; + } + + projectile.Kill(); } - projectile.velocity.Y += 0.1f; } + else + { + int closestPlayer = Player.FindClosest(projectile.Center, 1, 1); + float homingSpeed = 7.5f + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; + Vector2 homingVelocity = Vector2.Normalize(Main.player[closestPlayer].Center - projectile.Center) * homingSpeed; + int inertia = 200; + projectile.velocity.X = (projectile.velocity.X * (inertia - 1) + homingVelocity.X) / inertia; - projectile.rotation += projectile.velocity.X * 0.05f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + projectile.velocity.Y += 0.1f; + + projectile.rotation += projectile.velocity.X * 0.05f; + + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; + } return false; } @@ -2462,7 +2503,7 @@ namespace CalamityMod.Projectiles } #endregion - #region PostAI + #region Post AI public override void PostAI(Projectile projectile) { if (projectile.FinalExtraUpdate() && flatDRTimer > 0) @@ -2531,7 +2572,7 @@ namespace CalamityMod.Projectiles } #endregion - #region ModifyHitNPC + #region Modify Hit NPC public override void ModifyHitNPC(Projectile projectile, NPC target, ref NPC.HitModifiers modifiers) { Player player = Main.player[projectile.owner]; @@ -2601,14 +2642,14 @@ namespace CalamityMod.Projectiles } #endregion - #region ModifyHitPlayer + #region Modify Hit Player public override void ModifyHitPlayer(Projectile projectile, Player target, ref Player.HurtModifiers modifiers) { modifiers.FinalDamage.Flat -= flatDR; } #endregion - #region CanDamage + CanHit + #region Can Damage + Can Hit public override bool? CanDamage(Projectile projectile) { if (projectile.hostile && (projectile.damage - flatDR <= 0)) @@ -2659,9 +2700,7 @@ namespace CalamityMod.Projectiles if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255) { if (projectile.ModProjectile is null || (projectile.ModProjectile != null && projectile.ModProjectile.CanHitPlayer(Main.LocalPlayer) && (projectile.ModProjectile.CanDamage() ?? true))) - { return Color.Coral; - } } if (projectile.type == ProjectileID.Stinger) @@ -2694,9 +2733,27 @@ namespace CalamityMod.Projectiles return new Color(200, 200, 200, projectile.alpha); } + if (projectile.type == ProjectileID.ThornBall) + { + float startTurningBrownGateValue = 420f; + float timeToReachFullBrown = 180f; + float timeToReachThornExplosion = startTurningBrownGateValue + timeToReachFullBrown; + Color initialColor = Color.White; + initialColor.A = (byte)projectile.alpha; + Color finalColor = Color.RosyBrown; + finalColor.A = (byte)projectile.alpha; + if (projectile.ai[1] > startTurningBrownGateValue) + { + float colorTransitionRatio = (projectile.ai[1] - startTurningBrownGateValue) / timeToReachFullBrown; + Color dehydratedColor = Color.Lerp(initialColor, finalColor, colorTransitionRatio); + return dehydratedColor; + } + else + return initialColor; + } + if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera || - projectile.type == ProjectileID.ThornBall || projectile.type == ProjectileID.CultistBossFireBallClone || - projectile.type == ProjectileID.AncientDoomProjectile) + projectile.type == ProjectileID.CultistBossFireBallClone || projectile.type == ProjectileID.AncientDoomProjectile) { if (projectile.timeLeft < 85) { diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 50938ebc53..44c6526055 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -355,6 +355,19 @@ namespace CalamityMod.Projectiles internal static IProjectileTweak IDStaticIFrames(int f) => new IDStaticIFrameRule(f); #endregion + #region Ignore Water + internal class IgnoreWaterRule : IProjectileTweak + { + internal readonly bool flag = true; + + public IgnoreWaterRule(bool iw) => flag = iw; + public bool AppliesTo(Projectile proj) => true; + public void ApplyTweak(Projectile proj) => proj.ignoreWater = flag; + } + internal static IProjectileTweak IgnoreWater => new IgnoreWaterRule(true); + internal static IProjectileTweak DontIgnoreWater => new IgnoreWaterRule(false); + #endregion + #region Local Immunity Frames internal class LocalIFrameRule : IProjectileTweak { @@ -480,19 +493,6 @@ namespace CalamityMod.Projectiles internal static IProjectileTweak NoTileCollide => new TileCollideRule(false); #endregion - #region Ignore Water - internal class IgnoreWaterRule : IProjectileTweak - { - internal readonly bool flag = true; - - public IgnoreWaterRule(bool iw) => flag = iw; - public bool AppliesTo(Projectile proj) => true; - public void ApplyTweak(Projectile proj) => proj.ignoreWater = flag; - } - internal static IProjectileTweak IgnoreWater => new IgnoreWaterRule(true); - internal static IProjectileTweak DontIgnoreWater => new IgnoreWaterRule(false); - #endregion - #region Time Left internal class TimeLeftDeltaRule : IProjectileTweak { diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index dca8f89914..4b931db4f5 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Enemy { if (Main.zenithWorld) { - CombatText.NewText(Main.player[toTarget].getRect(), Color.Red, "Vibe check.", true); + CombatText.NewText(Main.player[toTarget].getRect(), Color.Red, CalamityUtils.GetTextValue("Misc.CragmawVibeCheck"), true); } Projectile.localAI[0] = 1f; ReelingPlayer = true; diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index b1613daefd..0c71f4b17a 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -26,9 +26,6 @@ namespace CalamityMod.Projectiles.Melee public ref float AlreadyParried => ref Projectile.ai[1]; public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.MeleeNoSpeed; @@ -57,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); SoundEngine.PlaySound(SoundID.Item67); - CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); AlreadyParried = 1f; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index 0a799138db..ca7aac86d1 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -30,9 +30,6 @@ namespace CalamityMod.Projectiles.Melee public ref float AlreadyParried => ref Projectile.ai[1]; public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.MeleeNoSpeed; @@ -64,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume = CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center); - CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); for (int i = 0; i < 5; i ++) //Don't loose your way { diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index c1fed8d70a..09420a0796 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -29,9 +29,6 @@ namespace CalamityMod.Projectiles.Melee public ref float AlreadyParried => ref Projectile.ai[1]; public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.MeleeNoSpeed; @@ -62,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee } SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume = CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center); - CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); for (int i = 0; i < 5; i ++) //Don't loose your way { diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 4df0d9d744..7c908cca5c 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -26,9 +26,6 @@ namespace CalamityMod.Projectiles.Melee public ref float AlreadyParried => ref Projectile.ai[1]; public Player Owner => Main.player[Projectile.owner]; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.MeleeNoSpeed; @@ -56,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee sword.Charge = 10f; SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); SoundEngine.PlaySound(SoundID.Item67); - CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); + CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); AlreadyParried = 1f; } diff --git a/Projectiles/Ranged/ClockworkBowHoldout.cs b/Projectiles/Ranged/ClockworkBowHoldout.cs index d0144325e4..3846715f27 100644 --- a/Projectiles/Ranged/ClockworkBowHoldout.cs +++ b/Projectiles/Ranged/ClockworkBowHoldout.cs @@ -94,9 +94,9 @@ namespace CalamityMod.Projectiles.Ranged ++LoadedBolts; if (LoadedBolts % 2 == 0) - CombatText.NewText(Owner.Hitbox, new Color(155, 255, 255), "Tock", true); + CombatText.NewText(Owner.Hitbox, new Color(155, 255, 255), CalamityUtils.GetTextValue("Misc.ClockworkTock"), true); else - CombatText.NewText(Owner.Hitbox, new Color(255, 200, 100), "Tick", true); + CombatText.NewText(Owner.Hitbox, new Color(255, 200, 100), CalamityUtils.GetTextValue("Misc.ClockworkTick"), true); FramesToLoadBolt *= 0.950f; diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index 2a1ffa2198..081da2d4f0 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Ranged if (shottimer == 1) { SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); - CombatText.NewText(player.getRect(), Color.Gold, "Jackpot!!!", true); + CombatText.NewText(player.getRect(), Color.Gold, CalamityUtils.GetTextValue("Misc.SevensJackpot"), true); } // Every 5 frames, shoot 7 coins. The first 5 frames are excluded for timing purposes if (shottimer % 5 == 0 && shottimer > 5) @@ -164,14 +164,14 @@ namespace CalamityMod.Projectiles.Ranged // A single brick with 100% damage case 1: Shoot(1, ModContent.ProjectileType(), weaponDamage, 0, 2f, 0); - CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true); + CombatText.NewText(player.getRect(), Color.Gray, CalamityUtils.GetTextValue("Misc.SevensBust"), true); SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center); break; // 7 exploding oranges with 200% damage case 2: int doublesDamage = (int)(weaponDamage * TheSevensStriker.DoublesMultiplier); Shoot(7, ModContent.ProjectileType(), doublesDamage, weaponKnockback, 2f, 0.1f); - CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true); + CombatText.NewText(player.getRect(), Color.Orange, CalamityUtils.GetTextValue("Misc.SevensDoubles"), true); SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center); break; // 7 piercing grapes with X% damage @@ -181,7 +181,7 @@ namespace CalamityMod.Projectiles.Ranged int grapeDamage = (int)(weaponDamage * TheSevensStriker.TriplesGrapeMultiplier); Shoot(7, ModContent.ProjectileType(), cherryDamage, weaponKnockback, 1.5f, 0.1f); Shoot(7, ModContent.ProjectileType(), grapeDamage, weaponKnockback, 2f, 0.2f); - CombatText.NewText(player.getRect(), Color.Red, "Triples!", true); + CombatText.NewText(player.getRect(), Color.Red, CalamityUtils.GetTextValue("Misc.SevensTriples"), true); SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center); break; } diff --git a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs index 08272e71ea..6f978ef544 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = new Vector2(Projectile.spriteDirection * 3f, -4f); Projectile.netUpdate = true; if (HeatInterpolant >= 1f) - CombatText.NewText(Owner.Hitbox, Color.OrangeRed, "OUCH! HOT!", true); + CombatText.NewText(Owner.Hitbox, Color.OrangeRed, CalamityUtils.GetTextValue("Misc.AutocannonHot"), true); return; } diff --git a/Projectiles/Summon/Umbrella/MagicHammer.cs b/Projectiles/Summon/Umbrella/MagicHammer.cs index 9d2841e9d1..2f450e6cae 100644 --- a/Projectiles/Summon/Umbrella/MagicHammer.cs +++ b/Projectiles/Summon/Umbrella/MagicHammer.cs @@ -263,7 +263,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella if ((Behavior == 3f || Behavior == 4f) && Main.rand.NextBool(20) && Projectile.soundDelay <= 0) { Rectangle location = new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height); - CombatText.NewText(location, new Color(239, 113, 152), "Stylish!", true); + CombatText.NewText(location, new Color(239, 113, 152), CalamityUtils.GetTextValue("Misc.StylishHammerHit"), true); SoundEngine.PlaySound(StylishSound with { Volume = 0.35f }, target.Center); Projectile.soundDelay = 60; for (int i = 0; i < 5; i++) diff --git a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs index 2c268d0b93..1f6eef7c60 100644 --- a/Tiles/Abyss/AbyssAmbient/AbyssVent.cs +++ b/Tiles/Abyss/AbyssAmbient/AbyssVent.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - AddMapEntry(new Color(106, 80, 102), CreateMapEntryName()); + AddMapEntry(new Color(106, 80, 102), CalamityUtils.GetText($"{LocalizationCategory}.AbyssVent.MapEntry")); DustType = 33; base.SetStaticDefaults(); diff --git a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs index c2bc6dfe05..14e185ff67 100644 --- a/Tiles/Abyss/AbyssAmbient/ThermalVent.cs +++ b/Tiles/Abyss/AbyssAmbient/ThermalVent.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient TileObjectData.newTile.LavaDeath = true; TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); - AddMapEntry(new Color(132, 56, 42), CreateMapEntryName()); + AddMapEntry(new Color(132, 56, 42), CalamityUtils.GetText($"{LocalizationCategory}.ThermalVent.MapEntry")); DustType = 162; base.SetStaticDefaults(); diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index 0baf1704d0..994a68b8a8 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.Abyss TileObjectData.newTile.DrawYOffset = 2; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.addTile(Type); - AddMapEntry(new Color(103, 65, 64), CreateMapEntryName()); + AddMapEntry(new Color(103, 65, 64), CalamityUtils.GetText($"{LocalizationCategory}.SteamGeyser.MapEntry")); DustType = (int)CalamityDusts.SulfurousSeaAcid; base.SetStaticDefaults(); diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs index be256d1fa0..b716315fae 100644 --- a/Tiles/DraedonSummoner/CodebreakerTile.cs +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Tiles.DraedonSummoner { // Create a warning if someone attempts to click on a codebreaker without a computer with which to open the UI. if (!codebreakerTileEntity.ContainsDecryptionComputer) - CombatText.NewText(player.Hitbox, Color.Cyan, "No decryption computer installed"); + CombatText.NewText(player.Hitbox, Color.Cyan, CalamityUtils.GetTextValue("Misc.NoComputer")); CodebreakerUI.ViewedTileEntityID = -1; SoundEngine.PlaySound(SoundID.MenuClose); diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs index 5cd81bc636..16ff5ce0a5 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Utilities/FurnitureSetupUtils.cs @@ -1145,6 +1145,7 @@ namespace CalamityMod /// Whether this tile is supposed to have a solid top. Defaults to true. internal static void SetUpPiano(this ModTile mt, bool lavaImmune = false, bool solidTop = true) { + Main.tileTable[mt.Type] = solidTop; Main.tileSolidTop[mt.Type] = solidTop; Main.tileLighted[mt.Type] = true; Main.tileFrameImportant[mt.Type] = true; diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index e5a557fbaf..1b1b5c7cde 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -294,6 +294,34 @@ namespace CalamityMod } } + /// + /// Shortcut for finding a specific string in the tooltip and replacing it with a new string
+ /// Typically used for dynamic tooltip updating. Consider overriding Tooltip or using String.Format for applying constants. + ///
+ /// The tooltip list provided to a ModifyTooltips TML hook. + /// The key to be replaced. + /// The new key. + public static void FindAndReplace(this List tooltips, string replacedKey, string newKey) + { + TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Text.Contains(replacedKey)); + if (line != null) + line.Text = line.Text.Replace(replacedKey, newKey); + } + + /// + /// Shortcut for automatically placing one keybind within a tooltip. Requires the "[KEY]" string to be replaced. + /// + /// The tooltip list provided to a ModifyTooltips TML hook. + /// The ModKeybind to integrate into the tooltip. + public static void IntegrateHotkey(this List tooltips, ModKeybind mhk) + { + if (Main.dedServ || mhk is null) + return; + + string finalKey = mhk.TooltipHotkeyString(); + tooltips.FindAndReplace("[KEY]", finalKey); + } + // Original code lifted from Iban's extended armor tooltips. /// /// Performs standard edits to a list of tooltip lines to add more if the Left SHIFT key is held down.