diff --git a/anon/src/index.ts b/anon/src/index.ts index 1bb54b1..5b8c2d3 100644 --- a/anon/src/index.ts +++ b/anon/src/index.ts @@ -177,7 +177,8 @@ function anonymize( const buf = `|${a.join('|')}`; const kws: string[] = []; for (const k in kwArgs) { - let v = kwArgs[k as keyof typeof kwArgs] as string; + let v = kwArgs[k as keyof typeof kwArgs] as any; + if (k === 'of') { v = anonymizePokemon(v as PokemonIdent, pokemonMap); } else if (k === 'spread') { @@ -185,7 +186,7 @@ function anonymize( v = v.split(',').map((s: string | PokemonIdent) => IDENT.test(s) ? anonymizePokemon(s as PokemonIdent, pokemonMap) : s).join(','); } - kws.push(`[${k}] ${v}`); + kws.push(v === true ? `[${k}]` : `[${k}] ${v}`); } return kws.length ? `${buf}|${kws.join('|')}` : buf; }; diff --git a/anon/src/testdata/anon.json b/anon/src/testdata/anon.json index 8ed15e8..3348dc9 100644 --- a/anon/src/testdata/anon.json +++ b/anon/src/testdata/anon.json @@ -425,7 +425,7 @@ "|-unboost|p2a: Rayquaza|spd|1", "|faint|p1a: Darmanitan", "|", - "|-weather|DeltaStream|[upkeep] true", + "|-weather|DeltaStream|[upkeep]", "|upkeep", "|", "|switch|p1a: Zygarde|Zygarde|100/100", @@ -443,7 +443,7 @@ "|", "|-activate|p1a: Zygarde|ability: Power Construct|", "|detailschange|p1a: Zygarde|Zygarde-Complete", - "|-heal|p1a: Zygarde|62/100|[silent] true", + "|-heal|p1a: Zygarde|62/100|[silent]", "|upkeep", "|turn|3", "|", @@ -483,7 +483,7 @@ "|-damage|p1a: Dugtrio|21/100", "|-hitcount|p1a: Dugtrio|2", "|-damage|p2a: Greninja|71/100|[from] item: Life Orb", - "|move|p1a: Dugtrio|Sucker Punch||[still] true", + "|move|p1a: Dugtrio|Sucker Punch||[still]", "|-fail|p1a: Dugtrio", "|", "|upkeep", @@ -566,7 +566,7 @@ "|", "|move|p1a: Shaymin|Hidden Power|p2a: Ditto", "|-damage|p2a: Ditto|79/100", - "|move|p2a: Ditto|Play Rough|p1a: Shaymin|[miss] true", + "|move|p2a: Ditto|Play Rough|p1a: Shaymin|[miss]", "|-miss|p2a: Ditto|p1a: Shaymin", "|", "|upkeep", diff --git a/anon/src/testdata/salt.json b/anon/src/testdata/salt.json index b895e22..e3869e7 100644 --- a/anon/src/testdata/salt.json +++ b/anon/src/testdata/salt.json @@ -425,7 +425,7 @@ "|-unboost|p2a: 64bd07b346|spd|1", "|faint|p1a: 544459d148", "|", - "|-weather|DeltaStream|[upkeep] true", + "|-weather|DeltaStream|[upkeep]", "|upkeep", "|", "|switch|p1a: ad9358a773|Zygarde|100/100", @@ -443,7 +443,7 @@ "|", "|-activate|p1a: ad9358a773|ability: Power Construct|", "|detailschange|p1a: ad9358a773|Zygarde-Complete", - "|-heal|p1a: ad9358a773|62/100|[silent] true", + "|-heal|p1a: ad9358a773|62/100|[silent]", "|upkeep", "|turn|3", "|", @@ -483,7 +483,7 @@ "|-damage|p1a: 8db0521bcb|21/100", "|-hitcount|p1a: 8db0521bcb|2", "|-damage|p2a: d677adb2c9|71/100|[from] item: Life Orb", - "|move|p1a: 8db0521bcb|Sucker Punch||[still] true", + "|move|p1a: 8db0521bcb|Sucker Punch||[still]", "|-fail|p1a: 8db0521bcb", "|", "|upkeep", @@ -566,7 +566,7 @@ "|", "|move|p1a: 540aaed869|Hidden Power|p2a: ce04869101", "|-damage|p2a: ce04869101|79/100", - "|move|p2a: ce04869101|Play Rough|p1a: 540aaed869|[miss] true", + "|move|p2a: ce04869101|Play Rough|p1a: 540aaed869|[miss]", "|-miss|p2a: ce04869101|p1a: 540aaed869", "|", "|upkeep",