From 1661b8d6eb119b7b3329f8f46f9e1ef6ac5dafda Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 14 Jun 2024 00:43:30 -0700 Subject: [PATCH] Fixed passive skills being castable thru combos --- .../Indyuce/mmocore/skill/binding/BoundSkillInfo.java | 11 +++++++---- .../Indyuce/mmocore/skill/cast/handler/KeyCombos.java | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/binding/BoundSkillInfo.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/binding/BoundSkillInfo.java index 2701e98c..ac15d614 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/binding/BoundSkillInfo.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/binding/BoundSkillInfo.java @@ -15,8 +15,11 @@ public class BoundSkillInfo implements Closeable { private final ClassSkill classSkill; /** - * PASSIVE skills must be registered inside MythicLib when - * bound. When set to null, the skill is not registered. + * Non-permanent passive skills must be registered inside + * MythicLib when bound. When set to null, the skill is either + * active or permanent passive. + *

+ * This does NOT indicate the skill being passive! */ @Nullable private final PassiveSkill registered; @@ -55,7 +58,7 @@ public class BoundSkillInfo implements Closeable { } public boolean isPassive() { - return registered != null; + return classSkill.getSkill().getTrigger().isPassive(); } @Override @@ -63,7 +66,7 @@ public class BoundSkillInfo implements Closeable { Validate.isTrue(open, "BoundSkillInfo has already been closed"); open = false; - // Unregister skill if passive + // Unregister skill if non-permanent passive if (registered != null) registered.unregister(playerData.getMMOPlayerData()); // Remove skill buffs associated to the slot diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/handler/KeyCombos.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/handler/KeyCombos.java index e9828909..37914e53 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/handler/KeyCombos.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/skill/cast/handler/KeyCombos.java @@ -12,6 +12,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.cast.*; import org.bukkit.GameMode; import org.bukkit.configuration.ConfigurationSection; @@ -146,9 +147,11 @@ public class KeyCombos extends SkillCastingHandler { else playerData.leaveSkillCasting(true); // Cast spell - if (playerData.hasSkillBound(spellSlot)) { + final ClassSkill boundSkill; + if (playerData.hasSkillBound(spellSlot) && + !(boundSkill = playerData.getBoundSkill(spellSlot)).getSkill().getTrigger().isPassive()) { final PlayerMetadata caster = playerData.getMMOPlayerData().getStatMap().cache(EquipmentSlot.MAIN_HAND); - final SkillResult result = playerData.getBoundSkill(spellSlot).toCastable(playerData).cast(new TriggerMetadata(caster, null, null)); + final SkillResult result = boundSkill.toCastable(playerData).cast(new TriggerMetadata(caster, TriggerType.CAST, null, null)); if (!result.isSuccessful()) if (failSkillSound != null) failSkillSound.playTo(player); } else if (stayIn) { if (failComboSound != null) failComboSound.playTo(player);