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 #137
mason/pixel-plays:mason/114-main-is-red-espresso-bar-firefly-jar-sig → main 8 commits fork
1 file
changed +0
−25
rounds.mjs −25
| @@ -32,7 +32,6 @@ export const ROUNDS = { | ||
| 32 | 32 | } |
| 33 | 33 | g.step(1); |
| 34 | 34 | } }, |
| 35 | // pour while the cup is under the spout, and let go in time for the stream's tail to land on the line | |
| 36 | 35 | // build nothing, march nowhere, and give up: the second press of R confirms |
| 37 | 36 | '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); } }, |
| 38 | 37 | // turn two coats that do not match, again and again, until the thirteenth mismatch |
| @@ -41,17 +40,6 @@ export const ROUNDS = { | ||
| 41 | 40 | if (pair) { g.tap(...pair[0]); g.tap(...pair[1]); } |
| 42 | 41 | g.run(.9); |
| 43 | 42 | } }, |
| 44 | 'espresso-bar': { over: /pour again/, outcome: /twenty cups poured · \d+/, beat: g => { | |
| 45 | 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)'); | |
| 46 | if (pour) g.keyDown(' '); else g.keyUp(' '); | |
| 47 | g.step(1); | |
| 48 | } }, | |
| 49 | // shoo any moth first, else catch a firefly that is glowing | |
| 50 | 'firefly-jar': { over: /another night/, outcome: /the night is survived · \d+ in the jar/, beat: g => { | |
| 51 | 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]; })()'); | |
| 52 | if (at) g.tap(at[0], at[1]); | |
| 53 | g.step(2); | |
| 54 | } }, | |
| 55 | 43 | '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); } }, |
| 56 | 44 | // dive the way the taker leans, once the tell shows |
| 57 | 45 | 'goalkeeper': { over: /play again/, outcome: /you win: \d+ saves/, beat: g => { |
| @@ -90,19 +78,6 @@ export const ROUNDS = { | ||
| 90 | 78 | }; |
| 91 | 79 | })() }, |
| 92 | 80 | 'sled-run': { over: /ride again/, outcome: /[1-9]\d* m · \d+ clean/, beat: g => { g.hold(...MID, .6); g.run(.6); } }, |
| 93 | // pull the lever the lamp showed for two trains, then a wrong one each turn until three trains are lost | |
| 94 | 'signal-box': { over: /run again/, outcome: /\d+ trains routed · the junction needs 8 to run on time/, beat: g => { | |
| 95 | if (g.read('P.phase') === 'input') g.press(String((g.read('P.seq[P.got]') + (g.read('P.routed') < 2 ? 0 : 1)) % 5 + 1)); | |
| 96 | g.run(.3); | |
| 97 | } }, | |
| 98 | // steer to the middle of the next gap in the bales | |
| 99 | 'soapbox-derby': { over: /roll again/, outcome: /banner! [\d.]+ s/, beat: g => { | |
| 100 | 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; })()'); | |
| 101 | const have = g.read('G.steer'), k = have < want - .04 ? 'ArrowRight' : have > want + .04 ? 'ArrowLeft' : null; | |
| 102 | if (k) g.keyDown(k); | |
| 103 | g.step(1); | |
| 104 | if (k) g.keyUp(k); | |
| 105 | } }, | |
| 106 | 81 | '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); } }, |
| 107 | 82 | 'stone-skip': { over: /play again/, outcome: /\d+ bounces/, beat: g => { g.drag([180, 140], [140, 170], .4); g.run(3); g.tap(...MID); } }, |
| 108 | 83 | // 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