getcompetitive 1.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.
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Team synergy analysis: defensive weakness stacking, offensive type coverage,
3
+ * and speed placement against a regulation roster. Pure type/list math over the
4
+ * existing dataset — no external data source.
5
+ */
6
+ import { z } from 'zod';
7
+ import { getDex, typeEffectiveness, TYPES18 } from '../dex.js';
8
+ import { getRegulationSet } from '../regulations.js';
9
+ import { ok, wrap, requireExists, READ_ONLY_ANNOTATIONS } from '../result.js';
10
+ export function registerAnalyzeTools(server) {
11
+ server.registerTool('analyze_team', {
12
+ title: 'Analyze team synergy',
13
+ description: 'Analyze a whole team\u2019s type synergy: per-type weak, resist, and immune counts with the types at risk, super-effective coverage from STAB, Tera type and supplied moves, speed placement, and a transparent 0-100 heuristic score \u2014 a quick signal, not a metagame rating. Use `type_chart` or `get_type` for one matchup. Each entry is a `species` with optional `teraType` and `moves`; unknown moves are collected into `unknownMoves`, unknown species or Tera types error, and `regulation` (e.g. "m-c") adds legal threats that outspeed your fastest member. Read-only and offline over the bundled dataset.',
14
+ annotations: READ_ONLY_ANNOTATIONS,
15
+ inputSchema: {
16
+ team: z
17
+ .array(z.object({
18
+ species: z.string().describe('Species name as it appears in Showdown, e.g. "Incineroar", "Garchomp".'),
19
+ teraType: z
20
+ .string()
21
+ .optional()
22
+ .describe('Optional Tera type, e.g. "Steel"; when set it replaces the member\u2019s defensive typing in the weakness tally.'),
23
+ moves: z
24
+ .array(z.string())
25
+ .optional()
26
+ .describe('Optional move names, e.g. ["Knock Off"]; their types widen offensive coverage. Unknown names are reported, not fatal.'),
27
+ }))
28
+ .min(1)
29
+ .max(6)
30
+ .describe('Team of up to 6 members, each a species with optional Tera type and moves.'),
31
+ regulation: z
32
+ .string()
33
+ .optional()
34
+ .describe('Optional regulation set id, e.g. "m-c"; when given, the reply also lists legal threats whose base speed beats your fastest member. Unknown ids return an isError.'),
35
+ },
36
+ outputSchema: {
37
+ team: z
38
+ .array(z.object({
39
+ species: z.string().describe('Resolved species name, e.g. "Great Tusk".'),
40
+ types: z.array(z.string()).describe('The species\u2019 types as the dataset defines them, e.g. ["Ground", "Fighting"].'),
41
+ teraType: z
42
+ .string()
43
+ .optional()
44
+ .describe('Tera type supplied for this member; when set it replaces the member\u2019s typing defensively and is added to its attacking types. Absent when none was given.'),
45
+ baseSpe: z.number().int().describe('Base Speed stat of the species, used for the speed placement below.'),
46
+ moveTypes: z
47
+ .array(z.string())
48
+ .describe('Types of the supplied moves that were recognised, e.g. ["Dark"]; unrecognised move names are left out here and listed in `unknownMoves`.'),
49
+ }))
50
+ .describe('The analysed team in the order it was supplied, each member with the typing actually used for the analysis.'),
51
+ defensiveWeaknesses: z
52
+ .record(z.string(), z.object({
53
+ weak: z.number().int().describe('How many members take super-effective damage from this attacking type.'),
54
+ resist: z.number().int().describe('How many members resist it (damage below neutral).'),
55
+ immune: z.number().int().describe('How many members are immune to it.'),
56
+ weakBy: z.array(z.string()).describe('Species names of the members weak to it, in team order; empty when none are.'),
57
+ }))
58
+ .describe('One entry for each of the 18 classic types (keyed by type name, e.g. "Fire"), tallying how the team fares defensively against that type. A member is counted on its Tera type instead of its own types when a Tera type was supplied.'),
59
+ atRiskTypes: z
60
+ .array(z.string())
61
+ .describe('The stacked-weakness types: at least two members weak to it and nobody resisting or immune. Empty means no such hole.'),
62
+ offensiveCoverage: z
63
+ .object({
64
+ coveredBy: z
65
+ .record(z.string(), z.array(z.string()))
66
+ .describe('One entry for each of the 18 classic types (keyed by the defending type), listing the team members that hit it super-effectively from STAB, Tera type, or a supplied move type; an empty array means nobody does.'),
67
+ uncoveredSuperEffectively: z.array(z.string()).describe('Defending types no member hits super-effectively.'),
68
+ note: z.string().describe('Reminder of which attacking types this coverage was computed from.'),
69
+ })
70
+ .describe('Super-effective coverage of all 18 defending types.'),
71
+ speed: z
72
+ .object({
73
+ fastest: z
74
+ .object({
75
+ species: z.string().describe('Species name of the team\u2019s fastest member by base Speed.'),
76
+ baseSpe: z.number().int().describe('Its base Speed stat.'),
77
+ })
78
+ .describe('The fastest member of the team.'),
79
+ slowest: z
80
+ .object({
81
+ species: z.string().describe('Species name of the team\u2019s slowest member by base Speed.'),
82
+ baseSpe: z.number().int().describe('Its base Speed stat.'),
83
+ })
84
+ .describe('The slowest member of the team.'),
85
+ regulation: z
86
+ .string()
87
+ .optional()
88
+ .describe('Display name of the regulation that was checked; present only when `regulation` was supplied.'),
89
+ fasterThreatCount: z
90
+ .number()
91
+ .int()
92
+ .optional()
93
+ .describe('How many legal species outspeed the fastest member; present only when `regulation` was supplied.'),
94
+ fasterThreats: z
95
+ .array(z.object({
96
+ species: z.string().describe('Legal species name.'),
97
+ baseSpe: z.number().int().describe('Its base Speed stat, higher than the team\u2019s fastest.'),
98
+ }))
99
+ .optional()
100
+ .describe('Up to 20 of those threats, fastest first, cut off at that limit; present only when `regulation` was supplied — compare with `fasterThreatCount` for the full total.'),
101
+ note: z
102
+ .string()
103
+ .optional()
104
+ .describe('Caveat that threats are base-speed comparisons only; present only when `regulation` was supplied.'),
105
+ })
106
+ .describe('Where the team sits on the speed spectrum, plus legal faster threats when a regulation was given.'),
107
+ score: z
108
+ .object({
109
+ overall: z.number().int().describe('Rounded mean of the component scores, 0-100.'),
110
+ defensive: z.number().int().describe('0-100 score penalising stacked weaknesses, floored at 0.'),
111
+ coverage: z.number().int().describe('0-100 share of the 18 types the team hits super-effectively.'),
112
+ speed: z
113
+ .number()
114
+ .int()
115
+ .optional()
116
+ .describe('0-100 score dropping 2 points per legal faster threat; present only when `regulation` was supplied.'),
117
+ note: z.string().describe('What each component means and the reminder that this is a heuristic, not a metagame rating.'),
118
+ })
119
+ .describe('Transparent heuristic 0-100 scoring of the team.'),
120
+ unknownMoves: z
121
+ .array(z.string())
122
+ .optional()
123
+ .describe('Deduplicated move names that were not found in the dataset and so contributed no coverage; omitted entirely when every move resolved.'),
124
+ },
125
+ }, wrap(async (args) => {
126
+ const dex = getDex(9);
127
+ const set = args.regulation ? getRegulationSet(args.regulation) : undefined;
128
+ if (args.regulation && !set) {
129
+ throw new Error(`Unknown regulation set "${args.regulation}".`);
130
+ }
131
+ const members = [];
132
+ const unknownMoves = [];
133
+ for (const entry of args.team) {
134
+ const sp = dex.species.get(entry.species);
135
+ requireExists(sp, 'Pokemon species', entry.species);
136
+ const moveTypes = [];
137
+ for (const mv of entry.moves ?? []) {
138
+ const m = dex.moves.get(mv);
139
+ if (m.exists)
140
+ moveTypes.push(m.type);
141
+ else
142
+ unknownMoves.push(mv);
143
+ }
144
+ if (entry.teraType && !dex.types.get(entry.teraType).exists) {
145
+ throw new Error(`Unknown Tera type "${entry.teraType}".`);
146
+ }
147
+ members.push({
148
+ species: sp.name,
149
+ types: [...sp.types],
150
+ teraType: entry.teraType,
151
+ baseSpe: sp.baseStats.spe,
152
+ moveTypes,
153
+ });
154
+ }
155
+ // --- Defensive weakness stacking ---
156
+ const defensive = {};
157
+ for (const t of TYPES18) {
158
+ let weak = 0;
159
+ let resist = 0;
160
+ let immune = 0;
161
+ const weakBy = [];
162
+ for (const m of members) {
163
+ // Tera replaces defensive typing entirely.
164
+ const defTypes = m.teraType ? [m.teraType] : m.types;
165
+ const eff = typeEffectiveness(t, defTypes, 9);
166
+ if (eff === 0)
167
+ immune++;
168
+ else if (eff > 1) {
169
+ weak++;
170
+ weakBy.push(m.species);
171
+ }
172
+ else if (eff < 1)
173
+ resist++;
174
+ }
175
+ defensive[t] = { weak, resist, immune, weakBy };
176
+ }
177
+ const atRisk = TYPES18.filter((t) => defensive[t].weak >= 2 && defensive[t].resist + defensive[t].immune === 0);
178
+ // --- Offensive super-effective coverage ---
179
+ const coverage = {};
180
+ const uncovered = [];
181
+ for (const def of TYPES18) {
182
+ const hitters = [];
183
+ for (const m of members) {
184
+ const atkTypes = new Set([...m.types, ...m.moveTypes]);
185
+ if (m.teraType)
186
+ atkTypes.add(m.teraType);
187
+ for (const atk of atkTypes) {
188
+ if (typeEffectiveness(atk, [def], 9) > 1) {
189
+ hitters.push(m.species);
190
+ break;
191
+ }
192
+ }
193
+ }
194
+ coverage[def] = hitters;
195
+ if (hitters.length === 0)
196
+ uncovered.push(def);
197
+ }
198
+ // --- Speed placement ---
199
+ const teamSpeeds = members.map((m) => ({ species: m.species, baseSpe: m.baseSpe }));
200
+ const fastest = [...teamSpeeds].sort((a, b) => b.baseSpe - a.baseSpe)[0];
201
+ const slowest = [...teamSpeeds].sort((a, b) => a.baseSpe - b.baseSpe)[0];
202
+ let fasterThreats = [];
203
+ if (set) {
204
+ const threshold = fastest.baseSpe;
205
+ for (const name of set.eligibleSpecies) {
206
+ const s = dex.species.get(name);
207
+ if (!s.exists)
208
+ continue;
209
+ if (s.baseStats.spe > threshold)
210
+ fasterThreats.push({ species: s.name, baseSpe: s.baseStats.spe });
211
+ }
212
+ fasterThreats.sort((a, b) => b.baseSpe - a.baseSpe);
213
+ }
214
+ // Transparent heuristic score — a quick signal, not a metagame rating.
215
+ const coverageScore = Math.round(((TYPES18.length - uncovered.length) / TYPES18.length) * 100);
216
+ let defensiveScore = 100;
217
+ for (const t of TYPES18) {
218
+ const w = defensive[t].weak;
219
+ if (w >= 4)
220
+ defensiveScore -= 40;
221
+ else if (w >= 3)
222
+ defensiveScore -= 25;
223
+ else if (w >= 2)
224
+ defensiveScore -= 12;
225
+ }
226
+ defensiveScore = Math.max(0, defensiveScore);
227
+ const speedScore = set ? Math.max(0, 100 - fasterThreats.length * 2) : undefined;
228
+ const parts = [defensiveScore, coverageScore, ...(speedScore !== undefined ? [speedScore] : [])];
229
+ const overall = Math.round(parts.reduce((a, b) => a + b, 0) / parts.length);
230
+ return ok({
231
+ team: members.map((m) => ({
232
+ species: m.species,
233
+ types: m.types,
234
+ teraType: m.teraType,
235
+ baseSpe: m.baseSpe,
236
+ moveTypes: m.moveTypes,
237
+ })),
238
+ defensiveWeaknesses: defensive,
239
+ atRiskTypes: atRisk,
240
+ offensiveCoverage: {
241
+ coveredBy: coverage,
242
+ uncoveredSuperEffectively: uncovered,
243
+ note: 'Coverage is computed from STAB types, Tera type, and any provided move types.',
244
+ },
245
+ speed: {
246
+ fastest,
247
+ slowest,
248
+ ...(set
249
+ ? {
250
+ regulation: set.name,
251
+ fasterThreatCount: fasterThreats.length,
252
+ fasterThreats: fasterThreats.slice(0, 20),
253
+ note: 'Threats are base-speed comparisons; EVs, natures, and Choice Scarf shift real speed tiers.',
254
+ }
255
+ : {}),
256
+ },
257
+ score: {
258
+ overall,
259
+ defensive: defensiveScore,
260
+ coverage: coverageScore,
261
+ ...(speedScore !== undefined ? { speed: speedScore } : {}),
262
+ note: 'Heuristic 0-100: defensive = penalty for stacked weaknesses; coverage = % of 18 types hit super-effectively; speed = penalty for faster legal threats. Not a metagame rating.',
263
+ },
264
+ ...(unknownMoves.length ? { unknownMoves: [...new Set(unknownMoves)] } : {}),
265
+ });
266
+ }));
267
+ }
268
+ //# sourceMappingURL=analyze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../src/tools/analyze.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,+lBAA+lB;QACjmB,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;iBACJ,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;gBACP,OAA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