Skip to content

Commit ba51f47

Browse files
committed
feat: display actual battle bonus via stationed pokemon
1 parent d8019f3 commit ba51f47

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/features/station/StationPopup.jsx

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import Rating from '@mui/material/Rating'
1717
import Typography from '@mui/material/Typography'
1818
import Stack from '@mui/material/Stack'
1919
import Box from '@mui/material/Box'
20-
import LockOpenIcon from '@mui/icons-material/LockOpen'
21-
import LockIcon from '@mui/icons-material/Lock'
2220

2321
import { useMemory } from '@store/useMemory'
2422
import { setDeepStore, useGetDeepStore, useStorage } from '@store/useStorage'
@@ -37,7 +35,7 @@ import {
3735
ExpandWithState,
3836
} from '@components/inputs/ExpandCollapse'
3937
import { VirtualGrid } from '@components/virtual/VirtualGrid'
40-
import { getStationAttackBonus } from '@utils/getAttackBonus'
38+
import { getStationDamageBoost } from '@utils/getAttackBonus'
4139
import { CopyCoords } from '@components/popups/Coords'
4240
import { PokeMove } from '@components/popups/PokeMove'
4341

@@ -58,7 +56,8 @@ export function StationPopup(station) {
5856
)}
5957
<StationMedia {...station} />
6058
{station.battle_start < Date.now() / 1000 &&
61-
station.battle_end > Date.now() / 1000 && (
59+
station.battle_end > Date.now() / 1000 &&
60+
!!station.total_stationed_pokemon && (
6261
<ExpandCollapse>
6362
<StationAttackBonus {...station} />
6463
<ExpandWithState
@@ -351,19 +350,14 @@ function StationAttackBonus({ total_stationed_pokemon, total_stationed_gmax }) {
351350
const { t } = useTranslation()
352351
return (
353352
<Stack alignItems="center">
354-
<Rating
355-
value={getStationAttackBonus(total_stationed_pokemon)}
356-
readOnly
357-
icon={<LockOpenIcon fontSize="inherit" />}
358-
emptyIcon={<LockIcon fontSize="inherit" />}
359-
max={4}
360-
/>
361353
<Typography variant="caption">
362-
{t('battle_bonus')} &nbsp;(
354+
{t('battle_bonus')}: +{getStationDamageBoost(total_stationed_pokemon)}%
355+
<br />
356+
{t('placed_pokemon')}:{' '}
363357
{total_stationed_gmax === undefined || total_stationed_gmax === null
364358
? ''
365-
: `${total_stationed_gmax} / `}
366-
{total_stationed_pokemon} / 40)
359+
: `${total_stationed_gmax}/`}
360+
{total_stationed_pokemon}/40
367361
</Typography>
368362
</Stack>
369363
)
@@ -389,15 +383,11 @@ function StationContent({ start_time, end_time, id }) {
389383
/** @param {import('@rm/types').Station} props */
390384
function StationMons({ id }) {
391385
const { t: tId } = useTranslateById()
392-
const { t } = useTranslation()
393386
const mons = useGetStationMons(id)
394387
const icons = useMemory((s) => s.Icons)
395388

396389
return (
397390
<CardContent sx={{ my: 1, p: 0, height: 130 }}>
398-
<Typography variant="h6" align="center">
399-
{t('placed_pokemon')}
400-
</Typography>
401391
<VirtualGrid data={mons} xs={6}>
402392
{(index, mon) => {
403393
const caption = tId(`${mon.pokemon_id}-${mon.form}`)

src/utils/getAttackBonus.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@ export function getStationAttackBonus(stationedPokemon) {
88
if (stationedPokemon > 0) return 1
99
return 0
1010
}
11+
12+
/** https://www.reddit.com/r/TheSilphRoad/comments/1nmx8fb/small_update_on_max_battle_parameters_and_the_cpm/
13+
* @param {number} stationedPokemon */
14+
export function getStationDamageBoost(stationedPokemon) {
15+
const boostTable = [
16+
0, 10, 15, 17, 18, 18.7, 19.1, 19.2, 19.3, 19.4, 19.5, 19.6, 19.7, 19.8,
17+
19.9,
18+
]
19+
if (stationedPokemon >= 15) return 20
20+
return boostTable[stationedPokemon] || 0
21+
}

0 commit comments

Comments
 (0)