[Bug] Fixing Baton Pass passing (#2058)
* skip yawn and infatuation for baton pass, and some docs along the way * update yawn condition readability
This commit is contained in:
parent
c71d794d97
commit
e5d9cfd10f
|
@ -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));
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue