mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
Fix TM compatibility for certain moves being reversed
This commit is contained in:
parent
4355ebd375
commit
8345eaef5a
@ -6,6 +6,15 @@ interface TmSpecies {
|
||||
[key: integer]: Array<Species | Array<Species | string>>
|
||||
}
|
||||
|
||||
export const reverseCompatibleTms: Moves[] = [
|
||||
Moves.DOUBLE_EDGE,
|
||||
Moves.REST,
|
||||
Moves.ENDURE,
|
||||
Moves.ATTRACT,
|
||||
Moves.FACADE,
|
||||
Moves.CAPTIVATE
|
||||
];
|
||||
|
||||
export const tmSpecies: TmSpecies = {
|
||||
[Moves.MEGA_PUNCH]: [
|
||||
Species.CHARMANDER,
|
||||
|
@ -12,7 +12,7 @@ import { PokeballType } from './data/pokeball';
|
||||
import { Gender } from './data/gender';
|
||||
import { initMoveAnim, loadMoveAnimAssets } from './data/battle-anims';
|
||||
import { Status, StatusEffect } from './data/status-effect';
|
||||
import { tmSpecies } from './data/tms';
|
||||
import { reverseCompatibleTms, tmSpecies } from './data/tms';
|
||||
import { pokemonEvolutions, pokemonPrevolutions, SpeciesEvolution, SpeciesEvolutionCondition } from './data/pokemon-evolutions';
|
||||
import { DamagePhase, FaintPhase, SwitchSummonPhase } from './battle-phases';
|
||||
import { BattleStat } from './data/battle-stat';
|
||||
@ -1624,17 +1624,22 @@ export class PlayerPokemon extends Pokemon {
|
||||
const tms = Object.keys(tmSpecies);
|
||||
for (let tm of tms) {
|
||||
const moveId = parseInt(tm) as Moves;
|
||||
let compatible = false;
|
||||
for (let p of tmSpecies[tm]) {
|
||||
if (Array.isArray(p)) {
|
||||
if (p[0] === this.species.speciesId || (this.fusionSpecies && p[0] === this.fusionSpecies.speciesId)) {
|
||||
this.compatibleTms.push(moveId);
|
||||
compatible = true;
|
||||
break;
|
||||
}
|
||||
} else if (p === this.species.speciesId || (this.fusionSpecies && p === this.fusionSpecies.speciesId)) {
|
||||
this.compatibleTms.push(moveId);
|
||||
compatible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (reverseCompatibleTms.indexOf(moveId) > -1)
|
||||
compatible = !compatible;
|
||||
if (compatible)
|
||||
this.compatibleTms.push(moveId);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user