From c81ef743b35fc4f30ca8975c6e308fa785e56070 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sat, 1 Jul 2023 19:26:12 -0600 Subject: [PATCH] - Actually shrunk Dragon Scales' tornado for real by fixing the logic to determine if the projectile comes from Dragon Scales or not, this learning experience will help on the venerated locket branch. - Improved how the tornado spawns to make it more consistent with how The Wand works; makes it less frustrating to test - Fixed a bug were Dragon Scales were hitting way more than intended due to forgetting to set the Local Iframes bool to false, will need rebalancing. --- CalPlayer/CalamityPlayerOnHit.cs | 41 ++++++------------------- Projectiles/CalamityGlobalProjectile.cs | 3 ++ Projectiles/Magic/InfernadoFriendly.cs | 22 ++++++++++--- 3 files changed, 30 insertions(+), 36 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 284963ace1..e05c877d36 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -777,43 +777,20 @@ namespace CalamityMod.CalPlayer var spawnSource = proj.GetSource_FromThis(); if (modProj.stealthStrike && dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 1) { - int projTileX = (int)(proj.Center.X / 16f); - int projTileY = (int)(proj.Center.Y / 16f); - int distance = 100; - if (projTileX < 10) - { - projTileX = 10; - } - if (projTileX > Main.maxTilesX - 10) - { - projTileX = Main.maxTilesX - 10; - } - if (projTileY < 10) - { - projTileY = 10; - } - if (projTileY > Main.maxTilesY - distance - 10) - { - projTileY = Main.maxTilesY - distance - 10; - } - for (int x = projTileX; x < projTileX + distance; x++) - { - Tile tile = Main.tile[projTileX, projTileY]; - if (tile.HasTile && (Main.tileSolid[tile.TileType] || tile.LiquidAmount != 0)) - { - projTileX = x; - break; - } - } - int damage = (int)Player.GetTotalDamage().ApplyTo(180); - int projectileIndex = Projectile.NewProjectile(spawnSource, projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), damage, 15f, Main.myPlayer, 16f, 16f); + + int damage = (int)Player.GetTotalDamage().ApplyTo(200); + int projectileIndex = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, 0f, 0f, ProjectileType(), damage, 15f, Main.myPlayer, 16f, 8f); //First overload seems to deal with timing, second is segment amount if (projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].DamageType = DamageClass.Generic; Main.projectile[projectileIndex].netUpdate = true; + Main.projectile[projectileIndex].usesLocalNPCImmunity = false; Main.projectile[projectileIndex].usesIDStaticNPCImmunity = true; - Main.projectile[projectileIndex].idStaticNPCHitCooldown = 30; - Main.projectile[projectileIndex].scale = Main.projectile[projectileIndex].scale / 3; + Main.projectile[projectileIndex].idStaticNPCHitCooldown = 20; + Main.projectile[projectileIndex].width = 75; + Main.projectile[projectileIndex].height = 14; + Main.projectile[projectileIndex].timeLeft = 200; + Main.projectile[projectileIndex].Calamity().DragonScalesInfernado=true; } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 312d736dcd..b0338f6d26 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -74,6 +74,9 @@ namespace CalamityMod.Projectiles // If true, this projectile creates impact sparks upon hitting enemies public bool deepcoreBullet = false; + // Used to make DragonScales' tornado smaller + public bool DragonScalesInfernado = false; + // Amount of extra updates that are set in SetDefaults. public int defExtraUpdates = -1; diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index cb9d94e78d..0e6769543b 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Magic { public class InfernadoFriendly : ModProjectile, ILocalizedModType { + public new string LocalizationCategory => "Projectiles.Magic"; bool intersectingSomething = false; public override void SetStaticDefaults() @@ -36,10 +37,11 @@ namespace CalamityMod.Projectiles.Magic if (Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) intersectingSomething = true; - float scaleBase = 44f; - float scaleMult = 2.5f; - float baseWidth = 320f; - float baseHeight = 88f; + //Check if the projectile is Wand's or Dragon Scales' + float scaleBase = Main.projectile[Projectile.whoAmI].Calamity().DragonScalesInfernado ? 20f : 44f; + float scaleMult = Main.projectile[Projectile.whoAmI].Calamity().DragonScalesInfernado ? 1.1f : 2.5f; + float baseWidth = Main.projectile[Projectile.whoAmI].Calamity().DragonScalesInfernado ? 80f : 320f; + float baseHeight = Main.projectile[Projectile.whoAmI].Calamity().DragonScalesInfernado ? 44f : 88f; if (Main.rand.NextBool(25)) { @@ -100,6 +102,8 @@ namespace CalamityMod.Projectiles.Magic float num618 = (scaleBase - Projectile.ai[1] + 1f) * scaleMult / scaleBase; center.Y -= baseHeight * num618 / 2f; center.Y += 2f; + if (Main.projectile[Projectile.whoAmI].Calamity().DragonScalesInfernado == true) //More space between segments, due to how the calculations work it had to be painstaikingly adjusted + center.Y -= 16f; Projectile segment = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 10f, Projectile.ai[1] - 1f); // The projectile defaults to magic, but each sub-segment copies the damage class of the previous. @@ -109,6 +113,16 @@ namespace CalamityMod.Projectiles.Magic segment.DamageType = Projectile.DamageType; segment.friendly = Projectile.friendly; segment.hostile = Projectile.hostile; + + //Fuck Dragon Scales mkay + if (Main.projectile[Projectile.whoAmI].Calamity().DragonScalesInfernado == true) + { + Main.projectile[segment.whoAmI].Calamity().DragonScalesInfernado = true; + Main.projectile[segment.whoAmI].usesLocalNPCImmunity = false; + Main.projectile[segment.whoAmI].usesIDStaticNPCImmunity = true; + Main.projectile[segment.whoAmI].idStaticNPCHitCooldown = 20; + Main.projectile[segment.whoAmI].timeLeft = 200; + } } } if (Projectile.ai[0] <= 0f)