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] 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%WR3)(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