|
| 1 | +/* Test the patch for the GFD delay. |
| 2 | + */ |
| 3 | + |
| 4 | +import { test, expect } from '@playwright/test'; |
| 5 | +import { setupCookieClickerPage } from 'cookie-connoisseur'; |
| 6 | + |
| 7 | +let saveGame = { |
| 8 | + seed: 'aaaaa', |
| 9 | + buildings: { |
| 10 | + 'Wizard tower': { |
| 11 | + amount: 100, |
| 12 | + level: 1, |
| 13 | + minigame: { |
| 14 | + magic: 50, |
| 15 | + onMinigame: true, |
| 16 | + }, |
| 17 | + }, |
| 18 | + }, |
| 19 | +}; |
| 20 | + |
| 21 | +test.describe('GFD delay patch', () => { |
| 22 | + test('is not present in the vanilla game', async ({ page }) => { |
| 23 | + await setupCookieClickerPage(page, {saveGame}); |
| 24 | + await page.click('#grimoireSpell6'); // cast GFD, get FtHoF |
| 25 | + /* GFD cast costs only 5 magic, it takes another 1.5 seconds to deduct the FtHoF cost. |
| 26 | + * We still need to use Math.floor because math keeps regenerating. |
| 27 | + */ |
| 28 | + expect(await page.evaluate(() => Math.floor(Game.Objects['Wizard tower'].minigame.magic))).toEqual(45); |
| 29 | + await page.waitForFunction(() => Game.Objects['Wizard tower'].minigame.magic < 45); |
| 30 | + |
| 31 | + expect(await page.evaluate(() => Math.floor(Game.Objects['Wizard tower'].minigame.magic))).toEqual(25); |
| 32 | + |
| 33 | + expect(await page.evaluate(() => Game.shimmers.length)).toEqual(1); |
| 34 | + expect(await page.evaluate(() => Game.shimmers[0]['force'])).toEqual('clot'); |
| 35 | + // This is the same as backfiring FtHoF with one spell cast |
| 36 | + }); |
| 37 | + |
| 38 | + test('works', async ({ page }) => { |
| 39 | + await setupCookieClickerPage(page, {saveGame}); |
| 40 | + await page.evaluate(() => Game.LoadMod('https://staticvariablejames.github.io/SpicedCookies/Spice.js')); |
| 41 | + await page.waitForFunction(() => 'Spiced cookies' in Game.mods); |
| 42 | + |
| 43 | + await page.evaluate(() => Game.CloseNotes()); |
| 44 | + await page.click('text=Options'); |
| 45 | + await page.click('#SpiceButtonpatchGFDDelay'); |
| 46 | + await page.click('text=Options'); |
| 47 | + |
| 48 | + await page.click('#grimoireSpell6'); // cast GFD, get FtHoF |
| 49 | + // Now the results are essentially instantaneous |
| 50 | + expect(await page.evaluate(() => Math.floor(Game.Objects['Wizard tower'].minigame.magic))).toEqual(25); |
| 51 | + |
| 52 | + expect(await page.evaluate(() => Game.shimmers.length)).toEqual(1); |
| 53 | + expect(await page.evaluate(() => Game.shimmers[0]['force'])).toEqual('cookie storm drop'); |
| 54 | + // This is the same as succeeding FtHoF with zero spells cast |
| 55 | + }); |
| 56 | +}); |
0 commit comments