@@ -2,7 +2,7 @@ import React, { useState } from 'react';
22import { View , Text , Pressable , StyleSheet , ScrollView } from 'react-native' ;
33import type { GameState } from '../../engine/types' ;
44import { RARITY_COLORS , WEAPON_EVOLVE_KILLS , WEAPON_EVOLVE_COST , WEAPON_MAX_LEVEL } from '../../engine/constants' ;
5- import { buyShopItem , rerollShop , healPlayer , buyEgg , trainPets , fusePets , evolveWeapon , getPetSynergies , toggleShopSlotLock } from '../../engine/GameEngine' ;
5+ import { buyShopItem , rerollShop , healPlayer , buyEgg , trainPets , fusePets , evolveWeapon , getPetSynergies , getPetAttackStats , toggleShopSlotLock } from '../../engine/GameEngine' ;
66import { WEAPONS , EVOLVED_WEAPONS , ITEM_DEFS } from '../../engine/data' ;
77import WeaponIcon , { hasWeaponIcon } from './WeaponIcon' ;
88
@@ -34,17 +34,6 @@ const PET_DETAILS: Record<string, { upgrade: string; breed: string }> = {
3434 } ,
3535} ;
3636
37- function getPetCooldown ( level : number , kind : string ) : string {
38- const base = kind === 'snapper' ? 0.85 : kind === 'spark' ? 1.2 : 1.5 ;
39- return ( base * Math . max ( 0.62 , 1 - ( level - 1 ) * 0.035 ) ) . toFixed ( 2 ) ;
40- }
41-
42- function getPetRange ( kind : string ) : number {
43- if ( kind === 'spark' ) return 180 ;
44- if ( kind === 'mender' ) return 145 ;
45- return 130 ;
46- }
47-
4837export default function ShopOverlay ( { gameState, onNextWave } : Props ) {
4938 const [ , force ] = useState ( 0 ) ;
5039 const [ broodNotice , setBroodNotice ] = useState ( '' ) ;
@@ -54,6 +43,7 @@ export default function ShopOverlay({ gameState, onNextWave }: Props) {
5443 if ( ! state ) return null ;
5544 const { shopSlots, materials, player, wave, rerollCost, healCost } = state ;
5645 const canHeal = player . hp < player . maxHp ;
46+ const broodFull = state . pets . length + state . pendingHatches . length >= 5 ;
5747 const eggCost = 18 + state . pets . length * 6 + wave . number * 2 ;
5848 const trainCost = 10 + state . pets . reduce ( ( sum , pet ) => sum + pet . level * 4 , 0 ) ;
5949 const canTrain = state . pets . length > 0 && state . pets . some ( pet => pet . level < 9 ) ;
@@ -202,6 +192,7 @@ export default function ShopOverlay({ gameState, onNextWave }: Props) {
202192 < Text style = { s . emptyPetText } > Find eggs in the arena or buy one here.</ Text >
203193 ) : state . pets . map ( pet => {
204194 const detail = PET_DETAILS [ pet . kind ] ;
195+ const attackStats = getPetAttackStats ( pet ) ;
205196 const nextPower = pet . level >= 9 ? 'Max trained' : `Next: Pow ${ Math . round ( pet . damage + 1 + Math . floor ( ( pet . level + 1 ) / 4 ) ) } ` ;
206197 const nextPerkLevel = [ 3 , 5 , 7 ] . find ( l => l > pet . level ) ;
207198 return (
@@ -219,7 +210,7 @@ export default function ShopOverlay({ gameState, onNextWave }: Props) {
219210 < Text style = { s . petName } > { pet . name } </ Text >
220211 < Text style = { [ s . generationTag , { backgroundColor : pet . color ?? '#2DD4BF' } ] } > Gen { pet . generation ?? 1 } </ Text >
221212 </ View >
222- < Text style = { s . petLevel } > Lv.{ pet . level } · Pow { Math . round ( pet . damage ) } · { getPetCooldown ( pet . level , pet . kind ) } s · R{ getPetRange ( pet . kind ) } </ Text >
213+ < Text style = { s . petLevel } > Lv.{ pet . level } · Pow { Math . round ( pet . damage ) } · { attackStats . cooldown . toFixed ( 2 ) } s · R{ attackStats . range } </ Text >
223214 < Text style = { s . petTrait } > { pet . attackName } : { PET_TRAITS [ pet . kind ] ?? 'Companion' } </ Text >
224215 { ( pet . perks ?. length ?? 0 ) > 0 && (
225216 < View style = { s . perkRow } >
@@ -254,15 +245,14 @@ export default function ShopOverlay({ gameState, onNextWave }: Props) {
254245 < Pressable
255246 onPress = { ( ) => {
256247 if ( buyEgg ( state ) ) {
257- const newest = state . pets [ state . pets . length - 1 ] ;
258- setBroodNotice ( newest ? `${ newest . name } joined the brood` : '+12 overflow materials' ) ;
248+ setBroodNotice ( 'A new egg is hatching…' ) ;
259249 force ( n => n + 1 ) ;
260250 }
261251 } }
262- disabled = { ( materials ?? 0 ) < eggCost }
263- style = { [ s . actionBtn , ( materials ?? 0 ) < eggCost && s . disabled ] }
252+ disabled = { broodFull || ( materials ?? 0 ) < eggCost }
253+ style = { [ s . actionBtn , ( broodFull || ( materials ?? 0 ) < eggCost ) && s . disabled ] }
264254 >
265- < Text style = { s . actionText } > 🥚 Egg (🔩{ eggCost } )</ Text >
255+ < Text style = { s . actionText } > { broodFull ? '🥚 Brood Full' : `🥚 Egg (🔩$ {eggCost } )` } </ Text >
266256 </ Pressable >
267257 < Pressable
268258 onPress = { ( ) => {
0 commit comments