Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Add female and double grunts #3280

Merged
merged 6 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions src/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,13 @@ export class FixedBattleConfig {
}
}

function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[]): GetTrainerFunc {
/**
* Helper function to generate a random trainer for evil team trainers and the elite 4/champion
* @param trainerPool The TrainerType or list of TrainerTypes that can possibly be generated
* @param randomGender whether or not to randomly (50%) generate a female trainer (for use with evil team grunts)
* @returns the generated trainer
*/
function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[], randomGender: boolean = false): GetTrainerFunc {
return (scene: BattleScene) => {
const rand = Utils.randSeedInt(trainerPool.length);
const trainerTypes: TrainerType[] = [];
Expand All @@ -435,11 +441,20 @@ 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 (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);
let trainerGender = TrainerVariant.DEFAULT;
if (randomGender) {
trainerGender = (Utils.randInt(2) === 0) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
}

/* 1/3 chance for evil team grunts to be double battles */
const evilTeamGrunts = [TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT];
const isEvilTeamGrunt = evilTeamGrunts.includes(trainerTypes[rand]);

if (trainerConfigs[trainerTypes[rand]].hasDouble && isEvilTeamGrunt) {
return new Trainer(scene, trainerTypes[rand], (Utils.randInt(3) === 0) ? TrainerVariant.DOUBLE : trainerGender);
}
return new Trainer(scene, trainerTypes[rand], TrainerVariant.DEFAULT);

return new Trainer(scene, trainerTypes[rand], trainerGender);
};
}

Expand All @@ -462,21 +477,21 @@ export const classicFixedBattles: FixedBattleConfigs = {
[25]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_2, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
[35]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[55]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_3, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
[62]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[64]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[66]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[95]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_4, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
[112]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[114]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[115]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_BOSS_GIOVANNI_1, TrainerType.MAXIE, TrainerType.ARCHIE, TrainerType.CYRUS, TrainerType.GHETSIS, TrainerType.LYSANDRE ])),
[145]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
Expand Down
6 changes: 6 additions & 0 deletions src/locales/en/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,23 @@ export const trainerClasses: SimpleTranslationEntries = {
"workers": "Workers",
"youngster": "Youngster",
"rocket_grunt": "Rocket Grunt",
"rocket_grunts": "Rocket Grunts",
"rocket_grunt_female": "Rocket Grunt",
"magma_grunt": "Magma Grunt",
"magma_grunt_female": "Magma Grunt",
"magma_grunts": "Magma Grunts",
"aqua_grunt": "Aqua Grunt",
"aqua_grunt_female": "Aqua Grunt",
"aqua_grunts": "Aqua Grunts",
"galactic_grunt": "Galactic Grunt",
"galactic_grunt_female": "Galactic Grunt",
"galactic_grunts": "Galactic Grunts",
"plasma_grunt": "Plasma Grunt",
"plasma_grunt_female": "Plasma Grunt",
"plasma_grunts": "Plasma Grunts",
"flare_grunt": "Flare Grunt",
"flare_grunt_female": "Flare Grunt",
"flare_grunts": "Flare Grunts",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
20 changes: 19 additions & 1 deletion src/locales/es/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,25 @@ export const trainerClasses: SimpleTranslationEntries = {
"worker": "Operario",
"worker_female": "Operaria",
"workers": "Operarios",
"youngster": "Joven"
"youngster": "Joven",
"rocket_grunt": "Rocket Grunt",
"rocket_grunts": "Rocket Grunts",
"rocket_grunt_female": "Rocket Grunt",
"magma_grunt": "Magma Grunt",
"magma_grunt_female": "Magma Grunt",
"magma_grunts": "Magma Grunts",
"aqua_grunt": "Aqua Grunt",
"aqua_grunt_female": "Aqua Grunt",
"aqua_grunts": "Aqua Grunts",
"galactic_grunt": "Galactic Grunt",
"galactic_grunt_female": "Galactic Grunt",
"galactic_grunts": "Galactic Grunts",
"plasma_grunt": "Plasma Grunt",
"plasma_grunt_female": "Plasma Grunt",
"plasma_grunts": "Plasma Grunts",
"flare_grunt": "Flare Grunt",
"flare_grunt_female": "Flare Grunt",
"flare_grunts": "Flare Grunts",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
8 changes: 7 additions & 1 deletion src/locales/fr/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "Gamin",
"rocket_grunt": "Sbire de la Team Rocket",
"rocket_grunt_female": "Sbire de la Team Rocket",
"rocket_grunts": "Sbires de la Team Rocket",
"magma_grunt": "Sbire de la Team Magma",
"magma_grunt_female": "Sbire de la Team Magma",
"magma_grunts": "Sbires de la Team Magma",
"aqua_grunt": "Sbire de la Team Aqua",
"aqua_grunt_female": "Sbire de la Team Aqua",
"aqua_grunts": "Sbires de la Team Aqua",
"galactic_grunt": "Sbire de la Team Galaxie",
"galactic_grunt_female": "Sbire Team Galaxie",
"galactic_grunt_female": "Sbire de la Team Galaxie",
"galactic_grunts": "Sbires de la Team Galaxie",
"plasma_grunt": "Sbire de la Team Plasma",
"plasma_grunt_female": "Sbire de la Team Plasma",
"plasma_grunts": "Sbires de la Team Plasma",
"flare_grunt": "Sbire de la Team Flare",
"flare_grunt_female": "Sbire de la Team Flare",
"flare_grunts": "Sbires de la Team Flare",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
20 changes: 19 additions & 1 deletion src/locales/it/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,25 @@ export const trainerClasses: SimpleTranslationEntries = {
"worker": "Operaio",
"worker_female": "Lavoratrice",
"workers": "Lavoratori",
"youngster": "Bullo"
"youngster": "Bullo",
"rocket_grunt": "Recluta Team Rocket",
"rocket_grunts": "Reclute Team Rocket",
"rocket_grunt_female": "Recluta Team Rocket",
"magma_grunt": "Recluta Team Magma",
"magma_grunt_female": "Recluta Team Magma",
"magma_grunts": "Reclute Team Magma",
"aqua_grunt": "Recluta Team Idro",
"aqua_grunt_female": "Recluta Team Idro",
"aqua_grunts": "Recluta Team Idro",
"galactic_grunt": "Recluta Team Galassia",
"galactic_grunt_female": "Recluta Team Galassia",
"galactic_grunts": "Reclute Team Galassia",
"plasma_grunt": "Seguace Plasma",
"plasma_grunt_female": "Seguace Plasma",
"plasma_grunts": "Seguaci Plasma",
"flare_grunt": "Recluta Team Flare",
"flare_grunt_female": "Recluta Team Flare",
"flare_grunts": "Reclute Team Flare",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
6 changes: 6 additions & 0 deletions src/locales/ko/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "반바지 꼬마",
"rocket_grunt": "로켓단 조무래기",
"rocket_grunt_female": "로켓단 조무래기",
"rocket_grunts": "로켓단 조무래기들",
"magma_grunt": "마그마단 조무래기",
"magma_grunt_female": "마그마단 조무래기",
"magma_grunts": "마그마단 조무래기들",
"aqua_grunt": "아쿠아단 조무래기",
"aqua_grunt_female": "아쿠아단 조무래기",
"aqua_grunts": "아쿠아단 조무래기들",
"galactic_grunt": "갤럭시단 조무래기",
"galactic_grunt_female": "갤럭시단 조무래기",
"galactic_grunts": "갤럭시단 조무래기들",
"plasma_grunt": "플라스마단 조무래기",
"plasma_grunt_female": "플라스마단 조무래기",
"plasma_grunts": "플라스마단 조무래기들",
"flare_grunt": "플레어단 조무래기",
"flare_grunt_female": "플레어단 조무래기",
"flare_grunts": "플레어단 조무래기들",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
6 changes: 6 additions & 0 deletions src/locales/pt_BR/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "Jovem",
"rocket_grunt": "Recruta da Equipe Rocket",
"rocket_grunt_female": "Recruta da Equipe Rocket",
"rocket_grunts": "Recrutas da Equipe Rocket",
"magma_grunt": "Recruta da Equipe Magma",
"magma_grunt_female": "Recruta da Equipe Magma",
"magma_grunts": "Recrutas da Equipe Magma",
"aqua_grunt": "Recruta da Equipe Aqua",
"aqua_grunt_female": "Recruta da Equipe Aqua",
"aqua_grunts": "Recrutas da Equipe Aqua",
"galactic_grunt": "Recruta da Equipe Galáctica",
"galactic_grunt_female": "Recruta da Equipe Galáctica",
"galactic_grunts": "Recrutas da Equipe Galáctica",
"plasma_grunt": "Recruta da Equipe Plasma",
"plasma_grunt_female": "Recruta da Equipe Plasma",
"plasma_grunts": "Recrutas da Equipe Plasma",
"flare_grunt": "Recruta da Equipe Flare",
"flare_grunt_female": "Recruta da Equipe Flare",
"flare_grunts": "Recrutas da Equipe Flare",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
6 changes: 6 additions & 0 deletions src/locales/zh_CN/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "短裤小子",
"rocket_grunt": "火箭队手下",
"rocket_grunt_female": "火箭队手下",
"rocket_grunts": "火箭队手下们",
"magma_grunt": "熔岩队手下",
"magma_grunt_female": "熔岩队手下",
"magma_grunts": "熔岩队手下们",
"aqua_grunt": "海洋队手下",
"aqua_grunt_female": "海洋队手下",
"aqua_grunts": "海洋队手下们",
"galactic_grunt": "银河队手下",
"galactic_grunt_female": "银河队手下",
"galactic_grunts": "银河队手下们",
"plasma_grunt": "等离子队手下",
"plasma_grunt_female": "等离子队手下",
"plasma_grunts": "等离子队手下们",
"flare_grunt": "闪焰队手下",
"flare_grunt_female": "闪焰队手下",
"flare_grunts": "闪焰队手下们",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
18 changes: 17 additions & 1 deletion src/locales/zh_TW/trainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,23 @@ export const trainerClasses: SimpleTranslationEntries = {
"worker": "工人",
"worker_female": "工人",
"workers": "工人組合",
"youngster": "短褲小子"
"youngster": "短褲小子",
"rocket_grunts": "火箭队手下們",
"magma_grunt": "熔岩队手下",
"magma_grunt_female": "熔岩队手下",
"magma_grunts": "熔岩队手下們",
"aqua_grunt": "海洋队手下",
"aqua_grunt_female": "海洋队手下",
"aqua_grunts": "海洋队手下們",
"galactic_grunt": "银河队手下",
"galactic_grunt_female": "银河队手下",
"galactic_grunts": "银河队手下們",
"plasma_grunt": "等离子队手下",
"plasma_grunt_female": "等离子队手下",
"plasma_grunts": "等离子队手下們",
"flare_grunt": "闪焰队手下",
"flare_grunt_female": "闪焰队手下",
"flare_grunts": "闪焰队手下們",
} as const;

// Names of special trainers like gym leaders, elite four, and the champion
Expand Down
Loading