[Bug] Fix generateVariant to account for forms (#1783)
* Add form check to generateVaraint * Add index check * Fix for typedoc
This commit is contained in:
parent
5ac1b7245f
commit
e0401a93aa
|
@ -1277,7 +1277,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
* @returns the shiny variant
|
||||
*/
|
||||
generateVariant(): Variant {
|
||||
if (!this.shiny || !variantData.hasOwnProperty(this.species.speciesId)) {
|
||||
const formIndex: number = this.formIndex;
|
||||
let variantDataIndex: string | number = this.species.speciesId;
|
||||
if (this.species.forms.length > 0) {
|
||||
const formKey = this.species.forms[formIndex]?.formKey;
|
||||
if (formKey) {
|
||||
variantDataIndex = `${variantDataIndex}-${formKey}`;
|
||||
}
|
||||
}
|
||||
// Checks if there is no variant data for both the index or index with form
|
||||
if (!this.shiny || (!variantData.hasOwnProperty(variantDataIndex) && !variantData.hasOwnProperty(this.species.speciesId))) {
|
||||
return 0;
|
||||
}
|
||||
const rand = Utils.randSeedInt(10);
|
||||
|
|
Loading…
Reference in New Issue