Fix TM compatibility for certain moves being reversed

pull/11/head
Flashfyre 2023-11-28 14:37:45 -05:00
parent 4355ebd375
commit 8345eaef5a
2 changed files with 17 additions and 3 deletions

View File

@ -6,6 +6,15 @@ interface TmSpecies {
[key: integer]: Array<Species | Array<Species | string>> [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 = { export const tmSpecies: TmSpecies = {
[Moves.MEGA_PUNCH]: [ [Moves.MEGA_PUNCH]: [
Species.CHARMANDER, Species.CHARMANDER,

View File

@ -12,7 +12,7 @@ import { PokeballType } from './data/pokeball';
import { Gender } from './data/gender'; import { Gender } from './data/gender';
import { initMoveAnim, loadMoveAnimAssets } from './data/battle-anims'; import { initMoveAnim, loadMoveAnimAssets } from './data/battle-anims';
import { Status, StatusEffect } from './data/status-effect'; 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 { pokemonEvolutions, pokemonPrevolutions, SpeciesEvolution, SpeciesEvolutionCondition } from './data/pokemon-evolutions';
import { DamagePhase, FaintPhase, SwitchSummonPhase } from './battle-phases'; import { DamagePhase, FaintPhase, SwitchSummonPhase } from './battle-phases';
import { BattleStat } from './data/battle-stat'; import { BattleStat } from './data/battle-stat';
@ -1624,17 +1624,22 @@ export class PlayerPokemon extends Pokemon {
const tms = Object.keys(tmSpecies); const tms = Object.keys(tmSpecies);
for (let tm of tms) { for (let tm of tms) {
const moveId = parseInt(tm) as Moves; const moveId = parseInt(tm) as Moves;
let compatible = false;
for (let p of tmSpecies[tm]) { for (let p of tmSpecies[tm]) {
if (Array.isArray(p)) { if (Array.isArray(p)) {
if (p[0] === this.species.speciesId || (this.fusionSpecies && p[0] === this.fusionSpecies.speciesId)) { if (p[0] === this.species.speciesId || (this.fusionSpecies && p[0] === this.fusionSpecies.speciesId)) {
this.compatibleTms.push(moveId); compatible = true;
break; break;
} }
} else if (p === this.species.speciesId || (this.fusionSpecies && p === this.fusionSpecies.speciesId)) { } else if (p === this.species.speciesId || (this.fusionSpecies && p === this.fusionSpecies.speciesId)) {
this.compatibleTms.push(moveId); compatible = true;
break; break;
} }
} }
if (reverseCompatibleTms.indexOf(moveId) > -1)
compatible = !compatible;
if (compatible)
this.compatibleTms.push(moveId);
} }
} }