Skip to content

Commit d0eae04

Browse files
authored
Merge pull request #105 from dstrain115/add_encounters_campaign
[Quantum RPG] Add encounters to first zone
2 parents 8d7085c + f29106e commit d0eae04

File tree

1 file changed

+104
-4
lines changed

1 file changed

+104
-4
lines changed

unitary/examples/quantum_rpg/final_state_preparation/classical_realm.py

Lines changed: 104 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
1+
import unitary.alpha as alpha
2+
3+
from unitary.examples.quantum_rpg.encounter import Encounter
14
from unitary.examples.quantum_rpg.world import Direction, Location
25
from unitary.examples.quantum_rpg.item import EXAMINE, TALK, Item
6+
from unitary.examples.quantum_rpg.npcs import BlueFoam, GreenFoam, Observer
7+
from unitary.examples.quantum_rpg.xp_utils import EncounterXp
8+
9+
10+
_BLUE_XP = EncounterXp(
11+
[
12+
[],
13+
[alpha.Flip(effect_fraction=0.5)],
14+
[alpha.Flip(effect_fraction=0.25)],
15+
[alpha.Flip(effect_fraction=0.125)],
16+
[alpha.Superposition()],
17+
[alpha.Phase(effect_fraction=0.375)],
18+
],
19+
[0.35, 0.05, 0.20, 0.20, 0.10, 0.10],
20+
)
21+
22+
_GREEN_XP = EncounterXp(
23+
[
24+
[],
25+
[alpha.Phase(effect_fraction=0.5)],
26+
[alpha.Phase(effect_fraction=0.25)],
27+
[alpha.Phase(effect_fraction=0.125)],
28+
[alpha.Superposition()],
29+
[alpha.Flip(effect_fraction=0.375)],
30+
],
31+
[0.35, 0.05, 0.20, 0.20, 0.10, 0.10],
32+
)
33+
34+
35+
def _blue_foam(number: int, prob: float = 0.5, xp=_BLUE_XP):
36+
return Encounter(
37+
[BlueFoam(f"bluey gooey {idx}") for idx in range(number)],
38+
probability=prob,
39+
description="Some blue quantum foam oozes towards you!",
40+
xp=xp,
41+
)
42+
43+
44+
def _green_foam(number: int, prob: float = 0.5, xp=_GREEN_XP):
45+
return Encounter(
46+
[GreenFoam(f"green goo {idx}") for idx in range(number)],
47+
probability=prob,
48+
description="Some green quantum foam oozes towards you!",
49+
xp=xp,
50+
)
351

452

553
RICHARD = Item(
@@ -278,6 +326,7 @@
278326
"open field.\n"
279327
),
280328
items=[LOOPED_PATH],
329+
encounters=[_blue_foam(1, 0.2), _green_foam(1, 0.2)],
281330
exits={
282331
Direction.EAST: "classical5",
283332
Direction.NORTH: "classical6",
@@ -293,6 +342,12 @@
293342
"and filled with tangles of weeds and bramble. In spots, you can see\n"
294343
"spots covered in iridicent colored slime roughly in the shape of waterdrops.\n"
295344
),
345+
encounters=[
346+
_blue_foam(2, 0.4),
347+
_green_foam(2, 0.4),
348+
_blue_foam(3, 0.1),
349+
_green_foam(3, 0.1),
350+
],
296351
exits={Direction.WEST: "classical4", Direction.EAST: "oxtail1"},
297352
),
298353
Location(
@@ -311,7 +366,11 @@
311366
Location(
312367
label="classical7",
313368
title="A Wild Frontier",
314-
description=("Blah"),
369+
description=(
370+
"The land here slopes along a ridge and climbs steadily towards\n"
371+
"the north, where the foothills begin to slowly climb in altitude."
372+
),
373+
encounters=[_blue_foam(2, 0.4), _green_foam(3, 0.3), _blue_foam(1, 0.1)],
315374
exits={Direction.EAST: "classical3", Direction.NORTH: "classical8"},
316375
),
317376
Location(
@@ -326,6 +385,7 @@
326385
"Farther to the east, you can see the cathedral-like buildings of a baroque\n"
327386
"college campus."
328387
),
388+
encounters=[_blue_foam(2, 0.3), _green_foam(2, 0.2)],
329389
exits={Direction.SOUTH: "classical7"},
330390
# TODO: Connect to the next zone.
331391
),
@@ -368,6 +428,7 @@
368428
"purple ooze seems to be eating away at the pillars and walls, and\n"
369429
"one entire section has collapsed into a pile of rubble.\n"
370430
),
431+
encounters=[_blue_foam(1, 0.3), _green_foam(3, 0.2), _blue_foam(3, 0.1)],
371432
items=[],
372433
exits={Direction.SOUTH: "quad4", Direction.EAST: "quad2"},
373434
),
@@ -382,6 +443,7 @@
382443
"dripping out of its open windows."
383444
),
384445
items=[],
446+
encounters=[_blue_foam(3, 0.3), _green_foam(3, 0.2)],
385447
exits={
386448
Direction.NORTH: "comms1",
387449
Direction.WEST: "quad1",
@@ -399,6 +461,7 @@
399461
"of the black holes Hawking was famous for casts a dark shadow on the wall."
400462
),
401463
items=[],
464+
encounters=[_blue_foam(4, 0.1)],
402465
exits={Direction.SOUTH: "quad6", Direction.WEST: "quad2"},
403466
),
404467
Location(
@@ -411,6 +474,13 @@
411474
"contrasting sharply with the green grass.\n"
412475
),
413476
items=[STUDENT[0]],
477+
encounters=[
478+
_blue_foam(2, 0.1),
479+
_green_foam(2, 0.1),
480+
_blue_foam(1, 0.1),
481+
_blue_foam(3, 0.1),
482+
_green_foam(1, 0.2),
483+
],
414484
exits={
415485
Direction.NORTH: "quad2",
416486
Direction.EAST: "quad6",
@@ -422,7 +492,10 @@
422492
label="quad6",
423493
title="Lab Entrance",
424494
description=(
425-
"A stone building home to a laboratory.A plan for this room, who needs one?"
495+
"A stone building here seems mostly untouched by the corrosion evident\n"
496+
"across most of the rest of the campus. Etched into the arched doorway\n"
497+
"are the words 'Chemistry Research Laboratory' and below that reads,\n"
498+
"'Nuclear Magnetic Resonance Facility'."
426499
),
427500
items=[],
428501
exits={
@@ -446,8 +519,14 @@
446519
Location(
447520
label="quad8",
448521
title="South end",
449-
description=("A plan for this room, who needs one?"),
522+
description=(
523+
"Here on the south end of campus is the mathematics\n"
524+
"department. Most of the windows and doors have been\n"
525+
"boarded up or blocked. A hastily drawn sign on the\n"
526+
"entrance proclaims: 'QUIET PLEASE! THEOREM CREATION IN PROGRESS.'"
527+
),
450528
items=[STUDENT[2]],
529+
encounters=[_blue_foam(2, 0.2)],
451530
exits={
452531
Direction.WEST: "quad7",
453532
Direction.NORTH: "quad5",
@@ -464,6 +543,12 @@
464543
"in reality form irregular disjointed cavities.\n"
465544
),
466545
items=[],
546+
encounters=[
547+
_blue_foam(1, 0.2),
548+
_blue_foam(2, 0.1),
549+
_green_foam(1, 0.2),
550+
_green_foam(2, 0.1),
551+
],
467552
exits={Direction.NORTH: "quad6", Direction.WEST: "quad8"},
468553
),
469554
Location(
@@ -475,6 +560,7 @@
475560
"lab spaces. Slimy foam drips down from a stairway leading upwards.\n"
476561
),
477562
items=[],
563+
encounters=[_blue_foam(3, 0.3), _green_foam(3, 0.1)],
478564
exits={Direction.SOUTH: "quad2", Direction.UP: "comms2"},
479565
),
480566
Location(
@@ -487,7 +573,21 @@
487573
"and it seems like parts of the building are phasing in and out of\n"
488574
"existence."
489575
),
490-
items=[], # TODO: quantum foam boss battle
576+
items=[],
577+
encounters=[
578+
Encounter(
579+
[
580+
BlueFoam("Blue Foamy"),
581+
BlueFoam("Blue Slimy"),
582+
GreenFoam("Green Gooey"),
583+
GreenFoam("Green Foamy"),
584+
Observer("The Observer"),
585+
],
586+
probability=1.0,
587+
description="The quantum slime oozes off all the walls and surrounds you!",
588+
xp=EncounterXp([[alpha.Flip()]]),
589+
)
590+
],
491591
exits={Direction.DOWN: "comms1", Direction.UP: "comms3"},
492592
),
493593
Location(

0 commit comments

Comments
 (0)