From 47dc9b36bd0246ded57760b5b85c5b77b4ab6864 Mon Sep 17 00:00:00 2001 From: Sendou <38327916+Sendouc@users.noreply.github.com> Date: Sun, 24 May 2020 13:06:16 +0300 Subject: [PATCH] actual ap values for non-lde abilities --- .../src/components/analyzer/BuildStats.tsx | 5 +- .../src/components/analyzer/StatChart.tsx | 15 +++++- frontend-react/src/utils/lists.ts | 49 +++++++++++++++++++ 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/frontend-react/src/components/analyzer/BuildStats.tsx b/frontend-react/src/components/analyzer/BuildStats.tsx index 8e47ccb67..d7aedf4fc 100644 --- a/frontend-react/src/components/analyzer/BuildStats.tsx +++ b/frontend-react/src/components/analyzer/BuildStats.tsx @@ -30,9 +30,7 @@ const BuildStats: React.FC = ({ hideExtra, }) => { const { colorMode } = useContext(MyThemeContext) - const [expandedCharts, setExpandedCharts] = useState>( - new Set(["Shots per ink tank"]) - ) + const [expandedCharts, setExpandedCharts] = useState>(new Set()) const abilityArrays: Ability[][] = [ build.headgear ?? [], @@ -158,6 +156,7 @@ const BuildStats: React.FC = ({ ap={ap} otherAp={otherAp} getEffect={getEffect} + ability={ability} /> )} diff --git a/frontend-react/src/components/analyzer/StatChart.tsx b/frontend-react/src/components/analyzer/StatChart.tsx index 57d23fb93..fdaadae6b 100644 --- a/frontend-react/src/components/analyzer/StatChart.tsx +++ b/frontend-react/src/components/analyzer/StatChart.tsx @@ -10,12 +10,15 @@ import { Line, } from "recharts" import MyThemeContext from "../../themeContext" +import { Ability } from "../../types" +import { possibleAps } from "../../utils/lists" interface StatChartProps { title: string getEffect: (ap: number) => number ap: number otherAp?: number + ability: Ability } const StatChart: React.FC = ({ @@ -23,13 +26,21 @@ const StatChart: React.FC = ({ ap, otherAp, getEffect, + ability, }) => { const { themeColorHex, darkerBgColor } = useContext(MyThemeContext) const getData = () => { const toReturn = [] - for (let i = 0; i < 58; i++) { - toReturn.push({ name: `${i}AP`, [title]: getEffect(i) }) + const LDEAbilities = ["ISM", "ISS", "REC"] + if (LDEAbilities.includes(ability)) { + for (let i = 0; i < 58; i++) { + toReturn.push({ name: `${i}AP`, [title]: getEffect(i) }) + } + } else { + possibleAps.forEach((ap) => { + toReturn.push({ name: `${ap}AP`, [title]: getEffect(ap) }) + }) } return toReturn diff --git a/frontend-react/src/utils/lists.ts b/frontend-react/src/utils/lists.ts index f99222350..71e2d075c 100644 --- a/frontend-react/src/utils/lists.ts +++ b/frontend-react/src/utils/lists.ts @@ -1,5 +1,54 @@ import { Weapon, Ability, HeadGear, ClothingGear, ShoesGear } from "../types" +export const possibleAps = [ + 0, + 3, + 6, + 9, + 10, + 12, + 13, + 15, + 16, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 50, + 51, + 53, + 54, + 56, + 57, +] as const + export const weaponCodes: Record = { "sploosh-o-matic": "Sploosh-o-matic", "neo_sploosh-o-matic": "Neo Sploosh-o-matic",