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 0000000000..b6d9064a49 Binary files /dev/null and b/NPCs/TownNPCs/WITCH.png differ diff --git a/NPCs/TownNPCs/WITCH_Head.png b/NPCs/TownNPCs/WITCH_Head.png new file mode 100644 index 0000000000..d6eb8aeaa3 Binary files /dev/null and b/NPCs/TownNPCs/WITCH_Head.png differ diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index e8844e2635..e8429d39d3 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public class SeethingDischargeBrimstoneHellblast : ModProjectile { + private bool initialized = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hellblast"); @@ -33,6 +35,16 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + if (!initialized) + { + if (projectile.npcProj) + { + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.penetrate = 10; + } + initialized = true; + } projectile.frameCounter++; if (projectile.frameCounter >= 10) {