mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-15 03:49:33 +02:00
Merge branch 'memleak' of https://github.com/emdeann/pokerogue into memleak
This commit is contained in:
commit
f34c38462e
@ -1834,7 +1834,7 @@ export function initSpecies() {
|
||||
new PokemonSpecies(Species.COFAGRIGUS, 5, false, false, false, "Coffin Pokémon", Type.GHOST, null, 1.7, 76.5, Abilities.MUMMY, Abilities.NONE, Abilities.NONE, 483, 58, 50, 145, 95, 105, 30, 90, 50, 169, GrowthRate.MEDIUM_FAST, 50, false),
|
||||
new PokemonSpecies(Species.TIRTOUGA, 5, false, false, false, "Prototurtle Pokémon", Type.WATER, Type.ROCK, 0.7, 16.5, Abilities.SOLID_ROCK, Abilities.STURDY, Abilities.SWIFT_SWIM, 355, 54, 78, 103, 53, 45, 22, 45, 50, 71, GrowthRate.MEDIUM_FAST, 87.5, false),
|
||||
new PokemonSpecies(Species.CARRACOSTA, 5, false, false, false, "Prototurtle Pokémon", Type.WATER, Type.ROCK, 1.2, 81, Abilities.SOLID_ROCK, Abilities.STURDY, Abilities.SWIFT_SWIM, 495, 74, 108, 133, 83, 65, 32, 45, 50, 173, GrowthRate.MEDIUM_FAST, 87.5, false),
|
||||
new PokemonSpecies(Species.ARCHEN, 5, false, false, false, "First Bird Pokémon", Type.ROCK, Type.FLYING, 0.5, 9.5, Abilities.DEFEATIST, Abilities.NONE, Abilities.EMERGENCY_EXIT, 401, 55, 112, 45, 74, 45, 70, 45, 50, 71, GrowthRate.MEDIUM_FAST, 87.5, false), //Custom Hidden
|
||||
new PokemonSpecies(Species.ARCHEN, 5, false, false, false, "First Bird Pokémon", Type.ROCK, Type.FLYING, 0.5, 9.5, Abilities.DEFEATIST, Abilities.NONE, Abilities.WIMP_OUT, 401, 55, 112, 45, 74, 45, 70, 45, 50, 71, GrowthRate.MEDIUM_FAST, 87.5, false), //Custom Hidden
|
||||
new PokemonSpecies(Species.ARCHEOPS, 5, false, false, false, "First Bird Pokémon", Type.ROCK, Type.FLYING, 1.4, 32, Abilities.DEFEATIST, Abilities.NONE, Abilities.EMERGENCY_EXIT, 567, 75, 140, 65, 112, 65, 110, 45, 50, 177, GrowthRate.MEDIUM_FAST, 87.5, false), //Custom Hidden
|
||||
new PokemonSpecies(Species.TRUBBISH, 5, false, false, false, "Trash Bag Pokémon", Type.POISON, null, 0.6, 31, Abilities.STENCH, Abilities.STICKY_HOLD, Abilities.AFTERMATH, 329, 50, 50, 62, 40, 62, 65, 190, 50, 66, GrowthRate.MEDIUM_FAST, 50, false),
|
||||
new PokemonSpecies(Species.GARBODOR, 5, false, false, false, "Trash Heap Pokémon", Type.POISON, null, 1.9, 107.3, Abilities.STENCH, Abilities.WEAK_ARMOR, Abilities.AFTERMATH, 474, 80, 95, 82, 60, 82, 75, 60, 50, 166, GrowthRate.MEDIUM_FAST, 50, false, true,
|
||||
|
@ -428,7 +428,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||
}
|
||||
|
||||
// Prompts reroll of party member species if species already present in the enemy party
|
||||
if (this.checkDuplicateSpecies(ret, baseSpecies)) {
|
||||
if (this.checkDuplicateSpecies(baseSpecies.speciesId)) {
|
||||
console.log("Duplicate species detected, prompting reroll...");
|
||||
retry = true;
|
||||
}
|
||||
@ -443,17 +443,23 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||
|
||||
/**
|
||||
* Checks if the enemy trainer already has the Pokemon species in their party
|
||||
* @param {PokemonSpecies} species {@linkcode PokemonSpecies}
|
||||
* @param {PokemonSpecies} baseSpecies {@linkcode PokemonSpecies} - baseSpecies of the Pokemon if species is forced to evolve
|
||||
* @param baseSpecies - The base {@linkcode Species} of the current Pokemon
|
||||
* @returns `true` if the species is already present in the party
|
||||
*/
|
||||
checkDuplicateSpecies(species: PokemonSpecies, baseSpecies: PokemonSpecies): boolean {
|
||||
const staticPartyPokemon = (signatureSpecies[TrainerType[this.config.trainerType]] ?? []).flat(1);
|
||||
|
||||
const currentPartySpecies = globalScene.getEnemyParty().map(p => {
|
||||
return p.species.speciesId;
|
||||
checkDuplicateSpecies(baseSpecies: Species): boolean {
|
||||
const staticSpecies = (signatureSpecies[TrainerType[this.config.trainerType]] ?? []).flat(1).map(s => {
|
||||
let root = s;
|
||||
while (pokemonPrevolutions.hasOwnProperty(root)) {
|
||||
root = pokemonPrevolutions[root];
|
||||
}
|
||||
return root;
|
||||
});
|
||||
return currentPartySpecies.includes(species.speciesId) || staticPartyPokemon.includes(baseSpecies.speciesId);
|
||||
|
||||
const currentSpecies = globalScene.getEnemyParty().map(p => {
|
||||
return p.species.getRootSpeciesId();
|
||||
});
|
||||
|
||||
return currentSpecies.includes(baseSpecies) || staticSpecies.includes(baseSpecies);
|
||||
}
|
||||
|
||||
getPartyMemberMatchupScores(trainerSlot: TrainerSlot = TrainerSlot.NONE, forSwitch: boolean = false): [integer, integer][] {
|
||||
|
@ -364,6 +364,8 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
success = this.setCursor(0);
|
||||
} else if (this.rowCursor < this.shopOptionsRows.length + 1) {
|
||||
success = this.setRowCursor(this.rowCursor + 1);
|
||||
} else {
|
||||
success = this.setRowCursor(0);
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
@ -371,13 +373,15 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
success = this.setRowCursor(this.rowCursor - 1);
|
||||
} else if (this.lockRarityButtonContainer.visible && this.cursor === 0) {
|
||||
success = this.setCursor(3);
|
||||
} else {
|
||||
success = this.setRowCursor(this.shopOptionsRows.length + 1);
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
if (!this.rowCursor) {
|
||||
switch (this.cursor) {
|
||||
case 0:
|
||||
success = false;
|
||||
success = this.setCursor(2);
|
||||
break;
|
||||
case 1:
|
||||
if (this.lockRarityButtonContainer.visible) {
|
||||
@ -395,11 +399,21 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
success = false;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this.lockRarityButtonContainer.visible) {
|
||||
success = this.setCursor(2);
|
||||
} else {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
} else if (this.cursor) {
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
} else if (this.rowCursor === 1 && this.rerollButtonContainer.visible) {
|
||||
success = this.setRowCursor(0);
|
||||
} else {
|
||||
if (this.rowCursor === 1 && this.options.length === 0) {
|
||||
success = false;
|
||||
} else {
|
||||
success = this.setCursor(this.getRowItems(this.rowCursor) - 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
@ -416,7 +430,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
success = this.setCursor(2);
|
||||
break;
|
||||
case 2:
|
||||
success = false;
|
||||
success = this.setCursor(0);
|
||||
break;
|
||||
case 3:
|
||||
if (this.transferButtonContainer.visible) {
|
||||
@ -428,8 +442,12 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
}
|
||||
} else if (this.cursor < this.getRowItems(this.rowCursor) - 1) {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
} else if (this.rowCursor === 1 && this.transferButtonContainer.visible) {
|
||||
success = this.setRowCursor(0);
|
||||
} else {
|
||||
if (this.rowCursor === 1 && this.options.length === 0) {
|
||||
success = this.setRowCursor(0);
|
||||
} else {
|
||||
success = this.setCursor(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -519,6 +537,14 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
|
||||
newCursor = 2;
|
||||
}
|
||||
}
|
||||
// Allows to find lock rarity button when looping from the top
|
||||
if (rowCursor === 0 && lastRowCursor > 1 && newCursor === 0 && this.lockRarityButtonContainer.visible) {
|
||||
newCursor = 3;
|
||||
}
|
||||
// Allows to loop to top when lock rarity button is shown
|
||||
if (rowCursor === this.shopOptionsRows.length + 1 && lastRowCursor === 0 && this.cursor === 3) {
|
||||
newCursor = 0;
|
||||
}
|
||||
this.cursor = -1;
|
||||
this.setCursor(newCursor);
|
||||
return true;
|
||||
|
@ -157,6 +157,12 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
|
||||
success = (this.cursor === 0) ? this.setCursor(this.cursor) : this.setCursor(this.cursor - 1, cursorPosition);
|
||||
} else if (this.scrollCursor) {
|
||||
success = this.setScrollCursor(this.scrollCursor - 1, cursorPosition);
|
||||
} else if ((this.cursor === 0) && (this.scrollCursor === 0)) {
|
||||
this.setScrollCursor(SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN);
|
||||
// Revert to avoid an extra session slot sticking out
|
||||
this.revertSessionSlot(SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN);
|
||||
this.setCursor(SLOTS_ON_SCREEN - 1);
|
||||
success = true;
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
@ -164,6 +170,11 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
|
||||
success = this.setCursor(this.cursor + 1, cursorPosition);
|
||||
} else if (this.scrollCursor < SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN) {
|
||||
success = this.setScrollCursor(this.scrollCursor + 1, cursorPosition);
|
||||
} else if ((this.cursor === SLOTS_ON_SCREEN - 1) && (this.scrollCursor === SESSION_SLOTS_COUNT - SLOTS_ON_SCREEN)) {
|
||||
this.setScrollCursor(0);
|
||||
this.revertSessionSlot(SLOTS_ON_SCREEN - 1);
|
||||
this.setCursor(0);
|
||||
success = true;
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
|
Loading…
Reference in New Issue
Block a user