start reporting type coverage

This commit is contained in:
Jeff Colombo 2019-03-11 23:28:08 -04:00
parent df7cad7635
commit ca3629f255
5 changed files with 120 additions and 61 deletions

88
dist/app.css vendored
View File

@ -396,50 +396,6 @@
.MovesDropdown__legacy__3-s2n { } .MovesDropdown__legacy__3-s2n { }
.MovesExplorer__wrapper__2y-BK {
font-size: 1em; }
.MovesExplorer__wrapper__2y-BK .title {
color: #fff;
position: absolute;
margin-top: -2em;
margin-bottom: 0; }
.MovesExplorer__legacy__2PDtp {
background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.5) 5px, rgba(255, 255, 255, 0.5) 10px);
background-size: 14px 14px; }
.PokemonDisplay__highlight__h50BA {
color: #fff;
pointer-events: none; }
.PokemonDisplay__pokemonInfoWrapper__3AW3e {
margin-bottom: 1rem; }
.PokemonDisplay__pokemonInfoLeftColumn__1vugM { }
.PokemonDisplay__pokemonInfoRightColumn__27Q49 { }
.PokemonDisplay__pokemonName__WBKbk {
margin-bottom: 0; }
.PokemonDisplay__dexHeader__2HVfr {
margin-bottom: 0.25rem; }
.PokemonDisplay__pokemonTypeWrapper__1rJIA {
display: flex;
justify-content: center;
align-self: stretch; }
.PokemonDisplay__formHeader__1pr6M {
text-transform: uppercase;
margin-bottom: 0; }
.PokemonDisplay__pokemonBaseStats__3UJvn {
display: flex;
flex-flow: column nowrap;
align-items: start;
align-self: stretch; }
.TypeEffectiveDisplay__multiplierWrapper__14os7 { .TypeEffectiveDisplay__multiplierWrapper__14os7 {
position: relative; position: relative;
z-index: 0; z-index: 0;
@ -504,6 +460,50 @@
flex-basis: unset; flex-basis: unset;
width: 6.75rem; } width: 6.75rem; }
.MovesExplorer__wrapper__2y-BK {
font-size: 1em; }
.MovesExplorer__wrapper__2y-BK .title {
color: #fff;
position: absolute;
margin-top: -2em;
margin-bottom: 0; }
.MovesExplorer__legacy__2PDtp {
background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.5) 5px, rgba(255, 255, 255, 0.5) 10px);
background-size: 14px 14px; }
.PokemonDisplay__highlight__h50BA {
color: #fff;
pointer-events: none; }
.PokemonDisplay__pokemonInfoWrapper__3AW3e {
margin-bottom: 1rem; }
.PokemonDisplay__pokemonInfoLeftColumn__1vugM { }
.PokemonDisplay__pokemonInfoRightColumn__27Q49 { }
.PokemonDisplay__pokemonName__WBKbk {
margin-bottom: 0; }
.PokemonDisplay__dexHeader__2HVfr {
margin-bottom: 0.25rem; }
.PokemonDisplay__pokemonTypeWrapper__1rJIA {
display: flex;
justify-content: center;
align-self: stretch; }
.PokemonDisplay__formHeader__1pr6M {
text-transform: uppercase;
margin-bottom: 0; }
.PokemonDisplay__pokemonBaseStats__3UJvn {
display: flex;
flex-flow: column nowrap;
align-items: start;
align-self: stretch; }
.PokemonSelectList__wrapper__2LQMY { .PokemonSelectList__wrapper__2LQMY {
font-size: 0.8rem; font-size: 0.8rem;
width: 20em; width: 20em;

48
dist/main-bundle.js vendored
View File

@ -37133,7 +37133,7 @@ exports.setMaxPossibleStats = function (maxStats) {
}; };
exports.setAttackTypeEffectiveness = function (attackTypeEffectiveness) { exports.setAttackTypeEffectiveness = function (attackTypeEffectiveness) {
return typesafe_actions_1.action(types_1.PokemonAppActionTypes.SET_COMBAT_MOVE_STATS, { return typesafe_actions_1.action(types_1.PokemonAppActionTypes.SET_ATTACK_TYPE_EFFECTIVENESS, {
attackTypeEffectiveness: attackTypeEffectiveness attackTypeEffectiveness: attackTypeEffectiveness
}); });
}; };
@ -38472,8 +38472,12 @@ var react_1 = __importDefault(__webpack_require__(/*! react */ "./node_modules/r
var classnames_1 = __importDefault(__webpack_require__(/*! classnames */ "./node_modules/classnames/index.js")); var classnames_1 = __importDefault(__webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"));
var Pokemon_1 = __webpack_require__(/*! app/models/Pokemon */ "./src/ts/app/models/Pokemon.ts");
var MovesDropdown_1 = __webpack_require__(/*! app/components/PokemonExplorer/MovesDropdown */ "./src/ts/app/components/PokemonExplorer/MovesDropdown.tsx"); var MovesDropdown_1 = __webpack_require__(/*! app/components/PokemonExplorer/MovesDropdown */ "./src/ts/app/components/PokemonExplorer/MovesDropdown.tsx");
var TypeEffectiveDisplay_1 = __webpack_require__(/*! ./TypeEffectiveDisplay */ "./src/ts/app/components/PokemonExplorer/TypeEffectiveDisplay.tsx");
var TypeIndicator_1 = __webpack_require__(/*! ./TypeIndicator */ "./src/ts/app/components/PokemonExplorer/TypeIndicator.tsx"); var TypeIndicator_1 = __webpack_require__(/*! ./TypeIndicator */ "./src/ts/app/components/PokemonExplorer/TypeIndicator.tsx");
var styles = __importStar(__webpack_require__(/*! app/components/PokemonExplorer/styles/MovesExplorer.scss */ "./src/ts/app/components/PokemonExplorer/styles/MovesExplorer.scss")); var styles = __importStar(__webpack_require__(/*! app/components/PokemonExplorer/styles/MovesExplorer.scss */ "./src/ts/app/components/PokemonExplorer/styles/MovesExplorer.scss"));
@ -38490,6 +38494,31 @@ function (_react_1$default$Comp) {
_this = _possibleConstructorReturn(this, _getPrototypeOf(MovesExplorer).apply(this, arguments)); _this = _possibleConstructorReturn(this, _getPrototypeOf(MovesExplorer).apply(this, arguments));
_this.calculateTypeCoverage = function () {
var _this$props = _this.props,
selectedMoves = _this$props.selectedMoves,
attackTypeEffectiveness = _this$props.attackTypeEffectiveness;
var calculatedffectiveness = new Map();
Object.values(selectedMoves).forEach(function (move) {
var moveType = _this.getMoveType(move);
if (moveType !== null) {
var moveEffectiveness = attackTypeEffectiveness.get(moveType);
if (typeof moveEffectiveness !== 'undefined') {
moveEffectiveness.forEach(function (effectiveness, type) {
var currentEffectiveness = calculatedffectiveness.get(type);
if (typeof currentEffectiveness === 'undefined' || Pokemon_1.TypeEffectiveness[effectiveness] > Pokemon_1.TypeEffectiveness[currentEffectiveness]) {
calculatedffectiveness.set(type, effectiveness);
}
});
}
}
});
return calculatedffectiveness;
};
_this.getMoveType = function (move) { _this.getMoveType = function (move) {
var moveStats = null; var moveStats = null;
@ -38540,11 +38569,11 @@ function (_react_1$default$Comp) {
_createClass(MovesExplorer, [{ _createClass(MovesExplorer, [{
key: "render", key: "render",
value: function render() { value: function render() {
var _this$props = this.props, var _this$props2 = this.props,
movesById = _this$props.movesById, movesById = _this$props2.movesById,
quickMoves = _this$props.quickMoves, quickMoves = _this$props2.quickMoves,
chargeMoves = _this$props.chargeMoves, chargeMoves = _this$props2.chargeMoves,
combatMoveSelectorsOpen = _this$props.combatMoveSelectorsOpen; combatMoveSelectorsOpen = _this$props2.combatMoveSelectorsOpen;
var _this$props$selectedM = this.props.selectedMoves, var _this$props$selectedM = this.props.selectedMoves,
quickMove = _this$props$selectedM.quickMove, quickMove = _this$props$selectedM.quickMove,
chargeMove1 = _this$props$selectedM.chargeMove1, chargeMove1 = _this$props$selectedM.chargeMove1,
@ -38591,7 +38620,10 @@ function (_react_1$default$Comp) {
}), chargeMove2 && chargeMove2Type && react_1.default.createElement(TypeIndicator_1.TypeIndicator, { }), chargeMove2 && chargeMove2Type && react_1.default.createElement(TypeIndicator_1.TypeIndicator, {
className: chargeMove2Css, className: chargeMove2Css,
type: chargeMove2Type type: chargeMove2Type
}), react_1.default.createElement("div", null, react_1.default.createElement("h4", null, "Type Coverage"))); }), react_1.default.createElement("div", null, react_1.default.createElement("h4", null, "Type Coverage"), react_1.default.createElement(TypeEffectiveDisplay_1.TypeEffectiveDisplay, {
pokemonName: "test",
effectiveness: this.calculateTypeCoverage()
})));
} }
}]); }]);
@ -38873,7 +38905,7 @@ function (_react_1$default$Comp) {
_this.props.dispatch(ActionsPokemonExplorer.setCombatMoveSelectorsOpen(combatMoveSelectorsOpen)); _this.props.dispatch(ActionsPokemonExplorer.setCombatMoveSelectorsOpen(combatMoveSelectorsOpen));
_this.props.toggleInterruption(true); _this.props.toggleInterruption(isOpen);
}; };
_this.handleOverlayClick = function () { _this.handleOverlayClick = function () {

View File

@ -6,9 +6,10 @@ import { AttackTypeEffectiveness } from 'app/models/Config';
import { CombatMoveStats, IMaxStats } from 'app/models/Pokemon'; import { CombatMoveStats, IMaxStats } from 'app/models/Pokemon';
export const setIsInterruption = (isInterruption : boolean) => action(PokemonAppActionTypes.SET_IS_INTERRUPTION, { isInterruption }); export const setIsInterruption = (isInterruption : boolean) => action(PokemonAppActionTypes.SET_IS_INTERRUPTION, { isInterruption });
export const setMaxPossibleStats = (maxStats : IMaxStats) => action(PokemonAppActionTypes.SET_MAX_STATS, { maxStats }); export const setMaxPossibleStats = (maxStats : IMaxStats) => action(PokemonAppActionTypes.SET_MAX_STATS, { maxStats });
export const setAttackTypeEffectiveness = (attackTypeEffectiveness : AttackTypeEffectiveness) => action(PokemonAppActionTypes.SET_COMBAT_MOVE_STATS, { attackTypeEffectiveness }); export const setAttackTypeEffectiveness = (attackTypeEffectiveness : AttackTypeEffectiveness) => action(PokemonAppActionTypes.SET_ATTACK_TYPE_EFFECTIVENESS, { attackTypeEffectiveness });
export const setCombatMoveStats = (combatMoves : CombatMoveStats) => action(PokemonAppActionTypes.SET_COMBAT_MOVE_STATS, { combatMoves }); export const setCombatMoveStats = (combatMoves : CombatMoveStats) => action(PokemonAppActionTypes.SET_COMBAT_MOVE_STATS, { combatMoves });

View File

@ -1,13 +1,16 @@
import POGOProtos from 'pogo-protos';
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { AttackTypeEffectiveness } from 'app/models/Config'; import { AttackTypeEffectiveness } from 'app/models/Config';
import { CombatMoveStats, ICombatMoveStats, IPokemonMove } from 'app/models/Pokemon'; import { CombatMoveStats, ICombatMoveStats, IPokemonMove, TypeEffectiveness } from 'app/models/Pokemon';
import { CombatMoveSelectorsOpen, SelectedCombatMoves } from 'app/components/PokemonExplorer/types'; import { CombatMoveSelectorsOpen, SelectedCombatMoves } from 'app/components/PokemonExplorer/types';
import { MovesDropdown } from 'app/components/PokemonExplorer/MovesDropdown'; import { MovesDropdown } from 'app/components/PokemonExplorer/MovesDropdown';
import { TypeEffectiveDisplay } from './TypeEffectiveDisplay';
import { TypeIndicator } from './TypeIndicator'; import { TypeIndicator } from './TypeIndicator';
import * as styles from 'app/components/PokemonExplorer/styles/MovesExplorer.scss'; import * as styles from 'app/components/PokemonExplorer/styles/MovesExplorer.scss';
@ -16,11 +19,7 @@ export interface IMovesExplorerProps {
movesById : CombatMoveStats; movesById : CombatMoveStats;
quickMoves : Array<IPokemonMove>; quickMoves : Array<IPokemonMove>;
chargeMoves : Array<IPokemonMove>; chargeMoves : Array<IPokemonMove>;
selectedMoves : { selectedMoves : SelectedCombatMoves;
quickMove : IPokemonMove | null;
chargeMove1 : IPokemonMove | null;
chargeMove2 : IPokemonMove | null;
};
attackTypeEffectiveness : AttackTypeEffectiveness; attackTypeEffectiveness : AttackTypeEffectiveness;
combatMoveSelectorsOpen : CombatMoveSelectorsOpen; combatMoveSelectorsOpen : CombatMoveSelectorsOpen;
handleToggleDropdownOpen : (menu : keyof CombatMoveSelectorsOpen, isOpen : boolean) => void; handleToggleDropdownOpen : (menu : keyof CombatMoveSelectorsOpen, isOpen : boolean) => void;
@ -100,12 +99,39 @@ export class MovesExplorer extends React.Component<IMovesExplorerProps> {
} }
<div> <div>
<h4>Type Coverage</h4> <h4>Type Coverage</h4>
<TypeEffectiveDisplay
pokemonName="test"
effectiveness={ this.calculateTypeCoverage() }
/>
</div> </div>
</div> </div>
); );
} }
private readonly calculateTypeCoverage = () => {
const {
selectedMoves,
attackTypeEffectiveness,
} = this.props;
const calculatedffectiveness : Map<POGOProtos.Enums.PokemonType, TypeEffectiveness> = new Map();
Object.values(selectedMoves).forEach((move) => {
const moveType = this.getMoveType(move);
if (moveType !== null) {
const moveEffectiveness = attackTypeEffectiveness.get(moveType);
if (typeof moveEffectiveness !== 'undefined') {
moveEffectiveness.forEach((effectiveness, type) => {
const currentEffectiveness = calculatedffectiveness.get(type);
if (typeof currentEffectiveness === 'undefined' || TypeEffectiveness[effectiveness] > TypeEffectiveness[currentEffectiveness]) {
calculatedffectiveness.set(type, effectiveness);
}
});
}
}
});
return calculatedffectiveness;
}
private readonly getMoveType = (move : IPokemonMove | null) => { private readonly getMoveType = (move : IPokemonMove | null) => {
let moveStats : ICombatMoveStats | null = null; let moveStats : ICombatMoveStats | null = null;
if (move !== null) { if (move !== null) {

View File

@ -181,7 +181,7 @@ class PokemonExplorer extends React.Component<IConnectedPokemonExplorerProps, IS
[menu]: isOpen, // 3/10/2019: TyepScript is not checking this! [menu]: isOpen, // 3/10/2019: TyepScript is not checking this!
}; };
this.props.dispatch(ActionsPokemonExplorer.setCombatMoveSelectorsOpen(combatMoveSelectorsOpen)); this.props.dispatch(ActionsPokemonExplorer.setCombatMoveSelectorsOpen(combatMoveSelectorsOpen));
this.props.toggleInterruption(true); this.props.toggleInterruption(isOpen);
} }
private readonly handleOverlayClick = () => { private readonly handleOverlayClick = () => {