Skip to content

Commit

Permalink
Disables all unique double battles but tate and Liza. And those two w…
Browse files Browse the repository at this point in the history
…ill now always have lunatone and the other one (solrock?) as their first pokemon (pagefaultgames#1654)
  • Loading branch information
CodeTappert authored Jun 1, 2024
1 parent 06ba63d commit 7ee6c97
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[]): Get
: trainerPoolEntry;
trainerTypes.push(trainerType);
}
// If the trainer type has a double variant, there's a 33% chance of it being a double battle
if (trainerConfigs[trainerTypes[rand]].trainerTypeDouble) {
// If the trainer type has a double variant, there's a 33% chance of it being a double battle (for now we only allow tate&liza to be double)
if (trainerConfigs[trainerTypes[rand]].trainerTypeDouble && (trainerTypes[rand] === TrainerType.TATE || trainerTypes[rand] === TrainerType.LIZA)) {
return new Trainer(scene, trainerTypes[rand], Utils.randSeedInt(3) ? TrainerVariant.DOUBLE : TrainerVariant.DEFAULT);
}
return new Trainer(scene, trainerTypes[rand], TrainerVariant.DEFAULT);
Expand Down
20 changes: 17 additions & 3 deletions src/field/trainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {trainerNamePools} from "../data/trainer-names";
import {ArenaTagSide, ArenaTrapTag} from "#app/data/arena-tag";
import {getIsInitialized, initI18n} from "#app/plugins/i18n";
import i18next from "i18next";
import {Species} from "#app/data/enums/species";

export enum TrainerVariant {
DEFAULT,
Expand Down Expand Up @@ -314,12 +315,25 @@ export default class Trainer extends Phaser.GameObjects.Container {

// If the index is even, use the species pool for the main trainer (that way he only uses his own pokemon in battle)
if (!(index % 2)) {
newSpeciesPool = speciesPoolFiltered;
// Since the only currently allowed double battle with named trainers is Tate & Liza, we need to make sure that Solrock is the first pokemon in the party for Tate and Lunatone for Liza
if (index === 0 && (TrainerType[this.config.trainerType] === TrainerType[TrainerType.TATE])) {
newSpeciesPool = [Species.SOLROCK];
} else if (index === 0 && (TrainerType[this.config.trainerType] === TrainerType[TrainerType.LIZA])) {
newSpeciesPool = [Species.LUNATONE];
} else {
newSpeciesPool = speciesPoolFiltered;
}
} else {
// If the index is odd, use the species pool for the partner trainer (that way he only uses his own pokemon in battle)
newSpeciesPool = speciesPoolPartnerFiltered;
// Since the only currently allowed double battle with named trainers is Tate & Liza, we need to make sure that Solrock is the first pokemon in the party for Tate and Lunatone for Liza
if (index === 1 && (TrainerType[this.config.trainerTypeDouble] === TrainerType[TrainerType.TATE])) {
newSpeciesPool = [Species.SOLROCK];
} else if (index === 1 && (TrainerType[this.config.trainerTypeDouble] === TrainerType[TrainerType.LIZA])) {
newSpeciesPool = [Species.LUNATONE];
} else {
newSpeciesPool = speciesPoolPartnerFiltered;
}
}

// Fallback for when the species pool is empty
if (newSpeciesPool.length === 0) {
// If all pokemon from this pool are already in the party, generate a random species
Expand Down

0 comments on commit 7ee6c97

Please sign in to comment.