feat: obchod, černé můry, netopýr, pavouk a denní úkoly u chytání motýlků
CI / Generate TypeScript types (push) Successful in 15s
CI / Server unit tests (push) Successful in 23s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 1m2s
CI / Playwright E2E tests (push) Successful in 1m33s
CI / Build and push Docker image (push) Successful in 49s
CI / Notify (push) Successful in 1s
CI / Generate TypeScript types (push) Successful in 15s
CI / Server unit tests (push) Successful in 23s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 1m2s
CI / Playwright E2E tests (push) Successful in 1m33s
CI / Build and push Docker image (push) Successful in 49s
CI / Notify (push) Successful in 1s
- obchod s pomůckami a trvalými vylepšeními (větší síťka, strašák, zpevněná síťka) – mince mají trvalý smysl - černé můry se míchají mezi motýly; chycení (i magnetem) ubere hodně úlovků - ptáci silnější, plašič dražší a kratší, zloději chodí častěji podle bohatství - denní úkol s odměnou + achievementy/odznaky - netopýr v noci loví motýly, pavouk zamotá síťku pavučinou – oba na zaklikání - nákupní hlášky rozlišují nedostatek mincí od jiné chyby; herní smyčka se pozastaví při skryté záložce Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e3f439bde0
commit
252d105408
@@ -11,8 +11,19 @@ import {
|
||||
defeatThief as defeatThiefApi,
|
||||
reportCaterpillarAte as caterpillarAteApi,
|
||||
defeatCaterpillar as defeatCaterpillarApi,
|
||||
reportMothHit as mothHitApi,
|
||||
buyPremiumNet as buyPremiumApi,
|
||||
buyWaspSpray as waspSprayApi,
|
||||
buyInsurance as buyInsuranceApi,
|
||||
buyUpgrade as buyUpgradeApi,
|
||||
} from '../../../types';
|
||||
|
||||
/** Druhy trvalých vylepšení v obchodě. */
|
||||
export type UpgradeItem = 'net' | 'scarecrow' | 'reinforced';
|
||||
|
||||
/** Výsledek nákupu: úspěch / nedostatek mincí / jiná chyba (např. starý server). */
|
||||
export type BuyResult = 'ok' | 'poor' | 'error';
|
||||
|
||||
/** Jak dlouho se čeká, než se nasbíraná dávka úlovků odešle na server. */
|
||||
const FLUSH_DEBOUNCE_MS = 1500;
|
||||
/** Jak často se přenačte stav ze serveru (kvůli přibývajícím škůdcům). */
|
||||
@@ -108,12 +119,12 @@ export function useButterflyStats(onReward?: (e: RewardEvent) => void) {
|
||||
} catch { /* ignore */ }
|
||||
}, [applyStats]);
|
||||
|
||||
const buyRepellent = useCallback(async (): Promise<boolean> => {
|
||||
const buyRepellent = useCallback(async (): Promise<BuyResult> => {
|
||||
try {
|
||||
const res = await buyRepellentApi();
|
||||
if (res.data) { applyStats(res.data); return true; }
|
||||
return false;
|
||||
} catch { return false; }
|
||||
if (res.data) { applyStats(res.data); return 'ok'; }
|
||||
return res.response?.status === 402 ? 'poor' : 'error';
|
||||
} catch { return 'error'; }
|
||||
}, [applyStats]);
|
||||
|
||||
const reportTear = useCallback(async () => {
|
||||
@@ -147,6 +158,34 @@ export function useButterflyStats(onReward?: (e: RewardEvent) => void) {
|
||||
} catch { /* ignore */ }
|
||||
}, [applyStats]);
|
||||
|
||||
/** Hráč omylem chytil černou můru – server sníží úlovky. */
|
||||
const mothHit = useCallback(async () => {
|
||||
try {
|
||||
const res = await mothHitApi();
|
||||
if (res.data) applyStats(res.data);
|
||||
} catch { /* ignore */ }
|
||||
}, [applyStats]);
|
||||
|
||||
/** Vyhodnotí výsledek nákupu z odpovědi (402 = nedostatek mincí, jinak chyba). */
|
||||
const buyResult = useCallback((res: { data?: unknown; response?: Response }): BuyResult => {
|
||||
if (res.data) { applyStats(res.data as ButterflyStats); return 'ok'; }
|
||||
return res.response?.status === 402 ? 'poor' : 'error';
|
||||
}, [applyStats]);
|
||||
|
||||
/** Obchod: koupě spotřebního předmětu / vylepšení. */
|
||||
const buyPremium = useCallback(async (): Promise<BuyResult> => {
|
||||
try { return buyResult(await buyPremiumApi()); } catch { return 'error'; }
|
||||
}, [buyResult]);
|
||||
const waspSpray = useCallback(async (): Promise<BuyResult> => {
|
||||
try { return buyResult(await waspSprayApi()); } catch { return 'error'; }
|
||||
}, [buyResult]);
|
||||
const buyInsurance = useCallback(async (): Promise<BuyResult> => {
|
||||
try { return buyResult(await buyInsuranceApi()); } catch { return 'error'; }
|
||||
}, [buyResult]);
|
||||
const buyUpgrade = useCallback(async (item: UpgradeItem): Promise<BuyResult> => {
|
||||
try { return buyResult(await buyUpgradeApi({ body: { item } })); } catch { return 'error'; }
|
||||
}, [buyResult]);
|
||||
|
||||
/** Hráč porazil housenku – odměna a statistika. */
|
||||
const defeatCaterpillar = useCallback(async () => {
|
||||
try {
|
||||
@@ -203,5 +242,6 @@ export function useButterflyStats(onReward?: (e: RewardEvent) => void) {
|
||||
return {
|
||||
stats, displayCaught, coinsRef, reportCatch, repair, killWasp, buyRepellent,
|
||||
reportTear, reportRobbery, defeatThief, caterpillarAte, defeatCaterpillar,
|
||||
mothHit, buyPremium, waspSpray, buyInsurance, buyUpgrade,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user