begin work showing type coverage

This commit is contained in:
Jeff Colombo 2019-03-10 22:08:47 -04:00
parent d9f1c35fa3
commit 7cd14f2b58
6 changed files with 41 additions and 8 deletions

16
dist/main-bundle.js vendored
View File

@ -29619,7 +29619,7 @@ function pathToRegexp (path, keys, options) {
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js because of ./node_modules/react-redux/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/extends.js because of ./node_modules/react-redux/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js because of ./node_modules/react-redux/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js because of ./node_modules/react-measure/dist/index.esm.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js because of ./node_modules/react-redux/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
@ -36665,7 +36665,7 @@ function () {
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var queryParameters, response;
var queryParameters, response, attackTypeEffectiveness;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
@ -36676,11 +36676,16 @@ function () {
case 3:
response = _context.sent;
attackTypeEffectiveness = response.attackTypeEffectiveness.map(function (tuple) {
var deserialize = [tuple[0], new Map(tuple[1])];
return deserialize;
});
return _context.abrupt("return", Object.assign({}, response, {
attackTypeEffectiveness: new Map(attackTypeEffectiveness),
combatMoves: new Map(response.combatMoves)
}));
case 5:
case 6:
case "end":
return _context.stop();
}
@ -37156,6 +37161,7 @@ function (_react_1$default$Comp) {
quickMoves: leaguePokemon.moves.quick,
chargeMoves: leaguePokemon.moves.cinematic,
selectedMoves: selectedCombatMoves,
attackTypeEffectiveness: null,
combatMoveSelectorsOpen: combatMoveSelectorsOpen,
handleToggleDropdownOpen: this.handleToggleDropdownOpen,
handleChangeSelectedMove: this.handleChangeSelectedMove
@ -38816,7 +38822,7 @@ function (_react_1$default$Comp) {
}), chargeMove2 && chargeMove2Type && react_1.default.createElement(TypeIndicator_1.TypeIndicator, {
className: chargeMove2Css,
type: chargeMove2Type
}));
}), react_1.default.createElement("div", null, react_1.default.createElement("h4", null, "Type Coverage")));
}
}]);
@ -39796,9 +39802,9 @@ function (_react_1$default$Comp) {
var typeIndicator;
if (value === Pokemon_1.TypeEffectiveness.SUPER_EFFECTIVE || value === Pokemon_1.TypeEffectiveness.NOT_VERY_EFFECTIVE) {
// using `key` because these are later transformed into an array of duplicate elements
typeIndicator = react_1.default.createElement(TypeIndicator_1.TypeIndicator, {
key: key,
className: "test",
type: key
});
} else {

View File

@ -2,7 +2,7 @@ import POGOProtos from 'pogo-protos';
import { AjaxRequest } from 'api/AjaxRequest';
import { IConfig, IConfigJson } from 'app/models/Config';
import { AttackTypeEffectivenessSerializingTuple, IConfig, IConfigJson } from 'app/models/Config';
import { ILeaguePokemon } from 'app/models/League';
import { IPokemon, TypeEffectiveness } from 'app/models/Pokemon';
@ -29,8 +29,17 @@ export class PokemonService implements IPokemonService {
};
const response : IConfigJson = await this.AjaxRequest.ajaxGet('/dist/db/config.json', queryParameters);
const attackTypeEffectiveness = response.attackTypeEffectiveness.map((tuple) => {
const deserialize : AttackTypeEffectivenessSerializingTuple = [
tuple[0],
new Map(tuple[1]),
];
return deserialize;
});
return {
...response,
attackTypeEffectiveness: new Map(attackTypeEffectiveness),
combatMoves: new Map(response.combatMoves),
};
}

View File

@ -229,6 +229,7 @@ class PokemonApp extends React.Component<IConnectedPokemonAppProps, IState> {
quickMoves={ leaguePokemon.moves.quick }
chargeMoves={ leaguePokemon.moves.cinematic }
selectedMoves={ selectedCombatMoves }
attackTypeEffectiveness={ null }
combatMoveSelectorsOpen={ combatMoveSelectorsOpen }
handleToggleDropdownOpen={ this.handleToggleDropdownOpen }
handleChangeSelectedMove={ this.handleChangeSelectedMove }

View File

@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import { AttackTypeEffectiveness } from 'app/models/Config';
import { CombatMoveStats, ICombatMoveStats, IPokemonMove } from 'app/models/Pokemon';
import { CombatMoveSelectorsOpen, SelectedCombatMoves } from 'app/types';
@ -20,6 +21,7 @@ export interface IMovesExplorerProps {
chargeMove1 : IPokemonMove | null;
chargeMove2 : IPokemonMove | null;
};
attackTypeEffectiveness : AttackTypeEffectiveness | null;
combatMoveSelectorsOpen : CombatMoveSelectorsOpen;
handleToggleDropdownOpen : (menu : keyof CombatMoveSelectorsOpen, isOpen : boolean) => void;
handleChangeSelectedMove : (moves : SelectedCombatMoves) => void;
@ -96,6 +98,10 @@ export class MovesExplorer extends React.Component<IMovesExplorerProps> {
{ chargeMove2 && chargeMove2Type &&
<TypeIndicator className={ chargeMove2Css } type={ chargeMove2Type } />
}
<div>
<h4>Type Coverage</h4>
</div>
</div>
);
}

View File

@ -51,7 +51,8 @@ export class TypeEffectiveDisplay extends React.Component<ITypeEffectiveDisplayP
if (value === TypeEffectiveness.SUPER_EFFECTIVE ||
value === TypeEffectiveness.NOT_VERY_EFFECTIVE
) {
typeIndicator = <TypeIndicator key={ key } className="test" type={ key } />;
// using `key` because these are later transformed into an array of duplicate elements
typeIndicator = <TypeIndicator key={ key } type={ key } />;
} else {
typeIndicator = <TypeIndicator type={ key } />;
}

View File

@ -1,13 +1,23 @@
import POGOProtos from 'pogo-protos';
import { CombatMoveStats, ICombatMoveStats, IMaxStats } from 'app/models/Pokemon';
import { CombatMoveStats, ICombatMoveStats, IMaxStats, TypeEffectiveness } from 'app/models/Pokemon';
type TypeEffectivenessByTypeJson = Array<[POGOProtos.Enums.PokemonType, TypeEffectiveness]>;
type AttackTypeEffectivenessJson = Array<[POGOProtos.Enums.PokemonType, TypeEffectivenessByTypeJson]>;
export interface IConfigJson {
maxPossibleStats : IMaxStats;
attackTypeEffectiveness : AttackTypeEffectivenessJson;
combatMoves : Array<[POGOProtos.Enums.PokemonMove, ICombatMoveStats]>;
}
export type TypeEffectivenessByType = Map<POGOProtos.Enums.PokemonType, TypeEffectiveness>;
export type AttackTypeEffectiveness = Map<POGOProtos.Enums.PokemonType, TypeEffectivenessByType>;
export interface IConfig {
maxPossibleStats : IMaxStats;
attackTypeEffectiveness : AttackTypeEffectiveness;
combatMoves : CombatMoveStats;
}
export type AttackTypeEffectivenessSerializingTuple = [POGOProtos.Enums.PokemonType, TypeEffectivenessByType];