add-tiuer

This commit is contained in:
lubiana 2025-07-13 11:30:59 +02:00
parent 5b822faa72
commit bf25f279c4
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
2 changed files with 11 additions and 2 deletions

View file

@ -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.' },
];

View file

@ -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 ? (
<span>{field.value}{field.won ? <span className="block text-xs font-normal text-green-300">+${formatter.format(field.won)}</span> : ''}</span>