From 65989673d85adcada258d68035f01c2f288819d2 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 20 Aug 2021 08:17:21 -0500 Subject: [PATCH] Buffed the Spectral Veil --- CalPlayer/CalamityPlayer.cs | 37 +++++++++++++------------------ Items/Accessories/SpectralVeil.cs | 9 ++++++-- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a164464a0e..02135df11e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2881,34 +2881,27 @@ namespace CalamityMod.CalPlayer { if (!player.chaosState) { - float teleportRange = 320f; Vector2 teleportLocation; - teleportLocation.X = (float)Main.mouseX + Main.screenPosition.X; + teleportLocation.X = Main.mouseX + Main.screenPosition.X; if (player.gravDir == 1f) - { - teleportLocation.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } + teleportLocation.Y = Main.mouseY + Main.screenPosition.Y - player.height; else + teleportLocation.Y = Main.screenPosition.Y + Main.screenHeight - Main.mouseY; + + teleportLocation.X -= player.width * 0.5f; + Vector2 teleportOffset = teleportLocation - player.position; + if (teleportOffset.Length() > SpectralVeil.TeleportRange) { - teleportLocation.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - teleportLocation.X -= (float)(player.width / 2); - Vector2 playerToTeleport = teleportLocation - player.position; - if (playerToTeleport.Length() > teleportRange) - { - playerToTeleport.Normalize(); - playerToTeleport *= teleportRange; - teleportLocation = player.position + playerToTeleport; + teleportOffset = teleportOffset.SafeNormalize(Vector2.Zero) * SpectralVeil.TeleportRange; + teleportLocation = player.position + teleportOffset; } if (teleportLocation.X > 50f && teleportLocation.X < (float)(Main.maxTilesX * 16 - 50) && teleportLocation.Y > 50f && teleportLocation.Y < (float)(Main.maxTilesY * 16 - 50)) { - int x = (int)(teleportLocation.X / 16f); - int y = (int)(teleportLocation.Y / 16f); if (!Collision.SolidCollision(teleportLocation, player.width, player.height)) { rogueStealth -= rogueStealthMax * 0.25f; - player.Teleport(teleportLocation, 1, 0); + player.Teleport(teleportLocation, 1); NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, teleportLocation.X, teleportLocation.Y, 1, 0, 0); int duration = chaosStateDuration; @@ -2921,7 +2914,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(BuffID.ChaosState, duration, true); int numDust = 40; - Vector2 step = playerToTeleport / numDust; + Vector2 step = teleportOffset / numDust; for (int i = 0; i < numDust; i++) { int dustIndex = Dust.NewDust(player.Center - (step * i), 1, 1, 21, step.X, step.Y); @@ -2930,8 +2923,8 @@ namespace CalamityMod.CalPlayer } player.immune = true; - player.immuneTime = 120; - spectralVeilImmunity = 120; + player.immuneTime = 150; + spectralVeilImmunity = 150; for (int k = 0; k < player.hurtCooldowns.Length; k++) player.hurtCooldowns[k] = player.immuneTime; } @@ -4037,7 +4030,7 @@ namespace CalamityMod.CalPlayer if (spectralVeil && spectralVeilImmunity > 0) { - SpectralVeil(); + SpectralVeilDodge(); return true; } @@ -4078,7 +4071,7 @@ namespace CalamityMod.CalPlayer return false; } - private void SpectralVeil() + private void SpectralVeilDodge() { player.immune = true; player.immuneTime = spectralVeilImmunity; //Set immunity before setting this variable to 0 diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index 94a543b078..6bcae63711 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -7,13 +7,16 @@ namespace CalamityMod.Items.Accessories { public class SpectralVeil : ModItem { + public const float TeleportRange = 845f; public override void SetStaticDefaults() { DisplayName.SetDefault("Spectral Veil"); Tooltip.SetDefault("The inside of the cloak is full of teeth...\n" + "TOOLTIP LINE HERE\n" + + "If you dodge something while invulnerable, you instantly gain full stealth\n" + "Teleportation is disabled while Chaos State is active\n" + - "If you dodge something while invulnerable, you instantly gain full stealth"); + "Provides 10% increaed movement speed\n" + + "Stealth generates 20% faster while moving"); } public override void SetDefaults() @@ -34,7 +37,7 @@ namespace CalamityMod.Items.Accessories { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a short range teleport and render you momentarily invulnerable"; + line2.text = "Press " + hotkey + " to consume 25% of your maximum stealth to perform a mid-range teleport and render you momentarily invulnerable"; } } } @@ -42,6 +45,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().spectralVeil = true; + player.Calamity().stealthGenMoving += 0.2f; + player.moveSpeed += 0.1f; } } }