From 9e06c9633fd3aa4559ea0f75fc257aeb05e80943 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 19 Jan 2022 00:40:57 -0600 Subject: [PATCH] 1 - Ravager free head always targets the same player as the body. 2 - Ravager free head can fire nukes, but at less frequency than the original head. --- NPCs/AquaticScourge/AquaticScourgeHead.cs | 3 +-- NPCs/CalamityAI.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 7 +++++++ NPCs/Ravager/RavagerHead2.cs | 19 ++++++------------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 8ebd83eb58..286e4041c8 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; @@ -89,7 +88,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive) + if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || BossRushEvent.BossRushActive) music = CalamityMod.Instance.GetMusicFromMusicMod("AquaticScourge") ?? MusicID.Boss2; CalamityAI.AquaticScourgeAI(npc, mod, true); diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index e3e25b4a09..7ffa9deabe 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || malice; // Adjust hostility and stats - if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive) + if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || BossRushEvent.BossRushActive) { if (calamityGlobalNPC.newAI[0] == 0f) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6eb1c3f116..71acb918a3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -186,6 +186,11 @@ namespace CalamityMod.NPCs public const int slowingDebuffResistanceMin = 1800; public int debuffResistanceTimer = 0; + // If a boss is affected by knockback and a timer for how long that boss is immune to knockback after being knocked back + public bool bossCanBeKnockedBack = false; + public const int knockbackResistanceMin = 180; + public int knockbackResistanceTimer = 0; + // Debuffs public int vaporfied = 0; public int timeSlow = 0; @@ -3800,6 +3805,8 @@ namespace CalamityMod.NPCs // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; + if (knockbackResistanceTimer > 0) + knockbackResistanceTimer--; if (timeSlow > 0) timeSlow--; diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 5a8968719d..2b3aa7dbbe 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -57,6 +57,8 @@ namespace CalamityMod.NPCs.Ravager return; } + Player player = Main.player[Main.npc[CalamityGlobalNPC.scavenger].target]; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || malice; bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; @@ -64,17 +66,6 @@ namespace CalamityMod.NPCs.Ravager if (npc.timeLeft < 1800) npc.timeLeft = 1800; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Target variable - Player player = Main.player[npc.target]; - // Rotation float num801 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num802 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); @@ -124,8 +115,10 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Item33, npc.position); - Projectile.NewProjectile(npc.Center, Vector2.Normalize(player.Center - npc.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); + Main.PlaySound(SoundID.Item62, npc.position); + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, Vector2.Normalize(player.Center - npc.Center) * projectileVelocity * 0.25f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); } } else