@@ -60,6 +60,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
60
60
public id : integer ;
61
61
public name : string ;
62
62
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
+ */
63
70
public illusion : { active : boolean , available : boolean , species ?: PokemonSpecies , name ?: string , fusionSpecies ?: PokemonSpecies } ;
64
71
public formIndex : integer ;
65
72
public abilityIndex : integer ;
@@ -308,6 +315,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
308
315
}
309
316
}
310
317
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
+ */
311
324
generateIllusion ( pokemon : Pokemon , party : Pokemon [ ] ) : void {
312
325
if ( pokemon . hasTrainer ( ) ) {
313
326
const lastPokemon : Pokemon = party . slice ( - 1 ) [ 0 ] ;
@@ -323,7 +336,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
323
336
pokemon . loadAssets ( false ) . then ( ( ) => pokemon . playAnim ( ) ) ;
324
337
} else {
325
338
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 ) ] ) ;
327
340
pokemon . illusion = { active : true , available : true , species : randomIllusion , name : pokemon . name } ;
328
341
pokemon . name = randomIllusion . name ;
329
342
pokemon . loadAssets ( false ) . then ( ( ) => pokemon . playAnim ( ) ) ;
0 commit comments