diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 3461b51f64..66439d5931 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -444,13 +444,14 @@ namespace CalamityMod.CalPlayer Rectangle frame = texture.Frame(1, 4, 0, modPlayer.tailFrame); if (modPlayer.fathomSwarmerTail) { + int dyeShader = drawPlayer.dye?[2].dye ?? 0; int frameSizeY = texture.Height / 4; int centerX = (int)(drawInfo.position.X + drawPlayer.width / 2f); int centerY = (int)(drawInfo.position.Y + drawPlayer.height / 2f); int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X - (3 * drawPlayer.direction)); int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); - Color color = Lighting.GetColor(centerX, centerY); - DrawData tailDrawData = new DrawData(texture, new Vector2(drawX, drawY), frame, color, 0f, new Vector2(texture.Width / 2f, frameSizeY / 2f), 1f, drawInfo.spriteEffects, 0); + DrawData tailDrawData = new DrawData(texture, new Vector2(drawX, drawY), frame, drawInfo.pantsColor, 0f, new Vector2(texture.Width / 2f, frameSizeY / 2f), 1f, drawInfo.spriteEffects, 0); + tailDrawData.shader = dyeShader; Main.playerDrawData.Add(tailDrawData); } }); diff --git a/CalamityLists.cs b/CalamityLists.cs index 03445ee35d..095bd4b54c 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -772,7 +772,7 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), diff --git a/CalamityMod.cs b/CalamityMod.cs index 97f607582d..c2e5bb9045 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -585,88 +585,96 @@ namespace CalamityMod #region Boss Kill Times private void SetupBossKillTimes() { - // 3600 = 1 minute - + // Kill times are measured exactly in frames. + // 60 frames = 1 second + // 3600 frames = 1 minute bossKillTimes = new SortedDictionary { - { NPCID.KingSlime, 3600 }, - { NPCID.EyeofCthulhu, 5400 }, - { NPCID.EaterofWorldsHead, 7200 }, + // + // VANILLA BOSSES + // + { NPCID.KingSlime, 3600 }, // 1:00 (60 seconds) + { NPCID.EyeofCthulhu, 5400 }, // 1:30 (90 seconds) + { NPCID.EaterofWorldsHead, 7200 }, // 2:00 (120 seconds) { NPCID.EaterofWorldsBody, 7200 }, { NPCID.EaterofWorldsTail, 7200 }, - { NPCID.BrainofCthulhu, 5400 }, - { NPCID.Creeper, 1800 }, - { NPCID.QueenBee, 7200 }, - { NPCID.SkeletronHead, 7200 }, - { NPCID.WallofFlesh, 7200 }, + { NPCID.BrainofCthulhu, 5400 }, // 1:30 (90 seconds) + { NPCID.Creeper, 1800 }, // 0:30 (30 seconds) + { NPCID.QueenBee, 7200 }, // 2:00 (120 seconds) + { NPCID.SkeletronHead, 9000 }, // 2:30 (150 seconds) + { NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds) { NPCID.WallofFleshEye, 7200 }, - { NPCID.Spazmatism, 10800 }, + { NPCID.Spazmatism, 10800 }, // 3:00 (180 seconds) { NPCID.Retinazer, 10800 }, - { NPCID.TheDestroyer, 10800 }, + { NPCID.TheDestroyer, 10800 }, // 3:00 (180 seconds) { NPCID.TheDestroyerBody, 10800 }, { NPCID.TheDestroyerTail, 10800 }, - { NPCID.SkeletronPrime, 10800 }, - { NPCID.Plantera, 10800 }, - { NPCID.Golem, 9000 }, - { NPCID.GolemHead, 3600 }, - { NPCID.DukeFishron, 9000 }, - { NPCID.CultistBoss, 9000 }, - { NPCID.MoonLordCore, 14400 }, - { NPCID.MoonLordHand, 7200 }, - { NPCID.MoonLordHead, 7200 }, - { ModContent.NPCType(), 3600 }, + { NPCID.SkeletronPrime, 10800 }, // 3:00 (180 seconds) + { NPCID.Plantera, 10800 }, // 3:00 (180 seconds) + { NPCID.Golem, 9000 }, // 2:30 (150 seconds) + { NPCID.GolemHead, 3600 }, // 1:00 (60 seconds) + { NPCID.DukeFishron, 9000 }, // 2:30 (150 seconds) + { NPCID.CultistBoss, 9000 }, // 2:30 (150 seconds) + { NPCID.MoonLordCore, 14400 }, // 4:00 (240 seconds) + { NPCID.MoonLordHand, 7200 }, // 2:00 (120 seconds) + { NPCID.MoonLordHead, 7200 }, // 2:00 (120 seconds) + + // + // CALAMITY BOSSES + // + { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) { ModContent.NPCType(), 3600 }, { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 5400 }, // 1:30 (90 seconds) + { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) + { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) -- total length of Slime God fight + { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) + { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) + { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) -- split slimes should spawn at 1:00 and die at around 2:00 + { ModContent.NPCType(), 3600 }, // 1:00 (60 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 14400 }, + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) -- first phase is 1:00 { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 14400 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 1200 }, - { ModContent.NPCType(), 8100 }, + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 5400 }, // 1:30 (90 seconds) + { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) + { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 1200 }, // 0:20 (20 seconds) + { ModContent.NPCType(), 8100 }, // 2:15 (135 seconds) { ModContent.NPCType(), 8100 }, { ModContent.NPCType(), 8100 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 14400 }, - { ModContent.NPCType(), 14400 }, - { ModContent.NPCType(), 14400 }, - { ModContent.NPCType(), 15300 }, - { ModContent.NPCType(), 18000 }, - { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 7200 }, // 2:00 (120 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 10800 }, // 3:00 (180 seconds) + { ModContent.NPCType(), 14400 }, // 4:00 (240 seconds) + { ModContent.NPCType(), 14400 }, // NOTE: Sentinels Phase takes 1:00, so with that included it's 5:00 + { ModContent.NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 + { ModContent.NPCType(), 14700 }, // 4:05 (245 seconds) -- he spends 5 seconds invincible where you can't do anything + { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) { ModContent.NPCType(), 21600 }, { ModContent.NPCType(), 21600 }, { ModContent.NPCType(), 21600 }, { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, // 6:00 (360 seconds) { ModContent.NPCType(), 21600 }, { ModContent.NPCType(), 21600 }, { ModContent.NPCType(), 21600 }, - { ModContent.NPCType(), 18000 } + { ModContent.NPCType(), 18000 }, // 5:00 (300 seconds) + { ModContent.NPCType(), 18000 } // 5:00 (300 seconds) }; } #endregion diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index d164469225..3e28c128e2 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -86,7 +86,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Item.Prefix += RelaxPrefixRequirements; On.Terraria.NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; IL.Terraria.NPC.SpawnNPC += MakeVoodooDemonDollWork; - IL.Terraria.NPC.VanillaHitEffect += RemoveLavaDropsFromExpertLavaSlimes; + //IL.Terraria.NPC.VanillaHitEffect += RemoveLavaDropsFromExpertLavaSlimes; IL.Terraria.Main.UpdateTime += BloodMoonsRequire200MaxLife; // Fix vanilla bugs exposed by Calamity mechanics @@ -159,7 +159,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Item.Prefix -= RelaxPrefixRequirements; On.Terraria.NPC.SlimeRainSpawns -= PreventBossSlimeRainSpawns; IL.Terraria.NPC.SpawnNPC -= MakeVoodooDemonDollWork; - IL.Terraria.NPC.VanillaHitEffect -= RemoveLavaDropsFromExpertLavaSlimes; + //IL.Terraria.NPC.VanillaHitEffect -= RemoveLavaDropsFromExpertLavaSlimes; IL.Terraria.Main.UpdateTime -= BloodMoonsRequire200MaxLife; // Fix vanilla bugs exposed by Calamity mechanics diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 3e860b30b3..bdfe16a370 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.dashMod = 4; + player.dash = 0; modPlayer.elysianAegis = true; modPlayer.abaddon = true; player.noKnockback = true; diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index a3825a44b7..50fbc170b1 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.dashMod = 2; + player.dash = 0; player.noKnockback = true; player.fireWalk = true; modPlayer.abaddon = true; diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index 336e3c1d95..2e15b7e237 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.dodgeScarf = true; modPlayer.dashMod = 1; + player.dash = 0; } } } diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index 4440b7a495..8def81b9b3 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.deepDiver = true; modPlayer.dashMod = 5; + player.dash = 0; } } } diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index c3e28f477e..d8993a2715 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.dashMod = 3; + player.dash = 0; modPlayer.elysianAegis = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[ModContent.BuffType()] = true; diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index fc6a945870..f015bd41af 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Accessories modPlayer.dodgeScarf = true; modPlayer.evasionScarf = true; modPlayer.dashMod = 1; + player.dash = 0; } public override void AddRecipes() diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 387377072d..eb1480708b 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Accessories player.statLifeMax2 += 20; } player.Calamity().dashMod = 6; + player.dash = 0; } public override void AddRecipes() diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index a786861756..8d3e560698 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -38,6 +38,7 @@ namespace CalamityMod.Items.Accessories player.noFallDmg = true; player.blackBelt = true; modPlayer.dashMod = 7; + player.dash = 0; player.spikedBoots = 2; } diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index c8edefe659..8565a62f41 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Accessories player.extraFall += 35; player.blackBelt = true; player.dash = 1; + player.Calamity().dashMod = 0; player.spikedBoots = 2; } @@ -42,8 +43,8 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ItemID.MasterNinjaGear); recipe.AddIngredient(ItemID.FrogLeg); recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/UnstablePrism.cs b/Items/Accessories/UnstablePrism.cs index 9b250daf51..00bb5af62e 100644 --- a/Items/Accessories/UnstablePrism.cs +++ b/Items/Accessories/UnstablePrism.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories { public override void SetStaticDefaults() { - DisplayName.SetDefault("Unstable Prism"); + DisplayName.SetDefault("Unstable Granite Core"); Tooltip.SetDefault("Three sparks are released on critical hits"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 5)); } diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index c79aa12c05..59bf7108ee 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -53,7 +53,10 @@ namespace CalamityMod.Items.Armor player.aggro += 1000; if (modPlayer.godSlayerDashHotKeyPressed) + { modPlayer.dashMod = 9; + player.dash = 0; + } } public override void UpdateEquip(Player player) diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 2409a4879a..9200d507da 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -48,7 +48,10 @@ namespace CalamityMod.Items.Armor "You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds"; if (modPlayer.godSlayerDashHotKeyPressed) + { modPlayer.dashMod = 9; + player.dash = 0; + } } public override void UpdateEquip(Player player) diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 602007176d..3f6b7d852f 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -55,7 +55,10 @@ namespace CalamityMod.Items.Armor "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; if (modPlayer.godSlayerDashHotKeyPressed) + { modPlayer.dashMod = 9; + player.dash = 0; + } } public override void UpdateEquip(Player player) diff --git a/Items/Armor/PlaguebringerVisor.cs b/Items/Armor/PlaguebringerVisor.cs index 3df72a7624..d71d843f10 100644 --- a/Items/Armor/PlaguebringerVisor.cs +++ b/Items/Armor/PlaguebringerVisor.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Armor player.Calamity().plaguebringerPatronSet = true; player.Calamity().dashMod = 8; + player.dash = 0; player.maxMinions += 3; if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index de9dd4cb95..27e04c2218 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -16,8 +14,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Silva Armor"); Tooltip.SetDefault("+80 max life\n" + - "12% increased damage and 8% increased critical strike chance\n" + - "Grants immunity to the irradiated debuff"); + "12% increased damage and 8% increased critical strike chance"); } public override void SetDefaults() @@ -35,13 +32,11 @@ namespace CalamityMod.Items.Armor player.statLifeMax2 += 80; player.allDamage += 0.12f; player.Calamity().AllCritBoost(8); - player.buffImmune[ModContent.BuffType()] = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddRecipeGroup("AnyGoldBar", 10); recipe.AddIngredient(ModContent.ItemType(), 12); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a013d48488..da66668749 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -998,6 +998,8 @@ namespace CalamityMod.Items return "HuntressTier3"; if (head.type == ItemID.ApprenticeAltHead && body.type == ItemID.ApprenticeAltShirt && legs.type == ItemID.ApprenticeAltPants) return "ApprenticeTier3"; + if (head.type == ItemID.SolarFlareHelmet && body.type == ItemID.SolarFlareBreastplate && legs.type == ItemID.SolarFlareLeggings) + return "SolarFlare"; return ""; } @@ -1130,6 +1132,10 @@ namespace CalamityMod.Items player.magicCrit += 15; player.setBonus += "\n10% increased minion damage and 15% increased magic critical strike chance"; } + else if (set == "SolarFlare") + { + modPlayer.dashMod = 0; + } } #endregion @@ -1532,6 +1538,9 @@ namespace CalamityMod.Items if (item.type == ItemID.HandWarmer) modPlayer.handWarmer = true; + if (item.type == ItemID.EoCShield || item.type == ItemID.Tabi || item.type == ItemID.MasterNinjaGear) + modPlayer.dashMod = 0; + // Hard / Guarding / Armored / Warding give 0.25% / 0.5% / 0.75% / 1% DR if (item.prefix == PrefixID.Hard) { diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs index bf8bda03f7..c1c9d82ef7 100644 --- a/Items/DifficultyItems/Malice.cs +++ b/Items/DifficultyItems/Malice.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.DifficultyItems "All boss minions no longer drop hearts.\n" + "Enrages all bosses and gives them new AI.\n" + "Bosses and their projectiles deal 35% more damage.\n" + - "Most bosses will enter later phases sooner if the fight has gone on for a long time.\n" + "Increases the velocity of most boss projectiles by 25%, this is increased to 35% during Boss Rush.\n" + "Boss reactive DR is always active outside of Boss Rush and is increased by 50%."); } diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index 5660709f9e..c438a251f0 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -34,8 +34,7 @@ namespace CalamityMod.Items.DifficultyItems // Boss lines "All boss minions no longer drop hearts.\n" + "Changes all boss AIs and some enemy AIs.\n" + - "Increases the health and damage of all bosses.\n" + - "Most bosses will enter later phases sooner if the fight has gone on for a long time."); + "Increases the health and damage of all bosses."); } public override void SetDefaults() diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 8ab63bed70..b14b3b14ba 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ItemID.DemoniteBar, 9, 14); DropHelper.DropItem(player, ItemID.RottenChunk, 10, 20); DropHelper.DropItemCondition(player, ItemID.CursedFlame, Main.hardMode, 15, 30); - DropHelper.DropItem(player, ItemID.CorruptSeeds, 2, 4); + DropHelper.DropItem(player, ItemID.CorruptSeeds, 10, 15); // Weapons float w = DropHelper.BagWeaponDropRateFloat; diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index fd7e50a36f..f8ef1b5ccd 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ItemID.CrimtaneBar, 9, 14); DropHelper.DropItem(player, ItemID.Vertebrae, 10, 20); DropHelper.DropItemCondition(player, ItemID.Ichor, Main.hardMode, 15, 30); - DropHelper.DropItem(player, ItemID.CrimsonSeeds, 2, 4); + DropHelper.DropItem(player, ItemID.CrimsonSeeds, 10, 15); // Weapons float w = DropHelper.BagWeaponDropRateFloat; diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 3e28c919d1..6433c7a98d 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -42,84 +42,46 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) - { - Main.PlaySound(SoundID.Item74, (int)target.position.X, (int)target.position.Y); - target.position.X += (float)(target.width / 2); - target.position.Y += (float)(target.height / 2); - target.position.X -= (float)(target.width / 2); - target.position.Y -= (float)(target.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 25; num623++) - { - int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - int num251 = Main.rand.Next(4, 6); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, 0f); - } - } + OnHitEffects(player, target.life <= 0, target.Center, target.width, target.height, knockback); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) + OnHitEffects(player, target.statLife <= 0, target.Center, target.width, target.height, item.knockBack); + } + + private void OnHitEffects(Player player, bool health, Vector2 targetPos, int targetWidth, int targetHeight, float kBack) + { + if (health) { - Main.PlaySound(SoundID.Item74, (int)target.position.X, (int)target.position.Y); - target.position.X += (float)(target.width / 2); - target.position.Y += (float)(target.height / 2); - target.position.X -= (float)(target.width / 2); - target.position.Y -= (float)(target.height / 2); - for (int num621 = 0; num621 < 15; num621++) + Main.PlaySound(SoundID.Item74, targetPos); + targetPos.X += (float)(targetWidth / 2); + targetPos.Y += (float)(targetHeight / 2); + targetPos.X -= (float)(targetWidth / 2); + targetPos.Y -= (float)(targetHeight / 2); + for (int i = 0; i < 15; i++) { - int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int idx = Dust.NewDust(targetPos, targetWidth, targetHeight, 5, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 3f; if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 25; num623++) + for (int i = 0; i < 25; i++) { - int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int idx = Dust.NewDust(targetPos, targetWidth, targetHeight, 5, 0f, 0f, 100, default, 3f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 5f; + idx = Dust.NewDust(targetPos, targetWidth, targetHeight, 5, 0f, 0f, 100, default, 2f); + Main.dust[idx].velocity *= 2f; } - int num251 = Main.rand.Next(4, 6); - for (int num252 = 0; num252 < num251; num252++) + int bloodAmt = Main.rand.Next(4, 6); + for (int i = 0; i < bloodAmt; i++) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, 0f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(targetPos, velocity, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), kBack, player.whoAmI, 0f, 0f); } } } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index 717afd4118..5c7a8a887f 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Universal Genesis"); - Tooltip.SetDefault("Seeing the cosmos makes you realize how insignificant we are\n" + - "Fires a spread of bullets from the gun and a spread of stars above the cursor\n" + + Tooltip.SetDefault("Let the starry sky fall upon your enemies\n" + + "Fires a spread of bullets from the gun and a flurry of stars to rain down on the cursor\n" + "Converts musket balls into starcaller shots that summon additional stars on enemy hits\n" + "50% chance to not consume ammo"); } @@ -87,7 +87,7 @@ namespace CalamityMod.Items.Weapons.Ranged yDist *= travelDist; float xVel = xDist + Main.rand.NextFloat(-0.6f, 0.6f); float yVel = yDist + Main.rand.NextFloat(-0.6f, 0.6f); - int star = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, xVel, yVel, ModContent.ProjectileType(), starDmg, knockBack, player.whoAmI, i); + int star = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, xVel, yVel, ModContent.ProjectileType(), starDmg, knockBack, player.whoAmI, i, 1f); Main.projectile[star].extraUpdates = 2; Main.projectile[star].localNPCHitCooldown = 30; } diff --git a/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs b/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs index ebb4c5aaa8..1200b303cd 100644 --- a/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs +++ b/NPCs/AdultEidolonWyrm/EidolonWyrmHeadHuge.cs @@ -151,13 +151,6 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < 0.8f; bool phase3 = lifeRatio < 0.6f; diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 859677eafc..88ba0ab8cf 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -107,13 +107,6 @@ namespace CalamityMod.NPCs.Bumblebirb // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); @@ -199,13 +192,6 @@ namespace CalamityMod.NPCs.Bumblebirb // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index fd73a177e9..ce1a306c76 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -62,13 +62,6 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; @@ -703,13 +696,6 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - bool phase2 = lifeRatio < 0.5f && revenge; bool phase3 = lifeRatio < 0.33f; @@ -1254,13 +1240,6 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase3 = lifeRatio < 0.7f; bool phase4 = lifeRatio < 0.35f; @@ -2046,13 +2025,6 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || malice; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -2335,13 +2307,6 @@ namespace CalamityMod.NPCs bool expertMode = Main.expertMode || malice; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); @@ -2623,13 +2588,6 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - float shootTimer = 1f; if (expertMode) shootTimer += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); @@ -3316,13 +3274,6 @@ namespace CalamityMod.NPCs // Life float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases based on life percentage bool halfHealth = npc.life / (float)npc.lifeMax < 0.5f; bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; @@ -3892,7 +3843,7 @@ namespace CalamityMod.NPCs npc.TargetClosest(); if (Vector2.Distance(player.Center, npc.Center) > 80f) { - Main.PlaySound(SoundID.Item12, npc.Center); + Main.PlaySound(phase2 ? SoundID.Item91 : SoundID.Item12, npc.Center); float num941 = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); float num942 = player.position.X + player.width * 0.5f - vector104.X; @@ -3910,13 +3861,13 @@ namespace CalamityMod.NPCs if (phase2) { // Waving beams need to start offset so they cross each other neatly. - float waveSideOffset = Main.rand.NextFloat(18f, 28f); + float waveSideOffset = Main.rand.NextFloat(9f, 14f); Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; for (int i = -1; i <= 1; i += 2) { Vector2 laserStartPos = vector104 + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); - Projectile godRay = Projectile.NewProjectileDirect(laserStartPos, laserVelocity * 0.25f, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile godRay = Projectile.NewProjectileDirect(laserStartPos, laserVelocity * 0.9f, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); // Tell this Phased God Ray exactly which way it should be waving. godRay.localAI[1] = i * 0.5f; @@ -3926,7 +3877,7 @@ namespace CalamityMod.NPCs { Projectile.NewProjectile(vector104, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); if (doubleLasersAndSplittingMines && npc.ai[0] % 4f == 0f) - Projectile.NewProjectile(vector104, laserVelocity * 0.75f, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(vector104, laserVelocity * 0.9f, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } @@ -4013,13 +3964,6 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio <= 0.7; bool phase3 = lifeRatio <= 0.4; @@ -4675,13 +4619,6 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; @@ -5496,13 +5433,6 @@ namespace CalamityMod.NPCs bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; bool phase2AI = npc.ai[0] > 4f; diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index abcb39188e..ccc872673a 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -8102,7 +8102,7 @@ namespace CalamityMod.NPCs } } } - else if (npc.type == NPCID.Wolf || npc.type == NPCID.Hellhound || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.Wolf || npc.type == NPCID.Hellhound || npc.type == ModContent.NPCType()) { if (npc.velocity.Y == 0f && num4 < 100f && Math.Abs(npc.velocity.X) > 3f && ((npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) && npc.velocity.X > 0f) || (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) && npc.velocity.X < 0f))) { @@ -8159,7 +8159,7 @@ namespace CalamityMod.NPCs float num7 = 0.1f; if (!flag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0))) { - if (npc.type == NPCID.Wolf || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.Wolf || npc.type == ModContent.NPCType()) { if (npc.velocity.X > 0f && npc.direction < 0) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 524edb45db..dd31896e5c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -168,8 +168,6 @@ namespace CalamityMod.NPCs internal const int maxAIMod = 4; public float[] newAI = new float[maxAIMod]; public int AITimer = 0; - public int AIIncreasedAggressionTimer = 0; - public float killTimeRatio_IncreasedAggression = 0f; // Town NPC Patreon public bool setNewName = true; @@ -2753,14 +2751,6 @@ namespace CalamityMod.NPCs { if (AITimer < KillTime) AITimer++; - - // Separate timer for aggression to avoid entering later phases too quickly - int aggressionTimerCap = (int)(KillTime * 1.5); - if (AIIncreasedAggressionTimer < aggressionTimerCap) - AIIncreasedAggressionTimer++; - - // Increases aggression over time if the fight is taking too long - killTimeRatio_IncreasedAggression = 1f - (AIIncreasedAggressionTimer / (float)aggressionTimerCap); } } @@ -3387,7 +3377,7 @@ namespace CalamityMod.NPCs } break; case 26: - if (npc.type == NPCType()) + if (npc.type == NPCType()) { return CalamityGlobalAI.BuffedUnicornAI(npc, mod); } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index aa0c332e85..16e34216e3 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -90,13 +90,6 @@ namespace CalamityMod.NPCs.Crabulon // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < 0.66f && expertMode; bool phase3 = lifeRatio < 0.33f && expertMode; diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 684d48bd2e..2cb2a85991 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -140,13 +140,6 @@ namespace CalamityMod.NPCs.Cryogen // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < (revenge ? 0.85f : 0.8f); bool phase3 = lifeRatio < (revenge ? 0.7f : 0.6f); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 19acf6793f..d353516109 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -129,13 +129,6 @@ namespace CalamityMod.NPCs.DesertScourge // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) npc.Calamity().newAI[0] += 1f; diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index a6b82e240f..57505549a5 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -272,13 +272,6 @@ namespace CalamityMod.NPCs.DevourerofGods // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phase 1 phases bool phase2 = lifeRatio < 0.9f; bool phase3 = lifeRatio < 0.68f; @@ -371,9 +364,8 @@ namespace CalamityMod.NPCs.DevourerofGods { Phase2Started = true; - // Timed DR and aggression + // Timed DR calamityGlobalNPC.AITimer = CalamityGlobalNPC.DoGPhase1KillTime; - calamityGlobalNPC.AIIncreasedAggressionTimer = CalamityGlobalNPC.DoGPhase1KillTime; // Reset important shit npc.ai[3] = 0f; diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 17ca36db2f..9d0be10292 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -115,9 +115,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Primitive trail drawer for the ribbon things public PrimitiveTrail RibbonTrail = null; + public const string NameToDisplay = "XS-03 Apollo"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("XS-03 Apollo"); + DisplayName.SetDefault(NameToDisplay); NPCID.Sets.TrailingMode[npc.type] = 3; NPCID.Sets.TrailCacheLength[npc.type] = 15; } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 4843c538a1..0d833a2f24 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -127,9 +127,11 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Primitive trail drawer for the ribbon things public PrimitiveTrail RibbonTrail = null; + public const string NameToDisplay = "XS-01 Artemis"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("XS-01 Artemis"); + DisplayName.SetDefault(NameToDisplay); NPCID.Sets.TrailingMode[npc.type] = 3; NPCID.Sets.TrailCacheLength[npc.type] = 15; } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 04e69f8c0d..a93dc527ee 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -361,13 +361,6 @@ namespace CalamityMod.NPCs.HiveMind // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Enrage if ((!player.ZoneCorrupt || (npc.position.Y / 16f) < Main.worldSurface) && !BossRushEvent.BossRushActive) { @@ -1111,7 +1104,7 @@ namespace CalamityMod.NPCs.HiveMind DropHelper.DropItemSpray(npc, ItemID.RottenChunk, 9, 15, 3); if (Main.hardMode) DropHelper.DropItemSpray(npc, ItemID.CursedFlame, 10, 20, 2); - DropHelper.DropItem(npc, ItemID.CorruptSeeds, 2, 4); + DropHelper.DropItem(npc, ItemID.CorruptSeeds, 10, 15); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 306e81b406..e70a1e8a57 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -82,13 +82,6 @@ namespace CalamityMod.NPCs.Leviathan // Percent life remaining float lifeRatio = Main.npc[CalamityGlobalNPC.leviathan].life / (float)Main.npc[CalamityGlobalNPC.leviathan].lifeMax; - if (CalamityWorld.revenge || CalamityWorld.malice || BossRushEvent.BossRushActive || Main.npc[CalamityGlobalNPC.leviathan].Calamity().enraged > 0) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > Main.npc[CalamityGlobalNPC.leviathan].Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = Main.npc[CalamityGlobalNPC.leviathan].Calamity().killTimeRatio_IncreasedAggression; - } - // Phases bool leviathanInPhase4 = lifeRatio < 0.2f; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index b307847d36..1e6c54d8bb 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -112,13 +112,6 @@ namespace CalamityMod.NPCs.Leviathan // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < 0.7f && expertMode; bool phase3 = lifeRatio < 0.4f; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index c3a9907d5b..b80a6fd9c9 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -150,13 +150,6 @@ namespace CalamityMod.NPCs.Leviathan float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - float bubbleVelocity = death ? 9f : revenge ? 7f : expertMode ? 6f : 5f; bubbleVelocity += 4f * enrageScale; if (!leviAlive) diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Rotdog.cs similarity index 96% rename from NPCs/NormalNPCs/Pitbull.cs rename to NPCs/NormalNPCs/Rotdog.cs index dcdf95dcaa..bcfd7d5592 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -6,11 +6,11 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class Pitbull : ModNPC + public class Rotdog : ModNPC { public override void SetStaticDefaults() { - DisplayName.SetDefault("Pitbull"); + DisplayName.SetDefault("Rotdog"); Main.npcFrameCount[npc.type] = 10; } diff --git a/NPCs/NormalNPCs/Pitbull.png b/NPCs/NormalNPCs/Rotdog.png similarity index 100% rename from NPCs/NormalNPCs/Pitbull.png rename to NPCs/NormalNPCs/Rotdog.png diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 37b61286a4..da21a770a6 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -101,13 +101,6 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) npc.Calamity().newAI[0] += 1f; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index b7fe06f677..c162f7aa4c 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -75,13 +75,6 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - float speed = 8f; float turnSpeed = 0.06f; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 2b35d915a1..d137fa6e7e 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -97,13 +97,6 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - float speed = 0.15f; float turnSpeed = 0.1f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index c867e1efca..9c0fde1688 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -123,13 +123,6 @@ namespace CalamityMod.NPCs.Perforator // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; @@ -488,7 +481,7 @@ namespace CalamityMod.NPCs.Perforator DropHelper.DropItemSpray(npc, ItemID.Vertebrae, 3, 9); if (Main.hardMode) DropHelper.DropItemSpray(npc, ItemID.Ichor, 10, 20, 2); - DropHelper.DropItem(npc, ItemID.CrimsonSeeds, 2, 4); + DropHelper.DropItem(npc, ItemID.CrimsonSeeds, 10, 15); // Weapons float w = DropHelper.NormalWeaponDropRateFloat; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index c74c9ef2b0..5ea79a0fcf 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -122,13 +122,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index e467a755e0..a3f5050262 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -151,13 +151,6 @@ namespace CalamityMod.NPCs.Polterghast bool revenge = CalamityWorld.revenge || malice; bool expertMode = Main.expertMode || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Phases bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); bool phase3 = lifeRatio < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); @@ -1108,13 +1101,6 @@ namespace CalamityMod.NPCs.Polterghast bool revenge = CalamityWorld.revenge || malice; bool death = CalamityWorld.death || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; - } - bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); bool phase3 = lifeRatio < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index a4704b170e..0c4cd9d091 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -87,13 +87,6 @@ namespace CalamityMod.NPCs.Polterghast // Percent life remaining, Polter float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression; - } - // Scale multiplier based on nearby active tiles float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 14ea39e2e5..d7c02e8add 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -100,13 +100,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - Vector2 vectorCenter = npc.Center; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) { diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 489df2337f..5e5a01fefa 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -198,13 +198,6 @@ namespace CalamityMod.NPCs.Providence // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Play enrage animation if night starts if (nightTime && calamityGlobalNPC.newAI[3] == spawnAnimationTime) { diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 6bf7366949..54fa4167b9 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -108,13 +108,6 @@ namespace CalamityMod.NPCs.Ravager // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Large fire light Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); Lighting.AddLight((int)(npc.Center.X + 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index e0903c31ed..ecf9da45a3 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -106,13 +106,6 @@ namespace CalamityMod.NPCs.Signus double lifeRatio = npc.life / (double)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); int maxCharges = death ? 1 : revenge ? 2 : expertMode ? 3 : 4; int maxTeleports = (death && lifeRatio < 0.9) ? 1 : revenge ? 2 : expertMode ? 3 : 4; diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index a6a0d1c132..5fc7ebb4d5 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -73,13 +73,6 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - npc.defense = npc.defDefense; npc.damage = npc.defDamage; if (npc.localAI[1] == 1f) diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 71c0405e08..9b0aa514c0 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -102,13 +102,6 @@ namespace CalamityMod.NPCs.SlimeGod // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - Vector2 vectorCenter = npc.Center; // Get a target diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index a4cbb412e8..e770963767 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -76,13 +76,6 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - npc.defense = npc.defDefense; npc.damage = npc.defDamage; if (npc.localAI[1] == 1f) diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 5dd7120aaa..6895f7dfaa 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -78,13 +78,6 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - npc.defense = npc.defDefense; npc.damage = npc.defDamage; if (npc.localAI[1] == 1f) diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 14a26ad244..d383ae0bef 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -78,13 +78,6 @@ namespace CalamityMod.NPCs.SlimeGod float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - npc.defense = npc.defDefense; npc.damage = npc.defDamage; if (npc.localAI[1] == 1f) diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index e3d4523559..bc0df78137 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -165,13 +165,6 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = npc.life / (float)npc.lifeMax; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } - // Shed armor bool shedArmor = npc.life / (float)npc.lifeMax < 0.9f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs index 27f9a9b213..18d40815a8 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/BrainOfCthulhuAI.cs @@ -103,10 +103,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Phases based on HP bool phase2 = lifeRatio < 0.85f; bool phase3 = lifeRatio < 0.7f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs index fb62a5b67d..f072dc7c6a 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/CultistAI.cs @@ -25,11 +25,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + // Phases bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged; bool death = CalamityWorld.death || malice; @@ -1074,11 +1070,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining for Cultist or Eidolon Wyrm float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > Main.npc[(int)npc.ai[0]].Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = Main.npc[(int)npc.ai[0]].Calamity().killTimeRatio_IncreasedAggression; - + bool phase2 = lifeRatio < 0.7f; bool phase3 = lifeRatio < (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType() ? 0.6f : 0.55f); bool phase4 = lifeRatio < 0.4f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index 08094e063c..d922150dd8 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -28,11 +28,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + // Phases based on life percentage bool phase2 = lifeRatio < 0.85f; bool phase3 = lifeRatio < 0.7f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs index 83be5d64df..6a2f1572d7 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DukeFishronAI.cs @@ -20,11 +20,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + // Variables bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged; bool death = CalamityWorld.death || malice; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs index 1347c8db90..8f0869bbb2 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EaterOfWorldsAI.cs @@ -58,10 +58,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent segments remaining, add two to total for head and tail float lifeRatio = segmentCount / (totalSegments + 2); - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // 10 seconds of resistance to prevent spawn killing if (calamityGlobalNPC.newAI[1] < 600f && BossRushEvent.BossRushActive) calamityGlobalNPC.newAI[1] += 1f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs index 1e73b51166..c71094a480 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/EyeOfCthulhuAI.cs @@ -22,11 +22,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged; bool death = CalamityWorld.death || malice; bool phase2 = lifeRatio < 0.75f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs index 2625d7d4cd..aad5e8deb7 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/GolemAI.cs @@ -23,11 +23,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + // Phases bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged; bool death = CalamityWorld.death || malice; @@ -659,10 +655,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged; bool death = CalamityWorld.death || malice; diff --git a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs index a415bc63e3..ac2b4156bb 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/KingSlimeAI.cs @@ -41,10 +41,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Phases based on life percentage bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index dce8e144f4..d674d71208 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -34,10 +34,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Phases based on HP bool phase1phase2 = lifeRatio < 0.75f; bool phase2 = lifeRatio <= 0.5f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs index 785c015456..ee87c2dc7a 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenBeeAI.cs @@ -44,11 +44,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + // Phases bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index ef704ca774..d9b9a98724 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -26,10 +26,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Phases bool respawnHands = npc.life / (float)npc.lifeMax < 0.33f; bool phase2 = respawnHands || death; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 7f8857f4ae..b27165e220 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -35,10 +35,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Spawn arms if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs index 17ebe8849a..5d46138fe2 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/TwinsAI.cs @@ -352,10 +352,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Easier to send info to Spazmatism CalamityGlobalNPC.laserEye = npc.whoAmI; @@ -1054,10 +1050,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Easier to send info to Retinazer CalamityGlobalNPC.fireEye = npc.whoAmI; diff --git a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs index ba580aa276..9c2e536bca 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/WallOfFleshAI.cs @@ -41,11 +41,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - + // Clamp life ratio to prevent bad velocity math. lifeRatio = MathHelper.Clamp(lifeRatio, 0f, 1f); @@ -496,10 +492,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Percent life remaining float lifeRatio = Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - bool charging = Main.npc[Main.wof].ai[3] == 1f; // Set up enraged laser firing timer diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 69bc14a8ee..8a79997017 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -35,9 +35,9 @@ namespace CalamityMod.NPCs.Yharon public class Yharon : ModNPC { private Rectangle safeBox = default; - private Vector2 flareDustBulletHellSpawn = default; + private Vector2 flareDustBulletHellSpawn = default; - private bool enraged = false; + private bool enraged = false; private bool protectionBoost = false; private bool moveCloser = false; private bool useTornado = true; @@ -46,26 +46,27 @@ namespace CalamityMod.NPCs.Yharon private bool startSecondAI = false; private bool spawnArena = false; private int invincibilityCounter = 0; - private int fastChargeTelegraphTime = 120; + private int fastChargeTelegraphTime = 120; - private const float ai2GateValue = 0.55f; + private const float ai2GateValue = 0.55f; + public const int Phase2InvincibilityTime = 300; - public static float normalDR = 0.22f; + public static float normalDR = 0.22f; public static float EnragedDR = 0.9f; public override void SetStaticDefaults() { DisplayName.SetDefault("Jungle Dragon, Yharon"); Main.npcFrameCount[npc.type] = 7; - NPCID.Sets.TrailingMode[npc.type] = 1; - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override void SetDefaults() { - npc.Calamity().canBreakPlayerDefense = true; + npc.Calamity().canBreakPlayerDefense = true; npc.npcSlots = 50f; - npc.GetNPCDamage(); - npc.width = 200; + npc.GetNPCDamage(); + npc.width = 200; npc.height = 200; npc.defense = 90; npc.LifeMaxNERB(1085000, 1300000, 370000); @@ -76,7 +77,7 @@ namespace CalamityMod.NPCs.Yharon aiType = -1; npc.value = Item.buyPrice(1, 0, 0, 0); npc.boss = true; - npc.DR_NERD(normalDR); + npc.DR_NERD(normalDR); npc.noGravity = true; npc.noTileCollide = true; @@ -87,10 +88,10 @@ namespace CalamityMod.NPCs.Yharon npc.HitSound = SoundID.NPCHit56; npc.DeathSound = SoundID.NPCDeath60; bossBag = ModContent.ItemType(); - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - npc.Calamity().VulnerableToSickness = true; - } + npc.Calamity().VulnerableToHeat = false; + npc.Calamity().VulnerableToCold = true; + npc.Calamity().VulnerableToSickness = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -105,17 +106,17 @@ namespace CalamityMod.NPCs.Yharon writer.Write(secondPhasePhase); writer.Write(teleportLocation); writer.Write(invincibilityCounter); - writer.Write(fastChargeTelegraphTime); - writer.WriteVector2(flareDustBulletHellSpawn); + writer.Write(fastChargeTelegraphTime); + writer.WriteVector2(flareDustBulletHellSpawn); writer.Write(safeBox.X); writer.Write(safeBox.Y); writer.Write(safeBox.Width); writer.Write(safeBox.Height); - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); - writer.Write(npc.localAI[2]); - writer.Write(npc.localAI[3]); - } + writer.Write(npc.localAI[0]); + writer.Write(npc.localAI[1]); + writer.Write(npc.localAI[2]); + writer.Write(npc.localAI[3]); + } public override void ReceiveExtraAI(BinaryReader reader) { @@ -129,59 +130,52 @@ namespace CalamityMod.NPCs.Yharon secondPhasePhase = reader.ReadInt32(); teleportLocation = reader.ReadInt32(); invincibilityCounter = reader.ReadInt32(); - fastChargeTelegraphTime = reader.ReadInt32(); - flareDustBulletHellSpawn = reader.ReadVector2(); - safeBox.X = reader.ReadInt32(); + fastChargeTelegraphTime = reader.ReadInt32(); + flareDustBulletHellSpawn = reader.ReadVector2(); + safeBox.X = reader.ReadInt32(); safeBox.Y = reader.ReadInt32(); safeBox.Width = reader.ReadInt32(); safeBox.Height = reader.ReadInt32(); - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - npc.localAI[2] = reader.ReadSingle(); - npc.localAI[3] = reader.ReadSingle(); - } + npc.localAI[0] = reader.ReadSingle(); + npc.localAI[1] = reader.ReadSingle(); + npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); + } public override void AI() { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; - // Stop rain - CalamityMod.StopRain(); + // Stop rain + CalamityMod.StopRain(); - // Variables - bool enraged2 = calamityGlobalNPC.enraged > 0; - bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged2; - bool expertMode = Main.expertMode || malice; - bool revenge = CalamityWorld.revenge || malice; - bool death = CalamityWorld.death || malice; + // Variables + bool enraged2 = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive || enraged2; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; - if (revenge) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) - lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - } + float pie = (float)Math.PI; - float pie = (float)Math.PI; + Vector2 vectorCenter = npc.Center; - Vector2 vectorCenter = npc.Center; - - // Start phase 2 or not - if (startSecondAI) + // Start phase 2 or not + if (startSecondAI) { Yharon_AI2(expertMode, revenge, death, malice, pie, lifeRatio, vectorCenter, calamityGlobalNPC); return; } - // Phase booleans - float phase2GateValue = revenge ? 0.9f : expertMode ? 0.85f : 0.75f; - bool phase2Check = death || lifeRatio <= phase2GateValue; + // Phase booleans + float phase2GateValue = revenge ? 0.9f : expertMode ? 0.85f : 0.75f; + bool phase2Check = death || lifeRatio <= phase2GateValue; bool phase3Check = lifeRatio <= (death ? 0.8f : revenge ? 0.75f : expertMode ? 0.7f : 0.625f); bool phase4Check = lifeRatio <= ai2GateValue; - bool phase1Change = npc.ai[0] > -1f; + bool phase1Change = npc.ai[0] > -1f; bool phase2Change = npc.ai[0] > 5f; bool phase3Change = npc.ai[0] > 12f; @@ -190,40 +184,40 @@ namespace CalamityMod.NPCs.Yharon float acceleration = expertMode ? 0.75f : 0.7f; float velocity = expertMode ? 12f : 11f; - // Damage immunity - if (phase3Change) - npc.dontTakeDamage = phase4Check; - else if (phase2Change) - npc.dontTakeDamage = phase3Check; - else if (phase1Change) - npc.dontTakeDamage = phase2Check; + // Damage immunity + if (phase3Change) + npc.dontTakeDamage = phase4Check; + else if (phase2Change) + npc.dontTakeDamage = phase3Check; + else if (phase1Change) + npc.dontTakeDamage = phase2Check; - if (phase3Change) + if (phase3Change) { - acceleration = expertMode ? 0.85f : 0.8f; - velocity = expertMode ? 14f : 13f; - phaseSwitchTimer = expertMode ? 25 : 28; - fastChargeTelegraphTime = 100; + acceleration = expertMode ? 0.85f : 0.8f; + velocity = expertMode ? 14f : 13f; + phaseSwitchTimer = expertMode ? 25 : 28; + fastChargeTelegraphTime = 100; } else if (phase2Change) { - acceleration = expertMode ? 0.8f : 0.75f; - velocity = expertMode ? 13f : 12f; - phaseSwitchTimer = expertMode ? 32 : 36; - fastChargeTelegraphTime = 110; + acceleration = expertMode ? 0.8f : 0.75f; + velocity = expertMode ? 13f : 12f; + phaseSwitchTimer = expertMode ? 32 : 36; + fastChargeTelegraphTime = 110; } else - phaseSwitchTimer = 25; + phaseSwitchTimer = 25; - // Timers and velocity for charging - float reduceSpeedChargeDistance = 540f; + // Timers and velocity for charging + float reduceSpeedChargeDistance = 540f; int chargeTime = expertMode ? 40 : 45; float chargeSpeed = expertMode ? 28f : 26f; - float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; - bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; - bool doFastCharge = npc.localAI[1] > fastChargeTelegraphTime; + float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; + bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; + bool doFastCharge = npc.localAI[1] > fastChargeTelegraphTime; - if (phase3Change) + if (phase3Change) { chargeTime = 35; chargeSpeed = 30f; @@ -236,18 +230,18 @@ namespace CalamityMod.NPCs.Yharon chargeSpeed = 28.5f; } - if (revenge) - { - int chargeTimeDecrease = malice ? 6 : death ? 4 : 2; - float velocityMult = malice ? 1.15f : death ? 1.1f : 1.05f; - phaseSwitchTimer -= chargeTimeDecrease; - acceleration *= velocityMult; - velocity *= velocityMult; - chargeTime -= chargeTimeDecrease; - chargeSpeed *= velocityMult; - } + if (revenge) + { + int chargeTimeDecrease = malice ? 6 : death ? 4 : 2; + float velocityMult = malice ? 1.15f : death ? 1.1f : 1.05f; + phaseSwitchTimer -= chargeTimeDecrease; + acceleration *= velocityMult; + velocity *= velocityMult; + chargeTime -= chargeTimeDecrease; + chargeSpeed *= velocityMult; + } - float reduceSpeedFlareBombDistance = 570f; + float reduceSpeedFlareBombDistance = 570f; int flareBombPhaseTimer = malice ? 30 : death ? 40 : 60; int flareBombSpawnDivisor = flareBombPhaseTimer / 20; float flareBombPhaseAcceleration = malice ? 1f : death ? 0.92f : 0.8f; @@ -257,74 +251,74 @@ namespace CalamityMod.NPCs.Yharon int newPhaseTimer = 180; - float flareDustPhaseScalar = death ? 48f : 60f; - phase2GateValue -= ai2GateValue; // 0.35, 70% HP = 0.7 - 0.55 = 0.15, 0.35 - 0.15 = 0.2 / 0.35 = 0.57, 60% HP = 0.6 - 0.55 = 0.05, 0.35 - 0.05 = 0.3 / 0.35 = 0.85, 80% HP = 0.8 - 0.55 = 0.25, 0.35 - 0.25 = 0.1 / 0.35 = 0.28 - int flareDustPhaseTimerReduction = revenge ? (int)(flareDustPhaseScalar * ((phase2GateValue - (lifeRatio - ai2GateValue)) / phase2GateValue)) : 0; - int flareDustPhaseTimer = (malice ? 210 : death ? 240 : 300) - flareDustPhaseTimerReduction; - int flareDustPhaseTimer2 = (malice ? 105 : death ? 120 : 150) - (flareDustPhaseTimerReduction / 2); + float flareDustPhaseScalar = death ? 48f : 60f; + phase2GateValue -= ai2GateValue; // 0.35, 70% HP = 0.7 - 0.55 = 0.15, 0.35 - 0.15 = 0.2 / 0.35 = 0.57, 60% HP = 0.6 - 0.55 = 0.05, 0.35 - 0.05 = 0.3 / 0.35 = 0.85, 80% HP = 0.8 - 0.55 = 0.25, 0.35 - 0.25 = 0.1 / 0.35 = 0.28 + int flareDustPhaseTimerReduction = revenge ? (int)(flareDustPhaseScalar * ((phase2GateValue - (lifeRatio - ai2GateValue)) / phase2GateValue)) : 0; + int flareDustPhaseTimer = (malice ? 210 : death ? 240 : 300) - flareDustPhaseTimerReduction; + int flareDustPhaseTimer2 = (malice ? 105 : death ? 120 : 150) - (flareDustPhaseTimerReduction / 2); - float spinTime = flareDustPhaseTimer / 2; + float spinTime = flareDustPhaseTimer / 2; - int flareDustSpawnDivisor = flareDustPhaseTimer / 10; - int flareDustSpawnDivisor2 = flareDustPhaseTimer2 / 30; - int flareDustSpawnDivisor3 = flareDustPhaseTimer / 25; + int flareDustSpawnDivisor = flareDustPhaseTimer / 10; + int flareDustSpawnDivisor2 = flareDustPhaseTimer2 / 30; + int flareDustSpawnDivisor3 = flareDustPhaseTimer / 25; - float spinPhaseVelocity = 25f; + float spinPhaseVelocity = 25f; float spinPhaseRotation = MathHelper.TwoPi * 3 / spinTime; - float increasedIdleTimeAfterBulletHell = -120f; + float increasedIdleTimeAfterBulletHell = -120f; - float teleportPhaseTimer = 30f; + float teleportPhaseTimer = 30f; - int spawnPhaseTimer = 75; + int spawnPhaseTimer = 75; - // Target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + // Target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(); npc.netUpdate = true; } - // 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, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) - 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, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); - Player player = Main.player[npc.target]; + Player player = Main.player[npc.target]; - // Despawn - if (player.dead || !player.active) + // Despawn + if (player.dead || !player.active) { - npc.TargetClosest(); - player = Main.player[npc.target]; - if (player.dead || !player.active) - { - npc.velocity.Y -= 0.4f; + npc.TargetClosest(); + player = Main.player[npc.target]; + if (player.dead || !player.active) + { + npc.velocity.Y -= 0.4f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (npc.timeLeft > 60) + npc.timeLeft = 60; - if (npc.ai[0] > 12f) - npc.ai[0] = 13f; - else if (npc.ai[0] > 5f) - npc.ai[0] = 6f; - else - npc.ai[0] = 0f; + if (npc.ai[0] > 12f) + npc.ai[0] = 13f; + else if (npc.ai[0] > 5f) + npc.ai[0] = 6f; + else + npc.ai[0] = 0f; - npc.ai[2] = 0f; - } + npc.ai[2] = 0f; + } } else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - int xPos = 60 * npc.direction; - Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; - Vector2 fromMouth = new Vector2((int)vector.X + xPos, (int)vector.Y - 15); + int xPos = 60 * npc.direction; + Vector2 vector = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; + Vector2 fromMouth = new Vector2((int)vector.X + xPos, (int)vector.Y - 15); - // Create the arena, but not as a multiplayer client. - // In single player, the arena gets created and never gets synced because it's single player. - // In multiplayer, only the server/host creates the arena, and everyone else receives it on the next frame via SendExtraAI. - // Everyone however sets spawnArena to true to confirm that the fight has started. - if (!spawnArena) + // Create the arena, but not as a multiplayer client. + // In single player, the arena gets created and never gets synced because it's single player. + // In multiplayer, only the server/host creates the arena, and everyone else receives it on the next frame via SendExtraAI. + // Everyone however sets spawnArena to true to confirm that the fight has started. + if (!spawnArena) { spawnArena = true; enraged = false; @@ -348,7 +342,7 @@ namespace CalamityMod.NPCs.Yharon npc.Calamity().CurrentlyEnraged = enraged || enraged2; if (enraged) { - phaseSwitchTimer = 15; + phaseSwitchTimer = 15; protectionBoost = true; npc.damage = npc.defDamage * 5; chargeSpeed += 25f; @@ -360,13 +354,13 @@ namespace CalamityMod.NPCs.Yharon } } - // Set DR based on protection boost (aka enrage) - bool chargeTelegraph = (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f; - bool bulletHell = npc.ai[0] == 8f || npc.ai[0] == 15f; - calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; + // Set DR based on protection boost (aka enrage) + bool chargeTelegraph = (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f; + bool bulletHell = npc.ai[0] == 8f || npc.ai[0] == 15f; + calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; - if (bulletHell) - npc.damage = 0; + if (bulletHell) + npc.damage = 0; // Trigger spawn effects if (npc.localAI[0] == 0f) @@ -394,16 +388,16 @@ namespace CalamityMod.NPCs.Yharon float npcRotationSpeed = 0.04f; if (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 8f || npc.ai[0] == 11f || npc.ai[0] == 12f || - npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f) + npc.ai[0] == 14f || npc.ai[0] == 15f || npc.ai[0] == 18f || npc.ai[0] == 19f) npcRotationSpeed = 0f; if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 9f || npc.ai[0] == 16f) npcRotationSpeed = 0.01f; - if (npcRotationSpeed != 0f) - npc.rotation = npc.rotation.AngleTowards(npcRotation, npcRotationSpeed); + if (npcRotationSpeed != 0f) + npc.rotation = npc.rotation.AngleTowards(npcRotation, npcRotationSpeed); - // Alpha effects - if (npc.ai[0] != -1f && ((npc.ai[0] != 6f && npc.ai[0] != 13f) || npc.ai[2] <= phaseSwitchTimer)) + // Alpha effects + if (npc.ai[0] != -1f && ((npc.ai[0] != 6f && npc.ai[0] != 13f) || npc.ai[2] <= phaseSwitchTimer)) { bool colliding = Collision.SolidCollision(npc.position, npc.width, npc.height); @@ -476,20 +470,20 @@ namespace CalamityMod.NPCs.Yharon } #region Phase1 - // Phase switch + // Phase switch else if (npc.ai[0] == 0f && !player.dead) { if (npc.ai[1] == 0f) npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); - Vector2 distanceFromDestination = destination - vectorCenter; + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 distanceFromDestination = destination - vectorCenter; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; - if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); - else - npc.velocity *= 0.98f; + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; int num1471 = Math.Sign(player.Center.X - vectorCenter.X); if (num1471 != 0) @@ -571,41 +565,41 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 5) { - if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (playFastChargeRoarSound) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (doFastCharge) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = 0f; + if (doFastCharge) + { + npc.ai[0] = 5f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[1] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num1471 != 0) - { - npc.direction = num1471; + if (num1471 != 0) + { + npc.direction = num1471; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (npc.spriteDirection == 1) + npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } - } - else - npc.localAI[1] += 1f; + npc.spriteDirection = -npc.direction; + } + } + else + npc.localAI[1] += 1f; } npc.netUpdate = true; } } - // Charge + // Charge else if (npc.ai[0] == 1f) { - ChargeDust(7, pie); + ChargeDust(7, pie); npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) @@ -614,25 +608,25 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Fireball breath + // Fireball breath else if (npc.ai[0] == 2f) { if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); - Vector2 value17 = destination - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 value17 = destination - vectorCenter; + Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; - if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) - npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); - else - npc.velocity *= 0.98f; + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) + npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + else + npc.velocity *= 0.98f; if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); @@ -641,9 +635,9 @@ namespace CalamityMod.NPCs.Yharon { if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); } } @@ -664,12 +658,12 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Fire tornadoes + // Fire tornadoes else if (npc.ai[0] == 3f) { npc.velocity *= 0.98f; @@ -690,12 +684,12 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Enter new phase + // Enter new phase else if (npc.ai[0] == 4f) { npc.velocity *= 0.9f; @@ -711,16 +705,16 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.localAI[1] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Fast charge + // Fast charge else if (npc.ai[0] == 5f) { - ChargeDust(14, pie); + ChargeDust(14, pie); npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) @@ -729,27 +723,27 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } #endregion #region Phase2 - // Phase switch + // Phase switch else if (npc.ai[0] == 6f && !player.dead) { if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); - Vector2 distanceFromDestination = destination - vectorCenter; - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 distanceFromDestination = destination - vectorCenter; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; - if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); - else - npc.velocity *= 0.98f; + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) @@ -816,28 +810,28 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 2) { - Vector2 npcCenter = vectorCenter; + Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } - if (npc.ai[2] == phaseSwitchTimer + 15f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[2] == phaseSwitchTimer + 15f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) - { - Vector2 center = player.Center + new Vector2(0f, -540f); - npcCenter = npc.Center = center; - } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) + { + Vector2 center = player.Center + new Vector2(0f, -540f); + npcCenter = npc.Center = center; + } - if (npc.ai[2] < phaseSwitchTimer + teleportPhaseTimer) - return; + if (npc.ai[2] < phaseSwitchTimer + teleportPhaseTimer) + return; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) @@ -853,8 +847,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 8f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 1f; - } + npc.ai[3] = 1f; + } else if (aiState == 3) { npc.ai[0] = 9f; @@ -869,31 +863,31 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 5) { - if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (playFastChargeRoarSound) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (doFastCharge) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = 0f; + if (doFastCharge) + { + npc.ai[0] = 11f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[1] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; + if (num1477 != 0) + { + npc.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (npc.spriteDirection == 1) + npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } - } - else - npc.localAI[1] += 1f; + npc.spriteDirection = -npc.direction; + } + } + else + npc.localAI[1] += 1f; } else if (aiState == 6) { @@ -919,10 +913,10 @@ namespace CalamityMod.NPCs.Yharon } } - // Charge + // Charge else if (npc.ai[0] == 7f) { - ChargeDust(7, pie); + ChargeDust(7, pie); npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) @@ -931,51 +925,51 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Flare Dust bullet hell + // Flare Dust bullet hell else if (npc.ai[0] == 8f) { - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); - } - - npc.ai[2] += 1f; - - if (npc.ai[2] % flareDustSpawnDivisor == 0f) + if (npc.ai[2] == 0f) { - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); + } + + npc.ai[2] += 1f; + + if (npc.ai[2] % flareDustSpawnDivisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) { - int ringReduction = (int)MathHelper.Lerp(0f, 14f, npc.ai[2] / flareDustPhaseTimer); - int totalProjectiles = 38 - ringReduction; // 36 for first ring, 22 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, false); + int ringReduction = (int)MathHelper.Lerp(0f, 14f, npc.ai[2] / flareDustPhaseTimer); + int totalProjectiles = 38 - ringReduction; // 36 for first ring, 22 for last ring + DoFlareDustBulletHell(0, flareDustSpawnDivisor, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, false); - // Fire a flame towards every player, with a limit of 5 - if (expertMode) - { - List targets = new List(); - for (int p = 0; p < Main.maxPlayers; p++) - { - if (Main.player[p].active && !Main.player[p].dead) - targets.Add(p); + // Fire a flame towards every player, with a limit of 5 + if (expertMode) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); - if (targets.Count > 4) - break; - } - foreach (int t in targets) - { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; - int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - } - } + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + } + } } npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); @@ -983,15 +977,15 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[2] >= flareDustPhaseTimer) { - npc.ai[0] = 6f; + npc.ai[0] = 6f; npc.ai[1] = 0f; npc.ai[2] = increasedIdleTimeAfterBulletHell; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Infernado + // Infernado else if (npc.ai[0] == 9f) { npc.velocity *= 0.98f; @@ -1009,12 +1003,12 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 6f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Enter new phase + // Enter new phase else if (npc.ai[0] == 10f) { npc.velocity *= 0.9f; @@ -1030,47 +1024,47 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.localAI[1] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Fast charge + // Fast charge else if (npc.ai[0] == 11f) { - ChargeDust(14, pie); + ChargeDust(14, pie); - npc.ai[2] += 1f; + npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) { npc.ai[0] = 6f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Flare Dust that speeds up and whips around in a wave + // Flare Dust that speeds up and whips around in a wave else if (npc.ai[0] == 12f) { - if (npc.ai[2] == 0f) + if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - npc.ai[2] += 1f; + npc.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) + if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 projectileVelocity = player.Center - fromMouth; - projectileVelocity.Normalize(); - projectileVelocity *= 0.1f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 projectileVelocity = player.Center - fromMouth; + projectileVelocity.Normalize(); + projectileVelocity *= 0.1f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1083,27 +1077,27 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } #endregion #region Phase3 - // Phase switch + // Phase switch else if (npc.ai[0] == 13f && !player.dead) { if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); - Vector2 distanceFromDestination = destination - vectorCenter; - Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 distanceFromDestination = destination - vectorCenter; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; - if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); - else - npc.velocity *= 0.98f; + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) @@ -1138,15 +1132,15 @@ namespace CalamityMod.NPCs.Yharon aiState = 3; break; case 6: - aiState = 6; + aiState = 6; break; case 7: npc.ai[3] = 1f; aiState = 7; break; - case 8: - aiState = 2; - break; + case 8: + aiState = 2; + break; } if (phase4Check) @@ -1173,28 +1167,28 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 2) { - Vector2 npcCenter = vectorCenter; + Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } - if (npc.ai[2] == phaseSwitchTimer + 15f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[2] == phaseSwitchTimer + 15f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) - { - Vector2 center = player.Center + new Vector2(0f, -540f); - npcCenter = npc.Center = center; - } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) + { + Vector2 center = player.Center + new Vector2(0f, -540f); + npcCenter = npc.Center = center; + } - if (npc.ai[2] < phaseSwitchTimer + teleportPhaseTimer) - return; + if (npc.ai[2] < phaseSwitchTimer + teleportPhaseTimer) + return; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * spinPhaseVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); if (num1477 != 0) @@ -1210,8 +1204,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 15f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; - } + npc.ai[3] = 0f; + } else if (aiState == 3) { npc.ai[0] = 16f; @@ -1226,31 +1220,31 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 5) { - if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (playFastChargeRoarSound) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (doFastCharge) - { - npc.ai[0] = 18f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[1] = 0f; + if (doFastCharge) + { + npc.ai[0] = 18f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[1] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeSpeed * fastChargeVelocityMultiplier; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num1477 != 0) - { - npc.direction = num1477; + if (num1477 != 0) + { + npc.direction = num1477; - if (npc.spriteDirection == 1) - npc.rotation += pie; + if (npc.spriteDirection == 1) + npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } - } - else - npc.localAI[1] += 1f; + npc.spriteDirection = -npc.direction; + } + } + else + npc.localAI[1] += 1f; } else if (aiState == 6) { @@ -1271,90 +1265,90 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; } - else if (aiState == 7) - { - npc.ai[0] = 20f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } + else if (aiState == 7) + { + npc.ai[0] = 20f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } - npc.netUpdate = true; + npc.netUpdate = true; } } - // Charge + // Charge else if (npc.ai[0] == 14f) { - ChargeDust(7, pie); + ChargeDust(7, pie); - npc.ai[2] += 1f; + npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) { npc.ai[0] = 13f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Flare Dust bullet hell - else if (npc.ai[0] == 15f) + // Flare Dust bullet hell + else if (npc.ai[0] == 15f) { - if (npc.ai[2] == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); - } + if (npc.ai[2] == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + flareDustBulletHellSpawn = vectorCenter + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); + } - npc.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor3 == 0f) - { - // Rotate spiral by 7.2 * (300 / 12) = +90 degrees and then back -90 degrees + npc.ai[2] += 1f; + if (npc.ai[2] % flareDustSpawnDivisor3 == 0f) + { + // Rotate spiral by 7.2 * (300 / 12) = +90 degrees and then back -90 degrees - if (Main.netMode != NetmodeID.MultiplayerClient) - { - DoFlareDustBulletHell(1, flareDustPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), 8, 12f, 3.6f, false); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + DoFlareDustBulletHell(1, flareDustPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), 8, 12f, 3.6f, false); - // Fire a flame towards every player, with a limit of 5 - if (expertMode && npc.ai[2] % (flareDustSpawnDivisor3 * 2) == 0f) - { - List targets = new List(); - for (int p = 0; p < Main.maxPlayers; p++) - { - if (Main.player[p].active && !Main.player[p].dead) - targets.Add(p); + // Fire a flame towards every player, with a limit of 5 + if (expertMode && npc.ai[2] % (flareDustSpawnDivisor3 * 2) == 0f) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); - if (targets.Count > 4) - break; - } - foreach (int t in targets) - { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; - int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - } - } - } + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + } + } + } - npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); - npc.rotation -= spinPhaseRotation * npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); + npc.rotation -= spinPhaseRotation * npc.direction; - if (npc.ai[2] >= flareDustPhaseTimer) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.localAI[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } + if (npc.ai[2] >= flareDustPhaseTimer) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.localAI[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } } - // Infernado + // Infernado else if (npc.ai[0] == 16f) { npc.velocity *= 0.98f; @@ -1373,147 +1367,147 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 3f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Enter new phase + // Enter new phase else if (npc.ai[0] == 17f) { - npc.velocity *= 0.9f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + npc.velocity *= 0.9f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == newPhaseTimer - 60) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[2] == newPhaseTimer - 60) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - npc.ai[2] += 1f; - if (npc.ai[2] >= newPhaseTimer) - { - startSecondAI = true; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } + npc.ai[2] += 1f; + if (npc.ai[2] >= newPhaseTimer) + { + startSecondAI = true; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.localAI[1] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } } - // Fast charge + // Fast charge else if (npc.ai[0] == 18f) { - ChargeDust(14, pie); + ChargeDust(14, pie); - npc.ai[2] += 1f; + npc.ai[2] += 1f; if (npc.ai[2] >= chargeTime) { npc.ai[0] = 13f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - // Fireball ring + // Fireball ring else if (npc.ai[0] == 19f) { - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[2] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - npc.ai[2] += 1f; + npc.ai[2] += 1f; - if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 projectileVelocity = player.Center - fromMouth; - projectileVelocity.Normalize(); - projectileVelocity *= 0.1f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } + if (npc.ai[2] % flareDustSpawnDivisor2 == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 projectileVelocity = player.Center - fromMouth; + projectileVelocity.Normalize(); + projectileVelocity *= 0.1f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } - npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); - npc.rotation -= spinPhaseRotation * npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); + npc.rotation -= spinPhaseRotation * npc.direction; - if (npc.ai[2] >= flareDustPhaseTimer2 - 50) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.TargetClosest(); - npc.netUpdate = true; - } + if (npc.ai[2] >= flareDustPhaseTimer2 - 50) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] += 1f; + npc.TargetClosest(); + npc.netUpdate = true; + } } - // Fireball breath - else if (npc.ai[0] == 20f) - { - if (npc.ai[1] == 0f) - npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); + // Fireball breath + else if (npc.ai[0] == 20f) + { + if (npc.ai[1] == 0f) + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); - Vector2 value17 = destination - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 value17 = destination - vectorCenter; + Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; - if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) - npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); - else - npc.velocity *= 0.98f; + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) + npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + else + npc.velocity *= 0.98f; - if (npc.ai[2] == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[2] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] % flareBombSpawnDivisor == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); - } - } + if (npc.ai[2] % flareBombSpawnDivisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); + } + } - int num1476 = Math.Sign(player.Center.X - vectorCenter.X); - if (num1476 != 0) - { - npc.direction = num1476; + int num1476 = Math.Sign(player.Center.X - vectorCenter.X); + if (num1476 != 0) + { + npc.direction = num1476; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; + if (npc.spriteDirection != -npc.direction) + npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } + npc.spriteDirection = -npc.direction; + } - npc.ai[2] += 1f; - if (npc.ai[2] >= flareBombPhaseTimer - 15) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - #endregion - } + npc.ai[2] += 1f; + if (npc.ai[2] >= flareBombPhaseTimer - 15) + { + npc.ai[0] = 13f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + #endregion + } #region AI2 public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool malice, float pie, float lifeRatio, Vector2 vectorCenter, CalamityGlobalNPC calamityGlobalNPC) { - float phase2GateValue = revenge ? 0.44f : expertMode ? 0.385f : 0.275f; - bool phase2 = death || lifeRatio <= phase2GateValue; - float phase3GateValue = death ? 0.358f : revenge ? 0.275f : expertMode ? 0.22f : 0.138f; - bool phase3 = lifeRatio <= phase3GateValue; - float phase4GateValue = death ? 0.165f : 0.11f; - bool phase4 = lifeRatio <= phase4GateValue && revenge; + float phase2GateValue = revenge ? 0.44f : expertMode ? 0.385f : 0.275f; + bool phase2 = death || lifeRatio <= phase2GateValue; + float phase3GateValue = death ? 0.358f : revenge ? 0.275f : expertMode ? 0.22f : 0.138f; + bool phase3 = lifeRatio <= phase3GateValue; + float phase4GateValue = death ? 0.165f : 0.11f; + bool phase4 = lifeRatio <= phase4GateValue && revenge; if (npc.ai[0] != 8f) { @@ -1535,142 +1529,142 @@ namespace CalamityMod.NPCs.Yharon CalamityUtils.DisplayLocalizedText(key, messageColor); } - if (invincibilityCounter < 900) - { - phase2 = phase3 = phase4 = false; - invincibilityCounter += 1; - } - else - { - // Damage immunity - switch (secondPhasePhase) - { - case 1: - npc.dontTakeDamage = phase2; - break; - case 2: - npc.dontTakeDamage = phase3; - break; - case 3: - npc.dontTakeDamage = phase4; - break; - case 4: - npc.dontTakeDamage = false; - break; - } + if (invincibilityCounter < Phase2InvincibilityTime) + { + phase2 = phase3 = phase4 = false; + invincibilityCounter += 1; + } + else + { + // Damage immunity + switch (secondPhasePhase) + { + case 1: + npc.dontTakeDamage = phase2; + break; + case 2: + npc.dontTakeDamage = phase3; + break; + case 3: + npc.dontTakeDamage = phase4; + break; + case 4: + npc.dontTakeDamage = false; + break; + } - if (!npc.dontTakeDamage) - npc.dontTakeDamage = npc.ai[0] == 9f; - } + if (!npc.dontTakeDamage) + npc.dontTakeDamage = npc.ai[0] == 9f; + } - // Acquire target and determine enrage state - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(); - npc.netUpdate = true; - } + // Acquire target and determine enrage state + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) + { + npc.TargetClosest(); + npc.netUpdate = true; + } - // 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, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) - 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, vectorCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); - Player targetData = Main.player[npc.target]; + Player targetData = Main.player[npc.target]; - // Despawn - bool targetDead = false; - if (targetData.dead || !targetData.active) - { - npc.TargetClosest(); - targetData = Main.player[npc.target]; - if (targetData.dead || !targetData.active) - { - targetDead = true; + // Despawn + bool targetDead = false; + if (targetData.dead || !targetData.active) + { + npc.TargetClosest(); + targetData = Main.player[npc.target]; + if (targetData.dead || !targetData.active) + { + targetDead = true; - npc.velocity.Y -= 0.4f; + npc.velocity.Y -= 0.4f; - if (npc.timeLeft > 60) - npc.timeLeft = 60; + if (npc.timeLeft > 60) + npc.timeLeft = 60; - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; + npc.ai[0] = 1f; + npc.ai[1] = 0f; + } + } + else if (npc.timeLeft < 1800) + npc.timeLeft = 1800; - enraged = !targetData.Hitbox.Intersects(safeBox); - if (enraged) - { - protectionBoost = true; - npc.damage = npc.defDamage * 5; - } - else - { - protectionBoost = false; - npc.damage = npc.defDamage; - } + enraged = !targetData.Hitbox.Intersects(safeBox); + if (enraged) + { + protectionBoost = true; + npc.damage = npc.defDamage * 5; + } + else + { + protectionBoost = false; + npc.damage = npc.defDamage; + } - // Set DR based on protection boost (aka enrage) - bool chargeTelegraph = npc.ai[0] < 2f && npc.localAI[1] > 0f; - bool bulletHell = npc.ai[0] == 5f; - calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; + // Set DR based on protection boost (aka enrage) + bool chargeTelegraph = npc.ai[0] < 2f && npc.localAI[1] > 0f; + bool bulletHell = npc.ai[0] == 5f; + calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; - if (bulletHell) - npc.damage = 0; + if (bulletHell) + npc.damage = 0; - float reduceSpeedChargeDistance = 500f; - float phaseSwitchTimer = malice ? 28f : expertMode ? 30f : 32f; - float acceleration = expertMode ? 0.92f : 0.9f; + float reduceSpeedChargeDistance = 500f; + float phaseSwitchTimer = malice ? 28f : expertMode ? 30f : 32f; + float acceleration = expertMode ? 0.92f : 0.9f; float velocity = expertMode ? 14.5f : 14f; - float chargeTime = expertMode ? 32f : 35f; + float chargeTime = expertMode ? 32f : 35f; float chargeSpeed = expertMode ? 32f : 30f; - float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; - fastChargeTelegraphTime = protectionBoost ? 60 : (100 - secondPhasePhase * 10); - bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; - bool doFastChargeTelegraph = npc.localAI[1] <= fastChargeTelegraphTime; + float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; + fastChargeTelegraphTime = protectionBoost ? 60 : (100 - secondPhasePhase * 10); + bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; + bool doFastChargeTelegraph = npc.localAI[1] <= fastChargeTelegraphTime; - float fireballBreathTimer = 60f; + float fireballBreathTimer = 60f; float fireballBreathPhaseTimer = fireballBreathTimer + 120f; - float fireballBreathPhaseVelocity = 22f; + float fireballBreathPhaseVelocity = 22f; float splittingFireballBreathTimer = 40f; float splittingFireballBreathPhaseVelocity = 22f; int splittingFireballBreathDivisor = 10; - int splittingFireballs = 10; + int splittingFireballs = 10; int splittingFireballBreathTimer2 = splittingFireballs * splittingFireballBreathDivisor; float splittingFireballBreathYVelocityTimer = 40f; float splittingFireballBreathPhaseTimer = splittingFireballBreathTimer + splittingFireballBreathTimer2 + splittingFireballBreathYVelocityTimer; - float flareDustPhaseScalar = secondPhasePhase == 4 ? (death ? 54f : 60f) : (death ? 67f : 80f); - int spinPhaseTimerReduction = revenge ? (secondPhasePhase == 4 ? (int)(flareDustPhaseScalar * ((phase4GateValue - lifeRatio) / phase4GateValue)) : (int)(flareDustPhaseScalar * (ai2GateValue - lifeRatio))) : 0; - int spinPhaseTimer = (secondPhasePhase == 4 ? (malice ? 150 : death ? 160 : 180) : (malice ? 180 : death ? 200 : 240)) - spinPhaseTimerReduction; - float spinTime = spinPhaseTimer / 2; - float spinRotation = MathHelper.TwoPi * 3 / spinTime; - float spinPhaseVelocity = 25f; - int flareDustSpawnDivisor = spinPhaseTimer / 10; - int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); - float increasedIdleTimeAfterBulletHell = -120f; + float flareDustPhaseScalar = secondPhasePhase == 4 ? (death ? 54f : 60f) : (death ? 67f : 80f); + int spinPhaseTimerReduction = revenge ? (secondPhasePhase == 4 ? (int)(flareDustPhaseScalar * ((phase4GateValue - lifeRatio) / phase4GateValue)) : (int)(flareDustPhaseScalar * (ai2GateValue - lifeRatio))) : 0; + int spinPhaseTimer = (secondPhasePhase == 4 ? (malice ? 150 : death ? 160 : 180) : (malice ? 180 : death ? 200 : 240)) - spinPhaseTimerReduction; + float spinTime = spinPhaseTimer / 2; + float spinRotation = MathHelper.TwoPi * 3 / spinTime; + float spinPhaseVelocity = 25f; + int flareDustSpawnDivisor = spinPhaseTimer / 10; + int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); + float increasedIdleTimeAfterBulletHell = -120f; - float flareSpawnDecelerationTimer = malice ? 60f : death ? 75f : 90f; - int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (ai2GateValue - lifeRatio)) : 0; - float flareSpawnPhaseTimer = (malice ? 120f : death ? 150f : 180f) - flareSpawnPhaseTimerReduction; + float flareSpawnDecelerationTimer = malice ? 60f : death ? 75f : 90f; + int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (ai2GateValue - lifeRatio)) : 0; + float flareSpawnPhaseTimer = (malice ? 120f : death ? 150f : 180f) - flareSpawnPhaseTimerReduction; - float teleportPhaseTimer = 45f; + float teleportPhaseTimer = 45f; - if (revenge) - { - float chargeTimeDecrease = malice ? 6f : death ? 4f : 2f; - float velocityMult = malice ? 1.15f : death ? 1.1f : 1.05f; - acceleration *= velocityMult; - velocity *= velocityMult; - chargeTime -= chargeTimeDecrease; - chargeSpeed *= velocityMult; - } + if (revenge) + { + float chargeTimeDecrease = malice ? 6f : death ? 4f : 2f; + float velocityMult = malice ? 1.15f : death ? 1.1f : 1.05f; + acceleration *= velocityMult; + velocity *= velocityMult; + chargeTime -= chargeTimeDecrease; + chargeSpeed *= velocityMult; + } if (npc.ai[0] == 0f) { - npc.ai[1] += 1f; + npc.ai[1] += 1f; if (npc.ai[1] >= 10f) { npc.ai[1] = 0f; @@ -1682,24 +1676,24 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 1f) { if (npc.ai[2] == 0f) - npc.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; + npc.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - Vector2 destination = targetData.Center + new Vector2(-npc.ai[2], 0f); - Vector2 desiredVelocity = npc.SafeDirectionTo(destination) * velocity; + Vector2 destination = targetData.Center + new Vector2(-npc.ai[2], 0f); + Vector2 desiredVelocity = npc.SafeDirectionTo(destination) * velocity; - if (!targetDead) - { - if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) - npc.SimpleFlyMovement(desiredVelocity, acceleration); - else - npc.velocity *= 0.98f; - } + if (!targetDead) + { + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; + } int num27 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.direction = npc.spriteDirection = num27; - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseSwitchTimer) + npc.ai[1] += 1f; + if (npc.ai[1] >= phaseSwitchTimer) { int num28 = 1; if (phase4) @@ -1842,65 +1836,65 @@ namespace CalamityMod.NPCs.Yharon } } - if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) - { - float newRotation = npc.AngleTo(targetData.Center); - float amount = 0.04f; + if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) + { + float newRotation = npc.AngleTo(targetData.Center); + float amount = 0.04f; - if (npc.spriteDirection == -1) - newRotation += pie; + if (npc.spriteDirection == -1) + newRotation += pie; - if (amount != 0f) - npc.rotation = npc.rotation.AngleTowards(newRotation, amount); + if (amount != 0f) + npc.rotation = npc.rotation.AngleTowards(newRotation, amount); - Vector2 npcCenter = vectorCenter; + Vector2 npcCenter = vectorCenter; - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + npc.alpha = 255; + } - float timeBeforeTeleport = teleportPhaseTimer - 15f; - if (npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + float timeBeforeTeleport = teleportPhaseTimer - 15f; + if (npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) - { - Vector2 center = targetData.Center + new Vector2(0f, -540f); - npcCenter = npc.Center = center; - } + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) + { + Vector2 center = targetData.Center + new Vector2(0f, -540f); + npcCenter = npc.Center = center; + } - return; - } + return; + } - if (num28 == 7 && doFastChargeTelegraph) - { - float newRotation = npc.AngleTo(targetData.Center); - float amount = 0.04f; + if (num28 == 7 && doFastChargeTelegraph) + { + float newRotation = npc.AngleTo(targetData.Center); + float amount = 0.04f; - if (npc.spriteDirection == -1) - newRotation += pie; + if (npc.spriteDirection == -1) + newRotation += pie; - if (amount != 0f) - npc.rotation = npc.rotation.AngleTowards(newRotation, amount); + if (amount != 0f) + npc.rotation = npc.rotation.AngleTowards(newRotation, amount); - if (playFastChargeRoarSound) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + if (playFastChargeRoarSound) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - npc.localAI[1] += 1f; + npc.localAI[1] += 1f; - return; - } + return; + } npc.ai[0] = num28; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 1f; - npc.localAI[1] = 0f; + npc.localAI[1] = 0f; - switch (secondPhasePhase) + switch (secondPhasePhase) { case 1: if (phase2) @@ -1980,9 +1974,9 @@ namespace CalamityMod.NPCs.Yharon npc.rotation += pie; npc.velocity = vector3 * spinPhaseVelocity; - - npc.localAI[3] = Main.rand.Next(2); - + + npc.localAI[3] = Main.rand.Next(2); + break; } case 7: //fast charge @@ -2002,32 +1996,32 @@ namespace CalamityMod.NPCs.Yharon } } - // Charge + // Charge else if (npc.ai[0] == 2f) { if (npc.ai[1] == 1f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - ChargeDust(7, pie); + ChargeDust(7, pie); - npc.ai[1] += 1f; - if (npc.ai[1] >= chargeTime) + npc.ai[1] += 1f; + if (npc.ai[1] >= chargeTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); + npc.TargetClosest(); } } - // Fireball spit + // Fireball spit else if (npc.ai[0] == 3f) { int num29 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.ai[2] = num29; - npc.ai[1] += 1f; - if (npc.ai[1] < fireballBreathTimer) + npc.ai[1] += 1f; + if (npc.ai[1] < fireballBreathTimer) { Vector2 vector4 = targetData.Center + new Vector2(num29 * -750f, -300f); Vector2 value = npc.SafeDirectionTo(vector4) * 16f; @@ -2055,12 +2049,12 @@ namespace CalamityMod.NPCs.Yharon { float xOffset = 30f; Vector2 position = vectorCenter + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); - Vector2 projectileVelocity = targetData.Center - position; - projectileVelocity.Normalize(); - projectileVelocity *= 0.1f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(position, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Vector2 projectileVelocity = targetData.Center - position; + projectileVelocity.Normalize(); + projectileVelocity *= 0.1f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(position, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); } if (Math.Abs(targetData.Center.X - vectorCenter.X) > 700f && Math.Abs(npc.velocity.X) < chargeSpeed) @@ -2072,11 +2066,11 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - } + npc.TargetClosest(); + } } - // Splitting fireball breath + // Splitting fireball breath else if (npc.ai[0] == 4f) { int num31 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; @@ -2119,9 +2113,9 @@ namespace CalamityMod.NPCs.Yharon Vector2 position = vectorCenter + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); int num34 = (int)(npc.ai[1] - splittingFireballBreathTimer + 1f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (num34 <= splittingFireballBreathTimer2 && num34 % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (num34 <= splittingFireballBreathTimer2 && num34 % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(position, npc.velocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } @@ -2134,101 +2128,101 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - } + npc.TargetClosest(); + } } - // Fireball spin + // Fireball spin else if (npc.ai[0] == 5f) { - npc.velocity = npc.velocity.RotatedBy(-(double)spinRotation * (float)npc.direction); + npc.velocity = npc.velocity.RotatedBy(-(double)spinRotation * (float)npc.direction); npc.rotation -= spinRotation * npc.direction; - if (npc.ai[1] == 1f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - flareDustBulletHellSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); - } - - npc.ai[1] += 1f; - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.ai[1] == 1f) { - if (secondPhasePhase >= 3) - { - // Rotate spiral by 9 * (240 / 12) = +90 degrees and then back -90 degrees + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + flareDustBulletHellSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / (MathHelper.TwoPi * 3f); + } - // For phase 4: Rotate spiral by 18 * (240 / 16) = +135 degrees and then back -135 degrees + npc.ai[1] += 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (secondPhasePhase >= 3) + { + // Rotate spiral by 9 * (240 / 12) = +90 degrees and then back -90 degrees - if (npc.ai[1] % flareDustSpawnDivisor2 == 0f) - { - int totalProjectiles = secondPhasePhase == 4 ? 12 : 10; - float projectileVelocity = secondPhasePhase == 4 ? 16f : 12f; - float radialOffset = secondPhasePhase == 4 ? 2.8f : 3.2f; - if (npc.localAI[3] == 0f) - { - DoFlareDustBulletHell(1, spinPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, projectileVelocity, radialOffset, true); - } - else - { - int ringReduction = (int)MathHelper.Lerp(0f, 12f, npc.ai[1] / spinPhaseTimer); - int totalProjectiles2 = 38 - ringReduction; // 36 for first ring, 24 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor2, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles2, 0f, 0f, true); - } + // For phase 4: Rotate spiral by 18 * (240 / 16) = +135 degrees and then back -135 degrees - // Fire a flame towards every player, with a limit of 10 - if (expertMode && npc.ai[2] % (flareDustSpawnDivisor2 * 2) == 0f) - { - List targets = new List(); - for (int p = 0; p < Main.maxPlayers; p++) - { - if (Main.player[p].active && !Main.player[p].dead) - targets.Add(p); + if (npc.ai[1] % flareDustSpawnDivisor2 == 0f) + { + int totalProjectiles = secondPhasePhase == 4 ? 12 : 10; + float projectileVelocity = secondPhasePhase == 4 ? 16f : 12f; + float radialOffset = secondPhasePhase == 4 ? 2.8f : 3.2f; + if (npc.localAI[3] == 0f) + { + DoFlareDustBulletHell(1, spinPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, projectileVelocity, radialOffset, true); + } + else + { + int ringReduction = (int)MathHelper.Lerp(0f, 12f, npc.ai[1] / spinPhaseTimer); + int totalProjectiles2 = 38 - ringReduction; // 36 for first ring, 24 for last ring + DoFlareDustBulletHell(0, flareDustSpawnDivisor2, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles2, 0f, 0f, true); + } - if (targets.Count > 4) - break; - } - foreach (int t in targets) - { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); - int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - } - } - } - else - { - if (npc.ai[1] % flareDustSpawnDivisor == 0f) - { - int ringReduction = (int)MathHelper.Lerp(0f, 12f, npc.ai[1] / spinPhaseTimer); - int totalProjectiles = 38 - ringReduction; // 36 for first ring, 24 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, true); + // Fire a flame towards every player, with a limit of 10 + if (expertMode && npc.ai[2] % (flareDustSpawnDivisor2 * 2) == 0f) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); - // Fire a flame towards every player, with a limit of 10 - if (expertMode) - { - List targets = new List(); - for (int p = 0; p < Main.maxPlayers; p++) - { - if (Main.player[p].active && !Main.player[p].dead) - targets.Add(p); + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + } + } + } + else + { + if (npc.ai[1] % flareDustSpawnDivisor == 0f) + { + int ringReduction = (int)MathHelper.Lerp(0f, 12f, npc.ai[1] / spinPhaseTimer); + int totalProjectiles = 38 - ringReduction; // 36 for first ring, 24 for last ring + DoFlareDustBulletHell(0, flareDustSpawnDivisor, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, true); - if (targets.Count > 4) - break; - } - foreach (int t in targets) - { - Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; - int type = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - } - } - } + // Fire a flame towards every player, with a limit of 10 + if (expertMode) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); - if (npc.ai[1] == 210f && secondPhasePhase == 4 && useTornado) + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + } + } + } + + if (npc.ai[1] == 210f && secondPhasePhase == 4 && useTornado) { useTornado = false; Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); @@ -2240,13 +2234,13 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = increasedIdleTimeAfterBulletHell; npc.ai[2] = 0f; - npc.localAI[2] = 0f; - npc.TargetClosest(); - npc.velocity /= 2f; + npc.localAI[2] = 0f; + npc.TargetClosest(); + npc.velocity /= 2f; } } - // Fire ring + // Fire ring else if (npc.ai[0] == 6f) { if (npc.ai[1] == 0f) @@ -2282,14 +2276,14 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] == 20f || npc.ai[1] == 80f || npc.ai[1] == 140f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + if (npc.ai[1] == 20f || npc.ai[1] == 80f || npc.ai[1] == 140f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - DoFireRing(expertMode ? 300 : 180, npc.GetProjectileDamage(ModContent.ProjectileType()), npc.target, 1f); + DoFireRing(expertMode ? 300 : 180, npc.GetProjectileDamage(ModContent.ProjectileType()), npc.target, 1f); - Vector2 vector7 = vectorCenter + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); - } + Vector2 vector7 = vectorCenter + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); + } } npc.ai[1] += 1f; @@ -2297,37 +2291,37 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] >= flareSpawnPhaseTimer) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(vectorCenter, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.target + 1); npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - } + npc.TargetClosest(); + } } - // Fast charge + // Fast charge else if (npc.ai[0] == 7f) { if (npc.ai[1] == 1f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); - ChargeDust(14, pie); + ChargeDust(14, pie); - npc.ai[1] += 1f; - if (npc.ai[1] >= chargeTime) + npc.ai[1] += 1f; + if (npc.ai[1] >= chargeTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.TargetClosest(); - } + npc.TargetClosest(); + } } - // Teleport + // Teleport else if (npc.ai[0] == 8f) { Vector2 npcCenter = vectorCenter; @@ -2361,12 +2355,12 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.localAI[1] = fastChargeTelegraphTime + 1f; - npc.netUpdate = true; + npc.localAI[1] = fastChargeTelegraphTime + 1f; + npc.netUpdate = true; } } - // Enter new phase + // Enter new phase else if (npc.ai[0] == 9f) { npc.velocity *= 0.9f; @@ -2410,8 +2404,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -2465,363 +2459,363 @@ namespace CalamityMod.NPCs.Yharon if (num43 != 0f) npc.rotation = npc.rotation.AngleTowards(num42, num43); } - #endregion + #endregion - #region Charge Dust - private void ChargeDust(int dustAmt, float pie) - { - for (int num1474 = 0; num1474 < dustAmt; num1474++) - { - Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; - vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + npc.Center; - Vector2 value18 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); - Main.dust[num1475].noGravity = true; - Main.dust[num1475].noLight = true; - Main.dust[num1475].velocity /= 4f; - Main.dust[num1475].velocity -= npc.velocity; - } - } - #endregion - - #region Flare Dust Bullet Hell - private void DoFlareDustBulletHell(int attackType, int timer, int projectileDamage, int totalProjectiles, float projectileVelocity, float radialOffset, bool phase2) - { - Main.PlaySound(SoundID.Item20, flareDustBulletHellSpawn); - float aiVariableUsed = phase2 ? npc.ai[1] : npc.ai[2]; - switch (attackType) - { - case 0: - float offsetAngle = 360 / totalProjectiles; - int totalSpaces = totalProjectiles / 5; - int spaceStart = Main.rand.Next(totalProjectiles - totalSpaces); - float ai0 = aiVariableUsed % (timer * 2) == 0f ? 1f : 0f; - - int spacesMade = 0; - for (int i = 0; i < totalProjectiles; i++) - { - if (i >= spaceStart && spacesMade < totalSpaces) - spacesMade++; - else - Projectile.NewProjectile(flareDustBulletHellSpawn, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, ai0, i * offsetAngle); - } - break; - - case 1: - double radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-npc.localAI[2], -projectileVelocity)); - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * projectileVelocity; - Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); - } - - float newRadialOffset = (int)aiVariableUsed / (timer / 4) % 2f == 0f ? radialOffset : -radialOffset; - npc.localAI[2] += newRadialOffset; - break; - - default: - break; - } - } - #endregion - - #region Fire Ring - public void DoFireRing(int timeLeft, int damage, float ai0, float ai1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float velocity = ai1 == 0f ? 10f : 5f; - int totalProjectiles = 50; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); - Main.projectile[proj].timeLeft = timeLeft; - } - } - } - #endregion - - #region Drawing - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + #region Charge Dust + private void ChargeDust(int dustAmt, float pie) { - bool idlePhases = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f)) || (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f)); + for (int num1474 = 0; num1474 < dustAmt; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f; + vector171 = vector171.RotatedBy((num1474 - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default, 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + } + #endregion - bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || - (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); + #region Flare Dust Bullet Hell + private void DoFlareDustBulletHell(int attackType, int timer, int projectileDamage, int totalProjectiles, float projectileVelocity, float radialOffset, bool phase2) + { + Main.PlaySound(SoundID.Item20, flareDustBulletHellSpawn); + float aiVariableUsed = phase2 ? npc.ai[1] : npc.ai[2]; + switch (attackType) + { + case 0: + float offsetAngle = 360 / totalProjectiles; + int totalSpaces = totalProjectiles / 5; + int spaceStart = Main.rand.Next(totalProjectiles - totalSpaces); + float ai0 = aiVariableUsed % (timer * 2) == 0f ? 1f : 0f; - bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || - (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f)); + int spacesMade = 0; + for (int i = 0; i < totalProjectiles; i++) + { + if (i >= spaceStart && spacesMade < totalSpaces) + spacesMade++; + else + Projectile.NewProjectile(flareDustBulletHellSpawn, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, ai0, i * offsetAngle); + } + break; - bool tornadoPhase = !startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f); + case 1: + double radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-npc.localAI[2], -projectileVelocity)); - bool newPhasePhase = (!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f)) || (startSecondAI && npc.ai[0] == 9f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * projectileVelocity; + Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); + } - bool pauseAfterTeleportPhase = startSecondAI && npc.ai[0] == 8f; + float newRadialOffset = (int)aiVariableUsed / (timer / 4) % 2f == 0f ? radialOffset : -radialOffset; + npc.localAI[2] += newRadialOffset; + break; - bool ai2 = startSecondAI; + default: + break; + } + } + #endregion - SpriteEffects spriteEffects = ai2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = ai2 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + #region Fire Ring + public void DoFireRing(int timeLeft, int damage, float ai0, float ai1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float velocity = ai1 == 0f ? 10f : 5f; + int totalProjectiles = 50; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); + int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); + Main.projectile[proj].timeLeft = timeLeft; + } + } + } + #endregion - Texture2D texture = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[npc.type] / 2); - Color color = lightColor; - Color invincibleColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - Color color36 = Color.White; + #region Drawing + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + bool idlePhases = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f)) || (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f)); - float amount9 = 0f; - bool invincible = ai2 && invincibilityCounter < 900; - bool flag8 = npc.ai[0] > 5f; - bool flag9 = npc.ai[0] > 12f; - bool flag10 = startSecondAI; - int num150 = 120; - int num151 = 60; + bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || + (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); - if (flag10) - color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.7f, 0.3f, 1f); - else if (flag9) - color = CalamityGlobalNPC.buffColor(color, 0.8f, 0.7f, 0.4f, 1f); - else if (flag8) - color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.5f, 1f); - else if (npc.ai[0] == 4f && npc.ai[2] > num150) - { - float num152 = npc.ai[2] - num150; - num152 /= num151; - color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f); - } + bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || + (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f)); - int num153 = 10; - int num154 = 2; - if (npc.ai[0] == -1f) - num153 = 0; - if (idlePhases) - num153 = 7; + bool tornadoPhase = !startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f); - if (invincible) - color36 = invincibleColor; - else if (chargingOrSpawnPhases) - { - color36 = Color.Red; - amount9 = 0.5f; - } - else - color = lightColor; + bool newPhasePhase = (!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f)) || (startSecondAI && npc.ai[0] == 9f); - if (CalamityConfig.Instance.Afterimages) - { - for (int num155 = 1; num155 < num153; num155 += num154) - { - Color color38 = color; - color38 = Color.Lerp(color38, color36, amount9); - color38 = npc.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } + bool pauseAfterTeleportPhase = startSecondAI && npc.ai[0] == 8f; - int num156 = 0; - float num157 = 0f; - float scaleFactor9 = 0f; + bool ai2 = startSecondAI; - if (npc.ai[0] == -1f) - num156 = 0; + SpriteEffects spriteEffects = ai2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = ai2 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - if (tornadoPhase) - { - int num158 = 60; - int num159 = 30; - if (npc.ai[2] > num158) - { - num156 = 6; - num157 = 1f - (float)Math.Cos((npc.ai[2] - num158) / num159 * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 40f; - } - } + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.npcFrameCount[npc.type] / 2); + Color color = lightColor; + Color invincibleColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color color36 = Color.White; - if (newPhasePhase && npc.ai[2] > num150) - { - num156 = 6; - num157 = 1f - (float)Math.Cos((npc.ai[2] - num150) / num151 * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 60f; - } + float amount9 = 0f; + bool invincible = ai2 && invincibilityCounter < Phase2InvincibilityTime; + bool flag8 = npc.ai[0] > 5f; + bool flag9 = npc.ai[0] > 12f; + bool flag10 = startSecondAI; + int num150 = 120; + int num151 = 60; - if (pauseAfterTeleportPhase) - { - num156 = 6; - num157 = 1f - (float)Math.Cos(npc.ai[2] / 30f * MathHelper.TwoPi); - num157 /= 3f; - scaleFactor9 = 20f; - } + if (flag10) + color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.7f, 0.3f, 1f); + else if (flag9) + color = CalamityGlobalNPC.buffColor(color, 0.8f, 0.7f, 0.4f, 1f); + else if (flag8) + color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.5f, 1f); + else if (npc.ai[0] == 4f && npc.ai[2] > num150) + { + float num152 = npc.ai[2] - num150; + num152 /= num151; + color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f); + } - if (CalamityConfig.Instance.Afterimages) - { - for (int num160 = 0; num160 < num156; num160++) - { - Color color39 = lightColor; - color39 = Color.Lerp(color39, color36, amount9); - color39 = npc.GetAlpha(color39); - color39 *= 1f - num157; - Vector2 vector42 = npc.Center + (num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector42 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector42 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } + int num153 = 10; + int num154 = 2; + if (npc.ai[0] == -1f) + num153 = 0; + if (idlePhases) + num153 = 7; - Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector43, npc.frame, invincible ? invincibleColor : npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + if (invincible) + color36 = invincibleColor; + else if (chargingOrSpawnPhases) + { + color36 = Color.Red; + amount9 = 0.5f; + } + else + color = lightColor; - if (flag8 || npc.ai[0] == 4f || startSecondAI) - { - texture = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowOrange"); - Color color40 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f); - color36 = invincible ? invincibleColor : Color.Orange; + if (CalamityConfig.Instance.Afterimages) + { + for (int num155 = 1; num155 < num153; num155 += num154) + { + Color color38 = color; + color38 = Color.Lerp(color38, color36, amount9); + color38 = npc.GetAlpha(color38); + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } - Texture2D texture2 = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowGreen"); - Color color43 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f); - Color color44 = invincible ? invincibleColor : Color.Chartreuse; + int num156 = 0; + float num157 = 0f; + float scaleFactor9 = 0f; - Texture2D texture3 = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowPurple"); - Color color45 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f); - Color color46 = invincible ? invincibleColor : Color.BlueViolet; + if (npc.ai[0] == -1f) + num156 = 0; - amount9 = 1f; - num157 = 0.5f; - scaleFactor9 = 10f; - num154 = 1; + if (tornadoPhase) + { + int num158 = 60; + int num159 = 30; + if (npc.ai[2] > num158) + { + num156 = 6; + num157 = 1f - (float)Math.Cos((npc.ai[2] - num158) / num159 * MathHelper.TwoPi); + num157 /= 3f; + scaleFactor9 = 40f; + } + } - if (newPhasePhase) - { - float num161 = npc.ai[2] - num150; - num161 /= num151; - color36 *= num161; - color40 *= num161; + if (newPhasePhase && npc.ai[2] > num150) + { + num156 = 6; + num157 = 1f - (float)Math.Cos((npc.ai[2] - num150) / num151 * MathHelper.TwoPi); + num157 /= 3f; + scaleFactor9 = 60f; + } - if (flag9 || npc.ai[0] == 10f || startSecondAI) - { - color43 *= num161; - color44 *= num161; - } + if (pauseAfterTeleportPhase) + { + num156 = 6; + num157 = 1f - (float)Math.Cos(npc.ai[2] / 30f * MathHelper.TwoPi); + num157 /= 3f; + scaleFactor9 = 20f; + } - if (flag10 || npc.ai[0] == 17f) - { - color45 *= num161; - color46 *= num161; - } - } + if (CalamityConfig.Instance.Afterimages) + { + for (int num160 = 0; num160 < num156; num160++) + { + Color color39 = lightColor; + color39 = Color.Lerp(color39, color36, amount9); + color39 = npc.GetAlpha(color39); + color39 *= 1f - num157; + Vector2 vector42 = npc.Center + (num160 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector42 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector42 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } - if (pauseAfterTeleportPhase) - { - float num162 = npc.ai[2]; - num162 /= 30f; + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, vector43, npc.frame, invincible ? invincibleColor : npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - if (num162 > 0.5f) - num162 = 1f - num162; + if (flag8 || npc.ai[0] == 4f || startSecondAI) + { + texture = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowOrange"); + Color color40 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Orange, 0.5f); + color36 = invincible ? invincibleColor : Color.Orange; - num162 *= 2f; - num162 = 1f - num162; - color36 *= num162; - color40 *= num162; - color43 *= num162; - color44 *= num162; - color45 *= num162; - color46 *= num162; - } + Texture2D texture2 = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowGreen"); + Color color43 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.Chartreuse, 0.5f); + Color color44 = invincible ? invincibleColor : Color.Chartreuse; - if (CalamityConfig.Instance.Afterimages) - { - for (int num163 = 1; num163 < num153; num163 += num154) - { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Texture2D texture3 = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowPurple"); + Color color45 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f); + Color color46 = invincible ? invincibleColor : Color.BlueViolet; - if (flag9 || npc.ai[0] == 10f || startSecondAI) - { - Color color47 = color43; - color47 = Color.Lerp(color47, color44, amount9); - color47 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture2, vector44, npc.frame, color47, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } + amount9 = 1f; + num157 = 0.5f; + scaleFactor9 = 10f; + num154 = 1; - if (flag10 || npc.ai[0] == 17f) - { - Color color48 = color45; - color48 = Color.Lerp(color48, color46, amount9); - color48 *= (num153 - num163) / 15f; - spriteBatch.Draw(texture3, vector44, npc.frame, color48, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } + if (newPhasePhase) + { + float num161 = npc.ai[2] - num150; + num161 /= num151; + color36 *= num161; + color40 *= num161; - for (int num164 = 1; num164 < num156; num164++) - { - Color color42 = color40; - color42 = Color.Lerp(color42, color36, amount9); - color42 = npc.GetAlpha(color42); - color42 *= 1f - num157; - Vector2 vector45 = npc.Center + (num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector45 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector45 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - spriteBatch.Draw(texture, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + if (flag9 || npc.ai[0] == 10f || startSecondAI) + { + color43 *= num161; + color44 *= num161; + } - if (flag9 || npc.ai[0] == 10f || startSecondAI) - { - Color color49 = color43; - color49 = Color.Lerp(color49, color44, amount9); - color49 = npc.GetAlpha(color49); - color49 *= 1f - num157; - spriteBatch.Draw(texture2, vector45, npc.frame, color49, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } + if (flag10 || npc.ai[0] == 17f) + { + color45 *= num161; + color46 *= num161; + } + } - if (flag10 || npc.ai[0] == 17f) - { - Color color50 = color45; - color50 = Color.Lerp(color50, color46, amount9); - color50 = npc.GetAlpha(color50); - color50 *= 1f - num157; - spriteBatch.Draw(texture3, vector45, npc.frame, color50, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } - } + if (pauseAfterTeleportPhase) + { + float num162 = npc.ai[2]; + num162 /= 30f; - spriteBatch.Draw(texture, vector43, npc.frame, color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + if (num162 > 0.5f) + num162 = 1f - num162; - if (flag9 || npc.ai[0] == 10f || startSecondAI) - spriteBatch.Draw(texture2, vector43, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + num162 *= 2f; + num162 = 1f - num162; + color36 *= num162; + color40 *= num162; + color43 *= num162; + color44 *= num162; + color45 *= num162; + color46 *= num162; + } - if (flag10 || npc.ai[0] == 17f) - spriteBatch.Draw(texture3, vector43, npc.frame, color45, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } + if (CalamityConfig.Instance.Afterimages) + { + for (int num163 = 1; num163 < num153; num163 += num154) + { + Color color41 = color40; + color41 = Color.Lerp(color41, color36, amount9); + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + if (flag9 || npc.ai[0] == 10f || startSecondAI) + { + Color color47 = color43; + color47 = Color.Lerp(color47, color44, amount9); + color47 *= (num153 - num163) / 15f; + spriteBatch.Draw(texture2, vector44, npc.frame, color47, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + if (flag10 || npc.ai[0] == 17f) + { + Color color48 = color45; + color48 = Color.Lerp(color48, color46, amount9); + color48 *= (num153 - num163) / 15f; + spriteBatch.Draw(texture3, vector44, npc.frame, color48, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + + for (int num164 = 1; num164 < num156; num164++) + { + Color color42 = color40; + color42 = Color.Lerp(color42, color36, amount9); + color42 = npc.GetAlpha(color42); + color42 *= 1f - num157; + Vector2 vector45 = npc.Center + (num164 / (float)num156 * MathHelper.TwoPi + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; + vector45 -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector45 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + if (flag9 || npc.ai[0] == 10f || startSecondAI) + { + Color color49 = color43; + color49 = Color.Lerp(color49, color44, amount9); + color49 = npc.GetAlpha(color49); + color49 *= 1f - num157; + spriteBatch.Draw(texture2, vector45, npc.frame, color49, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + if (flag10 || npc.ai[0] == 17f) + { + Color color50 = color45; + color50 = Color.Lerp(color50, color46, amount9); + color50 = npc.GetAlpha(color50); + color50 *= 1f - num157; + spriteBatch.Draw(texture3, vector45, npc.frame, color50, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + } + } + + spriteBatch.Draw(texture, vector43, npc.frame, color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + if (flag9 || npc.ai[0] == 10f || startSecondAI) + spriteBatch.Draw(texture2, vector43, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + if (flag10 || npc.ai[0] == 17f) + spriteBatch.Draw(texture3, vector43, npc.frame, color45, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } return false; } - #endregion + #endregion - #region Loot - public override void NPCLoot() - { - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedYharon); + #region Loot + public override void NPCLoot() + { + CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedYharon); - CalamityGlobalNPC.SetNewBossJustDowned(npc); + CalamityGlobalNPC.SetNewBossJustDowned(npc); - // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops - DropHelper.DropBags(npc); + // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops + DropHelper.DropBags(npc); // Normal drops: Everything that would otherwise be in the bag if (!Main.expertMode) @@ -2837,8 +2831,8 @@ namespace CalamityMod.NPCs.Yharon DropHelper.WeightStack(w), // Yharon Kindle Staff DropHelper.WeightStack(w), // Infernal Spear DropHelper.WeightStack(w), - DropHelper.WeightStack(w) - ); + DropHelper.WeightStack(w) + ); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); @@ -2850,32 +2844,32 @@ namespace CalamityMod.NPCs.Yharon int soulFragMax = 22; DropHelper.DropItem(npc, ModContent.ItemType(), true, soulFragMin, soulFragMax); - // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), true); - DropHelper.DropItem(npc, ModContent.ItemType(), true); + // Equipment + DropHelper.DropItem(npc, ModContent.ItemType(), true); + DropHelper.DropItem(npc, ModContent.ItemType(), true); } // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - // Other - // DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedYharon); + // Other + // DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedYharon); - // If Yharon has not been killed yet, notify players of Auric Ore - if (!CalamityWorld.downedYharon) - { - CalamityUtils.SpawnOre(ModContent.TileType(), 2E-05, 0.6f, 0.8f, 10, 20); + // If Yharon has not been killed yet, notify players of Auric Ore + if (!CalamityWorld.downedYharon) + { + CalamityUtils.SpawnOre(ModContent.TileType(), 2E-05, 0.6f, 0.8f, 10, 20); - string key = "Mods.CalamityMod.AuricOreText"; - Color messageColor = Color.Gold; - CalamityUtils.DisplayLocalizedText(key, messageColor); - } + string key = "Mods.CalamityMod.AuricOreText"; + Color messageColor = Color.Gold; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } - // Mark Yharon as dead - CalamityWorld.downedYharon = true; - CalamityNetcode.SyncWorld(); - } + // Mark Yharon as dead + CalamityWorld.downedYharon = true; + CalamityNetcode.SyncWorld(); + } public override void BossLoot(ref string name, ref int potionType) { @@ -2883,16 +2877,16 @@ namespace CalamityMod.NPCs.Yharon } #endregion - #region On Hit Player - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 420, true); - } - #endregion + #region On Hit Player + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 420, true); + } + #endregion - #region Projectile Resists - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { + #region Projectile Resists + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { if (projectile.type == ModContent.ProjectileType()) damage = (int)(damage * 0.85); if (projectile.type == ModContent.ProjectileType()) @@ -2900,10 +2894,10 @@ namespace CalamityMod.NPCs.Yharon if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) damage = (int)(damage * 0.95); } - #endregion + #endregion - #region HP Bar Cooldown Slot and Stats - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + #region HP Bar Cooldown Slot and Stats + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { scale = 2f; return null; @@ -2925,57 +2919,50 @@ namespace CalamityMod.NPCs.Yharon #region Find Frame public override void FindFrame(int frameHeight) { - bool idlePhases = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f)) || (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f)); + bool idlePhases = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f)) || (startSecondAI && (npc.ai[0] == 5f || npc.ai[0] < 2f)); - bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || - (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); + bool chargingOrSpawnPhases = (!startSecondAI && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f)) || + (startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f)); - bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || - (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f)); + bool projectileOrCirclePhases = (!startSecondAI && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 20f)) || + (startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f)); - bool tornadoPhase = !startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f); + bool tornadoPhase = !startSecondAI && (npc.ai[0] == 3f || npc.ai[0] == 9f || npc.ai[0] == -1f || npc.ai[0] == 16f); - bool newPhasePhase = (!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f)) || (startSecondAI && npc.ai[0] == 9f); + bool newPhasePhase = (!startSecondAI && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f)) || (startSecondAI && npc.ai[0] == 9f); - bool chargeTelegraph = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f) || - (startSecondAI && npc.ai[0] < 2f && npc.localAI[1] > 0f); + bool chargeTelegraph = (!startSecondAI && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f) || + (startSecondAI && npc.ai[0] < 2f && npc.localAI[1] > 0f); - if (chargeTelegraph) - { - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + if (chargeTelegraph) + { + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; - if (CalamityWorld.revenge || CalamityWorld.malice || BossRushEvent.BossRushActive) - { - // Increase aggression if player is taking a long time to kill the boss - if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) - lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; - } + bool doTelegraphFlightAnimation = npc.localAI[1] < fastChargeTelegraphTime * 0.5f || npc.localAI[1] > fastChargeTelegraphTime - (fastChargeTelegraphTime / 6f); + bool doTelegraphRoarAnimation = npc.localAI[1] > fastChargeTelegraphTime - fastChargeTelegraphTime * 0.4f && npc.localAI[1] < fastChargeTelegraphTime - fastChargeTelegraphTime * 0.2f; + bool phase4 = startSecondAI && lifeRatio <= ((CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 0.165f : 0.11f) && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice); + if (doTelegraphFlightAnimation) + { + npc.frameCounter += phase4 ? 2D : 1D; + if (npc.frameCounter > 5D) + { + npc.frameCounter = 0D; + npc.frame.Y += frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) + npc.frame.Y = 0; + } + else + { + npc.frame.Y = frameHeight * 5; + if (doTelegraphRoarAnimation) + npc.frame.Y = frameHeight * 6; + } + return; + } - bool doTelegraphFlightAnimation = npc.localAI[1] < fastChargeTelegraphTime * 0.5f || npc.localAI[1] > fastChargeTelegraphTime - (fastChargeTelegraphTime / 6f); - bool doTelegraphRoarAnimation = npc.localAI[1] > fastChargeTelegraphTime - fastChargeTelegraphTime * 0.4f && npc.localAI[1] < fastChargeTelegraphTime - fastChargeTelegraphTime * 0.2f; - bool phase4 = startSecondAI && lifeRatio <= ((CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 0.165f : 0.11f) && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice); - if (doTelegraphFlightAnimation) - { - npc.frameCounter += phase4 ? 2D : 1D; - if (npc.frameCounter > 5D) - { - npc.frameCounter = 0D; - npc.frame.Y += frameHeight; - } - if (npc.frame.Y >= frameHeight * 5) - npc.frame.Y = 0; - } - else - { - npc.frame.Y = frameHeight * 5; - if (doTelegraphRoarAnimation) - npc.frame.Y = frameHeight * 6; - } - return; - } - - if (idlePhases) + if (idlePhases) { int num84 = 5; if (!startSecondAI && (npc.ai[0] == 6f || npc.ai[0] == 13f)) diff --git a/Particles/Blood.png b/Particles/Blood.png new file mode 100644 index 0000000000..d123f8dc42 Binary files /dev/null and b/Particles/Blood.png differ diff --git a/Particles/Blood2.png b/Particles/Blood2.png new file mode 100644 index 0000000000..be02000dfc Binary files /dev/null and b/Particles/Blood2.png differ diff --git a/Particles/BloodParticle.cs b/Particles/BloodParticle.cs new file mode 100644 index 0000000000..8a8fe242de --- /dev/null +++ b/Particles/BloodParticle.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class BloodParticle : Particle + { + public Color InitialColor; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Particles/Blood"; + + public BloodParticle(Vector2 relativePosition, Vector2 velocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + Scale *= 0.98f; + Velocity.X *= 0.97f; + Velocity.Y = MathHelper.Clamp(Velocity.Y + 0.9f, -22f, 22f); + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float verticalStretch = Utils.InverseLerp(0f, 24f, Math.Abs(Velocity.Y), true) * 0.84f; + float brightness = (float)Math.Pow(Lighting.Brightness((int)(Position.X / 16f), (int)(Position.Y / 16f)), 0.15); + Vector2 scale = new Vector2(1f, verticalStretch + 1f) * Scale * 0.1f; + Texture2D texture = ModContent.GetTexture(Texture); + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color * brightness, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/BloodParticle2.cs b/Particles/BloodParticle2.cs new file mode 100644 index 0000000000..500fdd6c7c --- /dev/null +++ b/Particles/BloodParticle2.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class BloodParticle2 : Particle + { + public Color InitialColor; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Particles/Blood2"; + + public BloodParticle2(Vector2 relativePosition, Vector2 velocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + Velocity *= 0.98f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 4D)); + Rotation = Velocity.ToRotation(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float brightness = (float)Math.Pow(Lighting.Brightness((int)(Position.X / 16f), (int)(Position.Y / 16f)), 0.15); + Texture2D texture = ModContent.GetTexture(Texture); + Rectangle frame = texture.Frame(1, 3, 0, (int)(LifetimeCompletion * 3f)); + Vector2 origin = frame.Size() * 0.5f; + + spriteBatch.Draw(texture, Position - Main.screenPosition, frame, Color * brightness, Rotation, origin, Scale, 0, 0f); + } + } +} diff --git a/Particles/ImpactParticle.cs b/Particles/ImpactParticle.cs new file mode 100644 index 0000000000..43728049c4 --- /dev/null +++ b/Particles/ImpactParticle.cs @@ -0,0 +1,40 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ImpactParticle : Particle + { + public float AngularVelocity; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public ImpactParticle(Vector2 relativePosition, float angularVelocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Scale = scale; + AngularVelocity = angularVelocity; + Rotation = Main.rand.NextFloat(MathHelper.TwoPi); + Lifetime = lifetime; + Color = color; + } + + public override void Update() => Rotation += AngularVelocity; + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float scaleFactor = CalamityUtils.Convert01To010(LifetimeCompletion) * 1.3f; + Vector2 scale = new Vector2(0.3f, 1f) * scaleFactor; + Texture2D texture = ModContent.GetTexture(Texture); + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, 0f, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, -Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Particles/SparkParticle.cs b/Particles/SparkParticle.cs new file mode 100644 index 0000000000..280c905c45 --- /dev/null +++ b/Particles/SparkParticle.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class SparkParticle : Particle + { + public Color InitialColor; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public SparkParticle(Vector2 relativePosition, Vector2 velocity, int lifetime, float scale, Color color) + { + Position = relativePosition; + Velocity = velocity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + } + + public override void Update() + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(0.35f, 1.6f) * Scale; + Texture2D texture = ModContent.GetTexture(Texture); + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + } + } +} diff --git a/Projectiles/Boss/AstralGodRay.cs b/Projectiles/Boss/AstralGodRay.cs index 74c78ac6f5..d9ef0b693f 100644 --- a/Projectiles/Boss/AstralGodRay.cs +++ b/Projectiles/Boss/AstralGodRay.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.MaxUpdates = 3; - projectile.timeLeft = 2400; + projectile.MaxUpdates = 1; + projectile.timeLeft = 1200; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { if (WaveFrameState < 0f) - return new Color(255, 200, 0, projectile.alpha); + return new Color(255, 100, 0, projectile.alpha); return new Color(0, 255, 200, projectile.alpha); } @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustVel = projectile.velocity / 4f; for (int i = 0; i < dustAmt; ++i) { - Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 2.5f); + Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 1.5f); d.velocity += dustVel; d.velocity *= Main.rand.NextFloat(0.4f, 1f); d.noGravity = true; diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 432887d3e0..eb8e47dd2b 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -37,11 +37,12 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.ai[0] == 1f) { + projectile.extraUpdates = 2; bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; - float maxVelocity = malice ? 15f : 12f; + float maxVelocity = malice ? 3.75f : 3f; if (projectile.velocity.Length() < maxVelocity) { - projectile.velocity *= malice ? 1.075f : 1.05f; + projectile.velocity *= malice ? 1.02f : 1.015f; if (projectile.velocity.Length() > maxVelocity) { projectile.velocity.Normalize(); diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index e4c20dc1a8..a883a514a2 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -11,6 +11,9 @@ namespace CalamityMod.Projectiles.Boss { public class DeusMine : ModProjectile { + private const int MaxTimeLeft = 600; + private const int FadeTime = 85; + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Mine"); @@ -25,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 100; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft = 900; + projectile.timeLeft = MaxTimeLeft; } public override void SendExtraAI(BinaryWriter writer) @@ -50,29 +53,21 @@ namespace CalamityMod.Projectiles.Boss } // Deal no damage if fading out and not set to explode - // Grow in size if set to explode - if (projectile.timeLeft < 85) + if (projectile.timeLeft < FadeTime) { if (projectile.ai[0] == 0f) - { projectile.damage = 0; - } - else - { - projectile.scale += 1f / 85f; - projectile.width = projectile.height = (int)(30f * projectile.scale); - } } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(projectile.Center, 12f, targetHitbox); - public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 815 && (projectile.timeLeft >= 85 || projectile.ai[0] == 1f); + public override bool CanHitPlayer(Player target) => projectile.timeLeft <= MaxTimeLeft - FadeTime && (projectile.timeLeft >= FadeTime || projectile.ai[0] == 1f); public override Color? GetAlpha(Color lightColor) { // Fade in - if (projectile.timeLeft > 815) + if (projectile.timeLeft > MaxTimeLeft - FadeTime) { projectile.localAI[1] += 1f; byte b2 = (byte)(((int)projectile.localAI[1]) * 3); @@ -82,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss // Fade out if not set to explode // Glow more red over time if set to explode - if (projectile.timeLeft < 85) + if (projectile.timeLeft < FadeTime) { byte b2 = (byte)(projectile.timeLeft * 3); if (projectile.ai[0] == 0f) @@ -148,7 +143,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.timeLeft > 815 || (projectile.timeLeft < 85 && projectile.ai[0] == 0f)) + if (projectile.timeLeft > MaxTimeLeft - FadeTime || (projectile.timeLeft < FadeTime && projectile.ai[0] == 0f)) return; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Magic/TerraBeam.cs b/Projectiles/Magic/TerraBeam.cs index 6c3b4bbba7..744feb3203 100644 --- a/Projectiles/Magic/TerraBeam.cs +++ b/Projectiles/Magic/TerraBeam.cs @@ -76,7 +76,6 @@ namespace CalamityMod.Projectiles.Magic public override void DetermineScale() => projectile.scale = projectile.timeLeft / Lifetime * MaxScale; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { DrawBeamWithColor(spriteBatch, Color.Lime * 1.1f, projectile.scale); @@ -96,7 +95,7 @@ namespace CalamityMod.Projectiles.Magic int totalShards = (int)MathHelper.Lerp(1, 4, MathHelper.Clamp(lengthFromStart / MaxLaserLength * 1.4f, 0f, 1f)); int shardType = ModContent.ProjectileType(); - int shardDamage = (int)(damage * 0.6); + int shardDamage = (int)(projectile.damage * 0.6); for (int i = 0; i < totalShards; i++) { int tries = 0; @@ -108,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic } while (Collision.SolidCollision((target.Center + spawnOffset).ToTileCoordinates().ToVector2(), 4, 4) && tries < 10); - Projectile.NewProjectile(target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), shardType, shardDamage, knockback); + Projectile.NewProjectile(target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), shardType, shardDamage, projectile.knockBack, projectile.owner); } ShardCooldown = 3f; diff --git a/Projectiles/Magic/TerraShard.cs b/Projectiles/Magic/TerraShard.cs index cad86ae092..d5e639008b 100644 --- a/Projectiles/Magic/TerraShard.cs +++ b/Projectiles/Magic/TerraShard.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class TerraShard : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shard"); @@ -15,7 +17,6 @@ namespace CalamityMod.Projectiles.Magic projectile.width = projectile.height = 20; projectile.friendly = true; projectile.timeLeft = 60; - projectile.penetrate = 1; projectile.magic = true; projectile.tileCollide = true; } @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic terraMagic.velocity *= 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 500f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 15f, 20f); } } } diff --git a/Projectiles/Magic/TerraShard.png b/Projectiles/Magic/TerraShard.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/TerraShard.png and /dev/null differ diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 0315288d26..1be6b26875 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.channel) { HomeTowardsMouse(); - projectile.rotation += 0.35f / projectile.MaxUpdates; + projectile.rotation += 0.45f / projectile.MaxUpdates; } else { @@ -97,6 +98,78 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.netMode != NetmodeID.Server) + { + // Play a splatter and impact sound. + Main.PlaySound(SoundID.DD2_CrystalCartImpact, projectile.Center); + + float damageInterpolant = Utils.InverseLerp(950f, 2000f, damage, true); + float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant); + float impactParticleScale = MathHelper.Lerp(0.6f, 1f, damageInterpolant); + impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f); + + Color impactColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.5f)); + Vector2 impactPoint = Vector2.Lerp(projectile.Center, target.Center, 0.65f); + Vector2 bloodSpawnPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f; + Vector2 splatterDirection = (projectile.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY); + + // Emit blood if the target is organic. + if (target.Organic()) + { + Main.PlaySound(SoundID.NPCHit18, projectile.Center); + for (int i = 0; i < 6; i++) + { + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + Vector2 bloodVelocity = splatterDirection.RotatedByRandom(0.81f) * Main.rand.NextFloat(11f, 23f); + bloodVelocity.Y -= 12f; + BloodParticle blood = new BloodParticle(bloodSpawnPosition, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i < 3; i++) + { + float bloodScale = Main.rand.NextFloat(0.2f, 0.33f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat(0.5f, 1f)); + Vector2 bloodVelocity = splatterDirection.RotatedByRandom(0.9f) * Main.rand.NextFloat(9f, 14.5f); + BloodParticle2 blood = new BloodParticle2(bloodSpawnPosition, bloodVelocity, 20, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + + // Emit sparks if the target is not organic. + else + { + for (int i = 0; i < 6; i++) + { + int sparkLifetime = Main.rand.Next(22, 36); + float sparkScale = Main.rand.NextFloat(0.8f, 1f) + damageInterpolant * 0.85f; + Color sparkColor = Color.Lerp(Color.Silver, Color.Gold, Main.rand.NextFloat(0.7f)); + sparkColor = Color.Lerp(sparkColor, Color.Orange, Main.rand.NextFloat()); + + if (Main.rand.NextBool(10)) + sparkScale *= 2f; + + Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f); + sparkVelocity.Y -= 6f; + SparkParticle spark = new SparkParticle(impactPoint, sparkVelocity, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + // And create an impact point particle. + ImpactParticle impactParticle = new ImpactParticle(impactPoint, impactAngularVelocity, 20, impactParticleScale, impactColor); + GeneralParticleHandler.SpawnParticle(impactParticle); + } + } + internal float PrimitiveWidthFunction(float completionRatio) { float tipWidthFactor = MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0.01f, 0.04f, completionRatio)); diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 1097f95980..b503ca24f0 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -40,16 +40,6 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item9, projectile.position); } } - projectile.alpha -= 15; - int alphaMin = 150; - if (projectile.Center.Y >= projectile.ai[1]) - { - alphaMin = 0; - } - if (projectile.alpha < alphaMin) - { - projectile.alpha = alphaMin; - } projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; if (Main.rand.NextBool(48)) { @@ -57,17 +47,13 @@ namespace CalamityMod.Projectiles.Ranged Main.gore[idx].velocity *= 0.66f; Main.gore[idx].velocity += projectile.velocity * 0.3f; } - if (projectile.ai[1] == 1f) + if (Main.rand.NextBool(10)) { - projectile.light = 0.9f; - if (Main.rand.NextBool(10)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - } - if (Main.rand.NextBool(20)) - { - Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - } + Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + } + if (Main.rand.NextBool(20)) + { + Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } @@ -86,11 +72,50 @@ namespace CalamityMod.Projectiles.Ranged return new Color(200, 200, 200, projectile.alpha); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.ai[1] == 1f) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + Vector2 offsets = new Vector2(0f, projectile.gfxOffY) - Main.screenPosition; + Color alpha = projectile.GetAlpha(lightColor); + Rectangle spriteRec = new Microsoft.Xna.Framework.Rectangle(0, 0, tex.Width, tex.Height); + Vector2 spriteOrigin = spriteRec.Size() / 2f; + SpriteEffects spriteEffects = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Texture2D aura = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/FallenStarAura"); + Vector2 drawStart = projectile.Center + projectile.velocity; + Vector2 drawStart2 = projectile.Center - projectile.velocity * 0.5f; + Vector2 spinPoint = new Vector2(0f, -10f); + float time = Main.player[projectile.owner].miscCounter % 216000f / 60f; + Rectangle auraRec = aura.Frame(); + Color blue = Color.Blue * 0.2f; + Color white = Color.White * 0.5f; + white.A = 0; + blue.A = 0; + Vector2 auraOrigin = new Vector2(auraRec.Width / 2f, 10f); + + //Draw the aura + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.5f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.TwoPi / 3f), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.1f, SpriteEffects.None, 0); + spriteBatch.Draw(aura, drawStart + offsets + spinPoint.RotatedBy(MathHelper.TwoPi * time + MathHelper.Pi * 4f / 3f), auraRec, blue, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 1.3f, SpriteEffects.None, 0); + for (float d = 0f; d < 1f; d += 0.5f) + { + float scaleMult = time % 0.5f / 0.5f; + scaleMult = (scaleMult + d) % 1f; + float colorMult = scaleMult * 2f; + if (colorMult > 1f) + { + colorMult = 2f - colorMult; + } + spriteBatch.Draw(aura, drawStart2 + offsets, auraRec, white * colorMult, projectile.velocity.ToRotation() + MathHelper.PiOver2, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); + } + } + + //Draw the actual projectile CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); - return false; - } + return false; + } public override void Kill(int timeLeft) { diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 6b5283214e..4c8e63b064 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -5,7 +5,9 @@ using CalamityMod.NPCs.Calamitas; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.NormalNPCs; @@ -370,9 +372,19 @@ namespace CalamityMod.UI return; // Do not attempt to create a new bar for an NPC that's already in the list of bars. - bool canAddBar = Main.npc[index].active && Main.npc[index].life > 0 && Bars.All(b => b.NPCIndex != index) && !Main.npc[index].Calamity().ShouldCloseHPBar; + NPC npc = Main.npc[index]; + bool canAddBar = npc.active && npc.life > 0 && Bars.All(b => b.NPCIndex != index) && !npc.Calamity().ShouldCloseHPBar; + + // SPECIAL CASE: Artemis and Apollo should be registered as one boss, as they share HP. + // Apollo is the only NPC to recieve a bar, with a special overriding name. + string overridingName = null; + if (npc.type == NPCType()) + canAddBar = false; + if (npc.type == NPCType()) + overridingName = $"{Artemis.NameToDisplay} and {Apollo.NameToDisplay}"; + if (canAddBar) - Bars.Add(new BossHPUI(index)); + Bars.Add(new BossHPUI(index, overridingName)); } public static void Draw(SpriteBatch sb) @@ -401,6 +413,7 @@ namespace CalamityMod.UI public long PreviousLife; public long HealthAtStartOfCombo; public long InitialMaxLife; + public string OverridingName = null; public NPC AssociatedNPC => Main.npc.IndexInRange(NPCIndex) ? Main.npc[NPCIndex] : null; public int NPCType => AssociatedNPC?.type ?? -1; public long CombinedNPCLife @@ -518,7 +531,7 @@ namespace CalamityMod.UI public static Color MainColor = new Color(229, 189, 62); public static Color MainBorderColour = new Color(197, 127, 46); - public BossHPUI(int index) + public BossHPUI(int index, string overridingName = null) { NPCIndex = index; @@ -532,6 +545,7 @@ namespace CalamityMod.UI IntendedNPCType = AssociatedNPC.type; PreviousLife = CombinedNPCLife; } + OverridingName = overridingName; } public void Update() @@ -607,7 +621,8 @@ namespace CalamityMod.UI CalamityUtils.DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), MainColor, MainBorderColour * 0.25f); // Draw a red back-glow of the text if the NPC is enraged. - string name = AssociatedNPC.FullName; + string name = OverridingName ?? AssociatedNPC.FullName; + Vector2 nameSize = Main.fontMouseText.MeasureString(name); if (EnrageTimer > 0) { diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index c84df23fda..6165a3bed8 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -882,7 +882,7 @@ namespace CalamityMod npc = ModContent.NPCType(); break; case 53: - npc = ModContent.NPCType(); + npc = ModContent.NPCType(); break; case 54: npc = ModContent.NPCType();