diff --git a/src/battle-text-parser.ts b/src/battle-text-parser.ts
index b64e399e04..11da55e34a 100644
--- a/src/battle-text-parser.ts
+++ b/src/battle-text-parser.ts
@@ -46,7 +46,7 @@ class BattleTextParser {
case 'fieldhtml': case 'controlshtml': case 'bigerror':
case 'debug': case 'tier': case 'challstr': case 'popup': case '':
return [cmd, line.slice(index + 1)];
- case 'c': case 'chat': case 'uhtml': case 'uhtmlchange': case 'queryresponse':
+ case 'c': case 'chat': case 'uhtml': case 'uhtmlchange': case 'queryresponse': case 'showteam':
// three parts
const index2a = line.indexOf('|', index + 1);
return [cmd, line.slice(index + 1, index2a), line.slice(index2a + 1)];
diff --git a/src/battle.ts b/src/battle.ts
index 9f3985be78..f86564a45b 100644
--- a/src/battle.ts
+++ b/src/battle.ts
@@ -736,14 +736,19 @@ export class Side {
this.battle.scene.removeSideCondition(this.n, id);
}
addPokemon(name: string, ident: string, details: string, replaceSlot = -1) {
- const oldItem = replaceSlot >= 0 ? this.pokemon[replaceSlot].item : undefined;
+ const oldPokemon = replaceSlot >= 0 ? this.pokemon[replaceSlot] : undefined;
const data = this.battle.parseDetails(name, ident, details);
const poke = new Pokemon(data, this);
- if (oldItem) poke.item = oldItem;
+ if (oldPokemon) {
+ poke.item = oldPokemon.item;
+ poke.baseAbility = oldPokemon.baseAbility;
+ poke.teraType = oldPokemon.teraType;
+ }
if (!poke.ability && poke.baseAbility) poke.ability = poke.baseAbility;
poke.reset();
+ if (oldPokemon?.moveTrack.length) poke.moveTrack = oldPokemon.moveTrack;
if (replaceSlot >= 0) {
this.pokemon[replaceSlot] = poke;
@@ -3571,6 +3576,42 @@ export class Battle {
this.scene.teamPreview();
break;
}
+ case 'showteam': {
+ if (this.turn !== 0) return;
+ // @ts-ignore
+ if (!window.Storage?.unpackTeam || !window.Storage?.exportTeam) return;
+ // @ts-ignore
+ const team: PokemonSet[] = Storage.unpackTeam(args[2]);
+ if (!team) return;
+ const side = this.getSide(args[1]);
+ side.clearPokemon();
+ for (const set of team) {
+ const details = set.species + (!set.level || set.level === 100 ? '' : ', L' + set.level) +
+ (!set.gender || set.gender === 'N' ? '' : ', ' + set.gender) + (set.shiny ? ', shiny' : '');
+ const pokemon = side.addPokemon('', '', details);
+ if (set.item) pokemon.item = set.item;
+ if (set.ability) pokemon.rememberAbility(set.ability);
+ for (const move of set.moves) {
+ pokemon.rememberMove(move, 0);
+ }
+ if (set.teraType) pokemon.teraType = set.teraType;
+ }
+ const exportedTeam = team.map(set => {
+ // @ts-ignore
+ let buf = Storage.exportTeam([set], this.gen).replace(/\n/g, '
');
+ if (set.name && set.name !== set.species) {
+ buf = buf.replace(set.name, BattleLog.sanitizeHTML(`
${set.name}`));
+ } else {
+ buf = buf.replace(set.species, `
${set.species}`);
+ }
+ if (set.item) {
+ buf = buf.replace(set.item, `${set.item}