From cab3bfb5a7141cea74e6a7846c0530acb5316d27 Mon Sep 17 00:00:00 2001 From: Nazrin Date: Mon, 2 Oct 2023 00:25:35 -0700 Subject: [PATCH] Fix bug in quest cond state not equal (#2393) * Fix bug in ConditionStateNotEqual.java * Do the same fix for ConditionStateEqual.java --- .../game/quest/conditions/ConditionStateEqual.java | 5 ++++- .../game/quest/conditions/ConditionStateNotEqual.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java index 76298df0c..94d6a4185 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java @@ -20,6 +20,9 @@ public class ConditionStateEqual extends BaseCondition { var questStateValue = condition.getParam()[1]; var checkQuest = owner.getQuestManager().getQuestById(questId); - return checkQuest != null && checkQuest.getState().getValue() == questStateValue; + if (checkQuest == null) { + return questStateValue == 0; + } + return checkQuest.getState().getValue() == questStateValue; } } diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java index 946ef7420..4c06ac627 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java @@ -20,6 +20,9 @@ public class ConditionStateNotEqual extends BaseCondition { var questStateValue = condition.getParam()[1]; var checkQuest = owner.getQuestManager().getQuestById(questId); - return checkQuest != null && checkQuest.getState().getValue() != questStateValue; + if (checkQuest == null) { + return questStateValue != 0; + } + return checkQuest.getState().getValue() != questStateValue; } }