mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
* Stage release v1.10.0
* [GitHub] Workflows will now run on `release` branch (#6329)
* [Beta] [Balance] Add Wild Evo Delay to Gallade / Froslass (#6324)
* Update pokemon-evolutions.ts
---------
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* [Beta] [Balance] Fix Wrong Teras in Trainer Config (#6326)
* Update trainer-config.ts
---------
Co-authored-by: damocleas <damocleas25@gmail.com>
* Revert #6307 "Remove duplicate animation json for ... variants" (#6332)
Revert "[Refactor][Sprite] Remove duplicate animation json for shinies, sprite-based variants (#6307)"
This reverts commit 7bdb62ed1d
.
* [Beta] Fresh Start no longer overrides IV unlocks (#6333)
Unpack ivs when copying dexData
* [UI/UX] Always show starter's natures and ivs in evolution's dex entry (#6335)
Natures and ivs use starter's dexEntry
* [Bug] Sheer Force no longer boosts Fickle Beam; Focus Energy gives +2 crit instead of +1 (#6331)
[Bug] Sheer Force no longer boosts Fickle Beam; Focus Energy correctly gives +2 crit stages instead of +1
* Restricted party options for fainted mons in hardcore (#6336)
* [Challenge] No hardcore breeder (#6334)
Disallow expert breeder encounter in space
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* [Bug] [Beta] Fix trick room message (#6327)
Fix trick room's arena tag message
* [Beta][Bug][UI/UX] Fix broken candy upgrades (#6322)
* Candy upgrades change permanent starter data again
* Updating cost icon and passive bg in starter select after buying pokédex upgrades
* [Beta] [Balance] Even More 1.10 Balance Changes (Egg Moves + Passive Changes) (#6339)
1.10 Egg Moves and Passives pt 3
* [Bug][Sprite] Remove fake Deerling variants (#6330)
* Remove fake Deerling variants
* Remove unused json
* [Bug] Ensure MEs disabled in a challenge mode only do so while challenge is active (#6337)
* Ensure MEs disabled in a challenge mode only do so while challenge is active
* Optimize checking disallowed challenges
* [Misc] Moved `scrapeTrainerNames` to a script; removed `selfStatLowerMoves` (#6258)
* Removed scrape trainer names
* Removed `selfStatLowerMoves`
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Started work on the script again
* Made script actually work
* Made finishing touches on script
* Fixed main repo code to not expect snake cased locale strings
* Update trainer.ts
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* Remove biome ignore range
* Fix typedoc.json
* rename `getRandomLocaleKey` to `getRandomLocaleEntry`
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* Update locales
* [Balance] [ME] Trash to Treasure Option 1 Adjustment (#6341)
* Update trash-to-treasure-encounter.ts
* Update trash-to-treasure-encounter.test.ts tests
* [Misc] [UX] Add Daily Run Achievement, Re-Arrange Achievements, Replace some Icon Sprites (#6292)
* wip achievement changes
* Adjust egg image sizes, re-export item atlas
* painful eggs
* Add egg to legacy UI, re-export item atlas
* run biome
* Update achievement.test.ts
* Fix achievement test file
* Fix tera stellar missing icon path
* Fix achievement test file
* egg s
* Optimize new images, re-export item atlas
* update pngs and locale
* add daily achv and other sorting
* Optimize ribbons, re-export item atlas
* Bump to version 1.11.0
* more changes, waiting on pngs
* Update package.json
* ribbon fixes
* images!
* Optimize images, re-export item atlas
* final fix
---------
Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* [Bug] [UI/UX] [Beta] Fix visibility of egg moves in ssui (#6343)
Fix visibility of egg moves when backing out of fresh start and back into ssui
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Blitzy <118096277+Blitz425@users.noreply.github.com>
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: AJ Fontaine <36677462+Fontbane@users.noreply.github.com>
Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
/**
|
|
* Check if the given trainer class is female.
|
|
* @param {Document} document - The HTML document to scrape
|
|
* @returns {[gender: boolean, counterpartURLs: string[]]} A 2-length tuple containing:
|
|
* 1. The trainer class' gender (female or not)
|
|
* 2. A list of all the current class' opposite-gender counterparts (if the trainer has any).
|
|
*/
|
|
export function checkGenderAndType(document) {
|
|
const infoBox = document.getElementsByClassName("infobox")[0];
|
|
if (!infoBox) {
|
|
return [false, []];
|
|
}
|
|
// Find the row of the table containing the specified gender
|
|
const children = [...infoBox.getElementsByTagName("tr")];
|
|
const genderCell = children.find(node => [...node.childNodes].some(c => c.textContent?.includes("Gender")));
|
|
const tableBox = genderCell?.querySelector("td");
|
|
if (!tableBox) {
|
|
return [false, []];
|
|
}
|
|
|
|
const gender = getGender(tableBox);
|
|
|
|
// CHeck the cell's inner HTML for any `href`s to gender counterparts and scrape them too
|
|
const hrefExtractRegex = /href="\/wiki\/(.*?)_\(Trainer_class\)"/g;
|
|
const counterpartCell = children.find(node => [...node.childNodes].some(c => c.textContent?.includes("Counterpart")));
|
|
|
|
const counterpartURLs = [];
|
|
for (const url of counterpartCell?.innerHTML?.matchAll(hrefExtractRegex) ?? []) {
|
|
counterpartURLs.push(url[1]);
|
|
}
|
|
|
|
return [gender, counterpartURLs];
|
|
}
|
|
|
|
/**
|
|
* Retrieve the gender from the given node text.
|
|
* @param {HTMLTableCellElement} genderCell - The cell to check
|
|
* @returns {boolean} The gender type
|
|
* @todo Handle trainers whose gender type has changed across different gens (Artists, etc.)
|
|
*/
|
|
function getGender(genderCell) {
|
|
const gender = genderCell.textContent?.trim().toLowerCase() ?? "";
|
|
|
|
switch (gender) {
|
|
case "female only":
|
|
return true;
|
|
case "male only":
|
|
case "both":
|
|
case undefined:
|
|
default:
|
|
return false;
|
|
}
|
|
}
|