|
| 1 | +import unitary.alpha as alpha |
| 2 | + |
| 3 | +from unitary.examples.quantum_rpg.encounter import Encounter |
1 | 4 | from unitary.examples.quantum_rpg.world import Direction, Location |
2 | 5 | 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 | + ) |
3 | 51 |
|
4 | 52 |
|
5 | 53 | RICHARD = Item( |
|
278 | 326 | "open field.\n" |
279 | 327 | ), |
280 | 328 | items=[LOOPED_PATH], |
| 329 | + encounters=[_blue_foam(1, 0.2), _green_foam(1, 0.2)], |
281 | 330 | exits={ |
282 | 331 | Direction.EAST: "classical5", |
283 | 332 | Direction.NORTH: "classical6", |
|
293 | 342 | "and filled with tangles of weeds and bramble. In spots, you can see\n" |
294 | 343 | "spots covered in iridicent colored slime roughly in the shape of waterdrops.\n" |
295 | 344 | ), |
| 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 | + ], |
296 | 351 | exits={Direction.WEST: "classical4", Direction.EAST: "oxtail1"}, |
297 | 352 | ), |
298 | 353 | Location( |
|
311 | 366 | Location( |
312 | 367 | label="classical7", |
313 | 368 | 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)], |
315 | 374 | exits={Direction.EAST: "classical3", Direction.NORTH: "classical8"}, |
316 | 375 | ), |
317 | 376 | Location( |
|
326 | 385 | "Farther to the east, you can see the cathedral-like buildings of a baroque\n" |
327 | 386 | "college campus." |
328 | 387 | ), |
| 388 | + encounters=[_blue_foam(2, 0.3), _green_foam(2, 0.2)], |
329 | 389 | exits={Direction.SOUTH: "classical7"}, |
330 | 390 | # TODO: Connect to the next zone. |
331 | 391 | ), |
|
368 | 428 | "purple ooze seems to be eating away at the pillars and walls, and\n" |
369 | 429 | "one entire section has collapsed into a pile of rubble.\n" |
370 | 430 | ), |
| 431 | + encounters=[_blue_foam(1, 0.3), _green_foam(3, 0.2), _blue_foam(3, 0.1)], |
371 | 432 | items=[], |
372 | 433 | exits={Direction.SOUTH: "quad4", Direction.EAST: "quad2"}, |
373 | 434 | ), |
|
382 | 443 | "dripping out of its open windows." |
383 | 444 | ), |
384 | 445 | items=[], |
| 446 | + encounters=[_blue_foam(3, 0.3), _green_foam(3, 0.2)], |
385 | 447 | exits={ |
386 | 448 | Direction.NORTH: "comms1", |
387 | 449 | Direction.WEST: "quad1", |
|
399 | 461 | "of the black holes Hawking was famous for casts a dark shadow on the wall." |
400 | 462 | ), |
401 | 463 | items=[], |
| 464 | + encounters=[_blue_foam(4, 0.1)], |
402 | 465 | exits={Direction.SOUTH: "quad6", Direction.WEST: "quad2"}, |
403 | 466 | ), |
404 | 467 | Location( |
|
411 | 474 | "contrasting sharply with the green grass.\n" |
412 | 475 | ), |
413 | 476 | 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 | + ], |
414 | 484 | exits={ |
415 | 485 | Direction.NORTH: "quad2", |
416 | 486 | Direction.EAST: "quad6", |
|
422 | 492 | label="quad6", |
423 | 493 | title="Lab Entrance", |
424 | 494 | 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'." |
426 | 499 | ), |
427 | 500 | items=[], |
428 | 501 | exits={ |
|
446 | 519 | Location( |
447 | 520 | label="quad8", |
448 | 521 | 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 | + ), |
450 | 528 | items=[STUDENT[2]], |
| 529 | + encounters=[_blue_foam(2, 0.2)], |
451 | 530 | exits={ |
452 | 531 | Direction.WEST: "quad7", |
453 | 532 | Direction.NORTH: "quad5", |
|
464 | 543 | "in reality form irregular disjointed cavities.\n" |
465 | 544 | ), |
466 | 545 | 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 | + ], |
467 | 552 | exits={Direction.NORTH: "quad6", Direction.WEST: "quad8"}, |
468 | 553 | ), |
469 | 554 | Location( |
|
475 | 560 | "lab spaces. Slimy foam drips down from a stairway leading upwards.\n" |
476 | 561 | ), |
477 | 562 | items=[], |
| 563 | + encounters=[_blue_foam(3, 0.3), _green_foam(3, 0.1)], |
478 | 564 | exits={Direction.SOUTH: "quad2", Direction.UP: "comms2"}, |
479 | 565 | ), |
480 | 566 | Location( |
|
487 | 573 | "and it seems like parts of the building are phasing in and out of\n" |
488 | 574 | "existence." |
489 | 575 | ), |
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 | + ], |
491 | 591 | exits={Direction.DOWN: "comms1", Direction.UP: "comms3"}, |
492 | 592 | ), |
493 | 593 | Location( |
|
0 commit comments