Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
main is red: Espresso Bar, Firefly Jar, Signal Box and Soapbox Derby have no scripted round in rounds.mjs #124
mason/pixel-plays:mason/114-main-is-red-espresso-bar-firefly-jar-sig → main 3 commits fork
1 file
changed +0
−25
rounds.mjs −25
| @@ -27,20 +27,8 @@ export const ROUNDS = { | ||
| 27 | 27 | } |
| 28 | 28 | g.step(1); |
| 29 | 29 | } }, |
| 30 | // pour while the cup is under the spout, and let go in time for the stream's tail to land on the line | |
| 31 | 30 | // build nothing, march nowhere, and give up: the second press of R confirms |
| 32 | 31 | 'empire': { over: /victory|defeat/, outcome: /defeat · you gave up at \d+:\d\d · \d+ trained, \d+ defeated/, beat: g => { g.drag([140, 120], [220, 200], .4); g.press('r'); g.run(.5); g.press('r'); g.run(.5); } }, |
| 33 | 'espresso-bar': { over: /pour again/, outcome: /twenty cups poured · \d+/, beat: g => { | |
| 34 | const pour = g.read('R.phase === "play" && !R.done && Math.abs(R.x) <= Pour.WINDOW && R.fill + Pour.RATE * Pour.DELAY < Pour.lineOf(R.cup)'); | |
| 35 | if (pour) g.keyDown(' '); else g.keyUp(' '); | |
| 36 | g.step(1); | |
| 37 | } }, | |
| 38 | // shoo any moth first, else catch a firefly that is glowing | |
| 39 | 'firefly-jar': { over: /another night/, outcome: /the night is survived · \d+ in the jar/, beat: g => { | |
| 40 | const at = g.read('(() => { const t = Night.targets(R); const m = t.find(x => x.kind === "moth") || t.find(x => x.kind === "fly" && Night.glow(R.flies.find(f => f.id === x.id)).on); if (!m) return null; const p = scr(m.u, m.v, m.z); return [p.sx, p.sy]; })()'); | |
| 41 | if (at) g.tap(at[0], at[1]); | |
| 42 | g.step(2); | |
| 43 | } }, | |
| 44 | 32 | 'free-throw': { over: /play again/, outcome: /\d+ of 30/, beat: g => { g.hold(...MID, .6); g.run(.45); g.tap(...MID); g.run(1.5); g.tap(...MID); } }, |
| 45 | 33 | // dive the way the taker leans, once the tell shows |
| 46 | 34 | 'goalkeeper': { over: /play again/, outcome: /you win: \d+ saves/, beat: g => { |
| @@ -79,19 +67,6 @@ export const ROUNDS = { | ||
| 79 | 67 | }; |
| 80 | 68 | })() }, |
| 81 | 69 | 'sled-run': { over: /ride again/, outcome: /[1-9]\d* m · \d+ clean/, beat: g => { g.hold(...MID, .6); g.run(.6); } }, |
| 82 | // pull the lever the lamp showed for two trains, then a wrong one each turn until three trains are lost | |
| 83 | 'signal-box': { over: /run again/, outcome: /\d+ trains routed · the junction needs 8 to run on time/, beat: g => { | |
| 84 | if (g.read('P.phase') === 'input') g.press(String((g.read('P.seq[P.got]') + (g.read('P.routed') < 2 ? 0 : 1)) % 5 + 1)); | |
| 85 | g.run(.3); | |
| 86 | } }, | |
| 87 | // steer to the middle of the next gap in the bales | |
| 88 | 'soapbox-derby': { over: /roll again/, outcome: /banner! [\d.]+ s/, beat: g => { | |
| 89 | const want = g.read('(() => { for (let n = 0; n < Cart.GATES; n++) { const t = Cart.gateAt(n, R.seed); if (R.x < t.x + Cart.GATE_DEPTH + 1.6) return t.centre / Cart.LANE_MAX; } return 0; })()'); | |
| 90 | const have = g.read('G.steer'), k = have < want - .04 ? 'ArrowRight' : have > want + .04 ? 'ArrowLeft' : null; | |
| 91 | if (k) g.keyDown(k); | |
| 92 | g.step(1); | |
| 93 | if (k) g.keyUp(k); | |
| 94 | } }, | |
| 95 | 70 | 'stari-most': { over: /dive again/, outcome: /total [\d.]+/, beat: g => { g.hold(...MID, .4); g.run(.5); g.hold(...MID, .6); g.run(2); g.tap(...MID); } }, |
| 96 | 71 | 'stone-skip': { over: /play again/, outcome: /\d+ bounces/, beat: g => { g.drag([180, 140], [140, 170], .4); g.run(3); g.tap(...MID); } }, |
| 97 | 72 | // pour each cup to its line: start as it slides under the spout, hold just long enough for the stream's tail to finish it |
new above
offline