add pokemon type

This commit is contained in:
Jeff Colombo 2019-01-20 20:22:16 -05:00
parent e4c9aff117
commit 2ad47c55d0
3 changed files with 12 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import * as fs from 'fs';
import Pokemon from 'pokemongo-json-pokedex/output/pokemon.json'; import Pokemon from 'pokemongo-json-pokedex/output/pokemon.json';
import { LevelMultipliers } from 'app/models/LevelMultipliers'; import { LevelMultipliers } from 'app/models/LevelMultipliers';
import { Grade, ILeaguePokemon, IPokemon, IStats, League } from 'app/models/Pokemon'; import { Grade, ILeaguePokemon, IPokemon, IStats, League, Type } from 'app/models/Pokemon';
type ICpAndTotalFound = Record<number, Array<IStats>>; type ICpAndTotalFound = Record<number, Array<IStats>>;
interface IStatsDistribution { interface IStatsDistribution {
@ -42,6 +42,10 @@ Pokemon.forEach((mon) => {
id: mon.id, id: mon.id,
name: mon.name, name: mon.name,
dex: mon.dex, dex: mon.dex,
types: {
type1: mon.types[0].name.toLowerCase() as Type,
type2: mon.types[1] ? mon.types[1].name.toLowerCase() as Type : null,
},
stats: mon.stats, stats: mon.stats,
family: mon.family.id, family: mon.family.id,
pvp: { pvp: {

View File

@ -123,8 +123,8 @@ export class PokemonExplorer extends React.Component<IPokemonExplorerProps, ISta
</h2> </h2>
<div className="pokemon-base-stats"> <div className="pokemon-base-stats">
<div>Base Stats</div> <div>Base Stats</div>
<div className="pokemon-type type-1">{ }</div> <div className="pokemon-type type-1">{ leaguePokemon.types.type1 }</div>
<div className="pokemon-type type-2">{ }</div> <div className="pokemon-type type-2">{ leaguePokemon.types.type2 }</div>
<div>{ leaguePokemon.stats.baseStamina }</div> <div>{ leaguePokemon.stats.baseStamina }</div>
<div>{ leaguePokemon.stats.baseAttack }</div> <div>{ leaguePokemon.stats.baseAttack }</div>
<div>{ leaguePokemon.stats.baseDefense }</div> <div>{ leaguePokemon.stats.baseDefense }</div>

View File

@ -13,11 +13,16 @@ export interface IBaseStats {
baseStamina : number; baseStamina : number;
} }
export type Type = 'bug' | 'dark' | 'dragon' | 'electric' | 'fairy' | 'fighting' | 'fire' | 'flying' | 'ghost' | 'grass' | 'ground' | 'ice' | 'normal' | 'poison' | 'psychic' | 'rock' | 'steel' | 'water';
export interface IPokemon { export interface IPokemon {
name : string; name : string;
id : string; id : string;
family : string; family : string;
dex : number; dex : number;
types : {
type1 : Type;
type2 : Type | null;
};
stats : IBaseStats; stats : IBaseStats;
} }
export type League = 'great' | 'ultra'; export type League = 'great' | 'ultra';