diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 30c27d6f7b..9a23ce5126 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -41,6 +41,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Environment; +using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; @@ -136,10 +137,11 @@ namespace CalamityMod.CalPlayer public int itemTypeLastReforged = 0; public int reforgeTierSafety = 0; public int defenseDamage = 0; - #endregion + public float rangedAmmoCost = 1f; + #endregion - #region Tile Entity Trackers - public int CurrentlyViewedFactoryID = -1; + #region Tile Entity Trackers + public int CurrentlyViewedFactoryID = -1; public int CurrentlyViewedChargerID = -1; public int CurrentlyViewedHologramID = -1; public string CurrentlyViewedHologramText; @@ -246,7 +248,6 @@ namespace CalamityMod.CalPlayer public int auralisAuroraCooldown = 0; public int auralisAurora = 0; public int fungalSymbioteTimer = 0; - public bool canFireReaverRangedProjectile = false; public bool canFireAtaxiaRangedProjectile = false; public bool canFireAtaxiaRogueProjectile = false; public bool canFireGodSlayerRangedProjectile = false; @@ -589,12 +590,10 @@ namespace CalamityMod.CalPlayer public bool hasJetpack = false; public int jetPackCooldown = 0; public bool plaguedFuelPack = false; - public int plaguedFuelPackDash = 0; - public int plaguedFuelPackDirection = 0; public bool blunderBooster = false; - public int blunderBoosterDash = 0; - public int blunderBoosterDirection = 0; - public bool veneratedLocket = false; + public int jetPackDash = 0; + public int jetPackDirection = 0; + public bool veneratedLocket = false; public bool camper = false; public bool corrosiveSpine = false; public bool miniOldDuke = false; @@ -677,8 +676,6 @@ namespace CalamityMod.CalPlayer public bool brimflameFrenzy = false; public bool brimflameFrenzyCooldown = false; public int brimflameFrenzyTimer = 0; - public bool reaverSpore = false; - public bool reaverDoubleTap = false; public bool flamethrowerBoost = false; public bool hoverboardBoost = false; //hoverboard + shroomite visage public bool shadeRegen = false; @@ -693,9 +690,12 @@ namespace CalamityMod.CalPlayer public bool titanHeartBoots = false; public int titanCooldown = 0; public bool umbraphileSet = false; - public bool reaverBlast = false; - public bool reaverBurst = false; - public bool fathomSwarmer = false; + public bool reaverSpeed = false; + public bool reaverRegen = false; + public int reaverRegenCooldown = 0; + public bool reaverDefense = false; + public bool reaverExplore = false; + public bool fathomSwarmer = false; public bool fathomSwarmerVisage = false; public bool fathomSwarmerBreastplate = false; public bool fathomSwarmerTail = false; @@ -740,7 +740,6 @@ namespace CalamityMod.CalPlayer public bool fearmongerSet = false; public int fearmongerRegenFrames = 0; public bool daedalusCrystal = false; - public bool reaverOrb = false; public bool chaosSpirit = false; public bool redDevil = false; #endregion @@ -877,10 +876,11 @@ namespace CalamityMod.CalPlayer public bool hallowedPower = false; public bool hallowedRegen = false; public bool kamiBoost = false; - #endregion + public bool avertorBonus = false; + #endregion - #region Minion - public bool wDroid = false; + #region Minion + public bool wDroid = false; public bool resButterfly = false; public bool glSword = false; public bool mWorm = false; @@ -1680,12 +1680,16 @@ namespace CalamityMod.CalPlayer brimflameFrenzy = false; brimflameFrenzyCooldown = false; - reaverSpore = false; - reaverDoubleTap = false; - reaverBlast = false; - reaverBurst = false; + rangedAmmoCost = 1f; - ironBoots = false; + avertorBonus = false; + + reaverRegen = false; + reaverSpeed = false; + reaverDefense = false; + reaverExplore = false; + + ironBoots = false; depthCharm = false; anechoicPlating = false; jellyfishNecklace = false; @@ -1976,7 +1980,6 @@ namespace CalamityMod.CalPlayer slimeGod = false; urchin = false; chaosSpirit = false; - reaverOrb = false; daedalusCrystal = false; shellfish = false; hCrab = false; @@ -2100,11 +2103,9 @@ namespace CalamityMod.CalPlayer polarisBoostCounter = 0; spectralVeilImmunity = 0; jetPackCooldown = 0; - blunderBoosterDash = 0; - blunderBoosterDirection = 0; - plaguedFuelPackDash = 0; - plaguedFuelPackDirection = 0; - andromedaCripple = 0; + jetPackDash = 0; + jetPackDirection = 0; + andromedaCripple = 0; theBeeCooldown = 0; killSpikyBalls = false; moonCrownCooldown = 0; @@ -2296,10 +2297,12 @@ namespace CalamityMod.CalPlayer healCounter = 300; danceOfLightCharge = 0; bloodPactBoost = false; - #endregion + rangedAmmoCost = 1f; + avertorBonus = false; + #endregion - #region Armorbonuses - flamethrowerBoost = false; + #region Armorbonuses + flamethrowerBoost = false; hoverboardBoost = false; //hoverboard + shroomite visage shadowSpeed = false; godSlayer = false; @@ -2333,9 +2336,12 @@ namespace CalamityMod.CalPlayer brimflameFrenzy = false; brimflameFrenzyCooldown = false; brimflameFrenzyTimer = 0; - reaverSpore = false; - reaverDoubleTap = false; - shadeRegen = false; + reaverSpeed = false; + reaverRegen = false; + reaverRegenCooldown = 0; + reaverDefense = false; + reaverExplore = false; + shadeRegen = false; dsSetBonus = false; titanHeartSet = false; titanHeartMask = false; @@ -2343,8 +2349,6 @@ namespace CalamityMod.CalPlayer titanHeartBoots = false; titanCooldown = 0; umbraphileSet = false; - reaverBlast = false; - reaverBurst = false; fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; @@ -2840,24 +2844,12 @@ namespace CalamityMod.CalPlayer if (CalamityMod.PlaguePackHotKey.JustPressed && hasJetpack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && jetPackCooldown == 0 && !player.mount.Active) { - if (blunderBooster) - { - jetPackCooldown = 90; - blunderBoosterDash = 15; - blunderBoosterDirection = player.direction; - rogueStealth -= rogueStealthMax * 0.25f; - Main.PlaySound(SoundID.Item66, player.Center); - Main.PlaySound(SoundID.Item34, player.Center); - } - else if (plaguedFuelPack) - { - jetPackCooldown = 90; - plaguedFuelPackDash = 10; - plaguedFuelPackDirection = player.direction; - rogueStealth -= rogueStealthMax * 0.25f; - Main.PlaySound(SoundID.Item66, player.Center); - Main.PlaySound(SoundID.Item34, player.Center); - } + jetPackDash = blunderBooster ? 15 : 10; + jetPackDirection = player.direction; + jetPackCooldown = 60; + rogueStealth -= rogueStealthMax * 0.25f; + Main.PlaySound(SoundID.Item66, player.Center); + Main.PlaySound(SoundID.Item34, player.Center); } if (CalamityMod.TarraHotKey.JustPressed) { @@ -3996,10 +3988,112 @@ namespace CalamityMod.CalPlayer } #endregion } - #endregion + #endregion - #region Rogue Mirrors - public void AbyssMirrorEvade() + #region Dodges + private bool HandleDodges() + { + if (player.whoAmI != Main.myPlayer) + return false; + + if (spectralVeil && spectralVeilImmunity > 0) + { + SpectralVeil(); + return true; + } + // Scarf cooldowns affect each other + bool playerDashing = player.pulley || player.grappling[0] == -1 && !player.tongued; + if (playerDashing && dashMod == 1 && player.dashDelay < 0 && dodgeScarf && !scarfCooldown && !eScarfCooldown) + { + OnDodge(); + return true; + } + // Mirror cooldowns affect each other + if (Main.rand.NextBool(10) && player.immuneTime <= 0 && !eclipseMirrorCooldown && !abyssalMirrorCooldown) + { + if (eclipseMirror) + { + EclipseMirrorEvade(); + return true; + } + else if (abyssalMirror) + { + AbyssMirrorEvade(); + return true; + } + } + return false; + } + + private void SpectralVeil() + { + player.immune = true; + player.immuneTime = spectralVeilImmunity; //Set immunity before setting this variable to 0 + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + rogueStealth = rogueStealthMax; + spectralVeilImmunity = 0; + + Vector2 sVeilDustDir = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + sVeilDustDir.Normalize(); + sVeilDustDir *= 0.5f; + + for (int j = 0; j < 20; j++) + { + int sVeilDustIndex1 = Dust.NewDust(player.Center, 1, 1, 21, sVeilDustDir.X * j, sVeilDustDir.Y * j); + int sVeilDustIndex2 = Dust.NewDust(player.Center, 1, 1, 21, -sVeilDustDir.X * j, -sVeilDustDir.Y * j); + Main.dust[sVeilDustIndex1].noGravity = false; + Main.dust[sVeilDustIndex1].noLight = false; + Main.dust[sVeilDustIndex2].noGravity = false; + Main.dust[sVeilDustIndex2].noLight = false; + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); + + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + + private void OnDodge() + { + if (evasionScarf) + { + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(9f)); + player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); + } + else + { + player.AddBuff(ModContent.BuffType(), 540); + player.AddBuff(ModContent.BuffType(), player.chaosState ? 1800 : 900); + } + player.immune = true; + player.immuneTime = player.longInvince ? 100 : 60; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + for (int j = 0; j < 100; j++) + { + int num = Dust.NewDust(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[num]; + dust.position.X += (float)Main.rand.Next(-20, 21); + dust.position.Y += (float)Main.rand.Next(-20, 21); + dust.velocity *= 0.4f; + dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); + if (Main.rand.NextBool(2)) + { + dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + dust.noGravity = true; + } + } + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + #endregion + + #region Rogue Mirrors + public void AbyssMirrorEvade() { if (player.whoAmI == Main.myPlayer && abyssalMirror && !abyssalMirrorCooldown && !eclipseMirror) { @@ -4632,13 +4726,6 @@ namespace CalamityMod.CalPlayer Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 1.25f); } } - if (reaverBlast) - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } if (dsSetBonus) { if (Main.rand.NextBool(3)) @@ -4781,16 +4868,50 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && + player.armor[2].type == ModContent.ItemType()) + { target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); } } - } + if (reaverDefense) + { + player.lifeRegenTime += 1; + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != ModContent.NPCType() && !player.moonLeech) + { + float healMult = 0.2f; + float heal = damage * healMult; + + if (heal > 50) + heal = 50; + if (Main.rand.Next(10) > 0) + heal = 0; + + if ((int)heal > 0 && !Main.player[Main.myPlayer].moonLeech) + { + Main.player[Main.myPlayer].lifeSteal -= heal * 2f; + float lowestHealthCheck = 0f; + int healTarget = player.whoAmI; + for (int i = 0; i < Main.maxPlayers; i++) + { + Player otherPlayer = Main.player[i]; + if (otherPlayer.active && !otherPlayer.dead && ((!player.hostile && !otherPlayer.hostile) || player.team == otherPlayer.team)) + { + float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); + if (playerDist < 1200f && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + { + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + healTarget = i; + } + } + } + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI, healTarget, heal); + } + } + } + } #endregion #region On Hit NPC With Proj @@ -4993,11 +5114,10 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && + player.armor[2].type == ModContent.ItemType()) + { target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); } @@ -5128,11 +5248,10 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && + player.armor[2].type == ModContent.ItemType()) + { target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); } @@ -5335,11 +5454,10 @@ namespace CalamityMod.CalPlayer } if (vexation) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && + player.armor[2].type == ModContent.ItemType()) + { target.AddBuff(BuffID.CursedInferno, 90, false); target.AddBuff(BuffID.Venom, 120, false); } @@ -7895,11 +8013,12 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 240); player.AddBuff(ModContent.BuffType(), 240); } - else if (reaverBlast) - { - player.AddBuff(ModContent.BuffType(), 180); - } - if (fBarrier || (sirenBoobs && NPC.downedBoss3)) + else if (reaverDefense) + { + if (Main.rand.NextBool(4)) + player.AddBuff(ModContent.BuffType(), 180); + } + if (fBarrier || (sirenBoobs && NPC.downedBoss3)) { Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 27); for (int m = 0; m < Main.maxNPCs; m++) @@ -7997,29 +8116,40 @@ namespace CalamityMod.CalPlayer if (!profanedCrystal && pArtifact) player.AddBuff(ModContent.BuffType(), 300, true); - // Bloodflare Core defense shattering. - if (bloodflareCore) - { - // Shattered defense caps at half of total defense. Every hit adds its damage as shattered defense. - bloodflareCoreLostDefense = Math.Min(bloodflareCoreLostDefense + (int)damage, player.statDefense / 2); + // Bloodflare Core defense shattering + if (bloodflareCore) + { + // Shattered defense has a hard cap equal to half of total defense. + // It also has a soft cap determined by a formula so it isn't too powerful at excessively high defense. + int shatterDefenseCap = (int)(1.5D * Math.Pow(player.statDefense, 0.91D) - 0.5D * player.statDefense); + if (shatterDefenseCap > player.statDefense / 2) + shatterDefenseCap = player.statDefense / 2; - // Play a sound and make dust to signify that defense has been shattered. - Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, player.Center); - for (int i = 0; i < 36; ++i) - { - float speed = Main.rand.NextFloat(1.8f, 8f); - Vector2 dustVel = new Vector2(speed, speed); - Dust d = Dust.NewDustDirect(player.position, player.width, player.height, 90); - d.velocity = dustVel; - d.noGravity = true; - d.scale *= Main.rand.NextFloat(1.1f, 1.4f); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); - Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f); - } - } + // Every hit adds its damage as shattered defense. + int newLostDefense = Math.Min(bloodflareCoreLostDefense + (int)damage, shatterDefenseCap); - bool hardMode = Main.hardMode; + // Suddenly reducing your base defense stat does not let you suddenly reduce your shattered defense cap. + // In other words, you can't ever reduce your lost defense by taking another hit. + if (bloodflareCoreLostDefense < newLostDefense) + bloodflareCoreLostDefense = newLostDefense; + + // Play a sound and make dust to signify that defense has been shattered + Main.PlaySound(SoundID.DD2_MonkStaffGroundImpact, player.Center); + for (int i = 0; i < 36; ++i) + { + float speed = Main.rand.NextFloat(1.8f, 8f); + Vector2 dustVel = new Vector2(speed, speed); + Dust d = Dust.NewDustDirect(player.position, player.width, player.height, 90); + d.velocity = dustVel; + d.noGravity = true; + d.scale *= Main.rand.NextFloat(1.1f, 1.4f); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f); + } + } + + bool hardMode = Main.hardMode; if (player.whoAmI == Main.myPlayer) { int iFramesToAdd = 0; @@ -8257,34 +8387,18 @@ namespace CalamityMod.CalPlayer } } } - else if (reaverSpore) - { - if (damage > 0) - { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 1); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int rDamage = (int)(58 * player.RogueDamage()); //Reaver rogue helm - if (player.whoAmI == Main.myPlayer) - { - for (int i = 0; i < 4; i++) - { - float xPos = Main.rand.NextBool(2) ? player.Center.X + 100 : player.Center.X - 100; - Vector2 spawnPos = new Vector2(xPos, player.Center.Y + Main.rand.Next(-100, 101)); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int rspore1 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), rDamage, 2f, player.whoAmI, 0f, 0f); - Main.projectile[rspore1].usesLocalNPCImmunity = true; - Main.projectile[rspore1].localNPCHitCooldown = 60; - int rspore2 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), rDamage, 2f, player.whoAmI, 1f, 0f); - Main.projectile[rspore2].usesLocalNPCImmunity = true; - Main.projectile[rspore2].localNPCHitCooldown = 60; - } - } - } - } - else if (godSlayerDamage) //god slayer melee helm + else if (reaverDefense) //Defense and DR Helm + { + if (damage > 0) + { + int rDamage = (int)(80 * player.AverageDamage()); + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.Center.X, player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), rDamage, 0f, player.whoAmI, 0f, 0f); + } + } + } + else if (godSlayerDamage) //god slayer melee helm { if (damage > 80) { @@ -9467,48 +9581,6 @@ namespace CalamityMod.CalPlayer } } - private void OnDodge() - { - if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown && !eScarfCooldown) - { - if (evasionScarf) - { - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(9f)); - player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); - } - else - { - player.AddBuff(ModContent.BuffType(), 540); - player.AddBuff(ModContent.BuffType(), player.chaosState ? 1800 : 900); - } - player.immune = true; - player.immuneTime = player.longInvince ? 100 : 60; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } - for (int j = 0; j < 100; j++) - { - int num = Dust.NewDust(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num]; - dust.position.X += (float)Main.rand.Next(-20, 21); - dust.position.Y += (float)Main.rand.Next(-20, 21); - dust.velocity *= 0.4f; - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.noGravity = true; - } - } - if (player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); - } - } - } - public void ModHorizontalMovement() { float num = (player.accRunSpeed + player.maxRunSpeed) / 2f; @@ -9877,9 +9949,12 @@ namespace CalamityMod.CalPlayer bool isChannelable = it.channel; bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; - if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) - ConsumeStealthByAttacking(); - } + bool animationCheck = player.itemAnimation == player.itemAnimationMax - 1; + if (it.useAnimation == it.useTime) + animationCheck = player.itemTime == player.itemAnimationMax - 1; + if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon) + ConsumeStealthByAttacking(); + } private void ProvideStealthStatBonuses() { @@ -11422,7 +11497,8 @@ namespace CalamityMod.CalPlayer range *= fishAlert ? 3f : 1f; range *= abyssalMirror ? 0.65f : 1f; range *= eclipseMirror ? 0.3f : 1f; - return range; + range *= reaverExplore ? 0.9f : 1f; + return range; } /// diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 47e64d30d5..e37bd4e615 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -959,10 +959,8 @@ namespace CalamityMod.CalPlayer modPlayer.spectralVeilImmunity--; if (modPlayer.jetPackCooldown > 0) modPlayer.jetPackCooldown--; - if (modPlayer.plaguedFuelPackDash > 0) - modPlayer.plaguedFuelPackDash--; - if (modPlayer.blunderBoosterDash > 0) - modPlayer.blunderBoosterDash--; + if (modPlayer.jetPackDash > 0) + modPlayer.jetPackDash--; if (modPlayer.theBeeCooldown > 0) modPlayer.theBeeCooldown--; if (modPlayer.jellyDmg > 0f) @@ -1029,9 +1027,12 @@ namespace CalamityMod.CalPlayer { modPlayer.canFireGodSlayerRangedProjectile = true; modPlayer.canFireBloodflareRangedProjectile = true; - modPlayer.canFireReaverRangedProjectile = true; modPlayer.canFireAtaxiaRogueProjectile = true; } + if (modPlayer.reaverRegenCooldown < 60 && modPlayer.reaverRegen) + modPlayer.reaverRegenCooldown++; + else + modPlayer.reaverRegenCooldown = 0; if (modPlayer.roverDrive) { if (modPlayer.roverDriveTimer < CalamityUtils.SecondsToFrames(30f)) @@ -1202,6 +1203,9 @@ namespace CalamityMod.CalPlayer if (modPlayer.kamiBoost) player.allDamage += 0.15f; + if (modPlayer.avertorBonus) + player.allDamage += 0.1f; + if (modPlayer.roverDriveTimer < 616) { player.statDefense += 10; @@ -1778,53 +1782,52 @@ namespace CalamityMod.CalPlayer } } - // Plagued Fuel Pack effects - if (modPlayer.plaguedFuelPackDash > 0 && player.whoAmI == Main.myPlayer) + // Plagued Fuel Pack and Blunder Booster effects + if (modPlayer.jetPackDash > 0 && player.whoAmI == Main.myPlayer) { - int velocityMult = modPlayer.plaguedFuelPackDash > 1 ? 25 : 5; - player.velocity = new Vector2(modPlayer.plaguedFuelPackDirection, -1) * velocityMult; + int velocityAmt = modPlayer.blunderBooster ? 35 : 25; + int velocityMult = modPlayer.jetPackDash > 1 ? velocityAmt : 5; + player.velocity = new Vector2(modPlayer.jetPackDirection, -1) * velocityMult; - int numClouds = Main.rand.Next(2, 10); - for (int i = 0; i < numClouds; i++) + if (modPlayer.blunderBooster) { - Vector2 cloudVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - cloudVelocity.Normalize(); - cloudVelocity *= Main.rand.NextFloat(0f, 1f); - int projectile = Projectile.NewProjectile(player.Center, cloudVelocity, ModContent.ProjectileType(), (int)(20 * player.RogueDamage()), 0, player.whoAmI, 0, 0); - Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + int lightningCount = Main.rand.Next(2, 7); + for (int i = 0; i < lightningCount; i++) + { + Vector2 lightningVel = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + lightningVel.Normalize(); + lightningVel *= Main.rand.NextFloat(1f, 2f); + int projectile = Projectile.NewProjectile(player.Center, lightningVel, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0, player.whoAmI, Main.rand.Next(2), 0f); + Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + } + + for (int i = 0; i < 3; i++) + { + int dust = Dust.NewDust(player.Center, 1, 1, 60, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + } } - - for (int i = 0; i < 3; i++) + else if (modPlayer.plaguedFuelPack) { - int dust = Dust.NewDust(player.Center, 1, 1, 89, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - } - } + int numClouds = Main.rand.Next(2, 10); + for (int i = 0; i < numClouds; i++) + { + Vector2 cloudVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); + cloudVelocity.Normalize(); + cloudVelocity *= Main.rand.NextFloat(0f, 1f); + int projectile = Projectile.NewProjectile(player.Center, cloudVelocity, ModContent.ProjectileType(), (int)(20 * player.RogueDamage()), 0, player.whoAmI, 0, 0); + Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + } - // Blunder Booster effects - if (modPlayer.blunderBoosterDash > 0 && player.whoAmI == Main.myPlayer) - { - int velocityMult = modPlayer.blunderBoosterDash > 1 ? 35 : 5; - player.velocity = new Vector2(modPlayer.blunderBoosterDirection, -1) * velocityMult; - - int lightningCount = Main.rand.Next(2, 7); - for (int i = 0; i < lightningCount; i++) - { - Vector2 lightningVel = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - lightningVel.Normalize(); - lightningVel *= Main.rand.NextFloat(1f, 2f); - int projectile = Projectile.NewProjectile(player.Center, lightningVel, ModContent.ProjectileType(), (int)(30 * player.RogueDamage()), 0, player.whoAmI, Main.rand.Next(2), 0f); - Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); - } - - for (int i = 0; i < 3; i++) - { - int dust = Dust.NewDust(player.Center, 1, 1, 60, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; + for (int i = 0; i < 3; i++) + { + int dust = Dust.NewDust(player.Center, 1, 1, 89, player.velocity.X * -0.1f, player.velocity.Y * -0.1f, 100, default, 3.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + } } } @@ -2575,8 +2578,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.rRage) { - player.allDamage += 0.05f; - player.moveSpeed += 0.05f; + player.allDamage += 0.3f; + player.statDefense += 5; } if (modPlayer.xRage) @@ -4102,7 +4105,22 @@ namespace CalamityMod.CalPlayer // Actually apply the defense reduction player.statDefense -= lostDef; - } + } + + if (modPlayer.spectralVeilImmunity > 0) + { + int numDust = 2; + for (int i = 0; i < numDust; i++) + { + int dustIndex = Dust.NewDust(player.position, player.width, player.height, 21, 0f, 0f); + Dust dust = Main.dust[dustIndex]; + dust.position.X += Main.rand.Next(-5, 6); + dust.position.Y += Main.rand.Next(-5, 6); + dust.velocity *= 0.2f; + dust.noGravity = true; + dust.noLight = true; + } + } } #endregion @@ -4181,7 +4199,8 @@ namespace CalamityMod.CalPlayer (player.ammoBox ? 0.8f : 1f) * (player.ammoPotion ? 0.8f : 1f) * (player.ammoCost80 ? 0.8f : 1f) * - (player.ammoCost75 ? 0.75f : 1f)); + (player.ammoCost75 ? 0.75f : 1f) * + modPlayer.rangedAmmoCost); modPlayer.ammoReductionRogue = (int)(modPlayer.throwingAmmoCost * 100); modPlayer.defenseStat = player.statDefense; modPlayer.DRStat = (int)(player.endurance * 100f); diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index c906b0ed37..331c18290b 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Items.Accessories item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; + item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index 8c7818a09c..94a543b078 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("The inside of the cloak is full of teeth...\n" + "TOOLTIP LINE HERE\n" + "Teleportation is disabled while Chaos State is active\n" + - "If you dodge something while invulnerable, you instantly gain full stealth\n" + - "Revengeance drop"); + "If you dodge something while invulnerable, you instantly gain full stealth"); } public override void SetDefaults() @@ -24,6 +23,7 @@ namespace CalamityMod.Items.Accessories item.value = CalamityGlobalItem.Rarity12BuyPrice; item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; + item.expert = true; item.accessory = true; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a24a213217..773c658522 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -353,17 +353,6 @@ namespace CalamityMod.Items } } } - if (modPlayer.reaverDoubleTap && modPlayer.canFireReaverRangedProjectile) - { - if (item.ranged) - { - modPlayer.canFireReaverRangedProjectile = false; - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 1.3, 150), 2f, player.whoAmI); - } - } - } if (modPlayer.victideSet) { if ((item.ranged || item.melee || item.magic || item.thrown || rogue || item.summon) && item.rare < ItemRarityID.Yellow && Main.rand.NextBool(10)) @@ -2938,53 +2927,49 @@ Grants immunity to fire blocks, and temporary immunity to lava"; switch (arg) { case ItemID.WoodenCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 3, 5); - break; + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 3, 5); + break; case ItemID.IronCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - break; + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 8); + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 8); + break; case ItemID.CorruptFishingCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - break; - case ItemID.CrimsonFishingCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - break; + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.15f, 5, 8); + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.15f, 1, 3); + break; case ItemID.HallowedFishingCrate: - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.2f, 5, 10); - DropHelper.DropItemCondition(player, (WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType()), CalamityWorld.downedProvidence, 0.2f, 1, 3); - break; + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.15f, 5, 10); + DropHelper.DropItemCondition(player, (WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType()), CalamityWorld.downedProvidence, 0.1f, 1, 2); + break; case ItemID.DungeonFishingCrate: - DropHelper.DropItemCondition(player, ItemID.Ectoplasm, NPC.downedPlantBoss, 0.3f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.2f, 5, 10); - break; + DropHelper.DropItemCondition(player, ItemID.Ectoplasm, NPC.downedPlantBoss, 0.1f, 1, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedPolterghast, 0.1f, 1, 5); + break; case ItemID.JungleFishingCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(player, ItemID.ChlorophyteBar, (CalamityWorld.downedCalamitas || NPC.downedPlantBoss), 0.25f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedPlantBoss, 0.25f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 3, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.25f, 5, 10); - break; + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.2f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); + DropHelper.DropItemCondition(player, ItemID.ChlorophyteBar, (CalamityWorld.downedCalamitas || NPC.downedPlantBoss), 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedPlantBoss, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 3, 6); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.1f, 1, 3); + break; case ItemID.FloatingIslandFishingCrate: - DropHelper.DropItemCondition(player, ModContent.ItemType(), (CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator), 0.25f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 5, 15); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.1f, 1, 3); - break; + DropHelper.DropItemCondition(player, ModContent.ItemType(), (CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator), 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.1f, 1, 3); + break; } } - if (context == "bossBag") + if (context == "bossBag") { // Give a chance for Laudanum, Stress Pills and Heart of Darkness from every boss bag DropHelper.DropRevBagAccessories(player); @@ -3575,7 +3560,8 @@ Grants immunity to fire blocks, and temporary immunity to lava"; (modPlayer.holyWrath ? 0.05f : 0f) + (modPlayer.profanedRage ? 0.05f : 0f) + (modPlayer.draconicSurge ? 0.1f : 0f) + - (modPlayer.etherealExtorter && modPlayer.ZoneAstral ? 0.05f : 0f) + + (modPlayer.reaverSpeed ? 0.1f : 0f) + + (modPlayer.etherealExtorter && modPlayer.ZoneAstral ? 0.05f : 0f) + modPlayer.moveSpeedStat * 0.005f; // let's try it if (flightSpeedMult > 1.5f) flightSpeedMult = 1.5f; @@ -3599,7 +3585,8 @@ Grants immunity to fire blocks, and temporary immunity to lava"; int itemGrabRangeBoost = 0 + (modPlayer.wallOfFleshLore ? 10 : 0) + (modPlayer.planteraLore ? 20 : 0) + - (modPlayer.polterghastLore ? 30 : 0); + (modPlayer.reaverExplore ? 20 : 0) + + (modPlayer.polterghastLore ? 30 : 0); grabRange += itemGrabRangeBoost; } @@ -3637,10 +3624,12 @@ Grants immunity to fire blocks, and temporary immunity to lava"; if (hasExtraUpdates) Main.projectile[projectile].extraUpdates += 1; } - #endregion + #endregion - #region Consume Additional Ammo - public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) + #region Ammo + public override bool ConsumeAmmo(Item item, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost; + + public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) { bool flag = false; bool canShoot = false; @@ -3705,8 +3694,10 @@ Grants immunity to fire blocks, and temporary immunity to lava"; dontConsumeAmmo = true; if (player.ammoCost75 && Main.rand.NextBool(4)) dontConsumeAmmo = true; + if (Main.rand.NextFloat() > player.Calamity().rangedAmmoCost) + dontConsumeAmmo = true; - if (!dontConsumeAmmo && itemAmmo.consumable) + if (!dontConsumeAmmo && itemAmmo.consumable) { itemAmmo.stack -= ammoConsumed; if (itemAmmo.stack <= 0) @@ -3870,8 +3861,11 @@ Grants immunity to fire blocks, and temporary immunity to lava"; prefix = Main.rand.Next(22, 25); break; case 6: - // Legendary = 25 - prefix = 25; + // Legendary = 25, Light = 6 ~We are tool friendly (= + if (item.pick > 0 || item.axe > 0 || item.hammer > 0) + prefix = Main.rand.NextBool() ? 25 : 6; + else + prefix = 25; break; } switch (prefix) @@ -4353,10 +4347,13 @@ Grants immunity to fire blocks, and temporary immunity to lava"; prefix = 6; break; case 5: - case 6: // Mystic = 7 prefix = 7; break; + case 6: + // Demonic = 8 + prefix = 8; + break; } switch (prefix) { @@ -4383,6 +4380,9 @@ Grants immunity to fire blocks, and temporary immunity to lava"; case 7: prefix = PrefixID.Mystic; break; + case 8: + prefix = PrefixID.Demonic; + break; } } // All other summon weapons diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 4c29a8d8a8..86e5c1b0c9 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -25,14 +25,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item36; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item36; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 24f; item.useAmmo = AmmoID.Bullet; - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 7917b44dd5..0781e6ebdb 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -29,14 +29,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item36; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.UseSound = SoundID.Item36; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; // wait why item.shootSpeed = 28f; item.useAmmo = AmmoID.Bullet; - item.Calamity().customRarity = CalamityRarity.Violet; } public override Vector2? HoldoutOffset()