From e300c3cddb3334b9fdd5d4c67e47ed8a42d1a0ea Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sat, 28 Jan 2023 22:02:59 +0100 Subject: [PATCH] Nerf katana teleport --- Items/KatanaRedo.cs | 5 +++++ YhtPlayer.cs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Items/KatanaRedo.cs b/Items/KatanaRedo.cs index 4998ba0..706c381 100644 --- a/Items/KatanaRedo.cs +++ b/Items/KatanaRedo.cs @@ -24,6 +24,11 @@ public class KatanaRedo : GlobalItem { public override bool? UseItem(Item item, Player player) { if (item.type != ItemID.Katana || player.altFunctionUse != 2) return null; + YhtPlayer yhtPlayer = player.GetModPlayer(); + + if (yhtPlayer.katanaTeleportCooldown > 0) return null; + yhtPlayer.katanaTeleportCooldown = 300; + for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; if (!npc.CanBeChasedBy()) continue; diff --git a/YhtPlayer.cs b/YhtPlayer.cs index 344c6df..cc1cf16 100644 --- a/YhtPlayer.cs +++ b/YhtPlayer.cs @@ -1,3 +1,4 @@ +using System; using Terraria.ModLoader; namespace YHTMod; @@ -5,6 +6,11 @@ namespace YHTMod; public class YhtPlayer : ModPlayer { public int arcaneMissle = 0; + public int katanaTeleportCooldown = 0; + + public override void PreUpdate() { + this.katanaTeleportCooldown = Math.Max(this.katanaTeleportCooldown - 1, 0); + } public override void ResetEffects() {