Soft implement gen 6-9 species, abilities, and learnsets
parent
ec2ff480ec
commit
fab2d9b788
|
@ -1634,7 +1634,6 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||
const hitCount = new Utils.IntegerHolder(1);
|
||||
// Assume single target for multi hit
|
||||
applyMoveAttrs(MultiHitAttr, user, this.getTarget(), this.move.getMove(), hitCount);
|
||||
user.turnData.hitCount = 0;
|
||||
user.turnData.hitsLeft = user.turnData.hitCount = hitCount.value;
|
||||
}
|
||||
|
||||
|
@ -1642,12 +1641,18 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||
user.pushMoveHistory(moveHistoryEntry);
|
||||
|
||||
const targetHitChecks = Object.fromEntries(targets.map(p => [ p.getBattlerIndex(), this.hitCheck(p) ]));
|
||||
if (targets.length === 1 && !targetHitChecks[this.targets[0]]) {
|
||||
const activeTargets = targets.map(t => t.isActive(true));
|
||||
if (targets.length === 1 && !targetHitChecks[this.targets[0]] || !activeTargets.length) {
|
||||
user.turnData.hitCount = 1;
|
||||
user.turnData.hitsLeft = 1;
|
||||
if (activeTargets.length) {
|
||||
this.scene.queueMessage(getPokemonMessage(user, '\'s\nattack missed!'));
|
||||
moveHistoryEntry.result = MoveResult.MISS;
|
||||
applyMoveAttrs(MissEffectAttr, user, null, this.move.getMove());
|
||||
} else {
|
||||
this.scene.queueMessage('But it failed!');
|
||||
moveHistoryEntry.result = MoveResult.FAIL;
|
||||
}
|
||||
this.end();
|
||||
return;
|
||||
}
|
||||
|
@ -1720,7 +1725,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||
if (--user.turnData.hitsLeft >= 1 && this.getTarget()?.isActive())
|
||||
this.scene.unshiftPhase(this.getNewHitPhase());
|
||||
else {
|
||||
if (user.turnData.hitCount - user.turnData.hitsLeft > 1)
|
||||
if (user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0) > 1)
|
||||
this.scene.queueMessage(`Hit ${user.turnData.hitCount} time(s)!`);
|
||||
this.scene.applyModifiers(HitHealModifier, this.player, user);
|
||||
}
|
||||
|
@ -2914,7 +2919,9 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
const pokemon = this.getPokemon() as EnemyPokemon;
|
||||
this.scene.unshiftPhase(new VictoryPhase(this.scene, this.battlerIndex));
|
||||
|
||||
if (pokemon.getAbility().id === (!pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm()).abilityHidden)
|
||||
const speciesForm = pokemon.fusionSpecies ? pokemon.getSpeciesForm() : pokemon.getFusionSpeciesForm();
|
||||
|
||||
if (speciesForm.abilityHidden && (pokemon.fusionSpecies ? pokemon.fusionAbilityIndex : pokemon.abilityIndex) === speciesForm.getAbilityCount() - 1)
|
||||
this.scene.validateAchv(achvs.HIDDEN_ABILITY);
|
||||
|
||||
if (pokemon.species.pseudoLegendary || pokemon.species.legendary)
|
||||
|
|
1150
src/data/ability.ts
1150
src/data/ability.ts
File diff suppressed because it is too large
Load Diff
384
src/data/api.ts
384
src/data/api.ts
|
@ -1,6 +1,12 @@
|
|||
import { MainClient, NamedAPIResource } from 'pokenode-ts';
|
||||
import { MoveTarget, Moves, allMoves } from './move';
|
||||
import * as Utils from '../utils';
|
||||
import fs from 'vite-plugin-fs/browser';
|
||||
import { tmSpecies } from './tms';
|
||||
import PokemonSpecies, { PokemonForm } from './pokemon-species';
|
||||
import { GrowthRate } from './exp';
|
||||
import { Type } from './type';
|
||||
import { Abilities, allAbilities } from './ability';
|
||||
|
||||
const targetMap = {
|
||||
'specific-move': MoveTarget.ATTACKER,
|
||||
|
@ -33,14 +39,383 @@ const generationMap = {
|
|||
'generation-ix': 9
|
||||
};
|
||||
|
||||
const growthRateMap = {
|
||||
'slow-then-very-fast': GrowthRate.ERRATIC,
|
||||
'fast': GrowthRate.FAST,
|
||||
'medium': GrowthRate.MEDIUM_FAST,
|
||||
'medium-slow': GrowthRate.MEDIUM_SLOW,
|
||||
'slow': GrowthRate.SLOW,
|
||||
'fast-then-very-slow': GrowthRate.FLUCTUATING
|
||||
};
|
||||
|
||||
const regionalForms = [ 'alola', 'galar', 'hisui', 'paldea' ];
|
||||
|
||||
const ignoredForms = [ 'gmax', 'totem', 'cap', 'starter' ];
|
||||
|
||||
const generationDexNumbers = {
|
||||
1: 151,
|
||||
2: 251,
|
||||
3: 386,
|
||||
4: 494,
|
||||
5: 649,
|
||||
6: 721,
|
||||
7: 809,
|
||||
8: 905,
|
||||
9: 1010
|
||||
};
|
||||
|
||||
const versions = [ 'scarlet-violet', 'sword-shield', 'sun-moon' ];
|
||||
|
||||
type LevelMove = [level: integer, moveId: integer];
|
||||
|
||||
interface SpeciesLevelMoves {
|
||||
[key: string]: LevelMove[]
|
||||
}
|
||||
|
||||
interface FormLevelMoves {
|
||||
[key: integer]: LevelMove[]
|
||||
}
|
||||
|
||||
interface SpeciesFormLevelMoves {
|
||||
[key: string]: FormLevelMoves
|
||||
}
|
||||
|
||||
interface TmSpecies {
|
||||
[key: string]: string[]
|
||||
}
|
||||
|
||||
export async function printPokemon() {
|
||||
const api = new MainClient();
|
||||
|
||||
let enumStr = `export enum Species {\n`;
|
||||
let pokemonSpeciesStr = `\tallSpecies.push(\n`;
|
||||
const speciesLevelMoves: SpeciesLevelMoves = {};
|
||||
const speciesFormLevelMoves: SpeciesFormLevelMoves = {};
|
||||
const moveTmSpecies: TmSpecies = {};
|
||||
|
||||
let pokemonArr: NamedAPIResource[] = [];
|
||||
|
||||
let offset = 0;
|
||||
let pokemonResponse = await api.pokemon.listPokemons(offset, 2000)
|
||||
|
||||
pokemonArr = pokemonResponse.results;
|
||||
|
||||
const types = Utils.getEnumKeys(Type).map(t => t.toLowerCase());
|
||||
const abilities = Utils.getEnumKeys(Abilities).map(a => a.toLowerCase().replace(/\_/g, '-'));
|
||||
|
||||
const pokemonSpeciesList: PokemonSpecies[] = [];
|
||||
|
||||
for (let p of pokemonArr) {
|
||||
const pokemon = await api.pokemon.getPokemonByName(p.name);
|
||||
|
||||
let region: string = '';
|
||||
|
||||
if (pokemon.id > 10000) {
|
||||
const dexIdMatch = /\/(\d+)\//.exec(pokemon.species.url);
|
||||
if (!dexIdMatch)
|
||||
continue;
|
||||
|
||||
const matchingSpecies = pokemonSpeciesList[parseInt(dexIdMatch[1]) - 1];
|
||||
|
||||
const speciesKey = (matchingSpecies as any).key as string;
|
||||
|
||||
const formName = pokemon.name.slice(speciesKey.length + 1);
|
||||
|
||||
if (ignoredForms.filter(f => formName.indexOf(f) > -1).length)
|
||||
continue;
|
||||
|
||||
let shortFormName = formName.indexOf('-') > -1
|
||||
? formName.slice(0, formName.indexOf('-'))
|
||||
: formName;
|
||||
|
||||
if (regionalForms.indexOf(shortFormName) > -1)
|
||||
region = shortFormName.toUpperCase();
|
||||
else {
|
||||
const formBaseStats: integer[] = [];
|
||||
let formBaseTotal = 0;
|
||||
// Assume correct stat order in API result
|
||||
for (let stat of pokemon.stats) {
|
||||
formBaseStats.push(stat.base_stat);
|
||||
formBaseTotal += stat.base_stat;
|
||||
}
|
||||
|
||||
const [ formType1, formType2 ] = [ types.indexOf(pokemon.types.find(t => t.slot === 1).type.name), types.indexOf(pokemon.types.find(t => t.slot === 2)?.type.name) ];
|
||||
const [ formAbility1, formAbility2, formAbilityHidden ] = [
|
||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 1)?.ability.name), 0),
|
||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 2)?.ability.name), 0),
|
||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 3)?.ability.name), 0)
|
||||
];
|
||||
|
||||
const pokemonForm = new PokemonForm(formName, formName, formType1 as Type, formType2 > -1 ? formType2 as Type : null, pokemon.height / 10, pokemon.weight / 10,
|
||||
formAbility1 as Abilities, formAbility2 as Abilities, formAbilityHidden as Abilities, formBaseTotal, formBaseStats[0], formBaseStats[1], formBaseStats[2], formBaseStats[3], formBaseStats[4], formBaseStats[5],
|
||||
matchingSpecies.catchRate, matchingSpecies.baseFriendship, matchingSpecies.baseExp, matchingSpecies.genderDiffs);
|
||||
pokemonForm.speciesId = matchingSpecies.speciesId;
|
||||
pokemonForm.formIndex = matchingSpecies.forms.length;
|
||||
pokemonForm.generation = matchingSpecies.generation;
|
||||
|
||||
let moveVer: string;
|
||||
|
||||
if (!speciesFormLevelMoves.hasOwnProperty(speciesKey))
|
||||
speciesFormLevelMoves[speciesKey] = [];
|
||||
speciesFormLevelMoves[speciesKey][pokemonForm.formIndex] = [];
|
||||
|
||||
for (let version of versions) {
|
||||
if (pokemon.moves.find(m => m.version_group_details.find(v => v.version_group.name === version))) {
|
||||
moveVer = version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (moveVer) {
|
||||
pokemon.moves.forEach(moveData => {
|
||||
const verData = moveData.version_group_details.find(v => v.version_group.name === moveVer);
|
||||
if (!verData)
|
||||
return;
|
||||
|
||||
const moveName = moveData.move.name.toUpperCase().replace(/\_/g, '').replace(/\-/g, '_');
|
||||
const moveId = Math.max(Utils.getEnumKeys(Moves).indexOf(moveName), 0);
|
||||
|
||||
if (verData.move_learn_method.name === 'level-up')
|
||||
speciesFormLevelMoves[speciesKey][pokemonForm.formIndex].push([ verData.level_learned_at, moveId ]);
|
||||
});
|
||||
|
||||
if (JSON.stringify(speciesLevelMoves[speciesKey]) === JSON.stringify(speciesFormLevelMoves[speciesKey][pokemonForm.formIndex])) {
|
||||
delete speciesFormLevelMoves[speciesKey][pokemonForm.formIndex];
|
||||
if (!Object.keys(speciesFormLevelMoves[speciesKey]).length)
|
||||
delete speciesFormLevelMoves[speciesKey];
|
||||
}
|
||||
}
|
||||
|
||||
matchingSpecies.forms.push(pokemonForm);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const species = await api.pokemon.getPokemonSpeciesByName(pokemon.species.name);
|
||||
|
||||
let speciesKey = species.name.toUpperCase().replace(/\-/g, '_');
|
||||
|
||||
let dexId = species.id;
|
||||
|
||||
if (region) {
|
||||
dexId += (regionalForms.indexOf(region.toLowerCase()) + 1) * 2000;
|
||||
speciesKey = `${region}_${speciesKey}`;
|
||||
}
|
||||
|
||||
let generationIndex = 0;
|
||||
|
||||
if (!region)
|
||||
while (++generationIndex < 9 && dexId > generationDexNumbers[generationIndex]);
|
||||
else
|
||||
generationIndex = regionalForms.indexOf(region.toLowerCase()) + 6;
|
||||
|
||||
const baseStats: integer[] = [];
|
||||
let baseTotal = 0;
|
||||
// Assume correct stat order in API result
|
||||
for (let stat of pokemon.stats) {
|
||||
baseStats.push(stat.base_stat);
|
||||
baseTotal += stat.base_stat;
|
||||
}
|
||||
|
||||
console.log(pokemon);
|
||||
|
||||
const [ type1, type2 ] = [ types.indexOf(pokemon.types.find(t => t.slot === 1).type.name), types.indexOf(pokemon.types.find(t => t.slot === 2)?.type.name) ];
|
||||
const [ ability1, ability2, abilityHidden ] = [
|
||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 1)?.ability.name), 0),
|
||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 2)?.ability.name), 0),
|
||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 3)?.ability.name), 0)
|
||||
];
|
||||
|
||||
const pokemonSpecies = new PokemonSpecies(dexId, species.names.find(n => n.language.name === 'en').name, generationIndex, species.is_legendary && baseTotal < 660, species.is_legendary && baseTotal >= 660, species.is_mythical,
|
||||
species.genera.find(g => g.language.name === 'en')?.genus, type1 as Type, type2 > -1 ? type2 as Type : null, pokemon.height / 10, pokemon.weight / 10, ability1 as Abilities, ability2 as Abilities, abilityHidden as Abilities,
|
||||
baseTotal, baseStats[0], baseStats[1], baseStats[2], baseStats[3], baseStats[4], baseStats[5], species.capture_rate, species.base_happiness, pokemon.base_experience, growthRateMap[species.growth_rate.name],
|
||||
species.gender_rate < 9 ? 100 - (species.gender_rate * 12.5) : null, species.has_gender_differences, species.forms_switchable);
|
||||
|
||||
(pokemonSpecies as any).key = speciesKey;
|
||||
|
||||
pokemonSpeciesList.push(pokemonSpecies);
|
||||
|
||||
for (let f of pokemon.forms) {
|
||||
const form = await api.pokemon.getPokemonFormByName(f.name);
|
||||
|
||||
const [ formType1, formType2 ] = [ types.indexOf(form.types.find(t => t.slot === 1).type.name), types.indexOf(form.types.find(t => t.slot === 2)?.type.name) ];
|
||||
const pokemonForm = new PokemonForm(form.form_names.find(fn => fn.language.name === 'en')?.name || form.form_name, form.form_name, formType1 as Type, formType2 > -1 ? formType2 as Type : null,
|
||||
pokemonSpecies.height, pokemonSpecies.weight, pokemonSpecies.ability1, pokemonSpecies.ability2, pokemonSpecies.abilityHidden, baseTotal, baseStats[0], baseStats[1], baseStats[2], baseStats[3], baseStats[4], baseStats[5],
|
||||
pokemonSpecies.catchRate, pokemonSpecies.baseFriendship, pokemonSpecies.baseExp, pokemonSpecies.genderDiffs);
|
||||
pokemonForm.speciesId = pokemonSpecies.speciesId;
|
||||
pokemonForm.formIndex = pokemonSpecies.forms.length;
|
||||
pokemonForm.generation = pokemonSpecies.generation;
|
||||
|
||||
pokemonSpecies.forms.push(pokemonForm);
|
||||
}
|
||||
|
||||
let moveVer: string;
|
||||
|
||||
speciesLevelMoves[speciesKey] = [];
|
||||
|
||||
for (let version of versions) {
|
||||
if (pokemon.moves.find(m => m.version_group_details.find(v => v.version_group.name === version))) {
|
||||
moveVer = version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (moveVer) {
|
||||
pokemon.moves.forEach(moveData => {
|
||||
const verData = moveData.version_group_details.find(v => v.version_group.name === moveVer);
|
||||
if (!verData)
|
||||
return;
|
||||
|
||||
const moveName = moveData.move.name.toUpperCase().replace(/\_/g, '').replace(/\-/g, '_');
|
||||
const moveId = Math.max(Utils.getEnumKeys(Moves).indexOf(moveName), 0);
|
||||
|
||||
if (verData.move_learn_method.name === 'level-up')
|
||||
speciesLevelMoves[speciesKey].push([ verData.level_learned_at, moveId ]);
|
||||
|
||||
if (tmSpecies.hasOwnProperty(moveId)) {
|
||||
if (!moveTmSpecies.hasOwnProperty(moveName))
|
||||
moveTmSpecies[moveName] = [];
|
||||
if (moveId > 0 && moveTmSpecies[moveName].indexOf(speciesKey) === -1)
|
||||
moveTmSpecies[moveName].push(speciesKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log(pokemonSpecies.name, pokemonSpecies);
|
||||
}
|
||||
|
||||
for (let pokemonSpecies of pokemonSpeciesList) {
|
||||
const speciesKey = (pokemonSpecies as any).key as string;
|
||||
|
||||
enumStr += ` ${speciesKey}${pokemonSpecies.speciesId >= 2000 ? ` = ${pokemonSpecies.speciesId}` : ''},\n`;
|
||||
pokemonSpeciesStr += ` new PokemonSpecies(Species.${speciesKey}, "${pokemonSpecies.name}", ${pokemonSpecies.generation}, ${pokemonSpecies.pseudoLegendary}, ${pokemonSpecies.legendary}, ${pokemonSpecies.mythical}, "${pokemonSpecies.species}", Type.${Type[pokemonSpecies.type1]}, ${pokemonSpecies.type2 ? `Type.${Type[pokemonSpecies.type2]}` : 'null'}, ${pokemonSpecies.height}, ${pokemonSpecies.weight}, Abilities.${Abilities[pokemonSpecies.ability1]}, Abilities.${Abilities[pokemonSpecies.ability2]}, Abilities.${Abilities[pokemonSpecies.abilityHidden]}, ${pokemonSpecies.baseTotal}, ${pokemonSpecies.baseStats[0]}, ${pokemonSpecies.baseStats[1]}, ${pokemonSpecies.baseStats[2]}, ${pokemonSpecies.baseStats[3]}, ${pokemonSpecies.baseStats[4]}, ${pokemonSpecies.baseStats[5]}, ${pokemonSpecies.catchRate}, ${pokemonSpecies.baseFriendship}, ${pokemonSpecies.baseExp}, GrowthRate.${GrowthRate[pokemonSpecies.growthRate]}, ${pokemonSpecies.malePercent}, ${pokemonSpecies.genderDiffs}`;
|
||||
if (pokemonSpecies.forms.length > 1) {
|
||||
pokemonSpeciesStr += `, ${pokemonSpecies.canChangeForm},`;
|
||||
for (let form of pokemonSpecies.forms)
|
||||
pokemonSpeciesStr += `\n new PokemonForm("${form.formName}", "${form.formName}", Type.${Type[form.type1]}, ${form.type2 ? `Type.${Type[form.type2]}` : 'null'}, ${form.height}, ${form.weight}, Abilities.${Abilities[form.ability1]}, Abilities.${Abilities[form.ability2]}, Abilities.${Abilities[form.abilityHidden]}, ${form.baseTotal}, ${form.baseStats[0]}, ${form.baseStats[1]}, ${form.baseStats[2]}, ${form.baseStats[3]}, ${form.baseStats[4]}, ${form.baseStats[5]}, ${form.catchRate}, ${form.baseFriendship}, ${form.baseExp}${form.genderDiffs ? ', true' : ''}),`;
|
||||
pokemonSpeciesStr += '\n ';
|
||||
}
|
||||
pokemonSpeciesStr += `),\n`;
|
||||
}
|
||||
|
||||
let speciesLevelMovesStr = `export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {\n`;
|
||||
let speciesFormLevelMovesStr = `export const pokemonFormLevelMoves: PokemonSpeciesFormLevelMoves = {\n`;
|
||||
let tmSpeciesStr = `export const tmSpecies: TmSpecies = {\n`;
|
||||
|
||||
for (let species of Object.keys(speciesLevelMoves)) {
|
||||
speciesLevelMovesStr += ` [Species.${species}]: [\n`;
|
||||
|
||||
const orderedLevelMoves = speciesLevelMoves[species].sort((a: LevelMove, b: LevelMove) => {
|
||||
if (a[0] !== b[0])
|
||||
return a[0] < b[0] ? -1 : 1;
|
||||
return a[1] < b[1] ? -1 : 1;
|
||||
});
|
||||
|
||||
for (let lm of orderedLevelMoves)
|
||||
speciesLevelMovesStr += ` [ ${lm[0]}, Moves.${Moves[lm[1]]} ],\n`;
|
||||
|
||||
speciesLevelMovesStr += ` ],\n`;
|
||||
}
|
||||
|
||||
for (let species of Object.keys(speciesFormLevelMoves)) {
|
||||
speciesFormLevelMovesStr += ` [Species.${species}]: {\n`;
|
||||
|
||||
for (let f of Object.keys(speciesFormLevelMoves[species])) {
|
||||
speciesFormLevelMovesStr += ` ${f}: [\n`;
|
||||
|
||||
const orderedLevelMoves = speciesFormLevelMoves[species][f].sort((a: LevelMove, b: LevelMove) => {
|
||||
if (a[0] !== b[0])
|
||||
return a[0] < b[0] ? -1 : 1;
|
||||
return a[1] < b[1] ? -1 : 1;
|
||||
});
|
||||
|
||||
for (let lm of orderedLevelMoves)
|
||||
speciesFormLevelMovesStr += ` [ ${lm[0]}, Moves.${Moves[lm[1]]} ],\n`;
|
||||
|
||||
speciesFormLevelMovesStr += ` ],\n`;
|
||||
}
|
||||
|
||||
speciesFormLevelMovesStr += ` },\n`;
|
||||
}
|
||||
|
||||
enumStr += `\n};`;
|
||||
pokemonSpeciesStr += ` );`;
|
||||
speciesLevelMovesStr += `\n};`;
|
||||
speciesFormLevelMovesStr += `\n};`;
|
||||
tmSpeciesStr += `\n};`;
|
||||
|
||||
console.log(enumStr);
|
||||
console.log(pokemonSpeciesStr);
|
||||
console.log(speciesLevelMovesStr);
|
||||
console.log(speciesFormLevelMovesStr);
|
||||
console.log(tmSpeciesStr);
|
||||
}
|
||||
|
||||
export async function printAbilities() {
|
||||
const replaceText = true;
|
||||
|
||||
let abilityContent: string = await fs.readFile('./src/data/ability.ts');
|
||||
|
||||
const api = new MainClient();
|
||||
|
||||
let enumStr = `export enum Abilities {\n NONE,`;
|
||||
let abilityStr = ' allAbilities.push(';
|
||||
|
||||
abilityContent = abilityContent.slice(abilityContent.indexOf(abilityStr));
|
||||
|
||||
let abilities: NamedAPIResource[] = [];
|
||||
let offset = 0;
|
||||
let abilitiesResponse = await api.pokemon.listAbilities(offset, 2000);
|
||||
abilities = abilitiesResponse.results;
|
||||
|
||||
for (let a of abilities) {
|
||||
const ability = await api.pokemon.getAbilityByName(a.name);
|
||||
const abilityEnumName = ability.name.toUpperCase().replace(/\_/g, '').replace(/\-/g, '_');
|
||||
enumStr += `\n ${abilityEnumName},`;
|
||||
console.log(ability.name, ability);
|
||||
|
||||
const matchingLineIndex = abilityContent.search(new RegExp(`new Ability\\\(Abilities.${abilityEnumName},`));
|
||||
let matchingLine = matchingLineIndex > -1 ? abilityContent.slice(matchingLineIndex) : null;
|
||||
if (matchingLine)
|
||||
matchingLine = matchingLine.slice(0, matchingLine.search(/,(?: \/\/.*?)?(?:\r)?\n[ \t]+(?:new|\);)/));
|
||||
|
||||
let abilityName = ability.names.find(ln => ln.language.name === 'en').name;
|
||||
[ 'N', 'P' ].every(s => {
|
||||
if (!matchingLine || matchingLine.indexOf(` (${s})`) > -1) {
|
||||
abilityName += ` (${s})`;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
let flavorText: string;
|
||||
if (!matchingLine || replaceText) {
|
||||
for (let version of versions) {
|
||||
if ((flavorText = ability.flavor_text_entries.find(fte => fte.language.name === 'en' && fte.version_group.name === version)?.flavor_text) || '') {
|
||||
if (flavorText.indexOf('forgotten') > -1)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (matchingLine)
|
||||
flavorText = allAbilities[ability.id].description;
|
||||
abilityStr += `\n new Ability(Abilities.${abilityEnumName}, "${abilityName}", "${flavorText?.replace(/\n/g, '\\n').replace(/ /g, ' ').replace(/’/g, '\'') || ''}", ${generationMap[ability.generation.name]})`;
|
||||
if (matchingLine && matchingLine.length > 1) {
|
||||
const newLineIndex = matchingLine.indexOf('\n');
|
||||
if (newLineIndex > -1)
|
||||
abilityStr += matchingLine.slice(newLineIndex);
|
||||
}
|
||||
abilityStr += ',';
|
||||
}
|
||||
|
||||
enumStr += `\n};`;
|
||||
abilityStr += `\n);`;
|
||||
|
||||
console.log(enumStr);
|
||||
console.log(abilityStr);
|
||||
}
|
||||
|
||||
export async function printMoves() {
|
||||
return;
|
||||
const replaceText = true;
|
||||
|
||||
let moveContent: string = await fs.readFile('./src/data/move.ts');
|
||||
|
@ -55,12 +430,7 @@ export async function printMoves() {
|
|||
let moves: NamedAPIResource[] = [];
|
||||
let offset = 0;
|
||||
let movesResponse = await api.move.listMoves(offset, 2000);
|
||||
moves = moves.concat(movesResponse.results);
|
||||
while (movesResponse.next) {
|
||||
offset += movesResponse.count;
|
||||
movesResponse = await api.move.listMoves(offset, 2000);
|
||||
moves = moves.concat(movesResponse.results);
|
||||
}
|
||||
moves = movesResponse.results;
|
||||
|
||||
console.log(moves);
|
||||
|
||||
|
|
|
@ -3202,7 +3202,7 @@ export function initMoves() {
|
|||
.attr(FlinchAttr)
|
||||
.condition((user: Pokemon, target: Pokemon, move: Move) => user.status?.effect === StatusEffect.SLEEP)
|
||||
.soundBased(),
|
||||
new StatusMove(Moves.CURSE, "Curse (N)", Type.GHOST, -1, 10, -1, "A move that works differently for the Ghost type than for all other types.", -1, 0, 2)
|
||||
new StatusMove(Moves.CURSE, "Curse (N)", Type.UNKNOWN, -1, 10, -1, "A move that works differently for the Ghost type than for all other types.", -1, 0, 2)
|
||||
.target(MoveTarget.USER),
|
||||
new AttackMove(Moves.FLAIL, "Flail", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 15, -1, "The user flails about aimlessly to attack. The less HP the user has, the greater the move's power.", -1, 0, 2)
|
||||
.attr(LowHpPowerAttr),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -648,8 +648,427 @@ export enum Species {
|
|||
KELDEO,
|
||||
MELOETTA,
|
||||
GENESECT,
|
||||
XERNEAS = 716,
|
||||
CHESPIN,
|
||||
QUILLADIN,
|
||||
CHESNAUGHT,
|
||||
FENNEKIN,
|
||||
BRAIXEN,
|
||||
DELPHOX,
|
||||
FROAKIE,
|
||||
FROGADIER,
|
||||
GRENINJA,
|
||||
BUNNELBY,
|
||||
DIGGERSBY,
|
||||
FLETCHLING,
|
||||
FLETCHINDER,
|
||||
TALONFLAME,
|
||||
SCATTERBUG,
|
||||
SPEWPA,
|
||||
VIVILLON,
|
||||
LITLEO,
|
||||
PYROAR,
|
||||
FLABEBE,
|
||||
FLOETTE,
|
||||
FLORGES,
|
||||
SKIDDO,
|
||||
GOGOAT,
|
||||
PANCHAM,
|
||||
PANGORO,
|
||||
FURFROU,
|
||||
ESPURR,
|
||||
MEOWSTIC,
|
||||
HONEDGE,
|
||||
DOUBLADE,
|
||||
AEGISLASH,
|
||||
SPRITZEE,
|
||||
AROMATISSE,
|
||||
SWIRLIX,
|
||||
SLURPUFF,
|
||||
INKAY,
|
||||
MALAMAR,
|
||||
BINACLE,
|
||||
BARBARACLE,
|
||||
SKRELP,
|
||||
DRAGALGE,
|
||||
CLAUNCHER,
|
||||
CLAWITZER,
|
||||
HELIOPTILE,
|
||||
HELIOLISK,
|
||||
TYRUNT,
|
||||
TYRANTRUM,
|
||||
AMAURA,
|
||||
AURORUS,
|
||||
SYLVEON,
|
||||
HAWLUCHA,
|
||||
DEDENNE,
|
||||
CARBINK,
|
||||
GOOMY,
|
||||
SLIGGOO,
|
||||
GOODRA,
|
||||
KLEFKI,
|
||||
PHANTUMP,
|
||||
TREVENANT,
|
||||
PUMPKABOO,
|
||||
GOURGEIST,
|
||||
BERGMITE,
|
||||
AVALUGG,
|
||||
NOIBAT,
|
||||
NOIVERN,
|
||||
XERNEAS,
|
||||
YVELTAL,
|
||||
ETERNATUS = 890,
|
||||
ANNIHILAPE = 979
|
||||
ZYGARDE,
|
||||
DIANCIE,
|
||||
HOOPA,
|
||||
VOLCANION,
|
||||
ROWLET,
|
||||
DARTRIX,
|
||||
DECIDUEYE,
|
||||
LITTEN,
|
||||
TORRACAT,
|
||||
INCINEROAR,
|
||||
POPPLIO,
|
||||
BRIONNE,
|
||||
PRIMARINA,
|
||||
PIKIPEK,
|
||||
TRUMBEAK,
|
||||
TOUCANNON,
|
||||
YUNGOOS,
|
||||
GUMSHOOS,
|
||||
GRUBBIN,
|
||||
CHARJABUG,
|
||||
VIKAVOLT,
|
||||
CRABRAWLER,
|
||||
CRABOMINABLE,
|
||||
ORICORIO,
|
||||
CUTIEFLY,
|
||||
RIBOMBEE,
|
||||
ROCKRUFF,
|
||||
LYCANROC,
|
||||
WISHIWASHI,
|
||||
MAREANIE,
|
||||
TOXAPEX,
|
||||
MUDBRAY,
|
||||
MUDSDALE,
|
||||
DEWPIDER,
|
||||
ARAQUANID,
|
||||
FOMANTIS,
|
||||
LURANTIS,
|
||||
MORELULL,
|
||||
SHIINOTIC,
|
||||
SALANDIT,
|
||||
SALAZZLE,
|
||||
STUFFUL,
|
||||
BEWEAR,
|
||||
BOUNSWEET,
|
||||
STEENEE,
|
||||
TSAREENA,
|
||||
COMFEY,
|
||||
ORANGURU,
|
||||
PASSIMIAN,
|
||||
WIMPOD,
|
||||
GOLISOPOD,
|
||||
SANDYGAST,
|
||||
PALOSSAND,
|
||||
PYUKUMUKU,
|
||||
TYPE_NULL,
|
||||
SILVALLY,
|
||||
MINIOR,
|
||||
KOMALA,
|
||||
TURTONATOR,
|
||||
TOGEDEMARU,
|
||||
MIMIKYU,
|
||||
BRUXISH,
|
||||
DRAMPA,
|
||||
DHELMISE,
|
||||
JANGMO_O,
|
||||
HAKAMO_O,
|
||||
KOMMO_O,
|
||||
TAPU_KOKO,
|
||||
TAPU_LELE,
|
||||
TAPU_BULU,
|
||||
TAPU_FINI,
|
||||
COSMOG,
|
||||
COSMOEM,
|
||||
SOLGALEO,
|
||||
LUNALA,
|
||||
NIHILEGO,
|
||||
BUZZWOLE,
|
||||
PHEROMOSA,
|
||||
XURKITREE,
|
||||
CELESTEELA,
|
||||
KARTANA,
|
||||
GUZZLORD,
|
||||
NECROZMA,
|
||||
MAGEARNA,
|
||||
MARSHADOW,
|
||||
POIPOLE,
|
||||
NAGANADEL,
|
||||
STAKATAKA,
|
||||
BLACEPHALON,
|
||||
ZERAORA,
|
||||
MELTAN,
|
||||
MELMETAL,
|
||||
GROOKEY,
|
||||
THWACKEY,
|
||||
RILLABOOM,
|
||||
SCORBUNNY,
|
||||
RABOOT,
|
||||
CINDERACE,
|
||||
SOBBLE,
|
||||
DRIZZILE,
|
||||
INTELEON,
|
||||
SKWOVET,
|
||||
GREEDENT,
|
||||
ROOKIDEE,
|
||||
CORVISQUIRE,
|
||||
CORVIKNIGHT,
|
||||
BLIPBUG,
|
||||
DOTTLER,
|
||||
ORBEETLE,
|
||||
NICKIT,
|
||||
THIEVUL,
|
||||
GOSSIFLEUR,
|
||||
ELDEGOSS,
|
||||
WOOLOO,
|
||||
DUBWOOL,
|
||||
CHEWTLE,
|
||||
DREDNAW,
|
||||
YAMPER,
|
||||
BOLTUND,
|
||||
ROLYCOLY,
|
||||
CARKOL,
|
||||
COALOSSAL,
|
||||
APPLIN,
|
||||
FLAPPLE,
|
||||
APPLETUN,
|
||||
SILICOBRA,
|
||||
SANDACONDA,
|
||||
CRAMORANT,
|
||||
ARROKUDA,
|
||||
BARRASKEWDA,
|
||||
TOXEL,
|
||||
TOXTRICITY,
|
||||
SIZZLIPEDE,
|
||||
CENTISKORCH,
|
||||
CLOBBOPUS,
|
||||
GRAPPLOCT,
|
||||
SINISTEA,
|
||||
POLTEAGEIST,
|
||||
HATENNA,
|
||||
HATTREM,
|
||||
HATTERENE,
|
||||
IMPIDIMP,
|
||||
MORGREM,
|
||||
GRIMMSNARL,
|
||||
OBSTAGOON,
|
||||
PERRSERKER,
|
||||
CURSOLA,
|
||||
SIRFETCHD,
|
||||
MR_RIME,
|
||||
RUNERIGUS,
|
||||
MILCERY,
|
||||
ALCREMIE,
|
||||
FALINKS,
|
||||
PINCURCHIN,
|
||||
SNOM,
|
||||
FROSMOTH,
|
||||
STONJOURNER,
|
||||
EISCUE,
|
||||
INDEEDEE,
|
||||
MORPEKO,
|
||||
CUFANT,
|
||||
COPPERAJAH,
|
||||
DRACOZOLT,
|
||||
ARCTOZOLT,
|
||||
DRACOVISH,
|
||||
ARCTOVISH,
|
||||
DURALUDON,
|
||||
DREEPY,
|
||||
DRAKLOAK,
|
||||
DRAGAPULT,
|
||||
ZACIAN,
|
||||
ZAMAZENTA,
|
||||
ETERNATUS,
|
||||
KUBFU,
|
||||
URSHIFU,
|
||||
ZARUDE,
|
||||
REGIELEKI,
|
||||
REGIDRAGO,
|
||||
GLASTRIER,
|
||||
SPECTRIER,
|
||||
CALYREX,
|
||||
WYRDEER,
|
||||
KLEAVOR,
|
||||
URSALUNA,
|
||||
BASCULEGION,
|
||||
SNEASLER,
|
||||
OVERQWIL,
|
||||
ENAMORUS,
|
||||
SPRIGATITO,
|
||||
FLORAGATO,
|
||||
MEOWSCARADA,
|
||||
FUECOCO,
|
||||
CROCALOR,
|
||||
SKELEDIRGE,
|
||||
QUAXLY,
|
||||
QUAXWELL,
|
||||
QUAQUAVAL,
|
||||
LECHONK,
|
||||
OINKOLOGNE,
|
||||
TAROUNTULA,
|
||||
SPIDOPS,
|
||||
NYMBLE,
|
||||
LOKIX,
|
||||
PAWMI,
|
||||
PAWMO,
|
||||
PAWMOT,
|
||||
TANDEMAUS,
|
||||
MAUSHOLD,
|
||||
FIDOUGH,
|
||||
DACHSBUN,
|
||||
SMOLIV,
|
||||
DOLLIV,
|
||||
ARBOLIVA,
|
||||
SQUAWKABILLY,
|
||||
NACLI,
|
||||
NACLSTACK,
|
||||
GARGANACL,
|
||||
CHARCADET,
|
||||
ARMAROUGE,
|
||||
CERULEDGE,
|
||||
TADBULB,
|
||||
BELLIBOLT,
|
||||
WATTREL,
|
||||
KILOWATTREL,
|
||||
MASCHIFF,
|
||||
MABOSSTIFF,
|
||||
SHROODLE,
|
||||
GRAFAIAI,
|
||||
BRAMBLIN,
|
||||
BRAMBLEGHAST,
|
||||
TOEDSCOOL,
|
||||
TOEDSCRUEL,
|
||||
KLAWF,
|
||||
CAPSAKID,
|
||||
SCOVILLAIN,
|
||||
RELLOR,
|
||||
RABSCA,
|
||||
FLITTLE,
|
||||
ESPATHRA,
|
||||
TINKATINK,
|
||||
TINKATUFF,
|
||||
TINKATON,
|
||||
WIGLETT,
|
||||
WUGTRIO,
|
||||
BOMBIRDIER,
|
||||
FINIZEN,
|
||||
PALAFIN,
|
||||
VAROOM,
|
||||
REVAVROOM,
|
||||
CYCLIZAR,
|
||||
ORTHWORM,
|
||||
GLIMMET,
|
||||
GLIMMORA,
|
||||
GREAVARD,
|
||||
HOUNDSTONE,
|
||||
FLAMIGO,
|
||||
CETODDLE,
|
||||
CETITAN,
|
||||
VELUZA,
|
||||
DONDOZO,
|
||||
TATSUGIRI,
|
||||
ANNIHILAPE,
|
||||
CLODSIRE,
|
||||
FARIGIRAF,
|
||||
DUDUNSPARCE,
|
||||
KINGAMBIT,
|
||||
GREAT_TUSK,
|
||||
SCREAM_TAIL,
|
||||
BRUTE_BONNET,
|
||||
FLUTTER_MANE,
|
||||
SLITHER_WING,
|
||||
SANDY_SHOCKS,
|
||||
IRON_TREADS,
|
||||
IRON_BUNDLE,
|
||||
IRON_HANDS,
|
||||
IRON_JUGULIS,
|
||||
IRON_MOTH,
|
||||
IRON_THORNS,
|
||||
FRIGIBAX,
|
||||
ARCTIBAX,
|
||||
BAXCALIBUR,
|
||||
GIMMIGHOUL,
|
||||
GHOLDENGO,
|
||||
WO_CHIEN,
|
||||
CHIEN_PAO,
|
||||
TING_LU,
|
||||
CHI_YU,
|
||||
ROARING_MOON,
|
||||
IRON_VALIANT,
|
||||
KORAIDON,
|
||||
MIRAIDON,
|
||||
WALKING_WAKE,
|
||||
IRON_LEAVES,
|
||||
DIPPLIN,
|
||||
POLTCHAGEIST,
|
||||
SINISTCHA,
|
||||
OKIDOGI,
|
||||
MUNKIDORI,
|
||||
FEZANDIPITI,
|
||||
OGERPON,
|
||||
ALOLA_RATTATA = 2019,
|
||||
ALOLA_RATICATE = 2020,
|
||||
ALOLA_RAICHU = 2026,
|
||||
ALOLA_SANDSHREW = 2027,
|
||||
ALOLA_SANDSLASH = 2028,
|
||||
ALOLA_VULPIX = 2037,
|
||||
ALOLA_NINETALES = 2038,
|
||||
ALOLA_DIGLETT = 2050,
|
||||
ALOLA_DUGTRIO = 2051,
|
||||
ALOLA_MEOWTH = 2052,
|
||||
ALOLA_PERSIAN = 2053,
|
||||
ALOLA_GEODUDE = 2074,
|
||||
ALOLA_GRAVELER = 2075,
|
||||
ALOLA_GOLEM = 2076,
|
||||
ALOLA_GRIMER = 2088,
|
||||
ALOLA_MUK = 2089,
|
||||
ALOLA_EXEGGUTOR = 2103,
|
||||
ALOLA_MAROWAK = 2105,
|
||||
GALAR_MEOWTH = 4052,
|
||||
GALAR_PONYTA = 4077,
|
||||
GALAR_RAPIDASH = 4078,
|
||||
GALAR_SLOWPOKE = 4079,
|
||||
GALAR_SLOWBRO = 4080,
|
||||
GALAR_FARFETCHD = 4083,
|
||||
GALAR_WEEZING = 4110,
|
||||
GALAR_MR_MIME = 4122,
|
||||
GALAR_ARTICUNO = 4144,
|
||||
GALAR_ZAPDOS = 4145,
|
||||
GALAR_MOLTRES = 4146,
|
||||
GALAR_SLOWKING = 4199,
|
||||
GALAR_CORSOLA = 4222,
|
||||
GALAR_ZIGZAGOON = 4263,
|
||||
GALAR_LINOONE = 4264,
|
||||
GALAR_DARUMAKA = 4554,
|
||||
GALAR_DARMANITAN = 4555,
|
||||
GALAR_YAMASK = 4562,
|
||||
GALAR_STUNFISK = 4618,
|
||||
HISUI_GROWLITHE = 6058,
|
||||
HISUI_ARCANINE = 6059,
|
||||
HISUI_VOLTORB = 6100,
|
||||
HISUI_ELECTRODE = 6101,
|
||||
HISUI_TYPHLOSION = 6157,
|
||||
HISUI_QWILFISH = 6211,
|
||||
HISUI_SNEASEL = 6215,
|
||||
HISUI_SAMUROTT = 6503,
|
||||
HISUI_LILLIGANT = 6549,
|
||||
HISUI_ZORUA = 6570,
|
||||
HISUI_ZOROARK = 6571,
|
||||
HISUI_BRAVIARY = 6628,
|
||||
HISUI_SLIGGOO = 6705,
|
||||
HISUI_GOODRA = 6706,
|
||||
HISUI_AVALUGG = 6713,
|
||||
HISUI_DECIDUEYE = 6724,
|
||||
PALDEA_TAUROS = 8128,
|
||||
PALDEA_WOOPER = 8194,
|
||||
};
|
|
@ -613,7 +613,7 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
[TrainerType.INFIELDER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST),
|
||||
[TrainerType.JANITOR]: new TrainerConfig(++t).setMoneyMultiplier(1.1).setEncounterBgm(TrainerType.CLERK),
|
||||
[TrainerType.LINEBACKER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST),
|
||||
[TrainerType.MAID]: new TrainerConfig(++t).setMoneyMultiplier(1.6).setEncounterBgm(TrainerType.RICH).setSpeciesFilter(s => s.eggType1 === 'Field' || s.eggType2 === 'Field'),
|
||||
[TrainerType.MAID]: new TrainerConfig(++t).setMoneyMultiplier(1.6).setEncounterBgm(TrainerType.RICH),
|
||||
[TrainerType.MUSICIAN]: new TrainerConfig(++t).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.SING)),
|
||||
[TrainerType.NURSE]: new TrainerConfig(++t).setMoneyMultiplier(1.8).setEncounterBgm('lass').setSpeciesFilter(s => !!s.getLevelMoves().find(plm => plm[1] === Moves.CHARM) || !!s.getLevelMoves().find(plm => plm[1] === Moves.HEAL_PULSE)),
|
||||
[TrainerType.NURSERY_AIDE]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setEncounterBgm('lass'),
|
||||
|
@ -647,7 +647,7 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
[TrainerPoolTier.SUPER_RARE]: [ Species.BELDUM, Species.ESPEON /* species.WYRDEER, */ ],
|
||||
}),
|
||||
[TrainerType.RANGER]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.BACKPACKER).setHasGenders(),
|
||||
[TrainerType.RICH]: new TrainerConfig(++t).setMoneyMultiplier(5).setName('Gentleman').setHasGenders().setSpeciesFilter(s => s.eggType1 === 'Field' || s.eggType2 === 'Field'),
|
||||
[TrainerType.RICH]: new TrainerConfig(++t).setMoneyMultiplier(5).setName('Gentleman').setHasGenders(),
|
||||
[TrainerType.RICH_KID]: new TrainerConfig(++t).setMoneyMultiplier(3.75).setName('Rich Boy').setHasGenders('Lady').setEncounterBgm(TrainerType.RICH),
|
||||
[TrainerType.ROUGHNECK]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.DARK)),
|
||||
[TrainerType.SCIENTIST]: new TrainerConfig(++t).setHasGenders().setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.SCIENTIST)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export enum Type {
|
||||
UNKNOWN = -1,
|
||||
NORMAL = 0,
|
||||
FIGHTING,
|
||||
FLYING,
|
||||
|
|
|
@ -22,7 +22,7 @@ import { WeatherType } from './data/weather';
|
|||
import { TempBattleStat } from './data/temp-battle-stat';
|
||||
import { ArenaTagType, WeakenMoveTypeTag } from './data/arena-tag';
|
||||
import { Biome } from './data/biome';
|
||||
import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, IgnoreOpponentStatChangesAbAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability';
|
||||
import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, IgnoreOpponentStatChangesAbAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability';
|
||||
import PokemonData from './system/pokemon-data';
|
||||
import { BattlerIndex } from './battle';
|
||||
import { Mode } from './ui/ui';
|
||||
|
@ -140,11 +140,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
];
|
||||
|
||||
if (this.gender === undefined) {
|
||||
if (this.getSpeciesForm().malePercent === null)
|
||||
if (this.species.malePercent === null)
|
||||
this.gender = Gender.GENDERLESS;
|
||||
else {
|
||||
const genderChance = (this.id % 256) * 0.390625;
|
||||
if (genderChance < this.getSpeciesForm().malePercent)
|
||||
if (genderChance < this.species.malePercent)
|
||||
this.gender = Gender.MALE;
|
||||
else
|
||||
this.gender = Gender.FEMALE;
|
||||
|
@ -559,12 +559,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
|
||||
getAbility(): Ability {
|
||||
if (ABILITY_OVERRIDE && this.isPlayer())
|
||||
return abilities[ABILITY_OVERRIDE];
|
||||
return allAbilities[ABILITY_OVERRIDE];
|
||||
if (OPP_ABILITY_OVERRIDE && !this.isPlayer())
|
||||
return abilities[OPP_ABILITY_OVERRIDE];
|
||||
return allAbilities[OPP_ABILITY_OVERRIDE];
|
||||
if (this.fusionSpecies)
|
||||
return abilities[this.getFusionSpeciesForm().getAbility(this.fusionAbilityIndex)];
|
||||
return abilities[this.getSpeciesForm().getAbility(this.abilityIndex)];
|
||||
return allAbilities[this.getFusionSpeciesForm().getAbility(this.fusionAbilityIndex)];
|
||||
let abilityId = this.getSpeciesForm().getAbility(this.abilityIndex);
|
||||
if (abilityId === Abilities.NONE)
|
||||
abilityId = this.species.ability1;
|
||||
return allAbilities[abilityId];
|
||||
}
|
||||
|
||||
canApplyAbility(): boolean {
|
||||
|
@ -693,11 +696,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
this.fusionFormIndex = this.scene.getSpeciesFormIndex(this.fusionSpecies);
|
||||
this.fusionShiny = this.shiny;
|
||||
|
||||
if (this.getFusionSpeciesForm().malePercent === null)
|
||||
if (this.fusionSpecies.malePercent === null)
|
||||
this.fusionGender = Gender.GENDERLESS;
|
||||
else {
|
||||
const genderChance = (this.id % 256) * 0.390625;
|
||||
if (genderChance < this.getFusionSpeciesForm().malePercent)
|
||||
if (genderChance < this.fusionSpecies.malePercent)
|
||||
this.fusionGender = Gender.MALE;
|
||||
else
|
||||
this.fusionGender = Gender.FEMALE;
|
||||
|
@ -800,13 +803,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
const maxExpLevel = this.scene.getMaxExpLevel();
|
||||
const initialExp = this.exp;
|
||||
this.exp += exp;
|
||||
while (this.level < maxExpLevel && this.exp >= getLevelTotalExp(this.level + 1, this.getSpeciesForm().growthRate))
|
||||
while (this.level < maxExpLevel && this.exp >= getLevelTotalExp(this.level + 1, this.species.growthRate))
|
||||
this.level++;
|
||||
if (this.level >= maxExpLevel) {
|
||||
console.log(initialExp, this.exp, getLevelTotalExp(this.level, this.getSpeciesForm().growthRate));
|
||||
this.exp = Math.max(getLevelTotalExp(this.level, this.getSpeciesForm().growthRate), initialExp);
|
||||
console.log(initialExp, this.exp, getLevelTotalExp(this.level, this.species.growthRate));
|
||||
this.exp = Math.max(getLevelTotalExp(this.level, this.species.growthRate), initialExp);
|
||||
}
|
||||
this.levelExp = this.exp - getLevelTotalExp(this.level, this.getSpeciesForm().growthRate);
|
||||
this.levelExp = this.exp - getLevelTotalExp(this.level, this.species.growthRate);
|
||||
}
|
||||
|
||||
getOpponent(targetIndex: integer): Pokemon {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { TextStyle, addTextObject, getTextColor } from "./text";
|
|||
import { Mode } from "./ui";
|
||||
import MessageUiHandler from "./message-ui-handler";
|
||||
import { Gender, getGenderColor, getGenderSymbol } from "../data/gender";
|
||||
import { abilities } from "../data/ability";
|
||||
import { allAbilities } from "../data/ability";
|
||||
import { GameMode } from "../game-mode";
|
||||
import { Unlockables } from "../system/unlockables";
|
||||
import { GrowthRate, getGrowthRateColor } from "../data/exp";
|
||||
|
@ -754,7 +754,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||
|
||||
if (dexEntry.caughtAttr) {
|
||||
const ability = this.lastSpecies.getAbility(abilityIndex);
|
||||
this.pokemonAbilityText.setText(abilities[ability].name);
|
||||
this.pokemonAbilityText.setText(allAbilities[ability].name);
|
||||
|
||||
const isHidden = ability === this.lastSpecies.abilityHidden;
|
||||
this.pokemonAbilityText.setColor(getTextColor(!isHidden ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD));
|
||||
|
|
Loading…
Reference in New Issue