From 4d0955ee83e4c859d24e9bafd842d2c645f40324 Mon Sep 17 00:00:00 2001 From: Xyk Date: Mon, 4 Nov 2024 19:39:27 -0800 Subject: [PATCH] Combat function polish for RoDel --- CalPlayer/CalamityPlayer.cs | 2 + CalPlayer/CalamityPlayerHitHurt.cs | 24 +++++++ Items/Weapons/Typeless/RelicOfDeliverance.cs | 2 +- ...s.CalamityMod.Items.Weapons.Typeless.hjson | 3 + Particles/FullStar.png | Bin 0 -> 3439 bytes .../Typeless/RelicOfDeliveranceSpear.cs | 68 +++++++++++++++--- 6 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 Particles/FullStar.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c59657485c..2255afa16f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -580,6 +580,7 @@ namespace CalamityMod.CalPlayer public int gSabatonFall = 0; public bool gSabatonFalling = false; public int gSabatonTempJumpSpeed = 0; + public bool rOfDelivarenceRam = false; public bool sGlyph = false; public bool sRegen = false; public bool tracersDust = false; @@ -2422,6 +2423,7 @@ namespace CalamityMod.CalPlayer gSabatonFall = 0; gSabatonFalling = false; gSabatonTempJumpSpeed = 0; + rOfDelivarenceRam = false; astralStarRainCooldown = 0; AbaddonCooldown = 0; VoidCooldown = 0; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index cbe29ccff2..9b01be365b 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1579,6 +1579,30 @@ namespace CalamityMod.CalPlayer } } + if (rOfDelivarenceRam) + { + foreach (NPC n in Main.ActiveNPCs) + { + // Ignore critters with the Guide to Critter Companionship + if (Player.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) + continue; + + if (!n.dontTakeDamage && !n.friendly && n.Calamity().dashImmunityTime[Player.whoAmI] <= 0) + { + Rectangle npcHitbox = n.getRect(); + if ((Player.getRect()).Intersects(npcHitbox) && (n.noTileCollide || Collision.CanHit(Player.position, Player.width, Player.height, n.position, n.width, n.height))) + { + // 17APR2024: Ozzatron: This item gives iframes when passing through enemies for projectile safety. + // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. + n.Calamity().dashImmunityTime[Player.whoAmI] = 4; + Player.GiveUniversalIFrames(InterstellarStompers.PassthroughIFrames, false); + + return true; + } + } + } + } + // If no other effects occurred, run vanilla code return base.FreeDodge(info); } diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 67bae541da..56ef4ee0e1 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Typeless } // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 55; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 91163af6aa..06e70fe1d9 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -33,8 +33,11 @@ RelicOfDeliverance: { Press to grab hold of the spear and steer it Press again to while flying on the spear to drift, slowing your velocity but charging an extremley fast dash released when you let go of If you loose too much velocity before releasing the charge, you will reset to minimum speed + Speed is halved while a boss is alive + You can ram through enemies at the start of charged dashes The spear can take you through walls but will warp you to the last open space if you are inside them too long Holding out the spear heavily reduces the damage of all summons +Press to dismount ''' } diff --git a/Particles/FullStar.png b/Particles/FullStar.png new file mode 100644 index 0000000000000000000000000000000000000000..adb797ae7378e3f6a513b4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%0Dy!50Qvv` z0D$NK0Cg|`0P0`>06Lfe02gqax=}m;000SaNLh0L01FZT01FZU(%pXi0000RbVXQn zQ*UN;cVTj607GSLb9r+hQ*?D?X>TA@Z*OeDr{R1600MhSL_t(oh0WMMO9EjW!13=r zCx@CMC(>XvM00Dnq@vc+5IFV%g0|j3MDzyQ0$)I5(9lvU{#nGeIUK?U5s%O;4)3uc zJk*Lj$v?m4;O_YO@%j6EP67Hj2t`rstEOoPA&^pHnkN1JSE|8v;+#$p0|0;!0>9tS z!@~o+ySud8ZKRa;b0?6g5vr;Z2n4vlzh`f6kJr~%EX$f7LQxci5a_yYw}fFBNGYf4 zlBrw5<#MsQx=N{3A{vd-Xf){cdiL|Vb;tVpI{AE_L?XfS^YeVW13=R>LZJ|qN`*)y zLbKV#G|l-Uyk0LG8ynw+JFaTg>WrfYnO|sc6sZ@%mrzhUt-bUV; z6f!l!=ksxJaKP2o701WN+}_^O>2zj?7zY3ZgF({iG?`3>qoX5kZf;^Z79Nj>!^1=3@%W!f3xxvL*Vnwizw`L`h-FzAhGFM@ zd3pJcs8*{8Ay8Enzu%7#0+-8W*9&g98=ucN@jn|xr_fQ zcQ}R2eHZ-+v5 eColors = new List() { Color.Goldenrod, @@ -87,7 +96,7 @@ namespace CalamityMod.Projectiles.Typeless int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + bColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), powerColor, Utils.Remap(ramLerp, 0.15f, 0.17f, 0.5f, 0, true) * (driftPower == 1 ? 0 : 1)); if (Owner.dead || Owner.Calamity().mouseRight || !WorldGen.InWorld(Owner.Center.ToTileCoordinates().X, Owner.Center.ToTileCoordinates().Y, 20)) // Die if Owner dies or right clicks to exit { @@ -120,7 +129,7 @@ namespace CalamityMod.Projectiles.Typeless Vector2 aimDir = Owner.Calamity().mouseWorld; idealVel = Utils.DirectionTo(Owner.Center, aimDir) * speed * driftPower; - driftPowerScaling = MathHelper.Lerp(driftPowerScaling, driftPower * 0.7f, 0.005f); + driftPowerScaling = MathHelper.Lerp(driftPowerScaling, driftPower * 0.7f, (driftPowerScaling > driftPower * 0.7f) ? 0.005f : 0.04f); if (time == 0) { @@ -129,7 +138,7 @@ namespace CalamityMod.Projectiles.Typeless velY = Projectile.velocity.Y; } - float lerpPower = (drifting ? 0 : (boosted && driftPower > 1) ? 0.01f * Utils.GetLerpValue(120 * driftPower, 0, boostTimer) : 0.02f); + float lerpPower = (drifting ? 0 : (boosted && driftPower > 1) ? 0.01f * ramLerp : 0.02f); velX = MathHelper.Lerp(Projectile.velocity.X, idealVel.X, lerpPower); velY = MathHelper.Lerp(Projectile.velocity.Y, idealVel.Y, lerpPower); @@ -180,6 +189,17 @@ namespace CalamityMod.Projectiles.Typeless } if (!drifting) { + // Iframes for the ram + if (driftPower > 1 && ramLerp < 0.15f && !killed) + { + Owner.Calamity().rOfDelivarenceRam = true; + if (Main.rand.NextBool() || driftPower == 3) + { + Particle spark = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30 + Main.rand.NextVector2Circular(30, 30) * driftPowerScaling, Projectile.velocity * Main.rand.NextFloat(0.2f, 5), "CalamityMod/Particles/FullStar", false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(0.6f, 1.2f), Color.Khaki, new Vector2(2, 1), true, false, 0, false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (driftPower > 2) Projectile.extraUpdates = 5; else @@ -223,8 +243,12 @@ namespace CalamityMod.Projectiles.Typeless } if (driftPower > 1) Owner.Calamity().GeneralScreenShakePower = (driftPower == 2 ? 6 : 9); + else if (driftBadMult > 0.15f) + driftBadMult -= 0.15f; + boostTimer = 120 * driftPower; + Projectile.numHits = 0; } if (boostTimer > 0) boostTimer--; @@ -291,7 +315,10 @@ namespace CalamityMod.Projectiles.Typeless } if (time % Projectile.MaxUpdates == 0) + { respawnTimer++; + Projectile.soundDelay--; + } if (respawnTimer >= 180) { Projectile.Center = respawnPoint; @@ -359,13 +386,14 @@ namespace CalamityMod.Projectiles.Typeless SoundEngine.PlaySound(sound with { Volume = 0.065f * driftPowerScaling, Pitch = Main.rand.NextFloat(-0.4f, -0.9f) + (driftPower == 3 ? 1.4f : 0), MaxInstances = -1 }, Owner.Center); } } - if (time % Projectile.extraUpdates == 0 && digFXCooldown > 0) + if (time % Projectile.MaxUpdates == 0 && digFXCooldown > 0) digFXCooldown--; Owner.Center = Projectile.Center; Owner.velocity = Projectile.velocity * Projectile.MaxUpdates; Owner.dashDelay = 0; Projectile.timeLeft++; + Owner.RemoveAllGrapplingHooks(); Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * (driftPowerScaling + 0.5f)); @@ -400,17 +428,39 @@ namespace CalamityMod.Projectiles.Typeless if (inTiles && respawnPoint != Vector2.Zero) { Projectile.Center = respawnPoint; - Owner.Center = respawnPoint; + if (!Owner.dead) + Owner.Center = respawnPoint; } killed = true; Owner.fullRotationOrigin = Owner.Center - Owner.position; Owner.fullRotation = 0; + Owner.Calamity().rOfDelivarenceRam = false; Projectile.Kill(); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - float damageMult = driftPowerScaling * 1.4f; // Drift power scaling is lower than regular - modifiers.SourceDamage *= damageMult; + float minMult = 0.35f; + int hitsToMinMult = 25; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + float driftMult = (driftPower == 1 ? 0.3f : driftPower == 2 ? 1.7f : 2.5f) * damageMult; // Drift power scaling is lower than regular + modifiers.SourceDamage *= driftMult * ((Projectile.numHits == 0 && driftPower > 1) ? 1.9f : 1); + + if (Projectile.numHits == 0 && driftPower > 1) + { + for (int i = 0; i < 5; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 18, 0.05f * driftPower, Color.Lerp(Color.White, Color.Orange, i * 0.2f) * 0.85f, new Vector2(4 + i * 0.55f, 0.4f + i * 0.1f), true, false, 1f); + GeneralParticleHandler.SpawnParticle(spark); + } + SoundStyle sound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + SoundEngine.PlaySound(sound with { Volume = 1, Pitch = Main.rand.NextFloat(0.2f, 0.4f) * damageMult }, Projectile.Center); + } + if (Projectile.soundDelay <= 0) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderBigHit"); + SoundEngine.PlaySound(sound with { Volume = 1, Pitch = Main.rand.NextFloat(-0.2f, -0.4f) * damageMult }, Projectile.Center); + Projectile.soundDelay = 25; + } } public override bool? CanDamage() => (Projectile.velocity == Vector2.Zero || drifting) ? false : null; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 30 * driftPowerScaling, 60 * driftPowerScaling, targetHitbox);