From aaa70bf19a951f3ad941bf14f099c3df2b5ae240 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 8 Jun 2021 01:34:03 -0500 Subject: [PATCH] 1 - Immunity to most debuffs during God Slayer dash. 2 - Cannot be killed during God Slayer dash. --- CalPlayer/CalamityPlayer.cs | 310 ++++++++++++------------- CalPlayer/CalamityPlayerLifeRegen.cs | 2 +- CalPlayer/CalamityPlayerMiscEffects.cs | 8 +- CalamityLists.cs | 5 +- Items/Armor/GodSlayerHelm.cs | 3 +- Items/Armor/GodSlayerHelmet.cs | 3 +- Items/Armor/GodSlayerMask.cs | 3 +- 7 files changed, 167 insertions(+), 167 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 77ea6b0e90..29aa2262f3 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4200,6 +4200,14 @@ namespace CalamityMod.CalPlayer return false; } + if (dashMod == 9 && player.dashDelay < 0) + { + if (player.statLife < 1) + player.statLife = 1; + + return false; + } + if (silvaSet && silvaCountdown > 0) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) @@ -7027,7 +7035,7 @@ namespace CalamityMod.CalPlayer if (weakPetrification) WeakPetrification(); - if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet)) + if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && player.dashDelay < 0)) { if (player.lifeRegen < 0) player.lifeRegen = 0; @@ -7982,56 +7990,53 @@ namespace CalamityMod.CalPlayer if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) - { - float num = 300f * player.AverageDamage(); - float num2 = 15f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(135 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(90 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - npc.AddBuff(ModContent.BuffType(), 300); - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - { - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime += 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - player.hurtCooldowns[k] = player.immuneTime; - } - } + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + { + float num = 300f * player.AverageDamage(); + float num2 = 15f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(135 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(90 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + npc.AddBuff(ModContent.BuffType(), 300); + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } } } } @@ -8044,55 +8049,52 @@ namespace CalamityMod.CalPlayer if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) - { - float num = 250f * player.AverageDamage(); - float num2 = 12f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(120 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(80 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - { - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime += 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - player.hurtCooldowns[k] = player.immuneTime; - } - } + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + { + float num = 250f * player.AverageDamage(); + float num2 = 12f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(120 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(80 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } } } } @@ -8105,54 +8107,51 @@ namespace CalamityMod.CalPlayer if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) { Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) - { - float num = 100f * player.AverageDamage(); - float num2 = 9f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - bool isImmune = false; - for (int j = 0; j < player.hurtCooldowns.Length; j++) - { - if (player.hurtCooldowns[j] > 0) - isImmune = true; - } - if (!isImmune) - { - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime += 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - player.hurtCooldowns[k] = player.immuneTime; - } - } + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + { + float num = 100f * player.AverageDamage(); + float num2 = 9f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); + if (npc.immune[player.whoAmI] < 6) + npc.immune[player.whoAmI] = 6; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } } } } @@ -8191,10 +8190,7 @@ namespace CalamityMod.CalPlayer { direction = 1; } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - } + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); if (npc.immune[player.whoAmI] < 6) npc.immune[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 60); @@ -8239,10 +8235,7 @@ namespace CalamityMod.CalPlayer { direction = 1; } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - } + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); if (npc.immune[player.whoAmI] < 6) npc.immune[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 300); @@ -8314,10 +8307,7 @@ namespace CalamityMod.CalPlayer { direction = 1; } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - } + player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); if (npc.immune[player.whoAmI] < 6) npc.immune[player.whoAmI] = 6; npc.AddBuff(ModContent.BuffType(), 600); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 97f2028fc5..00ac66956e 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -583,7 +583,7 @@ namespace CalamityMod.CalPlayer player.mount.Dismount(player); } - if (modPlayer.lol || (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet)) + if (modPlayer.lol || (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) || (modPlayer.dashMod == 9 && player.dashDelay < 0)) { if (player.lifeRegen < 0) player.lifeRegen = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f6b32d2dbd..21e021e214 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1202,13 +1202,19 @@ namespace CalamityMod.CalPlayer if (modPlayer.auralisAuroraCooldown > 0) modPlayer.auralisAuroraCooldown--; + // God Slayer Armor dash debuff immunity + if (modPlayer.dashMod == 9 && player.dashDelay < 0) + { + foreach (int debuff in CalamityLists.debuffList) + player.buffImmune[debuff] = true; + } + // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) { foreach (int debuff in CalamityLists.debuffList) player.buffImmune[debuff] = true; - player.buffImmune[ModContent.BuffType()] = true; modPlayer.silvaCountdown -= 1; if (modPlayer.silvaCountdown <= 0) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); diff --git a/CalamityLists.cs b/CalamityLists.cs index 6910a0a50c..ff5a841a25 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -756,8 +756,9 @@ namespace CalamityMod BuffType(), BuffType(), BuffType(), - BuffType() - }; + BuffType(), + BuffType() + }; fireWeaponList = new List() { diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 725ce9dd13..9e7c91beab 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -41,7 +41,8 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerDamage = true; player.setBonus = "Allows you to dash for an immense distance\n" + "Enemies you dash through take massive damage\n" + - "This dash has a 30 second cooldown\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 30 second cooldown\n" + "Enemies are more likely to target you\n" + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + "Enemies take a lot of damage when they hit you\n" + diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index ddba193d2c..aa53777dca 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -41,7 +41,8 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerRanged = true; player.setBonus = "Allows you to dash for an immense distance\n" + "Enemies you dash through take massive damage\n" + - "This dash has a 30 second cooldown\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 30 second cooldown\n" + "You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds"; if (!modPlayer.godSlayerCooldown) diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 2d7fe7cb48..115ee1cba3 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -43,7 +43,8 @@ namespace CalamityMod.Items.Armor modPlayer.wearingRogueArmor = true; player.setBonus = "Allows you to dash for an immense distance\n" + "Enemies you dash through take massive damage\n" + - "This dash has a 30 second cooldown\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 30 second cooldown\n" + "While at full HP all of your rogue stats are boosted by 10%\n" + "If you take over 80 damage in one hit you will be given extra immunity frames\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" +