diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 95c36128d3..dd1287868f 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -67,7 +67,7 @@ namespace CalamityMod.CalPlayer CalamityPlayer.areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player); // If any boss NPC is active, apply Zen to the player to reduce spawn rate - if (CalamityPlayer.areThereAnyDamnBosses) + if (CalamityPlayer.areThereAnyDamnBosses && CalamityConfig.Instance.BossZen) { if (player.whoAmI == Main.myPlayer) player.AddBuff(ModContent.BuffType(), 2, false); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 262ef9fe74..daa15f27c8 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -100,8 +100,8 @@ namespace CalamityMod.Items #region SetDefaults public override void SetDefaults(Item item) { - if (customRarity.IsPostML() && item.rare != ItemRarityID.Red) - item.rare = ItemRarityID.Red; + if (customRarity.IsPostML() && item.rare != ItemRarityID.Purple) + item.rare = ItemRarityID.Purple; if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite || item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb) diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index e5f996bf2e..328751b216 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 63; + item.damage = 49; item.ranged = true; item.width = 34; item.height = 100; diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index 0b8ac1d413..1c8196c2f1 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 98; + item.damage = 86; item.ranged = true; item.noMelee = true; item.width = 46; diff --git a/Items/Weapons/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index b2b3d6063c..40f56b9850 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CelestialReaper : RogueWeapon { - public const int BaseDamage = 147; + public const int BaseDamage = 133; public override void SetStaticDefaults() { DisplayName.SetDefault("Celestial Reaper"); diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 7f3cff013c..e57ab79416 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,5 +1,5 @@ -using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Tactical Plague Engine"); Tooltip.SetDefault("Summons a plague jet to pummel your enemies into submission\n" + - "Consumes bullets\n" + + "Jets will fire ammo from your inventory, 66% chance to not consume ammo\n" + "Sometimes shoots a missile instead of a bullet"); } public override void SetDefaults() { - item.damage = 34; + item.damage = 52; item.mana = 10; item.width = 28; item.height = 20; @@ -39,9 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse != 2) - { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - } return false; } diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index b65237fe32..9253d9304b 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -203,10 +203,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Projectile laser = Projectile.NewProjectileDirect(projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness), projectile.DirectionTo(npc.Center) * 4f, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner); - laser.timeLeft *= 2; - laser.tileCollide = false; - laser.netUpdate = true; - laser.Calamity().forceMinion = true; + if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) + { + laser.timeLeft *= 2; + laser.tileCollide = false; + laser.netUpdate = true; + laser.Calamity().forceMinion = true; + } } projectile.ai[1]++; OldCenter = projectile.Center; diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index 9b80c993a3..96aa569f8a 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -65,12 +65,12 @@ namespace CalamityMod.Projectiles.Ranged // Adds 2 frames to lifeRegenTime on every hit. This increased value is used for the damage calculation. owner.lifeRegenTime += 2; - // Deals (1.00 + (0.1 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit. + // Deals (1.00 + (0.05 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit. // For example, at 0 life regen, you get 1% of lifeRegenTime as bonus damage. // At 10 life regen, you get 2%. At 20 life regen, you get 3%. // Negative life regen does not decrease damage. int regenForCalc = owner.lifeRegen > 0 ? owner.lifeRegen : 0; - float regenDamageRatio = 0.01f + 0.001f * regenForCalc; + float regenDamageRatio = 0.01f + 0.0005f * regenForCalc; // For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla. int regenTimeForCalc = (int)MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f); diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index 1f89300716..0d4147c176 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged float kback = player.ActiveItem().knockBack; if (canShoot) { - player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback, false); + player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback); kback = player.GetWeaponKnockback(player.ActiveItem(), kback); float speed = player.ActiveItem().shootSpeed * projectile.scale; Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index fb8a9e01f4..ebe12c499e 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -102,7 +102,8 @@ namespace CalamityMod.Projectiles.Summon if (dealDamage) { Projectile aura = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), dmg, 0f, projectile.owner, l); - aura.Calamity().forceMinion = true; + if (aura.whoAmI.WithinBounds(Main.maxProjectiles)) + aura.Calamity().forceMinion = true; } } } diff --git a/Projectiles/Summon/PlateProjectile.cs b/Projectiles/Summon/PlateProjectile.cs index cbdac97176..27f4332fd2 100644 --- a/Projectiles/Summon/PlateProjectile.cs +++ b/Projectiles/Summon/PlateProjectile.cs @@ -51,8 +51,8 @@ namespace CalamityMod.Projectiles.Summon float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; int shard = Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); - Main.projectile[shard].Calamity().forceMinion = true; - ProjectileID.Sets.MinionShot[Main.projectile[shard].type] = true; + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceMinion = true; } } } diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 905d11af2a..7feaab6fe9 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= 8f; int proj = Projectile.NewProjectile(projectile.Center + outerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); - if (proj != -1) + if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; if (innerSplits > 0) //only runs if there's still inner splits to create { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= 5f; proj = Projectile.NewProjectile(projectile.Center + innerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); - if (proj != -1) + if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; } innerSplits--; @@ -627,7 +627,8 @@ namespace CalamityMod.Projectiles.Summon correctedVelocity.Normalize(); correctedVelocity *= 25f; int proj = Projectile.NewProjectile(pos, correctedVelocity, ModContent.ProjectileType(), (int)((double)projectile.damage * 1.5f), projectile.knockBack, projectile.owner, 2); - Main.projectile[proj].Calamity().forceMinion = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; ((ProfanedCrystalRangedHuges)Main.projectile[proj].modProjectile).boomerSwarm = true; } } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 1f1b922daa..9718915629 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -132,7 +132,8 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= shootSpeed; int beam = Projectile.NewProjectile(source, velocity, ProjectileID.HeatRay, projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[beam].Calamity().forceMinion = true; + if (beam.WithinBounds(Main.maxProjectiles)) + Main.projectile[beam].Calamity().forceMinion = true; projectile.ai[0] = 50f; } } diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index ca4f622fbf..b691a22377 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -263,12 +263,15 @@ namespace CalamityMod.Projectiles.Summon { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[spark].Calamity().forceMinion = true; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; + if (spark.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark].Calamity().forceMinion = true; + Main.projectile[spark].timeLeft = 120; + Main.projectile[spark].penetrate = 3; + Main.projectile[spark].usesIDStaticNPCImmunity = true; + Main.projectile[spark].idStaticNPCHitCooldown = 10; + Main.projectile[spark].usesLocalNPCImmunity = false; + } } sparkCounter = 0; } @@ -507,12 +510,15 @@ namespace CalamityMod.Projectiles.Summon { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[spark].Calamity().forceMinion = true; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; + if (spark.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark].Calamity().forceMinion = true; + Main.projectile[spark].timeLeft = 120; + Main.projectile[spark].penetrate = 3; + Main.projectile[spark].usesIDStaticNPCImmunity = true; + Main.projectile[spark].idStaticNPCHitCooldown = 10; + Main.projectile[spark].usesLocalNPCImmunity = false; + } } sparkCounter = 0; } diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 2cbb99efcf..f7f7155084 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -1,13 +1,12 @@ using CalamityMod.Buffs.Summon; -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; namespace CalamityMod.Projectiles.Summon { @@ -38,6 +37,17 @@ namespace CalamityMod.Projectiles.Summon projectile.extraUpdates = 1; } + // Defines an Item which is a hacked clone of a P90, edited to be summon class instead of ranged. + // The false gun's damage is changed to the appropriate value every time a Tactical Plague Jet wants to fire a bullet. + private static void DefineFalseGun() + { + int p90ID = ModContent.ItemType(); + FalseGun = new Item(); + FalseGun.SetDefaults(p90ID, true); + FalseGun.ranged = false; + FalseGun.summon = true; + } + public override bool CanDamage() => false; public override void AI() @@ -60,9 +70,9 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; } - // Grab a fake gun, if not defined, with which to fire bullets. This should only need to be defined once. + // Construct a fake item to use with vanilla code for the sake of firing bullets. if (FalseGun is null) - FalseGun = ItemLoader.GetItem(ModContent.ItemType()).item; + DefineFalseGun(); projectile.localAI[0] = 1f; } @@ -157,37 +167,37 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0]++ % 75f == 24f) { - int damage = projectile.damage; + int projID = ProjectileID.Bullet; + float shootSpeed = FalseGun.shootSpeed; + bool canShoot = true; + int damage = FalseGun.damage = projectile.damage; + float kb = projectile.knockBack; + bool shootRocket = ++projectile.ai[1] % 20f == 0f; + // Rockets never consume ammo. + bool dontConsumeAmmo = Main.rand.NextBool() || shootRocket; + int projIndex; - // One in every 20 shots is a rocket for 1.5x damage. Rockets never consume ammo. - if (projectile.ai[1]++ % 20f == 0f) + // Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item". + player.PickAmmo(FalseGun, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, dontConsumeAmmo); + + // One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback. + if (shootRocket) { int rocketDamage = (int)(damage * 1.5f); - float rocketKB = 5f; - int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), + float rocketKB = kb + 5f; + projIndex = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), rocketDamage, rocketKB, projectile.owner); - Main.projectile[idx].Calamity().forceMinion = true; } - - // All other shots are bullets, fired from a "fake gun". The bullets are consumed from the player's inventory as per normal. else { - int projID = 0; - float shootSpeed = 0f; - bool canShoot = true; - float kb = projectile.knockBack; - player.PickAmmo(FalseGun, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb); - - // Tactical Plague Jets only deal 60% damage with Holy Fire Bullets. There was no other way to nerf them. - if (projID == ModContent.ProjectileType()) - damage = (int)(damage * 0.6f); - - int bullet = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, projID, + // Fire the selected bullet, nothing special. + projIndex = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, projID, damage, kb, projectile.owner); - - if (bullet.WithinBounds(Main.maxProjectiles)) - Main.projectile[bullet].Calamity().forceMinion = true; } + + // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. + if (projIndex.WithinBounds(Main.maxProjectiles)) + Main.projectile[projIndex].Calamity().forceMinion = true; } // Prevent minion clumping while firing.