From adfbf09ad07ffbbfe308d8b7db5ffe45d305f895 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Sun, 2 Oct 2022 10:47:37 -0400 Subject: [PATCH] Added dodge function for Amalgamated Brain and the Amalgam, reduced the dodge cooldown of Brain of Confusion and the Evolution --- Balancing/BalancingConstants.cs | 5 +++-- CalPlayer/CalamityPlayer.cs | 3 +++ ILEditing/MechanicILChanges.cs | 2 +- Items/Accessories/AmalgamatedBrain.cs | 7 ++++++- Items/Accessories/TheAmalgam.cs | 7 ++++++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 9d423548e8..691ac22e48 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -34,10 +34,11 @@ // Dodge cooldowns (in frames) // TODO -- Some of these could be moved to the respective item files internal static readonly int BeltDodgeCooldown = 5400; - internal static readonly int BrainDodgeCooldown = 7200; + internal static readonly int BrainDodgeCooldown = 5400; + internal static readonly int AmalgamDodgeCooldown = 5400; internal static readonly int MirrorDodgeCooldown = 5400; internal static readonly int DaedalusReflectCooldown = 5400; - internal static readonly int EvolutionReflectCooldown = 7200; + internal static readonly int EvolutionReflectCooldown = 5400; // Internal vanilla item damage variables internal static readonly float LeatherWhipTagDamageMultiplier = 1.08f; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 09d172e66a..44515a88d2 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -5869,6 +5869,9 @@ namespace CalamityMod.CalPlayer } } + // By setting brainOfConfusionItem, these accessories have this code already, + // but doing it again allows for increased duration + The Amalgam's other buffs, + // and also doesn't have random chance (why does Brain of Confusion not guarantee confusion on hit) if (aBrain || amalgam) { for (int m = 0; m < Main.maxNPCs; m++) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 4616938634..f429cc5250 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -402,7 +402,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldarg_0); // Emit a delegate which sets the player's Calamity dodge cooldown and sends a sync packet appropriately. - cursor.EmitDelegate>((Player p) => p.AddCooldown(GlobalDodge.ID, BalancingConstants.BrainDodgeCooldown)); + cursor.EmitDelegate>((Player p) => p.AddCooldown(GlobalDodge.ID, p.Calamity().amalgam ? BalancingConstants.AmalgamDodgeCooldown : BalancingConstants.BrainDodgeCooldown)); } #endregion Removal of Dodge RNG diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 1598945fb2..c98c99c88a 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; @@ -15,6 +16,9 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Amalgamated Brain"); Tooltip.SetDefault("10% increased damage\n" + "Shade rains down when you are hit\n" + + "Grants the ability to dodge attacks\n" + + $"The dodge has a {BalancingConstants.BrainDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects\n" + + "Temporarily increases critical strike chance and summon damage after a dodge\n" + "You will confuse nearby enemies when you are struck"); } @@ -31,6 +35,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.aBrain = true; + player.brainOfConfusionItem = Item; if (player.immune) { var source = player.GetSource_Accessory(Item); diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 7cfa78bfaf..831b8e333a 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Balancing; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; @@ -22,6 +23,9 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Extends the duration of potion buffs by 100% and potion buffs remain active even after you die\n" + "15% increased damage\n" + "Shade rains down when you are hit\n" + + "Grants the ability to dodge attacks\n" + + $"The dodge has a {BalancingConstants.AmalgamDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects\n" + + "Temporarily increases critical strike chance and summon damage after a dodge\n" + "Nearby enemies receive a variety of debuffs when you are hit"); Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(9, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; @@ -40,6 +44,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.amalgam = true; + player.brainOfConfusionItem = Item; player.GetDamage() += 0.15f; if (player.immune)