@nonz250/ai-rotom 0.0.2 → 0.1.0
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/README.md +1 -1
- package/dist/index.mjs +600 -320
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
6
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
6
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region ../../shared/src/utils/name-resolver.ts
|
|
9
9
|
var NameResolver = class {
|
|
@@ -59,6 +59,10 @@ function levenshteinDistance(a, b) {
|
|
|
59
59
|
return matrix[a.length][b.length];
|
|
60
60
|
}
|
|
61
61
|
//#endregion
|
|
62
|
+
//#region ../../shared/src/constants/champions.ts
|
|
63
|
+
/** タイプ一致 (STAB) 補正倍率。てきおうりょく等の特性補正は含まない通常値 */
|
|
64
|
+
const STAB_MULTIPLIER = 1.5;
|
|
65
|
+
//#endregion
|
|
62
66
|
//#region ../../shared/src/analysis/type-matchup.ts
|
|
63
67
|
/** 等倍の相性倍率 */
|
|
64
68
|
const NEUTRAL_EFFECTIVENESS = 1;
|
|
@@ -108,6 +112,154 @@ function compareSpeed(a, b) {
|
|
|
108
112
|
return "tie";
|
|
109
113
|
}
|
|
110
114
|
//#endregion
|
|
115
|
+
//#region ../../shared/src/analysis/priority-moves.ts
|
|
116
|
+
/** 優先度が 0 の技はこのモジュールの対象外(先制技のみを扱う) */
|
|
117
|
+
const MIN_PRIORITY_FOR_INCLUSION = 1;
|
|
118
|
+
/**
|
|
119
|
+
* learnset(技 ID の配列)から先制技のみを抽出し、priority 降順にソートして返す。
|
|
120
|
+
*
|
|
121
|
+
* - `priority >= 1` のみ対象
|
|
122
|
+
* - ソート: priority 降順 → 英名昇順(安定化のための二次キー)
|
|
123
|
+
* - `resolveMove` が undefined を返した ID は静かにスキップ(learnset と moves の
|
|
124
|
+
* 不整合で対面分析が落ちるのを避ける防衛的実装)
|
|
125
|
+
* - 日本語名は `resolveMove().nameJa` を優先し、null の場合は `toJapanese(enName)` に
|
|
126
|
+
* フォールバック。さらに未解決なら英名をそのまま返す
|
|
127
|
+
*
|
|
128
|
+
* 特性による priority 補正(いたずらごころ・はやてのつばさ等)はここでは扱わない。
|
|
129
|
+
*/
|
|
130
|
+
function extractPriorityMoves(params) {
|
|
131
|
+
const { learnsetMoveIds, resolveMove, toJapanese } = params;
|
|
132
|
+
const results = [];
|
|
133
|
+
for (const id of learnsetMoveIds) {
|
|
134
|
+
const move = resolveMove(id);
|
|
135
|
+
if (move === void 0) continue;
|
|
136
|
+
if (move.priority < MIN_PRIORITY_FOR_INCLUSION) continue;
|
|
137
|
+
const moveJa = move.nameJa ?? toJapanese(move.name) ?? move.name;
|
|
138
|
+
results.push({
|
|
139
|
+
move: move.name,
|
|
140
|
+
moveJa,
|
|
141
|
+
priority: move.priority,
|
|
142
|
+
category: move.category
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
results.sort((a, b) => {
|
|
146
|
+
if (b.priority !== a.priority) return b.priority - a.priority;
|
|
147
|
+
return a.move.localeCompare(b.move);
|
|
148
|
+
});
|
|
149
|
+
return results;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region ../../shared/src/analysis/defensive-ability-overrides.ts
|
|
153
|
+
/** 無効(0 倍) */
|
|
154
|
+
const IMMUNE_MULTIPLIER = 0;
|
|
155
|
+
/** フィルター系特性が抜群時に掛ける倍率 (3/4 = 0.75) */
|
|
156
|
+
const FILTER_SUPER_EFFECTIVE_MULTIPLIER = .75;
|
|
157
|
+
/** 効果抜群とみなす最低倍率 */
|
|
158
|
+
const SUPER_EFFECTIVE_THRESHOLD = 2;
|
|
159
|
+
/** 文字列を ID 相当(英数字のみ・小文字)に正規化する */
|
|
160
|
+
function toId$1(value) {
|
|
161
|
+
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* タイプ相性を無効化する特性 ID → 無効にする攻撃タイプのマップ。
|
|
165
|
+
* ぼうおん(Soundproof)は「おと系技」という技フラグ依存で、タイプ相性では
|
|
166
|
+
* 表現できないためここには含めない(issue スコープ外)。
|
|
167
|
+
*/
|
|
168
|
+
const TYPE_IMMUNITY_ABILITIES = new Map([
|
|
169
|
+
["levitate", "Ground"],
|
|
170
|
+
["flashfire", "Fire"],
|
|
171
|
+
["waterabsorb", "Water"],
|
|
172
|
+
["voltabsorb", "Electric"],
|
|
173
|
+
["lightningrod", "Electric"],
|
|
174
|
+
["motordrive", "Electric"],
|
|
175
|
+
["stormdrain", "Water"],
|
|
176
|
+
["sapsipper", "Grass"]
|
|
177
|
+
]);
|
|
178
|
+
/** 効果抜群時に 0.75 倍にする特性 ID のセット */
|
|
179
|
+
const FILTER_LIKE_ABILITIES = new Set([
|
|
180
|
+
"filter",
|
|
181
|
+
"solidrock",
|
|
182
|
+
"prismarmor"
|
|
183
|
+
]);
|
|
184
|
+
/**
|
|
185
|
+
* 特性を加味したタイプ相性補正を適用する。
|
|
186
|
+
*
|
|
187
|
+
* 優先順位:
|
|
188
|
+
* 1. 特性による無効化
|
|
189
|
+
* 2. フィルター系の 0.75 倍(抜群時のみ)
|
|
190
|
+
*
|
|
191
|
+
* @param baseMultiplier 純粋なタイプ相性計算の結果
|
|
192
|
+
* @param attackingType 攻撃側の技タイプ
|
|
193
|
+
* @param context 防御側の ability(英語名 or ID)
|
|
194
|
+
* @returns 補正後の倍率
|
|
195
|
+
*/
|
|
196
|
+
function applyDefensiveOverrides(baseMultiplier, attackingType, context) {
|
|
197
|
+
const abilityId = context.ability !== void 0 ? toId$1(context.ability) : void 0;
|
|
198
|
+
let multiplier = baseMultiplier;
|
|
199
|
+
if (abilityId !== void 0) {
|
|
200
|
+
const immuneType = TYPE_IMMUNITY_ABILITIES.get(abilityId);
|
|
201
|
+
if (immuneType !== void 0 && attackingType === immuneType) return IMMUNE_MULTIPLIER;
|
|
202
|
+
}
|
|
203
|
+
if (abilityId !== void 0 && FILTER_LIKE_ABILITIES.has(abilityId) && multiplier >= SUPER_EFFECTIVE_THRESHOLD) multiplier *= FILTER_SUPER_EFFECTIVE_MULTIPLIER;
|
|
204
|
+
return multiplier;
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region ../../shared/src/analysis/offensive-ability-overrides.ts
|
|
208
|
+
/**
|
|
209
|
+
* タイプ変更系特性(skin abilities)を扱う純関数モジュール。
|
|
210
|
+
*
|
|
211
|
+
* ノーマル技を別タイプに変換する特性の効果を、カバレッジ計算など
|
|
212
|
+
* 「タイプ相性のみ」を扱うツール向けに反映させる。
|
|
213
|
+
* 威力補正(1.2 倍)はここでは扱わない(ダメージ計算側の責務)。
|
|
214
|
+
*/
|
|
215
|
+
/** ノーマル技は `move.type === "Normal"` を満たす */
|
|
216
|
+
const NORMAL_TYPE = "Normal";
|
|
217
|
+
/**
|
|
218
|
+
* 変化技のカテゴリ。変化技にはタイプ変更系特性は乗らない。
|
|
219
|
+
* mcp-server 側の MoveCategory と同じ文字列だが、shared は mcp-server に
|
|
220
|
+
* 依存できないためここで独立に定義する。
|
|
221
|
+
*/
|
|
222
|
+
const STATUS_CATEGORY$4 = "Status";
|
|
223
|
+
/** 文字列を ID 相当(英数字のみ・小文字)に正規化する */
|
|
224
|
+
function toId(value) {
|
|
225
|
+
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 特性 ID → 変換後タイプのマップ。
|
|
229
|
+
* キーは `toId` 相当で正規化済みの特性 ID(例: "pixilate")。
|
|
230
|
+
*
|
|
231
|
+
* `data/champions/abilities.json` の id と一致する。
|
|
232
|
+
*/
|
|
233
|
+
const OFFENSIVE_TYPE_OVERRIDES = new Map([
|
|
234
|
+
["pixilate", "Fairy"],
|
|
235
|
+
["galvanize", "Electric"],
|
|
236
|
+
["refrigerate", "Ice"],
|
|
237
|
+
["aerilate", "Flying"]
|
|
238
|
+
]);
|
|
239
|
+
/**
|
|
240
|
+
* 攻撃技のタイプに対して、攻撃側の特性によるタイプ変更を適用する。
|
|
241
|
+
*
|
|
242
|
+
* ノーマル技 × タイプ変更系特性の組み合わせのときだけ変換後タイプを返し、
|
|
243
|
+
* それ以外は `originalMoveType` をそのまま返す(regression-free)。
|
|
244
|
+
*
|
|
245
|
+
* ability は英語名(@smogon/calc 互換の "Pixilate" 等)または ID
|
|
246
|
+
* ("pixilate" 等)を受け付ける。内部で `toId` による正規化を行う。
|
|
247
|
+
* 未知の値はそのまま無視する。
|
|
248
|
+
*
|
|
249
|
+
* @param originalMoveType 技本来のタイプ
|
|
250
|
+
* @param moveCategory 技カテゴリ(Status は変換対象外)
|
|
251
|
+
* @param ability 特性名(英語名 or ID、未指定・不明な特性は変換しない)
|
|
252
|
+
*/
|
|
253
|
+
function applyOffensiveTypeOverride(originalMoveType, moveCategory, ability) {
|
|
254
|
+
if (ability === void 0) return originalMoveType;
|
|
255
|
+
if (originalMoveType !== NORMAL_TYPE) return originalMoveType;
|
|
256
|
+
if (moveCategory === STATUS_CATEGORY$4) return originalMoveType;
|
|
257
|
+
const abilityId = toId(ability);
|
|
258
|
+
const overrideType = OFFENSIVE_TYPE_OVERRIDES.get(abilityId);
|
|
259
|
+
if (overrideType === void 0) return originalMoveType;
|
|
260
|
+
return overrideType;
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
111
263
|
//#region ../../shared/src/schemas/stats.ts
|
|
112
264
|
const statPointValueSchema = z.number({ message: "能力ポイント(SP)は数値で指定してください。" }).int({ message: "能力ポイント(SP)は整数で指定してください。" }).finite().min(0, { message: "能力ポイント(SP)は 0 以上で指定してください。" }).max(32, { message: `能力ポイント(SP)は各ステータス 32 以下です (ポケモンチャンピオンズ仕様)。` });
|
|
113
265
|
/**
|
|
@@ -154,6 +306,7 @@ const pokemonSchema = z.object({
|
|
|
154
306
|
const conditionsSchema = z.object({
|
|
155
307
|
weather: z.string().optional().describe("天候(Sun, Rain, Sand, Hail, Snow)"),
|
|
156
308
|
terrain: z.string().optional().describe("フィールド(Electric, Grassy, Misty, Psychic)"),
|
|
309
|
+
battleFormat: z.enum(["singles", "doubles"]).optional().describe("対戦形式(シングル: singles / ダブル: doubles)。省略時は singles。doubles 指定時は全体攻撃技 (じしん/ねっぷう等) の威力が ×0.75 され、壁系の軽減率が約 0.667 倍に変わる。"),
|
|
157
310
|
isReflect: z.boolean().optional().describe("リフレクター"),
|
|
158
311
|
isLightScreen: z.boolean().optional().describe("ひかりのかべ"),
|
|
159
312
|
isAuroraVeil: z.boolean().optional().describe("オーロラベール"),
|
|
@@ -44610,7 +44763,8 @@ var require_move = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
44610
44763
|
this.overrides = options.overrides;
|
|
44611
44764
|
this.species = options.species;
|
|
44612
44765
|
this.bp = data.basePower;
|
|
44613
|
-
|
|
44766
|
+
var typelessDamage = (gen.num === 0 || gen.num >= 2) && data.id === "struggle" || gen.num > 0 && gen.num <= 4 && ["futuresight", "doomdesire"].includes(data.id);
|
|
44767
|
+
this.type = typelessDamage ? "???" : data.type;
|
|
44614
44768
|
this.category = data.category || (gen.num > 0 && gen.num < 4 ? SPECIAL.includes(data.type) ? "Special" : "Physical" : "Status");
|
|
44615
44769
|
var stat = this.category === "Special" ? "spa" : "atk";
|
|
44616
44770
|
if (((_b = data.self) === null || _b === void 0 ? void 0 : _b.boosts) && data.self.boosts[stat] && data.self.boosts[stat] < 0) this.dropsStats = Math.abs(data.self.boosts[stat]);
|
|
@@ -44948,7 +45102,7 @@ function resolveNameWithFallback(resolver, name, label) {
|
|
|
44948
45102
|
* `resolveNameWithFallback` の undefined 許容版。
|
|
44949
45103
|
* name が undefined なら undefined を返し、指定があれば解決する。
|
|
44950
45104
|
*/
|
|
44951
|
-
function resolveOptionalName(resolver, name, label) {
|
|
45105
|
+
function resolveOptionalName$2(resolver, name, label) {
|
|
44952
45106
|
if (name === void 0) return;
|
|
44953
45107
|
return resolveNameWithFallback(resolver, name, label);
|
|
44954
45108
|
}
|
|
@@ -45007,12 +45161,24 @@ function buildPokemonOptions(input, natureEn, abilityEn, itemEn, pokemonEntry) {
|
|
|
45007
45161
|
//#endregion
|
|
45008
45162
|
//#region ../../shared/src/calc/builders/field-builder.ts
|
|
45009
45163
|
/**
|
|
45164
|
+
* battleFormat を @smogon/calc の GameType に変換する。
|
|
45165
|
+
* 未指定 / "singles" は "Singles"、"doubles" は "Doubles"。
|
|
45166
|
+
*/
|
|
45167
|
+
function toGameType(battleFormat) {
|
|
45168
|
+
return battleFormat === "doubles" ? "Doubles" : "Singles";
|
|
45169
|
+
}
|
|
45170
|
+
/**
|
|
45010
45171
|
* ConditionsInput から @smogon/calc の Field オブジェクトを組み立てる。
|
|
45011
|
-
* conditions が undefined
|
|
45172
|
+
* conditions が undefined の場合は gameType=Singles の空の Field を返す。
|
|
45173
|
+
*
|
|
45174
|
+
* gameType="Doubles" 指定時は @smogon/calc が以下のダブル補正を自動で適用する:
|
|
45175
|
+
* - 全体攻撃技 (target: allAdjacent / allAdjacentFoes) の威力 ×0.75
|
|
45176
|
+
* - リフレクター/ひかりのかべ/オーロラベールの軽減率が 0.5 → 約 0.667 倍
|
|
45012
45177
|
*/
|
|
45013
45178
|
function buildField(conditions) {
|
|
45014
|
-
if (conditions === void 0) return new import_dist.Field();
|
|
45179
|
+
if (conditions === void 0) return new import_dist.Field({ gameType: "Singles" });
|
|
45015
45180
|
return new import_dist.Field({
|
|
45181
|
+
gameType: toGameType(conditions.battleFormat),
|
|
45016
45182
|
weather: conditions.weather,
|
|
45017
45183
|
terrain: conditions.terrain,
|
|
45018
45184
|
defenderSide: {
|
|
@@ -45041,6 +45207,17 @@ function toPercent(value, maxHP) {
|
|
|
45041
45207
|
//#region ../../shared/src/calc/damage-calculator.ts
|
|
45042
45208
|
const CHAMPIONS_GEN_NUM$9 = 0;
|
|
45043
45209
|
const DEFAULT_NATURE_EN$1 = "Serious";
|
|
45210
|
+
function buildTypeMetrics(gen, move, attacker, defender) {
|
|
45211
|
+
const moveType = move.type;
|
|
45212
|
+
const typeMultiplier = calculateTypeEffectiveness(gen, moveType, defender.types);
|
|
45213
|
+
const isStab = attacker.types.includes(moveType);
|
|
45214
|
+
return {
|
|
45215
|
+
moveType,
|
|
45216
|
+
typeMultiplier,
|
|
45217
|
+
isStab,
|
|
45218
|
+
effectivePowerMultiplier: (isStab ? STAB_MULTIPLIER : 1) * typeMultiplier
|
|
45219
|
+
};
|
|
45220
|
+
}
|
|
45044
45221
|
/**
|
|
45045
45222
|
* @smogon/calc のラッパー。日本語名入力を受け付け、
|
|
45046
45223
|
* 名前解決・Pokemon/Move/Field 組み立て・結果整形をまとめて担う Facade。
|
|
@@ -45068,29 +45245,33 @@ var DamageCalculatorAdapter = class {
|
|
|
45068
45245
|
const moveName = resolveNameWithFallback(this.resolvers.move, input.moveName, "技");
|
|
45069
45246
|
const attackerNature = this.resolveNature(input.attacker.nature);
|
|
45070
45247
|
const defenderNature = this.resolveNature(input.defender.nature);
|
|
45071
|
-
const attackerAbility = resolveOptionalName(this.resolvers.ability, input.attacker.ability, "特性");
|
|
45072
|
-
const defenderAbility = resolveOptionalName(this.resolvers.ability, input.defender.ability, "特性");
|
|
45073
|
-
const attackerItem = resolveOptionalName(this.resolvers.item, input.attacker.item, "持ち物");
|
|
45074
|
-
const defenderItem = resolveOptionalName(this.resolvers.item, input.defender.item, "持ち物");
|
|
45248
|
+
const attackerAbility = resolveOptionalName$2(this.resolvers.ability, input.attacker.ability, "特性");
|
|
45249
|
+
const defenderAbility = resolveOptionalName$2(this.resolvers.ability, input.defender.ability, "特性");
|
|
45250
|
+
const attackerItem = resolveOptionalName$2(this.resolvers.item, input.attacker.item, "持ち物");
|
|
45251
|
+
const defenderItem = resolveOptionalName$2(this.resolvers.item, input.defender.item, "持ち物");
|
|
45075
45252
|
const attacker = new import_dist.Pokemon(gen, attackerName, buildPokemonOptions(input.attacker, attackerNature, attackerAbility, attackerItem, this.entryProvider?.getByName(attackerName)));
|
|
45076
45253
|
const defender = new import_dist.Pokemon(gen, defenderName, buildPokemonOptions(input.defender, defenderNature, defenderAbility, defenderItem, this.entryProvider?.getByName(defenderName)));
|
|
45077
|
-
const
|
|
45254
|
+
const move = new import_dist.Move(gen, moveName, { isCrit: input.conditions?.isCriticalHit });
|
|
45255
|
+
const result = (0, import_dist.calculate)(gen, attacker, defender, move, buildField(input.conditions));
|
|
45078
45256
|
const [min, max] = result.range();
|
|
45079
45257
|
const defenderMaxHP = defender.maxHP();
|
|
45080
45258
|
const minPercent = toPercent(min, defenderMaxHP);
|
|
45081
45259
|
const maxPercent = toPercent(max, defenderMaxHP);
|
|
45082
45260
|
const koResult = result.kochance();
|
|
45261
|
+
const damageArray = flattenDamage(result.damage);
|
|
45262
|
+
const typeMetrics = buildTypeMetrics(gen, move, attacker, defender);
|
|
45083
45263
|
return {
|
|
45084
45264
|
attacker: attackerName,
|
|
45085
45265
|
defender: defenderName,
|
|
45086
45266
|
move: moveName,
|
|
45087
|
-
damage:
|
|
45267
|
+
damage: damageArray,
|
|
45088
45268
|
min,
|
|
45089
45269
|
max,
|
|
45090
45270
|
minPercent,
|
|
45091
45271
|
maxPercent,
|
|
45092
45272
|
koChance: koResult.text,
|
|
45093
|
-
description: result.fullDesc()
|
|
45273
|
+
description: result.fullDesc(),
|
|
45274
|
+
...typeMetrics
|
|
45094
45275
|
};
|
|
45095
45276
|
}
|
|
45096
45277
|
calculateAllMoves(input) {
|
|
@@ -45099,10 +45280,10 @@ var DamageCalculatorAdapter = class {
|
|
|
45099
45280
|
const defenderName = resolveNameWithFallback(this.resolvers.pokemon, input.defender.name, "ポケモン");
|
|
45100
45281
|
const attackerNature = this.resolveNature(input.attacker.nature);
|
|
45101
45282
|
const defenderNature = this.resolveNature(input.defender.nature);
|
|
45102
|
-
const attackerAbility = resolveOptionalName(this.resolvers.ability, input.attacker.ability, "特性");
|
|
45103
|
-
const defenderAbility = resolveOptionalName(this.resolvers.ability, input.defender.ability, "特性");
|
|
45104
|
-
const attackerItem = resolveOptionalName(this.resolvers.item, input.attacker.item, "持ち物");
|
|
45105
|
-
const defenderItem = resolveOptionalName(this.resolvers.item, input.defender.item, "持ち物");
|
|
45283
|
+
const attackerAbility = resolveOptionalName$2(this.resolvers.ability, input.attacker.ability, "特性");
|
|
45284
|
+
const defenderAbility = resolveOptionalName$2(this.resolvers.ability, input.defender.ability, "特性");
|
|
45285
|
+
const attackerItem = resolveOptionalName$2(this.resolvers.item, input.attacker.item, "持ち物");
|
|
45286
|
+
const defenderItem = resolveOptionalName$2(this.resolvers.item, input.defender.item, "持ち物");
|
|
45106
45287
|
const attacker = new import_dist.Pokemon(gen, attackerName, buildPokemonOptions(input.attacker, attackerNature, attackerAbility, attackerItem, this.entryProvider?.getByName(attackerName)));
|
|
45107
45288
|
const defender = new import_dist.Pokemon(gen, defenderName, buildPokemonOptions(input.defender, defenderNature, defenderAbility, defenderItem, this.entryProvider?.getByName(defenderName)));
|
|
45108
45289
|
const field = buildField(input.conditions);
|
|
@@ -45111,13 +45292,15 @@ var DamageCalculatorAdapter = class {
|
|
|
45111
45292
|
for (const moveData of gen.moves) {
|
|
45112
45293
|
if (!moveData.basePower || moveData.basePower <= 0) continue;
|
|
45113
45294
|
try {
|
|
45114
|
-
const
|
|
45295
|
+
const move = new import_dist.Move(gen, moveData.name, { isCrit: input.conditions?.isCriticalHit });
|
|
45296
|
+
const result = (0, import_dist.calculate)(gen, attacker, defender, move, field);
|
|
45115
45297
|
const [min, max] = result.range();
|
|
45116
45298
|
if (max <= 0) continue;
|
|
45117
45299
|
const minPercent = toPercent(min, defenderMaxHP);
|
|
45118
45300
|
const maxPercent = toPercent(max, defenderMaxHP);
|
|
45119
45301
|
const koResult = result.kochance();
|
|
45120
45302
|
const damageArray = flattenDamage(result.damage);
|
|
45303
|
+
const typeMetrics = buildTypeMetrics(gen, move, attacker, defender);
|
|
45121
45304
|
results.push({
|
|
45122
45305
|
attacker: attackerName,
|
|
45123
45306
|
defender: defenderName,
|
|
@@ -45128,7 +45311,8 @@ var DamageCalculatorAdapter = class {
|
|
|
45128
45311
|
minPercent,
|
|
45129
45312
|
maxPercent,
|
|
45130
45313
|
koChance: koResult.text,
|
|
45131
|
-
description: result.fullDesc()
|
|
45314
|
+
description: result.fullDesc(),
|
|
45315
|
+
...typeMetrics
|
|
45132
45316
|
});
|
|
45133
45317
|
} catch {}
|
|
45134
45318
|
}
|
|
@@ -45139,7 +45323,7 @@ var DamageCalculatorAdapter = class {
|
|
|
45139
45323
|
const gen = this.getGen();
|
|
45140
45324
|
const resolvedName = resolveNameWithFallback(this.resolvers.pokemon, input.name, "ポケモン");
|
|
45141
45325
|
return {
|
|
45142
|
-
pokemon: new import_dist.Pokemon(gen, resolvedName, buildPokemonOptions(input, this.resolveNature(input.nature), resolveOptionalName(this.resolvers.ability, input.ability, "特性"), resolveOptionalName(this.resolvers.item, input.item, "持ち物"), this.entryProvider?.getByName(resolvedName))),
|
|
45326
|
+
pokemon: new import_dist.Pokemon(gen, resolvedName, buildPokemonOptions(input, this.resolveNature(input.nature), resolveOptionalName$2(this.resolvers.ability, input.ability, "特性"), resolveOptionalName$2(this.resolvers.item, input.item, "持ち物"), this.entryProvider?.getByName(resolvedName))),
|
|
45143
45327
|
resolvedName
|
|
45144
45328
|
};
|
|
45145
45329
|
}
|
|
@@ -45161,10 +45345,36 @@ var DamageCalculatorAdapter = class {
|
|
|
45161
45345
|
}
|
|
45162
45346
|
};
|
|
45163
45347
|
//#endregion
|
|
45348
|
+
//#region ../../shared/src/calc/filters/learnset-filter.ts
|
|
45349
|
+
/**
|
|
45350
|
+
* calculateAllMoves の結果を learnset で絞り込む。
|
|
45351
|
+
*
|
|
45352
|
+
* @smogon/calc は全技を走査するため、実際に覚えない技で過大評価しないように
|
|
45353
|
+
* 呼び出し側で learnset フィルタを適用するための純関数。
|
|
45354
|
+
*
|
|
45355
|
+
* learnsetMoveIds が空集合の場合は、learnset データが無い(不明)とみなして
|
|
45356
|
+
* フィルタせず元の配列をそのまま返す(現行挙動踏襲)。
|
|
45357
|
+
*
|
|
45358
|
+
* 呼び出し側は `results[i].move` と `learnsetMoveIds` を同じ正規化形式で
|
|
45359
|
+
* 揃える責務を持つ。正規化ロジックは `normalize` 引数で注入する。
|
|
45360
|
+
*/
|
|
45361
|
+
function filterResultsByLearnset(results, learnsetMoveIds, normalize) {
|
|
45362
|
+
if (learnsetMoveIds.size === 0) return [...results];
|
|
45363
|
+
return results.filter((r) => learnsetMoveIds.has(normalize(r.move)));
|
|
45364
|
+
}
|
|
45365
|
+
//#endregion
|
|
45164
45366
|
//#region src/instructions.ts
|
|
45165
45367
|
const SERVER_INSTRUCTIONS = `
|
|
45166
45368
|
ai-rotom はポケモンチャンピオンズ (Pokemon Champions) の対戦アドバイザー MCP サーバーです。
|
|
45167
|
-
|
|
45369
|
+
|
|
45370
|
+
## セッションスコープ(重要)
|
|
45371
|
+
|
|
45372
|
+
- このセッション内でポケモン関連の話題が出た場合は、すべてポケモンチャンピオンズ (Pokemon Champions) の仕様として扱ってください。
|
|
45373
|
+
- 従来作 (SV / 剣盾 / USUM / BDSP / LA 等) の仕様・技威力・特性効果・種族値・タイプ相性などを前提にしないでください。
|
|
45374
|
+
- 従来作の知識と差異が生じ得る項目 (種族値・技の威力/PP・特性効果・タイプ等) は、get_pokemon_info / get_move_info / get_ability_info / get_item_info / get_type_info 等のツールで必ず事実確認してください。
|
|
45375
|
+
- ポケチャン固有仕様で不明な点は推測で埋めず、ユーザーに確認してください。
|
|
45376
|
+
|
|
45377
|
+
以降は、従来作と差異が出やすい代表的な固有仕様です。
|
|
45168
45378
|
|
|
45169
45379
|
## 能力ポイント (SP) について
|
|
45170
45380
|
|
|
@@ -45182,11 +45392,25 @@ ai-rotom はポケモンチャンピオンズ (Pokemon Champions) の対戦ア
|
|
|
45182
45392
|
- メガシンカ: 1試合につき1回のみ使用可能。
|
|
45183
45393
|
- テラスタル: 未対応 (ゲーム側で未実装のため)。
|
|
45184
45394
|
|
|
45395
|
+
## 判断と計算の役割分担
|
|
45396
|
+
|
|
45397
|
+
- 本サーバーのツールは「判断の根拠となる正確なデータを返す」ことに責務を限定しています。
|
|
45398
|
+
「この選出が最適」「この構築が正解」といった最終判断は返しません。
|
|
45399
|
+
- 選出・構築・対策の結論は、ツールが返したデータ (タイプ相性・ダメ計・素早さ比較・対面マトリクス等) を元に AI が総合的に導いてください。
|
|
45400
|
+
- 一部ツール (find_counters 等) はスコア付きの候補リストを返しますが、これは候補抽出のための目安であり、
|
|
45401
|
+
最終的な採用判断はダメ計・素早さ・対面状況を踏まえて AI が行うものです。
|
|
45402
|
+
|
|
45185
45403
|
## 推奨される使い方
|
|
45186
45404
|
|
|
45187
45405
|
- ポケモン情報の確認: get_pokemon_info / search_pokemon
|
|
45188
45406
|
- 特定の技のダメージ計算: calculate_damage_single
|
|
45189
|
-
- 育成データが不明な場合は evs・nature
|
|
45407
|
+
- 育成データが不明な場合は evs・nature を省略してよい (デフォルト値で計算)
|
|
45408
|
+
|
|
45409
|
+
## 計算・分析系ツールでの ability / item 指定
|
|
45410
|
+
|
|
45411
|
+
- 計算・対面分析系ツール (calculate_damage_single / calculate_damage_all_moves / calculate_damage_party_matchup / analyze_damage_range / analyze_matchup / analyze_selection / find_counters) を呼ぶ前に、攻撃側・防御側の ability / item を確認してから指定すること。
|
|
45412
|
+
- 省略時の挙動: ability は通常特性 (pokemon.json の abilities[0]) が自動設定され、item は持ち物なし扱いとなる。そのためメガシンカ・こだわり系・半減きのみ・ちからのハチマキ 等が反映されず、実戦想定の build と乖離した結果になる。
|
|
45413
|
+
- 正確な計算のためには ability / item を明示的に指定することを強く推奨する。
|
|
45190
45414
|
`.trim();
|
|
45191
45415
|
//#endregion
|
|
45192
45416
|
//#region ../../data/champions/abilities.json
|
|
@@ -76483,6 +76707,18 @@ function toDataId(name) {
|
|
|
76483
76707
|
* 英語名から pokemonById Map を引いて PokemonEntry を返す。
|
|
76484
76708
|
*/
|
|
76485
76709
|
const pokemonEntryProvider = { getByName: (name) => pokemonById.get(toDataId(name)) };
|
|
76710
|
+
/**
|
|
76711
|
+
* 指定ポケモンの learnset に含まれる技 ID セットを取得する。
|
|
76712
|
+
* 未登録のポケモンは空 Set を返す(shared の filterResultsByLearnset では
|
|
76713
|
+
* 空 Set を「learnset データが無い」フォールバックとして扱う)。
|
|
76714
|
+
* learnset JSON の ID は既に Showdown toID 形式だが、呼び出し側の
|
|
76715
|
+
* 正規化関数({@link toDataId})との対称性を保つため念のため通している。
|
|
76716
|
+
*/
|
|
76717
|
+
function getLearnsetMoveIdSet(pokemonId) {
|
|
76718
|
+
const learnset = championsLearnsets[pokemonId];
|
|
76719
|
+
if (learnset === void 0) return /* @__PURE__ */ new Set();
|
|
76720
|
+
return new Set(learnset.map(toDataId));
|
|
76721
|
+
}
|
|
76486
76722
|
//#endregion
|
|
76487
76723
|
//#region src/name-resolvers.ts
|
|
76488
76724
|
/**
|
|
@@ -76610,16 +76846,16 @@ const damageCalcInputSchema = {
|
|
|
76610
76846
|
conditions: conditionsSchema.optional().describe("バトル条件")
|
|
76611
76847
|
};
|
|
76612
76848
|
const SINGLE_TOOL_NAME = "calculate_damage_single";
|
|
76613
|
-
const SINGLE_TOOL_DESCRIPTION = "ポケモンのダメージ計算を行うツール。攻撃側ポケモンの指定した1技が防御側ポケモンに与えるダメージを計算する。ポケモンチャンピオンズ (Pokemon Champions) の対戦仕様に対応。重要: 能力ポイント(evs) は各ステ 0-32・合計 0-66 で指定すること (従来の努力値 252/510 上限ではない)。レベル 50・個体値 31
|
|
76849
|
+
const SINGLE_TOOL_DESCRIPTION = "ポケモンのダメージ計算を行うツール。攻撃側ポケモンの指定した1技が防御側ポケモンに与えるダメージを計算する。ポケモンチャンピオンズ (Pokemon Champions) の対戦仕様に対応。重要: 能力ポイント(evs) は各ステ 0-32・合計 0-66 で指定すること (従来の努力値 252/510 上限ではない)。レベル 50・個体値 31 固定。育成データは省略可能で、省略時はデフォルト値で計算される。正確な計算のため攻撃側・防御側の ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。";
|
|
76614
76850
|
const ALL_MOVES_TOOL_NAME = "calculate_damage_all_moves";
|
|
76615
|
-
const ALL_MOVES_TOOL_DESCRIPTION = "
|
|
76851
|
+
const ALL_MOVES_TOOL_DESCRIPTION = "ポケモン対戦で攻撃側ポケモンの全攻撃技のダメージを一括計算する。どの技が最も有効かを比較するときに使用する。ポケモンチャンピオンズ対応。正確な計算のため攻撃側・防御側の ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。";
|
|
76616
76852
|
const allMovesInputSchema = {
|
|
76617
76853
|
attacker: pokemonSchema.describe("攻撃側ポケモン"),
|
|
76618
76854
|
defender: pokemonSchema.describe("防御側ポケモン"),
|
|
76619
76855
|
conditions: conditionsSchema.optional().describe("バトル条件")
|
|
76620
76856
|
};
|
|
76621
76857
|
const PARTY_MATCHUP_TOOL_NAME = "calculate_damage_party_matchup";
|
|
76622
|
-
const PARTY_MATCHUP_TOOL_DESCRIPTION = "パーティ対パーティの全組み合わせダメージ計算を行う。6vs6
|
|
76858
|
+
const PARTY_MATCHUP_TOOL_DESCRIPTION = "パーティ対パーティの全組み合わせダメージ計算を行う。6vs6の全対面での火力関係を一覧する。ポケモン対戦の選出判断やパーティ構築の検討に使用する。正確な計算のため各ポケモンの ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。";
|
|
76623
76859
|
const partyMatchupInputSchema = {
|
|
76624
76860
|
myParty: z.array(pokemonSchema).describe("自分のパーティ"),
|
|
76625
76861
|
opponentParty: z.array(pokemonSchema).describe("相手のパーティ"),
|
|
@@ -76746,7 +76982,7 @@ function registerDamageCalculationTools(server) {
|
|
|
76746
76982
|
const SP_COARSE_STEP = 4;
|
|
76747
76983
|
const SP_FINE_STEP = 1;
|
|
76748
76984
|
const TOOL_NAME$16 = "analyze_damage_range";
|
|
76749
|
-
const TOOL_DESCRIPTION$16 = "ダメージ計算を逆引きして、防御側を耐えさせるために必要な最小 SP 配分を探索する。`damage` には min/max ダメージと % を、`nHitKo` には確定 X 発の数を、`survivalSpConfig` には確定耐えに必要な最小 SP 配分を返す。ポケモンチャンピオンズ仕様(SP 各 0-32 / 合計 0-66
|
|
76985
|
+
const TOOL_DESCRIPTION$16 = "ダメージ計算を逆引きして、防御側を耐えさせるために必要な最小 SP 配分を探索する。`damage` には min/max ダメージと % を、`nHitKo` には確定 X 発の数を、`survivalSpConfig` には確定耐えに必要な最小 SP 配分を返す。ポケモンチャンピオンズ仕様(SP 各 0-32 / 合計 0-66)で計算。正確な計算のため攻撃側・防御側の ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。";
|
|
76750
76986
|
const inputSchema$13 = {
|
|
76751
76987
|
attacker: pokemonSchema.describe("攻撃側ポケモン"),
|
|
76752
76988
|
defender: pokemonSchema.describe("防御側ポケモン"),
|
|
@@ -76958,34 +77194,43 @@ function registerDamageRangeTool(server) {
|
|
|
76958
77194
|
//#endregion
|
|
76959
77195
|
//#region src/tools/analysis/find-counters.ts
|
|
76960
77196
|
const CHAMPIONS_GEN_NUM$8 = 0;
|
|
76961
|
-
/**
|
|
76962
|
-
const TOP_N = 10;
|
|
76963
|
-
/** スコア重み */
|
|
76964
|
-
const SCORE_TYPE_ADVANTAGE = 5;
|
|
76965
|
-
const SCORE_SPEED_WIN = 3;
|
|
76966
|
-
const SCORE_LOW_INCOMING_DAMAGE = 3;
|
|
76967
|
-
const SCORE_OHKO = 5;
|
|
76968
|
-
const SCORE_2HKO = 2;
|
|
76969
|
-
/** タイプ相性しきい値 */
|
|
77197
|
+
/** 弱点タイプ判定のしきい値(候補プール抽出で使用) */
|
|
76970
77198
|
const SUPER_EFFECTIVE_MIN = 2;
|
|
76971
|
-
const HALF_EFFECTIVE_MAX = .5;
|
|
76972
|
-
const IMMUNITY_MULTIPLIER$2 = 0;
|
|
76973
|
-
/** ダメージ割合(%)のしきい値 */
|
|
76974
|
-
const LOW_INCOMING_DAMAGE_PERCENT_MAX = 30;
|
|
76975
|
-
const OHKO_PERCENT_MIN = 100;
|
|
76976
|
-
const TWO_HKO_PERCENT_MIN = 50;
|
|
76977
|
-
/** 4 倍耐性以上(強耐性)しきい値: 0.25 */
|
|
76978
|
-
const STRONG_RESIST_MAX = .25;
|
|
76979
77199
|
/** Status 技 */
|
|
76980
77200
|
const STATUS_CATEGORY$3 = "Status";
|
|
76981
77201
|
const TOOL_NAME$15 = "find_counters";
|
|
76982
|
-
const TOOL_DESCRIPTION$15 = "
|
|
77202
|
+
const TOOL_DESCRIPTION$15 = "target の弱点タイプ攻撃技を持つポケモンを候補プールとして抽出し、各候補の双方向ダメ計・素早さ・タイプ相性を返す。`candidatePool` は文字列(名前のみ)と PokemonInput オブジェクト(ability / item / nature / evs 指定)を混在可能で、同一ポケモンの build 違い比較にも対応する。正確な計算のため target 側の ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。判断(受け型か速度勝ち型か等)は AI が行う前提。ポケモンチャンピオンズ対応。";
|
|
77203
|
+
const battleFormatValues = ["singles", "doubles"];
|
|
77204
|
+
const candidatePoolItemSchema = z.union([z.string(), pokemonSchema]);
|
|
76983
77205
|
const inputSchema$12 = {
|
|
76984
77206
|
target: pokemonSchema.describe("対策したい相手ポケモン"),
|
|
76985
|
-
candidatePool: z.array(
|
|
76986
|
-
battleFormat: z.enum(
|
|
77207
|
+
candidatePool: z.array(candidatePoolItemSchema).optional().describe("候補プール。各要素は「ポケモン名の文字列(簡易指定、デフォルト build で評価)」または「PokemonInput オブジェクト(name に加え ability / item / nature / evs / boosts / status を指定可能)」。同じポケモン名でも build 違いを並列で比較できる。未指定時は target の弱点タイプ攻撃技を覚える Champions 全ポケモンから自動選定(デフォルト build 評価)。"),
|
|
77208
|
+
battleFormat: z.enum(battleFormatValues).optional().describe("対戦形式(省略時: singles)")
|
|
76987
77209
|
};
|
|
76988
77210
|
/**
|
|
77211
|
+
* extractPriorityMoves 用の move 解決。learnset ID から MoveEntry を引く。
|
|
77212
|
+
*/
|
|
77213
|
+
function resolveMoveForPriority$1(id) {
|
|
77214
|
+
return movesById.get(id);
|
|
77215
|
+
}
|
|
77216
|
+
/**
|
|
77217
|
+
* extractPriorityMoves 用の日本語名解決。
|
|
77218
|
+
*/
|
|
77219
|
+
function moveToJapanese$1(en) {
|
|
77220
|
+
return moveNameResolver.toJapanese(en);
|
|
77221
|
+
}
|
|
77222
|
+
/**
|
|
77223
|
+
* 指定ポケモン ID の learnset から先制技のみを抽出する。
|
|
77224
|
+
* learnset データが無い場合は空配列を返す。
|
|
77225
|
+
*/
|
|
77226
|
+
function buildPriorityMoves(pokemonId) {
|
|
77227
|
+
return extractPriorityMoves({
|
|
77228
|
+
learnsetMoveIds: championsLearnsets[pokemonId] ?? [],
|
|
77229
|
+
resolveMove: resolveMoveForPriority$1,
|
|
77230
|
+
toJapanese: moveToJapanese$1
|
|
77231
|
+
});
|
|
77232
|
+
}
|
|
77233
|
+
/**
|
|
76989
77234
|
* ポケモン名を pokemon.json のエントリに解決する。
|
|
76990
77235
|
*/
|
|
76991
77236
|
function resolvePokemonEntry$3(name) {
|
|
@@ -77041,94 +77286,69 @@ function hasAttackingMoveOfAnyType(pokemonId, weaknessTypes) {
|
|
|
77041
77286
|
return false;
|
|
77042
77287
|
}
|
|
77043
77288
|
/**
|
|
77044
|
-
*
|
|
77045
|
-
*/
|
|
77046
|
-
function pickBestMove(results) {
|
|
77047
|
-
if (results.length === 0) return void 0;
|
|
77048
|
-
let best = results[0];
|
|
77049
|
-
for (const r of results) if (r.max > best.max) best = r;
|
|
77050
|
-
return best;
|
|
77051
|
-
}
|
|
77052
|
-
/**
|
|
77053
|
-
* 指定ポケモンの learnset に含まれる技 ID セットを取得する。
|
|
77054
|
-
* 未登録のポケモンは空 Set を返す。
|
|
77055
|
-
*/
|
|
77056
|
-
function getLearnsetMoveIdSet(pokemonId) {
|
|
77057
|
-
const learnset = championsLearnsets[pokemonId];
|
|
77058
|
-
if (learnset === void 0) return /* @__PURE__ */ new Set();
|
|
77059
|
-
return new Set(learnset);
|
|
77060
|
-
}
|
|
77061
|
-
/**
|
|
77062
|
-
* calculateAllMoves の結果を attacker の learnset で絞り込む。
|
|
77063
|
-
* @smogon/calc は全技を走査するため、実際に覚えない技で過大評価しないようにフィルタする。
|
|
77064
|
-
*/
|
|
77065
|
-
function filterResultsByLearnset(results, attackerPokemonId) {
|
|
77066
|
-
const learnsetIds = getLearnsetMoveIdSet(attackerPokemonId);
|
|
77067
|
-
if (learnsetIds.size === 0) return [...results];
|
|
77068
|
-
return results.filter((r) => learnsetIds.has(toDataId(r.move)));
|
|
77069
|
-
}
|
|
77070
|
-
/**
|
|
77071
|
-
* 被ダメージ % の最大値を元に LowIncoming 判定する。
|
|
77072
|
-
*/
|
|
77073
|
-
function isLowIncomingDamage(incomingMaxPercent) {
|
|
77074
|
-
return incomingMaxPercent <= LOW_INCOMING_DAMAGE_PERCENT_MAX;
|
|
77075
|
-
}
|
|
77076
|
-
/**
|
|
77077
|
-
* 対策スコアを計算する。設計書の重みに従う。
|
|
77289
|
+
* ターゲットのタイプに対して弱点となるタイプ集合を算出する。
|
|
77078
77290
|
*/
|
|
77079
|
-
function
|
|
77080
|
-
|
|
77081
|
-
if (
|
|
77082
|
-
|
|
77083
|
-
if (args.incomingMaxPercent !== null && isLowIncomingDamage(args.incomingMaxPercent)) score += SCORE_LOW_INCOMING_DAMAGE;
|
|
77084
|
-
if (args.outgoingMaxPercent !== null) {
|
|
77085
|
-
if (args.outgoingMaxPercent >= OHKO_PERCENT_MIN) score += SCORE_OHKO;
|
|
77086
|
-
else if (args.outgoingMaxPercent >= TWO_HKO_PERCENT_MIN) score += SCORE_2HKO;
|
|
77087
|
-
}
|
|
77088
|
-
return score;
|
|
77291
|
+
function buildWeaknessTypeSet(targetTypes, gen) {
|
|
77292
|
+
const set = /* @__PURE__ */ new Set();
|
|
77293
|
+
for (const attackerType of championsTypes) if (calcMultiplier(attackerType.name, targetTypes, gen) >= SUPER_EFFECTIVE_MIN) set.add(attackerType.name);
|
|
77294
|
+
return set;
|
|
77089
77295
|
}
|
|
77090
77296
|
/**
|
|
77091
|
-
*
|
|
77092
|
-
*
|
|
77093
|
-
* - speed_kill: 自分が先制 + 2 発以内で倒せる(OHKO or 2HKO)
|
|
77094
|
-
* - tank_then_kill: 半減以下で受け + OHKO/2HKO
|
|
77095
|
-
* それ以外はデフォルトで tank_then_kill 扱い(type_wall 未満の耐性 + 倒しきれる想定)。
|
|
77297
|
+
* PokemonInput から build 部分(name 以外)を抽出する。
|
|
77298
|
+
* 省略されたフィールドは含めない。
|
|
77096
77299
|
*/
|
|
77097
|
-
function
|
|
77098
|
-
const
|
|
77099
|
-
if (
|
|
77100
|
-
if (
|
|
77101
|
-
if (
|
|
77102
|
-
|
|
77300
|
+
function extractBuildInfo(input) {
|
|
77301
|
+
const build = {};
|
|
77302
|
+
if (input.ability !== void 0) build.ability = input.ability;
|
|
77303
|
+
if (input.item !== void 0) build.item = input.item;
|
|
77304
|
+
if (input.nature !== void 0) build.nature = input.nature;
|
|
77305
|
+
if (input.evs !== void 0) build.evs = input.evs;
|
|
77306
|
+
if (input.boosts !== void 0) build.boosts = input.boosts;
|
|
77307
|
+
if (input.status !== void 0) build.status = input.status;
|
|
77308
|
+
return build;
|
|
77103
77309
|
}
|
|
77104
77310
|
/**
|
|
77105
|
-
*
|
|
77311
|
+
* 候補のソート用 tiebreaker として使う安定的な署名を生成する。
|
|
77312
|
+
* 同名ポケモンの build 違いを区別する。build 未指定(string or 自動選定)は "default" 扱い。
|
|
77106
77313
|
*/
|
|
77107
|
-
function
|
|
77108
|
-
|
|
77109
|
-
|
|
77110
|
-
return set;
|
|
77314
|
+
function buildSignature(candidate) {
|
|
77315
|
+
if (!candidate.hasExplicitBuild) return "default";
|
|
77316
|
+
return JSON.stringify(extractBuildInfo(candidate.input));
|
|
77111
77317
|
}
|
|
77112
77318
|
/**
|
|
77113
77319
|
* 候補プールを決定する。
|
|
77114
|
-
* - candidatePool 指定時:
|
|
77115
|
-
* - 未指定時: target のタイプ弱点を攻撃技として持つ全 Champions
|
|
77320
|
+
* - candidatePool 指定時: 各要素(string or PokemonInput)を正規化して CandidateBuild 配列で返す。
|
|
77321
|
+
* - 未指定時: target のタイプ弱点を攻撃技として持つ全 Champions ポケモンに絞る(デフォルト build)。
|
|
77116
77322
|
*/
|
|
77117
77323
|
function buildCandidateEntries(candidatePool, target, gen) {
|
|
77118
77324
|
if (candidatePool !== void 0) {
|
|
77119
|
-
const
|
|
77120
|
-
for (const
|
|
77121
|
-
|
|
77325
|
+
const candidates = [];
|
|
77326
|
+
for (const item of candidatePool) if (typeof item === "string") {
|
|
77327
|
+
const entry = resolvePokemonEntry$3(item);
|
|
77328
|
+
candidates.push({
|
|
77329
|
+
entry,
|
|
77330
|
+
input: { name: entry.name },
|
|
77331
|
+
hasExplicitBuild: false
|
|
77332
|
+
});
|
|
77333
|
+
} else {
|
|
77334
|
+
const entry = resolvePokemonEntry$3(item.name);
|
|
77335
|
+
candidates.push({
|
|
77336
|
+
entry,
|
|
77337
|
+
input: {
|
|
77338
|
+
...item,
|
|
77339
|
+
name: entry.name
|
|
77340
|
+
},
|
|
77341
|
+
hasExplicitBuild: true
|
|
77342
|
+
});
|
|
77343
|
+
}
|
|
77344
|
+
return candidates;
|
|
77122
77345
|
}
|
|
77123
77346
|
const weaknessTypes = buildWeaknessTypeSet(target.types, gen);
|
|
77124
|
-
|
|
77125
|
-
|
|
77126
|
-
|
|
77127
|
-
|
|
77128
|
-
|
|
77129
|
-
candidates.push(entry);
|
|
77130
|
-
}
|
|
77131
|
-
return candidates;
|
|
77347
|
+
return (weaknessTypes.size === 0 ? [...championsPokemon].filter((p) => p.id !== target.id) : championsPokemon.filter((p) => p.id !== target.id && hasAttackingMoveOfAnyType(p.id, weaknessTypes))).map((entry) => ({
|
|
77348
|
+
entry,
|
|
77349
|
+
input: { name: entry.name },
|
|
77350
|
+
hasExplicitBuild: false
|
|
77351
|
+
}));
|
|
77132
77352
|
}
|
|
77133
77353
|
function registerFindCountersTool(server) {
|
|
77134
77354
|
const calculator = new DamageCalculatorAdapter({
|
|
@@ -77141,6 +77361,7 @@ function registerFindCountersTool(server) {
|
|
|
77141
77361
|
server.tool(TOOL_NAME$15, TOOL_DESCRIPTION$15, inputSchema$12, async (args) => {
|
|
77142
77362
|
try {
|
|
77143
77363
|
const gen = import_dist.Generations.get(CHAMPIONS_GEN_NUM$8);
|
|
77364
|
+
const damageConditions = { battleFormat: args.battleFormat };
|
|
77144
77365
|
const targetEntry = resolvePokemonEntry$3(args.target.name);
|
|
77145
77366
|
const { pokemon: targetObj, resolvedName: targetName } = calculator.createPokemonObject(args.target);
|
|
77146
77367
|
const targetNameJa = pokemonNameResolver.toJapanese(targetName) ?? targetName;
|
|
@@ -77153,10 +77374,11 @@ function registerFindCountersTool(server) {
|
|
|
77153
77374
|
spd: targetObj.stats.spd,
|
|
77154
77375
|
spe: targetObj.stats.spe
|
|
77155
77376
|
};
|
|
77156
|
-
const
|
|
77377
|
+
const candidateBuilds = buildCandidateEntries(args.candidatePool, targetEntry, gen);
|
|
77157
77378
|
const counterEntries = [];
|
|
77158
|
-
for (const candidate of
|
|
77159
|
-
const
|
|
77379
|
+
for (const candidate of candidateBuilds) {
|
|
77380
|
+
const candidateEntry = candidate.entry;
|
|
77381
|
+
const candidateInput = candidate.input;
|
|
77160
77382
|
let candidateObj;
|
|
77161
77383
|
try {
|
|
77162
77384
|
candidateObj = calculator.createPokemonObject(candidateInput).pokemon;
|
|
@@ -77168,101 +77390,55 @@ function registerFindCountersTool(server) {
|
|
|
77168
77390
|
try {
|
|
77169
77391
|
outgoing = filterResultsByLearnset(calculator.calculateAllMoves({
|
|
77170
77392
|
attacker: candidateInput,
|
|
77171
|
-
defender: args.target
|
|
77172
|
-
|
|
77393
|
+
defender: args.target,
|
|
77394
|
+
conditions: damageConditions
|
|
77395
|
+
}), getLearnsetMoveIdSet(candidateEntry.id), toDataId);
|
|
77173
77396
|
} catch {
|
|
77174
77397
|
outgoing = [];
|
|
77175
77398
|
}
|
|
77176
77399
|
try {
|
|
77177
77400
|
incoming = filterResultsByLearnset(calculator.calculateAllMoves({
|
|
77178
77401
|
attacker: args.target,
|
|
77179
|
-
defender: candidateInput
|
|
77180
|
-
|
|
77402
|
+
defender: candidateInput,
|
|
77403
|
+
conditions: damageConditions
|
|
77404
|
+
}), getLearnsetMoveIdSet(targetEntry.id), toDataId);
|
|
77181
77405
|
} catch {
|
|
77182
77406
|
incoming = [];
|
|
77183
77407
|
}
|
|
77184
|
-
const
|
|
77185
|
-
const
|
|
77186
|
-
const
|
|
77187
|
-
|
|
77188
|
-
|
|
77189
|
-
|
|
77190
|
-
|
|
77191
|
-
|
|
77192
|
-
|
|
77193
|
-
|
|
77194
|
-
|
|
77195
|
-
}
|
|
77196
|
-
let incomingMultiplier = 1;
|
|
77197
|
-
if (bestIncoming !== void 0) {
|
|
77198
|
-
const inMoveEntry = movesById.get(toDataId(bestIncoming.move));
|
|
77199
|
-
if (inMoveEntry !== void 0) incomingMultiplier = calcMultiplier(inMoveEntry.type, candidate.types, gen);
|
|
77200
|
-
}
|
|
77201
|
-
const score = calcCounterScore({
|
|
77202
|
-
typeAdvantage,
|
|
77203
|
-
speedAdvantage,
|
|
77204
|
-
incomingMaxPercent,
|
|
77205
|
-
outgoingMaxPercent
|
|
77206
|
-
});
|
|
77207
|
-
const strategy = classifyStrategy({
|
|
77208
|
-
incomingMultiplier,
|
|
77209
|
-
outgoingMaxPercent,
|
|
77210
|
-
speedAdvantage
|
|
77211
|
-
});
|
|
77212
|
-
const nameJa = candidate.nameJa ?? candidate.name;
|
|
77213
|
-
const details = { speedAdvantage };
|
|
77214
|
-
if (bestOutgoing !== void 0) {
|
|
77215
|
-
const outMoveEntry = movesById.get(toDataId(bestOutgoing.move));
|
|
77216
|
-
const outNameJa = moveNameResolver.toJapanese(bestOutgoing.move) ?? bestOutgoing.move;
|
|
77217
|
-
details.bestMove = {
|
|
77218
|
-
name: bestOutgoing.move,
|
|
77219
|
-
nameJa: outNameJa,
|
|
77220
|
-
type: outMoveEntry?.type ?? "",
|
|
77221
|
-
expectedDamagePercent: {
|
|
77222
|
-
min: bestOutgoing.minPercent,
|
|
77223
|
-
max: bestOutgoing.maxPercent
|
|
77224
|
-
}
|
|
77225
|
-
};
|
|
77226
|
-
}
|
|
77227
|
-
if (bestIncoming !== void 0) {
|
|
77228
|
-
const inMoveEntry = movesById.get(toDataId(bestIncoming.move));
|
|
77229
|
-
const inNameJa = moveNameResolver.toJapanese(bestIncoming.move) ?? bestIncoming.move;
|
|
77230
|
-
details.incomingBestMove = {
|
|
77231
|
-
name: bestIncoming.move,
|
|
77232
|
-
nameJa: inNameJa,
|
|
77233
|
-
type: inMoveEntry?.type ?? "",
|
|
77234
|
-
receivedDamagePercent: {
|
|
77235
|
-
min: bestIncoming.minPercent,
|
|
77236
|
-
max: bestIncoming.maxPercent
|
|
77237
|
-
}
|
|
77238
|
-
};
|
|
77239
|
-
}
|
|
77408
|
+
const speedCompare = compareSpeed(candidateObj.stats.spe, targetObj.stats.spe);
|
|
77409
|
+
const nameJa = candidateEntry.nameJa ?? candidateEntry.name;
|
|
77410
|
+
const pokemonProfile = {
|
|
77411
|
+
id: candidateEntry.id,
|
|
77412
|
+
name: candidateEntry.name,
|
|
77413
|
+
nameJa,
|
|
77414
|
+
types: [...candidateEntry.types],
|
|
77415
|
+
baseStats: { ...candidateEntry.baseStats },
|
|
77416
|
+
abilities: [...candidateEntry.abilities]
|
|
77417
|
+
};
|
|
77418
|
+
if (candidate.hasExplicitBuild) pokemonProfile.build = extractBuildInfo(candidateInput);
|
|
77240
77419
|
counterEntries.push({
|
|
77241
|
-
pokemon:
|
|
77242
|
-
|
|
77243
|
-
|
|
77244
|
-
|
|
77245
|
-
|
|
77246
|
-
|
|
77247
|
-
abilities: [...candidate.abilities]
|
|
77248
|
-
},
|
|
77249
|
-
strategy,
|
|
77250
|
-
score,
|
|
77251
|
-
details
|
|
77420
|
+
pokemon: pokemonProfile,
|
|
77421
|
+
speedCompare,
|
|
77422
|
+
outgoing,
|
|
77423
|
+
incoming,
|
|
77424
|
+
priorityMoves: buildPriorityMoves(candidateEntry.id),
|
|
77425
|
+
sortKey: buildSignature(candidate)
|
|
77252
77426
|
});
|
|
77253
77427
|
}
|
|
77254
77428
|
counterEntries.sort((a, b) => {
|
|
77255
|
-
|
|
77256
|
-
|
|
77429
|
+
const nameOrder = a.pokemon.name.localeCompare(b.pokemon.name);
|
|
77430
|
+
if (nameOrder !== 0) return nameOrder;
|
|
77431
|
+
return a.sortKey.localeCompare(b.sortKey);
|
|
77257
77432
|
});
|
|
77258
77433
|
const output = {
|
|
77259
77434
|
target: {
|
|
77260
77435
|
name: targetName,
|
|
77261
77436
|
nameJa: targetNameJa,
|
|
77262
77437
|
stats: targetStats,
|
|
77263
|
-
typeWeaknesses
|
|
77438
|
+
typeWeaknesses,
|
|
77439
|
+
priorityMoves: buildPriorityMoves(targetEntry.id)
|
|
77264
77440
|
},
|
|
77265
|
-
counters: counterEntries.
|
|
77441
|
+
counters: counterEntries.map(({ sortKey: _sortKey, ...rest }) => rest)
|
|
77266
77442
|
};
|
|
77267
77443
|
return { content: [{
|
|
77268
77444
|
type: "text",
|
|
@@ -77389,12 +77565,39 @@ function registerLearnsetTool(server) {
|
|
|
77389
77565
|
//#endregion
|
|
77390
77566
|
//#region src/tools/analysis/matchup.ts
|
|
77391
77567
|
const TOOL_NAME$12 = "analyze_matchup";
|
|
77392
|
-
const TOOL_DESCRIPTION$12 = "ポケモン2体の対面を分析する。双方向のダメージ計算と素早さ比較を行い、どちらが有利かを判断するためのデータを提供する。ポケモン対戦の対面判断に使用する。";
|
|
77568
|
+
const TOOL_DESCRIPTION$12 = "ポケモン2体の対面を分析する。双方向のダメージ計算と素早さ比較を行い、どちらが有利かを判断するためのデータを提供する。ポケモン対戦の対面判断に使用する。pokemon1Faster は静的な素早さ実数値のみの比較のため、素早さ負けでも先制技で逆転できる判断は pokemon{1,2}PriorityMoves を併用すること。正確な計算のため双方の ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。";
|
|
77393
77569
|
const matchupInputSchema = {
|
|
77394
77570
|
pokemon1: pokemonSchema.describe("ポケモン1"),
|
|
77395
77571
|
pokemon2: pokemonSchema.describe("ポケモン2"),
|
|
77396
77572
|
conditions: conditionsSchema.optional().describe("バトル条件")
|
|
77397
77573
|
};
|
|
77574
|
+
function resolveMoveForPriority(id) {
|
|
77575
|
+
return movesById.get(id);
|
|
77576
|
+
}
|
|
77577
|
+
function moveToJapanese(en) {
|
|
77578
|
+
return moveNameResolver.toJapanese(en);
|
|
77579
|
+
}
|
|
77580
|
+
function priorityMovesFor(resolvedName) {
|
|
77581
|
+
return extractPriorityMoves({
|
|
77582
|
+
learnsetMoveIds: championsLearnsets[toDataId(resolvedName)] ?? [],
|
|
77583
|
+
resolveMove: resolveMoveForPriority,
|
|
77584
|
+
toJapanese: moveToJapanese
|
|
77585
|
+
});
|
|
77586
|
+
}
|
|
77587
|
+
/**
|
|
77588
|
+
* 攻撃側タイプ配列から防御側タイプ配列への最大相性倍率を返す。
|
|
77589
|
+
* 攻撃側は自身のタイプ(種族タイプ)の技を出せる前提で、その中の最大値。
|
|
77590
|
+
* 将来的に selection-analysis 側と共通化する予定(#14 スコープ外)。
|
|
77591
|
+
*/
|
|
77592
|
+
function maxTypeMultiplier$1(attackerTypes, defenderTypes, gen) {
|
|
77593
|
+
let max = 0;
|
|
77594
|
+
const defenders = defenderTypes;
|
|
77595
|
+
for (const attackTypeName of attackerTypes) {
|
|
77596
|
+
const multiplier = calculateTypeEffectiveness(gen, attackTypeName, defenders);
|
|
77597
|
+
if (multiplier > max) max = multiplier;
|
|
77598
|
+
}
|
|
77599
|
+
return max;
|
|
77600
|
+
}
|
|
77398
77601
|
function registerMatchupTool(server) {
|
|
77399
77602
|
const calculator = new DamageCalculatorAdapter({
|
|
77400
77603
|
pokemon: pokemonNameResolver,
|
|
@@ -77409,16 +77612,21 @@ function registerMatchupTool(server) {
|
|
|
77409
77612
|
const { pokemon: p2, resolvedName: name2 } = calculator.createPokemonObject(args.pokemon2);
|
|
77410
77613
|
const nameJa1 = pokemonNameResolver.toJapanese(name1) ?? name1;
|
|
77411
77614
|
const nameJa2 = pokemonNameResolver.toJapanese(name2) ?? name2;
|
|
77412
|
-
const pokemon1Attacks = calculator.calculateAllMoves({
|
|
77615
|
+
const pokemon1Attacks = filterResultsByLearnset(calculator.calculateAllMoves({
|
|
77413
77616
|
attacker: args.pokemon1,
|
|
77414
77617
|
defender: args.pokemon2,
|
|
77415
77618
|
conditions: args.conditions
|
|
77416
|
-
});
|
|
77417
|
-
const pokemon2Attacks = calculator.calculateAllMoves({
|
|
77619
|
+
}), getLearnsetMoveIdSet(toDataId(name1)), toDataId);
|
|
77620
|
+
const pokemon2Attacks = filterResultsByLearnset(calculator.calculateAllMoves({
|
|
77418
77621
|
attacker: args.pokemon2,
|
|
77419
77622
|
defender: args.pokemon1,
|
|
77420
77623
|
conditions: args.conditions
|
|
77421
|
-
});
|
|
77624
|
+
}), getLearnsetMoveIdSet(toDataId(name2)), toDataId);
|
|
77625
|
+
const gen = calculator.getGen();
|
|
77626
|
+
const typeSummary = {
|
|
77627
|
+
p1ToP2MaxByPokemonType: maxTypeMultiplier$1(p1.types, p2.types, gen),
|
|
77628
|
+
p2ToP1MaxByPokemonType: maxTypeMultiplier$1(p2.types, p1.types, gen)
|
|
77629
|
+
};
|
|
77422
77630
|
const output = {
|
|
77423
77631
|
pokemon1: {
|
|
77424
77632
|
name: name1,
|
|
@@ -77432,7 +77640,10 @@ function registerMatchupTool(server) {
|
|
|
77432
77640
|
},
|
|
77433
77641
|
pokemon1Faster: compareSpeed(p1.stats.spe, p2.stats.spe) === "faster",
|
|
77434
77642
|
pokemon1Attacks,
|
|
77435
|
-
pokemon2Attacks
|
|
77643
|
+
pokemon2Attacks,
|
|
77644
|
+
pokemon1PriorityMoves: priorityMovesFor(name1),
|
|
77645
|
+
pokemon2PriorityMoves: priorityMovesFor(name2),
|
|
77646
|
+
typeSummary
|
|
77436
77647
|
};
|
|
77437
77648
|
return { content: [{
|
|
77438
77649
|
type: "text",
|
|
@@ -77559,14 +77770,12 @@ function registerNatureInfoTool(server) {
|
|
|
77559
77770
|
//#region src/tools/analysis/party-analysis.ts
|
|
77560
77771
|
const CHAMPIONS_GEN_NUM$7 = 0;
|
|
77561
77772
|
const TOOL_NAME$9 = "analyze_party_weakness";
|
|
77562
|
-
const TOOL_DESCRIPTION$9 = "
|
|
77773
|
+
const TOOL_DESCRIPTION$9 = "パーティ各メンバーのタイプ相性データを集計する。どのタイプが何匹の弱点か(teamWeaknesses)、どのタイプに抜群を取れないか(uncoveredTypes)を返す。致命性の判断は AI が文脈で行う前提。ポケモンチャンピオンズ対応。";
|
|
77563
77774
|
const partyAnalysisInputSchema = { party: z.array(pokemonSchema).describe("パーティメンバー") };
|
|
77564
77775
|
/** タイプ相性の倍率しきい値 */
|
|
77565
77776
|
const WEAKNESS_THRESHOLD$1 = 2;
|
|
77566
77777
|
const RESISTANCE_THRESHOLD = 1;
|
|
77567
77778
|
const IMMUNITY_THRESHOLD = 0;
|
|
77568
|
-
/** 致命的弱点とみなすための最低弱点数 */
|
|
77569
|
-
const CRITICAL_WEAKNESS_MIN_COUNT = 2;
|
|
77570
77779
|
/**
|
|
77571
77780
|
* ポケモン名を英語に解決する。
|
|
77572
77781
|
*/
|
|
@@ -77581,16 +77790,27 @@ function resolvePokemonName$2(name) {
|
|
|
77581
77790
|
/** ???タイプは計算対象から除外するためのマーカー */
|
|
77582
77791
|
const UNKNOWN_TYPE_NAME = "???";
|
|
77583
77792
|
/**
|
|
77793
|
+
* 日本語・英語のどちらの名前でも英語名に解決する。
|
|
77794
|
+
* 未知の名前は undefined を返し、呼び出し側で silent ignore する。
|
|
77795
|
+
*/
|
|
77796
|
+
function resolveOptionalName$1(resolver, name) {
|
|
77797
|
+
if (name === void 0) return void 0;
|
|
77798
|
+
const english = resolver.toEnglish(name);
|
|
77799
|
+
if (english !== void 0) return english;
|
|
77800
|
+
if (resolver.hasEnglishName(name)) return name;
|
|
77801
|
+
}
|
|
77802
|
+
/**
|
|
77584
77803
|
* ポケモンのタイプに対する各攻撃タイプの倍率を計算する。
|
|
77804
|
+
* 特性・もちものが指定されていれば相性補正を適用する。
|
|
77585
77805
|
*/
|
|
77586
|
-
function calculateTypeMatchups(pokemonTypes, gen) {
|
|
77806
|
+
function calculateTypeMatchups(pokemonTypes, gen, context = {}) {
|
|
77587
77807
|
const weaknesses = [];
|
|
77588
77808
|
const resistances = [];
|
|
77589
77809
|
const immunities = [];
|
|
77590
77810
|
const defenderTypes = pokemonTypes;
|
|
77591
77811
|
for (const attackType of gen.types) {
|
|
77592
77812
|
if (attackType.name === UNKNOWN_TYPE_NAME) continue;
|
|
77593
|
-
const multiplier = calculateTypeEffectiveness(gen, attackType.name, defenderTypes);
|
|
77813
|
+
const multiplier = applyDefensiveOverrides(calculateTypeEffectiveness(gen, attackType.name, defenderTypes), attackType.name, context);
|
|
77594
77814
|
if (multiplier === IMMUNITY_THRESHOLD) immunities.push(attackType.name);
|
|
77595
77815
|
else if (multiplier >= WEAKNESS_THRESHOLD$1) weaknesses.push({
|
|
77596
77816
|
type: attackType.name,
|
|
@@ -77634,7 +77854,6 @@ function registerPartyAnalysisTool(server) {
|
|
|
77634
77854
|
const gen = import_dist.Generations.get(CHAMPIONS_GEN_NUM$7);
|
|
77635
77855
|
const members = [];
|
|
77636
77856
|
const teamWeaknesses = {};
|
|
77637
|
-
const teamResistances = {};
|
|
77638
77857
|
const memberTypesList = [];
|
|
77639
77858
|
for (const member of args.party) {
|
|
77640
77859
|
const nameEn = resolvePokemonName$2(member.name);
|
|
@@ -77643,7 +77862,7 @@ function registerPartyAnalysisTool(server) {
|
|
|
77643
77862
|
const nameJa = entry.nameJa ?? entry.name;
|
|
77644
77863
|
const types = [...entry.types];
|
|
77645
77864
|
memberTypesList.push(types);
|
|
77646
|
-
const { weaknesses, resistances, immunities } = calculateTypeMatchups(types, gen);
|
|
77865
|
+
const { weaknesses, resistances, immunities } = calculateTypeMatchups(types, gen, { ability: resolveOptionalName$1(abilityNameResolver, member.ability) });
|
|
77647
77866
|
members.push({
|
|
77648
77867
|
name: entry.name,
|
|
77649
77868
|
nameJa,
|
|
@@ -77660,24 +77879,11 @@ function registerPartyAnalysisTool(server) {
|
|
|
77660
77879
|
teamWeaknesses[weakness.type].count += 1;
|
|
77661
77880
|
teamWeaknesses[weakness.type].members.push(entry.name);
|
|
77662
77881
|
}
|
|
77663
|
-
for (const resistance of resistances) teamResistances[resistance.type] = (teamResistances[resistance.type] ?? 0) + 1;
|
|
77664
|
-
for (const immuneType of immunities) teamResistances[immuneType] = (teamResistances[immuneType] ?? 0) + 1;
|
|
77665
77882
|
}
|
|
77666
|
-
const criticalWeaknesses = [];
|
|
77667
|
-
for (const [type, entry] of Object.entries(teamWeaknesses)) {
|
|
77668
|
-
const resistCount = teamResistances[type] ?? 0;
|
|
77669
|
-
if (entry.count >= CRITICAL_WEAKNESS_MIN_COUNT) criticalWeaknesses.push({
|
|
77670
|
-
type,
|
|
77671
|
-
weakCount: entry.count,
|
|
77672
|
-
resistCount
|
|
77673
|
-
});
|
|
77674
|
-
}
|
|
77675
|
-
criticalWeaknesses.sort((a, b) => b.weakCount - a.weakCount);
|
|
77676
77883
|
const output = {
|
|
77677
77884
|
members,
|
|
77678
77885
|
teamWeaknesses,
|
|
77679
|
-
uncoveredTypes: findUncoveredTypes(memberTypesList, gen)
|
|
77680
|
-
criticalWeaknesses
|
|
77886
|
+
uncoveredTypes: findUncoveredTypes(memberTypesList, gen)
|
|
77681
77887
|
};
|
|
77682
77888
|
return { content: [{
|
|
77683
77889
|
type: "text",
|
|
@@ -77698,10 +77904,16 @@ function registerPartyAnalysisTool(server) {
|
|
|
77698
77904
|
//#endregion
|
|
77699
77905
|
//#region src/tools/analysis/party-coverage.ts
|
|
77700
77906
|
const CHAMPIONS_GEN_NUM$6 = 0;
|
|
77907
|
+
/** 複合タイプを構成するタイプ数 */
|
|
77908
|
+
const DUAL_TYPE_COUNT = 2;
|
|
77909
|
+
/** 複合タイプ集合キーのセパレータ(タイプ名に現れない文字) */
|
|
77910
|
+
const DUAL_TYPE_KEY_SEPARATOR = "/";
|
|
77911
|
+
/** `dualTypeCoverage` の `examplePokemon` に収める最大件数 */
|
|
77912
|
+
const MAX_EXAMPLE_POKEMON = 3;
|
|
77701
77913
|
/** ステータス技(攻撃タイプから除外するため) */
|
|
77702
77914
|
const STATUS_CATEGORY$2 = "Status";
|
|
77703
77915
|
const TOOL_NAME$8 = "analyze_party_coverage";
|
|
77704
|
-
const TOOL_DESCRIPTION$8 = "パーティの攻撃カバレッジを分析する。各防御タイプ(18種)に対して、パーティのどの技が最も効果的かを算出し、抜群を取れないタイプを洗い出す。 `uncoveredTypes` は『抜群(>1 倍)を取れる技が 1 つも無い防御タイプ』を列挙する(等倍 1 倍も含む)。抜群倍率の内訳は `coverage[].maxMultiplier` を参照。 2
|
|
77916
|
+
const TOOL_DESCRIPTION$8 = "パーティの攻撃カバレッジを分析する。各防御タイプ(18種)に対して、パーティのどの技が最も効果的かを算出し、抜群を取れないタイプを洗い出す。 `uncoveredTypes` は『抜群(>1 倍)を取れる技が 1 つも無い防御タイプ』を列挙する(等倍 1 倍も含む)。抜群倍率の内訳は `coverage[].maxMultiplier` を参照。 実在する複合タイプ(データ内に 1 匹以上存在する 2 タイプ組合せ)に対するカバレッジは `dualTypeCoverage` を参照。抜群を取れない複合タイプ数は `dualTypeUncoveredCount`。 攻撃側のタイプ変換系特性(Pixilate 等)は単一/複合カバレッジ双方に反映される。 ポケモンチャンピオンズ対応。";
|
|
77705
77917
|
const inputSchema$7 = {
|
|
77706
77918
|
myParty: z.array(pokemonSchema).describe("自分のパーティ(moves 未指定時は learnset 内の全攻撃技を候補にする)"),
|
|
77707
77919
|
moves: z.record(z.string(), z.array(z.string())).optional().describe("ポケモン名(日本語 or 英語)をキーに技名配列を値とする map。省略時は learnset から全攻撃技を候補にする。")
|
|
@@ -77730,6 +77942,20 @@ function resolveAttackingMoveIds(pokemonEntry, explicitMoves) {
|
|
|
77730
77942
|
return moves;
|
|
77731
77943
|
}
|
|
77732
77944
|
/**
|
|
77945
|
+
* 日本語・英語のどちらの名前でも英語名に解決する。
|
|
77946
|
+
* 未知の名前は undefined を返し、呼び出し側で silent ignore する。
|
|
77947
|
+
*
|
|
77948
|
+
* 未知の特性文字列でエラーにしないのは、party_coverage が
|
|
77949
|
+
* 「構築入力を緩く受け取る」UX を取っているため。
|
|
77950
|
+
* 未知の特性は単に override なし扱いとする。
|
|
77951
|
+
*/
|
|
77952
|
+
function resolveOptionalName(resolver, name) {
|
|
77953
|
+
if (name === void 0) return void 0;
|
|
77954
|
+
const english = resolver.toEnglish(name);
|
|
77955
|
+
if (english !== void 0) return english;
|
|
77956
|
+
if (resolver.hasEnglishName(name)) return name;
|
|
77957
|
+
}
|
|
77958
|
+
/**
|
|
77733
77959
|
* ポケモン名を pokemon.json のエントリに解決する。
|
|
77734
77960
|
*/
|
|
77735
77961
|
function resolvePokemonEntry$2(name) {
|
|
@@ -77762,6 +77988,70 @@ function getEffectivenessForDefenderType(attackTypeName, defenderTypeName, gen)
|
|
|
77762
77988
|
return calculateTypeEffectiveness(gen, attackTypeName, [defenderTypeName]);
|
|
77763
77989
|
}
|
|
77764
77990
|
/**
|
|
77991
|
+
* 攻撃タイプ → 複合防御タイプへの倍率を計算する。
|
|
77992
|
+
*/
|
|
77993
|
+
function getEffectivenessForDualTypes(attackTypeName, defenderTypes, gen) {
|
|
77994
|
+
return calculateTypeEffectiveness(gen, attackTypeName, defenderTypes);
|
|
77995
|
+
}
|
|
77996
|
+
/**
|
|
77997
|
+
* 実在する複合タイプ(データ内に 1 匹以上存在するタイプ組合せ)の集合を構築する。
|
|
77998
|
+
* 対称性解消のため、キーは英名辞書順の 2 タイプを `/` で連結した文字列とする。
|
|
77999
|
+
*
|
|
78000
|
+
* `examplePokemon` 用の代表ポケモンも同時に収集する:
|
|
78001
|
+
* - メガ進化・リージョンフォーム等の派生フォーム(`baseSpecies !== null`)は後置し、
|
|
78002
|
+
* ベース種族を優先表示する(同じ実体の重複を避けるため)
|
|
78003
|
+
* - 同一優先度内では英名の辞書順で安定化
|
|
78004
|
+
* - 先頭 `MAX_EXAMPLE_POKEMON` 件を採用
|
|
78005
|
+
*/
|
|
78006
|
+
function buildRealDualTypeMap(pokemon) {
|
|
78007
|
+
const accumulator = /* @__PURE__ */ new Map();
|
|
78008
|
+
for (const entry of pokemon) {
|
|
78009
|
+
if (entry.types.length !== DUAL_TYPE_COUNT) continue;
|
|
78010
|
+
const sortedTypes = [...entry.types].sort((a, b) => a.localeCompare(b));
|
|
78011
|
+
const key = `${sortedTypes[0]}${DUAL_TYPE_KEY_SEPARATOR}${sortedTypes[1]}`;
|
|
78012
|
+
const existing = accumulator.get(key);
|
|
78013
|
+
if (existing === void 0) accumulator.set(key, {
|
|
78014
|
+
types: sortedTypes,
|
|
78015
|
+
entries: [entry]
|
|
78016
|
+
});
|
|
78017
|
+
else existing.entries.push(entry);
|
|
78018
|
+
}
|
|
78019
|
+
const result = /* @__PURE__ */ new Map();
|
|
78020
|
+
for (const [key, { types, entries }] of accumulator) {
|
|
78021
|
+
const examplePokemon = [...entries].sort((a, b) => {
|
|
78022
|
+
const aIsForme = a.baseSpecies !== null ? 1 : 0;
|
|
78023
|
+
const bIsForme = b.baseSpecies !== null ? 1 : 0;
|
|
78024
|
+
if (aIsForme !== bIsForme) return aIsForme - bIsForme;
|
|
78025
|
+
return a.name.localeCompare(b.name);
|
|
78026
|
+
}).slice(0, MAX_EXAMPLE_POKEMON).map((entry) => pokemonNameResolver.toJapanese(entry.name) ?? entry.name);
|
|
78027
|
+
result.set(key, {
|
|
78028
|
+
types,
|
|
78029
|
+
examplePokemon
|
|
78030
|
+
});
|
|
78031
|
+
}
|
|
78032
|
+
return result;
|
|
78033
|
+
}
|
|
78034
|
+
/**
|
|
78035
|
+
* 候補の attacker で `bestAttackers` を更新する共通ロジック。
|
|
78036
|
+
*
|
|
78037
|
+
* - `candidate.multiplier > currentMax` の場合は bestAttackers をクリアして入れ替え、新しい max を返す
|
|
78038
|
+
* - タイの場合は同一ポケモンが未登録であれば追加する(multiplier > 0 のときのみ、0 倍無効は列挙しない)
|
|
78039
|
+
* - それ以外は現状維持
|
|
78040
|
+
*
|
|
78041
|
+
* bestAttackers は in-place で更新する。maxMultiplier は戻り値として返す。
|
|
78042
|
+
*/
|
|
78043
|
+
function updateBestAttackers(currentMax, bestAttackers, candidate) {
|
|
78044
|
+
if (candidate.multiplier > currentMax) {
|
|
78045
|
+
bestAttackers.length = 0;
|
|
78046
|
+
bestAttackers.push(candidate);
|
|
78047
|
+
return candidate.multiplier;
|
|
78048
|
+
}
|
|
78049
|
+
if (candidate.multiplier === currentMax && candidate.multiplier > 0) {
|
|
78050
|
+
if (!bestAttackers.some((ba) => ba.pokemon === candidate.pokemon)) bestAttackers.push(candidate);
|
|
78051
|
+
}
|
|
78052
|
+
return currentMax;
|
|
78053
|
+
}
|
|
78054
|
+
/**
|
|
77765
78055
|
* パーティの攻撃カバレッジを計算する純関数。
|
|
77766
78056
|
* MCP tool handler からも直接テストからも呼び出せる。
|
|
77767
78057
|
*/
|
|
@@ -77772,8 +78062,17 @@ function analyzePartyCoverage(args) {
|
|
|
77772
78062
|
const attackingTypesSet = /* @__PURE__ */ new Set();
|
|
77773
78063
|
for (const member of args.myParty) {
|
|
77774
78064
|
const entry = resolvePokemonEntry$2(member.name);
|
|
77775
|
-
const
|
|
77776
|
-
|
|
78065
|
+
const rawAttackingMoves = resolveAttackingMoveIds(entry, movesMap.get(entry.id));
|
|
78066
|
+
const ability = resolveOptionalName(abilityNameResolver, member.ability);
|
|
78067
|
+
const attackingMoves = [];
|
|
78068
|
+
for (const move of rawAttackingMoves) {
|
|
78069
|
+
const effectiveType = applyOffensiveTypeOverride(move.type, move.category, ability);
|
|
78070
|
+
attackingTypesSet.add(effectiveType);
|
|
78071
|
+
attackingMoves.push({
|
|
78072
|
+
move,
|
|
78073
|
+
effectiveType
|
|
78074
|
+
});
|
|
78075
|
+
}
|
|
77777
78076
|
members.push({
|
|
77778
78077
|
entry,
|
|
77779
78078
|
attackingMoves
|
|
@@ -77791,23 +78090,15 @@ function analyzePartyCoverage(args) {
|
|
|
77791
78090
|
for (const defenderType of championsTypes) {
|
|
77792
78091
|
let maxMultiplier = 0;
|
|
77793
78092
|
const bestAttackers = [];
|
|
77794
|
-
for (const member of members) for (const move of member.attackingMoves) {
|
|
77795
|
-
const multiplier = getEffectivenessForDefenderType(
|
|
77796
|
-
|
|
77797
|
-
|
|
77798
|
-
|
|
77799
|
-
|
|
77800
|
-
|
|
77801
|
-
|
|
77802
|
-
|
|
77803
|
-
});
|
|
77804
|
-
} else if (multiplier === maxMultiplier && multiplier > 0) {
|
|
77805
|
-
if (!bestAttackers.some((ba) => ba.pokemon === member.entry.name)) bestAttackers.push({
|
|
77806
|
-
pokemon: member.entry.name,
|
|
77807
|
-
move: move.name,
|
|
77808
|
-
multiplier
|
|
77809
|
-
});
|
|
77810
|
-
}
|
|
78093
|
+
for (const member of members) for (const { move, effectiveType } of member.attackingMoves) {
|
|
78094
|
+
const multiplier = getEffectivenessForDefenderType(effectiveType, defenderType.name, gen);
|
|
78095
|
+
const attacker = {
|
|
78096
|
+
pokemon: member.entry.name,
|
|
78097
|
+
move: move.name,
|
|
78098
|
+
multiplier
|
|
78099
|
+
};
|
|
78100
|
+
if (effectiveType !== move.type) attacker.effectiveType = effectiveType;
|
|
78101
|
+
maxMultiplier = updateBestAttackers(maxMultiplier, bestAttackers, attacker);
|
|
77811
78102
|
}
|
|
77812
78103
|
coverage.push({
|
|
77813
78104
|
defenderType: defenderType.name,
|
|
@@ -77820,10 +78111,42 @@ function analyzePartyCoverage(args) {
|
|
|
77820
78111
|
nameJa: defenderType.nameJa
|
|
77821
78112
|
});
|
|
77822
78113
|
}
|
|
78114
|
+
const dualTypeMap = buildRealDualTypeMap(championsPokemon);
|
|
78115
|
+
const dualTypeCoverage = [];
|
|
78116
|
+
let dualTypeUncoveredCount = 0;
|
|
78117
|
+
for (const { types, examplePokemon } of dualTypeMap.values()) {
|
|
78118
|
+
let maxMultiplier = 0;
|
|
78119
|
+
const bestAttackers = [];
|
|
78120
|
+
for (const member of members) for (const { move, effectiveType } of member.attackingMoves) {
|
|
78121
|
+
const multiplier = getEffectivenessForDualTypes(effectiveType, types, gen);
|
|
78122
|
+
const attacker = {
|
|
78123
|
+
pokemon: member.entry.name,
|
|
78124
|
+
move: move.name,
|
|
78125
|
+
multiplier
|
|
78126
|
+
};
|
|
78127
|
+
if (effectiveType !== move.type) attacker.effectiveType = effectiveType;
|
|
78128
|
+
maxMultiplier = updateBestAttackers(maxMultiplier, bestAttackers, attacker);
|
|
78129
|
+
}
|
|
78130
|
+
dualTypeCoverage.push({
|
|
78131
|
+
defenderTypes: types,
|
|
78132
|
+
defenderTypesJa: [typeJaMap.get(types[0]) ?? types[0], typeJaMap.get(types[1]) ?? types[1]],
|
|
78133
|
+
maxMultiplier,
|
|
78134
|
+
bestAttackers,
|
|
78135
|
+
examplePokemon
|
|
78136
|
+
});
|
|
78137
|
+
if (maxMultiplier <= 1) dualTypeUncoveredCount += 1;
|
|
78138
|
+
}
|
|
78139
|
+
dualTypeCoverage.sort((a, b) => {
|
|
78140
|
+
if (a.maxMultiplier !== b.maxMultiplier) return a.maxMultiplier - b.maxMultiplier;
|
|
78141
|
+
if (a.defenderTypes[0] !== b.defenderTypes[0]) return a.defenderTypes[0].localeCompare(b.defenderTypes[0]);
|
|
78142
|
+
return a.defenderTypes[1].localeCompare(b.defenderTypes[1]);
|
|
78143
|
+
});
|
|
77823
78144
|
return {
|
|
77824
78145
|
attackingTypes,
|
|
77825
78146
|
coverage,
|
|
77826
|
-
uncoveredTypes
|
|
78147
|
+
uncoveredTypes,
|
|
78148
|
+
dualTypeCoverage,
|
|
78149
|
+
dualTypeUncoveredCount
|
|
77827
78150
|
};
|
|
77828
78151
|
}
|
|
77829
78152
|
function registerPartyCoverageTool(server) {
|
|
@@ -78463,20 +78786,8 @@ function registerSearchByTypeEffectivenessTool(server) {
|
|
|
78463
78786
|
//#endregion
|
|
78464
78787
|
//#region src/tools/analysis/selection-analysis.ts
|
|
78465
78788
|
const CHAMPIONS_GEN_NUM$3 = 0;
|
|
78466
|
-
/** 選出推奨のトップ N 件 */
|
|
78467
|
-
const RECOMMENDATION_TOP_N = 3;
|
|
78468
|
-
/** 各スコアの重み */
|
|
78469
|
-
const SCORE_WEIGHT_SPEED_WIN = 2;
|
|
78470
|
-
const SCORE_WEIGHT_TYPE_ADVANTAGE = 3;
|
|
78471
|
-
const SCORE_WEIGHT_DAMAGE_ADVANTAGE = 5;
|
|
78472
|
-
const SCORE_WEIGHT_TYPE_DISADVANTAGE = -1;
|
|
78473
|
-
/** ダメージ閾値(%表記) */
|
|
78474
|
-
const OHKO_PERCENT_THRESHOLD = 100;
|
|
78475
|
-
const TWO_HKO_PERCENT_THRESHOLD = 50;
|
|
78476
|
-
/** タイプ抜群判定のしきい値 */
|
|
78477
|
-
const SUPER_EFFECTIVE_THRESHOLD = 2;
|
|
78478
78789
|
const TOOL_NAME$3 = "analyze_selection";
|
|
78479
|
-
const TOOL_DESCRIPTION$3 = "
|
|
78790
|
+
const TOOL_DESCRIPTION$3 = "6v6 パーティ間の全対面(最大 36 エントリ)について、タイプ相性・素早さ比較・最大ダメージ見積もりをマトリクスで返す。選出判断は本ツールが返すデータを元に AI が総合的に行う前提で、ツール側では推奨やスコアリングは行わない。ポケモンチャンピオンズ対応。正確な計算のため各ポケモンの ability / item の指定を推奨(省略時は通常特性・持ち物なし扱い)。";
|
|
78480
78791
|
const inputSchema$2 = {
|
|
78481
78792
|
myParty: z.array(pokemonSchema).describe("自分のパーティ"),
|
|
78482
78793
|
opponentParty: z.array(pokemonSchema).describe("相手のパーティ"),
|
|
@@ -78512,45 +78823,13 @@ function bestDamageEstimate(results, moveJaResolver) {
|
|
|
78512
78823
|
move: {
|
|
78513
78824
|
name: best.move,
|
|
78514
78825
|
nameJa
|
|
78515
|
-
}
|
|
78826
|
+
},
|
|
78827
|
+
typeMultiplier: best.typeMultiplier,
|
|
78828
|
+
isStab: best.isStab,
|
|
78829
|
+
effectivePowerMultiplier: best.effectivePowerMultiplier
|
|
78516
78830
|
};
|
|
78517
78831
|
}
|
|
78518
78832
|
/**
|
|
78519
|
-
* ポケモンの対面スコア(選出推奨用)を計算する。
|
|
78520
|
-
* 大きいほど対面に強い。
|
|
78521
|
-
*/
|
|
78522
|
-
function calcMatchupScore(entry) {
|
|
78523
|
-
let score = 0;
|
|
78524
|
-
if (entry.speedCompare === "faster") score += SCORE_WEIGHT_SPEED_WIN;
|
|
78525
|
-
else if (entry.speedCompare === "slower") score -= SCORE_WEIGHT_SPEED_WIN;
|
|
78526
|
-
if (entry.typeAdvantage.myToOpp >= SUPER_EFFECTIVE_THRESHOLD) score += SCORE_WEIGHT_TYPE_ADVANTAGE;
|
|
78527
|
-
if (entry.typeAdvantage.oppToMy >= SUPER_EFFECTIVE_THRESHOLD) score += SCORE_WEIGHT_TYPE_DISADVANTAGE;
|
|
78528
|
-
if (entry.damageEstimate !== null) {
|
|
78529
|
-
if (entry.damageEstimate.max >= OHKO_PERCENT_THRESHOLD) score += SCORE_WEIGHT_DAMAGE_ADVANTAGE;
|
|
78530
|
-
else if (entry.damageEstimate.max >= TWO_HKO_PERCENT_THRESHOLD) score += SCORE_WEIGHT_DAMAGE_ADVANTAGE / 2;
|
|
78531
|
-
}
|
|
78532
|
-
return score;
|
|
78533
|
-
}
|
|
78534
|
-
/**
|
|
78535
|
-
* あるポケモンの「合計スコア」を、相手パーティ全員に対するスコア和として算出する。
|
|
78536
|
-
*/
|
|
78537
|
-
function calcTotalScoreForAttacker(attackerName, matrix) {
|
|
78538
|
-
let total = 0;
|
|
78539
|
-
for (const entry of matrix) if (entry.mine === attackerName) total += calcMatchupScore(entry);
|
|
78540
|
-
return total;
|
|
78541
|
-
}
|
|
78542
|
-
/**
|
|
78543
|
-
* 上位 N 件のポケモン名(日本語名)を返す。
|
|
78544
|
-
*/
|
|
78545
|
-
function topPokemonByScore(myParty, scorer, topN) {
|
|
78546
|
-
const scored = myParty.map((p) => ({
|
|
78547
|
-
nameJa: p.nameJa,
|
|
78548
|
-
score: scorer(p.name)
|
|
78549
|
-
}));
|
|
78550
|
-
scored.sort((a, b) => b.score - a.score);
|
|
78551
|
-
return scored.slice(0, topN).map((s) => s.nameJa);
|
|
78552
|
-
}
|
|
78553
|
-
/**
|
|
78554
78833
|
* ポケモンごとの候補技を英名リストに正規化する(日本語 → 英語)。
|
|
78555
78834
|
*/
|
|
78556
78835
|
function resolveMovesMap(moves) {
|
|
@@ -78567,8 +78846,11 @@ function resolveMovesMap(moves) {
|
|
|
78567
78846
|
/**
|
|
78568
78847
|
* attacker vs defender の候補技でダメージを計算する。
|
|
78569
78848
|
* movesMap に指定があればそれを、無ければ全技で計算する。
|
|
78849
|
+
* movesMap 未指定経路では attacker の learnset でフィルタし、覚えない技での過大評価を避ける。
|
|
78850
|
+
* 明示指定経路は learnset フィルタを掛けない(ユーザーの明示選択を尊重する既存仕様を維持)。
|
|
78851
|
+
* conditions (battleFormat 等) を calculator に伝える。
|
|
78570
78852
|
*/
|
|
78571
|
-
function calculateDamageForMatchup(calculator, attacker, defender, attackerId, movesMap) {
|
|
78853
|
+
function calculateDamageForMatchup(calculator, attacker, defender, attackerId, attackerLearnsetIds, movesMap, conditions) {
|
|
78572
78854
|
const explicitMoves = movesMap.get(attackerId);
|
|
78573
78855
|
if (explicitMoves !== void 0 && explicitMoves.length > 0) {
|
|
78574
78856
|
const results = [];
|
|
@@ -78576,16 +78858,18 @@ function calculateDamageForMatchup(calculator, attacker, defender, attackerId, m
|
|
|
78576
78858
|
results.push(calculator.calculate({
|
|
78577
78859
|
attacker,
|
|
78578
78860
|
defender,
|
|
78579
|
-
moveName
|
|
78861
|
+
moveName,
|
|
78862
|
+
conditions
|
|
78580
78863
|
}));
|
|
78581
78864
|
} catch {}
|
|
78582
78865
|
results.sort((a, b) => b.max - a.max);
|
|
78583
78866
|
return results;
|
|
78584
78867
|
}
|
|
78585
|
-
return calculator.calculateAllMoves({
|
|
78868
|
+
return filterResultsByLearnset(calculator.calculateAllMoves({
|
|
78586
78869
|
attacker,
|
|
78587
|
-
defender
|
|
78588
|
-
|
|
78870
|
+
defender,
|
|
78871
|
+
conditions
|
|
78872
|
+
}), attackerLearnsetIds, toDataId);
|
|
78589
78873
|
}
|
|
78590
78874
|
function registerSelectionAnalysisTool(server) {
|
|
78591
78875
|
const calculator = new DamageCalculatorAdapter({
|
|
@@ -78599,15 +78883,24 @@ function registerSelectionAnalysisTool(server) {
|
|
|
78599
78883
|
try {
|
|
78600
78884
|
const gen = import_dist.Generations.get(CHAMPIONS_GEN_NUM$3);
|
|
78601
78885
|
const movesMap = resolveMovesMap(args.moves);
|
|
78886
|
+
const damageConditions = { battleFormat: args.battleFormat };
|
|
78602
78887
|
function buildMemberContext(input) {
|
|
78603
78888
|
const { pokemon, resolvedName } = calculator.createPokemonObject(input);
|
|
78604
|
-
const
|
|
78889
|
+
const entryId = toDataId(resolvedName);
|
|
78890
|
+
const entry = pokemonById.get(entryId);
|
|
78891
|
+
const nameJa = pokemonNameResolver.toJapanese(resolvedName) ?? resolvedName;
|
|
78892
|
+
const types = entry !== void 0 ? [...entry.types] : [...pokemon.types];
|
|
78893
|
+
const priorityMoves = extractPriorityMoves({
|
|
78894
|
+
learnsetMoveIds: championsLearnsets[entryId] ?? [],
|
|
78895
|
+
resolveMove: (id) => movesById.get(id),
|
|
78896
|
+
toJapanese: (enName) => moveNameResolver.toJapanese(enName)
|
|
78897
|
+
});
|
|
78605
78898
|
return {
|
|
78606
78899
|
input,
|
|
78607
78900
|
profile: {
|
|
78608
78901
|
name: resolvedName,
|
|
78609
|
-
nameJa
|
|
78610
|
-
types
|
|
78902
|
+
nameJa,
|
|
78903
|
+
types,
|
|
78611
78904
|
actualStats: {
|
|
78612
78905
|
hp: pokemon.stats.hp,
|
|
78613
78906
|
atk: pokemon.stats.atk,
|
|
@@ -78615,13 +78908,16 @@ function registerSelectionAnalysisTool(server) {
|
|
|
78615
78908
|
spa: pokemon.stats.spa,
|
|
78616
78909
|
spd: pokemon.stats.spd,
|
|
78617
78910
|
spe: pokemon.stats.spe
|
|
78618
|
-
}
|
|
78911
|
+
},
|
|
78912
|
+
priorityMoves
|
|
78619
78913
|
},
|
|
78620
|
-
entryId
|
|
78914
|
+
entryId
|
|
78621
78915
|
};
|
|
78622
78916
|
}
|
|
78623
78917
|
const myMembers = args.myParty.map(buildMemberContext);
|
|
78624
78918
|
const oppMembers = args.opponentParty.map(buildMemberContext);
|
|
78919
|
+
const myLearnsetIds = /* @__PURE__ */ new Map();
|
|
78920
|
+
for (const mine of myMembers) myLearnsetIds.set(mine.entryId, getLearnsetMoveIdSet(mine.entryId));
|
|
78625
78921
|
const matrix = [];
|
|
78626
78922
|
for (const mine of myMembers) for (const opp of oppMembers) {
|
|
78627
78923
|
const myToOpp = maxTypeMultiplier(mine.profile.types, opp.profile.types, gen);
|
|
@@ -78629,7 +78925,7 @@ function registerSelectionAnalysisTool(server) {
|
|
|
78629
78925
|
const speedCompare = compareSpeed(mine.profile.actualStats.spe, opp.profile.actualStats.spe);
|
|
78630
78926
|
let damageEstimate = null;
|
|
78631
78927
|
try {
|
|
78632
|
-
damageEstimate = bestDamageEstimate(calculateDamageForMatchup(calculator, mine.input, opp.input, mine.entryId, movesMap), (enName) => moveNameResolver.toJapanese(enName));
|
|
78928
|
+
damageEstimate = bestDamageEstimate(calculateDamageForMatchup(calculator, mine.input, opp.input, mine.entryId, myLearnsetIds.get(mine.entryId) ?? /* @__PURE__ */ new Set(), movesMap, damageConditions), (enName) => moveNameResolver.toJapanese(enName));
|
|
78633
78929
|
} catch {
|
|
78634
78930
|
damageEstimate = null;
|
|
78635
78931
|
}
|
|
@@ -78644,26 +78940,10 @@ function registerSelectionAnalysisTool(server) {
|
|
|
78644
78940
|
damageEstimate
|
|
78645
78941
|
});
|
|
78646
78942
|
}
|
|
78647
|
-
const leadScorer = (name) => calcTotalScoreForAttacker(name, matrix);
|
|
78648
|
-
const lead = topPokemonByScore(myMembers.map((m) => m.profile), leadScorer, RECOMMENDATION_TOP_N);
|
|
78649
|
-
const pivotScorer = (name) => {
|
|
78650
|
-
let total = 0;
|
|
78651
|
-
for (const entry of matrix) {
|
|
78652
|
-
if (entry.mine !== name) continue;
|
|
78653
|
-
if (entry.typeAdvantage.oppToMy < 1) total += 1;
|
|
78654
|
-
if (entry.speedCompare === "slower") total -= .5;
|
|
78655
|
-
}
|
|
78656
|
-
return total;
|
|
78657
|
-
};
|
|
78658
|
-
const pivot = topPokemonByScore(myMembers.map((m) => m.profile), pivotScorer, RECOMMENDATION_TOP_N);
|
|
78659
78943
|
const output = {
|
|
78660
78944
|
myParty: myMembers.map((m) => m.profile),
|
|
78661
78945
|
opponentParty: oppMembers.map((m) => m.profile),
|
|
78662
78946
|
matchupMatrix: matrix,
|
|
78663
|
-
recommendations: {
|
|
78664
|
-
lead,
|
|
78665
|
-
pivot
|
|
78666
|
-
},
|
|
78667
78947
|
battleFormat: args.battleFormat
|
|
78668
78948
|
};
|
|
78669
78949
|
return { content: [{
|