From 109eadb2f1ff4f2da2c22ecabd122ac16e08ac8b Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Tue, 26 May 2020 23:04:49 -0400 Subject: [PATCH 01/73] set up basics for calamitas npc --- CalPlayer/CalamityPlayer.cs | 5 + NPCs/CalamityGlobalNPC.cs | 8 + NPCs/TownNPCs/WITCH.cs | 334 ++++++++++++++++++ NPCs/TownNPCs/WITCH.png | Bin 0 -> 4396 bytes NPCs/TownNPCs/WITCH_Head.png | Bin 0 -> 342 bytes .../SeethingDischargeBrimstoneHellblast.cs | 12 + 6 files changed, 359 insertions(+) create mode 100644 NPCs/TownNPCs/WITCH.cs create mode 100644 NPCs/TownNPCs/WITCH.png create mode 100644 NPCs/TownNPCs/WITCH_Head.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1c967fe618..5b55734ffd 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -132,6 +132,7 @@ namespace CalamityMod.CalPlayer public bool newCirrusInventory = false; public bool newAmidiasInventory = false; public bool newBanditInventory = false; + public bool newCalamitasInventory = false; #endregion #region Stat Meter @@ -972,6 +973,7 @@ namespace CalamityMod.CalPlayer newCirrusInventory = false; newAmidiasInventory = false; newBanditInventory = false; + newCalamitasInventory = false; } public override TagCompound Save() @@ -1019,6 +1021,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newCirrusInventory", newCirrusInventory); boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); boost.AddWithCondition("newBanditInventory", newBanditInventory); + boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); return new TagCompound { @@ -1090,6 +1093,7 @@ namespace CalamityMod.CalPlayer newCirrusInventory = boost.Contains("newCirrusInventory"); newAmidiasInventory = boost.Contains("newAmidiasInventory"); newBanditInventory = boost.Contains("newBanditInventory"); + newCalamitasInventory = boost.Contains("newCalamitasInventory"); rage = tag.GetAsInt("stress"); adrenaline = tag.GetAsInt("adrenaline"); @@ -1191,6 +1195,7 @@ namespace CalamityMod.CalPlayer BitsByte flags6 = reader.ReadByte(); newBanditInventory = flags6[0]; + newCalamitasInventory = flags6[1]; } else { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 3f5e146fa3..e252e2c6d3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4670,6 +4670,10 @@ namespace CalamityMod.NPCs { DrawNewInventoryAlert(npc); } + else if (npc.type == NPCType() && Main.LocalPlayer.Calamity().newCalamitasInventory) + { + DrawNewInventoryAlert(npc); + } else { switch (npc.type) @@ -5736,6 +5740,10 @@ namespace CalamityMod.NPCs { Main.LocalPlayer.Calamity().newBanditInventory = true; } + else if (types[i] == NPCType()) + { + Main.LocalPlayer.Calamity().newCalamitasInventory = true; + } else { switch (types[i]) diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs new file mode 100644 index 0000000000..ff27ce9ad1 --- /dev/null +++ b/NPCs/TownNPCs/WITCH.cs @@ -0,0 +1,334 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class WITCH : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Witch"); + + Main.npcFrameCount[npc.type] = 26; + NPCID.Sets.ExtraFramesCount[npc.type] = 9; + NPCID.Sets.AttackFrameCount[npc.type] = 4; + NPCID.Sets.DangerDetectRange[npc.type] = 700; + NPCID.Sets.AttackType[npc.type] = 2; + NPCID.Sets.AttackTime[npc.type] = 90; + NPCID.Sets.AttackAverageChance[npc.type] = 15; + NPCID.Sets.MagicAuraColor[npc.type] = new Color(250, 50, 50); + } + + public override void SetDefaults() + { + npc.townNPC = true; + npc.friendly = true; + npc.lavaImmune = true; + npc.width = 18; + npc.height = 40; + npc.aiStyle = 7; + npc.damage = 10; + //Has the same amount of life, defense, and dr as SCal + npc.Calamity().DR = CalamityWorld.death ? 0.75f : 0.7f; + npc.defense = 120; + npc.lifeMax = (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f)); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.knockBackResist = 0.8f; + animationType = NPCID.Wizard; + } + + public override void AI() + { + //To account for revengeance/death mode switching + if (npc.lifeMax != (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f))) + { + npc.lifeMax = (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f)); + } + if (npc.Calamity().DR != (CalamityWorld.death ? 0.75f : 0.7f)) + { + npc.Calamity().DR = CalamityWorld.death ? 0.75f : 0.7f; + } + } + + public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedSCal; + + public override string TownNPCName() => "Calamitas"; + + public override string GetChat() + { + if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) + { + if (Main.rand.NextBool(2)) + return "I deeply appreciate you rescuing me from being trapped within my frozen castle... It's been many, many years..."; + else + return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; + } + + IList dialogue = new List(); + + if (Main.dayTime) + { + dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); + dialogue.Add("My dear! What is it you would like to talk about today?"); + dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); + dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); + dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); + dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); + } + else + { + dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); + dialogue.Add("You could break the icy stillness in the air tonight."); + dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); + dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); + dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); + dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); + } + + dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); + + if (BirthdayParty.PartyIsUp) + dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); + + if (NPC.downedMoonlord) + { + dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); + dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); + } + + if (CalamityWorld.downedPolterghast) + dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); + + if (CalamityWorld.downedYharon) + dialogue.Add("...Where is Lord Yharim? He must be up to something..."); + + int dryad = NPC.FindFirstNPC(NPCID.Dryad); + if (dryad != -1) + dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); + + if (Main.player[Main.myPlayer].Calamity().chibii) + dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); + + if (Main.player[Main.myPlayer].Calamity().cryogenSoul) + dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); + + if (Main.hardMode) + dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); + + return dialogue[Main.rand.Next(dialogue.Count)]; + } + + public override void SetChatButtons(ref string button, ref string button2) + { + button = Language.GetTextValue("LegacyInterface.28"); + } + + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + { + Main.LocalPlayer.Calamity().newCalamitasInventory = false; + shop = true; + } + } + + public override void SetupShop(Chest shop, ref int nextSlot) + { + //Melee weapons + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Ranged weapons + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Magic weapons + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Summon weapons + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Rogue weapons + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Hybrid weapons + if (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Accessories + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + //Tools + if (Main.LocalPlayer.HasItem(ItemType())) + { + shop.item[nextSlot].SetDefaults(ItemType()); + nextSlot++; + } + } + + // Make this Town NPC teleport to the Queen statue when triggered. + public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue; + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 50; + knockback = 10f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 10; + randExtraCooldown = 50; + } + + //public override void TownNPCAttackMagic(ref float auraLightMultiplier) + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = ProjectileType(); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 2f; + } + + //Explode into red dust when die + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + npc.position = npc.Center; + npc.width = npc.height = 50; + npc.position.X -= npc.width / 2; + npc.position.Y -= npc.height / 2; + for (int dustIndex = 0; dustIndex < 5; dustIndex++) + { + int brimstone = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimstone].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[brimstone].scale = 0.5f; + Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int indexDust = 0; indexDust < 10; indexDust++) + { + int fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[fire].noGravity = true; + Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[fire].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/WITCH.png new file mode 100644 index 0000000000000000000000000000000000000000..b6d9064a49be7651124bf7c5cd93b16cfdfecaaa GIT binary patch literal 4396 zcmeHKdpy&7AOEe5$=qooY`K($$fYDP!!g%}av5ooKB9~kmQA9kyou|%u^?IJ?Jbyp0=lou;y?>Y2@AZ3qzMs$g^4%$di=Cvn zvN!+$lJ5zGD}000FD zPJ3;I@2aX9N+{}SYFTdIZX+r0DFzQkAUv#a9xg6Xp1u@6{{j`2R6wiZu*u0I2Tw!? zHQU1E>=q#?8eY zWbgm;0l0sHYk_lHOTl|b1AtVk@CRv+s5k@w5?AeQtoBmUM`g`fyOuA;0pTel707fx_3=F}*%8vN-`D(UZHPlYreN#62T*le^nN|#R6gAs@d$nq~zlNfXf-}gn5q}weZ%W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G( zcH%Bjh~(rL+ouxgxym*|>^uJ>N1bVFqW>~mNw+lK-lV-*ok<$KHZFn@w>9(ZimXOD zn|ayZw4tR5o34R6?D1!( z*Sl46tM9|rncfopK1qqy8GItYi6qsJ<*76K&Q z=B7wJxDyj*q&}QIUwIzPDSN&NILnz&sOaCR9uE2URHyP*z%;J|ZS;~&`rtLokd2Rt z9XlHo2dB#7l@v3O4)j~ec>f+8@S+zfXoY7wvg%~pdZbgP;}lMXpAv@l(4{pM@T+`R z1C(~yJ;iHq26JSA6P(Cc`oag;!hHbc9_`rhtC@?`wXTt!iEShXiMFC7L8R4xvEw>Ezz`cmjwOl^ zyT6xAs7XTB)RhTaOCWaCbT97miEAYt^@#+A4Q+dz#|myGD-`06-dfl7I{ed&#tR(@ zzVPPKaDL07yo>HnRiw3bKcWIww{gg8!bXr-=c|Sfdf(Plv1~E0ab&^Kk9Koo^Up4U zZhEC_n7&`oKR}b9HA!^@o&`BA?!;Z!oy z(Z%2s*Er3p<*PGC(5cpP{XIB%M}G&C=+jI@h#U|memmDpx$|m|$TzWE+O)Um;P|Z1 z_lDlli(DClmJ8Znb)xp6cX#9-_Z#zIP##~u6fWcq{K*kgq2%Iae%&`B&Tx{e75bm zK5H_oEhb)4$GDisodgyO&74EL-ax+jm%*ORs{Qg=-zILb-1Gae^_F|!E_^zl9#IHy zx@$=m)ARMaIV{|2IugAut5v`B7(VbDI$)j7uJ-1*Q(&2u7M4Jf*D+#nPOrE)@Re?TfH^jKSA44lIuDa=43W zW-!b}%O}mo>M|=^OR)H{!^gpNWL_$mhN)k+{V{JadHOJGGbC-+CSJHC4Cd^VzLc}1)#319JrLr z$xQ(Zy?*%&YuLVf@&!eF_pw8e9QXJUxHN= 10) { From 1f9bd87e5395e575092872f9165df849140ae576 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 9 Apr 2021 18:08:01 -0500 Subject: [PATCH 02/73] Minor adjustments to the SCal Town NPC --- CalPlayer/CalamityPlayer.cs | 5 ++ NPCs/TownNPCs/WITCH.cs | 153 ++++-------------------------------- 2 files changed, 21 insertions(+), 137 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 5cf0890c55..41ea4ba7f6 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -150,6 +150,7 @@ namespace CalamityMod.CalPlayer public bool newCirrusInventory = false; public bool newAmidiasInventory = false; public bool newBanditInventory = false; + public bool newCalamitasInventory = false; #endregion #region Stat Meter @@ -1039,6 +1040,7 @@ namespace CalamityMod.CalPlayer newCirrusInventory = false; newAmidiasInventory = false; newBanditInventory = false; + newCalamitasInventory = false; } public override TagCompound Save() @@ -1086,6 +1088,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newCirrusInventory", newCirrusInventory); boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); boost.AddWithCondition("newBanditInventory", newBanditInventory); + boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); return new TagCompound { @@ -1160,6 +1163,7 @@ namespace CalamityMod.CalPlayer newCirrusInventory = boost.Contains("newCirrusInventory"); newAmidiasInventory = boost.Contains("newAmidiasInventory"); newBanditInventory = boost.Contains("newBanditInventory"); + newCalamitasInventory = boost.Contains("newCalamitasInventory"); // Load rage from "stress" if this is an older save. Otherwise load it from "rage", its new name. if (tag.ContainsKey("stress")) @@ -1293,6 +1297,7 @@ namespace CalamityMod.CalPlayer BitsByte flags6 = reader.ReadByte(); newBanditInventory = flags6[0]; + newCalamitasInventory = flags6[1]; } else { diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index ff27ce9ad1..9f3bfa7159 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -45,35 +45,27 @@ namespace CalamityMod.NPCs.TownNPCs npc.height = 40; npc.aiStyle = 7; npc.damage = 10; - //Has the same amount of life, defense, and dr as SCal - npc.Calamity().DR = CalamityWorld.death ? 0.75f : 0.7f; + + // You should not be able to kill SCal under any typical circumstances. + npc.Calamity().DR = 0.999999f; + npc.Calamity().unbreakableDR = true; + npc.lifeMax = 1000000; + npc.defense = 120; - npc.lifeMax = (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f)); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.knockBackResist = 0.8f; animationType = NPCID.Wizard; } - public override void AI() - { - //To account for revengeance/death mode switching - if (npc.lifeMax != (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f))) - { - npc.lifeMax = (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f)); - } - if (npc.Calamity().DR != (CalamityWorld.death ? 0.75f : 0.7f)) - { - npc.Calamity().DR = CalamityWorld.death ? 0.75f : 0.7f; - } - } - public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedSCal; public override string TownNPCName() => "Calamitas"; public override string GetChat() { + // TODO: Give this town NPC unique dialog. + if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) { if (Main.rand.NextBool(2)) @@ -136,10 +128,7 @@ namespace CalamityMod.NPCs.TownNPCs return dialogue[Main.rand.Next(dialogue.Count)]; } - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - } + public override void SetChatButtons(ref string button, ref string button2) => button = Language.GetTextValue("LegacyInterface.28"); public override void OnChatButtonClicked(bool firstButton, ref bool shop) { @@ -152,125 +141,13 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) { - //Melee weapons + // NOTE: This town NPC is intended to not have an actual shop in the future and will instead have a special system. + // This item is only here temporarily. if (Main.LocalPlayer.HasItem(ItemType())) { shop.item[nextSlot].SetDefaults(ItemType()); nextSlot++; } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Ranged weapons - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Magic weapons - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Summon weapons - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Rogue weapons - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Hybrid weapons - if (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Accessories - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } - //Tools - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; - } } // Make this Town NPC teleport to the Queen statue when triggered. @@ -301,7 +178,7 @@ namespace CalamityMod.NPCs.TownNPCs multiplier = 2f; } - //Explode into red dust when die + // Explode into red dust on death. public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) @@ -310,7 +187,7 @@ namespace CalamityMod.NPCs.TownNPCs npc.width = npc.height = 50; npc.position.X -= npc.width / 2; npc.position.Y -= npc.height / 2; - for (int dustIndex = 0; dustIndex < 5; dustIndex++) + for (int i = 0; i < 5; i++) { int brimstone = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimstone].velocity *= 3f; @@ -320,11 +197,13 @@ namespace CalamityMod.NPCs.TownNPCs Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int indexDust = 0; indexDust < 10; indexDust++) + + for (int i = 0; i < 10; i++) { int fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; Main.dust[fire].velocity *= 5f; + fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[fire].velocity *= 2f; } From b7b90f86b7a2251d9c3a4f949bb9674318acd968 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:15:58 -0500 Subject: [PATCH 03/73] Start of Cal Reforge system --- CalPlayer/CalamityPlayer.cs | 8 + CalPlayer/CalamityPlayerMiscEffects.cs | 16 + CalamityMod.cs | 10 + .../UI/CalamitasReforgeBackground.png | Bin 0 -> 1094 bytes ExtraTextures/UI/CalamitasReforgePillar.png | Bin 0 -> 505 bytes ExtraTextures/UI/CalamitasReforgeSlot.png | Bin 0 -> 465 bytes Items/CalamityGlobalItem.cs | 29 +- NPCs/TownNPCs/WITCH.cs | 19 +- .../CalamitasEnchantUI.cs | 298 ++++++++++++++++++ UI/CalamitasEnchantments/Enchantment.cs | 38 +++ .../EnchantmentManager.cs | 64 ++++ 11 files changed, 469 insertions(+), 13 deletions(-) create mode 100644 ExtraTextures/UI/CalamitasReforgeBackground.png create mode 100644 ExtraTextures/UI/CalamitasReforgePillar.png create mode 100644 ExtraTextures/UI/CalamitasReforgeSlot.png create mode 100644 UI/CalamitasEnchantments/CalamitasEnchantUI.cs create mode 100644 UI/CalamitasEnchantments/Enchantment.cs create mode 100644 UI/CalamitasEnchantments/EnchantmentManager.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 41ea4ba7f6..cdd99317ed 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -993,6 +993,10 @@ namespace CalamityMod.CalPlayer public bool omegaBlueTransformationPower; #endregion + #region Calamitas Enchant Effects + public bool sacrificeEnchant = false; + #endregion Calamitas Enchant Effects + #endregion #region SavingAndLoading @@ -1355,6 +1359,8 @@ namespace CalamityMod.CalPlayer // Max health reductions if (crimEffigy) player.statLifeMax2 = (int)(player.statLifeMax2 * 0.9); + if (sacrificeEnchant) + player.statLifeMax2 = (int)(player.statLifeMax2 * 0.8); if (regenator) player.statLifeMax2 = (int)(player.statLifeMax2 * 0.5); @@ -1976,6 +1982,8 @@ namespace CalamityMod.CalPlayer RageDuration = DefaultRageDuration; RageDamageBoost = DefaultRageDamageBoost; + sacrificeEnchant = false; + lastProjectileHit = null; } #endregion diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 9f61959bb8..b153e0338a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -91,6 +91,9 @@ namespace CalamityMod.CalPlayer // Misc effects, because I don't know what else to call it MiscEffects(player, modPlayer, mod); + // Calamitas enchant held effects + EnchantHeldItemEffects(player, modPlayer, player.ActiveItem()); + // Max life and mana effects MaxLifeAndManaEffects(player, modPlayer, mod); @@ -2019,6 +2022,19 @@ namespace CalamityMod.CalPlayer } #endregion + #region Calamitas Enchantment Held Item Effects + public static void EnchantHeldItemEffects(Player player, CalamityPlayer modPlayer, Item heldItem) + { + if (heldItem.IsAir) + return; + + if (!heldItem.Calamity().AppliedEnchantment.HasValue || heldItem.Calamity().AppliedEnchantment.Value.HoldEffect is null) + return; + + heldItem.Calamity().AppliedEnchantment.Value.HoldEffect(player); + } + #endregion + #region Max Life And Mana Effects private static void MaxLifeAndManaEffects(Player player, CalamityPlayer modPlayer, Mod mod) { diff --git a/CalamityMod.cs b/CalamityMod.cs index 544e28d565..d690046eb4 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -38,6 +38,7 @@ using CalamityMod.Schematics; using CalamityMod.Skies; using CalamityMod.TileEntities; using CalamityMod.UI; +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -144,6 +145,7 @@ namespace CalamityMod BossHealthBarManager.Load(this); DraedonStructures.Load(); CalamityLists.LoadLists(); + EnchantmentManager.LoadAllEnchantments(); SetupVanillaDR(); SetupBossKillTimes(); SetupBossVelocityScalingValues(); @@ -259,6 +261,7 @@ namespace CalamityMod bossVelocityDamageScaleValues?.Clear(); bossVelocityDamageScaleValues = null; + EnchantmentManager.UnloadAllEnchantments(); CalamityLists.UnloadLists(); NPCStats.Unload(); @@ -855,6 +858,13 @@ namespace CalamityMod return true; }, InterfaceScaleType.None)); + // Calamitas Enchantment UI + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Calamitas Enchantment", () => + { + CalamitasEnchantUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + // Popup GUIs. layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () => { diff --git a/ExtraTextures/UI/CalamitasReforgeBackground.png b/ExtraTextures/UI/CalamitasReforgeBackground.png new file mode 100644 index 0000000000000000000000000000000000000000..ceca2dd493f70e71bda58de23a3c4a2f5a167988 GIT binary patch literal 1094 zcmeAS@N?(olHy`uVBq!ia0y~yU{nBN5e{ac$ewM|oIr}PILO_JVcj{Imp~3nx}&cn z1H;CC?mvmFK)z6bPlzj!-Z#QOCa}EyM73eVk-&q3;quR44d~a*$))q zEbxddW?*6#aLlM@Cf$jhQr~W?Xykxct>#msQ zlDFdRPuM0^eS6Hb@9v39Dp4+# zeeD)mg`EKe@xvnod|0;0A^xZnJB=KG$tOAIdf1W9D5ffej$p8BRVbJOIt+o#(B70WZ9 zUDDr}cIo*>hvWOtFWDuLu@H`Zm|u!BGtvMyifPnmgW?7^e4zY4>kuA!+&T~Z-^0Me zLJW*rFzLLNfdD<>i$t=*z*92y=jD~#r85@Z%UjS|wYyR5)mwhnU8i;ipP0;RGFe?ZL(Sjpg3r7^ zF$?S`-v4d1^H}ir6BCa)Fk4=d$WU;XV&;9~@%cRS-bs7vH5boqmRN?vf{+QFxvgmrA6@o%2htPae}44$rjF6*2UngEBCgR}qu literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasReforgePillar.png b/ExtraTextures/UI/CalamitasReforgePillar.png new file mode 100644 index 0000000000000000000000000000000000000000..982e193751e07365311cab4571fc91d0f3910941 GIT binary patch literal 505 zcmeAS@N?(olHy`uVBq!ia0vp^Qb3%TW1o;L3#{w9%Z`Qs7D&Q>eh%9Dc z;M)(vj25iHDnQ36dAc};czD0PdN8lqK!D}KE!NvNvW1!c|6hAI(N~i_;`s!RsWZH% z)LzWu5vF2K^pc;)-y2Qt&*F0yUnJLvVm)V1$9Pxh{J z)qgg$>KvDNU-&@G>8C_5BNyYEwa=}Vrh0NJXK&|XnA;H1_K{6jrGt5S2s@V``_;>{ z&Kz`6kCEw7IXCr^+p#A$ef`HRp2b+`wn#HMIavOmX0NIsxI$z?$n_46dPbgQoKN{p z{X7&{7VT|&U@FLZ&QF;Avi77;iVIA#IIev1ZSnr%sr7W(?7Uy^RruF`7iL=@)MI_p zIZ}Dib7ME2k3tjt7r0FddM4SD{9=l+*t%2ta}OWlz7=O4@nicwH=zqQ*Y&kLU$q3Y dKi{Hbe>SLNn{1`wE}!XT!FNWwsd-c#@`pa`ik}UO*DUhsNS1hID?m$fmJ|-f#+CF$@{m@ zfXcj=OyUDld?i7C!T*r~gX@7iCx9}X1s;*bKm`Xum~qF%?6*J%h&OXJD;_$A3V-kRUl<5`A<$)7dlJbw1?PI9m)%yT(bINR#6#-SU} zpRing#N(_vIk<~svBzv-O;=NO1IK{&_=z_a8v~d0FMQS_R_B_M%F-p)e)PV&fb#SD z>3*DPA2&UJdBN_aj{1g~r-PFDBd6VX&?DgP{MAEYxwZFl7UQ^bosJn#Tg$utam7Dm zoSSfLW0ilv-G7CgjD0O9PI1PFR5u=DEq$dhVY=WV&VUjJrKcN@6~}&CR37_y%7s(& zp8x1Q=ElVPMQq`dH3GbrQc~hQC!QAVEz-PqEn{*d?^ button = Language.GetTextValue("LegacyInterface.28"); + public override void SetChatButtons(ref string button, ref string button2) => button = "Enchant"; public override void OnChatButtonClicked(bool firstButton, ref bool shop) { if (firstButton) { + Main.playerInventory = true; Main.LocalPlayer.Calamity().newCalamitasInventory = false; - shop = true; - } - } + CalamitasEnchantUI.NPCIndex = npc.whoAmI; + CalamitasEnchantUI.CurrentlyViewing = true; - public override void SetupShop(Chest shop, ref int nextSlot) - { - // NOTE: This town NPC is intended to not have an actual shop in the future and will instead have a special system. - // This item is only here temporarily. - if (Main.LocalPlayer.HasItem(ItemType())) - { - shop.item[nextSlot].SetDefaults(ItemType()); - nextSlot++; + shop = false; } } diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs new file mode 100644 index 0000000000..74f51a0b5f --- /dev/null +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -0,0 +1,298 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI; +using Terraria.UI.Chat; + +namespace CalamityMod.UI.CalamitasEnchants +{ + public class CalamitasEnchantUI + { + public static int NPCIndex = -1; + public static int SelectedEnchantmentIndex = -1; + public static float SelectedEnchantmentScaleFactor = 1f; + public static Item CurrentlyHeldItem = new Item(); + + public static bool CurrentlyViewing = false; + + public static readonly Vector2 ReforgeUITopLeft = new Vector2(28f, 270f); + public static readonly float ResolutionRatio = Main.screenHeight / 1440f; + + public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + + public static bool InRangeOfNPC() + { + // Don't bother trying if no valid NPC has been selected yet. + if (!Main.npc.IndexInRange(NPCIndex) || !Main.npc[NPCIndex].active) + return false; + + Rectangle validTalkArea = Utils.CenteredRectangle(Main.LocalPlayer.Center, new Vector2(Player.tileRangeX * 2f, Player.tileRangeY) * 16f); + return validTalkArea.Intersects(Main.npc[NPCIndex].Hitbox); + } + + public static void Draw(SpriteBatch spriteBatch) + { + // Don't bother doing anything except resetting if not looking at the UI. + if (!CurrentlyViewing) + { + // If an item was stored, release it back into the world. + if (!CurrentlyHeldItem.IsAir) + { + Main.LocalPlayer.QuickSpawnClonedItem(CurrentlyHeldItem, CurrentlyHeldItem.stack); + CurrentlyHeldItem.TurnToAir(); + } + + NPCIndex = -1; + return; + } + + // Check if the player can still be in the UI. + if (Main.LocalPlayer.chest != -1 || Main.LocalPlayer.sign != -1 || Main.LocalPlayer.talkNPC == -1 || !Main.playerInventory || !InRangeOfNPC() || Main.InGuideCraftMenu) + { + CurrentlyViewing = false; + + // Check if the player has any items being held. + // If they do, drop it onto the ground. + Main.LocalPlayer.dropItemCheck(); + + // Reload visible recipes in case the dropped item was an ingredient. + Recipe.FindRecipes(); + return; + } + + // Open the inventory and stop talking to any NPCs by default while the UI is open, similar to the goblin tinkerer. + Main.playerInventory = true; + Main.npcChatText = string.Empty; + + Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgeBackground"); + Texture2D pillarTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgePillar"); + Vector2 backgroundScale = MathHelper.Clamp(ResolutionRatio * 1.25f, 0.67f, 1f) * new Vector2(1.3f, 1f); + + // Draw the background. + spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); + + // As well as a cool pillar to the side. + Vector2 pillarDrawPosition = ReforgeUITopLeft + Vector2.UnitX * (backgroundScale.X * backgroundTexture.Width + 25f); + pillarDrawPosition.Y += 20f; + spriteBatch.Draw(pillarTexture, pillarDrawPosition, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + DrawIcons(spriteBatch, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon); + if (isHoveringOverItemIcon) + InteractWithItemSlot(); + + Enchantment? enchantmentToUse = DisplayEnchantOptions(spriteBatch, ReforgeUITopLeft + new Vector2(112f, 55f), out List textAreas); + InteractWithTextAreas(textAreas); + + int cost = 0; + if (SelectedEnchantmentIndex != -1) + cost = DisplayEnchantCost(spriteBatch); + + if (isHoveringOverReforgeIcon && Main.mouseLeft && Main.mouseLeftRelease) + InteractWithReforgeIcon(enchantmentToUse, cost); + } + + public static void DrawIcons(SpriteBatch spriteBatch, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) + { + Texture2D itemSlotTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgeSlot"); + Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(40f, 65f); + Vector2 reforgeIconDrawPosition = itemSlotDrawPosition + Vector2.UnitX * (itemSlotTexture.Width * 0.5f + 24f); + + isHoveringOverReforgeIcon = false; + Rectangle reforgeIconArea = Utils.CenteredRectangle(reforgeIconDrawPosition, Main.reforgeTexture[0].Size()); + + Texture2D reforgeIconTexture = Main.reforgeTexture[0]; + + // Have the reforge icon light up if the mouse is hovering over it. + if (MouseScreenArea.Intersects(reforgeIconArea)) + { + reforgeIconTexture = Main.reforgeTexture[1]; + isHoveringOverReforgeIcon = true; + } + + // This will be used for item deposit/withdrawal logic. + isHoveringOverItemIcon = MouseScreenArea.Intersects(Utils.CenteredRectangle(itemSlotDrawPosition, itemSlotTexture.Size())); + + spriteBatch.Draw(itemSlotTexture, itemSlotDrawPosition, null, Color.White, 0f, itemSlotTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + // Draw the draw the item within the slot, if it exists. + if (!CurrentlyHeldItem.IsAir) + AttemptToDrawItemInIcon(spriteBatch, itemSlotDrawPosition); + + spriteBatch.Draw(reforgeIconTexture, reforgeIconDrawPosition, null, Color.White, 0f, reforgeIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + } + + public static void AttemptToDrawItemInIcon(SpriteBatch spriteBatch, Vector2 drawPosition) + { + float inventoryScale = Main.inventoryScale; + Texture2D itemTexture = Main.itemTexture[CurrentlyHeldItem.type]; + Rectangle itemFrame = itemTexture.Frame(1, 1, 0, 0); + if (Main.itemAnimations[CurrentlyHeldItem.type] != null) + itemFrame = Main.itemAnimations[CurrentlyHeldItem.type].GetFrame(itemTexture); + + float baseScale = 1f; + Color _ = Color.White; + ItemSlot.GetItemLight(ref _, ref baseScale, CurrentlyHeldItem, false); + + float itemScale = 1f; + + // Ensure that the item being drawn does not exceed a certain size. + // If it does, constrict its scale to prevent it from going beyond the maximum. + if (itemFrame.Width > 36 || itemFrame.Height > 36) + itemScale = 36f / MathHelper.Max(itemFrame.Width, itemFrame.Height); + + itemScale *= inventoryScale * baseScale; + + // Draw the item. + if (ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) + { + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, itemTexture.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, itemTexture.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); + } + } + + public static void InteractWithItemSlot() + { + if (!CurrentlyHeldItem.IsAir) + { + // Display item stats. + Main.HoverItem = CurrentlyHeldItem.Clone(); + + // Force the HoverItem to be displayed. + Main.instance.MouseTextHackZoom(string.Empty); + } + + // Prevent the player from say, firing a weapon while the mouse is hovering over the slot. + Main.LocalPlayer.mouseInterface = false; + Main.blockMouse = true; + + bool isHeldItemEnchantable = Main.mouseItem.damage > 0; + + // Attempt to exchange if the slot is clicked. + if (Main.mouseLeftRelease && Main.mouseLeft && (isHeldItemEnchantable || Main.mouseItem.IsAir)) + { + // Reset the enchantment variables. + SelectedEnchantmentScaleFactor = 1f; + SelectedEnchantmentIndex = -1; + + Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); + Main.PlaySound(SoundID.Grab); + } + } + + public static Enchantment? DisplayEnchantOptions(SpriteBatch spriteBatch, Vector2 drawPosition, out List textAreas) + { + IEnumerable possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); + + // Initialize the areas. + textAreas = new List(); + + if (SelectedEnchantmentIndex == -1) + SelectedEnchantmentScaleFactor = MathHelper.Lerp(SelectedEnchantmentScaleFactor, 1f, 0.15f); + else + SelectedEnchantmentScaleFactor = MathHelper.Lerp(SelectedEnchantmentScaleFactor, 1.35f, 0.15f); + + // Don't attempt to draw anything if no valid enchantments exist for an item, for whatever reason. + if (possibleEnchantments.Count() <= 0) + return null; + + int totalEnchantmentsToDisplay = Math.Min(possibleEnchantments.Count(), 6); + Enchantment? enchantmentToUse = null; + for (int i = 0; i < totalEnchantmentsToDisplay; i++) + { + Vector2 scale = Vector2.One; + Enchantment enchantment = possibleEnchantments.ElementAt(i); + + // Save this enchantment specifically if it's the one that's going to be selected. + if (i == SelectedEnchantmentIndex) + { + scale *= SelectedEnchantmentScaleFactor; + enchantmentToUse = enchantment; + } + + // Draw all options. + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, enchantment.Name, drawPosition, Color.Orange, 0f, Vector2.Zero, scale); + textAreas.Add(new Rectangle((int)drawPosition.X, (int)drawPosition.Y, 180, 40)); + drawPosition.Y += 60f; + } + + return enchantmentToUse; + } + + public static void InteractWithTextAreas(List textAreas) + { + for (int i = 0; i < textAreas.Count; i++) + { + Rectangle area = textAreas[i]; + if (Main.mouseLeft && Main.mouseLeftRelease && MouseScreenArea.Intersects(area)) + { + if (SelectedEnchantmentIndex == i) + SelectedEnchantmentIndex = -1; + else + SelectedEnchantmentIndex = i; + break; + } + } + } + + public static int DisplayEnchantCost(SpriteBatch spriteBatch) + { + if (CurrentlyHeldItem.IsAir) + return 0; + + int cost = CurrentlyHeldItem.value * 4; + Point topLeftDrawPosition = (ReforgeUITopLeft + new Vector2(18f, 34f)).ToPoint(); + ItemSlot.DrawMoney(spriteBatch, "Cost: ", topLeftDrawPosition.X, topLeftDrawPosition.Y, Utils.CoinsSplit(cost)); + + return cost; + } + + public static void InteractWithReforgeIcon(Enchantment? enchantmentToUse, int cost) + { + // If there's no valid item in the slot, do nothing. + if (CurrentlyHeldItem.IsAir) + return; + + // If there is no cost or the player cannot afford it, do nothing. + if (cost <= 0L || !Main.LocalPlayer.CanBuyItem(cost)) + return; + + // If no enchantment has been selected, do nothing. + if (!enchantmentToUse.HasValue) + return; + + Item originalItem = CurrentlyHeldItem.Clone(); + byte oldPrefix = CurrentlyHeldItem.prefix; + CurrentlyHeldItem.SetDefaults(CurrentlyHeldItem.type); + CurrentlyHeldItem.Prefix(oldPrefix); + CurrentlyHeldItem = CurrentlyHeldItem.CloneWithModdedDataFrom(originalItem); + + CurrentlyHeldItem.Calamity().AppliedEnchantment = enchantmentToUse.Value; + enchantmentToUse.Value.CreationEffect?.Invoke(CurrentlyHeldItem); + + // Update the compare item. This is used check comparisons when showing reforge tooltip bonuses. + // Updating it with the same bonuses as what was applied to the real item will negate the incorrect numbers, + // such as absurd damage boosts. + if (Main.cpItem is null || Main.cpItem.netID != CurrentlyHeldItem.netID) + { + Main.cpItem = new Item(); + Main.cpItem.netDefaults(CurrentlyHeldItem.netID); + } + Main.cpItem.Calamity().AppliedEnchantment = enchantmentToUse.Value; + enchantmentToUse.Value.CreationEffect?.Invoke(Main.cpItem); + + // Take away the money for the cost. + Main.LocalPlayer.BuyItem(cost); + + // Reset the enchantment variables. + SelectedEnchantmentScaleFactor = 1f; + SelectedEnchantmentIndex = -1; + + Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); + } + } +} diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs new file mode 100644 index 0000000000..40e18b539f --- /dev/null +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -0,0 +1,38 @@ +using System; +using Terraria; + +namespace CalamityMod.UI.CalamitasEnchants +{ + public struct Enchantment + { + public string Name; + public string Description; + public Action CreationEffect; + public Action HoldEffect; + public Predicate ApplyRequirement; + public Enchantment(string name, string description, Action creationEffect, Action holdEffect, Predicate requirement) + { + Name = name; + Description = description; + CreationEffect = creationEffect; + HoldEffect = holdEffect; + ApplyRequirement = requirement; + } + public Enchantment(string name, string description, Action holdEffect, Predicate requirement) + { + Name = name; + Description = description; + CreationEffect = null; + HoldEffect = holdEffect; + ApplyRequirement = requirement; + } + public Enchantment(string name, string description, Action creationEffect, Predicate requirement) + { + Name = name; + Description = description; + CreationEffect = creationEffect; + HoldEffect = null; + ApplyRequirement = requirement; + } + } +} diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs new file mode 100644 index 0000000000..f9e2af8c44 --- /dev/null +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; + +namespace CalamityMod.UI.CalamitasEnchants +{ + public static class EnchantmentManager + { + public static List EnchantmentList { get; internal set; } = new List(); + public static Enchantment ClearEnchantment { get; internal set; } + public static IEnumerable GetValidEnchantmentsForItem(Item item) + { + // Do nothing if the item cannot be enchanted. + if (item.IsAir || item.damage <= 0) + yield break; + + // Only give the option to clear if the item already has an enchantment. + if (item.Calamity().AppliedEnchantment.HasValue) + { + yield return ClearEnchantment; + yield break; + } + + // Otherwise check based on all the requirements for all enchantments. + foreach (Enchantment enchantment in EnchantmentList) + { + // Don't incorporate an enchantment in the list if the item already has it. + if (item.Calamity().AppliedEnchantment.HasValue && item.Calamity().AppliedEnchantment.Value.Equals(enchantment)) + continue; + + if (enchantment.ApplyRequirement(item)) + yield return enchantment; + } + } + + public static Enchantment? FindByName(string name, StringComparison comparisonType) + { + Enchantment? enchantment = EnchantmentList.FirstOrDefault(enchant => enchant.Name.Equals(name, comparisonType)); + if (enchantment.HasValue && !enchantment.Value.Equals(default(Enchantment))) + return enchantment; + return null; + } + + public static void LoadAllEnchantments() + { + EnchantmentList.Add(new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", item => + { + item.damage = (int)(item.damage * 1.2); + }, + player => + { + player.Calamity().sacrificeEnchant = true; + }, item => item.damage > 0)); + + ClearEnchantment = new Enchantment("Disenchant", string.Empty, item => + { + item.Calamity().AppliedEnchantment = null; + }, item => item.damage > 0); + } + + public static void UnloadAllEnchantments() => EnchantmentList = null; + } +} From ab98cf874ceeb9eaed773a26e4654b5e804f737a Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:26:11 -0500 Subject: [PATCH 04/73] Made disenchantment text white --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 74f51a0b5f..192a622a1f 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -204,9 +204,15 @@ namespace CalamityMod.UI.CalamitasEnchants Enchantment? enchantmentToUse = null; for (int i = 0; i < totalEnchantmentsToDisplay; i++) { + Color textColor = Color.Orange; Vector2 scale = Vector2.One; Enchantment enchantment = possibleEnchantments.ElementAt(i); + // Make the text for the disenchantment option white to differentiate it from + // everything else. + if (enchantment.Equals(EnchantmentManager.ClearEnchantment)) + textColor = Color.White; + // Save this enchantment specifically if it's the one that's going to be selected. if (i == SelectedEnchantmentIndex) { @@ -215,7 +221,7 @@ namespace CalamityMod.UI.CalamitasEnchants } // Draw all options. - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, enchantment.Name, drawPosition, Color.Orange, 0f, Vector2.Zero, scale); + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, enchantment.Name, drawPosition, textColor, 0f, Vector2.Zero, scale); textAreas.Add(new Rectangle((int)drawPosition.X, (int)drawPosition.Y, 180, 40)); drawPosition.Y += 60f; } From a49ee384457f89c9ed88063aef4944d656c68f84 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:32:36 -0500 Subject: [PATCH 05/73] Reforge bonus text problem fix --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 192a622a1f..dc701508cf 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -283,11 +283,9 @@ namespace CalamityMod.UI.CalamitasEnchants // Update the compare item. This is used check comparisons when showing reforge tooltip bonuses. // Updating it with the same bonuses as what was applied to the real item will negate the incorrect numbers, // such as absurd damage boosts. - if (Main.cpItem is null || Main.cpItem.netID != CurrentlyHeldItem.netID) - { + if (Main.cpItem is null) Main.cpItem = new Item(); - Main.cpItem.netDefaults(CurrentlyHeldItem.netID); - } + Main.cpItem.SetDefaults(Main.cpItem.type); Main.cpItem.Calamity().AppliedEnchantment = enchantmentToUse.Value; enchantmentToUse.Value.CreationEffect?.Invoke(Main.cpItem); From 23bd9850ad5e4bf18b757d851773f155deb558e2 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 13 Apr 2021 16:32:50 -0500 Subject: [PATCH 06/73] Slight enchantment definition cleanup --- .../EnchantmentManager.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index f9e2af8c44..95fab232ff 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -44,19 +44,14 @@ namespace CalamityMod.UI.CalamitasEnchants public static void LoadAllEnchantments() { - EnchantmentList.Add(new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", item => - { - item.damage = (int)(item.damage * 1.2); - }, - player => - { - player.Calamity().sacrificeEnchant = true; - }, item => item.damage > 0)); + EnchantmentList.Add(new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", + item => item.damage = (int)(item.damage * 1.1), + player => player.Calamity().sacrificeEnchant = true, + item => item.damage > 0)); - ClearEnchantment = new Enchantment("Disenchant", string.Empty, item => - { - item.Calamity().AppliedEnchantment = null; - }, item => item.damage > 0); + ClearEnchantment = new Enchantment("Disenchant", string.Empty, + item => item.Calamity().AppliedEnchantment = null, + item => item.damage > 0); } public static void UnloadAllEnchantments() => EnchantmentList = null; From db24a79d1681fda1320f4023f3e097d8d4b1e200 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 13 Apr 2021 17:08:35 -0500 Subject: [PATCH 07/73] Added descriptions on selection --- .../CalamitasEnchantUI.cs | 64 ++++++++++++------- .../EnchantmentManager.cs | 14 ++++ 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index dc701508cf..e128d01c5f 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -14,7 +14,7 @@ namespace CalamityMod.UI.CalamitasEnchants public class CalamitasEnchantUI { public static int NPCIndex = -1; - public static int SelectedEnchantmentIndex = -1; + public static Enchantment? SelectedEnchantment = null; public static float SelectedEnchantmentScaleFactor = 1f; public static Item CurrentlyHeldItem = new Item(); @@ -85,12 +85,22 @@ namespace CalamityMod.UI.CalamitasEnchants if (isHoveringOverItemIcon) InteractWithItemSlot(); - Enchantment? enchantmentToUse = DisplayEnchantOptions(spriteBatch, ReforgeUITopLeft + new Vector2(112f, 55f), out List textAreas); - InteractWithTextAreas(textAreas); + DisplayEnchantmentOptions(spriteBatch, ReforgeUITopLeft + new Vector2(112f, 55f), + out List textAreas, + out IEnumerable possibleEnchantments, + out Enchantment? enchantmentToUse); + + InteractWithTextAreas(textAreas, possibleEnchantments); int cost = 0; - if (SelectedEnchantmentIndex != -1) - cost = DisplayEnchantCost(spriteBatch); + if (SelectedEnchantment.HasValue) + { + cost = DisplayEnchantmentCost(spriteBatch, out Point costDrawPositionTopLeft); + Point descriptionDrawPositionTopLeft = costDrawPositionTopLeft; + descriptionDrawPositionTopLeft.Y += 90; + + DisplayEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); + } if (isHoveringOverReforgeIcon && Main.mouseLeft && Main.mouseLeftRelease) InteractWithReforgeIcon(enchantmentToUse, cost); @@ -177,31 +187,31 @@ namespace CalamityMod.UI.CalamitasEnchants { // Reset the enchantment variables. SelectedEnchantmentScaleFactor = 1f; - SelectedEnchantmentIndex = -1; + SelectedEnchantment = null; Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); Main.PlaySound(SoundID.Grab); } } - public static Enchantment? DisplayEnchantOptions(SpriteBatch spriteBatch, Vector2 drawPosition, out List textAreas) + public static void DisplayEnchantmentOptions(SpriteBatch spriteBatch, Vector2 drawPosition, out List textAreas, out IEnumerable possibleEnchantments, out Enchantment? enchantmentToUse) { - IEnumerable possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); + enchantmentToUse = null; + possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); // Initialize the areas. textAreas = new List(); - if (SelectedEnchantmentIndex == -1) + if (SelectedEnchantment is null) SelectedEnchantmentScaleFactor = MathHelper.Lerp(SelectedEnchantmentScaleFactor, 1f, 0.15f); else SelectedEnchantmentScaleFactor = MathHelper.Lerp(SelectedEnchantmentScaleFactor, 1.35f, 0.15f); // Don't attempt to draw anything if no valid enchantments exist for an item, for whatever reason. if (possibleEnchantments.Count() <= 0) - return null; + return; int totalEnchantmentsToDisplay = Math.Min(possibleEnchantments.Count(), 6); - Enchantment? enchantmentToUse = null; for (int i = 0; i < totalEnchantmentsToDisplay; i++) { Color textColor = Color.Orange; @@ -214,7 +224,7 @@ namespace CalamityMod.UI.CalamitasEnchants textColor = Color.White; // Save this enchantment specifically if it's the one that's going to be selected. - if (i == SelectedEnchantmentIndex) + if (enchantment.Equals(SelectedEnchantment)) { scale *= SelectedEnchantmentScaleFactor; enchantmentToUse = enchantment; @@ -222,41 +232,47 @@ namespace CalamityMod.UI.CalamitasEnchants // Draw all options. ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, enchantment.Name, drawPosition, textColor, 0f, Vector2.Zero, scale); - textAreas.Add(new Rectangle((int)drawPosition.X, (int)drawPosition.Y, 180, 40)); - drawPosition.Y += 60f; + textAreas.Add(new Rectangle((int)drawPosition.X, (int)drawPosition.Y, 180, 30)); + drawPosition.Y += 32f; } - - return enchantmentToUse; } - public static void InteractWithTextAreas(List textAreas) + public static void InteractWithTextAreas(List textAreas, IEnumerable possibleEnchantments) { for (int i = 0; i < textAreas.Count; i++) { Rectangle area = textAreas[i]; + Enchantment enchantmentAtIndex = possibleEnchantments.ElementAt(i); if (Main.mouseLeft && Main.mouseLeftRelease && MouseScreenArea.Intersects(area)) { - if (SelectedEnchantmentIndex == i) - SelectedEnchantmentIndex = -1; + if (SelectedEnchantment.Equals(enchantmentAtIndex)) + SelectedEnchantment = null; else - SelectedEnchantmentIndex = i; + SelectedEnchantment = enchantmentAtIndex; break; } } } - public static int DisplayEnchantCost(SpriteBatch spriteBatch) + public static int DisplayEnchantmentCost(SpriteBatch spriteBatch, out Point costDrawPositionTopLeft) { + costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(18f, 34f)).ToPoint(); if (CurrentlyHeldItem.IsAir) return 0; int cost = CurrentlyHeldItem.value * 4; - Point topLeftDrawPosition = (ReforgeUITopLeft + new Vector2(18f, 34f)).ToPoint(); - ItemSlot.DrawMoney(spriteBatch, "Cost: ", topLeftDrawPosition.X, topLeftDrawPosition.Y, Utils.CoinsSplit(cost)); + ItemSlot.DrawMoney(spriteBatch, "Cost: ", costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y, Utils.CoinsSplit(cost)); return cost; } + public static void DisplayEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) + { + Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); + Vector2 scale = new Vector2(0.55f, 0.6f); + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Description, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); + } + public static void InteractWithReforgeIcon(Enchantment? enchantmentToUse, int cost) { // If there's no valid item in the slot, do nothing. @@ -294,7 +310,7 @@ namespace CalamityMod.UI.CalamitasEnchants // Reset the enchantment variables. SelectedEnchantmentScaleFactor = 1f; - SelectedEnchantmentIndex = -1; + SelectedEnchantment = null; Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 95fab232ff..66cde07d57 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -22,6 +22,14 @@ namespace CalamityMod.UI.CalamitasEnchants yield break; } + // If an enchanted has already been selected, only show it to make space for the description. + // It can be unselected to reveal the others again. + if (CalamitasEnchantUI.SelectedEnchantment.HasValue) + { + yield return CalamitasEnchantUI.SelectedEnchantment.Value; + yield break; + } + // Otherwise check based on all the requirements for all enchantments. foreach (Enchantment enchantment in EnchantmentList) { @@ -49,6 +57,12 @@ namespace CalamityMod.UI.CalamitasEnchants player => player.Calamity().sacrificeEnchant = true, item => item.damage > 0)); + EnchantmentList.Add(new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", + item => item.damage = (int)(item.damage * 1.1), + player => player.Calamity().sacrificeEnchant = true, + item => item.damage > 0)); + + // Special disenchantment thing. This is separated from the list on purpose. ClearEnchantment = new Enchantment("Disenchant", string.Empty, item => item.Calamity().AppliedEnchantment = null, item => item.damage > 0); From 7973d01491b220d0ada687e020b11952de00b08b Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 14 Apr 2021 10:38:37 -0500 Subject: [PATCH 08/73] Load effect fix --- .../UI/CalamitasReforgeBackground.png | Bin 1094 -> 159 bytes Items/CalamityGlobalItem.cs | 13 ++++++++++--- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ExtraTextures/UI/CalamitasReforgeBackground.png b/ExtraTextures/UI/CalamitasReforgeBackground.png index ceca2dd493f70e71bda58de23a3c4a2f5a167988..c708fc5ae96e452b17ab94b9311288e42c419c87 100644 GIT binary patch delta 117 zcmX@cF`rSfGr-TCmrII^fq{Y7)59f*fq^jugc+HEB91X(-zF+5@GuAXgt%t#@@g$y zx@lsbxHW^Sr;B4q#=W-(85x1fniT%8&+~8qvXFqxYDTL92F4q=Uetg@Jzf1=);T3K F0RR<*91Q>f literal 1094 zcmeAS@N?(olHy`uVBq!ia0y~yU{nBN5e{ac$ewM|oIr}PILO_JVcj{Imp~3nx}&cn z1H;CC?mvmFK)z6bPlzj!-Z#QOCa}EyM73eVk-&q3;quR44d~a*$))q zEbxddW?*6#aLlM@Cf$jhQr~W?Xykxct>#msQ zlDFdRPuM0^eS6Hb@9v39Dp4+# zeeD)mg`EKe@xvnod|0;0A^xZnJB=KG$tOAIdf1W9D5ffej$p8BRVbJOIt+o#(B70WZ9 zUDDr}cIo*>hvWOtFWDuLu@H`Zm|u!BGtvMyifPnmgW?7^e4zY4>kuA!+&T~Z-^0Me zLJW*rFzLLNfdD<>i$t=*z*92y=jD~#r85@Z%UjS|wYyR5)mwhnU8i;ipP0;RGFe?ZL(Sjpg3r7^ zF$?S`-v4d1^H}ir6BCa)Fk4=d$WU;XV&;9~@%cRS-bs7vH5boqmRN?vf{+QFxvgmrA6@o%2htPae}44$rjF6*2UngEBCgR}qu diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index dcd05cd988..5b80aa79fa 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -228,9 +228,6 @@ namespace CalamityMod.Items } if (item.type == ItemID.StarCannon) item.UseSound = null; - - if (!item.IsAir && item.Calamity().AppliedEnchantment.HasValue && item.Calamity().AppliedEnchantment.Value.CreationEffect != null) - item.Calamity().AppliedEnchantment.Value.CreationEffect(item); } #endregion @@ -495,7 +492,12 @@ namespace CalamityMod.Items Enchantment? savedEnchantment = EnchantmentManager.FindByName(tag.GetString("enchantment"), StringComparison.OrdinalIgnoreCase); if (savedEnchantment.HasValue) + { AppliedEnchantment = savedEnchantment.Value; + bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null; + if (hasCreationEffect) + item.Calamity().AppliedEnchantment.Value.CreationEffect(item); + } } public override void LoadLegacy(Item item, BinaryReader reader) @@ -542,7 +544,12 @@ namespace CalamityMod.Items Enchantment? savedEnchantment = EnchantmentManager.FindByName(reader.ReadString(), StringComparison.OrdinalIgnoreCase); if (savedEnchantment.HasValue) + { AppliedEnchantment = savedEnchantment.Value; + bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null; + if (hasCreationEffect) + item.Calamity().AppliedEnchantment.Value.CreationEffect(item); + } } #endregion diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index e128d01c5f..4ddede0d76 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -71,7 +71,7 @@ namespace CalamityMod.UI.CalamitasEnchants Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgeBackground"); Texture2D pillarTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgePillar"); - Vector2 backgroundScale = MathHelper.Clamp(ResolutionRatio * 1.25f, 0.67f, 1f) * new Vector2(1.3f, 1f); + Vector2 backgroundScale = MathHelper.Clamp(ResolutionRatio * 1.25f, 0.67f, 1f) * new Vector2(1.3f, 0.85f); // Draw the background. spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); @@ -85,7 +85,7 @@ namespace CalamityMod.UI.CalamitasEnchants if (isHoveringOverItemIcon) InteractWithItemSlot(); - DisplayEnchantmentOptions(spriteBatch, ReforgeUITopLeft + new Vector2(112f, 55f), + DisplayEnchantmentOptions(spriteBatch, ReforgeUITopLeft + new Vector2(112f, 35f), out List textAreas, out IEnumerable possibleEnchantments, out Enchantment? enchantmentToUse); @@ -109,7 +109,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static void DrawIcons(SpriteBatch spriteBatch, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) { Texture2D itemSlotTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgeSlot"); - Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(40f, 65f); + Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(40f, 45f); Vector2 reforgeIconDrawPosition = itemSlotDrawPosition + Vector2.UnitX * (itemSlotTexture.Width * 0.5f + 24f); isHoveringOverReforgeIcon = false; From ddd43c2875a03824f6d2da668412f1d0545d3745 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 16 Apr 2021 20:26:27 -0500 Subject: [PATCH 09/73] Improved UI visuals --- ExtraTextures/UI/CalamitasCurseBackground.png | Bin 0 -> 3317 bytes ...rgeSlot.png => CalamitasCurseItemSlot.png} | Bin .../UI/CalamitasCurseUI_ArrowDown.png | Bin 0 -> 236 bytes .../UI/CalamitasCurseUI_ArrowDownClicked.png | Bin 0 -> 221 bytes .../UI/CalamitasCurseUI_ArrowDownHovered.png | Bin 0 -> 196 bytes ExtraTextures/UI/CalamitasCurseUI_ArrowUp.png | Bin 0 -> 205 bytes .../UI/CalamitasCurseUI_ArrowUpClicked.png | Bin 0 -> 190 bytes .../UI/CalamitasCurseUI_ArrowUpHovered.png | Bin 0 -> 142 bytes ExtraTextures/UI/CalamitasCurseUI_Button.png | Bin 0 -> 585 bytes .../UI/CalamitasCurseUI_ButtonClicked.png | Bin 0 -> 468 bytes .../UI/CalamitasCurseUI_ButtonHovered.png | Bin 0 -> 409 bytes .../UI/CalamitasReforgeBackground.png | Bin 159 -> 0 bytes ExtraTextures/UI/CalamitasReforgePillar.png | Bin 505 -> 0 bytes .../CalamitasEnchantUI.cs | 227 +++++++++++------- .../EnchantmentManager.cs | 15 +- 15 files changed, 135 insertions(+), 107 deletions(-) create mode 100644 ExtraTextures/UI/CalamitasCurseBackground.png rename ExtraTextures/UI/{CalamitasReforgeSlot.png => CalamitasCurseItemSlot.png} (100%) create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ArrowDown.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ArrowUp.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_Button.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ButtonClicked.png create mode 100644 ExtraTextures/UI/CalamitasCurseUI_ButtonHovered.png delete mode 100644 ExtraTextures/UI/CalamitasReforgeBackground.png delete mode 100644 ExtraTextures/UI/CalamitasReforgePillar.png diff --git a/ExtraTextures/UI/CalamitasCurseBackground.png b/ExtraTextures/UI/CalamitasCurseBackground.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c3ca7fd26bc2e3bbe1e0186c6945ac359ca6df GIT binary patch literal 3317 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- z--9L?QpM8|ymJ|*n;YEUw7&DYZz(FiVe(SVHz$aRqX0wI9;eWWV0Ui>d&k<~skaXOvFmmvfDB*h5iYp#WxjI}-7=J(1ki};UqncrVLNMDkx-#-Q z*@pK3yd-yI1WH$ehx4(91g==X*xYJ6J_ya0&lFb}lnf=(k);$V@qed`WSISEvHz&U ze^Hrt__HH~b{x0#{X&X-x)M!JzsX;Quq(}yyF4sGyvKlWY3Q0_z@f#H3n+#`;Cm#w zOLC&kD{$`tD+$HW!Pc;f1B2)IX2_R*PBSZaJ{BN0n>O}R^Nr~&ypP6fJoU+^K7%{T zt*3H##}C8_zG&Cp#1Aj;?4?GwCyZcYI|L4LbxxwVk?oun^4`ZXDb^#Znm&jWGCqkS zh0mm0HkJ+8fQ6R;c7YNP`il$XdVJeIGl&)MVAN(Ia87Cv{i?Y>H%+&0FfYKy^IjFX z^^}B+X`B-Cd>cYu6UjKiuzA}B*3*`?aQ#&qi8y2Jln>6l;OGPi@)Xxc3qmsy=&VN> zchy%_k?+a@fe{r)>LD+*T84N?C)>9B3F>E;m)F+Cnq11!@+}g4^%bNk sn{%7Tc=KE?Jj_4En~wZM+Wf(hC$1@0eufVI-#?I!wyri0t#H@=1^VAW`v3p{ literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasReforgeSlot.png b/ExtraTextures/UI/CalamitasCurseItemSlot.png similarity index 100% rename from ExtraTextures/UI/CalamitasReforgeSlot.png rename to ExtraTextures/UI/CalamitasCurseItemSlot.png diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowDown.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowDown.png new file mode 100644 index 0000000000000000000000000000000000000000..055426f728f68f8114ac2bdbff7cc1b810909aca GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^@!3HFQ8hUO4DaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(eheoCO|{#XwDmK$uZf!>a)(*y!ov7@`rJTvNZ|pFOj{9Q*yuE`ls=ZE^{- zIDIBDO5|=?deAIy-aIC;1F6Pm)b5|LOqf+8{r^9E^oa?AD>&0iL|U7F8q7{K3;nW| z<+Aa$_;i+wQ*LuG8_ZsQb_UC{^wcMfnKOJ19Bic%7wkX6pc8nbnDMBZ#DaajEetcw cj0_kU-rv#NUY+{jHPA5(p00i_>zopr0P@XF@c;k- literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked.png new file mode 100644 index 0000000000000000000000000000000000000000..21aa985d34eabad705d19fb5d8b16d95ed6fd37f GIT binary patch literal 221 zcmV<303!d1P)Px#mq|oHR49?9&7lp#Kmdi||C%N>piYp63Ixy^Hs}VY834ruC^U*8z@xiChoDe- zO%;loCJl!=QPPkm_tX88U?w8hG490Blo-VK1aN(4Y&XaKVI!z=z*&zy9X|f^QGc zMu^JAM4koKV0uqojp)&|8NQ1)-RcRbWIL79VpwpqCvS4_ eKhIM+EDWJM>RO65Lqe+p%s~tC-&{J^Bf5d3hP{H^<$+$~ALYPOdEBB}pm+_9N3zcq1 z$M5_8kh?3TU37=7e1gHerv;Ypn7`bT74W^jU}>6@X6ntadnLXWdrXq;cwBk2eNn!~ zvfD@9SI$~>=f&~)m&|wW+Y#wkWHI-By=+h0-LyyC?QL39q$4HrflgxZboFyt=akR{ E0FnPsb^rhX literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked.png new file mode 100644 index 0000000000000000000000000000000000000000..fc8bc6b53956aae46219c369e7b52cc23142ae96 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^_!3HE-Zss2cQjEnx?oJHr&dIz4aw%;d~)D+BC9&x*HP0^^q+9JyAq`)>Vv!qmICoRj_)*Ou@^Xh+h@yAWb z;*U0nznXB}L~vcK_=C??O_zVNrEzgbzPfL_Vp?d+@28Arzf12q-})~s9vqaXaC~8m oo}cIAV?{q#A6NMowebh*NgwTv>e0%%KsPXWy85}Sb4q9e0P!|PqW}N^ literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered.png new file mode 100644 index 0000000000000000000000000000000000000000..6894e585fc7ac632738c48ddf95bb60f51eaeccf GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^d_c^_!3HE-Zss2cQjEnx?oJHr&dIz4ay&d;978lF zCZ{ws?bk0eT+sMGV3uIygvdj^jUd1oYr3&Pu-{iAYocY!?GsKdzArxYh}`x#p|-|s mviz#wYO^M1DKop8F)`?E;4?oOma+tBCWEJ|pUXO@geCxK=`NH2 literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasCurseUI_Button.png b/ExtraTextures/UI/CalamitasCurseUI_Button.png new file mode 100644 index 0000000000000000000000000000000000000000..42694b1b18d1d8b8ebf02f2fa13ec55200f70be5 GIT binary patch literal 585 zcmV-P0=E5$P)Px%14%?dR7i=PP1x^xISbneo6 zF!ZQh)Pom63NJ>dSUk9U$xU4mB~i>Mh!zh)Fmn(D*HxSj&*$!MT2~64^?RB5{dvE~ zZ@%C6dt-0{Is;w$)j1}`0Ek=D1?!ZYw9#qdpErs{YKTQ@&VHl+h3R&b^F-Lc)7t=4 z`qBjp6=nx)cB)wPQH|O=dd);j0rO?_;_Yfb0GX2EeAhC*oRtMdio=NbOj8 z7qpp5eV_Jy!oO+n3H4Q(`$B!iSDjmJ8Vy4k09p=J*W-#0jBEg~o{^=!Q(cGo27rrY zij&!`)x7tPR$YH^49Ie%Rp&-)#eo4Zx21aVj-$rVH2{{sDYa>C^aMCUVi|zssB}kf zq(r`79oq@$WM^?fX zc6*>1fWdBMN1}?mmiJEq7r27BF2BzJn6}ll_pGBo X^=OM-Px$j!8s8R7i=1HpW#|9QJHKaU$6FH=5*{h ziAfXvmZqMlo-b3+m;ZjEpUSlhMm(8Hc0b#*_#zrnAY})Qt4Zygpnm@%A^;ATO~OiP zN$nWrh0Ds=aUzT8dp~VzJl6w24U`X%bBlokGzK*QR_8nipwm-Ez0en{M?QcWsDLUc zdfJP-6NoZY`Sjq>QI+jUO>c%9Ln+`ioe z-UvdS?U7JtYh!lH`5F(1(xc7A6adX9O`CW#ya7y|KbZM2FRR^(4^T*D9f;T?AK)k# zOpnN}w<8nJ#6#H;xdY=nNA^l(g;G8|NBV0=9_DRy9_=q3190|uVNhqwJ~v@6A&I=& z)!sx;o&1L~$t(cvek<%n3c&XKx&v_iayPbJCaEK7_gg@O5q$z=fOubZ8x`{a0000< KMNUMnLSTaVUB<5f literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered.png b/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered.png new file mode 100644 index 0000000000000000000000000000000000000000..3b9ad755f11a609e34d1486dfe988940b6e5591d GIT binary patch literal 409 zcmV;K0cQS*P)Px$Q%OWYR7i=R_Lcx=zV7_O17EVzC)|Ac8FI_xkd+%Q;0;o(_V$6r#er+9Z ziss+bOwHQXIsl(9Qw^}clg%5)+W^e2o&mUfoC;s%{8AlBUr>)UEbhz&QC>hPec@B* zy3ZO%yBW_|uS%c4)JfW!aT|b-@vHSlaHY;fGj6NA9^liXRwn{rGDCti4=JD$g0Fl&%(~HAIkiTdn-@sgg-}uTW1o;L3#{w9%Z`Qs7D&Q>eh%9Dc z;M)(vj25iHDnQ36dAc};czD0PdN8lqK!D}KE!NvNvW1!c|6hAI(N~i_;`s!RsWZH% z)LzWu5vF2K^pc;)-y2Qt&*F0yUnJLvVm)V1$9Pxh{J z)qgg$>KvDNU-&@G>8C_5BNyYEwa=}Vrh0NJXK&|XnA;H1_K{6jrGt5S2s@V``_;>{ z&Kz`6kCEw7IXCr^+p#A$ef`HRp2b+`wn#HMIavOmX0NIsxI$z?$n_46dPbgQoKN{p z{X7&{7VT|&U@FLZ&QF;Avi77;iVIA#IIev1ZSnr%sr7W(?7Uy^RruF`7iL=@)MI_p zIZ}Dib7ME2k3tjt7r0FddM4SD{9=l+*t%2ta}OWlz7=O4@nicwH=zqQ*Y&kLU$q3Y dKi{Hbe>SL 0f) + TopButtonClickCountdown--; + if (BottomButtonClickCountdown > 0f) + BottomButtonClickCountdown--; + if (ReforgeButtonClickCountdown > 0f) + ReforgeButtonClickCountdown--; + // Don't bother doing anything except resetting if not looking at the UI. if (!CurrentlyViewing) { @@ -47,6 +59,7 @@ namespace CalamityMod.UI.CalamitasEnchants CurrentlyHeldItem.TurnToAir(); } + EnchantIndex = 0; NPCIndex = -1; return; } @@ -69,71 +82,85 @@ namespace CalamityMod.UI.CalamitasEnchants Main.playerInventory = true; Main.npcChatText = string.Empty; - Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgeBackground"); - Texture2D pillarTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgePillar"); - Vector2 backgroundScale = MathHelper.Clamp(ResolutionRatio * 1.25f, 0.67f, 1f) * new Vector2(1.3f, 0.85f); + Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseBackground"); + Vector2 backgroundScale = Vector2.One * MathHelper.Clamp(ResolutionRatio * 1.25f, 0.67f, 1f); // Draw the background. spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); - // As well as a cool pillar to the side. - Vector2 pillarDrawPosition = ReforgeUITopLeft + Vector2.UnitX * (backgroundScale.X * backgroundTexture.Width + 25f); - pillarDrawPosition.Y += 20f; - spriteBatch.Draw(pillarTexture, pillarDrawPosition, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + // Draw the item icon. + Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(30f, 50f) * backgroundScale; + Vector2 reforgeIconDrawPosition = ReforgeUITopLeft + new Vector2(88f, 60f) * backgroundScale; - DrawIcons(spriteBatch, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon); - if (isHoveringOverItemIcon) - InteractWithItemSlot(); - - DisplayEnchantmentOptions(spriteBatch, ReforgeUITopLeft + new Vector2(112f, 35f), - out List textAreas, - out IEnumerable possibleEnchantments, - out Enchantment? enchantmentToUse); - - InteractWithTextAreas(textAreas, possibleEnchantments); + // Select the enchantment to use. + SelectEnchantment(out IEnumerable possibleEnchantments); + // Draw the cost and description. int cost = 0; if (SelectedEnchantment.HasValue) { - cost = DisplayEnchantmentCost(spriteBatch, out Point costDrawPositionTopLeft); + Point costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(50f, 84f) * backgroundScale).ToPoint(); + cost = DrawEnchantmentCost(spriteBatch, costDrawPositionTopLeft); Point descriptionDrawPositionTopLeft = costDrawPositionTopLeft; descriptionDrawPositionTopLeft.Y += 90; - DisplayEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); + DrawEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); } - if (isHoveringOverReforgeIcon && Main.mouseLeft && Main.mouseLeftRelease) - InteractWithReforgeIcon(enchantmentToUse, cost); + DrawItemIcon(spriteBatch, itemSlotDrawPosition, reforgeIconDrawPosition, backgroundScale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon); + if (isHoveringOverItemIcon) + InteractWithItemSlot(); + + // Draw the buttons. + DrawAndInteractWithButtons(spriteBatch, possibleEnchantments, ReforgeUITopLeft + new Vector2(210f, 50f) * backgroundScale, ReforgeUITopLeft + new Vector2(210f, 90f) * backgroundScale, backgroundScale); + + // Draw the enchantment name. + if (SelectedEnchantment.HasValue) + DrawEnchantmentName(spriteBatch, ReforgeUITopLeft + new Vector2(130f, 64f) * backgroundScale); + + // Handle spending logic. + if (isHoveringOverReforgeIcon) + { + // Prevent the player from say, firing a weapon while the mouse is hovering over the icon. + Main.LocalPlayer.mouseInterface = false; + Main.blockMouse = true; + + if (Main.mouseLeft && Main.mouseLeftRelease) + { + InteractWithEnchantIcon(SelectedEnchantment, cost); + ReforgeButtonClickCountdown = 8f; + } + } } - public static void DrawIcons(SpriteBatch spriteBatch, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) + public static void DrawItemIcon(SpriteBatch spriteBatch, Vector2 itemSlotDrawPosition, Vector2 reforgeIconDrawPosition, Vector2 scale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) { - Texture2D itemSlotTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasReforgeSlot"); - Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(40f, 45f); - Vector2 reforgeIconDrawPosition = itemSlotDrawPosition + Vector2.UnitX * (itemSlotTexture.Width * 0.5f + 24f); - isHoveringOverReforgeIcon = false; - Rectangle reforgeIconArea = Utils.CenteredRectangle(reforgeIconDrawPosition, Main.reforgeTexture[0].Size()); + Texture2D itemSlotTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseItemSlot"); - Texture2D reforgeIconTexture = Main.reforgeTexture[0]; + Texture2D reforgeIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_Button"); + Rectangle reforgeIconArea = new Rectangle((int)reforgeIconDrawPosition.X, (int)reforgeIconDrawPosition.Y, (int)(reforgeIconTexture.Width * scale.X), (int)(reforgeIconTexture.Height * scale.Y)); // Have the reforge icon light up if the mouse is hovering over it. if (MouseScreenArea.Intersects(reforgeIconArea)) { - reforgeIconTexture = Main.reforgeTexture[1]; + reforgeIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered"); isHoveringOverReforgeIcon = true; } - // This will be used for item deposit/withdrawal logic. - isHoveringOverItemIcon = MouseScreenArea.Intersects(Utils.CenteredRectangle(itemSlotDrawPosition, itemSlotTexture.Size())); + if (ReforgeButtonClickCountdown > 0f) + reforgeIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ButtonClicked"); - spriteBatch.Draw(itemSlotTexture, itemSlotDrawPosition, null, Color.White, 0f, itemSlotTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + // This will be used for item deposit/withdrawal logic. + isHoveringOverItemIcon = MouseScreenArea.Intersects(new Rectangle((int)itemSlotDrawPosition.X, (int)itemSlotDrawPosition.Y, (int)(itemSlotTexture.Width * scale.X), (int)(itemSlotTexture.Height * scale.Y))); + + spriteBatch.Draw(itemSlotTexture, itemSlotDrawPosition, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); // Draw the draw the item within the slot, if it exists. if (!CurrentlyHeldItem.IsAir) AttemptToDrawItemInIcon(spriteBatch, itemSlotDrawPosition); - spriteBatch.Draw(reforgeIconTexture, reforgeIconDrawPosition, null, Color.White, 0f, reforgeIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(reforgeIconTexture, reforgeIconDrawPosition, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); } public static void AttemptToDrawItemInIcon(SpriteBatch spriteBatch, Vector2 drawPosition) @@ -156,12 +183,13 @@ namespace CalamityMod.UI.CalamitasEnchants itemScale = 36f / MathHelper.Max(itemFrame.Width, itemFrame.Height); itemScale *= inventoryScale * baseScale; + drawPosition += itemFrame.Size() * itemScale * new Vector2(0.65f, 0.6f); // Draw the item. if (ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) { - spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, itemTexture.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); - spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, itemTexture.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, Vector2.Zero, itemScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, Vector2.Zero, itemScale, SpriteEffects.None, 0f); } } @@ -185,78 +213,88 @@ namespace CalamityMod.UI.CalamitasEnchants // Attempt to exchange if the slot is clicked. if (Main.mouseLeftRelease && Main.mouseLeft && (isHeldItemEnchantable || Main.mouseItem.IsAir)) { - // Reset the enchantment variables. - SelectedEnchantmentScaleFactor = 1f; - SelectedEnchantment = null; - Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); Main.PlaySound(SoundID.Grab); } } - public static void DisplayEnchantmentOptions(SpriteBatch spriteBatch, Vector2 drawPosition, out List textAreas, out IEnumerable possibleEnchantments, out Enchantment? enchantmentToUse) + public static void SelectEnchantment(out IEnumerable possibleEnchantments) { - enchantmentToUse = null; possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); + SelectedEnchantment = null; - // Initialize the areas. - textAreas = new List(); + if (possibleEnchantments.Count() > 0) + SelectedEnchantment = possibleEnchantments.ElementAt(EnchantIndex); + } - if (SelectedEnchantment is null) - SelectedEnchantmentScaleFactor = MathHelper.Lerp(SelectedEnchantmentScaleFactor, 1f, 0.15f); - else - SelectedEnchantmentScaleFactor = MathHelper.Lerp(SelectedEnchantmentScaleFactor, 1.35f, 0.15f); - - // Don't attempt to draw anything if no valid enchantments exist for an item, for whatever reason. - if (possibleEnchantments.Count() <= 0) + public static void DrawAndInteractWithButtons(SpriteBatch spriteBatch, IEnumerable possibleEnchantments, Vector2 topButtonTopLeft, Vector2 bottomButtonTopLeft, Vector2 scale) + { + // Leave the arrows blank if no possible enchants exist. + if (possibleEnchantments.Count() == 0) return; - int totalEnchantmentsToDisplay = Math.Min(possibleEnchantments.Count(), 6); - for (int i = 0; i < totalEnchantmentsToDisplay; i++) + // Decide textures. + Texture2D topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUp"); + Texture2D bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDown"); + if (TopButtonClickCountdown > 0f) + topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked"); + if (BottomButtonClickCountdown > 0f) + bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked"); + + Rectangle topButtonArea = new Rectangle((int)topButtonTopLeft.X, (int)topButtonTopLeft.Y, (int)(topArrowTexture.Width * scale.X), (int)(topArrowTexture.Height * scale.Y)); + Rectangle bottomButtonArea = new Rectangle((int)bottomButtonTopLeft.X, (int)bottomButtonTopLeft.Y, (int)(bottomArrowTexture.Width * scale.X), (int)(bottomArrowTexture.Height * scale.Y)); + bool hoveringOverTopArrow = MouseScreenArea.Intersects(topButtonArea); + bool hoveringOverBottomArrow = MouseScreenArea.Intersects(bottomButtonArea); + if (hoveringOverTopArrow) { - Color textColor = Color.Orange; - Vector2 scale = Vector2.One; - Enchantment enchantment = possibleEnchantments.ElementAt(i); + topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered"); - // Make the text for the disenchantment option white to differentiate it from - // everything else. - if (enchantment.Equals(EnchantmentManager.ClearEnchantment)) - textColor = Color.White; + // Prevent the player from say, firing a weapon while the mouse is hovering over the button. + Main.LocalPlayer.mouseInterface = false; + Main.blockMouse = true; + } + if (hoveringOverBottomArrow) + { + bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered"); - // Save this enchantment specifically if it's the one that's going to be selected. - if (enchantment.Equals(SelectedEnchantment)) + // Prevent the player from say, firing a weapon while the mouse is hovering over the button. + Main.LocalPlayer.mouseInterface = false; + Main.blockMouse = true; + } + + // Draw the arrows. + if (EnchantIndex > 0) + spriteBatch.Draw(topArrowTexture, topButtonTopLeft, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + if (EnchantIndex < possibleEnchantments.Count() - 1) + spriteBatch.Draw(bottomArrowTexture, bottomButtonTopLeft, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + if (Main.mouseLeft && Main.mouseLeftRelease) + { + // Decement the enchantment index if the top button is pressed. + if (hoveringOverTopArrow && EnchantIndex > 0) { - scale *= SelectedEnchantmentScaleFactor; - enchantmentToUse = enchantment; + EnchantIndex--; + TopButtonClickCountdown = 8f; } - // Draw all options. - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, enchantment.Name, drawPosition, textColor, 0f, Vector2.Zero, scale); - textAreas.Add(new Rectangle((int)drawPosition.X, (int)drawPosition.Y, 180, 30)); - drawPosition.Y += 32f; - } - } - - public static void InteractWithTextAreas(List textAreas, IEnumerable possibleEnchantments) - { - for (int i = 0; i < textAreas.Count; i++) - { - Rectangle area = textAreas[i]; - Enchantment enchantmentAtIndex = possibleEnchantments.ElementAt(i); - if (Main.mouseLeft && Main.mouseLeftRelease && MouseScreenArea.Intersects(area)) + // Increment the enchantment index if the bottom button is pressed. + if (hoveringOverBottomArrow && EnchantIndex < possibleEnchantments.Count() - 1) { - if (SelectedEnchantment.Equals(enchantmentAtIndex)) - SelectedEnchantment = null; - else - SelectedEnchantment = enchantmentAtIndex; - break; + EnchantIndex++; + TopButtonClickCountdown = 8f; } } } - public static int DisplayEnchantmentCost(SpriteBatch spriteBatch, out Point costDrawPositionTopLeft) + public static void DrawEnchantmentName(SpriteBatch spriteBatch, Vector2 nameDrawPositionTopLeft) + { + Vector2 scale = new Vector2(0.8f, 0.745f); + Color drawColor = SelectedEnchantment.Value.Equals(EnchantmentManager.ClearEnchantment) ? Color.White : Color.Orange; + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Name, nameDrawPositionTopLeft, drawColor, 0f, Vector2.Zero, scale); + } + + public static int DrawEnchantmentCost(SpriteBatch spriteBatch, Point costDrawPositionTopLeft) { - costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(18f, 34f)).ToPoint(); if (CurrentlyHeldItem.IsAir) return 0; @@ -266,14 +304,21 @@ namespace CalamityMod.UI.CalamitasEnchants return cost; } - public static void DisplayEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) + public static void DrawEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) { Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); - Vector2 scale = new Vector2(0.55f, 0.6f); - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Description, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); + Vector2 scale = new Vector2(0.67f, 0.7f); + foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 400, 10, out _)) + { + if (string.IsNullOrEmpty(line)) + continue; + + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, line, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); + vectorDrawPosition.Y += 16; + } } - public static void InteractWithReforgeIcon(Enchantment? enchantmentToUse, int cost) + public static void InteractWithEnchantIcon(Enchantment? enchantmentToUse, int cost) { // If there's no valid item in the slot, do nothing. if (CurrentlyHeldItem.IsAir) @@ -308,10 +353,6 @@ namespace CalamityMod.UI.CalamitasEnchants // Take away the money for the cost. Main.LocalPlayer.BuyItem(cost); - // Reset the enchantment variables. - SelectedEnchantmentScaleFactor = 1f; - SelectedEnchantment = null; - Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); } } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 66cde07d57..1b136eab90 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -22,15 +22,7 @@ namespace CalamityMod.UI.CalamitasEnchants yield break; } - // If an enchanted has already been selected, only show it to make space for the description. - // It can be unselected to reveal the others again. - if (CalamitasEnchantUI.SelectedEnchantment.HasValue) - { - yield return CalamitasEnchantUI.SelectedEnchantment.Value; - yield break; - } - - // Otherwise check based on all the requirements for all enchantments. + // Check based on all the requirements for all enchantments. foreach (Enchantment enchantment in EnchantmentList) { // Don't incorporate an enchantment in the list if the item already has it. @@ -57,11 +49,6 @@ namespace CalamityMod.UI.CalamitasEnchants player => player.Calamity().sacrificeEnchant = true, item => item.damage > 0)); - EnchantmentList.Add(new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", - item => item.damage = (int)(item.damage * 1.1), - player => player.Calamity().sacrificeEnchant = true, - item => item.damage > 0)); - // Special disenchantment thing. This is separated from the list on purpose. ClearEnchantment = new Enchantment("Disenchant", string.Empty, item => item.Calamity().AppliedEnchantment = null, From ab74c4ebb9359a0031398b7b0dc554df8768ebda Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 16 Apr 2021 20:36:46 -0500 Subject: [PATCH 10/73] Added menu sounds on arrow clicks --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index b00d0ecfbb..8d6d197a16 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -275,13 +275,15 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantIndex--; TopButtonClickCountdown = 8f; + Main.PlaySound(SoundID.MenuTick); } // Increment the enchantment index if the bottom button is pressed. if (hoveringOverBottomArrow && EnchantIndex < possibleEnchantments.Count() - 1) { EnchantIndex++; - TopButtonClickCountdown = 8f; + BottomButtonClickCountdown = 8f; + Main.PlaySound(SoundID.MenuTick); } } } From 8d67efd68a5c041bad3828c2ebd52a786c031106 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 17 Apr 2021 09:28:38 -0500 Subject: [PATCH 11/73] Made requirement definitions less rigid Also did some refactoring and offset the name display a tiny bit --- .../CalamitasEnchantUI.cs | 134 +++++++++--------- UI/CalamitasEnchantments/Enchantment.cs | 19 ++- .../EnchantmentManager.cs | 13 +- Utilities/ItemUtils.cs | 8 ++ 4 files changed, 100 insertions(+), 74 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 8d6d197a16..36e4b51445 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -92,8 +92,11 @@ namespace CalamityMod.UI.CalamitasEnchants Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(30f, 50f) * backgroundScale; Vector2 reforgeIconDrawPosition = ReforgeUITopLeft + new Vector2(88f, 60f) * backgroundScale; + // Prevent the player from say, firing a weapon while the mouse is hovering over the UI. + DisableMouseWhenOverUI(backgroundTexture, backgroundScale); + // Select the enchantment to use. - SelectEnchantment(out IEnumerable possibleEnchantments); + IEnumerable possibleEnchantments = SelectEnchantment(); // Draw the cost and description. int cost = 0; @@ -116,23 +119,69 @@ namespace CalamityMod.UI.CalamitasEnchants // Draw the enchantment name. if (SelectedEnchantment.HasValue) - DrawEnchantmentName(spriteBatch, ReforgeUITopLeft + new Vector2(130f, 64f) * backgroundScale); + DrawEnchantmentName(spriteBatch, ReforgeUITopLeft + new Vector2(130f, 66f) * backgroundScale); // Handle spending logic. if (isHoveringOverReforgeIcon) { - // Prevent the player from say, firing a weapon while the mouse is hovering over the icon. - Main.LocalPlayer.mouseInterface = false; - Main.blockMouse = true; - if (Main.mouseLeft && Main.mouseLeftRelease) { - InteractWithEnchantIcon(SelectedEnchantment, cost); - ReforgeButtonClickCountdown = 8f; + InteractWithEnchantIcon(cost); + ReforgeButtonClickCountdown = 15f; } } } + public static void DisableMouseWhenOverUI(Texture2D backgroundTexture, Vector2 backgroundScale) + { + Rectangle backgroundArea = new Rectangle((int)ReforgeUITopLeft.X, (int)ReforgeUITopLeft.Y, (int)(backgroundTexture.Width * backgroundScale.X), (int)(backgroundTexture.Width * backgroundScale.Y)); + + if (MouseScreenArea.Intersects(backgroundArea)) + { + Main.LocalPlayer.mouseInterface = false; + Main.blockMouse = true; + } + } + + public static IEnumerable SelectEnchantment() + { + IEnumerable possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); + + // Select the enchantment based on an index in the possible enchantments. + // If no possible enchantments were found, default to null. + SelectedEnchantment = null; + + if (possibleEnchantments.Count() > 0) + SelectedEnchantment = possibleEnchantments.ElementAt(EnchantIndex); + + return possibleEnchantments; + } + + public static int DrawEnchantmentCost(SpriteBatch spriteBatch, Point costDrawPositionTopLeft) + { + if (CurrentlyHeldItem.IsAir) + return 0; + + int cost = CurrentlyHeldItem.value * 4; + ItemSlot.DrawMoney(spriteBatch, "Cost: ", costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y, Utils.CoinsSplit(cost)); + + return cost; + } + + public static void DrawEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) + { + Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); + Vector2 scale = new Vector2(0.67f, 0.7f); + foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 400, 10, out _)) + { + if (string.IsNullOrEmpty(line)) + continue; + + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, line, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); + vectorDrawPosition.Y += 16; + } + } + public static void DrawItemIcon(SpriteBatch spriteBatch, Vector2 itemSlotDrawPosition, Vector2 reforgeIconDrawPosition, Vector2 scale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) { isHoveringOverReforgeIcon = false; @@ -204,29 +253,14 @@ namespace CalamityMod.UI.CalamitasEnchants Main.instance.MouseTextHackZoom(string.Empty); } - // Prevent the player from say, firing a weapon while the mouse is hovering over the slot. - Main.LocalPlayer.mouseInterface = false; - Main.blockMouse = true; - - bool isHeldItemEnchantable = Main.mouseItem.damage > 0; - // Attempt to exchange if the slot is clicked. - if (Main.mouseLeftRelease && Main.mouseLeft && (isHeldItemEnchantable || Main.mouseItem.IsAir)) + if (Main.mouseLeftRelease && Main.mouseLeft && (Main.mouseItem.CanBeEnchantedBySomething() || Main.mouseItem.IsAir)) { Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); Main.PlaySound(SoundID.Grab); } } - public static void SelectEnchantment(out IEnumerable possibleEnchantments) - { - possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); - SelectedEnchantment = null; - - if (possibleEnchantments.Count() > 0) - SelectedEnchantment = possibleEnchantments.ElementAt(EnchantIndex); - } - public static void DrawAndInteractWithButtons(SpriteBatch spriteBatch, IEnumerable possibleEnchantments, Vector2 topButtonTopLeft, Vector2 bottomButtonTopLeft, Vector2 scale) { // Leave the arrows blank if no possible enchants exist. @@ -246,22 +280,11 @@ namespace CalamityMod.UI.CalamitasEnchants bool hoveringOverTopArrow = MouseScreenArea.Intersects(topButtonArea); bool hoveringOverBottomArrow = MouseScreenArea.Intersects(bottomButtonArea); if (hoveringOverTopArrow) - { topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered"); - // Prevent the player from say, firing a weapon while the mouse is hovering over the button. - Main.LocalPlayer.mouseInterface = false; - Main.blockMouse = true; - } if (hoveringOverBottomArrow) - { bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered"); - // Prevent the player from say, firing a weapon while the mouse is hovering over the button. - Main.LocalPlayer.mouseInterface = false; - Main.blockMouse = true; - } - // Draw the arrows. if (EnchantIndex > 0) spriteBatch.Draw(topArrowTexture, topButtonTopLeft, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); @@ -274,7 +297,7 @@ namespace CalamityMod.UI.CalamitasEnchants if (hoveringOverTopArrow && EnchantIndex > 0) { EnchantIndex--; - TopButtonClickCountdown = 8f; + TopButtonClickCountdown = 15f; Main.PlaySound(SoundID.MenuTick); } @@ -282,7 +305,7 @@ namespace CalamityMod.UI.CalamitasEnchants if (hoveringOverBottomArrow && EnchantIndex < possibleEnchantments.Count() - 1) { EnchantIndex++; - BottomButtonClickCountdown = 8f; + BottomButtonClickCountdown = 15f; Main.PlaySound(SoundID.MenuTick); } } @@ -295,32 +318,7 @@ namespace CalamityMod.UI.CalamitasEnchants ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Name, nameDrawPositionTopLeft, drawColor, 0f, Vector2.Zero, scale); } - public static int DrawEnchantmentCost(SpriteBatch spriteBatch, Point costDrawPositionTopLeft) - { - if (CurrentlyHeldItem.IsAir) - return 0; - - int cost = CurrentlyHeldItem.value * 4; - ItemSlot.DrawMoney(spriteBatch, "Cost: ", costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y, Utils.CoinsSplit(cost)); - - return cost; - } - - public static void DrawEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) - { - Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); - Vector2 scale = new Vector2(0.67f, 0.7f); - foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 400, 10, out _)) - { - if (string.IsNullOrEmpty(line)) - continue; - - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, line, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); - vectorDrawPosition.Y += 16; - } - } - - public static void InteractWithEnchantIcon(Enchantment? enchantmentToUse, int cost) + public static void InteractWithEnchantIcon(int cost) { // If there's no valid item in the slot, do nothing. if (CurrentlyHeldItem.IsAir) @@ -331,7 +329,7 @@ namespace CalamityMod.UI.CalamitasEnchants return; // If no enchantment has been selected, do nothing. - if (!enchantmentToUse.HasValue) + if (!SelectedEnchantment.HasValue) return; Item originalItem = CurrentlyHeldItem.Clone(); @@ -340,8 +338,8 @@ namespace CalamityMod.UI.CalamitasEnchants CurrentlyHeldItem.Prefix(oldPrefix); CurrentlyHeldItem = CurrentlyHeldItem.CloneWithModdedDataFrom(originalItem); - CurrentlyHeldItem.Calamity().AppliedEnchantment = enchantmentToUse.Value; - enchantmentToUse.Value.CreationEffect?.Invoke(CurrentlyHeldItem); + CurrentlyHeldItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; + SelectedEnchantment.Value.CreationEffect?.Invoke(CurrentlyHeldItem); // Update the compare item. This is used check comparisons when showing reforge tooltip bonuses. // Updating it with the same bonuses as what was applied to the real item will negate the incorrect numbers, @@ -349,8 +347,8 @@ namespace CalamityMod.UI.CalamitasEnchants if (Main.cpItem is null) Main.cpItem = new Item(); Main.cpItem.SetDefaults(Main.cpItem.type); - Main.cpItem.Calamity().AppliedEnchantment = enchantmentToUse.Value; - enchantmentToUse.Value.CreationEffect?.Invoke(Main.cpItem); + Main.cpItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; + SelectedEnchantment.Value.CreationEffect?.Invoke(Main.cpItem); // Take away the money for the cost. Main.LocalPlayer.BuyItem(cost); diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs index 40e18b539f..2516b669df 100644 --- a/UI/CalamitasEnchantments/Enchantment.cs +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -9,7 +9,10 @@ namespace CalamityMod.UI.CalamitasEnchants public string Description; public Action CreationEffect; public Action HoldEffect; - public Predicate ApplyRequirement; + + // This is internal because CanBeAppliedTo should be used over this field directly. + // Using that has the benefit of null checks and is objectively superior to using the raw delegate. + internal Predicate ApplyRequirement; public Enchantment(string name, string description, Action creationEffect, Action holdEffect, Predicate requirement) { Name = name; @@ -34,5 +37,19 @@ namespace CalamityMod.UI.CalamitasEnchants HoldEffect = null; ApplyRequirement = requirement; } + + public bool CanBeAppliedTo(Item item) + { + // "Empty" items can never be enchanted. + if (item is null || item.IsAir) + return false; + + // If there is no requirement, always return true, bar the above requirement. + if (ApplyRequirement is null) + return true; + + // Otherwise return what the defined requirement says is needed. + return ApplyRequirement(item); + } } } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 1b136eab90..ba184a4d4d 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -12,7 +12,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static IEnumerable GetValidEnchantmentsForItem(Item item) { // Do nothing if the item cannot be enchanted. - if (item.IsAir || item.damage <= 0) + if (!item.CanBeEnchantedBySomething()) yield break; // Only give the option to clear if the item already has an enchantment. @@ -44,10 +44,13 @@ namespace CalamityMod.UI.CalamitasEnchants public static void LoadAllEnchantments() { - EnchantmentList.Add(new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", - item => item.damage = (int)(item.damage * 1.1), - player => player.Calamity().sacrificeEnchant = true, - item => item.damage > 0)); + EnchantmentList = new List + { + new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", + item => item.damage = (int)(item.damage * 1.1), + player => player.Calamity().sacrificeEnchant = true, + item => item.damage > 0) + }; // Special disenchantment thing. This is separated from the list on purpose. ClearEnchantment = new Enchantment("Disenchant", string.Empty, diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index a96224be03..536a8361db 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -1,6 +1,8 @@ +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; +using System.Linq; using System.Text; using Terraria; using Terraria.ID; @@ -261,6 +263,12 @@ namespace CalamityMod } #endregion + /// + /// Determines if an item can be enchanted by any item at all via Calamitas' enchantment system. + /// + /// The item to check. + public static bool CanBeEnchantedBySomething(this Item item) => EnchantmentManager.EnchantmentList.Any(enchantment => enchantment.ApplyRequirement(item)); + public static void ConsumeItemViaQuickBuff(Player player, Item item, int buffType, int buffTime, bool reducedPotionSickness) { bool showsOver = false; From 715fdad9e921c06a4f3b6c67421467c0abaa1903 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 17 Apr 2021 14:37:15 -0500 Subject: [PATCH 12/73] Centered enchantment names --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 36e4b51445..4b34b41903 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -119,7 +119,7 @@ namespace CalamityMod.UI.CalamitasEnchants // Draw the enchantment name. if (SelectedEnchantment.HasValue) - DrawEnchantmentName(spriteBatch, ReforgeUITopLeft + new Vector2(130f, 66f) * backgroundScale); + DrawEnchantmentName(spriteBatch, ReforgeUITopLeft + new Vector2(216f, 66f) * backgroundScale); // Handle spending logic. if (isHoveringOverReforgeIcon) @@ -311,11 +311,13 @@ namespace CalamityMod.UI.CalamitasEnchants } } - public static void DrawEnchantmentName(SpriteBatch spriteBatch, Vector2 nameDrawPositionTopLeft) + public static void DrawEnchantmentName(SpriteBatch spriteBatch, Vector2 nameDrawCenter) { Vector2 scale = new Vector2(0.8f, 0.745f); + float textWidth = Main.fontMouseText.MeasureString(SelectedEnchantment.Value.Name).X * scale.X; Color drawColor = SelectedEnchantment.Value.Equals(EnchantmentManager.ClearEnchantment) ? Color.White : Color.Orange; - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Name, nameDrawPositionTopLeft, drawColor, 0f, Vector2.Zero, scale); + nameDrawCenter.X -= textWidth * 0.5f; + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Name, nameDrawCenter, drawColor, 0f, Vector2.Zero, scale); } public static void InteractWithEnchantIcon(int cost) @@ -353,6 +355,9 @@ namespace CalamityMod.UI.CalamitasEnchants // Take away the money for the cost. Main.LocalPlayer.BuyItem(cost); + // Reset the enchantment index to prevent index problems on a different item. + EnchantIndex = 0; + Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); } } From 1632ef4541d369b248f5a483974a5d1cc4b41146 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 17 Apr 2021 15:00:37 -0500 Subject: [PATCH 13/73] Stackables and ammo can no longer be enchanted --- UI/CalamitasEnchantments/EnchantmentManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index ba184a4d4d..a5005a8662 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -49,13 +49,13 @@ namespace CalamityMod.UI.CalamitasEnchants new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", item => item.damage = (int)(item.damage * 1.1), player => player.Calamity().sacrificeEnchant = true, - item => item.damage > 0) + item => item.damage > 0 && item.maxStack == 1 && item.notAmmo) }; // Special disenchantment thing. This is separated from the list on purpose. ClearEnchantment = new Enchantment("Disenchant", string.Empty, item => item.Calamity().AppliedEnchantment = null, - item => item.damage > 0); + item => item.maxStack == 1 && item.notAmmo); } public static void UnloadAllEnchantments() => EnchantmentList = null; From 046d7b8d284bd809c99a7471e96e52ca4c839ec3 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 17 Apr 2021 15:55:50 -0500 Subject: [PATCH 14/73] ID loading system --- Items/CalamityGlobalItem.cs | 8 ++++---- UI/CalamitasEnchantments/Enchantment.cs | 13 ++++++++++--- UI/CalamitasEnchantments/EnchantmentManager.cs | 14 ++++++++------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 5b80aa79fa..649cc2a063 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -472,7 +472,7 @@ namespace CalamityMod.Items ["rarity"] = (int)customRarity, ["charge"] = Charge, ["reforgeTier"] = reforgeTier, - ["enchantment"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.Name : string.Empty + ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0 }; } @@ -490,7 +490,7 @@ namespace CalamityMod.Items reforgeTier = tag.GetInt("reforgeTimer"); - Enchantment? savedEnchantment = EnchantmentManager.FindByName(tag.GetString("enchantment"), StringComparison.OrdinalIgnoreCase); + Enchantment? savedEnchantment = EnchantmentManager.FindByID(tag.GetInt("enchantmentID")); if (savedEnchantment.HasValue) { AppliedEnchantment = savedEnchantment.Value; @@ -529,7 +529,7 @@ namespace CalamityMod.Items writer.Write(timesUsed); writer.Write(Charge); writer.Write(reforgeTier); - writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.Name : string.Empty); + writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); } public override void NetReceive(Item item, BinaryReader reader) @@ -542,7 +542,7 @@ namespace CalamityMod.Items Charge = reader.ReadSingle(); reforgeTier = reader.ReadInt32(); - Enchantment? savedEnchantment = EnchantmentManager.FindByName(reader.ReadString(), StringComparison.OrdinalIgnoreCase); + Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32()); if (savedEnchantment.HasValue) { AppliedEnchantment = savedEnchantment.Value; diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs index 2516b669df..68908fd0ac 100644 --- a/UI/CalamitasEnchantments/Enchantment.cs +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -10,32 +10,39 @@ namespace CalamityMod.UI.CalamitasEnchants public Action CreationEffect; public Action HoldEffect; + public int ID { get; internal set; } + + internal static readonly Random EnchantmentIDDecider = new Random(0xCA17A3); + // This is internal because CanBeAppliedTo should be used over this field directly. // Using that has the benefit of null checks and is objectively superior to using the raw delegate. internal Predicate ApplyRequirement; - public Enchantment(string name, string description, Action creationEffect, Action holdEffect, Predicate requirement) + public Enchantment(string name, string description, int id, Action creationEffect, Action holdEffect, Predicate requirement) { Name = name; Description = description; CreationEffect = creationEffect; HoldEffect = holdEffect; ApplyRequirement = requirement; + ID = id; } - public Enchantment(string name, string description, Action holdEffect, Predicate requirement) + public Enchantment(string name, string description, int id, Action holdEffect, Predicate requirement) { Name = name; Description = description; CreationEffect = null; HoldEffect = holdEffect; ApplyRequirement = requirement; + ID = id; } - public Enchantment(string name, string description, Action creationEffect, Predicate requirement) + public Enchantment(string name, string description, int id, Action creationEffect, Predicate requirement) { Name = name; Description = description; CreationEffect = creationEffect; HoldEffect = null; ApplyRequirement = requirement; + ID = id; } public bool CanBeAppliedTo(Item item) diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index a5005a8662..b31c60702f 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -7,6 +7,7 @@ namespace CalamityMod.UI.CalamitasEnchants { public static class EnchantmentManager { + internal const int ClearEnchantmentID = -18591774; public static List EnchantmentList { get; internal set; } = new List(); public static Enchantment ClearEnchantment { get; internal set; } public static IEnumerable GetValidEnchantmentsForItem(Item item) @@ -34,9 +35,9 @@ namespace CalamityMod.UI.CalamitasEnchants } } - public static Enchantment? FindByName(string name, StringComparison comparisonType) + public static Enchantment? FindByID(int id) { - Enchantment? enchantment = EnchantmentList.FirstOrDefault(enchant => enchant.Name.Equals(name, comparisonType)); + Enchantment? enchantment = EnchantmentList.FirstOrDefault(enchant => enchant.ID == id); if (enchantment.HasValue && !enchantment.Value.Equals(default(Enchantment))) return enchantment; return null; @@ -46,16 +47,17 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantmentList = new List { - new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", + new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", + 1, item => item.damage = (int)(item.damage * 1.1), player => player.Calamity().sacrificeEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.notAmmo) + item => item.damage > 0 && item.maxStack == 1) }; // Special disenchantment thing. This is separated from the list on purpose. - ClearEnchantment = new Enchantment("Disenchant", string.Empty, + ClearEnchantment = new Enchantment("Disenchant", string.Empty, ClearEnchantmentID, item => item.Calamity().AppliedEnchantment = null, - item => item.maxStack == 1 && item.notAmmo); + item => item.maxStack == 1); } public static void UnloadAllEnchantments() => EnchantmentList = null; From 16df53b2144d69068c881288de91f99418c4912a Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 30 Apr 2021 20:20:43 -0500 Subject: [PATCH 15/73] Error fix and start of demon enchantment (wip) --- CalPlayer/CalamityPlayer.cs | 6 +- Items/CalamityGlobalItem.cs | 53 ++++-- Items/CalamityGlobalItemTooltip.cs | 17 ++ NPCs/Other/CalamitasEnchantDemon.cs | 161 ++++++++++++++++++ NPCs/Other/CalamitasEnchantDemon.png | Bin 0 -> 8180 bytes Projectiles/Healing/DemonHeal.cs | 33 ++++ .../CalamitasEnchantUI.cs | 6 +- .../EnchantmentManager.cs | 10 +- 8 files changed, 264 insertions(+), 22 deletions(-) create mode 100644 NPCs/Other/CalamitasEnchantDemon.cs create mode 100644 NPCs/Other/CalamitasEnchantDemon.png create mode 100644 Projectiles/Healing/DemonHeal.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fafbbe4bf8..3f7242cc72 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -995,7 +995,7 @@ namespace CalamityMod.CalPlayer #endregion #region Calamitas Enchant Effects - public bool sacrificeEnchant = false; + public bool cursedSummonsEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1363,8 +1363,6 @@ namespace CalamityMod.CalPlayer // Max health reductions if (crimEffigy) player.statLifeMax2 = (int)(player.statLifeMax2 * 0.9); - if (sacrificeEnchant) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.8); if (regenator) player.statLifeMax2 = (int)(player.statLifeMax2 * 0.5); @@ -1986,7 +1984,7 @@ namespace CalamityMod.CalPlayer RageDuration = DefaultRageDuration; RageDamageBoost = DefaultRageDamageBoost; - sacrificeEnchant = false; + cursedSummonsEnchant = false; lastProjectileHit = null; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 389adcd6df..2bb7bcb04f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Magic; @@ -14,6 +15,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -49,10 +51,14 @@ namespace CalamityMod.Items return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f); } } - #endregion + #endregion - // Miscellaneous stuff - public CalamityRarity customRarity = CalamityRarity.NoEffect; + #region Enchantment Variables + public Enchantment? AppliedEnchantment = null; + #endregion + + // Miscellaneous stuff + public CalamityRarity customRarity = CalamityRarity.NoEffect; public int timesUsed = 0; public int reforgeTier = 0; public bool donorItem = false; @@ -221,6 +227,7 @@ namespace CalamityMod.Items public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); + if (rogue) { speedX *= modPlayer.throwingVelocity; @@ -457,8 +464,9 @@ namespace CalamityMod.Items ["timesUsed"] = timesUsed, ["rarity"] = (int)customRarity, ["charge"] = Charge, - ["reforgeTier"] = reforgeTier - }; + ["reforgeTier"] = reforgeTier, + ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0 + }; } public override void Load(Item item, TagCompound tag) @@ -474,7 +482,15 @@ namespace CalamityMod.Items Charge = tag.GetFloat("charge"); reforgeTier = tag.GetInt("reforgeTimer"); - } + Enchantment? savedEnchantment = EnchantmentManager.FindByID(tag.GetInt("enchantmentID")); + if (savedEnchantment.HasValue) + { + AppliedEnchantment = savedEnchantment.Value; + bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null; + if (hasCreationEffect) + item.Calamity().AppliedEnchantment.Value.CreationEffect(item); + } + } public override void LoadLegacy(Item item, BinaryReader reader) { @@ -505,7 +521,8 @@ namespace CalamityMod.Items writer.Write(timesUsed); writer.Write(Charge); writer.Write(reforgeTier); - } + writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); + } public override void NetReceive(Item item, BinaryReader reader) { @@ -516,7 +533,16 @@ namespace CalamityMod.Items timesUsed = reader.ReadInt32(); Charge = reader.ReadSingle(); reforgeTier = reader.ReadInt32(); - } + + Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32()); + if (savedEnchantment.HasValue) + { + AppliedEnchantment = savedEnchantment.Value; + bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null; + if (hasCreationEffect) + item.Calamity().AppliedEnchantment.Value.CreationEffect(item); + } + } #endregion #region Pickup Item Changes @@ -560,7 +586,7 @@ namespace CalamityMod.Items NetMessage.SendData(MessageID.MoonlordCountdown, -1, -1, null, NPC.MoonLordCountdown); } - return base.UseItem(item, player); + return base.UseItem(item, player); } public override bool AltFunctionUse(Item item, Player player) @@ -669,7 +695,14 @@ namespace CalamityMod.Items if (PopupGUIManager.AnyGUIsActive) return false; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && + if (player.Calamity().cursedSummonsEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + { + Point spawnPosition = Main.MouseWorld.ToPoint(); + NPC.NewNPC(spawnPosition.X, spawnPosition.Y, ModContent.NPCType(), Target: player.whoAmI); + Main.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); + } + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { return false; // Don't use weapons if you're charging with a spear diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index e6b3df9f97..f0ee590ff9 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -41,6 +41,10 @@ namespace CalamityMod.Items // This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items. StealthGenAccessoryTooltip(item, tooltips); + // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the + // tooltip list. + EnchantmentTooltips(item, tooltips); + // Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency. if (item.type < ItemID.Count) return; @@ -218,6 +222,19 @@ namespace CalamityMod.Items } #endregion + #region Enchantment Tooltips + private void EnchantmentTooltips(Item item, IList tooltips) + { + if (!item.IsAir && AppliedEnchantment.HasValue) + { + tooltips[0].text = $"{AppliedEnchantment.Value.Name} {tooltips[0].text}"; + + TooltipLine descriptionLine = new TooltipLine(mod, "Enchantment", CalamityUtils.ColorMessage(AppliedEnchantment.Value.Description, Color.DarkRed)); + tooltips.Add(descriptionLine); + } + } + #endregion + #region Vanilla Item Tooltip Modification private void ModifyVanillaTooltips(Item item, IList tooltips) { diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs new file mode 100644 index 0000000000..f88ba5486a --- /dev/null +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -0,0 +1,161 @@ +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class CalamitasEnchantDemon : ModNPC + { + public Player Target => Main.player[npc.target]; + public ref float AttackTimer => ref npc.ai[0]; + public ref float FadeAwayTimer => ref npc.ai[1]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.width = 68; + npc.height = 68; + npc.damage = 0; + npc.defense = 0; + + // This is meant to be created after SCal is defeated and should be at least a little challenging. + npc.lifeMax = 166660; + npc.HitSound = SoundID.NPCHit47; + npc.DeathSound = SoundID.NPCDeath18; + npc.noGravity = true; + npc.noTileCollide = true; + npc.value = 0f; + npc.knockBackResist = 0f; + npc.netAlways = true; + npc.aiStyle = 0; + } + + public override void AI() + { + FadeAwayTimer++; + + // This npc should not attempt to locate other targets. The only one it will accept is the + // player who summoned it in the first place. + if (!Main.projectile.IndexInRange(npc.target) || Target.dead || !Target.active) + { + FadeAway(); + return; + } + + if (FadeAwayTimer < 15f) + { + DoInitializationAI(); + return; + } + + AttackTarget(); + } + + public void FadeAway() + { + npc.dontTakeDamage = true; + npc.Opacity = Utils.InverseLerp(50f, 0f, FadeAwayTimer, true); + + // Become inactive after fading away completely. + if (npc.Opacity <= 0f) + { + npc.active = false; + npc.netUpdate = true; + } + + // Slow down and fade away. + npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * npc.Opacity * -2f, 0.125f); + + FadeAwayTimer++; + + if (Main.dedServ) + return; + + // Create some fade dust. + for (int i = 0; i < 3; i++) + { + Dust magic = Dust.NewDustDirect(npc.position, npc.width, npc.height, 223); + magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f); + magic.scale = Main.rand.NextFloat(1f, 1.125f); + magic.fadeIn = 0.4f; + magic.noGravity = true; + magic.noLight = true; + } + } + + public void DoInitializationAI() + { + // Create a burst of magic on the first frame. + if (!Main.dedServ && FadeAwayTimer == 1f) + { + for (int i = 0; i < 50; i++) + { + Dust magic = Dust.NewDustDirect(npc.position, npc.width, npc.height, 223); + magic.velocity = -Vector2.UnitY * Main.rand.NextFloat(2.8f, 3.5f); + magic.scale = Main.rand.NextFloat(1f, 1.125f); + magic.fadeIn = 0.7f; + magic.noGravity = true; + magic.noLight = true; + } + } + + // Rise upward. + npc.velocity = Vector2.UnitX * MathHelper.Lerp(-0.1f, -3.5f, FadeAwayTimer / 15f); + } + + public void AttackTarget() + { + // Slow down prior to a charge. + if (AttackTimer % 120f > 90f) + npc.velocity *= 0.94f; + + // Otherwise attempt to move towards the player. + else if (!npc.WithinRange(Target.Center, 150f)) + { + Vector2 idealVelocity = npc.SafeDirectionTo(Target.Center) * 16f; + npc.velocity = (npc.velocity * 29f + idealVelocity) / 30f; + npc.velocity = Vector2.Lerp(npc.velocity, idealVelocity, 0.025f); + } + + // Charge. + if (AttackTimer % 120f == 119f) + npc.velocity = npc.SafeDirectionTo(Target.Center) * 23.5f; + + npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter % 5f == 4f) + npc.frame.Y += frameHeight; + + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = 0; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + { + Utils.PoofOfSmoke(npc.Center); + + // Release 4 healing projectiles towards the target. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 4; i++) + { + Vector2 shootVelocity = npc.SafeDirectionTo(Target.Center).RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 14f); + Projectile.NewProjectile(npc.Center, shootVelocity, ModContent.ProjectileType(), 0, 0f, npc.target); + } + } + } + } + } +} diff --git a/NPCs/Other/CalamitasEnchantDemon.png b/NPCs/Other/CalamitasEnchantDemon.png new file mode 100644 index 0000000000000000000000000000000000000000..bd3a5924ca1b3036a565056b45c1f0e1bb7af3cb GIT binary patch literal 8180 zcma)hcT^MGzwZDVEEJKWbU1(%m7dU~SrAm32c)+k5K3r*^b!p*26|4#rAs=Tdz?Oss!at;b@Gvwcidp@)Iv9e|6 ziS*W~VIGij7FY~>zVm)`weJ4t5@YY+;*I(~R9!0&mcJVg( zlK2Hl_v@mcgc97Vos+noSf;*2tHAXagee2j_ANbU zp^^xAzb&XspT>5dMx+Dx)BpVBn_{fO8G>sIe&;>em`6UaJ_dxYu>dna#clhK8-(ON zm*(nW;(OV5sn8O&+dTS6nF07@VGP_6FT5?D)&A(6Tm$+u_i#Bb%ud^a5s*BQJn&{! z2&y7C!~(g?^C|UI@#8E!C=j@H1`q!jkO-rUm0_PeknhlAUQST17ijjjV;TP6O4hv&KLhX5Ksh zKy&uNu|9G7@Xs?h)|Uk=1Q?1a4$toUUi(Z^Qou^fMKKkU+C@iC=Q}-2D(K(c)IKURJu0&rhMO+J4Wc@GAzflb#YTg^(AQgXpHY7tf&Y6X2U)^Svi znioLP@caI@d9ZpZrQX%oHZ`ZgQuv}CB<;lnP}-rUE^=Kxmsf77+m+vx^wCa()Shx% z`AIAh0aP@01=)xGigGJ|np%&{;r*v^rN!QOgGa4UHBKID}b3aU^*NDuQIkv+bRtHqTq3#oVU% z6xa>b?9GT4;iBaZT|8%`w|bU(JBtQL9UA&&nFxi(%HBhF-w)T;^4eTM%4c>uAN5WcO^5l-?N7BnI1S8DtotOT zy^FBp^I`T8*Dt_Q^U}RN8b?A8+9g_<^EWs>Ak5+yAugpiZ`F-!^ByuCPKB$Q6cEB# zSZvt<6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I{fkf0p%a}O#lD@ literal 0 HcmV?d00001 diff --git a/Projectiles/Healing/DemonHeal.cs b/Projectiles/Healing/DemonHeal.cs new file mode 100644 index 0000000000..fcff05e107 --- /dev/null +++ b/Projectiles/Healing/DemonHeal.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class DemonHeal : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Heal"); + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 640; + } + + public override void AI() + { + projectile.HealingProjectile(10, projectile.owner, 20f, 20f, true, 640); + + Dust fire = Dust.NewDustPerfect(projectile.Center, 130); + fire.velocity = Microsoft.Xna.Framework.Vector2.Zero; + fire.scale = Main.rand.NextFloat(1f, 1.15f); + fire.fadeIn = 0.45f; + fire.noGravity = true; + } + } +} diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 4b34b41903..b18fa5dd63 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -232,13 +232,13 @@ namespace CalamityMod.UI.CalamitasEnchants itemScale = 36f / MathHelper.Max(itemFrame.Width, itemFrame.Height); itemScale *= inventoryScale * baseScale; - drawPosition += itemFrame.Size() * itemScale * new Vector2(0.65f, 0.6f); + drawPosition += Vector2.One * 23f * baseScale; // Draw the item. if (ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) { - spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, Vector2.Zero, itemScale, SpriteEffects.None, 0f); - spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, Vector2.Zero, itemScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, itemFrame.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, itemFrame.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); } } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index b31c60702f..7dde6936c9 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -13,7 +13,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static IEnumerable GetValidEnchantmentsForItem(Item item) { // Do nothing if the item cannot be enchanted. - if (!item.CanBeEnchantedBySomething()) + if (item is null || !item.CanBeEnchantedBySomething()) yield break; // Only give the option to clear if the item already has an enchantment. @@ -47,11 +47,11 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantmentList = new List { - new Enchantment("Self-Sacrificial", "Does 10% more damage at the cost of 20% of your max life", - 1, + new Enchantment("Cursed", "Summons demons that harm you but drop healing items on death on item usage.", + 100, item => item.damage = (int)(item.damage * 1.1), - player => player.Calamity().sacrificeEnchant = true, - item => item.damage > 0 && item.maxStack == 1) + player => player.Calamity().cursedSummonsEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.summon) }; // Special disenchantment thing. This is separated from the list on purpose. From 4489c44094bde6bf2b6f71d561d72d5f6f3f951b Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 11 May 2021 17:38:58 -0500 Subject: [PATCH 16/73] Removed some useless directives --- NPCs/TownNPCs/WITCH.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 04be4e9e42..a370b8fde1 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -1,24 +1,16 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Tools; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; -using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; using Terraria.GameContent.Events; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + using static Terraria.ModLoader.ModContent; + namespace CalamityMod.NPCs.TownNPCs { [AutoloadHead] From bf00ea7a293b335649b019ce8a7015381928f314 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 May 2021 09:42:09 -0500 Subject: [PATCH 17/73] UI adjustments --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index b18fa5dd63..1222cd9543 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -23,7 +23,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static bool CurrentlyViewing = false; - public static readonly Vector2 ReforgeUITopLeft = new Vector2(28f, 270f); + public static readonly Vector2 ReforgeUITopLeft = new Vector2(28f, 245f); public static readonly float ResolutionRatio = Main.screenHeight / 1440f; public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); @@ -83,7 +83,7 @@ namespace CalamityMod.UI.CalamitasEnchants Main.npcChatText = string.Empty; Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseBackground"); - Vector2 backgroundScale = Vector2.One * MathHelper.Clamp(ResolutionRatio * 1.25f, 0.67f, 1f); + Vector2 backgroundScale = Vector2.One; // Draw the background. spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); @@ -102,7 +102,7 @@ namespace CalamityMod.UI.CalamitasEnchants int cost = 0; if (SelectedEnchantment.HasValue) { - Point costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(50f, 84f) * backgroundScale).ToPoint(); + Point costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(50f, 78f) * backgroundScale).ToPoint(); cost = DrawEnchantmentCost(spriteBatch, costDrawPositionTopLeft); Point descriptionDrawPositionTopLeft = costDrawPositionTopLeft; descriptionDrawPositionTopLeft.Y += 90; @@ -171,7 +171,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static void DrawEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) { Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); - Vector2 scale = new Vector2(0.67f, 0.7f); + Vector2 scale = new Vector2(0.67f, 0.7f) * MathHelper.Clamp(ResolutionRatio, 0.825f, 1f); foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 400, 10, out _)) { if (string.IsNullOrEmpty(line)) From 283b8519857e8e58aa39f241e398560ec0135cec Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 May 2021 11:10:08 -0500 Subject: [PATCH 18/73] Aflame enchantment --- Buffs/DamageOverTime/VulnerabilityHex.cs | 9 +- Buffs/DamageOverTime/WeakBrimstoneFlames.cs | 20 +++++ Buffs/DamageOverTime/WeakBrimstoneFlames.png | Bin 0 -> 568 bytes CalPlayer/CalamityPlayer.cs | 8 +- CalPlayer/CalamityPlayerLifeRegen.cs | 9 ++ CalPlayer/CalamityPlayerMiscEffects.cs | 7 +- ExtraTextures/Particles/Fire.png | Bin 0 -> 10317 bytes Items/CalamityGlobalItem.cs | 3 +- NPCs/CalamityGlobalNPC.cs | 34 +++++++- Particles/BaseParticleSet.cs | 77 ++++++++++++++++++ Particles/FireParticleSet.cs | 44 ++++++++++ Particles/Particle.cs | 21 +++++ Projectiles/CalamityGlobalProjectile.cs | 6 ++ .../EnchantmentManager.cs | 10 ++- 14 files changed, 235 insertions(+), 13 deletions(-) create mode 100644 Buffs/DamageOverTime/WeakBrimstoneFlames.cs create mode 100644 Buffs/DamageOverTime/WeakBrimstoneFlames.png create mode 100644 ExtraTextures/Particles/Fire.png create mode 100644 Particles/BaseParticleSet.cs create mode 100644 Particles/FireParticleSet.cs create mode 100644 Particles/Particle.cs diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 17b1addd7e..dfc4a2c6e0 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -16,9 +16,14 @@ namespace CalamityMod.Buffs.DamageOverTime canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) + public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true; + + public override void Update(NPC npc, ref int buffIndex) { - player.Calamity().vHex = true; + if (npc.Calamity().vulnerabilityHex < npc.buffTime[buffIndex]) + npc.Calamity().vulnerabilityHex = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; } } } diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs new file mode 100644 index 0000000000..bf421c63ca --- /dev/null +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -0,0 +1,20 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class WeakBrimstoneFlames : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Weak Brimstone Flames"); + Description.SetDefault("Health loss"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().weakBrimstoneFlames = true; + } +} diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.png b/Buffs/DamageOverTime/WeakBrimstoneFlames.png new file mode 100644 index 0000000000000000000000000000000000000000..e2be863c4b8e5b6419c691f4fa2241bc20825796 GIT binary patch literal 568 zcmV-80>}M{P)Jb8|JbTyEvzrow@Tm=gyrw8|24x0D!00=O6SD`SDx;00aG8GzkHK9{|`` zTel1!@133lOX=aB_HxS}KQe0fubiC%@IZkbU`b6wpkm#P*le>FXKTb>jR{`ky>B0RV;RjAeI4gFg!BD2R7#6rk^` z!|B9{_Fp8GP@&Z+Gf&;_=Wi6ed^D{xJ7Rp8PL2X9(TxgN?F1QfUJZW~AY-jW+1N|w zRP&T;=0q_Y0O;O`nmO0Gs!81+1&GBtxzp*pg|}}p7}pk*67)HlYml)kyZWPmGYSmI znE9S{f^mO*S(Sz%d;HCvx)2QfQGnPPlComz%cS9sVg0wZ&)p^vBE{ z*^l;OR+Ng20#sr-IY|CrfgsF;0Dwlb(bvD@FcbRmcl--PV$fMYoVy1A0000 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + lifeRegenLost += 5; + } + if (modPlayer.bFlames) { if (player.lifeRegen > 0) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ec3aab6f51..2c15270b74 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -84,9 +84,6 @@ namespace CalamityMod.CalPlayer // Misc effects, because I don't know what else to call it MiscEffects(player, modPlayer, mod); - // Calamitas enchant held effects - EnchantHeldItemEffects(player, modPlayer, player.ActiveItem()); - // Max life and mana effects MaxLifeAndManaEffects(player, modPlayer, mod); @@ -2020,6 +2017,10 @@ namespace CalamityMod.CalPlayer return; heldItem.Calamity().AppliedEnchantment.Value.HoldEffect(player); + + // Weak brimstone flame hold curse effect. + if (modPlayer.flamingItemEnchant) + player.AddBuff(ModContent.BuffType(), 10); } #endregion diff --git a/ExtraTextures/Particles/Fire.png b/ExtraTextures/Particles/Fire.png new file mode 100644 index 0000000000000000000000000000000000000000..cc76a599b3fa10e773c9bb82aff2d72ed2bb67f6 GIT binary patch literal 10317 zcmYLPcRZWl_fKL4L9B|ECP+)w-m5}XsoJaduGVag+C;@_wPMs>p;lXz7DbGr_Na=g zU4&Yt_Nejm`Tq0!dP;Py8nL$ps&##bwK41&+6rb(p61Y4FIT4q(60_x}4KK*0S&g02o{Udw}v(#sUDq z^#yGWHIqQwKQsNqDt2b$+vomr;6ODh0`qOC2A_tZ3F+YiN>4f=BSYSglJ!9XFYE$v z0dQPsi#!L~!eC+6rpP@s5SzfCpgsHQ)c42w%?ZVb`jQ!V6a<(jb`xNwT zp8jc`4XLO-tW?}5ZVBlJ^|1$)UMS~=&ePkiv^EQE5q&4!#L|rG-p3NWu5QTepAMGf zyPq82iS}tU+ZRV4C70MuMuZoX^X7Y=l$Tsotzy&_OkV`U>_~g{a%a4{5$>aN-}laR zDah$r=lLc1L7)kPOY8JrfA)E03DA+7iMcYc>%#41S66im>vvrxIR~W06m|V{sKjn$ zFF=lp+@CdBndj48C4JUVqB^>lk_grilsBP+KwI9fnjhwyw$=#U_o4F+x~~8ML#e2% z;A#keV;N18 zY$ESr)fSQV0@ls!vuaP>$>4-FTBrCN#i5+eX|ltv=IiE=T!q`bx{=AlNXXiK-=qPO z(%ZzFO@P(r4zTu7e6?@_A@(PA%=Gqg$u(T-WW>4VXe`yo^jNT5YsDj(6BN@nuY89C z=vgs~)ZWDu$?}RI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$og)61K@L@HD9+awWVH>1V1x&*{^hH~Zx%la0&t>|}x%<-veset21k_{5Bi zH;bpbK6BNR2>2s(sH(Th>zs%;ZE~pW7H^M*yYqE@h?FY<{<@DbZ)jWTDXrm=x}7>t z9Bsh`F(D*wIAQIZwR*l8hmBhe;{P~#^!1PezHRs>*!@xLZdhg_%^fI(gJq5C%kRtt z+?e2ZULAvUWk52vRb{?czl>y16Qa0t=6MzS$~QDwaxk?0R=3&bRGN`f-Cj8Fwy4F7 zcmK1(uboUXXE7yq;}QCjatq0Kc=)S&uKOe~o6DrZ_0@{U+(QH2=Qw|`XUX#U$gUO51>Eb-I&Uty8s?70 z!=KOQaU0r=k~U7SK!2ARV+~@mDFkd~J-889ADtX#pOdD*8WX|7Q7&Ht^qDy8bUCkj zo+M_6Z&ZNP?}|D+>c(K@Bq35OFGLgQ9b(s zylhhd!~w&+faK&@!C`}w?(FjcD_R_+V5J!#4u>6r2*8Ca+bAYO&B>Lfpq|SUPFvCA z*aRy}X{5LoZ-4pl$C9yE`Av9opbb^BWXwX2m-?|81(HJ0M2s4NUEocn)Y@msY885N z4)y4RJ@*|Tt4?6ar^f&5e^B@F?4p13knw%KM8VdUP+7b$mNRWhK40Ls-|P=8q+dSz zO-)lD;2zn?MwF|Pv-Tg+VAiy^!8HZrF4K*7mHE}tuhM)bq(5 BossRushHPChanges = new SortedDictionary { @@ -957,7 +962,8 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(pShred, 1500, 300, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); - ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(vulnerabilityHex, 44440, 4444, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(kamiFlu, 250, 25, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); @@ -2002,7 +2008,9 @@ namespace CalamityMod.NPCs #region Pre AI public override bool PreAI(NPC npc) { - CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod); + if (VulnerabilityHexFireDrawer != null) + VulnerabilityHexFireDrawer.Update(); + CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod); if (CalamityPlayer.areThereAnyDamnBosses) { @@ -3504,6 +3512,8 @@ namespace CalamityMod.NPCs bBlood--; if (dFlames > 0) dFlames--; + if (vulnerabilityHex > 0) + vulnerabilityHex--; if (marked > 0) marked--; if (vaporfied > 0) @@ -4853,6 +4863,24 @@ namespace CalamityMod.NPCs Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + npc.width / 2 - Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + npc.height - Main.npcTexture[npc.type].Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } + else + { + if (npc.Calamity().vulnerabilityHex > 0) + { + float compactness = npc.width * 0.6f; + if (compactness < 10f) + compactness = 10f; + float power = npc.height / 100f; + if (power > 2.75f) + power = 2.75f; + if (VulnerabilityHexFireDrawer is null || VulnerabilityHexFireDrawer.LocalTimer >= VulnerabilityHexFireDrawer.SetLifetime) + VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); + else + VulnerabilityHexFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY)); + } + else + VulnerabilityHexFireDrawer = null; + } // Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event. if (npc.type == NPCID.DD2EterniaCrystal) diff --git a/Particles/BaseParticleSet.cs b/Particles/BaseParticleSet.cs new file mode 100644 index 0000000000..8490181b26 --- /dev/null +++ b/Particles/BaseParticleSet.cs @@ -0,0 +1,77 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Particles +{ + public abstract class BaseParticleSet + { + public int LocalTimer { get; internal set; } + public int SetLifetime { get; internal set; } + public int ParticleSpawnRate; + public List Particles = new List(); + public abstract int ParticleLifetime { get; } + public abstract void UpdateBehavior(Particle particle); + public abstract Particle SpawnParticle(); + public abstract Color DetermineParticleColor(float lifetimeCompletion); + public abstract Texture2D ParticleTexture { get; } + public virtual int ParticleFrameVariants => 1; + public virtual Func OrderFunction { get; } = null; + + public BaseParticleSet(int setLifetime, int particleSpawnRate) + { + SetLifetime = setLifetime; + ParticleSpawnRate = particleSpawnRate; + } + + public virtual void Update() + { + // Don't perform any operations on the server. Doing so would be a waste of space as these sets are entirely based on drawcode. + if (Main.netMode == NetmodeID.Server) + return; + + bool closeToDeath = LocalTimer >= SetLifetime - ParticleLifetime && SetLifetime > 0; + if (LocalTimer % ParticleSpawnRate == 0 && !closeToDeath) + { + Particle particle = SpawnParticle(); + particle.Lifetime = ParticleLifetime; + particle.Variant = Main.rand.Next(ParticleFrameVariants); + Particles.Add(particle); + } + + // Update and increment the time of all particles. + for (int i = 0; i < Particles.Count; i++) + { + Particles[i].Time++; + UpdateBehavior(Particles[i]); + } + + // Clear all expired particles. + Particles.RemoveAll(particle => particle.Time >= particle.Lifetime); + LocalTimer++; + } + + public virtual void DrawSet(Vector2 basePosition) + { + if (Main.netMode == NetmodeID.Server) + return; + + IEnumerable orderedParticles = Particles; + if (OrderFunction != null) + orderedParticles = orderedParticles.OrderBy(OrderFunction); + + foreach (Particle particle in Particles.OrderBy(p => p.Time)) + { + Vector2 drawPosition = basePosition - Main.screenPosition + particle.RelativeOffset; + Color particleColor = DetermineParticleColor(particle.Time / (float)particle.Lifetime); + Rectangle frame = ParticleTexture.Frame(1, ParticleFrameVariants, 0, particle.Variant); + + Main.spriteBatch.Draw(ParticleTexture, drawPosition, frame, particleColor, 0f, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); + } + } + } +} \ No newline at end of file diff --git a/Particles/FireParticleSet.cs b/Particles/FireParticleSet.cs new file mode 100644 index 0000000000..fd362b1a76 --- /dev/null +++ b/Particles/FireParticleSet.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class FireParticleSet : BaseParticleSet + { + public float SpawnAreaCompactness; + public float RelativePower; + public Color BrightColor; + public Color DarkColor; + public override int ParticleLifetime => 50; + public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Particles/Fire"); + public FireParticleSet(int setLifetime, int particleSpawnRate, Color brightColor, Color darkColor, float spawnAreaCompactness, float relativePower) : + base(setLifetime, particleSpawnRate) + { + BrightColor = brightColor; + DarkColor = darkColor; + SpawnAreaCompactness = spawnAreaCompactness; + RelativePower = relativePower; + } + + public override void UpdateBehavior(Particle particle) + { + particle.Scale += RelativePower * 0.01f; + particle.RelativeOffset.Y -= RelativePower * 3f; + } + + public override Color DetermineParticleColor(float lifetimeCompletion) + { + Color particleColor = Color.Lerp(BrightColor, DarkColor, lifetimeCompletion); + particleColor = Color.Lerp(particleColor, Color.SaddleBrown, Utils.InverseLerp(0.95f, 0.7f, lifetimeCompletion, true)); + particleColor = Color.Lerp(particleColor, Color.White, Utils.InverseLerp(0.1f, 0.25f, lifetimeCompletion, true) * Utils.InverseLerp(0.4f, 0.25f, lifetimeCompletion, true) * 0.7f); + particleColor *= Utils.InverseLerp(0f, 0.15f, lifetimeCompletion, true) * Utils.InverseLerp(1f, 0.8f, lifetimeCompletion, true) * 0.6f; + particleColor.A = 50; + + return particleColor; + } + + public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2Circular(1f, 1f) * SpawnAreaCompactness, 0.06f); + } +} \ No newline at end of file diff --git a/Particles/Particle.cs b/Particles/Particle.cs new file mode 100644 index 0000000000..cf3bac931f --- /dev/null +++ b/Particles/Particle.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Particles +{ + public class Particle + { + public int Time; + public int Lifetime; + public int Variant; + public float Scale; + public Vector2 RelativeOffset; + public Particle(int lifetime, Vector2 relativeOffset, float scale, int variant = 0) + { + Time = 0; + Lifetime = lifetime; + Variant = variant; + Scale = scale; + RelativeOffset = relativeOffset; + } + } +} \ No newline at end of file diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 8559271bb3..a0885fc92e 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.NPCs.NormalNPCs; @@ -1723,6 +1724,11 @@ namespace CalamityMod.Projectiles organicEnemyHitEffect?.Invoke(target); } } + + // NOTE - At the time of writing this vulnerability hex is basically useless against + // enemies. However, on the weapons branch it is extremely powerful and is used by the Calamity expert accessory. + if (modPlayer.flamingItemEnchant && !projectile.minion) + target.AddBuff(BuffType(), 420); if (!projectile.npcProj && !projectile.trap && rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) crit = true; diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 7dde6936c9..eec05cf0ab 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -13,7 +13,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static IEnumerable GetValidEnchantmentsForItem(Item item) { // Do nothing if the item cannot be enchanted. - if (item is null || !item.CanBeEnchantedBySomething()) + if (item is null || item.IsAir || !item.CanBeEnchantedBySomething()) yield break; // Only give the option to clear if the item already has an enchantment. @@ -51,7 +51,13 @@ namespace CalamityMod.UI.CalamitasEnchants 100, item => item.damage = (int)(item.damage * 1.1), player => player.Calamity().cursedSummonsEnchant = true, - item => item.damage > 0 && item.maxStack == 1 && item.summon) + item => item.damage > 0 && item.maxStack == 1 && item.summon), + + new Enchantment("Aflame", "Lights enemies ablaze on hit but also causes the user to take damage over time when holding this item.", + 200, + null, + player => player.Calamity().flamingItemEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), }; // Special disenchantment thing. This is separated from the list on purpose. From cdee32539d80b7841491bd9b3afadacba467164a Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 May 2021 12:44:21 -0500 Subject: [PATCH 19/73] Made Yharim's Crystal use the right mana method The old one wouldn't work with the on-mana-consume hooks --- Projectiles/Magic/YharimsCrystalPrism.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index 9f8a3703a5..7447510c99 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic UpdateAim(rrp, speedTimesScale); // CheckMana returns true if the mana cost can be paid. If mana isn't consumed this frame, the CheckMana short-circuits out of being evaluated. - bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem().mana, true, false); + bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem(), -1, true, false); bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed; // The beams are only projected once (on frame 1). From 4aa5d4b7ce680ddab43407badf1a7f0551889306 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 May 2021 13:34:59 -0500 Subject: [PATCH 20/73] Fixed some other mana using holdouts --- Projectiles/DraedonsArsenal/GatlingLaserProj.cs | 2 +- Projectiles/Magic/DarkSparkPrism.cs | 2 +- Projectiles/Magic/PurgeProj.cs | 2 +- Projectiles/Magic/SparklingBeam.cs | 2 +- Projectiles/Magic/T1000Proj.cs | 2 +- Projectiles/Ranged/ContagionBow.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index c6b5a6c1c5..e03bec6fec 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // This both checks if the player has sufficient mana and consumes it if they do. // If this is false, the Gatling Laser stops functioning. - bool hasMana = player.CheckMana(gatling.mana, true, false); + bool hasMana = player.CheckMana(gatling, -1, true, false); // Checks if the Gatling Laser has sufficient charge to fire. If this is false, it stops functioning. CalamityGlobalItem modItem = gatling.Calamity(); diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index 0fde8c1dfa..2f84f847a2 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Magic if (flag10 && Main.myPlayer == projectile.owner) { - bool flag11 = !flag9 || player.CheckMana(player.ActiveItem().mana, true, false); + bool flag11 = !flag9 || player.CheckMana(player, -1, true, false); bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; if (flag12) { diff --git a/Projectiles/Magic/PurgeProj.cs b/Projectiles/Magic/PurgeProj.cs index f6357b097f..e0d68f4db5 100644 --- a/Projectiles/Magic/PurgeProj.cs +++ b/Projectiles/Magic/PurgeProj.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic if (flag && Main.myPlayer == projectile.owner) { int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed; if (flag2) { float speed = player.ActiveItem().shootSpeed * projectile.scale; diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs index 7c188ee5f6..0ed8ed8033 100644 --- a/Projectiles/Magic/SparklingBeam.cs +++ b/Projectiles/Magic/SparklingBeam.cs @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.Magic } else { // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore - if (Main.player[projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem().mana, true)) + if (Main.player[projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem(), -1, true)) { projectile.Kill(); } diff --git a/Projectiles/Magic/T1000Proj.cs b/Projectiles/Magic/T1000Proj.cs index aec9a410c4..caebb2cf30 100644 --- a/Projectiles/Magic/T1000Proj.cs +++ b/Projectiles/Magic/T1000Proj.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic if (flag && Main.myPlayer == projectile.owner) { int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed; if (flag2) { float speed = player.ActiveItem().shootSpeed * projectile.scale; diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index c7382b46ee..89ac2dd550 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged } if (flag && Main.myPlayer == projectile.owner) { - bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && !player.noItems && !player.CCed; if (flag2) { float speed = player.ActiveItem().shootSpeed * projectile.scale; From 529cfcef74fc7840f20776950a78ef4171cb6339 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 May 2021 13:50:51 -0500 Subject: [PATCH 21/73] Oblatory enchant and modcall stuff --- CalPlayer/CalamityPlayer.cs | 29 ++++++ CalPlayer/CalamityPlayerLifeRegen.cs | 1 - ModSupport/ModCalls.cs | 6 ++ .../EnchantmentManager.cs | 88 ++++++++++++++++++- 4 files changed, 122 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a8345fa6cb..e108247939 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -997,6 +997,7 @@ namespace CalamityMod.CalPlayer #region Calamitas Enchant Effects public bool cursedSummonsEnchant = false; public bool flamingItemEnchant = false; + public bool lifeManaEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1977,6 +1978,7 @@ namespace CalamityMod.CalPlayer cursedSummonsEnchant = false; flamingItemEnchant = false; + lifeManaEnchant = false; lastProjectileHit = null; CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); @@ -10239,5 +10241,32 @@ namespace CalamityMod.CalPlayer } #endregion + + #region Mana Consumption Effects + public override void OnConsumeMana(Item item, int manaConsumed) + { + CalamityPlayer modPlayer = player.Calamity(); + if (Main.rand.NextBool(4) && modPlayer.lifeManaEnchant) + { + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-5); + player.statLife -= 5; + if (player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason($"{player.name} converted all of their life to mana."), 1000, -1); + } + + for (int i = 0; i < 8; i++) + { + Dust life = Dust.NewDustPerfect(player.Top + Main.rand.NextVector2Circular(player.width * 0.5f, 6f), 267); + life.color = Color.Red; + life.velocity = -Vector2.UnitY.RotatedByRandom(0.48f) * Main.rand.NextFloat(3f, 4.4f); + life.scale = Main.rand.NextFloat(1.5f, 1.72f); + life.fadeIn = 0.7f; + life.noGravity = true; + } + } + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 94dadc0c43..ecf422817b 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 1ff4d2662c..9023cd6b13 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles; +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using System; using System.Collections.Generic; @@ -1699,6 +1700,11 @@ namespace CalamityMod CalamityLists.MinionsToNotResurrectList.AddRange(secondaryArguments.Select(argument => Convert.ToInt32(argument))); return null; + case "CreateEnchantment": + case "RegisterEnchantment": + EnchantmentManager.ConstructFromModcall(args.Skip(1)); + break; + default: return new ArgumentException("ERROR: Invalid method name."); } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index eec05cf0ab..e1a8b02a3e 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -43,13 +43,89 @@ namespace CalamityMod.UI.CalamitasEnchants return null; } + public static void ConstructFromModcall(IEnumerable parameters) + { + int secondaryArgumentCount = parameters.Count(); + if (secondaryArgumentCount < 4) + throw new ArgumentNullException("ERROR: A minimum of 4 arguments must be supplied to this command; a name, a description, an id, and a requirement predicate."); + if (secondaryArgumentCount > 6) + throw new ArgumentNullException("ERROR: A maximum of 6 arguments can be supplied to this command."); + + string name = string.Empty; + string description = string.Empty; + int id = -1; + Predicate requirement = null; + Action creationEffect = null; + Action holdEffect = null; + + // First element - the name. + if (parameters.ElementAt(0) is string nameElement) + name = nameElement; + else + throw new ArgumentException("The first argument to this command must be a string."); + + // Second element - the description. + if (parameters.ElementAt(1) is string descriptionElement) + description = descriptionElement; + else + throw new ArgumentException("The second argument to this command must be a string."); + + // Third element - the ID. + if (parameters.ElementAt(2) is int idElement) + id = idElement; + else + throw new ArgumentException("The third argument to this command must be an int."); + + // Fourth element - the requirement predicate. This determines if an item can be enchanted by said enchant or not. + if (parameters.ElementAt(3) is Predicate requirementElement) + requirement = requirementElement; + else + throw new ArgumentException("The fourth argument to this command must be an Item Predicate."); + + // Optional elements - creation and hold effects. + switch (secondaryArgumentCount) + { + case 5: + object fifthElement = parameters.ElementAt(4); + if (fifthElement is Action creationElement) + creationEffect = creationElement; + else if (fifthElement is Action holdElement) + holdEffect = holdElement; + else + throw new ArgumentException("The fifth argument to this command must be an Item or Player Action."); + break; + case 6: + fifthElement = parameters.ElementAt(4); + object sixthElement = parameters.ElementAt(5); + if (fifthElement is Action creationElement2) + { + creationEffect = creationElement2; + holdEffect = sixthElement as Action; + } + else if (fifthElement is Action holdElement2) + { + creationEffect = sixthElement as Action; + holdEffect = holdElement2; + } + else + throw new ArgumentException("The fifth argument to this command must be an Item or Player Action and the sixth must be the other action type."); + break; + } + + // Ensure the enchantment's ID is not already claimed. + if (EnchantmentList.Any(enchant => enchant.ID == id) || id == ClearEnchantmentID) + throw new ArgumentException("An enchantment with this ID already exists. Another one must be specified."); + + EnchantmentList.Add(new Enchantment(name, description, id, creationEffect, holdEffect, requirement)); + } + public static void LoadAllEnchantments() { EnchantmentList = new List { new Enchantment("Cursed", "Summons demons that harm you but drop healing items on death on item usage.", 100, - item => item.damage = (int)(item.damage * 1.1), + null, player => player.Calamity().cursedSummonsEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.summon), @@ -58,6 +134,16 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().flamingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), + + new Enchantment("Oblatory", "Reduces mana cost and greatly increases damage but sometimes causes this item to use your life.", + 300, + item => + { + item.damage = (int)(item.damage * 1.5); + item.mana = (int)Math.Ceiling(item.mana * 0.6); + }, + player => player.Calamity().lifeManaEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), }; // Special disenchantment thing. This is separated from the list on purpose. From 41a46d957d9a8f0e015ac6d807d47c6c21d778d5 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 12 May 2021 19:46:06 -0500 Subject: [PATCH 22/73] Projectile proximity enchants --- CalPlayer/CalamityPlayer.cs | 5 +++++ Items/Weapons/Melee/Murasama.cs | 1 + ModSupport/ModCalls.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 16 ++++++++++++++-- Projectiles/Magic/DarkSparkPrism.cs | 2 +- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 5 +++-- UI/CalamitasEnchantments/Enchantment.cs | 2 -- UI/CalamitasEnchantments/EnchantmentManager.cs | 15 ++++++++++++++- 8 files changed, 39 insertions(+), 9 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e108247939..39d4a966f0 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -998,6 +998,8 @@ namespace CalamityMod.CalPlayer public bool cursedSummonsEnchant = false; public bool flamingItemEnchant = false; public bool lifeManaEnchant = false; + public bool farProximityRewardEnchant = false; + public bool closeProximityRewardEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1979,8 +1981,11 @@ namespace CalamityMod.CalPlayer cursedSummonsEnchant = false; flamingItemEnchant = false; lifeManaEnchant = false; + farProximityRewardEnchant = false; + closeProximityRewardEnchant = false; lastProjectileHit = null; + CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); } #endregion diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index efc3691e56..78055bf72a 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("There will be blood!\n" + "ID and power-level locked\n" + "Prove your strength or have the correct user ID to wield this sword"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 13)); } public override void SetDefaults() diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 9023cd6b13..05de84ee37 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -1703,7 +1703,7 @@ namespace CalamityMod case "CreateEnchantment": case "RegisterEnchantment": EnchantmentManager.ConstructFromModcall(args.Skip(1)); - break; + return null; default: return new ArgumentException("ERROR: Invalid method name."); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index a0885fc92e..445a999043 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1725,11 +1725,23 @@ namespace CalamityMod.Projectiles } } - // NOTE - At the time of writing this vulnerability hex is basically useless against - // enemies. However, on the weapons branch it is extremely powerful and is used by the Calamity expert accessory. if (modPlayer.flamingItemEnchant && !projectile.minion) target.AddBuff(BuffType(), 420); + if (modPlayer.farProximityRewardEnchant) + { + float proximityDamageInterpolant = Utils.InverseLerp(250f, 2400f, target.Distance(player.Center), true); + float proximityDamageFactor = MathHelper.SmoothStep(0.7f, 1.45f, proximityDamageInterpolant); + damage = (int)Math.Ceiling(damage * proximityDamageFactor); + } + + if (modPlayer.closeProximityRewardEnchant) + { + float proximityDamageInterpolant = Utils.InverseLerp(400f, 175f, target.Distance(player.Center), true); + float proximityDamageFactor = MathHelper.SmoothStep(0.75f, 1.75f, proximityDamageInterpolant); + damage = (int)Math.Ceiling(damage * proximityDamageFactor); + } + if (!projectile.npcProj && !projectile.trap && rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) crit = true; } diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index 2f84f847a2..009b32ccca 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Magic if (flag10 && Main.myPlayer == projectile.owner) { - bool flag11 = !flag9 || player.CheckMana(player, -1, true, false); + bool flag11 = !flag9 || player.CheckMana(player.ActiveItem(), -1, true, false); bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; if (flag12) { diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 1222cd9543..480780ef07 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -217,7 +217,8 @@ namespace CalamityMod.UI.CalamitasEnchants float inventoryScale = Main.inventoryScale; Texture2D itemTexture = Main.itemTexture[CurrentlyHeldItem.type]; Rectangle itemFrame = itemTexture.Frame(1, 1, 0, 0); - if (Main.itemAnimations[CurrentlyHeldItem.type] != null) + bool hasMultipleFrames = Main.itemAnimations[CurrentlyHeldItem.type] != null; + if (hasMultipleFrames) itemFrame = Main.itemAnimations[CurrentlyHeldItem.type].GetFrame(itemTexture); float baseScale = 1f; @@ -235,7 +236,7 @@ namespace CalamityMod.UI.CalamitasEnchants drawPosition += Vector2.One * 23f * baseScale; // Draw the item. - if (ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) + if (hasMultipleFrames || ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) { spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, itemFrame.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, itemFrame.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs index 68908fd0ac..e098ecb163 100644 --- a/UI/CalamitasEnchantments/Enchantment.cs +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -12,8 +12,6 @@ namespace CalamityMod.UI.CalamitasEnchants public int ID { get; internal set; } - internal static readonly Random EnchantmentIDDecider = new Random(0xCA17A3); - // This is internal because CanBeAppliedTo should be used over this field directly. // Using that has the benefit of null checks and is objectively superior to using the raw delegate. internal Predicate ApplyRequirement; diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index e1a8b02a3e..bd67cf75a3 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using Terraria; +using Terraria.ID; namespace CalamityMod.UI.CalamitasEnchants { @@ -144,12 +145,24 @@ namespace CalamityMod.UI.CalamitasEnchants }, player => player.Calamity().lifeManaEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + + new Enchantment("Resentful", "Makes the damage of projectiles vary based on how far the hit target is from you. The farther, the more damage, and vice versa.", + 400, + null, + player => player.Calamity().farProximityRewardEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + + new Enchantment("Bloodthirsty", "Makes the damage of projectiles vary based on how far the hit target is from you. The closer, the more damage, and vice versa.", + 500, + null, + player => player.Calamity().closeProximityRewardEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), }; // Special disenchantment thing. This is separated from the list on purpose. ClearEnchantment = new Enchantment("Disenchant", string.Empty, ClearEnchantmentID, item => item.Calamity().AppliedEnchantment = null, - item => item.maxStack == 1); + item => item.maxStack == 1 && item.shoot >= ProjectileID.None); } public static void UnloadAllEnchantments() => EnchantmentList = null; From 1e29259380d2af7a3e2ac979a5c1782038648162 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 13 May 2021 19:31:11 -0500 Subject: [PATCH 23/73] Ephemeral enchant --- CalPlayer/CalamityPlayer.cs | 29 +++-------- CalPlayer/CalamityPlayerMiscEffects.cs | 21 ++++++++ Items/CalamityGlobalItem.cs | 51 +++++++++++++++++-- .../EnchantmentManager.cs | 6 +++ 4 files changed, 81 insertions(+), 26 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 39d4a966f0..7e89eb65d9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1000,6 +1000,7 @@ namespace CalamityMod.CalPlayer public bool lifeManaEnchant = false; public bool farProximityRewardEnchant = false; public bool closeProximityRewardEnchant = false; + public bool dischargingItemEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1983,6 +1984,7 @@ namespace CalamityMod.CalPlayer lifeManaEnchant = false; farProximityRewardEnchant = false; closeProximityRewardEnchant = false; + dischargingItemEnchant = false; lastProjectileHit = null; @@ -4472,44 +4474,29 @@ namespace CalamityMod.CalPlayer #region Get Weapon Damage And KB public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) { - if (item.type == ModContent.ItemType()) - { - mult += GaelsGreatsword.BaseDamage / (float)GaelsGreatsword.BaseDamage - 1f; - } if (flamethrowerBoost && item.ranged && (item.useAmmo == AmmoID.Gel || CalamityLists.flamethrowerList.Contains(item.type))) - { mult += hoverboardBoost ? 0.35f : 0.25f; - } + if (cinnamonRoll && CalamityLists.fireWeaponList.Contains(item.type)) - { mult += 0.15f; - } + if (evergreenGin && CalamityLists.natureWeaponList.Contains(item.type)) - { mult += 0.15f; - } + if (fireball && CalamityLists.fireWeaponList.Contains(item.type)) - { mult += 0.1f; - } + if (eskimoSet && CalamityLists.iceWeaponList.Contains(item.type)) - { mult += 0.1f; - } if (item.ranged) - { acidRoundMultiplier = item.useTime / 20D; - } else - { acidRoundMultiplier = 1D; - } - //Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me + + // Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me if (desertProwler && (item.ranged || item.type == ModContent.ItemType()) && item.ammo == AmmoID.None) - { flat += 1f; - } } public override void GetWeaponKnockback(Item item, ref float knockback) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2c15270b74..a809f3e11f 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -7,6 +7,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor; using CalamityMod.Items.Fishing.AstralCatches; @@ -2013,6 +2014,26 @@ namespace CalamityMod.CalPlayer if (heldItem.IsAir) return; + // Exhaustion recharge effects. + foreach (Item item in player.inventory) + { + if (item.IsAir) + continue; + + if (item.Calamity().AppliedEnchantment.HasValue && item.Calamity().AppliedEnchantment.Value.ID == 600) + { + // Initialize the exhaustion if it is currently not defined. + if (item.Calamity().DischargeEnchantExhaustion <= 0f) + item.Calamity().DischargeEnchantExhaustion = CalamityGlobalItem.DischargeEnchantExhaustionCap; + + // Slowly recharge the weapon over time. This is depleted when the item is actaully used. + else if (item.Calamity().DischargeEnchantExhaustion < CalamityGlobalItem.DischargeEnchantExhaustionCap) + item.Calamity().DischargeEnchantExhaustion++; + } + else + item.Calamity().DischargeEnchantExhaustion = 0f; + } + if (!heldItem.Calamity().AppliedEnchantment.HasValue || heldItem.Calamity().AppliedEnchantment.Value.HoldEffect is null) return; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index b83de24cfd..da202648c4 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -55,6 +55,18 @@ namespace CalamityMod.Items #region Enchantment Variables public Enchantment? AppliedEnchantment = null; + public float DischargeEnchantExhaustion = 0; + public float DischargeExhaustionRatio + { + get + { + float ratio = DischargeEnchantExhaustion / DischargeEnchantExhaustionCap; + return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f); + } + } + public const float DischargeEnchantExhaustionCap = 1600f; + public const float DischargeEnchantMinDamageFactor = 0.77f; + public const float DischargeEnchantMaxDamageFactor = 1.26f; #endregion // Miscellaneous stuff @@ -76,6 +88,7 @@ namespace CalamityMod.Items { CalamityGlobalItem myClone = (CalamityGlobalItem)base.Clone(item, itemClone); myClone.StealthGenBonus = StealthGenBonus; + myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion; myClone.Charge = Charge; return myClone; } @@ -485,7 +498,8 @@ namespace CalamityMod.Items ["rarity"] = (int)customRarity, ["charge"] = Charge, ["reforgeTier"] = reforgeTier, - ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0 + ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0, + ["DischargeEnchantExhaustion"] = DischargeEnchantExhaustion }; } @@ -501,6 +515,7 @@ namespace CalamityMod.Items else Charge = tag.GetFloat("charge"); + DischargeEnchantExhaustion = tag.GetFloat("DischargeEnchantExhaustion"); reforgeTier = tag.GetInt("reforgeTimer"); Enchantment? savedEnchantment = EnchantmentManager.FindByID(tag.GetInt("enchantmentID")); if (savedEnchantment.HasValue) @@ -541,6 +556,7 @@ namespace CalamityMod.Items writer.Write(Charge); writer.Write(reforgeTier); writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); + writer.Write(DischargeEnchantExhaustion); } public override void NetReceive(Item item, BinaryReader reader) @@ -561,6 +577,7 @@ namespace CalamityMod.Items if (hasCreationEffect) item.Calamity().AppliedEnchantment.Value.CreationEffect(item); } + DischargeEnchantExhaustion = reader.ReadSingle(); } #endregion @@ -739,6 +756,15 @@ namespace CalamityMod.Items if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (modItem.rogue || item.magic || item.ranged || item.melee)) return player.altFunctionUse == 0 ? ProfanedSoulCrystal.TransformItemUsage(item, player) : AltFunctionUse(item, player); + // Exhaust the weapon if it has the necessary enchant. + if (!item.IsAir && modPlayer.dischargingItemEnchant) + { + float exhaustionCost = item.useTime * 2.25f; + if (exhaustionCost < 10f) + exhaustionCost = 10f; + DischargeEnchantExhaustion = MathHelper.Clamp(DischargeEnchantExhaustion - exhaustionCost, 0.001f, DischargeEnchantExhaustionCap); + } + // Check for sufficient charge if this item uses charge. if (item.type >= ItemID.Count && modItem.UsesCharge) { @@ -840,7 +866,11 @@ namespace CalamityMod.Items // Summon weapons specifically do not have their damage affected by charge. They still require charge to function however. CalamityGlobalItem modItem = item.Calamity(); - if (!item.summon && (modItem?.UsesCharge ?? false)) + + if (!item.summon && modItem.DischargeEnchantExhaustion > 0f) + mult *= DischargeEnchantmentDamageFormula(); + + if (!item.summon && (modItem?.UsesCharge ?? false)) { // At exactly zero charge, do not perform any multiplication. // This makes charge-using weapons show up at full damage when previewed in crafting, Recipe Browser, etc. @@ -850,9 +880,20 @@ namespace CalamityMod.Items } } - // This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge. - // Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped. - internal float ChargeDamageFormula() + internal float DischargeEnchantmentDamageFormula() + { + // This exponential has the properties of beginning at 0 and ending at 1, yet also has their signature rising curve. + // It is therefore perfect for a potential interpolant. + float interpolant = (float)Math.Pow(2D, DischargeExhaustionRatio) - 1f; + + // No further smoothening is required in the form of a Smoothstep remap. + // A linear interpolation works fine; the exponential already has the desired curve shape. + return MathHelper.Lerp(DischargeEnchantMinDamageFactor, DischargeEnchantMaxDamageFactor, interpolant); + } + + // This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge. + // Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped. + internal float ChargeDamageFormula() { float x = MathHelper.Clamp(ChargeRatio, 0f, 1f); float y = 1.087f - 0.08f / (x + 0.07f); diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index bd67cf75a3..518948ff15 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -157,6 +157,12 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().closeProximityRewardEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + + new Enchantment("Ephemeral", "Causes the damage output of this item to discharge from exhaustive use. Its damage returns naturally when not being used.", + 600, + null, + player => player.Calamity().dischargingItemEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), }; // Special disenchantment thing. This is separated from the list on purpose. From 97f41ce991aa49516870b293c393433c6d543c35 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 13 May 2021 21:45:41 -0500 Subject: [PATCH 24/73] Damned enchant --- CalPlayer/CalamityPlayer.cs | 2 + ILEditing/ILChanges.cs | 27 ++++++- Projectiles/CalamityGlobalProjectile.cs | 41 +++++++++- .../Summon/SummonBrimstoneExplosion.cs | 72 ++++++++++++++++++ .../Summon/SummonBrimstoneExplosion.png | Bin 0 -> 965 bytes .../EnchantmentManager.cs | 8 ++ 6 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 Projectiles/Summon/SummonBrimstoneExplosion.cs create mode 100644 Projectiles/Summon/SummonBrimstoneExplosion.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7e89eb65d9..0855e92ffb 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1001,6 +1001,7 @@ namespace CalamityMod.CalPlayer public bool farProximityRewardEnchant = false; public bool closeProximityRewardEnchant = false; public bool dischargingItemEnchant = false; + public bool explosiveMinionsEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1985,6 +1986,7 @@ namespace CalamityMod.CalPlayer farProximityRewardEnchant = false; closeProximityRewardEnchant = false; dischargingItemEnchant = false; + explosiveMinionsEnchant = false; lastProjectileHit = null; diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index c5d55c73dd..06db62641a 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.NPCs; +using CalamityMod.Projectiles; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -69,6 +70,7 @@ namespace CalamityMod.ILEditing DisableDemonAltarGeneration(); DisableTeleportersDuringBossFights(); FixSplittingWormBannerDrops(); + IncorporateMinionExplodingCountdown(); } /// @@ -397,10 +399,29 @@ namespace CalamityMod.ILEditing }; } - #endregion + private static void IncorporateMinionExplodingCountdown() + { + On.Terraria.Projectile.NewProjectile_float_float_float_float_int_int_float_int_float_float += (orig, x, y, xSpeed, ySpeed, type, damage, knockback, owner, ai0, ai1) => + { + // This is unfortunately not something that can be done via SetDefaults since owner is set + // after that method is called. Doing it directly when the projectile is spawned appears to be the only reasonable way. + int proj = orig(x, y, xSpeed, ySpeed, type, damage, knockback, owner, ai0, ai1); + Projectile projectile = Main.projectile[proj]; + if (projectile.minion) + { + Player player = Main.player[projectile.owner]; + CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); + if (player.Calamity().explosiveMinionsEnchant) + projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime; + } + return proj; + }; + } - #region IL Editing Injected/Hooked Functions - private static void BossRushLifeBytes(On.Terraria.Main.orig_InitLifeBytes orig) + #endregion + + #region IL Editing Injected/Hooked Functions + private static void BossRushLifeBytes(On.Terraria.Main.orig_InitLifeBytes orig) { orig(); foreach (int npcType in NeedsFourLifeBytes) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 445a999043..8fc1717647 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -106,8 +107,12 @@ namespace CalamityMod.Projectiles public bool affectedByMaliceModeVelocityMultiplier = false; public const float MaliceModeProjectileVelocityMultiplier = 1.25f; - #region SetDefaults - public override void SetDefaults(Projectile projectile) + // Enchantment variables. + public int ExplosiveEnchantCountdown = 0; + public const int ExplosiveEnchantTime = 600; + + #region SetDefaults + public override void SetDefaults(Projectile projectile) { if (CalamityLists.trueMeleeProjectileList.Contains(projectile.type)) trueMelee = true; @@ -219,6 +224,38 @@ namespace CalamityMod.Projectiles #region PreAI public override bool PreAI(Projectile projectile) { + if (projectile.minion && ExplosiveEnchantCountdown > 0) + { + ExplosiveEnchantCountdown--; + + // Make fizzle sounds and fire dust to indicate the impending explosion. + if (ExplosiveEnchantCountdown <= 300) + { + if (Main.rand.NextBool(24)) + Main.PlaySound(SoundID.DD2_BetsyFireballShot, projectile.Center); + + Dust fire = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Circular(projectile.width, projectile.height) * 0.42f, 267); + fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0.45f, 1f)); + fire.scale = Main.rand.NextFloat(1.4f, 1.65f); + fire.fadeIn = 0.5f; + fire.noGravity = true; + } + + if (ExplosiveEnchantCountdown <= 0) + { + Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center); + if (Main.myPlayer == projectile.owner) + { + if (projectile.minionSlots > 0f) + { + int damage = (int)(Main.player[projectile.owner].MinionDamage() * 6000); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); + } + projectile.Kill(); + } + } + } + if (RequiresManualResurrection) { // Reactivate the projectile the instant it's created. This is dirty as fuck, but diff --git a/Projectiles/Summon/SummonBrimstoneExplosion.cs b/Projectiles/Summon/SummonBrimstoneExplosion.cs new file mode 100644 index 0000000000..0c4eb00e90 --- /dev/null +++ b/Projectiles/Summon/SummonBrimstoneExplosion.cs @@ -0,0 +1,72 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SummonBrimstoneExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 160; + projectile.friendly = true; + projectile.hostile = true; + projectile.minion = true; + projectile.penetrate = -1; + projectile.timeLeft = Main.projFrames[projectile.type] * 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + CreateInitialDust(); + projectile.localAI[0] = 1f; + } + + // Emit crimson light. + Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 1.1f); + if (projectile.timeLeft % 5f == 4f) + projectile.frame++; + } + + public void CreateInitialDust() + { + float randomnessSmoothness = 3f; + for (int i = 0; i < 10; i++) + { + randomnessSmoothness += i; + + int offsetVariance = (int)(randomnessSmoothness * 4f); + for (int j = 0; j < 30; j++) + { + Vector2 velocity = Main.rand.NextVector2Square(-randomnessSmoothness, randomnessSmoothness).SafeNormalize(Vector2.UnitY) * randomnessSmoothness * 0.48f; + Dust dust = Dust.NewDustDirect(projectile.Center, offsetVariance, offsetVariance, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.6f); + dust.position += Main.rand.NextVector2Square(-10f, 10f); + dust.velocity = velocity; + dust.noGravity = true; + } + } + + projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + // Prevent absurd quantities of damage to the player. + damage = (int)(damage * 0.018); + } + } +} diff --git a/Projectiles/Summon/SummonBrimstoneExplosion.png b/Projectiles/Summon/SummonBrimstoneExplosion.png new file mode 100644 index 0000000000000000000000000000000000000000..b53b2fea887d88be7c6d896d0ad4715d91c23470 GIT binary patch literal 965 zcmV;$13LVPP)Px#1ZP1_K>z@;j|==^1poj55>QN3MF0Q*|B-WH7CEgnM&nOU00013X~QP~000Jb zQchF<|NsC00JFcOzW@LL32;bRa{vGi!2kdb!2!6DYwZ9411d>GK~!i%?Usvjqc99b zmu>U^zr0*uDUux%(1p%qww#$3Jr2g^nLm#LpDZtn1p`;hkty=B!U*In$BN9Nmpy8w zG>9g93r!0QYpYQuuAH3 zCX|SrGjcEF7@Uvnhi~+1O+g@LT=_$#RMo%7g&_D$fa?BtZOo~WodTPV+R_z z=!zU|Y#qq>qw}0bQHJKSZyCjfQDk0%3}p;M11K_d5-PUVG^%p{NHJ=A3~F6=LJh2C zs4_9ju%dBBUKX!5cLB2)CT6$@>>MsL6hzse)Et z$u9#sRhgK%!W=4IVa$jw`-_&J2UM|3Yd19c@t}y$8x&6Gyo?r9&tek3U{IH_I0$I@ z;qiZ@E^``C+FmV=!$(w?F#!}EkI{>$F8e8C88G7zi0~gMGRtVY3^)vG%&RhPOuv0l z@~sc!7r!pE=u-jE`5<6x#g)43#NwK5umV&WD)0Y za9+kFEKKw#uP&oBo5Dz4cKU<9qRPDBmbA>mCsjGhxt(Q?YjS_9%=tOlsmZuCEuO-m zY#Jrme}W)!*dln`EG)~eM{z5z%OoEh3g9qS6lGk}abY0WblJj9H2DZu$n!~^m!Sen zpM0`hT3}J0qsX&^zEYQusk%HqL;y7lSL!n8%R$~@UzZ52U%DnA z;j?8waXsf{s6QuL*l}Lo;`hk&lhxNX`3Se1x#i3)XFf%akL^A+8K2#)7tBai-ew%+ nI=TO8a;@BR%bEXNemwpG|6JTXI#<=S00000NkvXXu0mjfmFu-D literal 0 HcmV?d00001 diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 518948ff15..98d94c20f7 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,8 +1,10 @@ +using CalamityMod.Items.Weapons.Summon; using System; using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.UI.CalamitasEnchants { @@ -163,6 +165,12 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().dischargingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), + + new Enchantment("Damned", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. The explosion can hurt both you and enemies. Minions do more damage to compensate.", + 700, + item => item.damage = (int)(item.damage * 1.5), + player => player.Calamity().explosiveMinionsEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.summon), }; // Special disenchantment thing. This is separated from the list on purpose. From 45ef12b92393674161044e4c3c840be33ce253eb Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 16 May 2021 16:32:07 -0500 Subject: [PATCH 25/73] Tainted enchant (epic) --- CalPlayer/CalamityPlayer.cs | 5 + CalamityLists.cs | 4 +- Effects/CalamityShaders.cs | 3 + Effects/FadedUVMapStreak.xnb | Bin 2832 -> 2832 bytes Effects/FadingSolidTrail.fx | 63 ++++ Effects/FadingSolidTrail.xnb | Bin 0 -> 2036 bytes ExtraTextures/BladeTrailUVMap.png | Bin 0 -> 13673 bytes ExtraTextures/TaintedArm.png | Bin 0 -> 932 bytes ExtraTextures/TaintedForearm.png | Bin 0 -> 690 bytes ExtraTextures/TaintedHand.png | Bin 0 -> 673 bytes ExtraTextures/TaintedHand2.png | Bin 0 -> 783 bytes Projectiles/Melee/TaintedBladeSlasher.cs | 276 ++++++++++++++++++ TrailGeneration/PrimitiveTrail.cs | 15 +- .../CalamitasEnchantUI.cs | 1 - .../EnchantmentManager.cs | 37 ++- 15 files changed, 398 insertions(+), 6 deletions(-) create mode 100644 Effects/FadingSolidTrail.fx create mode 100644 Effects/FadingSolidTrail.xnb create mode 100644 ExtraTextures/BladeTrailUVMap.png create mode 100644 ExtraTextures/TaintedArm.png create mode 100644 ExtraTextures/TaintedForearm.png create mode 100644 ExtraTextures/TaintedHand.png create mode 100644 ExtraTextures/TaintedHand2.png create mode 100644 Projectiles/Melee/TaintedBladeSlasher.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 0855e92ffb..0407d4ed16 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1002,6 +1002,7 @@ namespace CalamityMod.CalPlayer public bool closeProximityRewardEnchant = false; public bool dischargingItemEnchant = false; public bool explosiveMinionsEnchant = false; + public bool bladeArmEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1987,6 +1988,7 @@ namespace CalamityMod.CalPlayer closeProximityRewardEnchant = false; dischargingItemEnchant = false; explosiveMinionsEnchant = false; + bladeArmEnchant = false; lastProjectileHit = null; @@ -6854,6 +6856,9 @@ namespace CalamityMod.CalPlayer #region Shoot public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (bladeArmEnchant) + return false; + if (veneratedLocket) { if (item.Calamity().rogue && item.type != ModContent.ItemType()) diff --git a/CalamityLists.cs b/CalamityLists.cs index 9790add389..ccb4559ddb 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -368,7 +368,8 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType() + ProjectileType(), + ProjectileType() }; rangedProjectileExceptionList = new List() @@ -440,6 +441,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), //Some hostile boss projectiles ProjectileType(), diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 407dc6b42c..04c361c29b 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Effects public static Effect TentacleShader; public static Effect LightDistortionShader; public static Effect FadedUVMapStreakShader; + public static Effect FadingSolidTrailShader; public static void LoadShaders() { @@ -23,6 +24,7 @@ namespace CalamityMod.Effects TentacleShader = CalamityMod.Instance.GetEffect("Effects/TentacleShader"); LightDistortionShader = CalamityMod.Instance.GetEffect("Effects/DistortionShader"); FadedUVMapStreakShader = CalamityMod.Instance.GetEffect("Effects/FadedUVMapStreak"); + FadingSolidTrailShader = CalamityMod.Instance.GetEffect("Effects/FadingSolidTrail"); Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); @@ -32,6 +34,7 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref(LightDistortionShader), "DistortionPass"); GameShaders.Misc["CalamityMod:TrailStreak"] = new MiscShaderData(new Ref(FadedUVMapStreakShader), "TrailPass"); + GameShaders.Misc["CalamityMod:FadingSolidTrail"] = new MiscShaderData(new Ref(FadingSolidTrailShader), "TrailPass"); } } } diff --git a/Effects/FadedUVMapStreak.xnb b/Effects/FadedUVMapStreak.xnb index 45b95d5d3f96dccd64d7961c591d51614e3fe859..fbc7a110eca69ec46b8fe2f22a41aafeba756474 100644 GIT binary patch delta 38 ucmbOrHbHEIJtJe`WCzAf=1G^>C$C}bVp3hZ*@9^=BlAZ0vdur3CD;M?h792V delta 38 scmbOrHbHEIJtHH-WCzAfW(Ed^$!i$9m>3u~TQKcq1o1cjV3uG90J3lh#Q*>R diff --git a/Effects/FadingSolidTrail.fx b/Effects/FadingSolidTrail.fx new file mode 100644 index 0000000000..dd9efcb37a --- /dev/null +++ b/Effects/FadingSolidTrail.fx @@ -0,0 +1,63 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, coords); + float opacity = fadeMapColor.r; + return color * opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/FadingSolidTrail.xnb b/Effects/FadingSolidTrail.xnb new file mode 100644 index 0000000000000000000000000000000000000000..7e0935bda4647b1083ec783ebcaf68ec0d72f999 GIT binary patch literal 2036 zcmb_czi-n}5PnYDlG38EATdP3Y(qBi_ZSOd*9i2_g*~rWPGhx z`F)8o<*oAAG#tBSFS^>CrE3oyeTA>t&azgtEtgxac7Jh^8}1C(Yurhz=cy+hy;(Pn zR$86qPRq2dv0*JkzqDHP8m{N?F^hYyqc_rO*;{Cs#v{H_wU@ayRv6A1i-iTAt?_&& zpTEt>loG1@G4N~ms!xN9(%(IK9S`tj+jz0+(J^7&#n>bL=s9|ti8o`rf%^3MjdS#Uq_3JQoVCA;9=}Lh+5?G# z1s2q0dyc_paDJjW?@Qtsq!MLGaPO(@G-_qLW%}(z{S1;gG|CZq1Hj&d>EIpIe)OIR zNiXUa`E|C|$?Ig+O+IW(Fh`9LP5~DrUIMO5d>#0M#J>Uml=v}l zLfWSka6#g8z^=sK0B=cr5BNah>*4;kJvWgb#6 z*6p5jZ?a`1WP77lZzacy6;bpPSFH==-e> z&D>I_N|lmYsne%jE!rzhvjH%o`jj{Do6 zgyv{RNgQqBJfKVBly}rY4KbGR*W2ALqM=dW0zacdV<+f4ANBp277>&C{)iCuO-0dp zqdCmM|9a-Px3}Xcr3XJT2S_hutN&?^_;0n9aHg17I|htzKjxA})P0g3d-+Vg#OS5Lpo;`ccoH=vn&Yd@J-hu@S=FgwMaN)w&UVH70 zH{J*g41E3d*B38d{EvV95fSgd|Nh#w z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WKV4ucU{jtVPsUkA*9ljbHUmQC>jYmHZt=z$!*j} z-~QNsu`tKL0Lw(HAH~Yj(Hc76E^ub<@<_byPoEpDH2rv6X-j7B$g8f{ahl%LhSWd0 zkM-;x0j}B6F5{abCeK$qder@O80(xMgqXS}XnN&!NFo#1vspF{i80dN+vKCa;@_4OR2uCQ1zsB`*Vfe` z@tqa6YZ(uUymo75X}+`C7xbrhPVub~4`gJxsw&ZXs3@{Vm?!8L*oVE~#sR}dgW0_Q z$q`;L{>x^U*z(z@gw!080I(-An?3>NQP+^R&9+%<7wCFw54Us>#Y+3Wnx;;>FeIDj zBNAwKj?q|9nN1w@{+Usz!slzMKu$<1*Qy`w@d17v{Z2L~+m+7{`lvkRu)Z19AuP?c zDcwQix-L|_*WD(KU6)?UQ>jgs^sW&vbs+O*KTgz-11a~a&3NXyYfL+4Pzj|)E{K?3 zY3*q0^o=!74SOv{i1w&sC=abxk6US$%%@hI$EQSzE{ZBM|ME_3v`yssoIguq8W~?X z+cc%mX*3Etn33u7HVkj+GEt2lAhnqcwc`Y5+Aza5Yt2*5#x@JVZ(sfMR~tLbH7rO?~FJ|gO&{G85jZKWVwKh3ySO zv@0)z>(k-X#FDrsvah3%pP*2-5kuB*oES9TNIBtZB*}G2mUN7AnDT`pEPgD`tJV#2k{j# literal 0 HcmV?d00001 diff --git a/ExtraTextures/TaintedArm.png b/ExtraTextures/TaintedArm.png new file mode 100644 index 0000000000000000000000000000000000000000..f8796f05e787355d2b6fa65e383341523fbba80f GIT binary patch literal 932 zcmV;V16%xwP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz135`VK~!i%?V3Mm z6hRop?}8G&c&Cwo2?@a{DwqhyPEj-#l13snDa1k$F%}k9Da1mpZ6hLBS)}m~Hdm=2 zSenA9sAxnIq7eLZA&Ll|%-el(c{1$m#?lYioD< z;^f??e0=CcQ>>X`b)coCgpQuI1$^G#y%V~*={J;o__G@N=Hp9f_zp1geVaP*xwxSN z%E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l0w|HY0>1+gm&?&=ELP-@+;RQ{ znei~|rIE-v`ZVGd_KOgX0v1qWeRfU{sRmR;8cQ)&h7}B70gM>l@P!qzJQAJ)oFfaV zf6M^_u0!PfJF-g3A!|c=eF#T^!JuE2!*V%C1UT3Dp08)Z^T4!l#PEofdk~%i@Pd^~ z%!mwEg)g})VD1Td4~PnY8dkLFiV#kpAGH-#^@NDG3b_6mc*sS#9st%ZIb9h7JONb@ zeem}M&H-3!g9UQ$dtJO$@L!YzD9!+QX2hzRbWOrnz!eG4`B~?UcsyW5#yh60#G`-( zdmt)QCgpb$JTr!`0C4SY-~;QKAuAT20xo#wWH@q=vjUaM Y4}g=Q+-bLJ=l}o!07*qoM6N<$f=62|yZ`_I literal 0 HcmV?d00001 diff --git a/ExtraTextures/TaintedHand.png b/ExtraTextures/TaintedHand.png new file mode 100644 index 0000000000000000000000000000000000000000..89e494b14c32ffcb87057c14ac88f2b6bdd74a9c GIT binary patch literal 673 zcmV;S0$%-zP)QF(00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TrF$*+f(9o_?_0ncE!M z?`CG_?9OJh&L-&hhYL44-0n4Ji(J1vb(_~%++rU zQ)&bQqv38iuFB=}V>nKylcc#~jcxpgnZeXpm-ZRM#Qo<-7#1_c%_gWnDv zKtG4-vU2S@rhA~)FO4%btJnYQ7?@cbf3J>NY{eY~bxZlF8IO9i(yLp)t@2(rLVd>K zxH2$C9335;gd<$sUNvWP&W}% za1(~&8MRoAhdvo7KP$1sucx}FR%6grkfpi#T-WRdea|e{Sg$u&h$qjOXN1ocZ=UzL z*0b`B@$A_Hy_IQlQ%2Z>F#nqw~y^ z#-mYwR3-z(i1^I}0E^XU7% zd0v;%p7%;K7Y~ai8`LMQQ_NFz-m27>l^SCy8!7ZH+^b{Uueuof_TL__o&hWOdjDK@ z1KG>{>Um32V~QGNWqhti)ga{NwZ~WvH419Ln+KH`>vX;VdY!$tZA3*W00000NkvXX Hu0mjfiXl39 literal 0 HcmV?d00001 diff --git a/ExtraTextures/TaintedHand2.png b/ExtraTextures/TaintedHand2.png new file mode 100644 index 0000000000000000000000000000000000000000..7050006ac8c61186020aaeb5ff1be56f97c2d586 GIT binary patch literal 783 zcmV+q1MvKbP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ940;EYqK~!i%?U>C@ z8!;4x(}WU838k<=s1i~)RDvxlUZBt17wC#@E47-_cx`NfHY zMB|~Z99pja7b*Tf4#Ldm=y#97zEo@;Su1G1GU1~hUfg3`j47D zw4Rm|)>Fm2dX-nu?O^BP1ZL;m*ogViw0`&yrkt56R`#{3ub|BqGb)xsmGnk#`^nUQ z?J~3<)t|*79qpuv`WIDeZ|opdR7I^%Rk$Rce7r4K?m^(7s-Mt&_PR7m4qi4TwUh5u;gM?o@c zTx&O$@QzNuhvyRgvr6*+KbTsBIdW3=KgHl|yzKXp_fW-@iYr*F-2)|fu73LwTAu&_ N002ovPDHLkV1gnUf{_3K literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs new file mode 100644 index 0000000000..a5e25b8753 --- /dev/null +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -0,0 +1,276 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TaintedBladeSlasher : ModProjectile + { + internal PrimitiveTrail TrailDrawer = null; + public ref float SwordItemID => ref projectile.ai[0]; + public ref float VerticalOffset => ref projectile.localAI[0]; + public ref float Time => ref projectile.localAI[1]; + public float AttackCompletionRatio => 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; + public Player Owner => Main.player[projectile.owner]; + public int Variant => projectile.identity % 2; + + public const float ForearmLength = 80f; + public const float ArmLength = 108f; + + public Rectangle BladeFrame + { + get + { + Texture2D bladeTexture = Main.itemTexture[(int)SwordItemID]; + Rectangle bladeFrame = bladeTexture.Frame(1, 1, 0, 0); + bool hasMultipleFrames = Main.itemAnimations[(int)SwordItemID] != null; + if (hasMultipleFrames) + bladeFrame = Main.itemAnimations[(int)SwordItemID].GetFrame(bladeTexture); + return bladeFrame; + } + } + + public Vector2 BackArmAimPosition + { + get + { + Vector2 baseAimPosition = Owner.Top + new Vector2(-Owner.direction * (ForearmLength + Math.Abs(VerticalOffset) * 0.55f), -27f); + if (Variant == 1) + baseAimPosition.Y += 30f; + if (Owner.itemAnimation == 0) + return baseAimPosition; + + Vector2 endSwingPosition = Owner.Center + Vector2.UnitX * Owner.direction * 510f; + return Vector2.SmoothStep(baseAimPosition, endSwingPosition, Utils.InverseLerp(0f, 0.67f, AttackCompletionRatio, true) * Utils.InverseLerp(1f, 0.67f, AttackCompletionRatio, true)); + } + } + public Vector2 IdleMoveOffset + { + get + { + Vector2 offset = Owner.itemAnimation == 0 ? (Time / 27f).ToRotationVector2() * new Vector2(5f, 4f) : Vector2.Zero; + if (Variant == 1) + offset += Vector2.UnitX * Owner.direction * (1f - AttackCompletionRatio) * 40f; + return offset; + } + } + public Vector2 FrontArmEnd + { + get + { + float backArmRotation = Owner.AngleTo(BackArmAimPosition); + Vector2 fromArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength; + Vector2 backOffset = (projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; + return fromArmDrawPosition + backOffset; + } + } + public Vector2 BladeOffsetDirection + { + get + { + float backArmRotation = Owner.AngleTo(BackArmAimPosition); + Vector2 fromArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength; + Vector2 backOffset = (projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; + float bladeRotation = backOffset.ToRotation() - MathHelper.PiOver4 + MathHelper.Pi; + return -(bladeRotation + MathHelper.PiOver4 + BladeRotationOffset).ToRotationVector2(); + } + } + public Vector2 BladeCenterPosition + { + get + { + float offsetFactor = BladeFrame.Height / 4f + 31f; + return FrontArmEnd + BladeOffsetDirection * offsetFactor; + } + } + public float BladeRotationOffset => MathHelper.Lerp(MathHelper.PiOver2, 0f, Utils.InverseLerp(0f, 0.17f, 1f - AttackCompletionRatio, true)) * -Owner.direction; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 70; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 4; + projectile.friendly = true; + projectile.melee = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 90000; + projectile.usesLocalNPCImmunity = true; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); + + public override void ReceiveExtraAI(BinaryReader reader) => VerticalOffset = reader.ReadSingle(); + + public override void AI() + { + CalamityPlayerMiscEffects.EnchantHeldItemEffects(Owner, Owner.Calamity(), Owner.ActiveItem()); + if (!Owner.Calamity().bladeArmEnchant) + { + projectile.Kill(); + return; + } + float swingOffsetAngle = MathHelper.SmoothStep(-1.87f, 3.79f, AttackCompletionRatio); + + // Offset a little bit angularly if the secondary variant to prevent complete overlap. + if (Variant == 1) + swingOffsetAngle -= 0.7f; + swingOffsetAngle *= Owner.direction; + swingOffsetAngle = MathHelper.Lerp(0f, swingOffsetAngle, Utils.InverseLerp(0f, 0.16f, AttackCompletionRatio, true)); + + if (Owner.itemAnimation == 0) + swingOffsetAngle = 0f; + + Vector2 destination = Owner.Center; + + if (Owner.itemAnimation == 0) + { + destination.X += Owner.direction * (VerticalOffset * 0.6f + 180f); + destination.Y += 330f + VerticalOffset; + if (Variant == 1) + destination.Y += 540f; + + // The blade can be kept in a static location when not being swung. + // This can result in insane damage coming from "poking" enemies. + // To accomodate for this, the hit countdown is increased when not attacking. + projectile.localNPCHitCooldown = 24; + } + else + { + // Swing around in an arc as needed. + // One arm extends a little bit further than the other. + destination -= Vector2.UnitY.RotatedBy(swingOffsetAngle) * 600f; + + // Make a fire/swing sound. + if (Owner.itemAnimation == 21) + Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Owner.Center); + projectile.localNPCHitCooldown = 3; + } + + if (AttackCompletionRatio < 0.16f) + projectile.oldPos = new Vector2[projectile.oldPos.Length]; + + // Very, very quickly approach the swing destination while attacking. + // Also gain a temporary extra update. + if (Owner.itemAnimation > 0) + { + projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.19f); + projectile.extraUpdates = 1; + } + + // Idly move towards the destination. + if (projectile.Center != destination) + projectile.Center += (destination - projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Min(projectile.Distance(destination), 12f + Owner.velocity.Length()); + + Time++; + } + + internal float PrimitiveWidthFunction(float completionRatio) => BladeFrame.Height * 0.47f; + + internal Color PrimitiveColorFunction(float completionRatio) + { + float opacity = Utils.InverseLerp(0.8f, 0.52f, completionRatio, true) * Utils.InverseLerp(1f, 0.81f, AttackCompletionRatio, true); + Color startingColor = Color.Lerp(Color.Red, Color.DarkRed, 0.4f); + Color endingColor = Color.Lerp(Color.DarkRed, Color.Purple, 0.77f); + return Color.Lerp(startingColor, endingColor, (float)Math.Pow(completionRatio, 0.37f)) * opacity; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:FadingSolidTrail"]); + + Texture2D forearmTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedForearm"); + Texture2D armTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedArm"); + Texture2D handTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedHand"); + + // Reflect the 1st hand variant horizontally. + SpriteEffects handDirection = SpriteEffects.None; + if (Variant == (Owner.direction == -1).ToInt()) + { + handTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/TaintedHand2"); + handDirection = SpriteEffects.FlipHorizontally; + } + Texture2D bladeTexture = Main.itemTexture[(int)SwordItemID]; + + // Draw the arms. + float backArmRotation = Owner.AngleTo(BackArmAimPosition); + spriteBatch.Draw(forearmTexture, Owner.Center - Main.screenPosition, null, Color.White, backArmRotation - MathHelper.PiOver2, Vector2.UnitX * forearmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + + Vector2 frontArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength + IdleMoveOffset; + float frontArmRotation = projectile.AngleFrom(frontArmDrawPosition); + spriteBatch.Draw(armTexture, frontArmDrawPosition - Main.screenPosition, null, Color.White, frontArmRotation - MathHelper.PiOver2, Vector2.UnitX * armTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + + float handRotation = frontArmRotation + MathHelper.PiOver2 + MathHelper.Pi; + float bladeRotation = handRotation - MathHelper.PiOver4 + MathHelper.Pi + BladeRotationOffset; + if (Owner.direction == -1) + bladeRotation += MathHelper.PiOver2; + + // Draw the trail behind the blade. + if (Owner.itemAnimation > 0) + { + GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/BladeTrailUVMap")); + Vector2 bottom = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; + Vector2 top = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; + Vector2 offsetToBlade = (top - bottom).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * 5f; + + TrailDrawer.OverridingStickPointStart = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f + offsetToBlade - Main.screenPosition; + TrailDrawer.OverridingStickPointEnd = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f + offsetToBlade - Main.screenPosition; + + // Swap the ends if needed so that the trail faces the right direction. + if (Owner.direction == -1) + Utils.Swap(ref TrailDrawer.OverridingStickPointStart, ref TrailDrawer.OverridingStickPointEnd); + + Vector2[] drawPoints = new Vector2[projectile.oldPos.Length]; + Vector2 perpendicularDirection = BladeOffsetDirection.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.PiOver2); + for (int i = 1; i < drawPoints.Length; i++) + { + if (projectile.oldPos[i] == Vector2.Zero) + continue; + + drawPoints[i] = projectile.Center + perpendicularDirection.RotatedBy(i * -0.014f * Owner.direction) * i * -Owner.direction * 4f; + } + + TrailDrawer.Draw(drawPoints, BladeCenterPosition - projectile.position - Main.screenPosition, 67); + } + + // Draw the blade. + Vector2 bladeDrawPosition = BladeCenterPosition - Main.screenPosition; + SpriteEffects bladeDirection = Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(bladeTexture, bladeDrawPosition, BladeFrame, Color.White, bladeRotation, BladeFrame.Size() * 0.5f, projectile.scale, bladeDirection, 0f); + + // Draw the hand. + spriteBatch.Draw(handTexture, FrontArmEnd - Main.screenPosition, null, projectile.GetAlpha(Color.White), handRotation, handTexture.Size() * 0.5f, projectile.scale, handDirection, 0f); + return false; + } + + // Register collision at the blade's position. + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Vector2 start = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f; + Vector2 end = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f; + float width = 60f; + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit); + NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit); + PlayerHooks.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); + } + } +} diff --git a/TrailGeneration/PrimitiveTrail.cs b/TrailGeneration/PrimitiveTrail.cs index 707c0e8845..53668105f3 100644 --- a/TrailGeneration/PrimitiveTrail.cs +++ b/TrailGeneration/PrimitiveTrail.cs @@ -45,6 +45,9 @@ namespace CalamityMod public DynamicIndexBuffer IndexBuffer = null; public DynamicVertexBuffer VertexBuffer = null; + public Vector2 OverridingStickPointStart = Vector2.Zero; + public Vector2 OverridingStickPointEnd = Vector2.Zero; + public delegate List TrailPointRetrievalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable originalRotations = null); public PrimitiveTrail(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, TrailPointRetrievalFunction pointFunction = null, MiscShaderData specialShader = null) @@ -194,11 +197,19 @@ namespace CalamityMod // This doesn't use RotatedBy for the sake of performance (there can potentially be a lot of trail points). Vector2 sideDirection = new Vector2(-directionToAhead.Y, directionToAhead.X); + Vector2 left = currentPosition - sideDirection * widthAtVertex; + Vector2 right = currentPosition + sideDirection * widthAtVertex; + if (i == 0 && OverridingStickPointStart != Vector2.Zero) + { + left = OverridingStickPointStart; + right = OverridingStickPointEnd; + } + // What this is doing, at its core, is defining a rectangle based on two triangles. // These triangles are defined based on the width of the strip at that point. // The resulting rectangles combined are what make the trail itself. - vertices[i * 2] = new VertexPosition2DColor(currentPosition - sideDirection * widthAtVertex, vertexColor, leftCurrentTextureCoord); - vertices[i * 2 + 1] = new VertexPosition2DColor(currentPosition + sideDirection * widthAtVertex, vertexColor, rightCurrentTextureCoord); + vertices[i * 2] = new VertexPosition2DColor(left, vertexColor, leftCurrentTextureCoord); + vertices[i * 2 + 1] = new VertexPosition2DColor(right, vertexColor, rightCurrentTextureCoord); } if (VertexBuffer is null || vertices.Length != VertexBuffer.VertexCount) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 480780ef07..47f77b4606 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using System.Collections.Generic; using System.Linq; using Terraria; diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 98d94c20f7..619a285624 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; @@ -126,7 +127,7 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantmentList = new List { - new Enchantment("Cursed", "Summons demons that harm you but drop healing items on death on item usage.", + new Enchantment("Cursed", "Summons demons that harm you but drop healing items on death on item usage.", 100, null, player => player.Calamity().cursedSummonsEnchant = true, @@ -171,6 +172,38 @@ namespace CalamityMod.UI.CalamitasEnchants item => item.damage = (int)(item.damage * 1.5), player => player.Calamity().explosiveMinionsEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.summon), + + new Enchantment("Tainted", "Removes projectile shooting capabilities of this item. In exchange, two skeletal arms are released on use that slice at the mouse position.", + 800, + item => item.useTime = item.useAnimation = 25, + player => + { + player.Calamity().bladeArmEnchant = true; + bool armsArePresent = false; + int armType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != armType || Main.projectile[i].owner != player.whoAmI || !Main.projectile[i].active) + continue; + + armsArePresent = true; + break; + } + + if (Main.myPlayer == player.whoAmI && !armsArePresent) + { + // Yes, this is a LOT of damage but given the limited range of this thing it needs to be extremely powerful when it does actually hit. + int damage = (int)(player.ActiveItem().damage * player.MeleeDamage() * 5); + int blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1, player.ActiveItem().type); + if (Main.projectile.IndexInRange(blade)) + Main.projectile[blade].localAI[0] = 0f; + + blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, -1, player.ActiveItem().type); + if (Main.projectile.IndexInRange(blade)) + Main.projectile[blade].localAI[0] = -80f; + } + }, + item => item.damage > 0 && item.maxStack == 1 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None), }; // Special disenchantment thing. This is separated from the list on purpose. From 2e5a35630ecc57923fd3ad1a2dcc845d94a830ba Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 16 May 2021 16:36:14 -0500 Subject: [PATCH 26/73] Slight fix --- Projectiles/Melee/TaintedBladeSlasher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index a5e25b8753..3958b3a93c 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee public class TaintedBladeSlasher : ModProjectile { internal PrimitiveTrail TrailDrawer = null; - public ref float SwordItemID => ref projectile.ai[0]; + public ref float SwordItemID => ref projectile.ai[1]; public ref float VerticalOffset => ref projectile.localAI[0]; public ref float Time => ref projectile.localAI[1]; public float AttackCompletionRatio => 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; From 9426eeb9759285793bc1d7b9a2eca98f905cad7b Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 16 May 2021 19:47:41 -0500 Subject: [PATCH 27/73] Start of Treacherous Enchant (wip) --- CalPlayer/CalamityPlayer.cs | 2 + Items/CalamityGlobalItem.cs | 8 ++ Projectiles/Magic/ManaMonster.cs | 120 ++++++++++++++++++ Projectiles/Magic/ManaMonster.png | Bin 0 -> 983 bytes .../EnchantmentManager.cs | 6 + 5 files changed, 136 insertions(+) create mode 100644 Projectiles/Magic/ManaMonster.cs create mode 100644 Projectiles/Magic/ManaMonster.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 0407d4ed16..d4bc8d64d5 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1003,6 +1003,7 @@ namespace CalamityMod.CalPlayer public bool dischargingItemEnchant = false; public bool explosiveMinionsEnchant = false; public bool bladeArmEnchant = false; + public bool manaMonsterEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -1989,6 +1990,7 @@ namespace CalamityMod.CalPlayer dischargingItemEnchant = false; explosiveMinionsEnchant = false; bladeArmEnchant = false; + manaMonsterEnchant = false; lastProjectileHit = null; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index da202648c4..df861eb740 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -734,6 +734,14 @@ namespace CalamityMod.Items Main.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, Main.MouseWorld); } + bool belowHalfMana = player.statMana < player.statManaMax2 * 0.5f; + if (player.Calamity().manaMonsterEnchant && Main.rand.NextBool(12) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && belowHalfMana) + { + int damage = (int)(45000 * player.MagicDamage()); + Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.67f) * Main.rand.NextFloat(4f, 5f); + Projectile.NewProjectile(player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), damage, 0f, player.whoAmI); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { diff --git a/Projectiles/Magic/ManaMonster.cs b/Projectiles/Magic/ManaMonster.cs new file mode 100644 index 0000000000..4d5ff9f799 --- /dev/null +++ b/Projectiles/Magic/ManaMonster.cs @@ -0,0 +1,120 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ManaMonster : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public Player Target => Main.player[projectile.owner]; + public const int NPCAttackTime = 150; + public const int PlayerAttackRedirectTime = 45; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Monster"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 52; + projectile.friendly = true; + projectile.hostile = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 300; + projectile.Opacity = 0f; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.magic = true; + } + + public override void AI() + { + if (Time < NPCAttackTime) + { + projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); + if (potentialTarget != null) + AttackNPCTarget(potentialTarget); + else if (projectile.velocity.Length() < 22f) + projectile.velocity *= 1.02f; + } + else + { + // Make an alert sound to indicate that the monster has become enraged and will now attack its caster. + if (Time == NPCAttackTime) + { + int ambientNoiseID = Main.rand.Next(39, 41 + 1); + Main.PlaySound(SoundID.Zombie, Target.Center, ambientNoiseID); + Main.PlaySound(SoundID.DD2_DrakinShot, Target.Center); + CreateTransitionBurstDust(); + } + + if (Time < NPCAttackTime + PlayerAttackRedirectTime) + { + float idealMovementDirection = projectile.AngleTo(Target.Center); + float angularTurnSpeed = 0.09f; + float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 14f, 0.1f); + projectile.velocity = projectile.velocity.ToRotation().AngleTowards(idealMovementDirection, angularTurnSpeed).ToRotationVector2() * newSpeed; + } + else if (projectile.velocity.Length() < 34f) + projectile.velocity *= 1.02f; + + // Fade out. + projectile.Opacity = Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); + } + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Time++; + } + + public void AttackNPCTarget(NPC target) + { + if (!projectile.WithinRange(target.Center, 60f)) + { + float idealMovementDirection = projectile.AngleTo(target.Center); + float angularTurnSpeed = 0.18f; + float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 21f, 0.115f); + projectile.velocity = projectile.velocity.ToRotation().AngleTowards(idealMovementDirection, angularTurnSpeed).ToRotationVector2() * newSpeed; + } + } + + public void CreateTransitionBurstDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 75; i++) + { + Dust brimstone = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Square(-25f, 25f), (int)CalamityDusts.Brimstone); + brimstone.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 3.1f) * MathHelper.Lerp(1f, 2.175f, i / 75f); + brimstone.velocity = Vector2.Lerp(brimstone.velocity, -Vector2.UnitY * brimstone.velocity.Length(), 0.5f); + brimstone.scale = MathHelper.Lerp(1f, 1.875f, i / 75f) * Main.rand.NextFloat(0.8f, 1f); + brimstone.fadeIn = 0.4f; + brimstone.noGravity = true; + } + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + // Ensure damage is not absolutely obscene when hitting players. + damage = (int)(damage * 0.0021); + } + + public override bool CanDamage() => projectile.Opacity >= 1f; + + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Magic/ManaMonster.png b/Projectiles/Magic/ManaMonster.png new file mode 100644 index 0000000000000000000000000000000000000000..9b98b7bad063f0b4347abe0ef345a61deb11c197 GIT binary patch literal 983 zcmV;|11S87P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D18hk|K~#8N?V3M} z6G0e<6C)=%v=pq);wllWY(R6pneJ!4y;o66|NBU{Bwn3YbA(P3a=6@ zJuY|{qM4m%!C&$^o9u36cjtjHo9t$1_kHG_*_ot09*?7uWi3sD5rc` zOG-6|v4igHIyQ!hF!paB9~Npbnp>3q>Y6*bWrY0@&CS75ddvSstGYCDy2MIS~KsmX51FhTvpVW&cLntT3M!}xe%7Id1uzl%voE3MGZ!CAuzYT zx#8aT-@SDuI$h#MZeBf1PA)ICABsm98tdKfZFM z(!YAgm0wPVt~~5^TnT$WzQrdLi$ZVi_GrbuCdMYOi4m+gCgT}n+8@}@@qE81V$Ol) zmh$N6jNeLl+BtS5xu;-tXSC`{czE`w-mLdKyv=7@ACk``9(W$i6t(faiI>u;`i`n)qoP7#q%+lQ>Z9;;xidRgYI zUN%%e$Me4a=JZz?BC7K=&|V96e|>kMwR&I9XU*UlpJ+*-y|kk9LTHXTB10ss8MKM@D?+Imzs8{uxxD`u zv7kkzzo`qlMgv@T{mp?DDI#PUO!pU*d$goreX?I$Qgh6~ltKUhk=~W-uB46g4#AdR4hr~O5HPpuEEdPDU^bD$B@+<)r|002ovPDHLk FV1nsK-qZj9 literal 0 HcmV?d00001 diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 619a285624..73fd142398 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -204,6 +204,12 @@ namespace CalamityMod.UI.CalamitasEnchants } }, item => item.damage > 0 && item.maxStack == 1 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None), + + new Enchantment("Treacherous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.", + 900, + null, + player => player.Calamity().manaMonsterEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), }; // Special disenchantment thing. This is separated from the list on purpose. From 101c1f5c8cbc8662585fd777837c8d50eb3b48f9 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 18 May 2021 17:07:05 -0500 Subject: [PATCH 28/73] Finished up the Treacherous enchant --- Items/CalamityGlobalItem.cs | 4 ++-- Projectiles/Magic/ManaMonster.cs | 30 ++++++++---------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index df861eb740..9a3773413d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -737,8 +737,8 @@ namespace CalamityMod.Items bool belowHalfMana = player.statMana < player.statManaMax2 * 0.5f; if (player.Calamity().manaMonsterEnchant && Main.rand.NextBool(12) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && belowHalfMana) { - int damage = (int)(45000 * player.MagicDamage()); - Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.67f) * Main.rand.NextFloat(4f, 5f); + int damage = (int)(165000 * player.MagicDamage()); + Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); Projectile.NewProjectile(player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), damage, 0f, player.whoAmI); } diff --git a/Projectiles/Magic/ManaMonster.cs b/Projectiles/Magic/ManaMonster.cs index 4d5ff9f799..934b90e21c 100644 --- a/Projectiles/Magic/ManaMonster.cs +++ b/Projectiles/Magic/ManaMonster.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic { public ref float Time => ref projectile.ai[0]; public Player Target => Main.player[projectile.owner]; - public const int NPCAttackTime = 150; + public const int NPCAttackTime = 50; public const int PlayerAttackRedirectTime = 45; public override void SetStaticDefaults() { @@ -39,12 +39,9 @@ namespace CalamityMod.Projectiles.Magic { if (Time < NPCAttackTime) { - projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); - NPC potentialTarget = projectile.Center.ClosestNPCAt(1600f); - if (potentialTarget != null) - AttackNPCTarget(potentialTarget); - else if (projectile.velocity.Length() < 22f) - projectile.velocity *= 1.02f; + projectile.Opacity = Utils.InverseLerp(0f, 30f, Time, true); + if (projectile.velocity.Length() < 27f) + projectile.velocity *= 1.05f; } else { @@ -61,11 +58,11 @@ namespace CalamityMod.Projectiles.Magic { float idealMovementDirection = projectile.AngleTo(Target.Center); float angularTurnSpeed = 0.09f; - float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 14f, 0.1f); + float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 22f, 0.1f); projectile.velocity = projectile.velocity.ToRotation().AngleTowards(idealMovementDirection, angularTurnSpeed).ToRotationVector2() * newSpeed; } - else if (projectile.velocity.Length() < 34f) - projectile.velocity *= 1.02f; + else if (projectile.velocity.Length() < 35f) + projectile.velocity *= 1.04f; // Fade out. projectile.Opacity = Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); @@ -75,17 +72,6 @@ namespace CalamityMod.Projectiles.Magic Time++; } - public void AttackNPCTarget(NPC target) - { - if (!projectile.WithinRange(target.Center, 60f)) - { - float idealMovementDirection = projectile.AngleTo(target.Center); - float angularTurnSpeed = 0.18f; - float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 21f, 0.115f); - projectile.velocity = projectile.velocity.ToRotation().AngleTowards(idealMovementDirection, angularTurnSpeed).ToRotationVector2() * newSpeed; - } - } - public void CreateTransitionBurstDust() { if (Main.dedServ) @@ -105,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { // Ensure damage is not absolutely obscene when hitting players. - damage = (int)(damage * 0.0021); + damage = Main.rand.Next(150, 225); } public override bool CanDamage() => projectile.Opacity >= 1f; From f91c2fe215ac173ce1b126ecb2a4a79390b0cbe8 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 19 May 2021 19:15:24 -0500 Subject: [PATCH 29/73] Entropy's vigil upgrade and Brimstone Locus --- CalPlayer/CalamityPlayer.cs | 3 + ExtraTextures/Particles/Light.png | Bin 0 -> 2903 bytes Items/BrimstoneLocus.cs | 35 ++++++ Items/BrimstoneLocus.png | Bin 0 -> 295 bytes Items/CalamityGlobalItem.cs | 52 +++++++- Items/Weapons/Summon/Something.cs | 50 ++++++++ Items/Weapons/Summon/Something.png | Bin 0 -> 477 bytes NPCs/TownNPCs/WITCH.cs | 7 ++ Particles/EnchantedParticleSet.cs | 45 +++++++ Projectiles/Melee/TaintedBladeSlasher.cs | 8 +- Projectiles/Summon/CataclysmSummon.cs | 115 ++++++++++++++++++ Projectiles/Summon/CatastropheSummon.cs | 51 ++++++++ .../CalamitasEnchantUI.cs | 39 ++++-- .../EnchantmentManager.cs | 27 +++- 14 files changed, 416 insertions(+), 16 deletions(-) create mode 100644 ExtraTextures/Particles/Light.png create mode 100644 Items/BrimstoneLocus.cs create mode 100644 Items/BrimstoneLocus.png create mode 100644 Items/Weapons/Summon/Something.cs create mode 100644 Items/Weapons/Summon/Something.png create mode 100644 Particles/EnchantedParticleSet.cs create mode 100644 Projectiles/Summon/CataclysmSummon.cs create mode 100644 Projectiles/Summon/CatastropheSummon.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d4bc8d64d5..eaa8000d18 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -114,6 +114,7 @@ namespace CalamityMod.CalPlayer public int defenseDamage = 0; public float rangedAmmoCost = 1f; public bool heldGaelsLastFrame = false; + public bool GivenBrimstoneLocus = false; #endregion #region Tile Entity Trackers @@ -1103,6 +1104,7 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); boost.AddWithCondition("newBanditInventory", newBanditInventory); boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); + boost.AddWithCondition("GivenBrimstoneLocus", GivenBrimstoneLocus); return new TagCompound { @@ -1179,6 +1181,7 @@ namespace CalamityMod.CalPlayer newAmidiasInventory = boost.Contains("newAmidiasInventory"); newBanditInventory = boost.Contains("newBanditInventory"); newCalamitasInventory = boost.Contains("newCalamitasInventory"); + GivenBrimstoneLocus = boost.Contains("GivenBrimstoneLocus"); // Load rage from "stress" if this is an older save. Otherwise load it from "rage", its new name. if (tag.ContainsKey("stress")) diff --git a/ExtraTextures/Particles/Light.png b/ExtraTextures/Particles/Light.png new file mode 100644 index 0000000000000000000000000000000000000000..8e2d2a871cdedc2f8035aec442b4c527a2bf3160 GIT binary patch literal 2903 zcmV-d3#jyoP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D3hYTlK~#8N?VRg# z6Ui0Dv1}RH^80Pfn}w}p$tGU|e95NB9~~;2$_7#uDx0d^u=&6e9)5r=Sue{ESuf}O z?(`LsY%^XKQnlGRra3b`Gq-Q|J-Xe~G7Oyi-=U|i0U;co2}eRWbo8Hp6r=(tI0YY5 zL1x>Pk`iFYpa91y$(7R*tRkQ-z+KAvD2hrH6oU_`pdQ7zLL7dcPN#>%xdmr16_k`3 z=n2+Q`^Xg1YDdbEfb6`{Xw<`bkD~niLn|s#Pz-*If_k2Hh4d?ESO|O`J}-2i52w?{ z5>ijFBpg#rz0o){uGftZh3<24kD^>be%^)mQdFX#7`%^y?3sS0ID3v65#WpfkB*LJ z;j93UkB?8n5|mvZ5@1JDfF+n3T&-3s@SXtg@9!Je1o%LJ`*W1@`{t%ZK{5Ct3OZ3a zT{*^B0vUtH#>U3ssi~>yZk`Cr8K0P#fJZVJQv6m(FlnNq4dJ3H`BP*S;E zE_L(n?rs&9z;@pX(V#}(j;S(sl~f)^JTOfkRw?6ceOty{Nl!eiNNlzTL- z!RLpEZ5Gq)*O!AD(JWT4N3)csEqHft&vMbzr%%6!|NY%}PvEVsoGB`o&uzl4C|95> z$=6Y5%}I%ZVi2pK{+y%bjYZy-Ge0-C0564{a^>>nEAZWW_wK5$y!Z2KRAeHwMwO2hKr@rHvH(}!-w#z)zw$ghWB_g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bLa~^~&wqaX^*``?Q=lLDe141T{O%+Dqz+rOgFO!6L_sm=D2PBX zg5lUA&Q3oH;xkGvBHQbYCc|j64^-IRF0iAh`a@okd9Hp~Z}JU;-ke8JhoVEZ+4blL zj`E1EMAKd$s8c}|+=rdOer`{N7w~hrtz4OQ@tOK!u~@*bCr_UI3qSw!{P{EdR_@uP zA6%zj5?YmKP!rFYaRGlpqM#Ub6eM(V5bU!V$BeX22Z?|Ll~%^r=e*h47M7QnmzV*_ zLHx!9dn-g&Yt-ic-rgaz8ZmZ}U=LO!Ol$Uyt5!O8iN72~l6vm3`$A-$2c;bB^35vk zXqnug-GYE0`Fw5@zaBq+{CE6({rdF=ev^CXN2O9J(=S&JDstaoN1~t@bSubV3SuOQ zmV)H_w9FLtEu;dpuh}fkHv_x7d)2kI^|cEZmY4L=KG5)|4r&JnY_%vTE!|t!=e#zW z&DwYMvJ=@4ZP;<7l73jdD-VQwjdNRDW$dy{rk!G`Sft%bxx9@ZUw!r0zu?!##`*?+ zD)+p`Z`M8Z12xevj_D`Bu3+{ZiGpHa(d>iOX}M$SVitpw-!MyXB2H3}!>+l4SO>w$ zZ@DJuL9Bv&*72OAbx!h|_6gqNT?%saD5*auxso(1CI8yz=ZLc?$kC%D&q=N%=WOyX z4u4+wAqsMws3d2;?}mNltsG^u6#GRmzxxO$|LXbw1n;9DN6)japm*dbTR-_a%Fl~KZ-_0w=#PVpVU53QJf zBnpbb$5c>1dfJLpPCvSo;`k_v=|`fVcjDZ+{{kvxraID#`U(I5002ovPDHLkV1ke6 Bu4(`P literal 0 HcmV?d00001 diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs new file mode 100644 index 0000000000..d30495e93c --- /dev/null +++ b/Items/BrimstoneLocus.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.Materials; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class BrimstoneLocus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Locus"); + Tooltip.SetDefault("Not only can I enhance your equipment with potent magic, I can also draw out the true strength and ascend\n" + + "some of your weaponry to entirely new forms\n" + + "Such items are revealed while this item is in your inventory"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = 0; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/BrimstoneLocus.png b/Items/BrimstoneLocus.png new file mode 100644 index 0000000000000000000000000000000000000000..fae3b786552cd8d03b5413f9b8d64b7a8511d72e GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX3?zBp#Z3TGjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCf`V@Ck7R(qeqdwi>p+mTnpn28m*p|0fnd_V-_F;s%sDbIvLUNO6?}`33)n z0ftRybj|}sISV`@iy0XB4ude`@%$AjK*1VM7sn6_|D_WS@-ZuNxNtjN{r~@=(K)qS z-p03U#ZTBY9lZYMP}l0%I~UX5`Ilt-f7ze^SVhmCz2xmZuJ0YT3$oTdFKY6+8uPAO z<6TxmzM@Yk@0oLp8&(wy9;|9zbgo8x@B33R7iV%99e=@U&6iOn60$qkl())) + return true; + + // Create particle positions as necessary. + EnchantmentEnergyParticles.Update(); + + // Draw all particles. + float currentPower = 0f; + int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); + if (calamitasNPCIndex != -1) + currentPower = Utils.InverseLerp(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); + + position += Vector2.One * 14f; + EnchantmentEnergyParticles.InterpolationSpeed = MathHelper.Lerp(0.035f, 0.1f, currentPower); + EnchantmentEnergyParticles.DrawSet(position + Main.screenPosition); + + float pulse = Main.GlobalTime * 0.79f % 1f; + float pulseFade = Utils.InverseLerp(0.87f, 0.27f, pulse, true); + float pulseScale = scale * MathHelper.Lerp(1.6f, 1f, pulseFade) / scale; + Color pulseColor = Color.Lerp(drawColor, Color.BlueViolet, pulseFade) * pulseFade; + drawItemManually(pulseColor, pulseScale); + drawItemManually(drawColor, 1f); + + return false; + } + #endregion + #region Reforging private int NewPrefixType(Item item) { diff --git a/Items/Weapons/Summon/Something.cs b/Items/Weapons/Summon/Something.cs new file mode 100644 index 0000000000..7accc71ebf --- /dev/null +++ b/Items/Weapons/Summon/Something.cs @@ -0,0 +1,50 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class Something : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Something"); + Tooltip.SetDefault("Summons either Cataclysm or Catastrophe at the mouse position\n" + + "They will look at you for a moment before charging at you\n" + + "They can do damage to both you and enemies"); + } + + public override void SetDefaults() + { + item.mana = 100; + item.damage = 16660; + item.useStyle = ItemUseStyleID.SwingThrow; + item.width = 58; + item.height = 64; + item.useTime = item.useAnimation = 30; + item.autoReuse = true; + item.noMelee = true; + item.knockBack = 0f; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.Violet; + item.UseSound = SoundID.DD2_BetsySummon; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + if (Main.rand.NextBool(2)) + type = ModContent.ProjectileType(); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/Something.png b/Items/Weapons/Summon/Something.png new file mode 100644 index 0000000000000000000000000000000000000000..96d3b0caf3147fdefbac73e05553e25a2a1f232d GIT binary patch literal 477 zcmeAS@N?(olHy`uVBq!ia0vp^RzU2)!3-p8?o8PWq!^2X+?^QKos)S9s|5IjxB}__%uLa0YEQY=NsG&_F>%#aP-rnS`rqjO?_6Q1iVjdg*N2je zK#Hd%$S?Rm0x$^OKX(o&&RO6QSEamT;l20T?YzSZ0vg( z;LUxvM{KeOr_5$9SYwvT#)(Hm86OaZ5C4;A{ KpUXO@geCx`1k6$Z literal 0 HcmV?d00001 diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index a370b8fde1..161db7bccd 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Items; using CalamityMod.Projectiles.Magic; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; @@ -133,6 +134,12 @@ namespace CalamityMod.NPCs.TownNPCs CalamitasEnchantUI.NPCIndex = npc.whoAmI; CalamitasEnchantUI.CurrentlyViewing = true; + if (!Main.LocalPlayer.Calamity().GivenBrimstoneLocus) + { + DropHelper.DropItem(npc, ItemType()); + Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; + } + shop = false; } } diff --git a/Particles/EnchantedParticleSet.cs b/Particles/EnchantedParticleSet.cs new file mode 100644 index 0000000000..4feb625237 --- /dev/null +++ b/Particles/EnchantedParticleSet.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ChargingEnergyParticleSet : BaseParticleSet + { + public float InterpolationSpeed; + public float EdgeOffset; + public Color EdgeColor; + public Color CenterColor; + public override int ParticleLifetime => 50; + public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Particles/Light"); + public ChargingEnergyParticleSet(int setLifetime, int particleSpawnRate, Color edgeColor, Color centerColor, float interpolationSpeed, float edgeOffset) : + base(setLifetime, particleSpawnRate) + { + EdgeColor = edgeColor; + CenterColor = centerColor; + InterpolationSpeed = interpolationSpeed; + EdgeOffset = edgeOffset; + } + + public override void UpdateBehavior(Particle particle) + { + float distanceToCenter = particle.RelativeOffset.Length(); + particle.Scale = MathHelper.SmoothStep(0.05f, 0.125f, Utils.InverseLerp(EdgeOffset, 6f, distanceToCenter, true)); + particle.Scale *= Utils.InverseLerp(ParticleLifetime, ParticleLifetime - 10f, particle.Time, true); + + if (distanceToCenter > 4.5f) + particle.RelativeOffset = Vector2.Lerp(particle.RelativeOffset, Vector2.Zero, InterpolationSpeed); + } + + public override Color DetermineParticleColor(float lifetimeCompletion) + { + Color particleColor = Color.Lerp(EdgeColor, CenterColor, Utils.InverseLerp(0f, 0.67f, lifetimeCompletion, true)); + particleColor.A = 50; + + return particleColor; + } + + public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2CircularEdge(1f, 1f) * EdgeOffset, 0.1f); + } +} \ No newline at end of file diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 3958b3a93c..5634fdf373 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee public ref float Time => ref projectile.localAI[1]; public float AttackCompletionRatio => 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; public Player Owner => Main.player[projectile.owner]; - public int Variant => projectile.identity % 2; + public int Variant => (int)projectile.ai[0] % 2; public const float ForearmLength = 80f; public const float ArmLength = 108f; @@ -117,11 +117,12 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { CalamityPlayerMiscEffects.EnchantHeldItemEffects(Owner, Owner.Calamity(), Owner.ActiveItem()); - if (!Owner.Calamity().bladeArmEnchant) + if (!Owner.Calamity().bladeArmEnchant || Owner.CCed || !Owner.active || Owner.dead) { projectile.Kill(); return; } + float swingOffsetAngle = MathHelper.SmoothStep(-1.87f, 3.79f, AttackCompletionRatio); // Offset a little bit angularly if the secondary variant to prevent complete overlap. @@ -174,6 +175,9 @@ namespace CalamityMod.Projectiles.Melee if (projectile.Center != destination) projectile.Center += (destination - projectile.Center).SafeNormalize(Vector2.Zero) * MathHelper.Min(projectile.Distance(destination), 12f + Owner.velocity.Length()); + // Ensure that the position is never too far from the destination. + CalamityUtils.DistanceClamp(ref projectile.position, ref destination, 50f); + Time++; } diff --git a/Projectiles/Summon/CataclysmSummon.cs b/Projectiles/Summon/CataclysmSummon.cs new file mode 100644 index 0000000000..36beeecad4 --- /dev/null +++ b/Projectiles/Summon/CataclysmSummon.cs @@ -0,0 +1,115 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class CataclysmSummon : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public bool LookingAtPlayer => Time < 45f; + public override string Texture => "CalamityMod/NPCs/SupremeCalamitas/SupremeCataclysm"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cataclysm"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = false; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = false; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 100; + projectile.netImportant = true; + projectile.friendly = true; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 90000; + projectile.penetrate = -1; + projectile.Opacity = 0f; + projectile.tileCollide = false; + projectile.minion = true; + } + + public override void AI() => Behavior(projectile, Main.player[projectile.owner], ref Time); + + public static void Behavior(Projectile projectile, Player owner, ref float time) + { + DoFrameEffects(projectile); + + if (time < 40f) + FadeIn(projectile); + + else if (time > 95f) + { + projectile.Opacity -= 0.06f; + if (projectile.Opacity < 0f) + projectile.Kill(); + } + + if (time < 25f) + { + float idealRotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2; + projectile.rotation = projectile.rotation.AngleLerp(idealRotation, 0.08f); + projectile.rotation = projectile.rotation.AngleTowards(idealRotation, 0.2f); + } + else if (time < 40f) + { + projectile.rotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2; + projectile.velocity = projectile.SafeDirectionTo(owner.Center) * -5f; + } + else if (time == 40f) + { + projectile.rotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2; + projectile.velocity = projectile.SafeDirectionTo(owner.Center) * 31f; + projectile.damage = (int)(projectile.damage * 1.45); + + Main.PlaySound(SoundID.DD2_BetsyFlameBreath, owner.Center); + Main.PlaySound(SoundID.DD2_WyvernDiveDown, owner.Center); + } + + time++; + } + + public static void FadeIn(Projectile projectile) + { + if (projectile.localAI[0] == 0f) + { + for (int i = 0; i < 40; i++) + { + Dust brimstone = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Square(-65f, 65f), 267); + brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.8f, 3.6f); + brimstone.scale = Main.rand.NextFloat(1.65f, 1.85f); + brimstone.fadeIn = Main.rand.NextFloat(0.7f, 0.9f); + brimstone.color = Color.Red; + brimstone.noGravity = true; + } + projectile.localAI[0] = 1f; + } + + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.075f, 0f, 1f); + } + + public static void DoFrameEffects(Projectile projectile) + { + projectile.frameCounter++; + if (projectile.frameCounter % 5f == 4f) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.Red, 1); + return true; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; + + public override bool CanDamage() => projectile.Opacity >= 1f; + } +} diff --git a/Projectiles/Summon/CatastropheSummon.cs b/Projectiles/Summon/CatastropheSummon.cs new file mode 100644 index 0000000000..d60bdafa56 --- /dev/null +++ b/Projectiles/Summon/CatastropheSummon.cs @@ -0,0 +1,51 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class CatastropheSummon : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public bool LookingAtPlayer => Time < 45f; + public override string Texture => "CalamityMod/NPCs/SupremeCalamitas/SupremeCatastrophe"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Catastrophe"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.MinionSacrificable[projectile.type] = false; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = false; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 120; + projectile.netImportant = true; + projectile.friendly = true; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 90000; + projectile.penetrate = -1; + projectile.Opacity = 0f; + projectile.tileCollide = false; + projectile.minion = true; + } + + public override void AI() => CataclysmSummon.Behavior(projectile, Main.player[projectile.owner], ref Time); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.Red, 1); + return true; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; + + public override bool CanDamage() => projectile.Opacity >= 1f; + } +} diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 47f77b4606..2be7d5e39d 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -162,6 +162,11 @@ namespace CalamityMod.UI.CalamitasEnchants return 0; int cost = CurrentlyHeldItem.value * 4; + + // Increase the cost of enchanting significantly if doing so would upgrade the item directly. + if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == "Curse") + cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; + ItemSlot.DrawMoney(spriteBatch, "Cost: ", costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y, Utils.CoinsSplit(cost)); return cost; @@ -234,6 +239,9 @@ namespace CalamityMod.UI.CalamitasEnchants itemScale *= inventoryScale * baseScale; drawPosition += Vector2.One * 23f * baseScale; + if (EnchantmentManager.ItemUpgradeRelationship.ContainsKey(CurrentlyHeldItem.type)) + drawPosition -= Vector2.One * 12f; + // Draw the item. if (hasMultipleFrames || ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) { @@ -326,22 +334,30 @@ namespace CalamityMod.UI.CalamitasEnchants if (CurrentlyHeldItem.IsAir) return; - // If there is no cost or the player cannot afford it, do nothing. - if (cost <= 0L || !Main.LocalPlayer.CanBuyItem(cost)) - return; - // If no enchantment has been selected, do nothing. if (!SelectedEnchantment.HasValue) return; + // If there is no cost or the player cannot afford it, do nothing. + if (cost <= 0 || !Main.LocalPlayer.CanBuyItem(cost)) + return; + Item originalItem = CurrentlyHeldItem.Clone(); byte oldPrefix = CurrentlyHeldItem.prefix; CurrentlyHeldItem.SetDefaults(CurrentlyHeldItem.type); CurrentlyHeldItem.Prefix(oldPrefix); CurrentlyHeldItem = CurrentlyHeldItem.CloneWithModdedDataFrom(originalItem); - CurrentlyHeldItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; - SelectedEnchantment.Value.CreationEffect?.Invoke(CurrentlyHeldItem); + if (SelectedEnchantment.Value.Name == "Curse") + { + CurrentlyHeldItem.SetDefaults(EnchantmentManager.ItemUpgradeRelationship[CurrentlyHeldItem.type]); + CurrentlyHeldItem.Prefix(oldPrefix); + } + else + { + CurrentlyHeldItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; + SelectedEnchantment.Value.CreationEffect?.Invoke(CurrentlyHeldItem); + } // Update the compare item. This is used check comparisons when showing reforge tooltip bonuses. // Updating it with the same bonuses as what was applied to the real item will negate the incorrect numbers, @@ -349,8 +365,12 @@ namespace CalamityMod.UI.CalamitasEnchants if (Main.cpItem is null) Main.cpItem = new Item(); Main.cpItem.SetDefaults(Main.cpItem.type); - Main.cpItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; - SelectedEnchantment.Value.CreationEffect?.Invoke(Main.cpItem); + + if (SelectedEnchantment.Value.Name != "Curse") + { + Main.cpItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; + SelectedEnchantment.Value.CreationEffect?.Invoke(Main.cpItem); + } // Take away the money for the cost. Main.LocalPlayer.BuyItem(cost); @@ -359,6 +379,9 @@ namespace CalamityMod.UI.CalamitasEnchants EnchantIndex = 0; Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); + + if (SelectedEnchantment.Value.Name == "Curse") + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Main.LocalPlayer.Center); } } } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 73fd142398..f86efb6f3e 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using System; @@ -13,6 +14,7 @@ namespace CalamityMod.UI.CalamitasEnchants { internal const int ClearEnchantmentID = -18591774; public static List EnchantmentList { get; internal set; } = new List(); + public static Dictionary ItemUpgradeRelationship { get; internal set; } = new Dictionary(); public static Enchantment ClearEnchantment { get; internal set; } public static IEnumerable GetValidEnchantmentsForItem(Item item) { @@ -20,6 +22,10 @@ namespace CalamityMod.UI.CalamitasEnchants if (item is null || item.IsAir || !item.CanBeEnchantedBySomething()) yield break; + // Don't allow any enchantments if the item is an upgrade item. + if (ItemUpgradeRelationship.ContainsValue(item.type)) + yield break; + // Only give the option to clear if the item already has an enchantment. if (item.Calamity().AppliedEnchantment.HasValue) { @@ -127,6 +133,12 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantmentList = new List { + new Enchantment("Curse", "Transforms this item into something significantly better.", + 1, + null, + null, + item => ItemUpgradeRelationship.ContainsKey(item.type)), + new Enchantment("Cursed", "Summons demons that harm you but drop healing items on death on item usage.", 100, null, @@ -194,11 +206,11 @@ namespace CalamityMod.UI.CalamitasEnchants { // Yes, this is a LOT of damage but given the limited range of this thing it needs to be extremely powerful when it does actually hit. int damage = (int)(player.ActiveItem().damage * player.MeleeDamage() * 5); - int blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1, player.ActiveItem().type); + int blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, player.ActiveItem().type); if (Main.projectile.IndexInRange(blade)) Main.projectile[blade].localAI[0] = 0f; - blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, -1, player.ActiveItem().type); + blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, player.ActiveItem().type); if (Main.projectile.IndexInRange(blade)) Main.projectile[blade].localAI[0] = -80f; } @@ -216,8 +228,17 @@ namespace CalamityMod.UI.CalamitasEnchants ClearEnchantment = new Enchantment("Disenchant", string.Empty, ClearEnchantmentID, item => item.Calamity().AppliedEnchantment = null, item => item.maxStack == 1 && item.shoot >= ProjectileID.None); + + ItemUpgradeRelationship = new Dictionary() + { + [ModContent.ItemType()] = ModContent.ItemType() + }; } - public static void UnloadAllEnchantments() => EnchantmentList = null; + public static void UnloadAllEnchantments() + { + EnchantmentList = null; + ItemUpgradeRelationship = null; + } } } From 48645809e2a307274f4e7bfd832ac2aea8283609 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Thu, 20 May 2021 19:08:16 -0500 Subject: [PATCH 30/73] Particle fixes --- CalPlayer/CalamityPlayerMiscEffects.cs | 5 +++++ Items/CalamityGlobalItem.cs | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index a809f3e11f..19127d619a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -112,6 +112,11 @@ namespace CalamityMod.CalPlayer // Potions (Quick Buff && Potion Sickness) HandlePotions(player, modPlayer); + // Update all particle sets for items. + // This must be done here instead of in the item logic because these sets are not properly instanced + // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. + CalamityGlobalItem.UpdateAllParticleSets(); + // Regularly sync player stats during multiplayer if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 13a0015304..a7904cc87d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -87,7 +87,6 @@ namespace CalamityMod.Items public CalamityGlobalItem() { StealthGenBonus = 1f; - EnchantmentEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.DarkViolet, Color.White, 0.04f, 24f); } public override GlobalItem Clone(Item item, Item itemClone) @@ -1692,14 +1691,19 @@ namespace CalamityMod.Items #endregion #region Inventory Drawing - internal ChargingEnergyParticleSet EnchantmentEnergyParticles; + internal static ChargingEnergyParticleSet EnchantmentEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.DarkViolet, Color.White, 0.04f, 24f); + + internal static void UpdateAllParticleSets() + { + EnchantmentEnergyParticles.Update(); + } public override bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { void drawItemManually(Color color, float generalScale) { Texture2D itemTexture = Main.itemTexture[item.type]; - Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame(1, 1, 0, 0) : Main.itemAnimations[item.type].GetFrame(itemTexture); + Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture); Vector2 itemOrigin = itemFrame.Size() * 0.5f; spriteBatch.Draw(itemTexture, position, itemFrame, color, 0f, itemOrigin, scale * generalScale, SpriteEffects.None, 0f); } @@ -1707,9 +1711,6 @@ namespace CalamityMod.Items if (!EnchantmentManager.ItemUpgradeRelationship.ContainsKey(item.type) || !Main.LocalPlayer.InventoryHas(ModContent.ItemType())) return true; - // Create particle positions as necessary. - EnchantmentEnergyParticles.Update(); - // Draw all particles. float currentPower = 0f; int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); From b700d75c11bf2fa4730905d1cae1b09c7042b148 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 26 May 2021 13:46:26 -0500 Subject: [PATCH 31/73] Exhume upgrade enchant name --- UI/CalamitasEnchantments/CalamitasEnchantUI.cs | 8 ++++---- UI/CalamitasEnchantments/EnchantmentManager.cs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 2be7d5e39d..b3570e3ad6 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -164,7 +164,7 @@ namespace CalamityMod.UI.CalamitasEnchants int cost = CurrentlyHeldItem.value * 4; // Increase the cost of enchanting significantly if doing so would upgrade the item directly. - if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == "Curse") + if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; ItemSlot.DrawMoney(spriteBatch, "Cost: ", costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y, Utils.CoinsSplit(cost)); @@ -348,7 +348,7 @@ namespace CalamityMod.UI.CalamitasEnchants CurrentlyHeldItem.Prefix(oldPrefix); CurrentlyHeldItem = CurrentlyHeldItem.CloneWithModdedDataFrom(originalItem); - if (SelectedEnchantment.Value.Name == "Curse") + if (SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) { CurrentlyHeldItem.SetDefaults(EnchantmentManager.ItemUpgradeRelationship[CurrentlyHeldItem.type]); CurrentlyHeldItem.Prefix(oldPrefix); @@ -366,7 +366,7 @@ namespace CalamityMod.UI.CalamitasEnchants Main.cpItem = new Item(); Main.cpItem.SetDefaults(Main.cpItem.type); - if (SelectedEnchantment.Value.Name != "Curse") + if (SelectedEnchantment.Value.Name != EnchantmentManager.UpgradeEnchantName) { Main.cpItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; SelectedEnchantment.Value.CreationEffect?.Invoke(Main.cpItem); @@ -380,7 +380,7 @@ namespace CalamityMod.UI.CalamitasEnchants Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); - if (SelectedEnchantment.Value.Name == "Curse") + if (SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Main.LocalPlayer.Center); } } diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index f86efb6f3e..893b3f232b 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -13,6 +13,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static class EnchantmentManager { internal const int ClearEnchantmentID = -18591774; + internal const string UpgradeEnchantName = "Exhume"; public static List EnchantmentList { get; internal set; } = new List(); public static Dictionary ItemUpgradeRelationship { get; internal set; } = new Dictionary(); public static Enchantment ClearEnchantment { get; internal set; } @@ -133,7 +134,7 @@ namespace CalamityMod.UI.CalamitasEnchants { EnchantmentList = new List { - new Enchantment("Curse", "Transforms this item into something significantly better.", + new Enchantment(UpgradeEnchantName, "Transforms this item into something significantly better.", 1, null, null, From 9d95c596bb4a063a279a90e4dd8721ea6d5ce524 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 26 May 2021 13:47:35 -0500 Subject: [PATCH 32/73] Enchanted item rarity effect --- Items/CalamityGlobalItem.cs | 3 -- Items/CalamityGlobalItemTooltip.cs | 35 +++++++++++++++++++ .../EnchantmentManager.cs | 4 +-- Utilities/ItemUtils.cs | 22 ++++++++++++ 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a7904cc87d..4a8751cb07 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -4,7 +4,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions; -using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.SupremeCalamitas; @@ -22,13 +21,11 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; -using System.Collections.Generic; using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.UI; namespace CalamityMod.Items { diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index ba2fb23903..b888524432 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Linq; @@ -17,6 +18,7 @@ using System.Text; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.UI.Chat; namespace CalamityMod.Items { @@ -964,6 +966,39 @@ namespace CalamityMod.Items } #endregion + #region Enchanted Rarity Text Drawing + public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) + { + // Special enchantment line color. + if (line.Name == "ItemName" && line.mod == "Terraria" && item.IsEnchanted()) + { + Color rarityColor = line.color; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float backInterpolant = (float)Math.Pow(Main.GlobalTime * 0.81f % 1f, 1.5f); + Vector2 backScale = line.baseScale * MathHelper.Lerp(1f, 1.2f, backInterpolant); + Color backColor = Color.Lerp(rarityColor, Color.DarkRed, backInterpolant) * (float)Math.Pow(1f - backInterpolant, 0.46f); + Vector2 backPosition = basePosition - new Vector2(1f, 0.1f) * backInterpolant * 10f; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); + + // Draw the back text as an ominous pulse. + for (int i = 0; i < 2; i++) + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.font, line.text, backPosition, backColor, line.rotation, line.origin, backScale, line.maxWidth, line.spread); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.font, line.text, basePosition, rarityColor, line.rotation, line.origin, line.baseScale, line.maxWidth, line.spread); + + return false; + } + return true; + } + #endregion + #region Fargo Biome Fountain Tooltip private void FargoFountainTooltip(Item item, IList tooltips) { diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 893b3f232b..714ed29ee6 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -130,7 +130,7 @@ namespace CalamityMod.UI.CalamitasEnchants EnchantmentList.Add(new Enchantment(name, description, id, creationEffect, holdEffect, requirement)); } - public static void LoadAllEnchantments() + internal static void LoadAllEnchantments() { EnchantmentList = new List { @@ -236,7 +236,7 @@ namespace CalamityMod.UI.CalamitasEnchants }; } - public static void UnloadAllEnchantments() + internal static void UnloadAllEnchantments() { EnchantmentList = null; ItemUpgradeRelationship = null; diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 7cee8821f8..ad29b36b7f 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -198,6 +198,28 @@ namespace CalamityMod return moved; } + /// + /// Determines if a given item is enchanted based on Calamitas' special system. + /// + /// The item to check. + public static bool IsEnchanted(this Item item) + { + // If the item is air just immediately return false. + // It will not have a CalamityGlobalItem instance to use and attempting to do anything with it + // would just result in errors. + if (item.IsAir) + return false; + + // If the item is contained in the enchant upgrade result relationship, return true. + if (EnchantmentManager.ItemUpgradeRelationship.ContainsValue(item.type)) + return true; + + if (item.Calamity().AppliedEnchantment.HasValue) + return true; + + return false; + } + public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) { Player player = Main.player[Main.myPlayer]; From 7ab93103f4370bbb01bf8b95847bf827ee59a14b Mon Sep 17 00:00:00 2001 From: Dominic Date: Thu, 27 May 2021 19:52:25 -0500 Subject: [PATCH 33/73] Renamed the vigil upgrade to Exhumed Vigilance --- Items/CalamityGlobalItemTooltip.cs | 2 +- .../Summon/{Something.cs => ExhumedVigilance.cs} | 4 ++-- .../Summon/{Something.png => ExhumedVigilance.png} | Bin UI/CalamitasEnchantments/EnchantmentManager.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename Items/Weapons/Summon/{Something.cs => ExhumedVigilance.cs} (94%) rename Items/Weapons/Summon/{Something.png => ExhumedVigilance.png} (100%) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index b888524432..eefdbc317a 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -972,7 +972,7 @@ namespace CalamityMod.Items // Special enchantment line color. if (line.Name == "ItemName" && line.mod == "Terraria" && item.IsEnchanted()) { - Color rarityColor = line.color; + Color rarityColor = line.overrideColor ?? line.color; Vector2 basePosition = new Vector2(line.X, line.Y); float backInterpolant = (float)Math.Pow(Main.GlobalTime * 0.81f % 1f, 1.5f); diff --git a/Items/Weapons/Summon/Something.cs b/Items/Weapons/Summon/ExhumedVigilance.cs similarity index 94% rename from Items/Weapons/Summon/Something.cs rename to Items/Weapons/Summon/ExhumedVigilance.cs index 7accc71ebf..107d5e99a8 100644 --- a/Items/Weapons/Summon/Something.cs +++ b/Items/Weapons/Summon/ExhumedVigilance.cs @@ -6,11 +6,11 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class Something : ModItem + public class ExhumedVigilance : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Something"); + DisplayName.SetDefault("Exhumed Vigilance"); Tooltip.SetDefault("Summons either Cataclysm or Catastrophe at the mouse position\n" + "They will look at you for a moment before charging at you\n" + "They can do damage to both you and enemies"); diff --git a/Items/Weapons/Summon/Something.png b/Items/Weapons/Summon/ExhumedVigilance.png similarity index 100% rename from Items/Weapons/Summon/Something.png rename to Items/Weapons/Summon/ExhumedVigilance.png diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 714ed29ee6..06f8eb821a 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -232,7 +232,7 @@ namespace CalamityMod.UI.CalamitasEnchants ItemUpgradeRelationship = new Dictionary() { - [ModContent.ItemType()] = ModContent.ItemType() + [ModContent.ItemType()] = ModContent.ItemType() }; } From 3b8691c6a2e1a784d4bd13c733444064cb5eb121 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 31 May 2021 14:41:53 -0500 Subject: [PATCH 34/73] Tainted blade enchant bug fix --- Projectiles/Melee/TaintedBladeSlasher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 5634fdf373..45f392914a 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { CalamityPlayerMiscEffects.EnchantHeldItemEffects(Owner, Owner.Calamity(), Owner.ActiveItem()); - if (!Owner.Calamity().bladeArmEnchant || Owner.CCed || !Owner.active || Owner.dead) + if (!Owner.Calamity().bladeArmEnchant || Owner.ActiveItem().type != SwordItemID || Owner.CCed || !Owner.active || Owner.dead) { projectile.Kill(); return; From d9b016fb05dc7b73f61e0238578cdc322ba5adc9 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 4 Jun 2021 22:14:15 -0500 Subject: [PATCH 35/73] Interactions with BR/The new fight --- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 195 ++++++++++++++-------- 1 file changed, 129 insertions(+), 66 deletions(-) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index a34f9404cc..1729faee74 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -12,6 +12,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -203,7 +204,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void BossHeadSlot(ref int index) { bool inPhase2 = npc.ai[0] == 3f; - if (!CalamityWorld.downedSCal) + if (!CalamityWorld.downedSCal || BossRushEvent.BossRushActive) index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; else index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; @@ -375,10 +376,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startText) { - string key = "Mods.CalamityMod.SCalSummonText"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalSummonText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } startText = true; } #endregion @@ -562,7 +566,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, npc.Opacity, true); if (npc.alpha >= 230) { - // TODO: Spawn the town NPC variant of SCal here when it's on the public branch. + if (Main.netMode != NetmodeID.MultiplayerClient && !BossRushEvent.BossRushActive && CalamityWorld.downedSCal) + { + Dust.QuickDustLine(npc.Center, initialRitualPosition, 350f, Color.Red); + NPC.NewNPC((int)initialRitualPosition.X, (int)initialRitualPosition.Y + 12, ModContent.NPCType()); + } npc.active = false; npc.netUpdate = true; } @@ -749,10 +757,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (!startSecondAttack && (npc.life <= npc.lifeMax * 0.75)) { - string key = "Mods.CalamityMod.SCalBH2Text"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalBH2Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } startSecondAttack = true; return; } @@ -809,12 +820,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas { // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. music = CalamityMod.Instance.GetMusicFromMusicMod("SCL") ?? MusicID.Boss3; - string key = "Mods.CalamityMod.SCalBH3Text"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); - if (CalamityWorld.downedSCal) - CalamityUtils.DisplayLocalizedText(key + "2", textColor); + + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalBH3Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + if (CalamityWorld.downedSCal) + CalamityUtils.DisplayLocalizedText(key + "2", textColor); + } startThirdAttack = true; return; } @@ -880,10 +895,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { // Switch from the Lament section of Stained, Brutal Calamity to the Epiphany section. music = CalamityMod.Instance.GetMusicFromMusicMod("SCE") ?? MusicID.LunarBoss; - string key = "Mods.CalamityMod.SCalBH4Text"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalBH4Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } startFourthAttack = true; return; } @@ -947,10 +966,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (!startFifthAttack && (npc.life <= npc.lifeMax * 0.1)) { - string key = "Mods.CalamityMod.SCalBH5Text"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalBH5Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } startFifthAttack = true; return; } @@ -972,9 +994,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity.X *= 0.96f; - if (CalamityWorld.downedSCal) + if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) { - // TODO: Spawn the town NPC variant of SCal again here. if (giveUpCounter == 720) { for (int i = 0; i < 24; i++) @@ -992,14 +1013,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPCLoot(); } } - else if (giveUpCounter == 900) + else if (giveUpCounter == 900 && !BossRushEvent.BossRushActive) CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText1", textColor); - else if(giveUpCounter == 600) + else if (giveUpCounter == 600 && !BossRushEvent.BossRushActive) CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText2", textColor); - else if(giveUpCounter == 300) + else if (giveUpCounter == 300 && !BossRushEvent.BossRushActive) CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText3", textColor); if (giveUpCounter <= 0) { + if (BossRushEvent.BossRushActive) + { + npc.chaseable = true; + npc.dontTakeDamage = false; + return; + } + for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Fire); @@ -1016,6 +1044,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas return; } giveUpCounter--; + npc.chaseable = false; npc.dontTakeDamage = true; return; @@ -1032,37 +1061,49 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - string key = "Mods.CalamityMod.SCalDesparationText4"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalDesparationText4"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } gettingTired5 = true; return; } else if (!gettingTired4 && (npc.life <= npc.lifeMax * 0.02)) { - string key = "Mods.CalamityMod.SCalDesparationText3"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalDesparationText3"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } gettingTired4 = true; return; } else if (!gettingTired3 && (npc.life <= npc.lifeMax * 0.04)) { - string key = "Mods.CalamityMod.SCalDesparationText2"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalDesparationText2"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } gettingTired3 = true; return; } else if (!gettingTired2 && (npc.life <= npc.lifeMax * 0.06)) { - string key = "Mods.CalamityMod.SCalDesparationText1"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalDesparationText1"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } gettingTired2 = true; return; } @@ -1125,10 +1166,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region TransformSeekerandBrotherTriggers if (!halfLife && (npc.life <= npc.lifeMax * 0.4)) { - string key = "Mods.CalamityMod.SCalPhase2Text"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalPhase2Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } halfLife = true; } @@ -1137,10 +1181,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (!secondStage) { - string key = "Mods.CalamityMod.SCalSeekerRingText"; - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalSeekerRingText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(SoundID.Item74, npc.position); @@ -2460,13 +2507,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (attackCastDelay == 0) { - string key = "Mods.CalamityMod.SCalStartText"; - if (npc.life <= npc.lifeMax * 0.08) - key = "Mods.CalamityMod.SCalSepulcher2Text"; + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalStartText"; + if (npc.life <= npc.lifeMax * 0.08) + key = "Mods.CalamityMod.SCalSepulcher2Text"; + + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } - if (CalamityWorld.downedSCal) - key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, textColor); foreach (Vector2 heartSpawnPosition in heartSpawnPositions) { // Make the hearts appear in a burst of flame. @@ -2578,13 +2629,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas // And spawn them. if (attackCastDelay == 0) { - string key = "Mods.CalamityMod.SCalBrothersText"; - if (CalamityWorld.downedSCal) - key += "Rematch"; + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalBrothersText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + + CalamityUtils.DisplayLocalizedText(key, textColor); + if (CalamityWorld.downedSCal) + CalamityUtils.DisplayLocalizedText(key + "2", textColor); + } - CalamityUtils.DisplayLocalizedText(key, textColor); - if (CalamityWorld.downedSCal) - CalamityUtils.DisplayLocalizedText(key + "2", textColor); if (Main.netMode != NetmodeID.MultiplayerClient) { CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, ModContent.NPCType()); @@ -2666,10 +2721,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void NPCLoot() { + if (BossRushEvent.BossRushActive) + return; + // Create a teleport line effect Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); npc.Center = initialRitualPosition; + // Make the town NPC spawn. + NPC.NewNPC((int)initialRitualPosition.X, (int)initialRitualPosition.Y + 12, ModContent.NPCType()); + // Increase the player's SCal kill count if (Main.player[npc.target].Calamity().sCalKillCount < 5) Main.player[npc.target].Calamity().sCalKillCount++; @@ -2730,6 +2791,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Prevent the player from accidentally killing SCal instead of having her turn into a town NPC. public override bool CheckDead() { + if (BossRushEvent.BossRushActive) + return true; npc.life = 1; npc.active = true; npc.dontTakeDamage = true; @@ -2798,7 +2861,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = CalamityWorld.downedSCal ? Main.npcTexture[npc.type] : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); + Texture2D texture2D15 = CalamityWorld.downedSCal && !BossRushEvent.BossRushActive ? Main.npcTexture[npc.type] : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); Vector2 vector11 = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type] / 2f); Color color36 = Color.White; From 494d10e89f77cb98984fc296892476235d37d650 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 6 Jun 2021 14:02:03 -0500 Subject: [PATCH 36/73] Cal NPC resprite --- NPCs/TownNPCs/WITCH.cs | 9 ++++----- NPCs/TownNPCs/WITCH.png | Bin 4396 -> 5010 bytes NPCs/TownNPCs/WITCH_Head.png | Bin 342 -> 448 bytes 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 161db7bccd..c536d20ba6 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -21,14 +21,13 @@ namespace CalamityMod.NPCs.TownNPCs { DisplayName.SetDefault("Brimstone Witch"); - Main.npcFrameCount[npc.type] = 26; + Main.npcFrameCount[npc.type] = 27; NPCID.Sets.ExtraFramesCount[npc.type] = 9; NPCID.Sets.AttackFrameCount[npc.type] = 4; NPCID.Sets.DangerDetectRange[npc.type] = 700; - NPCID.Sets.AttackType[npc.type] = 2; - NPCID.Sets.AttackTime[npc.type] = 90; - NPCID.Sets.AttackAverageChance[npc.type] = 15; - NPCID.Sets.MagicAuraColor[npc.type] = new Color(250, 50, 50); + NPCID.Sets.AttackType[npc.type] = 1; + NPCID.Sets.AttackTime[npc.type] = 30; + NPCID.Sets.AttackAverageChance[npc.type] = 5; } public override void SetDefaults() diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/WITCH.png index b6d9064a49be7651124bf7c5cd93b16cfdfecaaa..7c02e35630acb55640041e8e134719e5da2fe077 100644 GIT binary patch literal 5010 zcmeHLiBl7I`wt*NgArf33JS4kFyR!+p(p`_2w4upk|0MRf?~rVPze?h40u3G&`4N< zpke}vlE^J;jbc!wNDvJHibW|XqKH_z6bumG#dh9lXWoC{H@|mhGQ0bo+1+QK&+|Dp zKam5x(I{gS0)ar2e7rz-Z-GD{o0n_AN9JoBZooUW6wrGIqUO=MH}J`_?>ziH5QuuV z_Ck~<0-=E*`%#GS`bNacjk@~In@qP`uC>8pz0kV8TDl=P9N7s+N28;O_TQ0lf!q*v491-T=b`$9Q~9i`Rf2~tP4C~mg75af?SCEkKh%MyJ#P15 zo*)=tK+xy^-y0%mRtpP5w<6gmGzEcJb#LjXrjG-%5C|O|l9vZ1E%M!kQ{dWdYjzfA zwYb>X6~{k$Hp`TcpZ_FKq#f<8w$t`yQqS@TH3bdX-Z7HQo0%Q_yin0Wv#G5uwmIgC+dMRKaBNDcTzJS!yZv^@0PCRW_3J+P8a6va zt88UQ7GXObp;t0jY$%yj0$N^afk@untf}q}UrXiG)P#G%>FtC_8zufY0ctN#9vqo0 z=$L}k(*uWY-5Q=$snYh*7a&yTZQR7-w#gAefsG8?MgTy=uYL`(DZQlD z#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4LAZasJorl+@efoYn#7{lO$C(nWL-RsxD`2FkGUbDI$)j7uJ- z1*Q(&2u7M4Jf*D+#nPOrE)@Re?TfH^jKSA44lIuDa=43WW-!b}%O}mo>M|=^OR)H{ z!^gpNWL_$mhN)k+{VS8j4-B|!8ygv zV9PaCRIr9MOc0k(aJrc421j|?f*rGL!yYgl9_9t6SFYNI)#XtEE?{x=u*PsP-3<=E z{s`5ZX!^Jc=7~KM_0gWY0(bb^@II<)x%*izv a0HgKey$=1(0{{R307*qoM6N<$f&c)SYm*`X From 2d6e01c3f72b6192bdd240b6038c555c732f85f7 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 11 Jun 2021 14:14:22 -0500 Subject: [PATCH 37/73] Merge conflict handling --- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 440c0feb0a..1afb51394b 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -13,6 +13,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -567,7 +568,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas forcefieldOpacity = Utils.InverseLerp(0.1f, 0.6f, npc.Opacity, true); if (npc.alpha >= 230) { - // TODO: Spawn the town NPC variant of SCal here when it's on the public branch. + if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) + { + // Create a teleport line effect + Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); + npc.Center = initialRitualPosition; + + // Make the town NPC spawn. + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + } + npc.active = false; npc.netUpdate = true; } @@ -994,7 +1005,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) { - // TODO: Spawn the town NPC variant of SCal again here. if (giveUpCounter == 720) { for (int i = 0; i < 24; i++) @@ -2722,6 +2732,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); npc.Center = initialRitualPosition; + // Make the town NPC spawn. + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + // Increase the player's SCal kill count if (Main.player[npc.target].Calamity().sCalKillCount < 5) Main.player[npc.target].Calamity().sCalKillCount++; From 6ac52dc3cd5aab15a238c9a4a5cb165574b75d2d Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 12 Jun 2021 16:31:39 -0500 Subject: [PATCH 38/73] Damned Curse rename and improvements --- Projectiles/CalamityGlobalProjectile.cs | 11 ++- .../Summon/SummonBrimstoneExplosionSmall.cs | 64 ++++++++++++++++++ .../Summon/SummonBrimstoneExplosionSmall.png | Bin 0 -> 965 bytes .../EnchantmentManager.cs | 4 +- 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 Projectiles/Summon/SummonBrimstoneExplosionSmall.cs create mode 100644 Projectiles/Summon/SummonBrimstoneExplosionSmall.png diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 86c10b88cf..3b341686aa 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles // Enchantment variables. public int ExplosiveEnchantCountdown = 0; - public const int ExplosiveEnchantTime = 600; + public const int ExplosiveEnchantTime = 2400; #region SetDefaults public override void SetDefaults(Projectile projectile) @@ -228,6 +228,9 @@ namespace CalamityMod.Projectiles if (projectile.minion && ExplosiveEnchantCountdown > 0) { ExplosiveEnchantCountdown--; + if (defDamage == 0) + defDamage = projectile.damage; + projectile.damage = (int)(defDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime)); // Make fizzle sounds and fire dust to indicate the impending explosion. if (ExplosiveEnchantCountdown <= 300) @@ -242,6 +245,12 @@ namespace CalamityMod.Projectiles fire.noGravity = true; } + if (ExplosiveEnchantCountdown % 40 == 39 && Main.rand.NextBool(12)) + { + int damage = (int)(Main.player[projectile.owner].MinionDamage() * 2000); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); + } + if (ExplosiveEnchantCountdown <= 0) { Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center); diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs new file mode 100644 index 0000000000..24b4b6de0e --- /dev/null +++ b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs @@ -0,0 +1,64 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SummonBrimstoneExplosionSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 108; + projectile.friendly = true; + projectile.hostile = false; + projectile.minion = true; + projectile.penetrate = -1; + projectile.timeLeft = Main.projFrames[projectile.type] * 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + CreateInitialDust(); + projectile.localAI[0] = 1f; + } + + // Emit crimson light. + Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 1.1f); + if (projectile.timeLeft % 5f == 4f) + projectile.frame++; + } + + public void CreateInitialDust() + { + float randomnessSmoothness = 3f; + for (int i = 0; i < 6; i++) + { + randomnessSmoothness += i * 0.36f; + + for (int j = 0; j < 30; j++) + { + Vector2 velocity = Main.rand.NextVector2Square(-randomnessSmoothness, randomnessSmoothness).SafeNormalize(Vector2.UnitY) * randomnessSmoothness * 0.48f; + Dust dust = Dust.NewDustDirect(projectile.position + Vector2.One * 22f, 1, 1, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.6f); + dust.position += Main.rand.NextVector2Square(-10f, 10f); + dust.velocity = velocity; + dust.noGravity = true; + } + } + + projectile.Damage(); + } + } +} diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.png b/Projectiles/Summon/SummonBrimstoneExplosionSmall.png new file mode 100644 index 0000000000000000000000000000000000000000..b53b2fea887d88be7c6d896d0ad4715d91c23470 GIT binary patch literal 965 zcmV;$13LVPP)Px#1ZP1_K>z@;j|==^1poj55>QN3MF0Q*|B-WH7CEgnM&nOU00013X~QP~000Jb zQchF<|NsC00JFcOzW@LL32;bRa{vGi!2kdb!2!6DYwZ9411d>GK~!i%?Usvjqc99b zmu>U^zr0*uDUux%(1p%qww#$3Jr2g^nLm#LpDZtn1p`;hkty=B!U*In$BN9Nmpy8w zG>9g93r!0QYpYQuuAH3 zCX|SrGjcEF7@Uvnhi~+1O+g@LT=_$#RMo%7g&_D$fa?BtZOo~WodTPV+R_z z=!zU|Y#qq>qw}0bQHJKSZyCjfQDk0%3}p;M11K_d5-PUVG^%p{NHJ=A3~F6=LJh2C zs4_9ju%dBBUKX!5cLB2)CT6$@>>MsL6hzse)Et z$u9#sRhgK%!W=4IVa$jw`-_&J2UM|3Yd19c@t}y$8x&6Gyo?r9&tek3U{IH_I0$I@ z;qiZ@E^``C+FmV=!$(w?F#!}EkI{>$F8e8C88G7zi0~gMGRtVY3^)vG%&RhPOuv0l z@~sc!7r!pE=u-jE`5<6x#g)43#NwK5umV&WD)0Y za9+kFEKKw#uP&oBo5Dz4cKU<9qRPDBmbA>mCsjGhxt(Q?YjS_9%=tOlsmZuCEuO-m zY#Jrme}W)!*dln`EG)~eM{z5z%OoEh3g9qS6lGk}abY0WblJj9H2DZu$n!~^m!Sen zpM0`hT3}J0qsX&^zEYQusk%HqL;y7lSL!n8%R$~@UzZ52U%DnA z;j?8waXsf{s6QuL*l}Lo;`hk&lhxNX`3Se1x#i3)XFf%akL^A+8K2#)7tBai-ew%+ nI=TO8a;@BR%bEXNemwpG|6JTXI#<=S00000NkvXXu0mjfmFu-D literal 0 HcmV?d00001 diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 06f8eb821a..377204cc07 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -180,9 +180,9 @@ namespace CalamityMod.UI.CalamitasEnchants player => player.Calamity().dischargingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), - new Enchantment("Damned", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. The explosion can hurt both you and enemies. Minions do more damage to compensate.", + new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. The explosion can hurt both you and enemies. Minions do more damage the longer they live and idly explode.", 700, - item => item.damage = (int)(item.damage * 1.5), + null, player => player.Calamity().explosiveMinionsEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.summon), From c2954fc69994408dcedabbad7fbe1a9be99272d2 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 12 Jun 2021 18:12:32 -0500 Subject: [PATCH 39/73] Withered Enchant and Shattered Community change --- Buffs/Cooldowns/Withered.cs | 21 +++++++++++++++ Buffs/Cooldowns/Withered.png | Bin 0 -> 517 bytes CalPlayer/CalamityPlayerLifeRegen.cs | 19 ++++++++++++- Items/Accessories/ShatteredCommunity.cs | 25 ------------------ Items/CalamityGlobalItem.cs | 2 +- .../CalamitasEnchantUI.cs | 3 --- .../EnchantmentManager.cs | 12 +++++++-- 7 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 Buffs/Cooldowns/Withered.cs create mode 100644 Buffs/Cooldowns/Withered.png diff --git a/Buffs/Cooldowns/Withered.cs b/Buffs/Cooldowns/Withered.cs new file mode 100644 index 0000000000..5a68168394 --- /dev/null +++ b/Buffs/Cooldowns/Withered.cs @@ -0,0 +1,21 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class Withered : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Withered"); + Description.SetDefault("Holding withered weapons causes you to suffer but makes your weapons strong"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().witheredDebuff = true; + } +} diff --git a/Buffs/Cooldowns/Withered.png b/Buffs/Cooldowns/Withered.png new file mode 100644 index 0000000000000000000000000000000000000000..8565069431ae04a073a6edffbea36c09cd24b8bb GIT binary patch literal 517 zcmV+g0{Z=lP)s zX2sZ82*JW47CU#s%~RGuk8f-&l_)-faLLC{WOEin*Y;FlqLz?U-%FME9>-BR8+o zXSC+YT>%{f@5-Q=pB%+cYsEJ6QsXjp;BIxDkDLPkt+YN(%e>?sKv>c-V+Utsc00000NkvXX Hu0mjfX6NGx literal 0 HcmV?d00001 diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 3623f87f65..5befef5ace 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.Projectiles.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; @@ -408,7 +409,23 @@ namespace CalamityMod.CalPlayer if (player.lifeRegen > 0) player.lifeRegen = 0; lifeRegenLost += 42; //the meaning of death - } + } + if (modPlayer.witheredDebuff) + { + modPlayer.witheredWeaponHoldTime += modPlayer.witheringWeaponEnchant.ToDirectionInt(); + if (modPlayer.witheredWeaponHoldTime < 0) + { + modPlayer.witheredWeaponHoldTime = 0; + } + else + { + lifeRegenLost += (int)(4D * Math.Pow(1.5D, modPlayer.witheredWeaponHoldTime / 87D)); + if (player.lifeRegen > 0) + player.lifeRegen = 0; + } + } + else + modPlayer.witheredWeaponHoldTime = 0; player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult); diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index f26df095ed..731ab8fe33 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -238,30 +238,5 @@ namespace CalamityMod.Items.Accessories level = reader.ReadInt32(); totalRageDamage = reader.ReadInt64(); } - - public override void AddRecipes() - { - ModRecipe r = new ShatteredCommunityRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 120); - r.AddRecipe(); - } - - // The Shattered Community can only be crafted with a full-power Community. - // That is, in a world where all relevant bosses have been defeated. - private class ShatteredCommunityRecipe : ModRecipe - { - public ShatteredCommunityRecipe(Mod mod) : base(mod) { } - - public override bool RecipeAvailable() - { - bool vanillaBosses = NPC.downedSlimeKing && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedQueenBee && NPC.downedBoss3 && Main.hardMode; - vanillaBosses &= NPC.downedMechBossAny && NPC.downedPlantBoss && NPC.downedGolemBoss && NPC.downedFishron && NPC.downedAncientCultist && NPC.downedMoonlord; - bool calamityBosses = CalamityWorld.downedProvidence && CalamityWorld.downedDoG && CalamityWorld.downedYharon; - return vanillaBosses && calamityBosses; - } - } } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 0847369958..34dec2710e 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1721,7 +1721,7 @@ namespace CalamityMod.Items if (calamitasNPCIndex != -1) currentPower = Utils.InverseLerp(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); - position += Vector2.One * 14f; + position += frame.Size() * 0.25f; EnchantmentEnergyParticles.InterpolationSpeed = MathHelper.Lerp(0.035f, 0.1f, currentPower); EnchantmentEnergyParticles.DrawSet(position + Main.screenPosition); diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index b3570e3ad6..5abf79f364 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -239,9 +239,6 @@ namespace CalamityMod.UI.CalamitasEnchants itemScale *= inventoryScale * baseScale; drawPosition += Vector2.One * 23f * baseScale; - if (EnchantmentManager.ItemUpgradeRelationship.ContainsKey(CurrentlyHeldItem.type)) - drawPosition -= Vector2.One * 12f; - // Draw the item. if (hasMultipleFrames || ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) { diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 377204cc07..aa03ce8d81 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -180,7 +181,7 @@ namespace CalamityMod.UI.CalamitasEnchants player => player.Calamity().dischargingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), - new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. The explosion can hurt both you and enemies. Minions do more damage the longer they live and idly explode.", + new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", 700, null, player => player.Calamity().explosiveMinionsEnchant = true, @@ -223,6 +224,12 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().manaMonsterEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + + new Enchantment("Withering", "You heal when hurt based on damage dealt. After being hurt, the weapon rapidly drains your life to deal massive damage.", + 1000, + null, + player => player.Calamity().witheringWeaponEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), }; // Special disenchantment thing. This is separated from the list on purpose. @@ -232,7 +239,8 @@ namespace CalamityMod.UI.CalamitasEnchants ItemUpgradeRelationship = new Dictionary() { - [ModContent.ItemType()] = ModContent.ItemType() + [ModContent.ItemType()] = ModContent.ItemType(), + [ModContent.ItemType()] = ModContent.ItemType(), }; } From 7222901420b4526f27bd04e3a5b7b0ce7e86f20d Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 15 Jun 2021 10:06:45 -0500 Subject: [PATCH 40/73] Persecuted enchantment --- CalPlayer/CalamityPlayer.cs | 18 +++ NPCs/Other/CalamitasEnchantDemon.cs | 4 +- NPCs/Other/DemonPortal.cs | 123 ++++++++++++++++++ NPCs/Other/DemonPortal.png | Bin 0 -> 837 bytes Projectiles/Typeless/SuicideBomberDemon.cs | 117 +++++++++++++++++ Projectiles/Typeless/SuicideBomberDemon.png | Bin 0 -> 8180 bytes .../EnchantmentManager.cs | 6 + Utilities/DrawingUtils.cs | 11 ++ 8 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 NPCs/Other/DemonPortal.cs create mode 100644 NPCs/Other/DemonPortal.png create mode 100644 Projectiles/Typeless/SuicideBomberDemon.cs create mode 100644 Projectiles/Typeless/SuicideBomberDemon.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c3e51a953c..1467e28ea8 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -32,6 +32,7 @@ using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.Providence; @@ -1017,6 +1018,12 @@ namespace CalamityMod.CalPlayer public bool explosiveMinionsEnchant = false; public bool bladeArmEnchant = false; public bool manaMonsterEnchant = false; + + public bool witheringWeaponEnchant = false; + public bool witheredDebuff = false; + public int witheredWeaponHoldTime = 0; + + public bool persecutedEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -2010,6 +2017,8 @@ namespace CalamityMod.CalPlayer explosiveMinionsEnchant = false; bladeArmEnchant = false; manaMonsterEnchant = false; + witheringWeaponEnchant = false; + persecutedEnchant = false; lastProjectileHit = null; @@ -7347,6 +7356,15 @@ namespace CalamityMod.CalPlayer if (player.whoAmI == Main.myPlayer) { + // Summon a portal if needed. + if (player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + { + Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); + int portal = NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, ModContent.NPCType()); + if (Main.npc.IndexInRange(portal)) + Main.npc[portal].target = player.whoAmI; + } + if (revivify) { int healAmt = (int)(damage / 15D); diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index f88ba5486a..d4a60a001d 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.Other npc.defense = 0; // This is meant to be created after SCal is defeated and should be at least a little challenging. - npc.lifeMax = 166660; + npc.lifeMax = 101010; npc.HitSound = SoundID.NPCHit47; npc.DeathSound = SoundID.NPCDeath18; npc.noGravity = true; @@ -36,6 +36,8 @@ namespace CalamityMod.NPCs.Other npc.aiStyle = 0; } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 101010; + public override void AI() { FadeAwayTimer++; diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs new file mode 100644 index 0000000000..092c7846ee --- /dev/null +++ b/NPCs/Other/DemonPortal.cs @@ -0,0 +1,123 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class DemonPortal : ModNPC + { + public ref float Time => ref npc.ai[0]; + public override void SetStaticDefaults() => DisplayName.SetDefault("Mysterious Portal"); + + public override void SetDefaults() + { + npc.width = npc.height = 60; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 24660; + npc.noGravity = true; + npc.noTileCollide = true; + npc.value = 0f; + npc.knockBackResist = 0f; + npc.netAlways = true; + npc.aiStyle = -1; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 24660; + + public override void AI() + { + npc.rotation += 0.18f; + npc.Opacity = Utils.InverseLerp(0f, 30f, Time, true) * Utils.InverseLerp(420f, 390f, Time, true); + npc.velocity = Vector2.Zero; + npc.scale = npc.Opacity; + + if (Time == 300f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + ReleaseThings(); + Main.PlaySound(SoundID.DD2_EtherianPortalOpen, npc.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient && Time >= 420f) + { + npc.active = false; + npc.netUpdate = true; + } + + Time++; + } + + public void ReleaseThings() + { + bool friendly = npc.life == 1; + for (int i = 0; i < 6; i++) + { + int demon = Projectile.NewProjectile(npc.Center, Main.rand.NextVector2CircularEdge(4f, 4f), ModContent.ProjectileType(), 17000, 0f, npc.target); + if (Main.projectile.IndexInRange(demon)) + { + Main.projectile[demon].friendly = friendly; + Main.projectile[demon].hostile = !friendly; + } + } + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + bool wouldDie = npc.life - (damage * (crit ? 2D : 1D)) <= 0; + if (wouldDie) + { + npc.immortal = true; + + // Enrage demons if hit when already at 1 health. + if (npc.life == 1) + { + int demonType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != demonType || !Main.projectile[i].active || Main.projectile[i].hostile) + continue; + + Main.projectile[i].hostile = true; + Main.projectile[i].friendly = false; + Main.projectile[i].netUpdate = true; + } + } + + npc.life = 1; + damage = 0D; + return false; + } + return true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + spriteBatch.SetBlendState(BlendState.AlphaBlend); + + Texture2D portalTexture = Main.npcTexture[npc.type]; + Vector2 drawPosition = npc.Center - Main.screenPosition; + Vector2 origin = portalTexture.Size() * 0.5f; + Color baseColor = Color.White; + + // Purple-black portal. + Color color = Color.Lerp(baseColor, Color.Black, 0.55f) * npc.Opacity * 1.8f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + spriteBatch.Draw(portalTexture, drawPosition, null, color, -npc.rotation, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + + // Purple portal. + color = Color.Lerp(Color.Lerp(baseColor, Color.Purple, 0.55f), Color.Black, 0.66f) * npc.Opacity * 1.6f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation * 0.6f, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + + // Red portal. + color = Color.Lerp(baseColor, Color.Red, 0.55f) * npc.Opacity * 1.6f; + spriteBatch.Draw(portalTexture, drawPosition, null, color, npc.rotation * -0.6f, origin, npc.scale * 1.2f, SpriteEffects.None, 0f); + + spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/NPCs/Other/DemonPortal.png b/NPCs/Other/DemonPortal.png new file mode 100644 index 0000000000000000000000000000000000000000..1fb1ceee5ec7c9ee409dd8e0e838951134cc5808 GIT binary patch literal 837 zcmV-L1G@Z)P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz0@_JLK~!i%?U_Am z6j2n0*DORtqoVkYh!7AzD#c1s?A1bSZ3TaVzrdd$*xHJP+KYmvR(>=A5z!#QK-frN zB`9Z@r|?aV=gytkY%%wN9%H}zlP5rx?0`wXtm;*1vRWD`5Sb* z8VAg`oskv8fN7=aIIBjl-M>_|hnElD{4-;U3`4HzVi-f3GZ2}Lj7E6Iz3Q!|!86`p z!{ny-M8ZRJ7BHP_I5MkfPxNxTe}?P0VSJ5DdpQeD%_?d-mDgXNRqcx5nhopW$aF+* z?kZZX!OLx}C7$VGSPg?W{wkW=ZL74>bktDO#V}wRQs>aqnrQ*o$Mw*TwLvlLp}DQ5 zHFqE~?iq#1tj?jqTm2Qo5uWMDFy_>_ZjTJBS#MRub?TFxVmKA)1KlXNGeY_s;IFj9ff?`P9K3 z2dZtx(%RCSH`17GdBLSUhUfq+h-rn|G#55qj!e4{2#X5wU3!4Z*#Do z&@_LIQl;BM71g(qpidDY$5sx-a4u?ANgZb=O)=aQo%uve%PjQF@L=#4u1&JuY~y$e P00000NkvXXu0mjfrTv(< literal 0 HcmV?d00001 diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs new file mode 100644 index 0000000000..a712fd1b16 --- /dev/null +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -0,0 +1,117 @@ +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class SuicideBomberDemon : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 32; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.Opacity = 0f; + projectile.timeLeft = 300; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.friendly); + writer.Write(projectile.hostile); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.friendly = reader.ReadBoolean(); + projectile.hostile = reader.ReadBoolean(); + } + + public override void AI() + { + if (projectile.owner == 255) + projectile.owner = Player.FindClosest(projectile.Center, 1, 1); + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.025f, 0f, 1f); + + projectile.frame = projectile.frameCounter++ / 5 % Main.projFrames[projectile.type]; + + // Anti-clumping behavior. + float pushForce = 0.08f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || otherProj.type != projectile.type || k == projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == projectile.type; + float taxicabDist = MathHelper.Distance(projectile.position.X, otherProj.position.X) + MathHelper.Distance(projectile.position.Y, otherProj.position.Y); + if (sameProjType && taxicabDist < 60f) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= pushForce; + else + projectile.velocity.X += pushForce; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= pushForce; + else + projectile.velocity.Y += pushForce; + } + } + + if (projectile.hostile) + { + projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(Owner.Center) * 16f, 1.4f); + projectile.spriteDirection = (Owner.Center.X > projectile.Center.X).ToDirectionInt(); + if (projectile.Hitbox.Intersects(Owner.Hitbox)) + projectile.Kill(); + } + else if (projectile.friendly) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1360f); + if (potentialTarget is null) + projectile.velocity = Vector2.Lerp(projectile.velocity, -Vector2.UnitY * 10f, 0.06f); + else + { + projectile.spriteDirection = (potentialTarget.Center.X > projectile.Center.X).ToDirectionInt(); + projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(potentialTarget.Center) * 18.5f, 3f); + if (projectile.Hitbox.Intersects(potentialTarget.Hitbox)) + { + projectile.Damage(); + projectile.Kill(); + } + } + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 40; i++) + { + Dust explosion = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 267); + explosion.velocity = Main.rand.NextVector2Circular(4f, 4f); + explosion.color = Color.Red; + explosion.scale = 1.35f; + explosion.fadeIn = 0.45f; + explosion.noGravity = true; + } + } + + public override bool CanDamage() => projectile.Opacity >= 1f; + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = Main.rand.Next(60, 70); + } +} diff --git a/Projectiles/Typeless/SuicideBomberDemon.png b/Projectiles/Typeless/SuicideBomberDemon.png new file mode 100644 index 0000000000000000000000000000000000000000..bd3a5924ca1b3036a565056b45c1f0e1bb7af3cb GIT binary patch literal 8180 zcma)hcT^MGzwZDVEEJKWbU1(%m7dU~SrAm32c)+k5K3r*^b!p*26|4#rAs=Tdz?Oss!at;b@Gvwcidp@)Iv9e|6 ziS*W~VIGij7FY~>zVm)`weJ4t5@YY+;*I(~R9!0&mcJVg( zlK2Hl_v@mcgc97Vos+noSf;*2tHAXagee2j_ANbU zp^^xAzb&XspT>5dMx+Dx)BpVBn_{fO8G>sIe&;>em`6UaJ_dxYu>dna#clhK8-(ON zm*(nW;(OV5sn8O&+dTS6nF07@VGP_6FT5?D)&A(6Tm$+u_i#Bb%ud^a5s*BQJn&{! z2&y7C!~(g?^C|UI@#8E!C=j@H1`q!jkO-rUm0_PeknhlAUQST17ijjjV;TP6O4hv&KLhX5Ksh zKy&uNu|9G7@Xs?h)|Uk=1Q?1a4$toUUi(Z^Qou^fMKKkU+C@iC=Q}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6hDvQm|+w1own9~T8@}^U6Dy5r@a4_Wmfpr zPB*}ceqRYvBBJBuOS)P)ryu`b8*1J6-ZWzwl26;BJA^V+lUV}eT}$W-@$NAPg3W8^ z(@sYRV2rP?pIy4wZ6(*A6Zq?)F9rP41Rt;DOQRSV`8nHN){ifmch=Z@myTs?J1nLBK^7LEkp=nDF6K>Fu>ZCC8Su!M)&JMo9Nh5XUifUp0<4x zklX4@540I}DC6I*c@`Za{W38SB=D;dxB_})Xed9r4@-!h*8B={^O{;XB%?skqvsAm z@~O3LylxotKJ5iMJO=cLz?!A5XNn`aon2`kN~_Y85!H_vYx*XJ0weDJzxsAOn#LR# YQsVCWs`)Ya86UWP(@?weI{fkf0p%a}O#lD@ literal 0 HcmV?d00001 diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index aa03ce8d81..6a1502f4c6 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -230,6 +230,12 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().witheringWeaponEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), + + new Enchantment("Persecuted", "You attract portals which summon demons on hit. The portal must be brought close to death or the demons will attack you. Otherwise they attack enemies.", + 1100, + null, + player => player.Calamity().persecutedEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), }; // Special disenchantment thing. This is separated from the list on purpose. diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 697e5f7931..a3eefd6d7e 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -112,6 +112,17 @@ namespace CalamityMod } } + /// + /// Sets a 's arbitrarily. + /// + /// The sprite batch. + /// The blend state to use. + public static void SetBlendState(this SpriteBatch spriteBatch, BlendState blendState) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, blendState, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + } + // Used for bullets. This lets you draw afterimages while keeping the hitbox at the front of the projectile. // This supports type 0 and type 2 afterimages. Vanilla bullets never have type 2 afterimages. public static void DrawAfterimagesFromEdge(Projectile proj, int mode, Color lightColor, Texture2D texture = null) From a3e5bebe411ffaae7cfd8ade642f06e63b16098d Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 15 Jun 2021 12:26:44 -0500 Subject: [PATCH 41/73] Enchantment icons --- CalPlayer/CalamityPlayer.cs | 2 + CalPlayer/CalamityPlayerMiscEffects.cs | 14 ++++ ExtraTextures/UI/CalamitasCurseBackground.png | Bin 3317 -> 3403 bytes .../EnchantmentSymbols/CurseIcon_Aflame.png | Bin 0 -> 308 bytes .../CurseIcon_Bloodthirsty.png | Bin 0 -> 295 bytes .../CurseIcon_Capricious.png | Bin 0 -> 277 bytes .../CurseIcon_Ephemeral.png | Bin 0 -> 300 bytes .../EnchantmentSymbols/CurseIcon_Erratic.png | Bin 0 -> 270 bytes .../EnchantmentSymbols/CurseIcon_Evasive.png | Bin 0 -> 246 bytes .../CurseIcon_Evocative.png | Bin 0 -> 314 bytes .../EnchantmentSymbols/CurseIcon_Exhumed.png | Bin 0 -> 819 bytes .../CurseIcon_Hellbound.png | Bin 0 -> 309 bytes .../EnchantmentSymbols/CurseIcon_Incisive.png | Bin 0 -> 334 bytes .../CurseIcon_Indignant.png | Bin 0 -> 302 bytes .../CurseIcon_Lecherous.png | Bin 0 -> 294 bytes .../EnchantmentSymbols/CurseIcon_Oblatory.png | Bin 0 -> 303 bytes .../CurseIcon_Obstinate.png | Bin 0 -> 289 bytes .../CurseIcon_Persecuted.png | Bin 0 -> 281 bytes .../EnchantmentSymbols/CurseIcon_Polluted.png | Bin 0 -> 341 bytes .../CurseIcon_Relentless.png | Bin 0 -> 287 bytes .../CurseIcon_Resentful.png | Bin 0 -> 285 bytes .../CurseIcon_Splintered.png | Bin 0 -> 316 bytes .../EnchantmentSymbols/CurseIcon_Tainted.png | Bin 0 -> 290 bytes .../CurseIcon_Traitorous.png | Bin 0 -> 334 bytes .../CurseIcon_Vindictive.png | Bin 0 -> 303 bytes .../EnchantmentSymbols/CurseIcon_Withered.png | Bin 0 -> 301 bytes .../CalamitasEnchantUI.cs | 38 ++++++++--- UI/CalamitasEnchantments/Enchantment.cs | 10 ++- .../EnchantmentManager.cs | 64 ++++++++++++------ 29 files changed, 96 insertions(+), 32 deletions(-) create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Capricious.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Erratic.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evasive.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evocative.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Incisive.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Lecherous.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Oblatory.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Obstinate.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Polluted.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Relentless.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Splintered.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Tainted.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Vindictive.png create mode 100644 ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1467e28ea8..69914b73ed 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1024,6 +1024,7 @@ namespace CalamityMod.CalPlayer public int witheredWeaponHoldTime = 0; public bool persecutedEnchant = false; + public int persecutedEnchantSummonTimer = 0; #endregion Calamitas Enchant Effects #endregion @@ -2427,6 +2428,7 @@ namespace CalamityMod.CalPlayer animusBoost = 1f; potionTimer = 0; bloodflareCoreLostDefense = 0; + persecutedEnchantSummonTimer = 0; if (BossRushEvent.BossRushActive) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2af4eb10fa..5f766fba27 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Environment; @@ -1180,6 +1181,19 @@ namespace CalamityMod.CalPlayer modPlayer.aBulwarkRareTimer--; if (modPlayer.hellbornBoost > 0) modPlayer.hellbornBoost--; + if (modPlayer.persecutedEnchantSummonTimer < 1800) + modPlayer.persecutedEnchantSummonTimer++; + else + { + modPlayer.persecutedEnchantSummonTimer = 0; + if (Main.myPlayer == player.whoAmI && player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + { + Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); + int portal = NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, ModContent.NPCType()); + if (Main.npc.IndexInRange(portal)) + Main.npc[portal].target = player.whoAmI; + } + } if (player.miscCounter % 20 == 0) modPlayer.canFireAtaxiaRangedProjectile = true; if (player.miscCounter % 100 == 0) diff --git a/ExtraTextures/UI/CalamitasCurseBackground.png b/ExtraTextures/UI/CalamitasCurseBackground.png index f6c3ca7fd26bc2e3bbe1e0186c6945ac359ca6df..29555271c1f6e2758c26afaad47b5655305bf5b3 100644 GIT binary patch delta 2329 zcmbtWYc!PY8XjX}90uc zIb<41h?$A_IxRUwDu?V&n=(48ls&t>f9$pPpKq=G=ULBvt?SQy-Oqhp&*ugAjLE3q zru76(V@(VOL-6v1127mBM0uaYt18bexw1(y*$2n(@`Bxhcwz5~3860>^^XqdT3>8D z(O=9g{x;`&>fN6=#q&124LPfoGW^d45 zsrRY!JFBHb>hXzz1w}qvhA;*tAz90+Ky6>aTFk;x3~H3Atn!d+SnoA=; zIR3S@?!cn-rvs{wZ}0DjO`Xz88J{_nIkN=HkREERZOoZE9IYYA~r+}=RP9uLZuD&^ICu>Z*&JS|`iw$}j)QYpQNuCY=lTHY!8`dN?9BJb2T ztb)GoQ$3Bi@hOI~`8#+gM=$A@*aR;3NfjU94Nb5mWB=e*TCf`))awqf_k_)e!qMKv zpCnp$7tw34>V*#BX0YW)c4w|ZjgBvi#hQR*mtjZ0XWU?_eNC`0(4dEx=S(qG)QMu6 z35b`}+WJ(bnOG8~nP(i}$y+fek(X@w#vcqg)q}4dOnsKmIY3|K>)UnUy8Gis`>`l< zXu%tOnKx;qy&sq!H#3-Bp0$H)T-E<^1#`3@=UM1`h?s}fdh|wL#o!n?U$RubjzrQh zv^K}iw?Y_0dMX5>SWo88w1sw+BA2bQ>->$`w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`(#YdLv*X~Nm*>yx*e)I>YbsHmBTej2#>V_I)mYt@7zbNj zHmST)r1rW|1OAM0dmXoJ6+DP^zfo;LSd{a|`3icBv%(x3bFM-6(E*Flem%wl}r+RTW}(Yz;tjyX3$Wm(ah& zvI5p6Mg#ciPj%soO!_^g#v~Zk2OJrO_wQzeXhq?4p`1uuMKCzG{`qf!PWIE0qtVt) zbZ1$FzS-OQsPBlFY&>fyn6|5niKZ4ae4D?_gqY3{n&--A6`%!PZ_SRJ4v$*DePDYI~(sp z!l1Cuel33bB=U<;CG)VFP}KyUJgWE2KFW>C1s^h)dZoXJGW@ZxK2ypS&a@-`g5U8Y zbI<-uiT^VR{FL{9Oq#pMceXr4 zH%GF4`eV-ndpC7hM{~A@cN8f>Sf8%sPp|K8r(I+x4G`m7Wp;8*j-bUC*`fvd_UBR+ z!DFVLIf#<8K7yu2O{P0Gl=irQ1s5Q~d~M12&(F~7$SwcOpq77tGn?eVDV1LAo2I%P zz_hkEm*C=mzmg8Hjw-3yCTR0dwIDSNQQX5^m-p>p9cSK%^t5s%nPhF8`suVJJ2pv) zJ}wS4f^uwR+Un5O?RAxv^m`acNObw$I_N8-=03@^ue!4FvgTQ3Wi_?&HW#wZ*3jHq zRlZBZrQ0;b;u~mVmgtTIoRx%}dz5!na!2x#)i~2Td!PBFI^iunf+hbFh^MQM%OfY! GwSNI%a~huj diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame.png new file mode 100644 index 0000000000000000000000000000000000000000..8d8c0b27ec38a0dcaea586ff1a7419d318b08627 GIT binary patch literal 308 zcmV-40n7f0P)Px#?ny*JR9J=Wm`M(UFbqXMRnO5C_diirT!gNorp8kS651ZLW~lV1;BtssK~W z6~Y@7>!4M~7%bClf2$sbH+YFbC3}0#N$t&949IA(Vl?KY`%PJ%+Tf5mnw?T?)480I z&tS)@q^YhkPx#;Ymb6R9J=Wm^%`~APfZ`nViE_?tdazxrkFS!)T-@VTzzc+qeK^SbnmBq9}6H zq7_dZR?)Tct{2|4(IXiAYq$m#bJAFJ7HB)m7<}%fJw)*T2M*&Oly+1Gmh{ za$=H_+8`aFVuscWm{iwdYJ(E*yi?a|H%3fSe##&Kf7cF#&N+|m4ORzNneO0;!`guj zi|b8edxJB(SlyN6hEP%L=gwx#-VY;P%4U>!GHzpWwl_F^lR%7Invo_va~|6pjI6Px#&q+i6kO!VlE95&EzQ6eY7v&&mb$xdPkZ};`t~;d5<@!R#W*4 zs|F2ougKGSkN7u8Monh%CgUyEF-WW?Tkoyr$a)6Jgh>El@SoW^X=QzbPx#=1D|BR9J=Wn86OiAP9!pvghb&@Bc(Q^+mc9i8_QI>r%9SC({Jdei6YEEf&}E z@CJNn~{deh$cN;%IiS^h{*gJRCJCU0p_%*`f~c#+chJO+g?uT`;H-B$c?244*^ zmZ8$*QF#tAr9l+SB*ZNZTGcI@taY652CMr)Iq_W`1c+Bnj%N_)7-kNlUlWc_l*NZP zC{;0f(!1t9VVZ%edq{&NY7a#xW@`>i$V?7t&^=|R0H&b33=`gPx#$Vo&&R9J=WmOBoGFbo72^v*%W{ZB;oE&^4gVC7?*M4(Nkfd&I3FDx*byvt&} z;J_A6&(f?Nf9E6JS({AhNK1ponO>uxH~4EXLmEr&W@H|K-YAbjX`q10s1_cB5y|w* zor;VHW2ZQ(Oi~(5QrOYl_fo|;22nR<{%Zkb26KkGmk07*qoM6N<$f}&e+2mk;8 literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evasive.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evasive.png new file mode 100644 index 0000000000000000000000000000000000000000..3969952ddca0e49467adcdb37c68a23195e492c5 GIT binary patch literal 246 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEjKx9jP7LeL$-D$|Hh8)?hD5Z! zo$e^)U?9LU{S%-1|N4oO`wP58qs?ZzOzHKJSMD$~bZrrE`jw_(TR1h6|E=oxn3Qfm zxsR%~heIAp-I`OU{p&~GncYjdn;B1gNVpqU9o*}v_dzp_Eq`CJ=9;^aQ}#OSX7gXd z^CGtETzf(Og_>ER&+fFHI4gJM?<4;ET=B30J)vP)78&qol`;+0JZ*Lj{pDw literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evocative.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evocative.png new file mode 100644 index 0000000000000000000000000000000000000000..588a10e3b0cdd9f1ed53e1eb80539a85cc5fec3e GIT binary patch literal 314 zcmV-A0mc4_P)Px#^hrcPR9J=Wmq8N3FbGAd<2kzW{wM0ni_}$|gb9J4;uOZbmDYqw-T+df#o}Hz zbi+Y=`FPebUi5Z4Qp@8fQ5|tR;6ZzB*NyN7%{kbybF%NI>)<{w1^t?KXw#T*=%vsN)@Do67gtkBFz{6`-YZwX8$P!&r^ z)t%4a#7t*3DCP2S3JP!VTgAZCQkXTSt!v`uF<61lb^Ld9KVRSEbSi_xoAW+}zM~lS zcS&V%2r%6Ya}MpZsSTo2j8x4V5!7e%_Cc+majgCEQk?Jx7mK_30E7oIAM!#nd;kCd M07*qoM6N<$f>IWXK>z>% literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed.png new file mode 100644 index 0000000000000000000000000000000000000000..584bd628816ff3ca8333a87b1dcb3b413cede037 GIT binary patch literal 819 zcmV-31I+x1P)Px%?MXyIR9J=Wn9ojAK@^9-p<1Z5N(-coO&6v>aiM{*(}WdDG;!g=cW^~qkl-V@ zU}0SO79{R~xN~I;MiV0t{D(qH0E-la7U;N`OzlkP-j--$ukp9JnYm}q%zXFEnYjc1 z^?MS{8a_-dIO`we2LPDAR`*^41sp&e_-O`?`8xk}Xg0l+Qb3X6Z~s09+YV z=+cQ004vYG7tF{ci6AX_ka-)+equu_Dav4fi1iMhHC%-002ovPDHLkV1gm|e~AD9 literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound.png new file mode 100644 index 0000000000000000000000000000000000000000..96b2a87a02d4ed345067c7ecd10ac95eba73108b GIT binary patch literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEjKx9jP7LeL$-D$|-g~+@hD5Z! zo#DvWY{0{Ech&nBEC1IA`qwO(qr-YS?lxy`=Tu8YM<$-^B!#G+!qa>emnWOsPqd8R zlImahz|Q0sd(Gj5ti1CDvdz7gZM;#%C6d$J^z%PlG;}jPUVd-Jw=-?`m_AE~Y$|t1 zJGROzK`gDbu9-J3)M-iN(~~P^>ZS@LrJ5%21szg26Ias8c-+xTVhe{P$BgE`4xG(# z$CGFJ>@{C2x}wEVZK`Z){dKR9LkVWd({6tG&L1e)d{e6}ZS(z;pQTyuc7$Jb{;O=f z-%;)M@xb(}Uaur_8g5Geovo^w8Spfx_{>w@b=)z3X3H)#H;LexwFTsL22WQ%mvv4F FO#r4yeJ}t3 literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Incisive.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Incisive.png new file mode 100644 index 0000000000000000000000000000000000000000..fe9459ec6135b8c6b7a8cd9d72eb5d01f8baf6c7 GIT binary patch literal 334 zcmV-U0kQsxP)Px$2uVaiR9J=WmrD-9Fbo9^;vB5F|A|=jBCv{-SpGblB5agdL7N6Ld2v#r&1YP+ z8&A5wqR-4c=t%t`&h?aDzDUMkx=#tubZdj-W7cHqx4F^s25&%{F;Z?4&6+j?P?hLw zaAaZ1qKVPoGd)a-?fM!N;8|QoE|^>H3x=WUP~IS1^^KA9KG4-JX74ZSAV;fYvG&skS?bWe_qEIC-bC*xI1CO1)JWs)t$@`x+Fog&IN4LNij{;HmqjMBpt> gJRg=fxY_)gH?1N_L8CDWXaE2J07*qoM6N<$f)z}a$p8QV literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant.png new file mode 100644 index 0000000000000000000000000000000000000000..526223131ed6dbf436984aa240f4ab0b60f43162 GIT binary patch literal 302 zcmV+}0nz@6P)Px#=t)FDR9J=Wmq8N4AP7Z&J3U8Nx&Mi}%0<$Z9YRGxnTD!wlSKm2Hz*1$7T0p~ zO7z0B_Q_Ei!-hTk^4>nA-|(;o^qR5~-k^F`8FP}UVs5F{B*Ggs*C32FW;Mnc(jez# zuGbi63WEUr%_YJc^wE0aP;9_w#Z#Ob4TJl60oneEP)Px#;7LS5R9J=Wmq`x8APhx+s-7dO-v2~h^&;)c61d-BP*h>+x5Ny|!%RSuB*}ks zSb--_UG$#q3jiK?IX|i9Hr48feEs!=xuG${BpIiQ3(Fh4H)7h{p~{;%SJbQOH)e?T z7t)|*t_jI4ZQNyE+Dm^S4GP{I>(%p`q%#-NU~k{jMsyr3PO#$D_{$q~tv=KZf>!PXBnQAR=ceYj-JiB9f1Blae0HY`NCGS)fbI>Z`jKl?B<|#^L0S?$Px#=}AOER9J=Wm`e`AFbqVeh;y*w{wHG9i@?f)ME(+^)*)}jA`R_hCRha)V{F!f z2X6H7$z6NLo_tF!m!IyQz;$$k55o;vX6qT0j4B+Oh#sAmwenL{XPu!l0mo`Vur zmc1=6X>hcKR)#m=ZP+qd&tU&Vj&m{EdRp)LrRo_}=-V7>HM8Djvc5seq>{zPz!w=- zsc%qW)ZG8In8jf(+V+O|4Juhv%}qVcc#-}IQp^#jH|TDZ(oV}D`(4vyFg!go?`oty zQcRxS;P5#}FjJ3rKAe0WjACUfU>HCFgNwz{ya4nqGGa93rI-K!002ovPDHLkV1g8i Bgk=B# literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Obstinate.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Obstinate.png new file mode 100644 index 0000000000000000000000000000000000000000..41a740b38771f711bae0c946055c5ba2b0fd3a66 GIT binary patch literal 289 zcmV++0p9+JP)Px#+et)0R9J=Wmq8AMAPhx|nRBq3`=7{_7nxZ#0i@-F7_sn{h)7=Gw-PND&*JV{ zcqcDC`i0;A(xI-i_1n@te0nVe7;9o4g8`_q=qyT1X)raC8g;^WmU#?vo+-DvDRb=@ zRLn?R%0K4)1~cZmm?7{?zTaSglxL-R={VHIFs2MLkvS#*)QZ9Lr|Ji@=1TMEY!d2X z7!wAe+b4}TRG^6A4OVY(Cx6*W4Z|C3sU(i5oMXK#n=q*67+?ym;aN-=l&I|s(Ml9y n%3$e#7kUph#|&?9v3Qz4B&jV?Mun_f00000NkvXXu0mjfvf+7? literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted.png new file mode 100644 index 0000000000000000000000000000000000000000..d4999cd4adef288907f7baf1210cf18255b3375a GIT binary patch literal 281 zcmV+!0p|XRP)Px#(@8`@R9J=Wm_ZJNAPhz8#B;cs`=4l5bCGdH;xu6UZHf59TM{ksY!MKd#8|Qe zeq_^4zhhr-`9kqt@genP%?fm4E(E{9UgiqJ8@yb_4s(lY|LePx$4@pEpR9J=Wm`x6ZAPh#!WX|Dg?tdazUWD096KOvBBTNG5+h}4z^U^|*=%I~d z1?;r(ZAN21baeitlGk5n@4<f|FrLtKs1dMskpmx#*hvs>yi`D!B!#S&3^hIiJA` zIajQQ%6QeJ9LLY6HfZIVYQ}34kbm6-7>v8blm;2gq>Ph9`%1|0278=~L+@DsTwEhi nwaiWbEVR=5kL>UUA6oeW06|Gaftp%w00000NkvXXu0mjfbkdpI literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Relentless.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Relentless.png new file mode 100644 index 0000000000000000000000000000000000000000..df19b8d4c1994064a898f9f1cc1c0d07760997f1 GIT binary patch literal 287 zcmV+)0pR|LP)Px#*-1n}R9J=Wm_ZK1APfYZs_)1t|9??W`AB+-idJB+6VzhrxrKm0qXnFZBuNsR z#XI07t9Qtu&AG|04t{uN`!-LuW5t|mMtOh0v&uXM3(yRXEpU_FoiB#r4br(OZW8MTL8$YwWq){s&0XxMTB!4n=vOry*P!rbkXF`Q zRm@3fg9uyiiO6SHDs|*i_G=N^AY0d6%_>D)gH|@IZ1p0p!Mj}eey%c~!QOusEao#< lz?!MHv(@+T29xC1ya8;GBwXoCI8p!r002ovPDHLkV1nEGe(C@K literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful.png new file mode 100644 index 0000000000000000000000000000000000000000..6259357bb1e2546cdd4fd349dcbcfe8b775871ab GIT binary patch literal 285 zcmV+&0pk9NP)Px#*GWV{R9J=Wm`xIcFbGDe<2kzW{wH$fMeHgwEd%nA#5Sb7t>nj-M2JL5lEmg= z1?=?H9-TFPZ**8gez3Tre}HOGFlQNajfI+=!eB9H?pGEMjcJ)2-rx$vKyUnJyu@oJ zT`MxYL3CfiI8HybGXH0=AbbTb=MdIlPOz1nU@K}S;omc~`naectB7lmSk5eFfLzSm zYs`_0k!nUX3B*H$uLnI9^{r!u&BdOIy6de@=ub2|yuq*kSTbWCcH(;?T2doS!M jzVlY+y8nhXn6&Z&iViO~@sRyX00000NkvXXu0mjfL+^b) literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Splintered.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Splintered.png new file mode 100644 index 0000000000000000000000000000000000000000..0f75aff9d7fc72c7365a0394714dd8a2b940bec3 GIT binary patch literal 316 zcmV-C0mJ@@P)Px#_DMuRR9J=Wm^}`IFbqaNs-A<1`=5x3i=>k!aO2nx5w)wlg&{v8FOD4mCX-2S zmQfS!Sgl=4t8v3|d8b$J3q8f#+HsVj2G!lnXV75EYedl)1_#t)Q|;Bv5#bHCPO&u)S}RM}?LDH;SEkEzvcrH-7iY9g-9L% O0000Px#+(|@1R9J=Wm`e`BAPfafm2-5J`=6+*T!gMHwU)6T&?*>tHj%=AWJ3s1k|ePy zUWFGuTSawdjFT>?@dF&>Hkt+%bJCb+zh(HVoo8|jgQhuY05A{r!z^#`Fv_~j$@d>7 zxt;8sKb1H~9Ano^-+1HPYZL%TLhCVm0eHE77 o@&<=ir2+iIDMTA)agyB48%A3*T`w|$2mk;807*qoM6N<$f*gx?i~s-t literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous.png new file mode 100644 index 0000000000000000000000000000000000000000..9a7f8c7cecbd50c96ce6c2af5d8d4fa1699b6ddf GIT binary patch literal 334 zcmV-U0kQsxP)Px$2uVaiR9J=Wm`e_XAP@!HiRW;|{ZHhIi!iHB6nIVZancOdMnfV(!4rh&rH^e? zMJFA68>DwQ@>TVI+MDzno@n4kcWZ%Ct7_IU=*U;kFAe4mHmCTKTEvhv|DVB(x!QzQ znKW;3j|*Z$LJyI-(x~urs?jrVFzLlfhqi}RDJ`WQjg)zV$sD|ZOg4SrxIDA#5l3oD zgWRJKT}7T)hlwUN$iyZ^cy1w+inTk7d4n)Py}K2~bE@>uYY-v)y`egh>07xYpKXhI zgHno1AX6o?Rr^Qt2D?ud8q%J9_c|#?DAFyqVOoPdDb`Z@E{ZH^ur#mHesj*1WLS!| gpp%Jd*W#C6zC{i^Uk+RXdjJ3c07*qoM6N<$f}m55!~g&Q literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Vindictive.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Vindictive.png new file mode 100644 index 0000000000000000000000000000000000000000..3a768a4e8e59eb37aa990585cc5e87d32e36af8e GIT binary patch literal 303 zcmV+~0nq-5P)Px#=}AOER9J=Wn86OiAP9!pvgg=o@Bc(Q?M1p1iT*(pu!$1COWU-i<_n0H=n&&! zec?-QKE0$^ANmD{RP&q~?FL@60~UrwtcFt?zrli*G0erv zTy$PcWzdyVn8WGj!ALJ=dey9ct7kNi!2xrlu}syzyg^SVQO&hX6misf6WQNjfy*4; zx0+04kO}o#!K6wGgJP$cy?bl1yumZTDDGVySD`f*N2`}fX|S64M@=d{J%2C8o=I@6 znhdPKi71Id#$-~!wE|z>U}R5%xc=2_zpFb$`2$loIaNqEAKw4~002ovPDHLkV1ipM Bhp+$u literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered.png new file mode 100644 index 0000000000000000000000000000000000000000..fd200486135311cd3ff5e68f4c0c37070304f99d GIT binary patch literal 301 zcmV+|0n+}7P)Px#=Sf6CR9J=Wm`e`BAPhvORnO5??|-7MdXaSHiV|#Ws0t(bZL&at@HFNVAW7D8 z(Hfq(YfZ;5#(3c6dife0?C+dr*Dx0~78a(ja}qfIlX=C;F8Jzf25Z}2kNGNV<0k!jbCMP<-sXmn2=SPcL$8El+7LMPvvz^#z`G!wbi z&E7@KZ=gL7 literal 0 HcmV?d00001 diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 5abf79f364..e4434c1263 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -22,7 +22,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static bool CurrentlyViewing = false; - public static readonly Vector2 ReforgeUITopLeft = new Vector2(28f, 245f); + public static readonly Vector2 ReforgeUITopLeft = new Vector2(68f, 320f); public static readonly float ResolutionRatio = Main.screenHeight / 1440f; public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); @@ -87,10 +87,6 @@ namespace CalamityMod.UI.CalamitasEnchants // Draw the background. spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); - // Draw the item icon. - Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(30f, 50f) * backgroundScale; - Vector2 reforgeIconDrawPosition = ReforgeUITopLeft + new Vector2(88f, 60f) * backgroundScale; - // Prevent the player from say, firing a weapon while the mouse is hovering over the UI. DisableMouseWhenOverUI(backgroundTexture, backgroundScale); @@ -104,11 +100,20 @@ namespace CalamityMod.UI.CalamitasEnchants Point costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(50f, 78f) * backgroundScale).ToPoint(); cost = DrawEnchantmentCost(spriteBatch, costDrawPositionTopLeft); Point descriptionDrawPositionTopLeft = costDrawPositionTopLeft; - descriptionDrawPositionTopLeft.Y += 90; + descriptionDrawPositionTopLeft.Y += 70; + Vector2 iconDrawPositionTopLeft = costDrawPositionTopLeft.ToVector2() + new Vector2(270f, -24f); DrawEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); + if (!string.IsNullOrEmpty(SelectedEnchantment.Value.IconTexturePath)) + { + Texture2D iconTexture = ModContent.GetTexture(SelectedEnchantment.Value.IconTexturePath); + DrawIcon(spriteBatch, iconDrawPositionTopLeft, iconTexture); + } } + // Draw the item icon. + Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(30f, 50f) * backgroundScale; + Vector2 reforgeIconDrawPosition = ReforgeUITopLeft + new Vector2(84f, 60f) * backgroundScale; DrawItemIcon(spriteBatch, itemSlotDrawPosition, reforgeIconDrawPosition, backgroundScale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon); if (isHoveringOverItemIcon) InteractWithItemSlot(); @@ -167,7 +172,18 @@ namespace CalamityMod.UI.CalamitasEnchants if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; - ItemSlot.DrawMoney(spriteBatch, "Cost: ", costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y, Utils.CoinsSplit(cost)); + // Draw the coin costs. + string costText = "Cost: "; + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, costText, costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y + 45f, Color.White * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero); + costDrawPositionTopLeft.X += (int)(Main.fontMouseText.MeasureString(costText).X * 0.5f + 12f); + + int[] coinsArray = Utils.CoinsSplit(cost); + for (int i = 0; i < 4; i++) + { + Vector2 drawPosition = new Vector2(costDrawPositionTopLeft.X + ChatManager.GetStringSize(Main.fontMouseText, costText, Vector2.One, -1f).X + (24 * i) - 24f, costDrawPositionTopLeft.Y + 54f); + spriteBatch.Draw(Main.itemTexture[ItemID.PlatinumCoin - i], drawPosition, null, Color.White, 0f, Main.itemTexture[ItemID.PlatinumCoin - i].Size() * 0.5f, 1f, SpriteEffects.None, 0f); + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontItemStack, coinsArray[3 - i].ToString(), drawPosition.X - 11f, drawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f); + } return cost; } @@ -176,7 +192,7 @@ namespace CalamityMod.UI.CalamitasEnchants { Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); Vector2 scale = new Vector2(0.67f, 0.7f) * MathHelper.Clamp(ResolutionRatio, 0.825f, 1f); - foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 400, 10, out _)) + foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 465, 10, out _)) { if (string.IsNullOrEmpty(line)) continue; @@ -186,6 +202,11 @@ namespace CalamityMod.UI.CalamitasEnchants } } + public static void DrawIcon(SpriteBatch spriteBatch, Vector2 drawPositionTopLeft, Texture2D texture) + { + spriteBatch.Draw(texture, drawPositionTopLeft, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + public static void DrawItemIcon(SpriteBatch spriteBatch, Vector2 itemSlotDrawPosition, Vector2 reforgeIconDrawPosition, Vector2 scale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) { isHoveringOverReforgeIcon = false; @@ -261,6 +282,7 @@ namespace CalamityMod.UI.CalamitasEnchants // Attempt to exchange if the slot is clicked. if (Main.mouseLeftRelease && Main.mouseLeft && (Main.mouseItem.CanBeEnchantedBySomething() || Main.mouseItem.IsAir)) { + EnchantIndex = 0; Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); Main.PlaySound(SoundID.Grab); } diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs index e098ecb163..e24f411e0e 100644 --- a/UI/CalamitasEnchantments/Enchantment.cs +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -7,6 +7,7 @@ namespace CalamityMod.UI.CalamitasEnchants { public string Name; public string Description; + public string IconTexturePath; public Action CreationEffect; public Action HoldEffect; @@ -15,7 +16,7 @@ namespace CalamityMod.UI.CalamitasEnchants // This is internal because CanBeAppliedTo should be used over this field directly. // Using that has the benefit of null checks and is objectively superior to using the raw delegate. internal Predicate ApplyRequirement; - public Enchantment(string name, string description, int id, Action creationEffect, Action holdEffect, Predicate requirement) + public Enchantment(string name, string description, int id, string iconTexturePath, Action creationEffect, Action holdEffect, Predicate requirement) { Name = name; Description = description; @@ -23,8 +24,9 @@ namespace CalamityMod.UI.CalamitasEnchants HoldEffect = holdEffect; ApplyRequirement = requirement; ID = id; + IconTexturePath = iconTexturePath; } - public Enchantment(string name, string description, int id, Action holdEffect, Predicate requirement) + public Enchantment(string name, string description, int id, string iconTexturePath, Action holdEffect, Predicate requirement) { Name = name; Description = description; @@ -32,8 +34,9 @@ namespace CalamityMod.UI.CalamitasEnchants HoldEffect = holdEffect; ApplyRequirement = requirement; ID = id; + IconTexturePath = iconTexturePath; } - public Enchantment(string name, string description, int id, Action creationEffect, Predicate requirement) + public Enchantment(string name, string description, int id, string iconTexturePath, Action creationEffect, Predicate requirement) { Name = name; Description = description; @@ -41,6 +44,7 @@ namespace CalamityMod.UI.CalamitasEnchants HoldEffect = null; ApplyRequirement = requirement; ID = id; + IconTexturePath = iconTexturePath; } public bool CanBeAppliedTo(Item item) diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 6a1502f4c6..ba3dddd99c 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -58,14 +58,15 @@ namespace CalamityMod.UI.CalamitasEnchants public static void ConstructFromModcall(IEnumerable parameters) { int secondaryArgumentCount = parameters.Count(); - if (secondaryArgumentCount < 4) + if (secondaryArgumentCount < 5) throw new ArgumentNullException("ERROR: A minimum of 4 arguments must be supplied to this command; a name, a description, an id, and a requirement predicate."); - if (secondaryArgumentCount > 6) + if (secondaryArgumentCount > 7) throw new ArgumentNullException("ERROR: A maximum of 6 arguments can be supplied to this command."); string name = string.Empty; string description = string.Empty; int id = -1; + string iconTexturePath = null; Predicate requirement = null; Action creationEffect = null; Action holdEffect = null; @@ -94,33 +95,39 @@ namespace CalamityMod.UI.CalamitasEnchants else throw new ArgumentException("The fourth argument to this command must be an Item Predicate."); + // Fifth element - the texture path. This determines what icon is drawn on the UI when selected. It may be null to specify that none should be drawn. + if (parameters.ElementAt(4) is string iconTexturePathElement) + iconTexturePath = iconTexturePathElement; + else + throw new ArgumentException("The fifth argument to this command must be a string."); + // Optional elements - creation and hold effects. switch (secondaryArgumentCount) { - case 5: - object fifthElement = parameters.ElementAt(4); - if (fifthElement is Action creationElement) + case 6: + object sixthElement = parameters.ElementAt(4); + if (sixthElement is Action creationElement) creationEffect = creationElement; - else if (fifthElement is Action holdElement) + else if (sixthElement is Action holdElement) holdEffect = holdElement; else - throw new ArgumentException("The fifth argument to this command must be an Item or Player Action."); + throw new ArgumentException("The sixth argument to this command must be an Item or Player Action."); break; - case 6: - fifthElement = parameters.ElementAt(4); - object sixthElement = parameters.ElementAt(5); - if (fifthElement is Action creationElement2) + case 7: + sixthElement = parameters.ElementAt(4); + object seventhElement = parameters.ElementAt(5); + if (sixthElement is Action creationElement2) { creationEffect = creationElement2; - holdEffect = sixthElement as Action; + holdEffect = seventhElement as Action; } - else if (fifthElement is Action holdElement2) + else if (sixthElement is Action holdElement2) { - creationEffect = sixthElement as Action; + creationEffect = seventhElement as Action; holdEffect = holdElement2; } else - throw new ArgumentException("The fifth argument to this command must be an Item or Player Action and the sixth must be the other action type."); + throw new ArgumentException("The sixth argument to this command must be an Item or Player Action and the sixth must be the other action type."); break; } @@ -128,33 +135,37 @@ namespace CalamityMod.UI.CalamitasEnchants if (EnchantmentList.Any(enchant => enchant.ID == id) || id == ClearEnchantmentID) throw new ArgumentException("An enchantment with this ID already exists. Another one must be specified."); - EnchantmentList.Add(new Enchantment(name, description, id, creationEffect, holdEffect, requirement)); + EnchantmentList.Add(new Enchantment(name, description, id, iconTexturePathElement, creationEffect, holdEffect, requirement)); } internal static void LoadAllEnchantments() { EnchantmentList = new List { - new Enchantment(UpgradeEnchantName, "Transforms this item into something significantly better.", + new Enchantment(UpgradeEnchantName, "Transforms this item into something significantly stronger.", 1, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed", null, null, item => ItemUpgradeRelationship.ContainsKey(item.type)), - new Enchantment("Cursed", "Summons demons that harm you but drop healing items on death on item usage.", + new Enchantment("Indignant", "Summons demons that harm you but drop healing items on death on item usage.", 100, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant", null, player => player.Calamity().cursedSummonsEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.summon), new Enchantment("Aflame", "Lights enemies ablaze on hit but also causes the user to take damage over time when holding this item.", 200, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame", null, player => player.Calamity().flamingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), new Enchantment("Oblatory", "Reduces mana cost and greatly increases damage but sometimes causes this item to use your life.", 300, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Oblatory", item => { item.damage = (int)(item.damage * 1.5); @@ -165,30 +176,35 @@ namespace CalamityMod.UI.CalamitasEnchants new Enchantment("Resentful", "Makes the damage of projectiles vary based on how far the hit target is from you. The farther, the more damage, and vice versa.", 400, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful", null, player => player.Calamity().farProximityRewardEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), new Enchantment("Bloodthirsty", "Makes the damage of projectiles vary based on how far the hit target is from you. The closer, the more damage, and vice versa.", 500, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty", null, player => player.Calamity().closeProximityRewardEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), new Enchantment("Ephemeral", "Causes the damage output of this item to discharge from exhaustive use. Its damage returns naturally when not being used.", 600, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral", null, player => player.Calamity().dischargingItemEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", 700, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound", null, player => player.Calamity().explosiveMinionsEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.summon), new Enchantment("Tainted", "Removes projectile shooting capabilities of this item. In exchange, two skeletal arms are released on use that slice at the mouse position.", 800, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Tainted", item => item.useTime = item.useAnimation = 25, player => { @@ -219,27 +235,33 @@ namespace CalamityMod.UI.CalamitasEnchants }, item => item.damage > 0 && item.maxStack == 1 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None), - new Enchantment("Treacherous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.", + new Enchantment("Traitorous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.", 900, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous", null, player => player.Calamity().manaMonsterEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), new Enchantment("Withering", "You heal when hurt based on damage dealt. After being hurt, the weapon rapidly drains your life to deal massive damage.", 1000, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered", null, player => player.Calamity().witheringWeaponEnchant = true, item => item.damage > 0 && item.maxStack == 1 && !item.summon), - new Enchantment("Persecuted", "You attract portals which summon demons on hit. The portal must be brought close to death or the demons will attack you. Otherwise they attack enemies.", + new Enchantment("Persecuted", "When attacked, or over time, demon portals appear near you. If sufficiently damaged they are friendly; otherwise they attack you.", 1100, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted", null, player => player.Calamity().persecutedEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), }; // Special disenchantment thing. This is separated from the list on purpose. - ClearEnchantment = new Enchantment("Disenchant", string.Empty, ClearEnchantmentID, + ClearEnchantment = new Enchantment("Disenchant", + string.Empty, + ClearEnchantmentID, + null, item => item.Calamity().AppliedEnchantment = null, item => item.maxStack == 1 && item.shoot >= ProjectileID.None); From ba70ac64e2b0dfaa8a2470d065478bccc6192aad Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 15 Jun 2021 12:36:44 -0500 Subject: [PATCH 42/73] Locus resprite that was missed fsr --- Items/BrimstoneLocus.png | Bin 295 -> 1029 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Items/BrimstoneLocus.png b/Items/BrimstoneLocus.png index fae3b786552cd8d03b5413f9b8d64b7a8511d72e..4f08d4e2d27d7ee2788316bd34907bc9707b4ba6 100644 GIT binary patch delta 1013 zcmVv~nojHN|Lz~| zWpmT)Vmtj{{Lcf<^X~b-@AEw8e}pK0ay(`ubXRsJw5PBCms9f>mk@V^g+f!07@^C+ zJ?a~K5Ue-it^thS4qT4j038esLFR8=yNWocvI<&m6wVZ1+yVXEZ-=U^c#pqzCior5 zN=<_n=@y__15J3x20rwsr8$&!ku?StQeBMv*+95JB7ajp8a;z4_ zoPoHv%a1*Pa#oUgy0v#~FYln8%)k0fq9zpp$f5B;%eWkOr1(dr2~Xce{k>1vkjpGM0V016NNR+C2T@0)7JIfbtMR12UOfL&pDnMlpP=s z@0LKBc|JF=uCp%?4`&H$YM!wn@I~M|AXgiMUi_vIWeE;2^Id(@P@*63d=}^cGtJIQ zTI+kEa^}?zkIbtb9DFc)RuqO0G1y7cz!>+M-rp69(if04>xk zsdz%-dm4Gq^DM}Y5Pnat^Tb270a5XKWZrI>K&(9n)GFk*_epwkm|Kq+99{JIcfMff zCfzzQ>m=H3`2R_Ek@3}Lo&;YXSTE$a7b$v#%COk#N?fdPcye02mHsm1KI8aH;5*>b zb%)MIiWhpyOT5GV-Rj%-f2thTpjik0*$;4L)cH{}j}LM75pTU@E&M+NzTjCfWky2B jEn?Dt delta 273 zcmZqWSk9!_8Q|y6%O%Cdz`(%k>ERLtq~$=EgBeKjyo;MKQBk2@F2EFWRg4~@>L-SRfRT`PXVrs?4IKZm+j$KJV^ zp7zeaB-{VX{`|)(diLxkZ|`w^@338vweERQlh4(dcikHAvKsOgeL{K9oLk(ms#x$~ zRqLX2HR5~UpNhFSlf&rv3s!5sj4F|k-NB}8CvG;*uR6znn@2qL$&$_8K!-4Ry85}S Ib4q9e0Bpc&MF0Q* From 1f95e423013c5a5a278bad8b3cb4cf9ab45c59d3 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 15 Jun 2021 13:38:05 -0500 Subject: [PATCH 43/73] Tainted blade afterimage trail fix --- Effects/FadingSolidTrail.fx | 3 +++ Effects/FadingSolidTrail.xnb | Bin 2036 -> 2576 bytes Projectiles/Melee/TaintedBladeSlasher.cs | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Effects/FadingSolidTrail.fx b/Effects/FadingSolidTrail.fx index dd9efcb37a..5b8427dcff 100644 --- a/Effects/FadingSolidTrail.fx +++ b/Effects/FadingSolidTrail.fx @@ -13,6 +13,7 @@ float3 uLightSource; float2 uImageSize0; float2 uImageSize1; matrix uWorldViewProjection; +float shouldFlip; struct VertexShaderInput { @@ -46,6 +47,8 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { float4 color = input.Color; float2 coords = input.TextureCoordinates; + if (shouldFlip == 1) + coords.y = 1 - coords.y; // Read the fade map as a streak. float4 fadeMapColor = tex2D(uImage1, coords); diff --git a/Effects/FadingSolidTrail.xnb b/Effects/FadingSolidTrail.xnb index 7e0935bda4647b1083ec783ebcaf68ec0d72f999..0d83a614e8e4531647c3403999fa3b9d3190b9b0 100644 GIT binary patch delta 600 zcmYjNyGjE=6umR+#`OUkg5U!|5mJbakH$h#6A}mni5g)A!NLSK5PYDbjTppQ)M-+P z#7?n^q_K$j3I2p1kU~T(c04!P)tu#W&pmVY+}ZuKulg)!Id*J{aQC%!JLq;1z4tWg zVfu&Y(%#GU>$xDcD8A(5SZ!9miWwLT-{b@Yv+#?LdQb=M?olz9EEe{N)VHw^k*sF( z+wM+b|0q92Mp&gfbYd16*|wYqpL1T>=Mww|#VA5^QK~i41$arFnj^9<)tz~{;prS@ zRugMNI!RAQDV|-54a2;JVvU1&#*Ife(I!#6fb}_48r63BC;nW)kGePd<>86?F{kG} z-HRn_DR}?D0RaLYbk;o`p?Er#wGcEe8*gX>XPzFSq?3-fZm?M4&Imel4(VV5bha9_ z%%3;V+RvE>?=%1#(3)t4$P{E(@Y5DxvDn8@6QSrFmf~+(C8G6bEUh@r42hZUi8Sj~ U=&%XasnKwhNLEE 0) { GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/BladeTrailUVMap")); + GameShaders.Misc["CalamityMod:FadingSolidTrail"].Shader.Parameters["shouldFlip"].SetValue((float)(Owner.direction == -1).ToInt()); + Vector2 bottom = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; Vector2 top = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; Vector2 offsetToBlade = (top - bottom).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * 5f; @@ -244,7 +246,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.oldPos[i] == Vector2.Zero) continue; - drawPoints[i] = projectile.Center + perpendicularDirection.RotatedBy(i * -0.014f * Owner.direction) * i * -Owner.direction * 4f; + drawPoints[i] = projectile.Center + perpendicularDirection.RotatedBy(i * -0.014f * Owner.direction) * i * -Owner.direction * 6f; } TrailDrawer.Draw(drawPoints, BladeCenterPosition - projectile.position - Main.screenPosition, 67); From dacc68d3c1f6587b4a629bb8a9704b8ebdfe56a5 Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 15 Jun 2021 15:01:55 -0500 Subject: [PATCH 44/73] Lecherous enchant --- CalPlayer/CalamityPlayer.cs | 3 + NPCs/Other/BrimstoneOrb.cs | 111 ++++++++++++++++++ NPCs/Other/BrimstoneOrb.png | Bin 0 -> 481 bytes NPCs/TownNPCs/WITCH.cs | 19 ++- .../EnchantmentManager.cs | 29 +++++ 5 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 NPCs/Other/BrimstoneOrb.cs create mode 100644 NPCs/Other/BrimstoneOrb.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 69914b73ed..71304aafe8 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1025,6 +1025,8 @@ namespace CalamityMod.CalPlayer public bool persecutedEnchant = false; public int persecutedEnchantSummonTimer = 0; + + public bool lecherousOrbEnchant = false; #endregion Calamitas Enchant Effects #endregion @@ -2020,6 +2022,7 @@ namespace CalamityMod.CalPlayer manaMonsterEnchant = false; witheringWeaponEnchant = false; persecutedEnchant = false; + lecherousOrbEnchant = false; lastProjectileHit = null; diff --git a/NPCs/Other/BrimstoneOrb.cs b/NPCs/Other/BrimstoneOrb.cs new file mode 100644 index 0000000000..2b96ceeae0 --- /dev/null +++ b/NPCs/Other/BrimstoneOrb.cs @@ -0,0 +1,111 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class BrimstoneOrb : ModNPC + { + public ref float Time => ref npc.ai[0]; + public Player Owner + { + get + { + if (npc.target >= 255 || npc.target < 0) + npc.TargetClosest(); + return Main.player[npc.target]; + } + } + public override void SetStaticDefaults() => DisplayName.SetDefault("Brimstone Orb"); + + public override void SetDefaults() + { + npc.width = npc.height = 28; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 97444; + npc.noGravity = true; + npc.noTileCollide = true; + npc.value = 0f; + npc.HitSound = SoundID.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.knockBackResist = 0f; + npc.netAlways = true; + npc.aiStyle = -1; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 97444; + + public override void AI() + { + npc.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + npc.velocity = Vector2.Zero; + + if (Main.myPlayer == npc.target) + { + // Disappear if the player no longer has the enchanted weapon. + if (!Owner.Calamity().lecherousOrbEnchant) + { + npc.active = false; + npc.netUpdate = true; + } + + Vector2 destination = Vector2.Lerp(Owner.Center, Main.MouseWorld, 0.3f); + npc.Center = Vector2.Lerp(npc.Center, destination, 0.035f).MoveTowards(destination, 5f); + if (!npc.WithinRange(destination, 2000f)) + npc.Center = Owner.Center; + + if (npc.Center != destination) + { + npc.netSpam = 0; + npc.netUpdate = true; + } + } + + Time++; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int i = 0; i < 3; i++) + { + Dust magic = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(12f, 12f), 264); + magic.color = Color.Red; + magic.velocity = Main.rand.NextVector2Circular(3f, 3f); + magic.fadeIn = 0.9f; + magic.scale = 1.3f; + magic.noGravity = true; + } + + if (npc.life <= 0) + { + for (int i = 0; i < 15; i++) + { + Dust magic = Dust.NewDustPerfect(npc.Center + Main.rand.NextVector2Circular(12f, 12f), 264); + magic.color = Color.Red; + magic.velocity = Main.rand.NextVector2Circular(6f, 6f); + magic.fadeIn = 1.25f; + magic.scale = Main.rand.NextFloat(1.2f, 1.56f); + magic.noGravity = true; + } + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // Minions do less damage to this project due to the fact that they can attack independantly from the player. + // The intent of this effect is for it to interfere with damage output in exchange for health. + if (projectile.minion) + damage = (int)(damage * 0.35); + } + + public override void NPCLoot() + { + for (int i = 0; i < 8; i++) + DropHelper.DropItem(npc, ItemID.Heart); + } + + public override Color? GetAlpha(Color drawColor) => Color.White * npc.Opacity; + } +} diff --git a/NPCs/Other/BrimstoneOrb.png b/NPCs/Other/BrimstoneOrb.png new file mode 100644 index 0000000000000000000000000000000000000000..680009c5da5117b371cac1f550277a7d0d0252af GIT binary patch literal 481 zcmV<70UrK|P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0d`45K~zXf&6Y7s z13?glPq7FR$QAwoK|zv2L9wxjo!V&W4@hHSp+yS8LM#PA8^II_mNquph@BQ`B!XH5 z!4&ouC!|OrDEoHbA(I=8&Fy_Kyd?*B`!REy8wv(wX>8@oEfcwUzaHpb!!A=p-IX-j z%YV34GW*?vTUj(?|AsW9QSopF*{(h!7dB^+QDqlN!p@al+&&?e4?0L`>d#O!8?C<~ zTkQy0YF!{T{xVJ7u`00000NkvXXu0mjf6=cWe literal 0 HcmV?d00001 diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index c536d20ba6..bff081bc14 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles.Magic; using CalamityMod.UI.CalamitasEnchants; @@ -11,6 +12,7 @@ using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; namespace CalamityMod.NPCs.TownNPCs { @@ -158,9 +160,22 @@ namespace CalamityMod.NPCs.TownNPCs randExtraCooldown = 50; } - //public override void TownNPCAttackMagic(ref float auraLightMultiplier) + public override bool PreAI() + { + // Disappear if the SCal boss is active. She's supposed to be the boss. + // However, this doesn't happen in Boss Rush; the SCal there is a silent puppet created by Xeroc, not SCal herself. + if (NPC.AnyNPCs(NPCType()) && !BossRushEvent.BossRushActive) + { + npc.active = false; + npc.netUpdate = true; + return false; + } + return true; + } - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + //public override void TownNPCAttackMagic(ref float auraLightMultiplier) + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) { projType = ProjectileType(); attackDelay = 1; diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index ba3dddd99c..a1e0e3ce78 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Other; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using System; @@ -255,6 +256,34 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => player.Calamity().persecutedEnchant = true, item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + + new Enchantment("Lecherous", "Spawns a resiliant brimstone orb that stays between you and your mouse that interferes with your homing weapons. It releases a bunch of hearts on death.", + 1200, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Lecherous", + null, + player => + { + player.Calamity().lecherousOrbEnchant = true; + + bool orbIsPresent = false; + int orbType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != orbType || Main.npc[i].target != player.whoAmI || !Main.npc[i].active) + continue; + + orbIsPresent = true; + break; + } + + if (Main.myPlayer == player.whoAmI && !orbIsPresent) + { + int orb = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y - 5, orbType); + if (Main.npc.IndexInRange(orb)) + Main.npc[orb].TargetClosest(); + } + }, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), }; // Special disenchantment thing. This is separated from the list on purpose. From f768f1e8f83c41583f5057742a3a6df09c58643e Mon Sep 17 00:00:00 2001 From: Dominic Date: Tue, 15 Jun 2021 15:02:54 -0500 Subject: [PATCH 45/73] Removed unnecessary code --- NPCs/Other/BrimstoneOrb.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/NPCs/Other/BrimstoneOrb.cs b/NPCs/Other/BrimstoneOrb.cs index 2b96ceeae0..eeefb6705f 100644 --- a/NPCs/Other/BrimstoneOrb.cs +++ b/NPCs/Other/BrimstoneOrb.cs @@ -92,14 +92,6 @@ namespace CalamityMod.NPCs.Other } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - // Minions do less damage to this project due to the fact that they can attack independantly from the player. - // The intent of this effect is for it to interfere with damage output in exchange for health. - if (projectile.minion) - damage = (int)(damage * 0.35); - } - public override void NPCLoot() { for (int i = 0; i < 8; i++) From 5259a83003c1a9ae9569cc4a7c5bee45ea523ba4 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 18 Jun 2021 13:36:13 -0500 Subject: [PATCH 46/73] Start of Exhumed Mechworm --- Buffs/Summon/SepulcherMinionBuff.cs | 36 ++ Buffs/Summon/SepulcherMinionBuff.png | Bin 0 -> 704 bytes CalPlayer/CalamityPlayer.cs | 2 + Items/Weapons/Summon/StaffoftheMechworm2.cs | 48 ++ Items/Weapons/Summon/StaffoftheMechworm2.png | Bin 0 -> 1405 bytes Projectiles/Summon/BrimstoneDartMinion.cs | 58 ++ Projectiles/Summon/SepulcherArm.png | Bin 0 -> 769 bytes Projectiles/Summon/SepulcherForeArm.png | Bin 0 -> 625 bytes Projectiles/Summon/SepulcherHand.png | Bin 0 -> 839 bytes Projectiles/Summon/SepulcherMinion.cs | 519 ++++++++++++++++++ Projectiles/Summon/SepulcherMinionBody.png | Bin 0 -> 1924 bytes Projectiles/Summon/SepulcherMinionBodyAlt.png | Bin 0 -> 2059 bytes Projectiles/Summon/SepulcherMinionHead.png | Bin 0 -> 1768 bytes Projectiles/Summon/SepulcherMinionTail.png | Bin 0 -> 1033 bytes 14 files changed, 663 insertions(+) create mode 100644 Buffs/Summon/SepulcherMinionBuff.cs create mode 100644 Buffs/Summon/SepulcherMinionBuff.png create mode 100644 Items/Weapons/Summon/StaffoftheMechworm2.cs create mode 100644 Items/Weapons/Summon/StaffoftheMechworm2.png create mode 100644 Projectiles/Summon/BrimstoneDartMinion.cs create mode 100644 Projectiles/Summon/SepulcherArm.png create mode 100644 Projectiles/Summon/SepulcherForeArm.png create mode 100644 Projectiles/Summon/SepulcherHand.png create mode 100644 Projectiles/Summon/SepulcherMinion.cs create mode 100644 Projectiles/Summon/SepulcherMinionBody.png create mode 100644 Projectiles/Summon/SepulcherMinionBodyAlt.png create mode 100644 Projectiles/Summon/SepulcherMinionHead.png create mode 100644 Projectiles/Summon/SepulcherMinionTail.png diff --git a/Buffs/Summon/SepulcherMinionBuff.cs b/Buffs/Summon/SepulcherMinionBuff.cs new file mode 100644 index 0000000000..34910472ba --- /dev/null +++ b/Buffs/Summon/SepulcherMinionBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SepulcherMinionBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sepulcher"); + Description.SetDefault("It is not benevolent"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.sepulcher = true; + + if (!modPlayer.sepulcher) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/SepulcherMinionBuff.png b/Buffs/Summon/SepulcherMinionBuff.png new file mode 100644 index 0000000000000000000000000000000000000000..5eeae4fa2bc9a0ad21703d163c051442a004eecb GIT binary patch literal 704 zcmV;x0zdtUP)!3UH8HitVDQT+AopN{_JjsInTV(lRS`bG`|9#CMhc|#)E z*%=35TWG!FuP4s}5RB{rU^e$$@n;g()b;rE7XV%jrvSLa1I5=|0VfBV8zO)kK~rpv zGEBre0Vwug1mJ4a;xCMS1z<_)zQx-LCbPrJe{c()2sP zRc>EwKj7BAxvppWfRh9AhLh2L09qdRC_{<7HDu3-6-yOAPCEc^^Y&ib3Ya+6dJcfT zf>)=ZL@s+N)gcOH+N{0rdXrOrnKmnjw#+puKUqf<^xQOb6fm>ioQ48XD4)5j?uWaM z18yI1XNvVZlhsursJQ|Q`hW@ZWMoEQLKHMRs|nBa0Y`ydM{WS_l#`rTxAh!G~zo0_nA|K%$H6pi)0qky2&Jb%)(7k~i@0Qfr$*WcPM&LrS=LOBtcRZ(*Ve1W-aCT_vx^(PM#$I0000 PendingProjectilesToRespawn = new List(); // Due to the way vanilla summons work, the buff must be applied manually for it to properly register, since @@ -1986,6 +1987,7 @@ namespace CalamityMod.CalPlayer plaguebringerPatronSummon = false; howlTrio = false; mountedScanner = false; + sepulcher = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; diff --git a/Items/Weapons/Summon/StaffoftheMechworm2.cs b/Items/Weapons/Summon/StaffoftheMechworm2.cs new file mode 100644 index 0000000000..1fb6faa386 --- /dev/null +++ b/Items/Weapons/Summon/StaffoftheMechworm2.cs @@ -0,0 +1,48 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class StaffoftheMechworm2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Staff of the Mechworm (But Exhumed!)"); + Tooltip.SetDefault("Summons a sepulcher to fight for you\n" + + "While the sepulcher is active brimstone hearts will begin to appear and orbit you\n" + + "The sepulcher will attempt to attack you more and more frequently depending on how many hearts are present\n" + + "The sepulcher takes up 4 minion slots"); + } + + public override void SetDefaults() + { + item.damage = 666; + item.mana = 15; + item.width = 58; + item.height = 58; + item.useTime = item.useAnimation = 12; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.knockBack = 2f; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.UseSound = SoundID.DD2_BetsySummon; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Summon/StaffoftheMechworm2.png b/Items/Weapons/Summon/StaffoftheMechworm2.png new file mode 100644 index 0000000000000000000000000000000000000000..ffcc7066c041095c029a4ac8652a4ae994d0611d GIT binary patch literal 1405 zcmV-@1%mpCP)@W;98YG}@S@Niel3wi+Q17LDM7R7G&XAc(X^sRex$9|fU`mKH^5 zDku~eT>2sY^EYrlXnO+~x{B!4?ncJZyvxW1$40D;extDzN zZ|7W#B}PNp-2hlO8g z?Qveg7@}dN`U2u1|G}d2Y5*>r8?phm?|2`8%C_6D`Tfx!&j9ej&Nl$4sak|OlPy7x*@8B+%8A8wD?*Pazt+K!v5=F)t63!Nln*sQG?K1!be^>xu z_s9?c$1ctR(7B-rfTq*x`x1M^u;8V$0L+AXA7h9{+8Pqovn=yj09pB~Y=GP9>H&E2 z)P4Xquh;;VcnXL#MWOdJ;n)%Cl4UMp4ADp%L%il3LhFlL0jSti;yS*qs|;|= z=n9-r$5Dnn@!sbEY~A^4%=1c@EEq#H(#DVoTwQ2c?OhhYk$rn?fL4?#54Nud;9bT6 zIJ$QPfKn~{NH!9r=kdZAqLDU+$V^mz(-AXJWrh|*4tD;E$Lqa`Dj35R4%j zNi#&RL?x@NEGz_Ic5>VXsJiEA00tkf1)%sRRcE}gUd=UP%uHk6gO>sEFotNP!VuSQ zKC4jG4fj8;>IJDl_r7%yfYQ|}yU6@P>Wc_suHxS)#t@B^)gk)2NW~_#k3%X@sXT{| ztIx}1YeuVR7aL=UM$!z?dlfO`saGBVoL-~n@BsjFi_0v4*-4dUWahb8vBC>uh(^K< zk?fLRQVPKAWi=bs*IuP}=?-NPzc%Yk7RC^bgw-KpMrCsY0HeKquDQm~->X;=qpomW zn=vHCEP4#_GUM6Z?*Q<{HuYLiu|}nwx%yV9*M&gLU41gY$h}$Z>zEo- zD{JX$hF}cQ@Qfi|JBWpxmH8Gxz*44&8G275bw;|IAs9n6qGE{GQwLtpo5=BG%{&v0 zF+?NEkjAQ30PKHfVrCDC5whQNN81(vatewqfI0uPI?+PFbzWmgh7!&);Z^w1Q;hPg znjm}1D?>9-eJ9S`)TCsgjEWgL#t@Bg4Dnip7c*q9mi}JQ*IJDsON4L?sVb-gV0fw@ z@P58k_G}5VLq~SzTsSwBfXhrC#t;qb`Ib)ssL!4SAUC_j250YhWBW^hcSWl2=F8OB zAs9n6eC6580XR9IYXfvPsP0zwjtde~!mIG1Cy "CalamityMod/Projectiles/Boss/BrimstoneBarrage"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimfire"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionShot[projectile.type] = true; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 18; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 300; + projectile.penetrate = 1; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.alpha = 255; + } + + public override void AI() + { + projectile.frameCounter++; + projectile.frame = projectile.frameCounter / 5 % Main.projFrames[projectile.type]; + projectile.Opacity = Utils.InverseLerp(300f, 285f, projectile.timeLeft, true) * Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (projectile.velocity.Length() < 35f) + projectile.velocity *= 1.036f; + + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 600); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + lightColor.R = (byte)(255 * projectile.Opacity); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Summon/SepulcherArm.png b/Projectiles/Summon/SepulcherArm.png new file mode 100644 index 0000000000000000000000000000000000000000..b45111f2065293ffdd8a1711e4dfab68e0bd55bf GIT binary patch literal 769 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^^%yud6L*UUm78h`=9Qf^Z9%~KQFcw9zEXJw(j$*1pqp|ww|?b z-ngj%s+SiUV866!y%*_`0ywUp1MvC068pWBZy^6$E4~M{C<36A$!LI1uMNP1JNs6< zuiuX}z>B;0WBWNcJr;s0X&~VfiS!77la3+r^5IkKd9z-&p1b;SQD15x;S*^Mhp~1c zA$qpG3&5w}zbyM< z)d!IVD5ldUZaiedCnD;OMpm@=B)(F1?DF18r=3`H!Y5Kpr-5mP6WFUs1~wfoj5uOHb2-+VLGxiuVwMPx2&goLa!MDnMu-F==_DFx8ilT55( zO2Cbxt!x$unTSa8gX;s&OD38=Hu}K4Pt1@2AeS*` z+$B85%EaLkachg*XH@(F$E1pmcY4*>R#RP{Q$@+7#g&W#XpQ%*qDaRs<|itq7j7C8 z6%-L`@>_#QF0H)ruN4dt?^$2LQ!QtzwR=jSz#kQh6bzB&&(J)i{#L;d`2*$yEw2+b Ri?9Fy002ovPDHLkV1hBPfvW%j literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs new file mode 100644 index 0000000000..50abfd7e2c --- /dev/null +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -0,0 +1,519 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SepulcherMinion : ModProjectile + { + public struct SepulcherSegment + { + public Vector2 CurrentPosition; + public float Rotation; + public SepulcherSegment(Vector2 position, float rotation) + { + CurrentPosition = position; + Rotation = rotation; + } + } + + public class SepulcherArm + { + public class SepulcherArmLimb + { + public Vector2 Center; + public float Rotation; + + public SepulcherArmLimb(Vector2 center, float rotation) + { + Center = center; + Rotation = rotation; + } + + public void SendData(BinaryWriter writer) + { + writer.WritePackedVector2(Center); + writer.Write(Rotation); + } + + public static SepulcherArmLimb ReceiveData(BinaryReader reader) => new SepulcherArmLimb(reader.ReadPackedVector2(), reader.ReadSingle()); + } + + public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[2]; + public byte SegmentIndexToAttachTo; + public Vector2 Center; + public float Rotation; + public bool ReelingBack = false; + public bool Direction; + public SepulcherArm(Vector2 center, byte segmentIndexToAttachTo, float rotation, bool reelingBack, bool direction) + { + Center = center; + SegmentIndexToAttachTo = segmentIndexToAttachTo; + Rotation = rotation; + ReelingBack = reelingBack; + Direction = direction; + Limbs = new SepulcherArmLimb[2] + { + new SepulcherArmLimb(center, rotation), + new SepulcherArmLimb(center, rotation) + }; + } + } + + public enum AIState + { + HoverNearOwner, + AttackEnemy_Charge, + AttackEnemy_ReleaseDartBurst, + AttackOwner + } + + public int IdleTimer; + public int AttackTimer; + public int PlayerAttackCountdown; + public SepulcherSegment[] Segments = new SepulcherSegment[24]; + public List Arms = new List(); + public Player Owner => Main.player[projectile.owner]; + public AIState CurrentAIState + { + get => (AIState)(int)projectile.ai[0]; + set + { + // Don't do anything unless the caller is the owner of this projectile- changes will be synced to other clients in MP. + if (Main.myPlayer != projectile.owner) + return; + + projectile.ai[0] = (int)value; + projectile.netUpdate = true; + } + } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.netImportant = true; + projectile.penetrate = -1; + projectile.minionSlots = 4f; + projectile.timeLeft = 90000; + projectile.Opacity = 0f; + projectile.tileCollide = false; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + projectile.scale = 1.35f; + projectile.hide = true; + } + + #region Syncing + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(IdleTimer); + writer.Write(PlayerAttackCountdown); + writer.Write(Arms.Count); + for (int i = 0; i < Arms.Count; i++) + { + writer.WritePackedVector2(Arms[i].Center); + writer.Write(Arms[i].SegmentIndexToAttachTo); + writer.Write(Arms[i].Rotation); + writer.Write(Arms[i].ReelingBack); + writer.Write(Arms[i].Direction); + Arms[0].Limbs[0].SendData(writer); + Arms[0].Limbs[1].SendData(writer); + } + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + IdleTimer = reader.ReadInt32(); + PlayerAttackCountdown = reader.ReadInt32(); + Arms.Clear(); + for (int i = 0; i < reader.ReadInt32(); i++) + { + Arms.Add(new SepulcherArm(reader.ReadPackedVector2(), reader.ReadByte(), reader.ReadSingle(), reader.ReadBoolean(), reader.ReadBoolean())); + Arms.Last().Limbs[0] = SepulcherArm.SepulcherArmLimb.ReceiveData(reader); + Arms.Last().Limbs[1] = SepulcherArm.SepulcherArmLimb.ReceiveData(reader); + } + } + #endregion + + #region AI + public override void AI() + { + Initialize(); + HandleBuffs(); + HandleFlexibleDamage(); + UpdateSegments(); + + // Fade in rapidly. + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.2f, 0f, 1f); + + NPC potentialTarget = AttemptToFindTarget(1450f); + + // Enter the attack state if a valid enemy is found and go back to hovering otherwise. + // This will be overriden if attacking the owner. + if (CurrentAIState != AIState.AttackEnemy_ReleaseDartBurst && CurrentAIState != AIState.AttackEnemy_Charge) + { + if (potentialTarget != null) + CurrentAIState = AIState.AttackEnemy_ReleaseDartBurst; + } + else if (potentialTarget is null) + { + CurrentAIState = AIState.HoverNearOwner; + AttackTimer = 0; + } + + // Reset the AI to player attack mode if the countdown is going on. + if (PlayerAttackCountdown > 0) + { + if (CurrentAIState != AIState.AttackOwner) + CurrentAIState = AIState.AttackOwner; + + PlayerAttackCountdown--; + + // If it's finished, go back to idle owner hover movement. + if (PlayerAttackCountdown <= 0) + CurrentAIState = AIState.HoverNearOwner; + } + + switch (CurrentAIState) + { + case AIState.HoverNearOwner: + HoverNearOwner(); + break; + case AIState.AttackEnemy_ReleaseDartBurst: + AttackEnemyWithDarts(potentialTarget); + AttackTimer++; + break; + case AIState.AttackEnemy_Charge: + AttackEnemyByCharging(potentialTarget); + AttackTimer++; + break; + } + + // Check if ready to enrage every so often. + IdleTimer++; + if (IdleTimer % 600 == 599) + { + float chanceToBecomeAngry = 0f; + if (Main.rand.NextFloat() < chanceToBecomeAngry) + { + PlayerAttackCountdown = 300; + projectile.netUpdate = true; + } + } + } + + public void Initialize() + { + if (projectile.localAI[0] != 0f) + return; + + for (int i = 0; i < Segments.Length; i++) + Segments[i].CurrentPosition = projectile.Center - projectile.velocity.SafeNormalize(Vector2.UnitY) * i * 0.2f; + + projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + if (Main.myPlayer == projectile.owner) + { + float rotationalOffset = 0f; + for (byte i = 3; i < Segments.Length - 2; i += 2) + { + Arms.Add(new SepulcherArm(Segments[i].CurrentPosition, i, rotationalOffset, false, false)); + rotationalOffset = MathHelper.WrapAngle(rotationalOffset + MathHelper.Pi / 6f); + + Arms.Add(new SepulcherArm(Segments[i].CurrentPosition, i, rotationalOffset + MathHelper.Pi, false, true)); + rotationalOffset = MathHelper.WrapAngle(rotationalOffset + MathHelper.Pi / 6f); + } + projectile.netUpdate = true; + } + } + + public void HandleBuffs() + { + // Maintain or remove the Mechworm buff from the owner. + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Owner.dead) + Owner.Calamity().sepulcher = false; + if (Owner.Calamity().sepulcher) + projectile.timeLeft = 2; + } + + public void HandleFlexibleDamage() + { + // Adjust the damage of this projectile if the owner's current minion damage factor has changed for any reason. + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + projectile.damage = trueDamage; + } + } + + public void UpdateSegments() + { + float aheadRotation = projectile.rotation; + Vector2 aheadPosition = projectile.Center; + + // Connect all segments to each-other and calculate their rotations. + for (int i = 0; i < Segments.Length; i++) + { + Vector2 offsetToDestination = aheadPosition - Segments[i].CurrentPosition; + // This variant of segment attachment incorporates rotation. + // Given the fact that all segments will execute this code is succession, the + // result across the entire worm will exponentially decay over each segment, + // allowing for smooth rotations. This code is what the stardust dragon uses for its segmenting. + if (aheadRotation != Segments[i].Rotation) + { + float angleOffset = MathHelper.WrapAngle(aheadRotation - Segments[i].Rotation.AngleLerp(aheadRotation, 0.08f)); + offsetToDestination = offsetToDestination.RotatedBy(angleOffset * 0.08f); + } + + Segments[i].Rotation = (aheadPosition - Segments[i].CurrentPosition).ToRotation() + MathHelper.PiOver2; + Segments[i].CurrentPosition = aheadPosition - offsetToDestination.SafeNormalize(Vector2.Zero) * 60f; + + // Adjust the ahead positions before interating further. + aheadPosition = Segments[i].CurrentPosition; + aheadRotation = Segments[i].Rotation; + } + + // Adjust the arms. + for (int i = 0; i < Arms.Count; i++) + { + SepulcherSegment segmentToAttachTo = Segments[Arms[i].SegmentIndexToAttachTo]; + Vector2 idealMovePosition = segmentToAttachTo.CurrentPosition; + float sideFactor = MathHelper.Lerp(200f, 18f, Utils.InverseLerp(-0.51f, -0.06f, Arms[i].Rotation, true)); + float aheadFactor = MathHelper.Lerp(284f, 680f, Utils.InverseLerp(-0.51f, -0.06f, Arms[i].Rotation, true)); + int direction = Arms[i].Direction.ToDirectionInt(); + idealMovePosition += (segmentToAttachTo.Rotation + Arms[i].Rotation * direction - MathHelper.PiOver2).ToRotationVector2() * projectile.scale * aheadFactor; + idealMovePosition += (segmentToAttachTo.Rotation + Arms[i].Rotation * direction - MathHelper.PiOver2 + MathHelper.PiOver2 * direction).ToRotationVector2() * projectile.scale * sideFactor; + Arms[i].Center = idealMovePosition; + + Vector2 offsetFromSegment = Vector2.Zero; + + offsetFromSegment += new Vector2(direction * 60f, 55f).RotatedBy(segmentToAttachTo.Rotation - (MathHelper.PiOver2 - Arms[i].Rotation * 1.7f - 0.77f) * direction).SafeNormalize(Vector2.UnitY) * 82f; + Arms[i].Limbs[0].Center = segmentToAttachTo.CurrentPosition + offsetFromSegment; + Arms[i].Limbs[0].Rotation = offsetFromSegment.ToRotation(); + + Arms[i].Limbs[1].Rotation = (Arms[i].Center - Arms[i].Limbs[0].Center).ToRotation(); + Arms[i].Limbs[1].Center = Arms[i].Limbs[0].Center + offsetFromSegment * 0.5f + (Arms[i].Center - Arms[i].Limbs[0].Center).SafeNormalize(Vector2.UnitY) * 84f; + + float rotationalVelocityFactor = Utils.InverseLerp(0f, 6f, projectile.velocity.Length(), true); + if (CurrentAIState == AIState.AttackEnemy_Charge) + rotationalVelocityFactor *= 0.85f; + + if (Arms[i].ReelingBack) + { + Arms[i].Rotation -= rotationalVelocityFactor * 0.066f; + if (Arms[i].Rotation < -0.55f) + Arms[i].ReelingBack = false; + } + else + { + Arms[i].Rotation += rotationalVelocityFactor * 0.029f; + if (Arms[i].Rotation > 0.77f) + Arms[i].ReelingBack = true; + } + } + } + + public void HoverNearOwner() + { + // Teleport to the owner if it's very far away. + if (!projectile.WithinRange(Owner.Center, 3200f)) + { + projectile.Center = Owner.Center; + projectile.velocity = Main.rand.NextVector2CircularEdge(4f, 4f); + projectile.netUpdate = true; + } + + // Attempt to move towards the owner. + if (!projectile.WithinRange(Owner.Center, 540f)) + { + Vector2 destination = Owner.Center + (IdleTimer / 31f).ToRotationVector2() * 240f; + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 18f, 0.03f); + + float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.04f); + projectile.velocity = updatedDirectionRotation.ToRotationVector2() * projectile.velocity.Length(); + } + else if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.03f; + + // Determine the head rotation. + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public void AttackEnemyWithDarts(NPC target) + { + Vector2 destination = target.Center + ((AttackTimer / 20f).ToRotationVector2() * 320f); + + // Step towards the ideal velocity with an acceleration of 1 pixel/second^2. + projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(destination) * 24f, 1f); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + // Release a burst of darts from all segments at the target. + if (Main.myPlayer == projectile.owner && AttackTimer % 60 > 60 - Segments.Length) + { + int segmentToFireFrom = 60 - AttackTimer % 60; + Vector2 spawnPosition = Segments[segmentToFireFrom].CurrentPosition; + Vector2 shootVelocity = (target.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * 8f; + Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack, projectile.owner); + } + + if (Main.myPlayer == projectile.owner && AttackTimer > 430) + { + CurrentAIState = AIState.AttackEnemy_Charge; + AttackTimer = 0; + } + } + + public void AttackEnemyByCharging(NPC target) + { + if (!projectile.WithinRange(target.Center, 350f)) + { + Vector2 destination = target.Center + (AttackTimer / 25f).ToRotationVector2() * MathHelper.Min(target.width * 0.35f, 150f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 34f, 0.05f); + + float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.07f); + projectile.velocity = updatedDirectionRotation.ToRotationVector2() * projectile.velocity.Length(); + } + else if (projectile.velocity.Length() < 21f) + projectile.velocity *= 1.035f; + + // Determine the head rotation. + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Main.myPlayer == projectile.owner && AttackTimer > 280) + { + CurrentAIState = AIState.AttackEnemy_ReleaseDartBurst; + AttackTimer = 0; + } + } + + public NPC AttemptToFindTarget(float searchDistance) + { + NPC closestTarget = null; + + if (Owner.HasMinionAttackTargetNPC) + { + NPC targetedNPC = Main.npc[Owner.MinionAttackTargetNPC]; + if (targetedNPC.WithinRange(projectile.Center, searchDistance) && targetedNPC.CanBeChasedBy()) + return targetedNPC; + } + + float distance = searchDistance * searchDistance; + for (int index = 0; index < Main.maxNPCs; index++) + { + if (Main.npc[index].CanBeChasedBy()) + { + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + if (Main.npc[index].WithinRange(projectile.Center, distance + extraDistance)) + { + distance = Main.npc[index].DistanceSQ(projectile.Center); + closestTarget = Main.npc[index]; + } + } + } + + return closestTarget; + } + + #endregion + + #region Drawing + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D headTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionHead"); + Texture2D bodyTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionBody"); + Texture2D bodyTexture2 = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionBodyAlt"); + Texture2D tailTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionTail"); + Texture2D armTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherArm"); + Texture2D foreArmTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherForeArm"); + Texture2D handTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherHand"); + + Vector2 drawPosition; + + // Draw arms. + for (int i = 0; i < Arms.Count; i++) + { + Vector2 forearmDrawPosition = Arms[i].Limbs[0].Center - Main.screenPosition; + Color drawColor = Lighting.GetColor((int)(Arms[i].Limbs[0].Center.X / 16), (int)(Arms[i].Limbs[0].Center.Y / 16)); + spriteBatch.Draw(foreArmTexture, forearmDrawPosition, null, drawColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + + Vector2 armDrawPosition = Arms[i].Limbs[1].Center - Main.screenPosition; + drawColor = Lighting.GetColor((int)(Arms[i].Limbs[1].Center.X / 16), (int)(Arms[i].Limbs[1].Center.Y / 16)); + spriteBatch.Draw(armTexture, armDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, SpriteEffects.FlipVertically, 0f); + + Vector2 handDrawPosition = armDrawPosition; + SpriteEffects handDirection = Arms[i].Direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + spriteBatch.Draw(handTexture, handDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, handDirection, 0f); + } + + for (int i = 0; i < Segments.Length; i++) + { + Texture2D textureToUse = i % 2 == 1 ? bodyTexture2 : bodyTexture; + + // Use the tail texture for the last segment. + if (i == Segments.Length - 1) + textureToUse = tailTexture; + + drawPosition = Segments[i].CurrentPosition - Main.screenPosition; + lightColor = Lighting.GetColor((int)(drawPosition.X + Main.screenPosition.X) / 16, (int)(drawPosition.Y + Main.screenPosition.Y) / 16); + spriteBatch.Draw(textureToUse, drawPosition, null, projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + + drawPosition = projectile.Center - Main.screenPosition; + lightColor = Lighting.GetColor((int)(drawPosition.X + Main.screenPosition.X) / 16, (int)(drawPosition.Y + Main.screenPosition.Y) / 16); + spriteBatch.Draw(headTexture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, headTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // If default collision is possible return true immediately. + if (projHitbox.Intersects(targetHitbox)) + return true; + + // Check based on segments. + for (int i = 0; i < Segments.Length; i++) + { + if (Utils.CenteredRectangle(Segments[i].CurrentPosition, Vector2.One * 52f).Intersects(targetHitbox)) + return true; + } + + // And finally arm hands. + for (int i = 0; i < Arms.Count; i++) + { + if (Utils.CenteredRectangle(Arms[i].Center, Vector2.One * 32f).Intersects(targetHitbox)) + return true; + } + + return false; + } + + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindProjectiles.Add(index); + } + + #endregion + } +} diff --git a/Projectiles/Summon/SepulcherMinionBody.png b/Projectiles/Summon/SepulcherMinionBody.png new file mode 100644 index 0000000000000000000000000000000000000000..5e8b75333ef4e7beb6b6b9b19646e550aa3167ea GIT binary patch literal 1924 zcmeAS@N?(olHy`uVBq!ia0vp^And`x3}WpM3IS4##X;^)4C~IxyaaMs(j9#r85lP9 zbN@+XWnf@t2=EDU1&VWV@yhe*YYU6pXiIA=D0s6AyC`aes_10!@)jD~xQTcK8ak#2 zXtXFxwip?$F>&oH*8kz@xo@KR|L*MfhwA_T`wcW?6pV(zPz(VvHU=?ZK4B;c@(cby zvH?TzcXm}^9C8+TL>4nJa0`PlBg3pY62QWO(bL5-B*OjZjJMlnD+su9OKhz>GV9Xs zfB99fzZtkDUy2uh7pcv4=8PYk+tEKiYE~CcE?!wYp*SMwdFv|$&W94_l9%3Y+7=mC zpQ@|E_*yFYvH+7#%Q|kyi08A^j+IW0=dxPCc4=qjvA^Hd1T=CsEmnEG>)dD2C~nU~ zXVsdF-Gbt;E&FNrWEYp(mrXYgHN4)HYABMvOoR1bu&2soe~o}9>w~jn&F?h2m zb+OPr%b+!rPSlBWK3vABE~C=jWN~|js&7kDwnC(WqTwu#6dm!2$9%*NKAPgLReEN@ zQ=h~ON|B<1obz)Ru$U(3F1g*^aY%yAJJ{8w`=3EVs9-I-knqye?gC8Txo)ZQi2d9U zBR1W^b)r|p7K?J()`i@CkDjR=Jnoiq^m0&r<^CxTyC*JjJMngzLe(#UCHhy~Pu%9s zU-U}B^yH4qVm2&t|D%NZt|cWaSZ6-=*VYg4RB8V8v1-M?nrW)VN}X_L(>>)-zl7(JOFzqT zt`wQnefsz3ZUc|sleX=>pZw=X$H%(-=txfc-~EffPw-M~{B+%^PT}FD@0D7&zCG7t zY_-W_+hN(ou$E;KBg3~D6I#w3?ay{gsC09>;GwDF?4ICu%Jb{lthZ zl|IetSDpKmJ3l6U|MUF0#ivc}=geoViSlsKSnn0CvOeJY`ctbqRc3q%daj^4*Gm7( d(-Y^sfUdH*Z)fe*L!Zjms-vPvgtKn^&p#JMjF$XFp9it|wx za3l$5#zshICjMeIy|gc4Z`_L-oQV;yj)8ZozW8Q75%+oF!miWIp%B?Y*)v0+)>Y-i4{ef;~YM0#Q*+N2^ZacoZYm{aLu#}&&S(tPGiV!T=*mW$fA%N5j)PwYDDx&2Iz4Axf!7% zaCo!M5=o}M&n=w^Eldv?I_y6OC$T=2+hFxVwQ=>UqCkNepKWpq{M?lS5_287nYNjA zU(aD!et6dFwbOT=bJS1gl_}Z3e~(R@qUbdzgFcJ8y>WUzrfYts7N;&;$dd@Q;jKW8xlXWOtaM7=*xU)nZe1Om3^lj+xKixT6W>E2(l^stwe$m1`X-p_xqJn@q_z_@ja*6DT38cUBboi*}Sp1fhx z4K3@OY3JCN9&1}-zEUHFQ-(crbxFjs4~p)W*86rdi8aQZ&7Z=h{oO+$?q1|Jvuexh zrTd+adbP72PrneZ)4JR4kK@V>QyA;lJUX1)J@@(g{|!H<1|>44-~7q*ttM{vzsQ#x jgrv94`oA!C!}s6*CRcXX1@2ds0u`;Eu6{1-oD!M<7#!iq literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/SepulcherMinionHead.png b/Projectiles/Summon/SepulcherMinionHead.png new file mode 100644 index 0000000000000000000000000000000000000000..ce918150f1e3334acb2269f120379bbaccd2d7c1 GIT binary patch literal 1768 zcmVP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ9427O6HK~#8N?VMX| z6jdC?*&?@UfwtB{st6*WpdwXYphk!Z5Q8R~DDfH}jLM^i2Te2tn-Vg(eX5Jdd0jOZGUFPDN`71r;~~^(W#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-Z23)mX_Uz~1;j<_1w8e1+{i7@3}X)qOPtfuA<157brJ~VaG00000NkvXXu0mjf D2Dj?t literal 0 HcmV?d00001 From 1dc5ace76c95968fcb276849bc73cbc75df828d0 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Tue, 22 Jun 2021 04:54:03 +0200 Subject: [PATCH 47/73] Exhumed mechworm enrage behavior --- NPCs/Other/ExhumedHeart.cs | 66 ++++++ NPCs/Other/ExhumedHeart.png | Bin 0 -> 2249 bytes Projectiles/Summon/SepulcherMinion.cs | 225 ++++++++++++++++++--- Projectiles/Summon/SepulcherMinionEyes.png | Bin 0 -> 252 bytes Projectiles/Summon/SepulcherMinionHead.png | Bin 1768 -> 752 bytes Projectiles/Summon/SepulcherMinionJaw.png | Bin 0 -> 295 bytes 6 files changed, 264 insertions(+), 27 deletions(-) create mode 100644 NPCs/Other/ExhumedHeart.cs create mode 100644 NPCs/Other/ExhumedHeart.png create mode 100644 Projectiles/Summon/SepulcherMinionEyes.png create mode 100644 Projectiles/Summon/SepulcherMinionJaw.png diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs new file mode 100644 index 0000000000..f1fdb578b3 --- /dev/null +++ b/NPCs/Other/ExhumedHeart.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class ExhumedHeart : ModNPC + { + public ref float Time => ref npc.ai[0]; + public Player Owner + { + get + { + if (npc.target >= 255 || npc.target < 0) + npc.TargetClosest(); + return Main.player[npc.target]; + } + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exhumed Brimstone Heart"); + Main.npcFrameCount[npc.type] = 6; + } + + public override void SetDefaults() + { + npc.width = npc.height = 38; + npc.damage = 0; + npc.defense = 0; + npc.lifeMax = 51740; + npc.noGravity = true; + npc.noTileCollide = true; + npc.value = 0f; + npc.HitSound = SoundID.NPCHit13; + npc.DeathSound = SoundID.NPCDeath1; + npc.knockBackResist = 0f; + npc.netAlways = true; + npc.aiStyle = -1; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 51740; + + public override void AI() + { + npc.Opacity = Utils.InverseLerp(0f, 25f, Time, true); + npc.Center = Owner.Center + (MathHelper.TwoPi * Time / 540f).ToRotationVector2() * 350f; + npc.velocity = Vector2.Zero; + + Time++; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + npc.frame.Y = (int)(npc.frameCounter / 5) % Main.npcFrameCount[npc.type] * frameHeight; + } + + public override Color? GetAlpha(Color drawColor) + { + Color color = Color.Purple * npc.Opacity; + color.A = 127; + return color; + } + } +} diff --git a/NPCs/Other/ExhumedHeart.png b/NPCs/Other/ExhumedHeart.png new file mode 100644 index 0000000000000000000000000000000000000000..c597cfe505dbc26ebfb4a17f3d193fbd257e9d06 GIT binary patch literal 2249 zcmV;)2sZbLP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA2wq77TRiM6&tOrOeF}~i580f1)C5MBnAWiBB zVk6P|8u^a<$oiV^o-;F>$ei;&FiduL?z;Ec?|yUUoOjoaF~%5U%mVJ&?(Z0{9-O$f z{b%8Wqdyn@H&1N$t6}zUi@Ar6PLvfl3uHP!#$%C6^3-hs^J@xP=wpPZgVeEW!lzpv>^lw){S+93sPA1aU-_==4>y05J?{X| z$NgEi=-2Sun@5T|H40}QJyZ77D5ll$CtrS1_S86Fy4H{TGpscWn8vI^t#X`p1MR(> z0il1x+GiEaK5_1;vWIsseYE}8-{?D`eOS@4hSI-bYB4jX=D)rAb=hZ3J@fTrm~kxq z5z~4m1MRn3+n;^@aoNA{{L5vJdF|WKzhO|*&|2G=#xVB-{TgbcwtfwBO_rfGn2jN_ zQ6A&z@y5eySg$M~GY9%}IyM>iiUY%EHusj>fDuK_fgaCswJQvzKf|E4tmk~tTGr!u zoZGE4KG45mYFWF1_F*-wOs!q$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H6-|Bf zu5i1xJHR+K4AgS1ruFfu-2wWqVW5`DT-MU8diC5o)1!=Q7&6naG>bWoVPLMUHL2Y? z|Bx}BVLkI@-}t<*9P#Q5FMh#cEVgV^mfb&>@oHGng!bG~S;p!N8)J+y#u#JFon!CU zbPDqpFx)bRI^lwAO>&GzTSo$NT^-KoZ zZ)^Es%xm9<{tbhghOD+T)0!WKsX5|)4QI)0$hrq)=~if6?eE{PURgk94)o`AY%=Z@ zhZ@#1k)q~6kLS3l`L)#*@nazOX_Dz2^47Gl&eHe6%0MvBroEr3N81x!1 z`@gt@n&-CDt*v0ZHRbB;c+?YZ#opG{%?-Y&L%Z X3?`!v=}~JZ00000NkvXXu0mjf2HlQ} literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 50abfd7e2c..7635085c33 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Summon; +using CalamityMod.NPCs.Other; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -93,19 +95,24 @@ namespace CalamityMod.Projectiles.Summon projectile.netUpdate = true; } } + public ref float JawRotation => ref projectile.localAI[0]; + public ref float JawSnapTimer => ref projectile.localAI[1]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Sepulcher"); + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() { - projectile.width = 24; - projectile.height = 24; + projectile.width = 54; + projectile.height = 54; projectile.friendly = true; projectile.ignoreWater = true; projectile.netImportant = true; @@ -117,7 +124,6 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - projectile.scale = 1.35f; projectile.hide = true; } @@ -192,6 +198,10 @@ namespace CalamityMod.Projectiles.Summon CurrentAIState = AIState.HoverNearOwner; } + + // Determine whether the projectile can attack its owner based on the attakc countdown. + projectile.hostile = PlayerAttackCountdown > 0; + switch (CurrentAIState) { case AIState.HoverNearOwner: @@ -205,24 +215,48 @@ namespace CalamityMod.Projectiles.Summon AttackEnemyByCharging(potentialTarget); AttackTimer++; break; + case AIState.AttackOwner: + AttackOwner(); + break; } // Check if ready to enrage every so often. IdleTimer++; if (IdleTimer % 600 == 599) { + int heartsAttachedToOwner = 0; + int heartType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != heartType || !Main.npc[i].active || Main.npc[i].target != projectile.owner) + continue; + heartsAttachedToOwner++; + } + float chanceToBecomeAngry = 0f; + if (heartsAttachedToOwner >= 2) + chanceToBecomeAngry = Utils.InverseLerp(2f, 6f, heartsAttachedToOwner, true); if (Main.rand.NextFloat() < chanceToBecomeAngry) { PlayerAttackCountdown = 300; projectile.netUpdate = true; } + else if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)Owner.Center.X, (int)Owner.Center.Y, heartType); } + + if (JawSnapTimer > 0f) + { + JawRotation = JawRotation.AngleTowards(-0.44f, 0.064f); + JawSnapTimer--; + } + else + JawRotation = JawRotation.AngleTowards(0f, 0.03f); } public void Initialize() { - if (projectile.localAI[0] != 0f) + if (projectile.ai[1] != 0f) return; for (int i = 0; i < Segments.Length; i++) @@ -230,7 +264,7 @@ namespace CalamityMod.Projectiles.Summon projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - projectile.localAI[0] = 1f; + projectile.ai[1] = 1f; if (Main.myPlayer == projectile.owner) { float rotationalOffset = 0f; @@ -286,7 +320,7 @@ namespace CalamityMod.Projectiles.Summon } Segments[i].Rotation = (aheadPosition - Segments[i].CurrentPosition).ToRotation() + MathHelper.PiOver2; - Segments[i].CurrentPosition = aheadPosition - offsetToDestination.SafeNormalize(Vector2.Zero) * 60f; + Segments[i].CurrentPosition = aheadPosition - offsetToDestination.SafeNormalize(Vector2.Zero) * 48f; // Adjust the ahead positions before interating further. aheadPosition = Segments[i].CurrentPosition; @@ -307,16 +341,18 @@ namespace CalamityMod.Projectiles.Summon Vector2 offsetFromSegment = Vector2.Zero; - offsetFromSegment += new Vector2(direction * 60f, 55f).RotatedBy(segmentToAttachTo.Rotation - (MathHelper.PiOver2 - Arms[i].Rotation * 1.7f - 0.77f) * direction).SafeNormalize(Vector2.UnitY) * 82f; + offsetFromSegment += new Vector2(direction * 35f, 28f).RotatedBy(segmentToAttachTo.Rotation - (MathHelper.PiOver2 - Arms[i].Rotation * 1.7f - 0.77f) * direction).SafeNormalize(Vector2.UnitY) * 62f; Arms[i].Limbs[0].Center = segmentToAttachTo.CurrentPosition + offsetFromSegment; Arms[i].Limbs[0].Rotation = offsetFromSegment.ToRotation(); Arms[i].Limbs[1].Rotation = (Arms[i].Center - Arms[i].Limbs[0].Center).ToRotation(); - Arms[i].Limbs[1].Center = Arms[i].Limbs[0].Center + offsetFromSegment * 0.5f + (Arms[i].Center - Arms[i].Limbs[0].Center).SafeNormalize(Vector2.UnitY) * 84f; + Arms[i].Limbs[1].Center = Arms[i].Limbs[0].Center + offsetFromSegment * 0.5f + (Arms[i].Center - Arms[i].Limbs[0].Center).SafeNormalize(Vector2.UnitY) * 64f; float rotationalVelocityFactor = Utils.InverseLerp(0f, 6f, projectile.velocity.Length(), true); if (CurrentAIState == AIState.AttackEnemy_Charge) rotationalVelocityFactor *= 0.85f; + if (CurrentAIState == AIState.AttackOwner) + rotationalVelocityFactor *= 1.2f; if (Arms[i].ReelingBack) { @@ -388,46 +424,97 @@ namespace CalamityMod.Projectiles.Summon if (!projectile.WithinRange(target.Center, 350f)) { Vector2 destination = target.Center + (AttackTimer / 25f).ToRotationVector2() * MathHelper.Min(target.width * 0.35f, 150f); - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 34f, 0.05f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 34f, 0.08f); - float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.07f); + float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.12f); projectile.velocity = updatedDirectionRotation.ToRotationVector2() * projectile.velocity.Length(); } - else if (projectile.velocity.Length() < 21f) + else if (projectile.velocity.Length() < 29f) + { projectile.velocity *= 1.035f; + if (JawSnapTimer <= 0f) + { + // Open the mouth of the jaw if close but not super close to the target. + if (projectile.WithinRange(target.Center, 270f)) + JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); + + // If really close, snap. + if (projectile.WithinRange(target.Center, 165f)) + { + Main.PlaySound(SoundID.DD2_SkeletonHurt, projectile.Center); + JawSnapTimer = 45f; + } + } + } // Determine the head rotation. projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Main.myPlayer == projectile.owner && AttackTimer > 280) + if (Main.myPlayer == projectile.owner && AttackTimer > 480) { CurrentAIState = AIState.AttackEnemy_ReleaseDartBurst; AttackTimer = 0; } } + public void AttackOwner() + { + // Attempt to angle towards the owner. + float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 21f, 0.025f); + + if (!projectile.WithinRange(Owner.Center, 370f)) + { + Vector2 idealVelocity = projectile.SafeDirectionTo(Owner.Center) * newSpeed; + projectile.velocity = projectile.velocity.MoveTowards(idealVelocity, 2f); + + float idealAimDirection = idealVelocity.ToRotation(); + projectile.velocity = projectile.velocity.ToRotation().AngleLerp(idealAimDirection, 0.05f).ToRotationVector2() * projectile.velocity.Length(); + } + else if (projectile.velocity.Length() < 36f) + { + projectile.velocity *= 1.03f; + if (JawSnapTimer <= 0f) + { + // Open the mouth of the jaw if close but not super close to the owner. + if (projectile.WithinRange(Owner.Center, 300f)) + JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); + + // If really close, snap. + if (projectile.WithinRange(Owner.Center, 180f)) + { + Main.PlaySound(SoundID.DD2_SkeletonHurt, projectile.Center); + JawSnapTimer = 45f; + } + } + } + + // Determine the head rotation. + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + public NPC AttemptToFindTarget(float searchDistance) { NPC closestTarget = null; + int heartType = ModContent.NPCType(); if (Owner.HasMinionAttackTargetNPC) { NPC targetedNPC = Main.npc[Owner.MinionAttackTargetNPC]; - if (targetedNPC.WithinRange(projectile.Center, searchDistance) && targetedNPC.CanBeChasedBy()) + if (targetedNPC.WithinRange(projectile.Center, searchDistance) && targetedNPC.CanBeChasedBy() && targetedNPC.type != heartType) return targetedNPC; } float distance = searchDistance * searchDistance; - for (int index = 0; index < Main.maxNPCs; index++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[index].CanBeChasedBy()) + if (Main.npc[i].CanBeChasedBy() && Main.npc[i].type != heartType) { - float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); - if (Main.npc[index].WithinRange(projectile.Center, distance + extraDistance)) + if (Main.npc[i].WithinRange(projectile.Center, distance + extraDistance)) { - distance = Main.npc[index].DistanceSQ(projectile.Center); - closestTarget = Main.npc[index]; + distance = Main.npc[i].DistanceSQ(projectile.Center); + closestTarget = Main.npc[i]; } } } @@ -441,6 +528,13 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + float angerFactor = Utils.InverseLerp(300f, 280f, PlayerAttackCountdown, true) * Utils.InverseLerp(0f, 30f, PlayerAttackCountdown, true); + float afterimageOutwardness = MathHelper.Lerp(6f, 8f, (float)Math.Cos(Main.GlobalTime * 2.3f) * 0.5f + 0.5f) * angerFactor; + Color backAfterimageColor = Color.Red * angerFactor; + backAfterimageColor.A = 0; + + Texture2D eyesTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionEyes"); + Texture2D jawTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionJaw"); Texture2D headTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionHead"); Texture2D bodyTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionBody"); Texture2D bodyTexture2 = ModContent.GetTexture("CalamityMod/Projectiles/Summon/SepulcherMinionBodyAlt"); @@ -451,22 +545,50 @@ namespace CalamityMod.Projectiles.Summon Vector2 drawPosition; - // Draw arms. + // Draw the arms. for (int i = 0; i < Arms.Count; i++) { Vector2 forearmDrawPosition = Arms[i].Limbs[0].Center - Main.screenPosition; Color drawColor = Lighting.GetColor((int)(Arms[i].Limbs[0].Center.X / 16), (int)(Arms[i].Limbs[0].Center.Y / 16)); + + if (afterimageOutwardness > 0f) + { + for (int j = 0; j < 4; j++) + { + Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; + spriteBatch.Draw(foreArmTexture, forearmDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } spriteBatch.Draw(foreArmTexture, forearmDrawPosition, null, drawColor, Arms[i].Limbs[0].Rotation + MathHelper.PiOver2, foreArmTexture.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); Vector2 armDrawPosition = Arms[i].Limbs[1].Center - Main.screenPosition; drawColor = Lighting.GetColor((int)(Arms[i].Limbs[1].Center.X / 16), (int)(Arms[i].Limbs[1].Center.Y / 16)); + + if (afterimageOutwardness > 0f) + { + for (int j = 0; j < 4; j++) + { + Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; + spriteBatch.Draw(armTexture, armDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, SpriteEffects.FlipVertically, 0f); + } + } spriteBatch.Draw(armTexture, armDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation + MathHelper.PiOver2, armTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, SpriteEffects.FlipVertically, 0f); Vector2 handDrawPosition = armDrawPosition; SpriteEffects handDirection = Arms[i].Direction ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + if (afterimageOutwardness > 0f) + { + for (int j = 0; j < 4; j++) + { + Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; + spriteBatch.Draw(handTexture, handDrawPosition + drawOffset, null, backAfterimageColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, handDirection, 0f); + } + } spriteBatch.Draw(handTexture, handDrawPosition, null, drawColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, handDirection, 0f); } + // Draw the segments. for (int i = 0; i < Segments.Length; i++) { Texture2D textureToUse = i % 2 == 1 ? bodyTexture2 : bodyTexture; @@ -477,12 +599,54 @@ namespace CalamityMod.Projectiles.Summon drawPosition = Segments[i].CurrentPosition - Main.screenPosition; lightColor = Lighting.GetColor((int)(drawPosition.X + Main.screenPosition.X) / 16, (int)(drawPosition.Y + Main.screenPosition.Y) / 16); + + if (afterimageOutwardness > 0f) + { + for (int j = 0; j < 4; j++) + { + Vector2 drawOffset = (MathHelper.TwoPi * j / 4f).ToRotationVector2() * afterimageOutwardness; + spriteBatch.Draw(textureToUse, drawPosition + drawOffset, null, backAfterimageColor, Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + } spriteBatch.Draw(textureToUse, drawPosition, null, projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); } drawPosition = projectile.Center - Main.screenPosition; lightColor = Lighting.GetColor((int)(drawPosition.X + Main.screenPosition.X) / 16, (int)(drawPosition.Y + Main.screenPosition.Y) / 16); + + // Draw the jaws. + for (int i = -1; i <= 1; i += 2) + { + float jawBaseOffset = 24f; + SpriteEffects jawSpriteEffect = i == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Vector2 jawPosition = projectile.Center - Main.screenPosition; + jawPosition += Vector2.UnitX.RotatedBy(projectile.rotation + JawRotation * i) * i * (jawBaseOffset + (float)Math.Sin(JawRotation) * 14f); + jawPosition -= Vector2.UnitY.RotatedBy(projectile.rotation) * (26f + (float)Math.Sin(JawRotation) * 8f); + spriteBatch.Draw(jawTexture, jawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation + JawRotation * i, jawTexture.Size() * 0.5f, projectile.scale * 1.25f, jawSpriteEffect, 0f); + } + + // Draw the head. + if (afterimageOutwardness > 0f) + { + for (int i = 0; i < 4; i++) + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * afterimageOutwardness; + spriteBatch.Draw(headTexture, drawPosition + drawOffset, null, backAfterimageColor, projectile.rotation, headTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + } + } spriteBatch.Draw(headTexture, drawPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, headTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + + // Draw demonic eyes if enraged. + if (afterimageOutwardness > 0f) + { + for (int i = 0; i < (int)(projectile.oldPos.Length * angerFactor); i++) + { + drawPosition = projectile.Center - Main.screenPosition - projectile.velocity.SafeNormalize(Vector2.Zero) * 3f * i; + Color fadeColor = Color.White * (1f - i / (float)projectile.oldPos.Length); + spriteBatch.Draw(eyesTexture, drawPosition, null, projectile.GetAlpha(fadeColor), projectile.oldRot[i], eyesTexture.Size() * 0.5f, projectile.scale * 1.25f, SpriteEffects.None, 0f); + } + } + return false; } @@ -499,13 +663,6 @@ namespace CalamityMod.Projectiles.Summon return true; } - // And finally arm hands. - for (int i = 0; i < Arms.Count; i++) - { - if (Utils.CenteredRectangle(Arms[i].Center, Vector2.One * 32f).Intersects(targetHitbox)) - return true; - } - return false; } @@ -514,6 +671,20 @@ namespace CalamityMod.Projectiles.Summon drawCacheProjsBehindProjectiles.Add(index); } + #endregion + + #region Damage Stuff + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + damage = Main.rand.Next(80, 90); + } + + public override bool? CanHitNPC(NPC target) + { + if (target.type == ModContent.NPCType()) + return false; + return null; + } #endregion } } diff --git a/Projectiles/Summon/SepulcherMinionEyes.png b/Projectiles/Summon/SepulcherMinionEyes.png new file mode 100644 index 0000000000000000000000000000000000000000..29f526703105e4181a1784a023e6686924dcbdb1 GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^c0e4#!3-p4ZQ5c8q!^2X+?^QKos)S9^9T5ZxB}^;3YPy*&HO*R0my#j$Ow{REeY}q{tpBUzqj!P0|ht>JR*x3 z82Ao=Fk{xWPEMd;s;7%%NQC>_GaLCD6nGc{H~#r=uDy}DQ)iy3-uGqO9^Uw+{cMJ1 zTHnlMC>8(Y?UdwQ@p@k?vwv$&H_=+w2;Bm)z4*}Q$iB}E1X;E literal 0 HcmV?d00001 diff --git a/Projectiles/Summon/SepulcherMinionHead.png b/Projectiles/Summon/SepulcherMinionHead.png index ce918150f1e3334acb2269f120379bbaccd2d7c1..e1fb4453594bf28e7713d4a41a6008628cee78a0 100644 GIT binary patch delta 711 zcmaFC`+;?WBnLAC1H-IMTMQ>ED%3j#_=LCu`CMGQfrgIS!s0H98tDNV`zD&dKUCi? z<7lHT-B+xCRKe0s#6zA>|Np6(KRi7Pjcr`33*S z1{fGG9e4s%!CBxDSV?q{`4?bhybSQvVBcdKn`bMs!86@B$EXMKuX_M<_ zhGP@e9v#%@>D+uE)aIC4y_>1FXyVz=z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owN4L z%5cRv5bInU=x29jf6uLOb%xV=H}ib|FEohZb{sIKKC+k^eTeT diff --git a/Projectiles/Summon/SepulcherMinionJaw.png b/Projectiles/Summon/SepulcherMinionJaw.png new file mode 100644 index 0000000000000000000000000000000000000000..11df3bb5aebbe5b8413609d8b3b3fbe184119db3 GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^VnD3L!3-oDE=Au5QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`MFV_7T!FNc)mncaXw zoCO|{#S9F52SAuH>slu#P_V<(#WBRff9eHBt|JOOE*I6@-q%0*I=kz1lV{n2)_n(V z{OFl~!mBmZ^_EX-=vkTLCnQu7j>(i6q+PvtwkkZ{qh*3 Date: Sat, 26 Jun 2021 16:46:12 -0500 Subject: [PATCH 48/73] Placeholder text --- NPCs/TownNPCs/WITCH.cs | 66 +----------------------------------------- 1 file changed, 1 insertion(+), 65 deletions(-) diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index bff081bc14..0313ce6017 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -58,71 +58,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string TownNPCName() => "Calamitas"; - public override string GetChat() - { - // TODO: Give this town NPC unique dialog. - - if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns) - { - if (Main.rand.NextBool(2)) - return "I deeply appreciate you rescuing me from being trapped within my frozen castle... It's been many, many years..."; - else - return "Thank you for saving me...though now I admit I am without a home since mine got destroyed."; - } - - IList dialogue = new List(); - - if (Main.dayTime) - { - dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste..."); - dialogue.Add("My dear! What is it you would like to talk about today?"); - dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!"); - dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry..."); - dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it..."); - dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs..."); - } - else - { - dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters."); - dialogue.Add("You could break the icy stillness in the air tonight."); - dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon..."); - dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure..."); - dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive..."); - dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do..."); - } - - dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted."); - - if (BirthdayParty.PartyIsUp) - dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies."); - - if (NPC.downedMoonlord) - { - dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you..."); - dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?"); - } - - if (CalamityWorld.downedPolterghast) - dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss..."); - - if (CalamityWorld.downedYharon) - dialogue.Add("...Where is Lord Yharim? He must be up to something..."); - - int dryad = NPC.FindFirstNPC(NPCID.Dryad); - if (dryad != -1) - dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now..."); - - if (Main.player[Main.myPlayer].Calamity().chibii) - dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know."); - - if (Main.player[Main.myPlayer].Calamity().cryogenSoul) - dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know."); - - if (Main.hardMode) - dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you..."); - - return dialogue[Main.rand.Next(dialogue.Count)]; - } + public override string GetChat() => "Mrrp is cringe."; public override void SetChatButtons(ref string button, ref string button2) => button = "Enchant"; From 1b7e62e13e685ea391e9a7bdf648939bb9cf7daa Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 16:48:40 -0500 Subject: [PATCH 49/73] Temporary Sepulcher weapon removal --- Items/Weapons/Summon/StaffoftheMechworm2.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Items/Weapons/Summon/StaffoftheMechworm2.cs b/Items/Weapons/Summon/StaffoftheMechworm2.cs index 1fb6faa386..54a05bfb70 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm2.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm2.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Items.Weapons.Summon { public class StaffoftheMechworm2 : ModItem { + // This is unfinished atm. + public override bool Autoload(ref string name) => false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Staff of the Mechworm (But Exhumed!)"); From 075a1c545b8f9233bb6880b7825a9ba0de27873d Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 16:49:10 -0500 Subject: [PATCH 50/73] Exhumed Vigilance damage nerf --- Items/Weapons/Summon/ExhumedVigilance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Summon/ExhumedVigilance.cs b/Items/Weapons/Summon/ExhumedVigilance.cs index 107d5e99a8..185a2ccd9d 100644 --- a/Items/Weapons/Summon/ExhumedVigilance.cs +++ b/Items/Weapons/Summon/ExhumedVigilance.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.mana = 100; - item.damage = 16660; + item.damage = 1666; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 58; item.height = 64; From 113c09ff7681e16fc1d0526a6b44ab74d4df5164 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 17:59:35 -0500 Subject: [PATCH 51/73] Withered buff icon resprite --- Buffs/Cooldowns/Withered.png | Bin 517 -> 578 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Buffs/Cooldowns/Withered.png b/Buffs/Cooldowns/Withered.png index 8565069431ae04a073a6edffbea36c09cd24b8bb..c51dae7b2a01cf2f6868db3129deebff8cd7bbdf 100644 GIT binary patch delta 564 zcmV-40?Yk{1i}Q68Gix*008_L?V|ty00DDSM?wIu&K&6g000DMK}|sb0I`n?{9y$E z000SaNLh0L01m?d01m?e$8V@)0005kNklY#OWhHqii-F<>EmfCWN*6!{KezyY$`OHB=cWH*@Igyd3)KOjEC1?UwA zeZ~4fa@vAtKz|Z{96-RgcOQTx{@g&{RD|pU2?;hJ`RNxINCF8!T#f8MhzK$mfK-HH zK~{nk5WRTu3yApGzQNI*r!Ro$+4mnn1avjr;XvOYdk8C_ZyX?ln(6m|WUQMski2^P zGmt!YA5p$aadJRe3=BYT0m&IwvJfsD3`8ordG{xfRDV}y2aACKvOgeT@8P#V5|Yv& zewrMr4UzzZqtAW;Nr(R+KMkA@AOM#?kmI8zQwd1&zu^Ru5Vu3X;P3$iAp2w8jyFIO zzuO^TAbhZIqB)Sf@CalxE`LB`0^)WExN?aZ%0dO!QlK=Jyzm5&q?ZrU13)dia7TU! z7Y#sshAj&~Vgea#z78s^Hk`TvBx&!1A>O)XU;qFzlGj_(zumR~0000rI0jMHezAp3)onMh;JbxL@WZ)!k=cv*jNa`!Xg$scf!o>I;pY) zo@RIM&YhWa_TD=)LA6o_pmp0BFh*1>1qzv86!Y->+Av3okuVRJ7E|3zt!Dtbjs@hd zKr#kYz6$eFd4J1r=yq;W?OBLkUSmHM6H+g{iGg7ybTAhPqpW|wvbqMq)8j*`pC}P1 zC306_m<5urR@4hz%mp^{1auwoP5}p8%w72E_fqX1DWED}w6_fmvtees7`HPNaK(mv zx91V$u0Wy^ZqA0lkhwtqp=4bn{L7j+f Date: Sat, 26 Jun 2021 19:45:11 -0400 Subject: [PATCH 52/73] if x return true else return false --- Utilities/ItemUtils.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index ad29b36b7f..00b12acb8e 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -214,10 +214,7 @@ namespace CalamityMod if (EnchantmentManager.ItemUpgradeRelationship.ContainsValue(item.type)) return true; - if (item.Calamity().AppliedEnchantment.HasValue) - return true; - - return false; + return item.Calamity().AppliedEnchantment.HasValue; } public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) From f9566bdc281994d4f7c79deae931cacca6e01fd0 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 18:55:23 -0500 Subject: [PATCH 53/73] Vulnerability hex ambiguity fix --- Buffs/DamageOverTime/VulnerabilityHex.cs | 8 -------- NPCs/CalamityGlobalNPC.cs | 1 - 2 files changed, 9 deletions(-) diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 519aa10d15..dfc4a2c6e0 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -25,13 +25,5 @@ namespace CalamityMod.Buffs.DamageOverTime npc.DelBuff(buffIndex); buffIndex--; } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().vulnerabilityHex < npc.buffTime[buffIndex]) - npc.Calamity().vulnerabilityHex = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; - } } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 468c4dda67..86be0eb288 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -148,7 +148,6 @@ namespace CalamityMod.NPCs public int wCleave = 0; public int bBlood = 0; public int dFlames = 0; - public int vulnerabilityHex = 0; public int marked = 0; public int irradiated = 0; public int bFlames = 0; From dbe2ca3bc5ab5c8af34e4733ff37c37e979d091b Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 26 Jun 2021 19:20:11 -0500 Subject: [PATCH 54/73] 1 - Radiant Ooze and Ambrosial Ampoule life regen don't stack. --- CalPlayer/CalamityPlayerLifeRegen.cs | 5 +++++ CalPlayer/CalamityPlayerMiscEffects.cs | 5 ++++- Items/Accessories/AmbrosialAmpoule.cs | 1 + Items/Accessories/RadiantOoze.cs | 5 ----- Items/Accessories/Sponge.cs | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 5eaaf80cc2..b13d4b0e77 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -653,6 +653,11 @@ namespace CalamityMod.CalPlayer player.lifeRegenTime += 1; player.lifeRegen += 2; } + else if (modPlayer.rOoze) + { + if (!Main.dayTime) + player.lifeRegen += 4; + } if (modPlayer.ursaSergeant) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index d64c545969..ac99000e5e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1402,11 +1402,14 @@ namespace CalamityMod.CalPlayer // Ambrosial Ampoule bonus and other light-granting bonuses float[] light = new float[3]; - if (modPlayer.aAmpoule) + if ((modPlayer.rOoze && !Main.dayTime) || modPlayer.aAmpoule) { light[0] += 1f; light[1] += 1f; light[2] += 0.6f; + } + if (modPlayer.aAmpoule) + { player.endurance += 0.05f; player.pickSpeed -= 0.25f; player.buffImmune[BuffID.Venom] = true; diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 4286e66c63..ac477ff3f0 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.beeResist = true; modPlayer.aAmpoule = true; + modPlayer.rOoze = true; } public override void AddRecipes() diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index d25f436569..4828b840ba 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -25,11 +25,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().rOoze = true; - if (!Main.dayTime) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f); - player.lifeRegen += 4; - } } public override void AddRecipes() diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index 107bcab7ec..c5d984bb12 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -78,6 +78,7 @@ namespace CalamityMod.Items.Accessories modPlayer.seaShell = true; modPlayer.absorber = true; modPlayer.aAmpoule = true; + modPlayer.rOoze = true; player.statManaMax2 += 20; } From 45d0551b7463c4cf3560d8942c948fe120e09d8a Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 19:27:58 -0500 Subject: [PATCH 55/73] Color fix --- Items/Weapons/Magic/RainbowPartyCannon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 94188df883..1fa28d3f8d 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void ModifyTooltips(List tooltips) { var tt2 = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria"); - tt2.overrideColor = new Color(MathHelper.Lerp(156f, 255f, Main.DiscoR / 256f), 108f, 251f); + tt2.overrideColor = new Color((int)MathHelper.Lerp(156f, 255f, Main.DiscoR / 256f), 108, 251); } public override void AddRecipes() From 4cdca8ea08730589083325c68485a9cf419f7090 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 26 Jun 2021 19:29:11 -0500 Subject: [PATCH 56/73] 1 - Updated Cal Clone total kill time to be 4 minutes. --- CalamityMod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index e07aff653a..68f5bea4fb 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -552,7 +552,7 @@ namespace CalamityMod { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 1200 }, - { ModContent.NPCType(), 11400 }, + { ModContent.NPCType(), 13200 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 10800 }, From 3f30b7e3c549a53929e064e6824397bf19a05698 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:45:25 -0500 Subject: [PATCH 57/73] Fixed Brimstone Orb rage generation --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 3 +++ NPCs/Other/BrimstoneOrb.cs | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c78d13b8c1..f7e789e900 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -351,7 +351,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; - if (npc is null || !npc.IsAnEnemy()) + if (npc is null || !npc.IsAnEnemy() || npc.Calamity().DoesNotGenerateRage) continue; // Take the longer of the two directions for the NPC's hitbox to be generous. diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 86be0eb288..093719ee1f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -114,6 +114,9 @@ namespace CalamityMod.NPCs public int shopAlertAnimTimer = 0; public int shopAlertAnimFrame = 0; + // Rage interactions + public bool DoesNotGenerateRage = false; + // NewAI internal const int maxAIMod = 4; public float[] newAI = new float[maxAIMod]; diff --git a/NPCs/Other/BrimstoneOrb.cs b/NPCs/Other/BrimstoneOrb.cs index eeefb6705f..8468cd95e5 100644 --- a/NPCs/Other/BrimstoneOrb.cs +++ b/NPCs/Other/BrimstoneOrb.cs @@ -33,6 +33,7 @@ namespace CalamityMod.NPCs.Other npc.knockBackResist = 0f; npc.netAlways = true; npc.aiStyle = -1; + npc.Calamity().DoesNotGenerateRage = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 97444; From 79b5d517fed3b1ba2319ff5c28c41b4d0d2b4b9e Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:46:10 -0500 Subject: [PATCH 58/73] Fixed Weak Brimstone Flames showing time --- Buffs/DamageOverTime/WeakBrimstoneFlames.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs index bf421c63ca..edf6f12830 100644 --- a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } From 6dcb27e0b39dce5d1768efdbfbe1a3b35fd3006d Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:48:42 -0500 Subject: [PATCH 59/73] Fixed UI interactions with the Calamity mouse --- ILEditing/ILChanges.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 6bf6c712c0..adf8ec7167 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -611,7 +611,7 @@ namespace CalamityMod.ILEditing Main.spriteBatch.Draw(Main.cursorTextures[cursorIndex], drawPosition, null, desaturatedCursorColor, 0f, Vector2.Zero, Main.cursorScale, SpriteEffects.None, 0f); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.UIScaleMatrix); GameShaders.Misc["CalamityMod:FireMouse"].UseColor(Color.Red); GameShaders.Misc["CalamityMod:FireMouse"].UseSecondaryColor(Color.Lerp(Color.Red, Color.Orange, 0.75f)); GameShaders.Misc["CalamityMod:FireMouse"].Apply(); From 99c1a0ce2e17f872e1ddd81f87c09c175da04b34 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:51:17 -0500 Subject: [PATCH 60/73] Reduced Refraction Rotor dust --- Projectiles/Rogue/PrismRocket.cs | 3 +++ Projectiles/Rogue/PrismShurikenBlade.cs | 4 ++-- Projectiles/Rogue/RefractionRotorProjectile.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Projectiles/Rogue/PrismRocket.cs b/Projectiles/Rogue/PrismRocket.cs index 482518b704..25e8598ab3 100644 --- a/Projectiles/Rogue/PrismRocket.cs +++ b/Projectiles/Rogue/PrismRocket.cs @@ -61,6 +61,9 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 2; i++) { + if (!Main.rand.NextBool(3)) + continue; + Dust dust = Dust.NewDustPerfect(projectile.Center - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f, 261); dust.color = Color.Cyan; dust.velocity = Main.rand.NextVector2Unit(); diff --git a/Projectiles/Rogue/PrismShurikenBlade.cs b/Projectiles/Rogue/PrismShurikenBlade.cs index 696565eed0..31e90538bb 100644 --- a/Projectiles/Rogue/PrismShurikenBlade.cs +++ b/Projectiles/Rogue/PrismShurikenBlade.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Rogue if (Main.dedServ) return; - for (int i = 0; i < 25; i++) + for (int i = 0; i < 15; i++) { - Vector2 circularOffsetDirection = (MathHelper.TwoPi * i / 25f).ToRotationVector2().RotatedBy(projectile.velocity.ToRotation() - MathHelper.PiOver2); + Vector2 circularOffsetDirection = (MathHelper.TwoPi * i / 15f).ToRotationVector2().RotatedBy(projectile.velocity.ToRotation() - MathHelper.PiOver2); Vector2 spawnPosition = projectile.Center - (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * projectile.height * 1.25f; spawnPosition += circularOffsetDirection * new Vector2(12f, 7f); diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs index e87801c161..24cdfaf854 100644 --- a/Projectiles/Rogue/RefractionRotorProjectile.cs +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue // If this projectile is a stealth strike, don't create the blades as a gore-- create them as a projectile instead. if (!Main.dedServ) { - for (int i = 0; i < 80; i++) + for (int i = 0; i < 15; i++) { Dust rainbowBurst = Dust.NewDustPerfect(projectile.Center, 267); rainbowBurst.color = Main.hslToRgb(i / 80f, 0.9f, 0.6f); From 25101e9737e30916bb9b63d8a7dc83fa577f40b4 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:53:51 -0500 Subject: [PATCH 61/73] Made Jailor chains a little slower --- Projectiles/Ranged/PrismMine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Ranged/PrismMine.cs b/Projectiles/Ranged/PrismMine.cs index b2e06f1ef6..406e1be8af 100644 --- a/Projectiles/Ranged/PrismMine.cs +++ b/Projectiles/Ranged/PrismMine.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged float rotation = projectile.AngleTo(destination); float remainingDistance = projectile.Distance(destination) - 30f; float laserScale = 0.5f; - Rectangle frame = laserTexture.Frame(1, 7, 0, (int)(Main.GlobalTime * 17f + projectile.identity * 3f) % 7); + Rectangle frame = laserTexture.Frame(1, 7, 0, (int)(Main.GlobalTime * 10f + projectile.identity * 3f) % 7); Vector2 laserOrigin = frame.Size() * 0.5f; while (remainingDistance > frame.Height * laserScale) { From cd255ce60bcc34617e4f73d5f35dee556bd9d4ef Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:54:49 -0500 Subject: [PATCH 62/73] Added some missing dev item tags --- Items/Weapons/Magic/RainbowPartyCannon.cs | 1 + Items/Weapons/Summon/UniverseSplitter.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs index 1fa28d3f8d..a346414cf1 100644 --- a/Items/Weapons/Magic/RainbowPartyCannon.cs +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Weapons.Magic item.shoot = ModContent.ProjectileType(); item.channel = true; item.shootSpeed = 20f; + item.Calamity().devItem = true; } public override void ModifyTooltips(List tooltips) diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 66c282b95e..10806aa174 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; From 9391babda72dbe530ce52aee76fa82fd580f4ace Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 20:55:23 -0500 Subject: [PATCH 63/73] Adjusted Bullet-Filled Shotgun's tooltip --- Items/Weapons/Ranged/BulletFilledShotgun.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index 7b38b8dc0d..0dcb7bf48a 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Bullet-Filled Shotgun"); Tooltip.SetDefault("Fires a massive spread of bouncing bullets\n" + - "Consumes five ammo per fire\n" + + "Consumes five bullets per-use\n" + "Aim? What's that?"); } public override void SetDefaults() From 4f1a4ed3ca159167fb21c5cb35bc8add135b970c Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 21:05:32 -0500 Subject: [PATCH 64/73] Calamitas Encahnt UI scale integration --- .../CalamitasEnchantUI.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index e4434c1263..39ade9da0c 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -82,7 +82,7 @@ namespace CalamityMod.UI.CalamitasEnchants Main.npcChatText = string.Empty; Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseBackground"); - Vector2 backgroundScale = Vector2.One; + Vector2 backgroundScale = Vector2.One * Main.UIScale; // Draw the background. spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); @@ -100,8 +100,8 @@ namespace CalamityMod.UI.CalamitasEnchants Point costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(50f, 78f) * backgroundScale).ToPoint(); cost = DrawEnchantmentCost(spriteBatch, costDrawPositionTopLeft); Point descriptionDrawPositionTopLeft = costDrawPositionTopLeft; - descriptionDrawPositionTopLeft.Y += 70; - Vector2 iconDrawPositionTopLeft = costDrawPositionTopLeft.ToVector2() + new Vector2(270f, -24f); + descriptionDrawPositionTopLeft.Y += (int)(Main.UIScale * 70f); + Vector2 iconDrawPositionTopLeft = costDrawPositionTopLeft.ToVector2() + new Vector2(270f, -24f) * Main.UIScale; DrawEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); if (!string.IsNullOrEmpty(SelectedEnchantment.Value.IconTexturePath)) @@ -174,15 +174,15 @@ namespace CalamityMod.UI.CalamitasEnchants // Draw the coin costs. string costText = "Cost: "; - Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, costText, costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y + 45f, Color.White * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero); - costDrawPositionTopLeft.X += (int)(Main.fontMouseText.MeasureString(costText).X * 0.5f + 12f); + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, costText, costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y + 45f * Main.UIScale, Color.White * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero, Main.UIScale); + costDrawPositionTopLeft.X += (int)((Main.fontMouseText.MeasureString(costText).X * 0.5f + 12f) * Main.UIScale); int[] coinsArray = Utils.CoinsSplit(cost); for (int i = 0; i < 4; i++) { - Vector2 drawPosition = new Vector2(costDrawPositionTopLeft.X + ChatManager.GetStringSize(Main.fontMouseText, costText, Vector2.One, -1f).X + (24 * i) - 24f, costDrawPositionTopLeft.Y + 54f); - spriteBatch.Draw(Main.itemTexture[ItemID.PlatinumCoin - i], drawPosition, null, Color.White, 0f, Main.itemTexture[ItemID.PlatinumCoin - i].Size() * 0.5f, 1f, SpriteEffects.None, 0f); - Utils.DrawBorderStringFourWay(spriteBatch, Main.fontItemStack, coinsArray[3 - i].ToString(), drawPosition.X - 11f, drawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f); + Vector2 drawPosition = new Vector2(costDrawPositionTopLeft.X + (ChatManager.GetStringSize(Main.fontMouseText, costText, Vector2.One, -1f).X + ((24 * i) - 24f)) * Main.UIScale, costDrawPositionTopLeft.Y + 54f * Main.UIScale); + spriteBatch.Draw(Main.itemTexture[ItemID.PlatinumCoin - i], drawPosition, null, Color.White, 0f, Main.itemTexture[ItemID.PlatinumCoin - i].Size() * 0.5f, Main.UIScale, SpriteEffects.None, 0f); + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontItemStack, coinsArray[3 - i].ToString(), drawPosition.X - 11f, drawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f * Main.UIScale); } return cost; @@ -191,20 +191,20 @@ namespace CalamityMod.UI.CalamitasEnchants public static void DrawEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) { Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); - Vector2 scale = new Vector2(0.67f, 0.7f) * MathHelper.Clamp(ResolutionRatio, 0.825f, 1f); + Vector2 scale = new Vector2(0.67f, 0.7f) * MathHelper.Clamp(ResolutionRatio, 0.825f, 1f) * Main.UIScale; foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 465, 10, out _)) { if (string.IsNullOrEmpty(line)) continue; ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, line, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); - vectorDrawPosition.Y += 16; + vectorDrawPosition.Y += Main.UIScale * 16f; } } public static void DrawIcon(SpriteBatch spriteBatch, Vector2 drawPositionTopLeft, Texture2D texture) { - spriteBatch.Draw(texture, drawPositionTopLeft, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(texture, drawPositionTopLeft, null, Color.White, 0f, Vector2.Zero, Main.UIScale, SpriteEffects.None, 0f); } public static void DrawItemIcon(SpriteBatch spriteBatch, Vector2 itemSlotDrawPosition, Vector2 reforgeIconDrawPosition, Vector2 scale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon) @@ -246,7 +246,7 @@ namespace CalamityMod.UI.CalamitasEnchants if (hasMultipleFrames) itemFrame = Main.itemAnimations[CurrentlyHeldItem.type].GetFrame(itemTexture); - float baseScale = 1f; + float baseScale = Main.UIScale; Color _ = Color.White; ItemSlot.GetItemLight(ref _, ref baseScale, CurrentlyHeldItem, false); @@ -340,7 +340,7 @@ namespace CalamityMod.UI.CalamitasEnchants public static void DrawEnchantmentName(SpriteBatch spriteBatch, Vector2 nameDrawCenter) { - Vector2 scale = new Vector2(0.8f, 0.745f); + Vector2 scale = new Vector2(0.8f, 0.745f) * Main.UIScale; float textWidth = Main.fontMouseText.MeasureString(SelectedEnchantment.Value.Name).X * scale.X; Color drawColor = SelectedEnchantment.Value.Equals(EnchantmentManager.ClearEnchantment) ? Color.White : Color.Orange; nameDrawCenter.X -= textWidth * 0.5f; From 7a017a2c4f6c611522a77e51e44dadf5a9b6c24b Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 21:09:20 -0500 Subject: [PATCH 65/73] Celestial Sigil stack fix --- Items/CalamityGlobalItem.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a8e3a9afa5..babd4bca52 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -130,7 +130,10 @@ namespace CalamityMod.Items if (item.type == ItemID.PirateMap || item.type == ItemID.SnowGlobe) item.maxStack = 20; - if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) + if (item.type == ItemID.CelestialSigil) + item.maxStack = 1; + + if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) item.value = Item.buyPrice(0, 0, 5, 0); if (CalamityLists.useTurnList?.Contains(item.type) ?? false) From 56b193cac1ac65cacc04289f4602ba3999721534 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 26 Jun 2021 21:09:52 -0500 Subject: [PATCH 66/73] Game loading fix --- UI/CalamitasEnchantments/EnchantmentManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index a1e0e3ce78..e30094da53 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -209,6 +209,9 @@ namespace CalamityMod.UI.CalamitasEnchants item => item.useTime = item.useAnimation = 25, player => { + if (Main.gameMenu) + return; + player.Calamity().bladeArmEnchant = true; bool armsArePresent = false; int armType = ModContent.ProjectileType(); @@ -263,6 +266,9 @@ namespace CalamityMod.UI.CalamitasEnchants null, player => { + if (Main.gameMenu) + return; + player.Calamity().lecherousOrbEnchant = true; bool orbIsPresent = false; From 7df3196eaf9bf228988947d2e61a29f8d9602929 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 27 Jun 2021 00:41:14 -0500 Subject: [PATCH 67/73] Exhumed Hearts no longer generate rage --- NPCs/Other/ExhumedHeart.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index f1fdb578b3..bfde229cb5 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -37,6 +37,7 @@ namespace CalamityMod.NPCs.Other npc.knockBackResist = 0f; npc.netAlways = true; npc.aiStyle = -1; + npc.Calamity().DoesNotGenerateRage = true; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 51740; From 16dcfd8f5d18abdfdb8412d700f2238dfd1cf894 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 27 Jun 2021 01:40:55 -0500 Subject: [PATCH 68/73] Made Apotheosis a tiny bit less jarring --- Projectiles/Magic/ApotheosisEnergy.cs | 2 +- Projectiles/Magic/ApotheosisWorm.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index 30c346c073..0b27b1b7fe 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic baseColor = Color.Lerp(baseColor, Color.Fuchsia, (completionRatio - 0.66f) / 0.33f); else { - float whiteFade = (float)Math.Sin(Utils.InverseLerp(0.1f, 0.56f, completionRatio, true) * MathHelper.Pi + Main.GlobalTime * 10f) * 0.85f; + float whiteFade = (float)Math.Sin(Utils.InverseLerp(0.0f, 0.2f, completionRatio, true) * MathHelper.Pi + Main.GlobalTime * 3f) * 0.45f; baseColor = Color.Lerp(baseColor, Color.White, whiteFade); } diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index 77e904b95b..dd7c1fa2ec 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -317,7 +317,7 @@ namespace CalamityMod.Projectiles.Magic colorA *= currentFade; colorB *= currentFade; Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(8f, 19f) * projectile.Opacity * currentFade; + Vector2 scale = new Vector2(4f, 10f) * projectile.Opacity * currentFade; spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, SpriteEffects.None, 0); spriteBatch.Draw(texture, drawPos, null, colorA, 0f, origin, scale, SpriteEffects.None, 0); From bf3568b54b05209c58b2ea28392734bb0fe4ad4f Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 27 Jun 2021 07:48:27 -0500 Subject: [PATCH 69/73] Tainted enchant fire gauntlet fix --- Projectiles/Melee/TaintedBladeSlasher.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index f4d16515ed..7d493cda46 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -108,6 +108,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 90000; projectile.usesLocalNPCImmunity = true; + projectile.noEnchantments = true; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); From 80d00c8cebaa8771571be3bf4469be0312f7f0df Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 28 Jun 2021 19:14:52 -0500 Subject: [PATCH 70/73] Malice sprite stuff --- ExtraTextures/UI/ModeIndicatorArea.png | Bin 1124 -> 662 bytes ExtraTextures/UI/ModeIndicatorMalice.png | Bin 0 -> 357 bytes ExtraTextures/UI/ModeIndicatorRune.png | Bin 567 -> 0 bytes Items/DifficultyItems/Malice.cs | 3 +++ Items/DifficultyItems/Malice.png | Bin 497 -> 3073 bytes UI/ModeIndicatorUI.cs | 16 +++++++--------- 6 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 ExtraTextures/UI/ModeIndicatorMalice.png delete mode 100644 ExtraTextures/UI/ModeIndicatorRune.png diff --git a/ExtraTextures/UI/ModeIndicatorArea.png b/ExtraTextures/UI/ModeIndicatorArea.png index 701089c3ccdaa9e9c2109e739c44bc0a64782550..508fe00039ad87668029603cf3d9c898db4d9fe8 100644 GIT binary patch delta 620 zcmV-y0+apZ2$ltq83+Ra0021Ia<`EoAb%K8OjJb{6&_DlUuA7_Kt@k4F+GTnksu%~ z0000i1}vcf000PdQchF<|NsC0|Nj8qgS}Y*000SaNLh0L01mV5pE|dN4Hb9SrDi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GK#P2l>YX7E7yUH{*1Xu=? zjsX^7gy1%UY3mn1FvM#B_ZPqWY?<0dFqR>JpE_|rz;}?^Q)F8PFkytynh}iG5PloZ zbY%b&MhKl5!7F$T>B|5nj1YP=f?-2IUj{H?L}oDf1Ns3=TN>bL)Bpeg07*qoM6N<$ Eg3>_vKmY&$ diff --git a/ExtraTextures/UI/ModeIndicatorMalice.png b/ExtraTextures/UI/ModeIndicatorMalice.png new file mode 100644 index 0000000000000000000000000000000000000000..bfa33cbe8d04eb35f37a3da2c9bac5f474540a72 GIT binary patch literal 357 zcmeAS@N?(olHy`uVBq!ia0vp^azL!W!3-pg=2`dxDaPU;cPEB*=VV?2IV|apzK#qG z8~eHcB(ehe>H$6>t_ljeskue|;qe{)6CK?A#YE-w3~hIm#uON8PWE+vvb^E{%R@l5 zFEeMe04d&*Aiv=MNPxlig;E<(g0sLQvY3H^Z$Ah#TCfJI00q~1x;Tbd_)nb_&DWy9 zKr$oB^kbGSFT0S#5JKNOiGoCHyDmLF`Suxta-QcneAQ6BQ7W? m|8!pI5X#&U-59?2z5P`#(T~;J=Pd@hoWax8&t;ucLK6VP42UHF literal 0 HcmV?d00001 diff --git a/ExtraTextures/UI/ModeIndicatorRune.png b/ExtraTextures/UI/ModeIndicatorRune.png deleted file mode 100644 index 51a2ed08d5258278e95aeed20db9b06ee537d0b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 567 zcmV-70?7S|P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz0nAB6K~z{r)t668 z0zn*x#}qmU{zXGbU6l$13+oVci|`Wk1?uL#@6ZS6*4;|bxbA`_7@U~^1>t`;1dE>n2kgQz<$9=d6gei0*|;p zAu0h-!AiMIX&+;NHPl1TSO)h1u)i_Pz|DPz^8EOj^5~3@_qO;Lpc3x|{6%%yPLR0Xgb zVYf0e{Af3A@|0=xPeQK(GDe0n_BED~D*%iPWh^pg><1MF(bE%>enbEO002ovPDHLk FV1m3{0lfeK diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs index 998250226f..874febecbf 100644 --- a/Items/DifficultyItems/Malice.cs +++ b/Items/DifficultyItems/Malice.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.DifficultyItems Tooltip.SetDefault("Enrages every boss and allows them to drop special items.\n" + "Nurse no longer heals while a boss is alive.\n" + "Effect can be toggled on and off."); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); } public override void SetDefaults() @@ -27,6 +29,7 @@ namespace CalamityMod.Items.DifficultyItems item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item119; + item.noUseGraphic = true; item.consumable = false; } diff --git a/Items/DifficultyItems/Malice.png b/Items/DifficultyItems/Malice.png index 493a9b001ca2fca997f4041e011df8e577faa106..fa448647be361034f7e03ec5ef3152dae9f99bfd 100644 GIT binary patch literal 3073 zcmbVOdpy&7AD>Gkm$K+&O%|I=ku0$dGYs1>hKh(Bb5d?$iQ`Uj6f@fn<=#X|BDoey z&XExzxh7#@p>j!?%bq!%>YV4l=lQ-~-`D5&z5V`pf8L+>=bdCnw3OZk+6Djsr13bc zy&wvv@Q$q_f-l%QdrA<5g6%C$0e3sWT){&0w26%g0B|o=a?N9lV7=eY+R@w;g;9`G z^71^JmiT)L+%S{$voA=g>6eIpCX-WF#}|x`fVP{0+W^rqyD&kJq1Y20Hut{|fcfKB zt%4JYb2#TFN1xWOMiN$p&sUK9m7 zjg%k#wFD5^QQ+4R)9w0x$21b}3~sm=$T?q06@}^kGIv@MI$c7;E>L(Yi~Y1b zxcvu{sZQ)i#$X*GsykWc+$GdYuPe*mw^bp%@L4nerlu zEr!t%5mENFF0;3;H~k!hPfQl!P%8F4r|0F(^X8kX`@HuZfnKrr2agF8ijd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XYF7g<$* ze(D~?ECeC?f7cy|nfpN8KcQ8G1)FVELKLB9IJJ&oim@9NYl5K_B%KOjuZq#^@i2># zECkh>aS@@6Vc%&A#7sH52ho4xRRln0n&@={R*_f*kh7o48Hmxl5K1(b(z6P?I}xq% zO26*d1fs)|l6xsM6JsgvnrhqbLJ&n3{(Fi@cGQeZ2;$SF4Gg95q}BIJV-4XL0&z*O z)ocWr#+#{X1<`Tg$)Z!r8N^*<*CR8J@Cjq4$jjqsVkOo%pR>HP2nAZ2;n&;HbwQ+Y zFhO%jAL7-4aCP_Vf>`6-GlvW_soJ new Vector2(0f, -16f); - public static Vector2 ArmageddonIconOffset => new Vector2(11.5f, 7f); - public static Vector2 DefiledRuneIconOffset => new Vector2(-12f, 7); + public static Vector2 ArmageddonIconOffset => new Vector2(12f, 7f); + public static Vector2 MaliceIconOffset => new Vector2(-12f, 7f); public static void Draw(SpriteBatch spriteBatch) { // The mode indicator should only be displayed when the inventory is open, to prevent obstruction. @@ -22,9 +22,7 @@ namespace CalamityMod.UI Texture2D revengeanceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorRev"); Texture2D deathIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorDeath"); Texture2D armageddonIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorArma"); - - // TODO -- When Malice is added, replace this with Malice's indicator. - Texture2D defiledRuneIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorRune"); + Texture2D maliceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorMalice"); Vector2 drawCenter = new Vector2(Main.screenWidth - 400f, 72f) + outerAreaTexture.Size() * 0.5f; @@ -33,14 +31,14 @@ namespace CalamityMod.UI if (CalamityWorld.revenge) { Texture2D difficultyIconToUse = CalamityWorld.death ? deathIconTexture : revengeanceIconTexture; - spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, revengeanceIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); + spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, difficultyIconToUse.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); } if (CalamityWorld.armageddon) - spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, revengeanceIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); + spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, armageddonIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); - /*if (false) - spriteBatch.Draw(defiledRuneIconTexture, drawCenter + DefiledRuneIconOffset, null, Color.White, 0f, revengeanceIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f);*/ + if (CalamityWorld.malice) + spriteBatch.Draw(maliceIconTexture, drawCenter + MaliceIconOffset, null, Color.White, 0f, maliceIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); } } } From 5ac54a7a0b0acd698aa57be513b84064c44ec67a Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 28 Jun 2021 19:26:09 -0500 Subject: [PATCH 71/73] Icon render fixes --- ExtraTextures/UI/ModeIndicatorArma.png | Bin 527 -> 253 bytes ExtraTextures/UI/ModeIndicatorDeath.png | Bin 539 -> 257 bytes ExtraTextures/UI/ModeIndicatorMalice.png | Bin 357 -> 261 bytes ExtraTextures/UI/ModeIndicatorRev.png | Bin 523 -> 248 bytes UI/ModeIndicatorUI.cs | 8 ++++---- 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ExtraTextures/UI/ModeIndicatorArma.png b/ExtraTextures/UI/ModeIndicatorArma.png index d5e6ea594e2e8d084fc20206a7b516cd03f3080b..619f29b4a2beff55eda3871d668aa5e75be5386c 100644 GIT binary patch delta 208 zcmeBY`O7##l7pFnfx&2=h3`Z~g?ga?pAgsOrVp;B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5j9Ef)@N7gGOqvVGSz?!q?$wYwJ!z6M&$;OXk;vd$@?2>>K@ BR&D?Q delta 280 zcmZo=ddf7x(NjIZC&X1jK{qwG$Ui*3qkp1~mXaX9;Q#;s zGdO6i`~u{27I;J!GcfQS0Aa?gYn_}x!BkHd#}EturxU&T8VopC1K-uB8?(A3FFxO@ zoqm!3@}5gq{!FXSkbaW3AZv5#^8OXGK3OG9b&V8`SnK<~?#gq)5MK-DEg{7VvXq=l zw=8>X$x{3zBG4oxCuX8+B=h`BT=!mR%V&M(?Y+ktxzi?D6=)-ar>mdKI;Vst0ERM4 A5&!@I delta 480 zcmV<60U!SO0gD8X83+ad000F*$bXR`Ab$yPNLh0L01m+b01m+cxRGn^0004?Nkl ztA^!DS+>H|sx{dP&{e=3<0!*U=NW0+i^xJghitamNVQ*Af%uFaXDwv7v9*bOdwE4J zuN08v{;r99Xta<{F^`NIH@7g4yuQ3blK6~mD+}Y*QVAdM4v8nt-em<2QfZ{h@t}{K zmDjtn5`-1Jt=Ey}7!%GR4R_L?NPivY{b?jCz%@Y3H?CSKBx!6P%2t@-#gS|URJsG? z_!)DKIcK_6t&TU&c;qh@CbSW#?}uf4RyE_FR>$WR}u)*-?r@Mcpc`< z@$O?6Nls=akvyGfNqg?$wB+fu|M86^XITqr&dx<>-s|>|r&HniqA7p7QB9}U-d9kW zjFmysl*DJOK4mW1xuGh+Q;MgO&hV+zHsmQ&_fI0K0xCK~6?2VM)Cv%tp-N1~iNp`H WoZqEpmC`=|0000 new Vector2(0f, -16f); + public static Vector2 DifficultyIconOffset => new Vector2(0f, -13f); public static Vector2 ArmageddonIconOffset => new Vector2(12f, 7f); public static Vector2 MaliceIconOffset => new Vector2(-12f, 7f); public static void Draw(SpriteBatch spriteBatch) @@ -31,14 +31,14 @@ namespace CalamityMod.UI if (CalamityWorld.revenge) { Texture2D difficultyIconToUse = CalamityWorld.death ? deathIconTexture : revengeanceIconTexture; - spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, difficultyIconToUse.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); + spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, difficultyIconToUse.Size() * 0.5f, 1f, SpriteEffects.None, 0f); } if (CalamityWorld.armageddon) - spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, armageddonIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); + spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, armageddonIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); if (CalamityWorld.malice) - spriteBatch.Draw(maliceIconTexture, drawCenter + MaliceIconOffset, null, Color.White, 0f, maliceIconTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); + spriteBatch.Draw(maliceIconTexture, drawCenter + MaliceIconOffset, null, Color.White, 0f, maliceIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); } } } From ac4859e6a03f9b989cadfb7c1dd35a841b1e7778 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 28 Jun 2021 21:26:31 -0500 Subject: [PATCH 72/73] UI hover text --- UI/ModeIndicatorUI.cs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/UI/ModeIndicatorUI.cs b/UI/ModeIndicatorUI.cs index 694004e53e..ea0209a775 100644 --- a/UI/ModeIndicatorUI.cs +++ b/UI/ModeIndicatorUI.cs @@ -24,21 +24,49 @@ namespace CalamityMod.UI Texture2D armageddonIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorArma"); Texture2D maliceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorMalice"); + Rectangle mouseRectangle = Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + Vector2 drawCenter = new Vector2(Main.screenWidth - 400f, 72f) + outerAreaTexture.Size() * 0.5f; spriteBatch.Draw(outerAreaTexture, drawCenter, null, Color.White, 0f, outerAreaTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + Texture2D difficultyIconToUse = CalamityWorld.death ? deathIconTexture : revengeanceIconTexture; + bool modeIsActive = CalamityWorld.revenge; + bool renderingText = false; if (CalamityWorld.revenge) - { - Texture2D difficultyIconToUse = CalamityWorld.death ? deathIconTexture : revengeanceIconTexture; spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, difficultyIconToUse.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + // Rev/Death active text. + if (mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + DifficultyIconOffset, difficultyIconToUse.Size()))) + { + Main.instance.MouseText($"{(CalamityWorld.death ? "Death" : "Revengeance")} mode is {(modeIsActive ? "active" : "not active")}."); + renderingText = true; } if (CalamityWorld.armageddon) + { spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, armageddonIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + } + + // Armageddon active text. + if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + ArmageddonIconOffset, armageddonIconTexture.Size()))) + { + Main.instance.MouseText($"Armageddon mode is {(CalamityWorld.armageddon ? "active" : "not active")}."); + renderingText = true; + } if (CalamityWorld.malice) spriteBatch.Draw(maliceIconTexture, drawCenter + MaliceIconOffset, null, Color.White, 0f, maliceIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + // Malice active text. + if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + MaliceIconOffset, armageddonIconTexture.Size()))) + { + Main.instance.MouseText($"Malice mode is {(CalamityWorld.malice ? "active" : "not active")}."); + renderingText = true; + } + + if (renderingText) + Main.instance.MouseTextHackZoom(string.Empty); } } } From 954ffb73123132e261457748d4a3da431cf41825 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Mon, 28 Jun 2021 23:04:31 -0400 Subject: [PATCH 73/73] Mode is capitalized, Armageddon isn't Armageddon Mode --- UI/ModeIndicatorUI.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UI/ModeIndicatorUI.cs b/UI/ModeIndicatorUI.cs index ea0209a775..5967268016 100644 --- a/UI/ModeIndicatorUI.cs +++ b/UI/ModeIndicatorUI.cs @@ -39,7 +39,7 @@ namespace CalamityMod.UI // Rev/Death active text. if (mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + DifficultyIconOffset, difficultyIconToUse.Size()))) { - Main.instance.MouseText($"{(CalamityWorld.death ? "Death" : "Revengeance")} mode is {(modeIsActive ? "active" : "not active")}."); + Main.instance.MouseText($"{(CalamityWorld.death ? "Death" : "Revengeance")} Mode is {(modeIsActive ? "active" : "not active")}."); renderingText = true; } @@ -51,7 +51,7 @@ namespace CalamityMod.UI // Armageddon active text. if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + ArmageddonIconOffset, armageddonIconTexture.Size()))) { - Main.instance.MouseText($"Armageddon mode is {(CalamityWorld.armageddon ? "active" : "not active")}."); + Main.instance.MouseText($"Armageddon is {(CalamityWorld.armageddon ? "active" : "not active")}."); renderingText = true; } @@ -61,7 +61,7 @@ namespace CalamityMod.UI // Malice active text. if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + MaliceIconOffset, armageddonIconTexture.Size()))) { - Main.instance.MouseText($"Malice mode is {(CalamityWorld.malice ? "active" : "not active")}."); + Main.instance.MouseText($"Malice Mode is {(CalamityWorld.malice ? "active" : "not active")}."); renderingText = true; }