Skip to content

Commit f79174e

Browse files
committed
add comments for the property pokemon.illusion
1 parent 8927758 commit f79174e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/field/pokemon.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
6060
public id: integer;
6161
public name: string;
6262
public species: PokemonSpecies;
63+
/**Illusion attribute
64+
* @property {boolean} active - Whether the ability is active or not.
65+
* @property {boolean} available - If the pokemon can create an illusion.
66+
* @property {PokemonSpecies} species - The species of the illusion.
67+
* @property {string} name - The stored name of the pokemon.
68+
* @property {fusionSpecies} fusionSpecies - The fusionned species of the illusion if it's a fusion.
69+
*/
6370
public illusion: {active: boolean, available: boolean, species?: PokemonSpecies, name?: string, fusionSpecies?: PokemonSpecies};
6471
public formIndex: integer;
6572
public abilityIndex: integer;
@@ -308,6 +315,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
308315
}
309316
}
310317

318+
/**
319+
* Generate an illusion of the last pokemon in the party.
320+
*
321+
* @param {Pokemon} pokemon - The Pokemon that will create an illusion.
322+
* @param {Pokemon[]} party - The party of the trainer's pokemon.
323+
*/
311324
generateIllusion(pokemon: Pokemon, party: Pokemon[]): void {
312325
if (pokemon.hasTrainer()) {
313326
const lastPokemon: Pokemon = party.slice(-1)[0];
@@ -323,7 +336,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
323336
pokemon.loadAssets(false).then(() => pokemon.playAnim());
324337
} else {
325338
const availables = [Species.ENTEI, Species.RAIKOU, Species.SUICUNE];
326-
const randomIllusion: PokemonSpecies = getPokemonSpecies(availables[Math.floor(Math.random()*3)]);
339+
const randomIllusion: PokemonSpecies = getPokemonSpecies(availables[this.randSeedInt(3, 0)]);
327340
pokemon.illusion = {active: true, available: true, species: randomIllusion, name: pokemon.name};
328341
pokemon.name = randomIllusion.name;
329342
pokemon.loadAssets(false).then(() => pokemon.playAnim());

0 commit comments

Comments
 (0)