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.
Files changed (2) hide show
  1. package/lib/index.js +2 -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);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-wordle-game",
3
3
  "description": "欢迎来到 Wordle 猜单词小游戏,包含多种模式、多种词库、多种游戏设置和排行榜系统。",
4
- "version": "1.2.7",
4
+ "version": "1.2.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [