@nonz250/ai-rotom 1.1.1 → 1.1.2

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/dist/index.mjs CHANGED
@@ -71000,6 +71000,22 @@ const inputSchema$16 = {
71000
71000
  moves: z.record(z.string(), z.array(z.string())).optional().describe("ポケモン名(日本語 or 英語)をキーに技名配列を値とする map。省略時は learnset から全攻撃技を候補にする。")
71001
71001
  };
71002
71002
  /**
71003
+ * 技名を英語名に解決する。日本語名・英語名どちらでも受け付ける。
71004
+ * 未知の名前は類似サジェスト付きでエラーを throw する。
71005
+ *
71006
+ * `resolvePokemonEntry` と同様の方針で、未知名は silent skip せずに
71007
+ * 呼び出し側へエラーとして伝える(silent skip だと「指定 moves が
71008
+ * 0 件 → 全タイプ uncovered」のような不可視バグを引き起こすため)。
71009
+ */
71010
+ function resolveMoveEnglishName(name) {
71011
+ const fromJa = moveNameResolver.toEnglish(name);
71012
+ if (fromJa !== void 0) return fromJa;
71013
+ if (moveNameResolver.hasEnglishName(name)) return name;
71014
+ const suggestions = moveNameResolver.suggestSimilar(name);
71015
+ const suggestionMessage = suggestions.length > 0 ? ` もしかして: ${suggestions.join(", ")}` : "";
71016
+ throw new Error(`技「${name}」が見つかりません。${suggestionMessage}`);
71017
+ }
71018
+ /**
71003
71019
  * 1 メンバー分の「覚えている攻撃技 ID」を取得する。
71004
71020
  * moves 指定があればそれを使い、未指定時は learnset から category !== Status の技を全て拾う。
71005
71021
  */
@@ -71007,7 +71023,7 @@ function resolveAttackingMoveIds(pokemonEntry, explicitMoves) {
71007
71023
  if (explicitMoves !== void 0) {
71008
71024
  const result = [];
71009
71025
  for (const moveName of explicitMoves) {
71010
- const moveId = toDataId(moveName);
71026
+ const moveId = toDataId(resolveMoveEnglishName(moveName));
71011
71027
  const move = movesById.get(moveId);
71012
71028
  if (move !== void 0 && move.category !== STATUS_CATEGORY$3) result.push(move);
71013
71029
  }