diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 0ebb0d5dd3..2577bc8695 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -271,15 +271,6 @@ namespace CalamityMod.CalPlayer { float rageGen = 0f; - // Draedon's Heart provides constant rage generation that scales with missing health. - if (modPlayer.draedonsHeart) - { - float percentMissingHealth = 1f - player.statLife / player.statLifeMax2; - float rageGainLerp = MathHelper.Lerp(DraedonsHeart.MinRagePerSecond, DraedonsHeart.MaxRagePerSecond, percentMissingHealth); - float dhRageGen = modPlayer.rageMax * rageGainLerp / 60f; - if (rageGen < dhRageGen) - rageGen = dhRageGen; - } // Shattered Community provides constant rage generation (stronger than Heart of Darkness). if (modPlayer.shatteredCommunity) { @@ -3883,7 +3874,6 @@ namespace CalamityMod.CalPlayer // Draedon's Heart bonus if (modPlayer.draedonsHeart) { - player.allDamage += 0.05f; if (player.StandingStill() && player.itemAnimation == 0) player.statDefense += (int)(player.statDefense * 0.75); } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 6bbbbc8cbf..935819aa37 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -1,30 +1,17 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.DataStructures; using Terraria.ID; +using Terraria.DataStructures; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class DraedonsHeart : ModItem { - // The percentage of a full Rage bar that is gained every second with Draedon's Heart equipped. - public const float MinRagePerSecond = 0.015f; - public const float MaxRagePerSecond = 0.045f; // 3x rage generation at 0% health, aka +200% rage generation - public override void SetStaticDefaults() { DisplayName.SetDefault("Draedon's Heart"); - Tooltip.SetDefault("Boosts your damage by 5% and max movement speed and acceleration by 5%\n" + - "You generate rage over time and rage does not fade away out of combat\n" + - "Passive rage generation increases drastically as health decreases\n" + - "Converts certain debuffs into buffs and extends their durations\n" + - "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, Broken Armor,\n" + - "Armor Crunch, War Cleave, Chilled, Ichor and Obstructed\n" + - "Receiving a hit causes you to only lose half of your max adrenaline rather than all of it\n" + - "Reduces the amount of defense stat damage you take by 50%\n" + + Tooltip.SetDefault("Reduces the amount of defense damage you take by 50%\n" + "Standing still regenerates your life quickly, reduces your damage by 50% and boosts your defense by 75%\n" + "Nanomachines, son"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 7)); @@ -34,32 +21,17 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.expert = true; + item.rare = ItemRarityID.Red; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.laudanum = true; - modPlayer.stressPills = true; - modPlayer.heartOfDarkness = true; modPlayer.draedonsHeart = true; } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.Nanites, 250); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } } } diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index d67e7dd65a..c7131d0a81 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ItemID.CrystalShard, 12); + recipe.AddIngredient(ItemID.CrystalShard, 6); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index 3926fc4d55..fa7df4c6cd 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 6); + recipe.AddIngredient(ItemID.CrystalShard, 3); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index e6aeacb2c8..61edef9fdc 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 6); + recipe.AddIngredient(ItemID.CrystalShard, 3); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index e912674001..a3316974d9 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 6); + recipe.AddIngredient(ItemID.CrystalShard, 3); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index 9b93ce9254..d206e65f9d 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 6); + recipe.AddIngredient(ItemID.CrystalShard, 3); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index cb590f5eb6..3ea12d0015 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ItemID.CrystalShard, 8); + recipe.AddIngredient(ItemID.CrystalShard, 4); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index be2a064568..72809634d1 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 6); + recipe.AddIngredient(ItemID.CrystalShard, 3); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs index c8adee338e..3a3d844998 100644 --- a/Items/Potions/RevivifyPotion.cs +++ b/Items/Potions/RevivifyPotion.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Potions recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ModContent.ItemType(), 100); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this, 5); recipe.AddRecipe(); diff --git a/Items/TreasureBags/DraedonTreasureBag.cs b/Items/TreasureBags/DraedonTreasureBag.cs new file mode 100644 index 0000000000..2d427947ab --- /dev/null +++ b/Items/TreasureBags/DraedonTreasureBag.cs @@ -0,0 +1,68 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +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.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags +{ + public class DraedonTreasureBag : ModItem + { + public override int BossBagNPC => ModContent.NPCType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = ItemRarityID.Cyan; + item.expert = true; + } + + public override bool CanRightClick() => true; + + public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); + + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); + + // Weapons + float w = DropHelper.BagWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(player, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + + // Equipment + DropHelper.DropItem(player, ModContent.ItemType()); + + // Vanity + // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + // DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + } + } +} diff --git a/Items/TreasureBags/DraedonTreasureBag.png b/Items/TreasureBags/DraedonTreasureBag.png new file mode 100644 index 0000000000..ece5dd54e5 Binary files /dev/null and b/Items/TreasureBags/DraedonTreasureBag.png differ diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index f581260826..7a3808bd52 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -48,8 +48,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ItemID.RainbowRod); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 7dcf2abc09..6430560952 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -99,8 +99,8 @@ namespace CalamityMod.Items.Weapons.Magic r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType(), 4); - r.AddIngredient(ItemID.FragmentSolar, 80); - r.AddIngredient(ItemID.FragmentNebula, 20); + r.AddIngredient(ItemID.FragmentSolar, 20); + r.AddIngredient(ItemID.FragmentNebula, 5); r.AddRecipe(); } } diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs index bfe0389fa9..8ee40e71eb 100644 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ b/Items/Weapons/Melee/CatastropheClaymore.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HallowedBar, 10); - recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.CrystalShard, 7); recipe.AddIngredient(ItemID.SoulofNight, 5); recipe.AddRecipeGroup("CursedFlameIchor", 5); recipe.AddIngredient(ItemID.SoulofMight, 3); diff --git a/Items/Weapons/Melee/CrystalBlade.cs b/Items/Weapons/Melee/CrystalBlade.cs index e44d25d89f..1f769f5039 100644 --- a/Items/Weapons/Melee/CrystalBlade.cs +++ b/Items/Weapons/Melee/CrystalBlade.cs @@ -35,14 +35,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.CrystalShard, 10); recipe.AddIngredient(ItemID.CobaltSword); recipe.AddIngredient(ItemID.PixieDust, 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 15); + recipe.AddIngredient(ItemID.CrystalShard, 10); recipe.AddIngredient(ItemID.PalladiumSword); recipe.AddIngredient(ItemID.PixieDust, 10); recipe.AddTile(TileID.MythrilAnvil); diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index be3b231ab3..df4e313394 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -79,13 +79,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.CrystalShard, 10); recipe.AddIngredient(ItemID.AdamantiteBar, 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.CrystalShard, 10); recipe.AddIngredient(ItemID.TitaniumBar, 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index c00482d590..5041f37f0c 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HolyWater, 100); recipe.AddRecipeGroup("AnyAdamantiteBar", 5); - recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ItemID.CrystalShard, 10); recipe.AddIngredient(ItemID.SoulofLight, 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 71efd22101..791f79bd8e 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -578,20 +578,19 @@ namespace CalamityMod } // Exo Mechs - // Loot requires edits // Collection requires edits // Instructions require edits // Despawn requires edits - /*{ + { BossDifficulty.TryGetValue("ExoMechs", out float order); List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; - string instructions = "By using a high-tech computer thing that somebody as stupid as you shouldn't be able to use, but whatever"; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + //List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = "By using a high-tech computer thing"; string despawn = CalamityUtils.ColorMessage("An imperfection after all...what a shame.", new Color(0x7F, 0xFF, 0xD4)); - string bossLogTex = "CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist"; - AddBoss(bossChecklist, calamity, "ExoMechs", order, bosses, DownedExoMechs, null, loot, collection, instructions, despawn, bossLogTex); - }*/ + //string bossLogTex = "CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist"; + //AddBoss(bossChecklist, calamity, "ExoMechs", order, bosses, DownedExoMechs, null, loot, collection, instructions, despawn, bossLogTex); + } // Supreme Calamitas { diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 6a0d3a9185..59e0d7ea3d 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; @@ -15,9 +16,23 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Apollo { - //[AutoloadBossHead] public class Apollo : ModNPC { + public static int phase1IconIndex; + public static int phase2IconIndex; + + internal static void LoadHeadIcons() + { + string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloHead"; + string phase2IconPath = "CalamityMod/NPCs/ExoMechs/Apollo/ApolloPhase2Head"; + + CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); + + CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); + phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + } + public enum Phase { Normal = 0, @@ -95,7 +110,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); + npc.value = Item.buyPrice(3, 33, 0, 0); npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -103,9 +118,18 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo npc.netAlways = true; npc.boss = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + bossBag = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) + public override void BossHeadSlot(ref int index) + { + if (npc.life / (float)npc.lifeMax < 0.6f) + index = phase2IconIndex; + else + index = phase1IconIndex; + } + + public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); @@ -688,23 +712,25 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo return false; } + public override bool SpecialNPCLoot() + { + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + ModContent.NPCType(), + ModContent.NPCType()); + npc.position = Main.npc[closestSegmentID].position; + return false; + } + public override void BossLoot(ref string name, ref int potionType) { potionType = ModContent.ItemType(); } - // Needs edits public override void NPCLoot() { - /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); - // Check if the other exo mechs are alive bool otherExoMechsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) @@ -718,12 +744,8 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo otherExoMechsAlive = true; } - // Mark Exo Mechs as dead if (!otherExoMechsAlive) - { - CalamityWorld.downedExoMechs = true; - CalamityNetcode.SyncWorld(); - }*/ + AresBody.DropExoMechLoot(npc); } // Needs edits diff --git a/NPCs/ExoMechs/Apollo/ApolloHead.png b/NPCs/ExoMechs/Apollo/ApolloHead.png new file mode 100644 index 0000000000..80f3142a48 Binary files /dev/null and b/NPCs/ExoMechs/Apollo/ApolloHead.png differ diff --git a/NPCs/ExoMechs/Apollo/ApolloPhase2Head.png b/NPCs/ExoMechs/Apollo/ApolloPhase2Head.png new file mode 100644 index 0000000000..e3e366d018 Binary files /dev/null and b/NPCs/ExoMechs/Apollo/ApolloPhase2Head.png differ diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 5041395d02..d6df87a6d4 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1,5 +1,9 @@ using CalamityMod.Events; using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; @@ -15,7 +19,7 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Ares { - //[AutoloadBossHead] + [AutoloadBossHead] public class AresBody : ModNPC { public enum Phase @@ -89,7 +93,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); + npc.value = Item.buyPrice(3, 33, 0, 0); npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -97,6 +101,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.netAlways = true; npc.boss = true; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + bossBag = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) @@ -689,18 +694,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares potionType = ModContent.ItemType(); } - // Needs edits public override void NPCLoot() { - /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); - // Check if the other exo mechs are alive bool otherExoMechsAlive = false; if (CalamityGlobalNPC.draedonExoMechWorm != -1) @@ -716,10 +713,38 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Mark Exo Mechs as dead if (!otherExoMechsAlive) + DropExoMechLoot(npc); + } + + public static void DropExoMechLoot(NPC npc) + { + DropHelper.DropBags(npc); + + // DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedExoMechs); + + // All other drops are contained in the bag, so they only drop directly on Normal + if (!Main.expertMode) { - CalamityWorld.downedExoMechs = true; - CalamityNetcode.SyncWorld(); - }*/ + // Weapons + float w = DropHelper.NormalWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + + // Vanity + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + } + + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Ares/AresBody_Head_Boss.png b/NPCs/ExoMechs/Ares/AresBody_Head_Boss.png new file mode 100644 index 0000000000..b99699f7ff Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresBody_Head_Boss.png differ diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index eb0c3adeb2..1a93f54644 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -15,9 +15,23 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Artemis { - //[AutoloadBossHead] public class Artemis : ModNPC { + public static int phase1IconIndex; + public static int phase2IconIndex; + + internal static void LoadHeadIcons() + { + string phase1IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead"; + string phase2IconPath = "CalamityMod/NPCs/ExoMechs/Artemis/ArtemisPhase2Head"; + + CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); + phase1IconIndex = ModContent.GetModBossHeadSlot(phase1IconPath); + + CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); + phase2IconIndex = ModContent.GetModBossHeadSlot(phase2IconPath); + } + public enum Phase { Normal = 0, @@ -120,7 +134,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -130,7 +143,15 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } - public override void SendExtraAI(BinaryWriter writer) + public override void BossHeadSlot(ref int index) + { + if (npc.life / (float)npc.lifeMax < 0.6f) + index = phase2IconIndex; + else + index = phase1IconIndex; + } + + public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); @@ -166,6 +187,17 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis bool revenge = CalamityWorld.revenge || malice; bool expertMode = Main.expertMode || malice; + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Target variable + Player player = Main.player[npc.target]; + // Check if the other exo mechs are alive int otherExoMechsAlive = 0; bool exoWormAlive = false; @@ -182,6 +214,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis { if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) { + // Set target to Apollo's target if Apollo is alive + player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].target]; + // Link the HP of both twins if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life) npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life; @@ -226,17 +261,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // If Artemis and Apollo don't go berserk bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoPrimeLifeRatio < 0.4f; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Target variable - Player player = Main.player[npc.target]; - // Spawn Apollo if it doesn't exist after the first 10 frames have passed if (npc.ai[0] < 10f) { @@ -1003,43 +1027,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis return false; } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ModContent.ItemType(); - } - - // Needs edits - public override void NPCLoot() - { - /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); - - // Check if the other exo mechs are alive - bool otherExoMechsAlive = false; - if (CalamityGlobalNPC.draedonExoMechWorm != -1) - { - if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) - otherExoMechsAlive = true; - } - if (CalamityGlobalNPC.draedonExoMechPrime != -1) - { - if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) - otherExoMechsAlive = true; - } - - // Mark Exo Mechs as dead - if (!otherExoMechsAlive) - { - CalamityWorld.downedExoMechs = true; - CalamityNetcode.SyncWorld(); - }*/ - } + public override bool PreNPCLoot() => false; // Needs edits public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Artemis/ArtemisHead.png b/NPCs/ExoMechs/Artemis/ArtemisHead.png new file mode 100644 index 0000000000..9ed3965858 Binary files /dev/null and b/NPCs/ExoMechs/Artemis/ArtemisHead.png differ diff --git a/NPCs/ExoMechs/Artemis/ArtemisPhase2Head.png b/NPCs/ExoMechs/Artemis/ArtemisPhase2Head.png new file mode 100644 index 0000000000..cb6d1ae1ba Binary files /dev/null and b/NPCs/ExoMechs/Artemis/ArtemisPhase2Head.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index e21075a414..78fcbb996f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -14,8 +14,23 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { - public class ThanatosBody1 : ModNPC + public class ThanatosBody1 : ModNPC { + public static int normalIconIndex; + public static int vulnerableIconIndex; + + internal static void LoadHeadIcons() + { + string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalBody"; + string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody"; + + CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); + + CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); + vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + } + // Whether the body is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); @@ -55,6 +70,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } + public override void BossHeadSlot(ref int index) + { + if (vulnerable) + index = vulnerableIconIndex; + else + index = normalIconIndex; + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); @@ -401,9 +429,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index b22afe9608..1c49259062 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -14,8 +14,23 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { - public class ThanatosBody2 : ModNPC + public class ThanatosBody2 : ModNPC { + public static int normalIconIndex; + public static int vulnerableIconIndex; + + internal static void LoadHeadIcons() + { + string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalBody"; + string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody"; + + CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); + + CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); + vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + } + // Whether the body is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); @@ -55,6 +70,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } + public override void BossHeadSlot(ref int index) + { + if (vulnerable) + index = vulnerableIconIndex; + else + index = normalIconIndex; + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); @@ -401,9 +429,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index bd6ac6b0eb..6d0dccb86f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -1,5 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; @@ -16,9 +17,23 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { - //[AutoloadBossHead] public class ThanatosHead : ModNPC { + public static int normalIconIndex; + public static int vulnerableIconIndex; + + internal static void LoadHeadIcons() + { + string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead"; + string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead"; + + CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); + + CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); + vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + } + public enum Phase { Charge = 0, @@ -110,7 +125,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos aiType = -1; npc.Opacity = 0f; npc.knockBackResist = 0f; - npc.value = Item.buyPrice(10, 0, 0, 0); + npc.value = Item.buyPrice(3, 33, 0, 0); npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -120,9 +135,23 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.boss = true; npc.chaseable = false; music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + bossBag = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) + public override void BossHeadSlot(ref int index) + { + if (vulnerable) + index = vulnerableIconIndex; + else + index = normalIconIndex; + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + + public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); @@ -150,7 +179,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[i] = reader.ReadSingle(); } - public override void AI() + public override void AI() { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -895,17 +924,21 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos potionType = ModContent.ItemType(); } + public override bool SpecialNPCLoot() + { + int closestSegmentID = DropHelper.FindClosestWormSegment(npc, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType()); + npc.position = Main.npc[closestSegmentID].position; + return false; + } + public override void NPCLoot() { - /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); + // DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); - DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); - // Check if the other exo mechs are alive bool otherExoMechsAlive = false; if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) @@ -919,12 +952,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos otherExoMechsAlive = true; } - // Mark Exo Mechs as dead if (!otherExoMechsAlive) - { - CalamityWorld.downedExoMechs = true; - CalamityNetcode.SyncWorld(); - }*/ + AresBody.DropExoMechLoot(npc); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png b/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png new file mode 100644 index 0000000000..9c496d1e77 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosNormalBody.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png b/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png new file mode 100644 index 0000000000..1c485fcc41 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosNormalHead.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png b/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png new file mode 100644 index 0000000000..45a93ddc59 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosNormalTail.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 89bfba078c..f590452b41 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -13,8 +13,23 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.ExoMechs.Thanatos { - public class ThanatosTail : ModNPC + public class ThanatosTail : ModNPC { + public static int normalIconIndex; + public static int vulnerableIconIndex; + + internal static void LoadHeadIcons() + { + string normalIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalTail"; + string vulnerableIconPath = "CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail"; + + CalamityMod.Instance.AddBossHeadTexture(normalIconPath, -1); + normalIconIndex = ModContent.GetModBossHeadSlot(normalIconPath); + + CalamityMod.Instance.AddBossHeadTexture(vulnerableIconPath, -1); + vulnerableIconIndex = ModContent.GetModBossHeadSlot(vulnerableIconPath); + } + // Whether the tail is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); @@ -54,6 +69,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; } + public override void BossHeadSlot(ref int index) + { + if (vulnerable) + index = vulnerableIconIndex; + else + index = normalIconIndex; + } + + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); @@ -400,9 +428,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechWorm].target]; + Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2); + float num191 = player.position.X + (player.width / 2); + float num192 = player.position.Y + (player.height / 2); num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png new file mode 100644 index 0000000000..c45262044c Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableBody.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png new file mode 100644 index 0000000000..f6394a48ae Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableHead.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png new file mode 100644 index 0000000000..be37ce6997 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosVulnerableTail.png differ