From 4144a1de54bc33ad0527cb17b3756a5dfafb4e70 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sun, 25 Apr 2021 07:18:31 -0500 Subject: [PATCH] 1 - Nerfed many On Hit extra projectiles and projectiles that spawn from other projectiles. 2 - Gave Friendly Infernados, Briny Baron typhoons and Monsoon/Alluvion typhoons ID static immunity instead of local immunity. --- CalPlayer/CalamityPlayerOnHit.cs | 57 ++++++++----------- Items/Armor/ForbiddenCirclet.cs | 2 +- .../BrimstoneCragCatches/Shadowfish.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 46 +++++++-------- Projectiles/Magic/InfernadoFriendly.cs | 4 +- Projectiles/Melee/BrinySpout.cs | 8 +-- Projectiles/Ranged/WaterSpout.cs | 6 +- Projectiles/Rogue/DragonShit.cs | 46 ++++++++------- Projectiles/Rogue/JewelSpike.cs | 6 +- Projectiles/Rogue/MoonSigil.cs | 2 +- Projectiles/Typeless/Nanotech.cs | 17 +++--- Projectiles/Typeless/UnstableSpark.cs | 2 +- 12 files changed, 95 insertions(+), 103 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 325ada0eef..9b11c74b4f 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -11,15 +11,12 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; -using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using System.Linq; -using CalamityMod.Items.Weapons.Summon; namespace CalamityMod.CalPlayer { @@ -126,30 +123,32 @@ namespace CalamityMod.CalPlayer //flask of party affects all types of weapons, !proj.melee is to prevent double flask effects if (!proj.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner, 0f, 0f); + Projectile.NewProjectile(position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); if (modPlayer.alchFlask && player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) { - Projectile projectile = CalamityGlobalProjectile.SpawnOrb(proj, (int)(proj.damage * 0.25), ProjectileType(), 400f, 12f); + Projectile projectile = CalamityGlobalProjectile.SpawnOrb(proj, (int)(30 * player.AverageDamage()), ProjectileType(), 400f, 12f); if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile.whoAmI].Calamity().forceTypeless = true; } + if (modPlayer.theBee && player.statLife >= player.statLifeMax2) - { Main.PlaySound(SoundID.Item110, proj.Center); - } + if (modPlayer.reaverDefense) player.lifeRegenTime += 1; + if (npcCheck) { - if (modPlayer.unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 10) + if (modPlayer.unstablePrism && crit && player.ownedProjectileCounts[ProjectileType()] < 5) { for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(proj.damage * 0.15), 0f, player.whoAmI); + Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(15 * player.AverageDamage()), 0f, player.whoAmI); } } + if (modPlayer.astralStarRain && crit && modPlayer.astralStarRainCooldown <= 0) { modPlayer.astralStarRainCooldown = 60; @@ -359,9 +358,9 @@ namespace CalamityMod.CalPlayer } else if (buffType == empowerBuff) { - if (player.ownedProjectileCounts[ProjectileType()] < 5 && Main.rand.NextBool(10)) //at most 5 + if (player.ownedProjectileCounts[ProjectileType()] < 3 && Main.rand.NextBool(10)) { - int damage = (int)(100 * player.MinionDamage()); + int damage = (int)(75 * player.MinionDamage()); Projectile.NewProjectile(proj.position, proj.velocity, ProjectileType(), damage, 1f, player.whoAmI, 0f); } } @@ -417,23 +416,22 @@ namespace CalamityMod.CalPlayer { if (modPlayer.nucleogenesis) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.25), proj.knockBack * 0.25f, proj.owner); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.MinionDamage()), 4f, proj.owner); modPlayer.jellyDmg = 100f; } else if (modPlayer.starbusterCore) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.35), 3.5f, proj.owner); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(40 * player.MinionDamage()), 3.5f, proj.owner); modPlayer.jellyDmg = 60f; } else if (modPlayer.nuclearRod) { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.25), 0f, proj.owner); + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(20 * player.MinionDamage()), 0f, proj.owner); modPlayer.jellyDmg = 60f; } else if (modPlayer.jellyChargedBattery) { - int projDamage = (int)(proj.damage * 0.3); - CalamityGlobalProjectile.SpawnOrb(proj, projDamage, ProjectileType(), 800f, 15f); + CalamityGlobalProjectile.SpawnOrb(proj, (int)(15 * player.MinionDamage()), ProjectileType(), 800f, 15f); modPlayer.jellyDmg = 60f; } } @@ -445,7 +443,7 @@ namespace CalamityMod.CalPlayer modPlayer.hallowedRuneCooldown = 180; Vector2 spawnPosition = position - new Vector2(0f, 920f).RotatedByRandom(0.3f); float speed = Main.rand.NextFloat(17f, 23f); - Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), proj.damage / 3, 3f, proj.owner); + Projectile.NewProjectile(spawnPosition, Vector2.Normalize(position - spawnPosition) * speed, ProjectileType(), (int)(30 * player.MinionDamage()), 3f, proj.owner); } } } @@ -455,7 +453,7 @@ namespace CalamityMod.CalPlayer #region Rogue private static void RogueOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) { - if (modProj.stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 2) + if (modProj.stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 1) { int projTileX = (int)(proj.Center.X / 16f); int projTileY = (int)(proj.Center.Y / 16f); @@ -485,7 +483,7 @@ namespace CalamityMod.CalPlayer break; } } - int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), 840, 15f, Main.myPlayer, 16f, 16f); + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(400 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); if (projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().forceRogue = true; @@ -540,8 +538,7 @@ namespace CalamityMod.CalPlayer float speedX = (position.X - source.X) / 30f; float speedY = (position.Y - source.Y) * 8; Vector2 velocity = new Vector2(speedX, speedY); - int dmg = (int)(15 + (proj.damage * 0.05f)); - int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), dmg, 3f, proj.owner); + int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(15 * player.RogueDamage()), 3f, proj.owner); if (feather.WithinBounds(Main.maxProjectiles)) Main.projectile[feather].Calamity().forceRogue = true; modPlayer.featherCrownCooldown = 15; @@ -554,8 +551,7 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 10f; - int dmg = (int)(150 + (proj.damage * 0.05f)); - int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, dmg, 3, proj.owner); + int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, (int)(60 * player.RogueDamage()), 3, proj.owner); if (flare.WithinBounds(Main.maxProjectiles)) Main.projectile[flare].Calamity().forceRogue = true; modPlayer.moonCrownCooldown = 15; @@ -568,8 +564,7 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 40f; - int dmg = (int)(1000 + (proj.damage * 0.05f)); - int flare = Projectile.NewProjectile(source, velocity, ProjectileType(),dmg, 3f, proj.owner); + int flare = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(120 * player.RogueDamage()), 3f, proj.owner); if (flare.WithinBounds(Main.maxProjectiles)) Main.projectile[flare].Calamity().rogue = true; modPlayer.nanoFlareCooldown = 15; @@ -584,16 +579,14 @@ namespace CalamityMod.CalPlayer float yVector = Main.rand.Next(-35, 36) * 0.02f; xVector *= 10f; yVector *= 10f; - int dmg = (int)(75 + (proj.damage * 0.05f)); - Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), dmg, proj.knockBack, proj.owner, 0f, 0f); + Projectile.NewProjectile(proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), (int)(40 * player.RogueDamage()), proj.knockBack, proj.owner); modPlayer.forbiddenCooldown = 15; } } if (modPlayer.titanHeartSet && modProj.stealthStrike && modPlayer.titanCooldown <= 0 && modProj.stealthStrikeHitCount < 5) { - int dmg = (int)(100 + (proj.damage * 0.01f)); - int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), dmg, proj.knockBack, proj.owner, 1f, 0f); + int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(50 * player.RogueDamage()), proj.knockBack, proj.owner, 1f, 0f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceRogue = true; Main.PlaySound(SoundID.Item14, proj.Center); @@ -631,7 +624,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { float speed = Main.rand.NextFloat(5f, 11f); - Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(proj.damage * 0.3), proj.knockBack, player.whoAmI); + Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(35 * player.RogueDamage()), proj.knockBack, player.whoAmI); } } } @@ -681,6 +674,7 @@ namespace CalamityMod.CalPlayer modPlayer.shadowPotCooldown = 30; } } + if (npcCheck) { if (modPlayer.umbraphileSet && (Main.rand.NextBool(4) || (modProj.stealthStrike && modProj.stealthStrikeHitCount < 5)) && proj.type != ProjectileType()) @@ -697,7 +691,7 @@ namespace CalamityMod.CalPlayer for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(proj.damage * 0.1), 0f, player.whoAmI); + int spark = Projectile.NewProjectile(position, velocity, ProjectileType(), (int)(20 * player.RogueDamage()), 0f, player.whoAmI); if (spark.WithinBounds(Main.maxProjectiles)) { Main.projectile[spark].Calamity().forceRogue = true; @@ -1332,7 +1326,6 @@ namespace CalamityMod.CalPlayer } #endregion - #region The Horseman's Blade public static void HorsemansBladeOnHit(Player player, int targetIdx, int damage, float knockback, int extraUpdateAmt = 0, int type = ProjectileID.FlamingJack) { diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index 38efa77607..96746a47d9 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.defense = 1; //21 + item.defense = 1; // This item has the same rarity and sell price as Forbidden Mask item.value = Item.buyPrice(gold: 25); item.rare = ItemRarityID.Pink; diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index c95f79f559..5d225b7aac 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shadowfish"); //Future potion ingredient + DisplayName.SetDefault("Shadowfish"); Tooltip.SetDefault("Darkness spreads"); } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index d16fe27fd7..b8f1682d9f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1195,7 +1195,7 @@ namespace CalamityMod.Projectiles { if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 30) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 15) { //Note: these don't count as true melee anymore but its useful code to keep around if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || @@ -1212,13 +1212,11 @@ namespace CalamityMod.Projectiles } vector24 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; Vector2 newCenter = player.RotatedRelativePoint(player.position + vector24, true) + projectile.velocity; - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, - (int)(projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(newCenter, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); } else { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.Mushroom, - (int)(projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); } } } @@ -1230,32 +1228,31 @@ namespace CalamityMod.Projectiles { if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 25) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.15), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.RogueDamage()), 0f, projectile.owner); } } } - // Moon Crown gets overridden by Nanotech else if (modPlayer.moonCrown && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { - if (Main.player[projectile.owner].miscCounter % 300 == 0 && projectile.FinalExtraUpdate()) + if (Main.player[projectile.owner].miscCounter % 120 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 15) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.2), 0, projectile.owner); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(45 * player.RogueDamage()), 0f, projectile.owner); } } } + if (modPlayer.dragonScales && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { if (Main.player[projectile.owner].miscCounter % 50 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 15) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - // Spawn a dust that does 1/5th of the original damage Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), - (int)(projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); + (int)(80 * player.RogueDamage()), 0f, projectile.owner); } } } @@ -1276,7 +1273,8 @@ namespace CalamityMod.Projectiles } } } - //will always be friendly and rogue if it has this boost + + // Will always be friendly and rogue if it has this boost if (modPlayer.momentumCapacitor && momentumCapacitatorBoost) { if (projectile.velocity.Length() < 26f) @@ -1637,39 +1635,37 @@ namespace CalamityMod.Projectiles #region Kill public override void Kill(Projectile projectile, int timeLeft) { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) { if (rogue) { - if (modPlayer.etherealExtorter && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 10) + if (modPlayer.etherealExtorter && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) { for (int i = 0; i < 2; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int soul = Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), (int)(projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); + int soul = Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), (int)(25 * player.RogueDamage()), 0f, projectile.owner); Main.projectile[soul].tileCollide = false; } } + if (modPlayer.scuttlersJewel && CalamityLists.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) { - int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.35), projectile.knockBack, projectile.owner); + int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(15 * player.RogueDamage()), projectile.knockBack, projectile.owner); Main.projectile[spike].frame = 4; } } if (projectile.type == ProjectileID.UnholyWater) - { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); - } + if (projectile.type == ProjectileID.BloodWater) - { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); - } + if (projectile.type == ProjectileID.HolyWater) - { Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); - } } } #endregion diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index 440c8aa038..8118335fa3 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 500; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; projectile.magic = true; } diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index 16efbae42e..4db7e562e6 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 2; projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } + projectile.timeLeft = 90; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 8; + } public override void AI() { diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 2e56efabf7..40327e0c42 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -25,9 +25,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 837bcfe9d7..0bdd8d8301 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Rogue { public NPC target; public Vector2 rotationVector = Vector2.UnitY * -13f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -20,8 +21,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { projectile.width = 64; - projectile.height = 66; - projectile.scale = 1f; + projectile.height = 64; projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; @@ -30,7 +30,9 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 380 && target.CanBeChasedBy(projectile); + + public override void AI() { target = projectile.Center.ClosestNPCAt(1200f); if (projectile.localAI[0] == 0f) @@ -38,6 +40,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f); projectile.localAI[0] = 1f; } + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -45,22 +48,23 @@ namespace CalamityMod.Projectiles.Rogue projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) - { projectile.frame = 0; - } - if (projectile.timeLeft >= 380) - { - projectile.velocity *= 1.07f; - } - else if (target != null) - projectile.velocity = (projectile.velocity * 23f + projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; - else - { - projectile.timeLeft = Math.Min(projectile.timeLeft, 15); - projectile.alpha += 17; - projectile.velocity = rotationVector; - rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * projectile.ai[0])); - } + + if (projectile.timeLeft >= 380) + { + projectile.velocity *= 1.07f; + } + else if (target != null) + { + projectile.velocity = (projectile.velocity * 23f + projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f; + } + else + { + projectile.timeLeft = Math.Min(projectile.timeLeft, 15); + projectile.alpha += 17; + projectile.velocity = rotationVector; + rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * projectile.ai[0])); + } } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); @@ -73,6 +77,7 @@ namespace CalamityMod.Projectiles.Rogue Main.spriteBatch.Draw(projectileTexture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), projectile.scale, SpriteEffects.None, 0f); return false; } + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.Center); @@ -84,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(2)) { Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int d = 0; d < 8; d++) @@ -96,9 +101,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[idx].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); } } } diff --git a/Projectiles/Rogue/JewelSpike.cs b/Projectiles/Rogue/JewelSpike.cs index 166511b516..735ccea2e0 100644 --- a/Projectiles/Rogue/JewelSpike.cs +++ b/Projectiles/Rogue/JewelSpike.cs @@ -27,21 +27,21 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.velocity *= 0f; + if (Main.rand.NextBool(5) && projectile.frame < 3) { int crystalDust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 87, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); Main.dust[crystalDust].noGravity = true; } + projectile.frameCounter++; if (projectile.frameCounter > 4 && projectile.frame > 0) { projectile.frame--; projectile.frameCounter = 0; } - if (projectile.frame < 0) //just in case - { + if (projectile.frame < 0) projectile.frame = 0; - } } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs index af64e67075..2c21e0511a 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 20; projectile.friendly = true; projectile.alpha = 0; - projectile.penetrate = 10; + projectile.penetrate = 2; projectile.ignoreWater = true; projectile.timeLeft = 250; projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 27f448d64b..6eaf3e2a09 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; @@ -22,20 +21,20 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = 1; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.ai[1] >= 30f && target.CanBeChasedBy(projectile); + + public override void AI() { Lighting.AddLight(projectile.Center, new Vector3(0.075f, 0.4f, 0.15f)); + projectile.rotation += projectile.velocity.X * 0.2f; if (projectile.velocity.X > 0f) - { projectile.rotation += 0.08f; - } else - { projectile.rotation -= 0.08f; - } + projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) + if (projectile.ai[1] > 60f) { projectile.alpha += 5; if (projectile.alpha >= 255) @@ -45,7 +44,9 @@ namespace CalamityMod.Projectiles.Typeless return; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + + if (projectile.ai[1] >= 30f) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Typeless/UnstableSpark.cs b/Projectiles/Typeless/UnstableSpark.cs index 702b4bcf6b..5b45274991 100644 --- a/Projectiles/Typeless/UnstableSpark.cs +++ b/Projectiles/Typeless/UnstableSpark.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.height = 12; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 120; + projectile.timeLeft = 90; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; }