diff --git a/src/components/GubbleStore.tsx b/src/components/GubbleStore.tsx index d03dd65..cc0d418 100644 --- a/src/components/GubbleStore.tsx +++ b/src/components/GubbleStore.tsx @@ -7,6 +7,7 @@ type Upgrades = { gubbleDouble: boolean; addFourthNumber: boolean; autoscratcher: boolean; + swipeScratcher: boolean; }; type GubbleStoreProps = { @@ -18,10 +19,11 @@ type GubbleStoreProps = { }; const UPGRADE_LIST: { key: keyof Upgrades; label: string; cost: number; description: string }[] = [ + { key: 'swipeScratcher', label: 'Swipe Scratcher', cost: 20, description: 'You only need to move the cursor over a tile to scratch it.' }, { key: 'evenDouble', label: 'Double Even Winnings', cost: 30, description: 'Double winnings from even numbers.' }, + { key: 'gubbleDouble', label: 'Double Gubble Point Gains', cost: 50, description: 'Double gubble point gains.' }, { key: 'oddDouble', label: 'Double Odd Winnings', cost: 60, description: 'Double winnings from odd numbers.' }, { key: 'allTripple', label: 'Tripple All Winnings', cost: 150, description: 'Tripple all winnings.' }, - { key: 'gubbleDouble', label: 'Double Gubble Point Gains', cost: 50, description: 'Double gubble point gains.' }, { key: 'addFourthNumber', label: 'Add Fourth Winning Number', cost: 200, description: 'Adds a fourth winning number to each card.' }, { key: 'autoscratcher', label: 'Auto Scratcher', cost: 400, description: 'Automatically scratches all tiles when you buy a card.' }, ]; diff --git a/src/components/ScratchFieldButton.tsx b/src/components/ScratchFieldButton.tsx index 7fe7acf..63063c6 100644 --- a/src/components/ScratchFieldButton.tsx +++ b/src/components/ScratchFieldButton.tsx @@ -12,6 +12,12 @@ const ScratchFieldButton: React.FC<{ upgrades?: Upgrades; formatter: Intl.NumberFormat; }> = ({ field, idx, card, setCard, setMoney, setGubblePoints, upgrades, formatter }) => { + const handleMouseMove = () => { + if (field.scratched) return; + if (upgrades?.swipeScratcher) { + handleScratch(); + } + } const handleScratch = () => { if (field.scratched) return; // Gubble point gain (with upgrade) @@ -52,7 +58,8 @@ const ScratchFieldButton: React.FC<{ className={`w-16 h-16 flex items-center justify-center rounded-lg border-2 text-2xl font-bold transition ${field.scratched ? (field.won ? 'bg-green-900 border-green-700 text-green-300' : 'bg-gray-700 border-gray-600 text-gray-400') : 'bg-yellow-900 border-yellow-700 text-yellow-300 hover:bg-yellow-800'}`} disabled={field.scratched} - onMouseMove={handleScratch} + onClick={handleScratch} + onMouseMove={handleMouseMove} > {field.scratched ? ( {field.value}{field.won ? +${formatter.format(field.won)} : ''}