mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Fix modifier type spawning from ultra tier
This commit is contained in:
parent
9eb69e51e7
commit
dda809823f
@ -1481,9 +1481,18 @@ class SpeciesStatBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
|||||||
return new SpeciesStatBoosterModifierType(pregenArgs[0] as SpeciesStatBoosterItem);
|
return new SpeciesStatBoosterModifierType(pregenArgs[0] as SpeciesStatBoosterItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
const values = Object.values(items);
|
// Get a pool of items based on the rarity.
|
||||||
const keys = Object.keys(items);
|
const keys: (keyof SpeciesStatBoosterItem)[] = [];
|
||||||
const weights = keys.map(() => 0);
|
const values: (typeof items)[keyof typeof items][] = [];
|
||||||
|
const weights: number[] = [];
|
||||||
|
for (const [key, val] of Object.entries(SpeciesStatBoosterModifierTypeGenerator.items)) {
|
||||||
|
if (val.rare !== rare) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
values.push(val);
|
||||||
|
keys.push(key as keyof SpeciesStatBoosterItem);
|
||||||
|
weights.push(0);
|
||||||
|
}
|
||||||
|
|
||||||
for (const p of party) {
|
for (const p of party) {
|
||||||
const speciesId = p.getSpeciesForm(true).speciesId;
|
const speciesId = p.getSpeciesForm(true).speciesId;
|
||||||
@ -1506,8 +1515,6 @@ class SpeciesStatBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
|||||||
|
|
||||||
if (!hasItem) {
|
if (!hasItem) {
|
||||||
if (checkedSpecies.includes(speciesId) || (!!fusionSpeciesId && checkedSpecies.includes(fusionSpeciesId))) {
|
if (checkedSpecies.includes(speciesId) || (!!fusionSpeciesId && checkedSpecies.includes(fusionSpeciesId))) {
|
||||||
// Sets the item's rarity in order to determine if the item is rare (ultra tier) or not (great tier)
|
|
||||||
values[i].rare = rare;
|
|
||||||
// Add weight if party member has a matching species or, if applicable, a matching fusion species
|
// Add weight if party member has a matching species or, if applicable, a matching fusion species
|
||||||
weights[i]++;
|
weights[i]++;
|
||||||
} else if (checkedSpecies.includes(Species.PIKACHU) && hasFling) {
|
} else if (checkedSpecies.includes(Species.PIKACHU) && hasFling) {
|
||||||
|
Loading…
Reference in New Issue
Block a user