diff --git a/src/battle-scene.ts b/src/battle-scene.ts index f1f53e54d2b..9a6cc40f153 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -695,6 +695,10 @@ export default class BattleScene extends SceneBase { return this.getPlayerField().find(p => p.isActive()); } + /** + * Returns an array of PlayerPokemon of length 1 or 2 depending on if double battles or not + * @returns array of {@linkcode PlayerPokemon} + */ getPlayerField(): PlayerPokemon[] { const party = this.getParty(); return party.slice(0, Math.min(party.length, this.currentBattle?.double ? 2 : 1)); @@ -708,6 +712,10 @@ export default class BattleScene extends SceneBase { return this.getEnemyField().find(p => p.isActive()); } + /** + * Returns an array of EnemyPokemon of length 1 or 2 depending on if double battles or not + * @returns array of {@linkcode EnemyPokemon} + */ getEnemyField(): EnemyPokemon[] { const party = this.getEnemyParty(); return party.slice(0, Math.min(party.length, this.currentBattle?.double ? 2 : 1)); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 7bf3c8ca52d..d7072d717e1 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2167,12 +2167,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { tags.filter(t => t.sourceId === sourceId).forEach(t => t.sourceId = newSourceId); } + /** + * Transferring stat changes and Tags + * @param source {@linkcode Pokemon} the pokemon whose stats/Tags are to be passed on from, ie: the Pokemon using Baton Pass + */ transferSummon(source: Pokemon): void { const battleStats = Utils.getEnumValues(BattleStat); for (const stat of battleStats) { this.summonData.battleStats[stat] = source.summonData.battleStats[stat]; } for (const tag of source.summonData.tags) { + + // bypass yawn, and infatuation as those can not be passed via Baton Pass + if (tag.sourceMove === Moves.YAWN || tag.tagType === BattlerTagType.INFATUATED) { + continue; + } + this.summonData.tags.push(tag); } if (this instanceof PlayerPokemon && source.summonData.battleStats.find(bs => bs === 6)) {