koishi-plugin-wordle-game 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -571,7 +571,7 @@ function apply(ctx, config) {
|
|
|
571
571
|
wordsList = remainingWordsList;
|
|
572
572
|
}
|
|
573
573
|
let longestRemainingWordList = await findLongestMatchedWords(wordsList, lowercaseInputWord, targetWord, isChallengeMode);
|
|
574
|
-
while (isChallengeMode && wordsList.includes(targetWord) && longestRemainingWordList.length === 1 && longestRemainingWordList[0] !== targetWord) {
|
|
574
|
+
while (isChallengeMode && wordsList.includes(targetWord) && longestRemainingWordList && longestRemainingWordList.length === 1 && longestRemainingWordList[0] !== targetWord) {
|
|
575
575
|
longestRemainingWordList = await findLongestMatchedWords(wordsList, lowercaseInputWord, targetWord, isChallengeMode);
|
|
576
576
|
}
|
|
577
577
|
// 变态挑战模式
|
|
@@ -1213,7 +1213,7 @@ async function findLongestMatchedWords(wordsList, lowercaseInputWord, targetWord
|
|
|
1213
1213
|
const results = await Promise.all(wordsList.map(word => processWordAndMatch(lowercaseInputWord, word, wordsList)));
|
|
1214
1214
|
const maxLength = Math.max(...results.map(result => result.matchedWords.length));
|
|
1215
1215
|
let longestMatchedWords = results.filter(result => result.matchedWords.length === maxLength).map(result => result.matchedWords);
|
|
1216
|
-
if (isChallengeMode) {
|
|
1216
|
+
if (isChallengeMode && wordsList.includes(targetWord)) {
|
|
1217
1217
|
longestMatchedWords = longestMatchedWords.filter(words => words.includes(targetWord));
|
|
1218
1218
|
}
|
|
1219
1219
|
const randomIndex = Math.floor(Math.random() * longestMatchedWords.length);
|