diff --git a/src/App.tsx b/src/App.tsx index e73d8c5..a28c7e2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,21 +13,20 @@ export type Tier = { const TIERS: Tier[] = [ { name: 'Start', unlockPrice: 0, buyPrice: 1, gubblePointChance: 0.0 }, - { name: 'Bronze', unlockPrice: 2, buyPrice: 3, gubblePointChance: 0.0 }, - { name: 'Silver', unlockPrice: 5, buyPrice: 7, gubblePointChance: 0.0 }, - { name: 'Gold', unlockPrice: 10, buyPrice: 15, gubblePointChance: 0.1 }, - { name: 'Platinum', unlockPrice: 20, buyPrice: 30, gubblePointChance: 0.1 }, - { name: 'Diamond', unlockPrice: 50, buyPrice: 75, gubblePointChance: 0.2 }, - { name: 'Master', unlockPrice: 100, buyPrice: 150, gubblePointChance: 0.2 }, - { name: 'Legend', unlockPrice: 200, buyPrice: 300, gubblePointChance: 0.3 }, - { name: 'Ultimate', unlockPrice: 500, buyPrice: 750, gubblePointChance: 0.3 }, - { name: 'Champion', unlockPrice: 1000, buyPrice: 1500, gubblePointChance: 0.4 }, - { name: 'Supreme', unlockPrice: 2000, buyPrice: 3000, gubblePointChance: 0.4 }, + { name: 'Bronze', unlockPrice: 3, buyPrice: 2, gubblePointChance: 0.0 }, + { name: 'Silver', unlockPrice: 7, buyPrice: 5, gubblePointChance: 0.0 }, + { name: 'Gold', unlockPrice: 15, buyPrice: 10, gubblePointChance: 0.1 }, + { name: 'Platinum', unlockPrice: 30, buyPrice: 20, gubblePointChance: 0.1 }, + { name: 'Diamond', unlockPrice: 75, buyPrice: 50, gubblePointChance: 0.2 }, + { name: 'Master', unlockPrice: 750, buyPrice: 500, gubblePointChance: 0.2 }, + { name: 'Legend', unlockPrice: 3000, buyPrice: 2000, gubblePointChance: 0.3 }, + { name: 'Ultimate', unlockPrice: 7500, buyPrice: 5000, gubblePointChance: 0.3 }, + { name: 'Champion', unlockPrice: 15000, buyPrice: 10000, gubblePointChance: 0.4 }, ]; function App() { // --- Game State --- - const [money, setMoney] = useState(20); // User starts with $20 + const [money, setMoney] = useState(5); // User starts with $20 const [unlockedTiers, setUnlockedTiers] = useState([]); // Unlocked tier names const [gubblePoints, setGubblePoints] = useState(0); const [card, setCard] = useState<{ diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 8b1d92c..e8a323a 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -34,7 +34,7 @@ const Card: React.FC = ({ card, setCard, setMoney, setGubblePoints }) 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-200 border-green-500 text-green-700' : 'bg-gray-200 border-gray-400 text-gray-500') : 'bg-yellow-100 border-yellow-400 text-yellow-700 hover:bg-yellow-200'}`} disabled={field.scratched} - onClick={() => { + onMouseMove={() => { if (field.scratched) return; if (Math.random() < (card.tier?.gubblePointChance ?? 0)) { setGubblePoints((g) => g + 1); @@ -43,9 +43,9 @@ const Card: React.FC = ({ card, setCard, setMoney, setGubblePoints }) // Determine win amount let won = null; if (card.winningNumbers.includes(field.value)) { - if (idx < 2) won = Math.floor((card.tier?.buyPrice ?? 0) * 0.5); - else if (idx < 4) won = Math.floor((card.tier?.buyPrice ?? 0) * 0.8); - else won = Math.floor((card.tier?.buyPrice ?? 0) * 1.2); + if (idx < 2) won = Math.ceil((card.tier?.buyPrice ?? 0) * 0.5); + else if (idx < 4) won = Math.ceil((card.tier?.buyPrice ?? 0) * 0.8); + else won = Math.ceil((card.tier?.buyPrice ?? 0) * 1.2); } setCard((prev) => { if (!prev) return prev;