Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- game/engine.py +10 -28
game/engine.py
CHANGED
|
@@ -533,6 +533,9 @@ def discover_mushroom(catalog):
|
|
| 533 |
mushroom = _choose_mushroom(catalog)
|
| 534 |
last_mushroom_obj = mushroom
|
| 535 |
|
|
|
|
|
|
|
|
|
|
| 536 |
mush_x, mush_y = random.randint(0, 2), random.randint(0, 2)
|
| 537 |
while (mush_x, mush_y) in used_tiles:
|
| 538 |
mush_x, mush_y = random.randint(0, 2), random.randint(0, 2)
|
|
@@ -540,13 +543,13 @@ def discover_mushroom(catalog):
|
|
| 540 |
|
| 541 |
# We fill EVERY possible key that dex_markdown or status bars might read
|
| 542 |
active_mushrooms.append({
|
| 543 |
-
"name": name,
|
| 544 |
-
"rarity":
|
| 545 |
-
"habitat":
|
| 546 |
-
"lore":
|
| 547 |
-
"edible":
|
| 548 |
-
"magic":
|
| 549 |
-
"danger":
|
| 550 |
"poison": "Yes" if name in POISONOUS_MUSHROOM_NAMES else "No",
|
| 551 |
"mush_x": mush_x,
|
| 552 |
"mush_y": mush_y,
|
|
@@ -554,27 +557,6 @@ def discover_mushroom(catalog):
|
|
| 554 |
"clue": "Harvested instantly!",
|
| 555 |
"studied": "No"
|
| 556 |
})
|
| 557 |
-
|
| 558 |
-
# Build a current state dictionary packed with fallback HUD variables
|
| 559 |
-
current = {
|
| 560 |
-
"name": "Mushroom Patch",
|
| 561 |
-
"rarity": "Multiple",
|
| 562 |
-
"poison": "No",
|
| 563 |
-
"active_mushrooms": active_mushrooms,
|
| 564 |
-
"game_over": "No",
|
| 565 |
-
"picked": "No",
|
| 566 |
-
"studied": "No",
|
| 567 |
-
"encounter": f"Boom! {num_mushrooms} mushrooms sprouted! Move Myco to collect them!",
|
| 568 |
-
"event_title": "Spore Influx",
|
| 569 |
-
"event_emoji": "✨",
|
| 570 |
-
"mystery_title": "The Wrong Memory",
|
| 571 |
-
"score_total": "0",
|
| 572 |
-
"health": "3",
|
| 573 |
-
"reward_text": "Run around the map to clear the board!"
|
| 574 |
-
}
|
| 575 |
-
|
| 576 |
-
# Return the real mushroom object instead of None to prevent 'NoneType' errors
|
| 577 |
-
return last_mushroom_obj, current, []
|
| 578 |
|
| 579 |
|
| 580 |
def myco_reply(message=None, history=None, current=None, collection=None, position=None):
|
|
|
|
| 533 |
mushroom = _choose_mushroom(catalog)
|
| 534 |
last_mushroom_obj = mushroom
|
| 535 |
|
| 536 |
+
# FIX: Define 'name' by extracting it from the mushroom object
|
| 537 |
+
name = getattr(mushroom, "name", "Unknown Mushroom")
|
| 538 |
+
|
| 539 |
mush_x, mush_y = random.randint(0, 2), random.randint(0, 2)
|
| 540 |
while (mush_x, mush_y) in used_tiles:
|
| 541 |
mush_x, mush_y = random.randint(0, 2), random.randint(0, 2)
|
|
|
|
| 543 |
|
| 544 |
# We fill EVERY possible key that dex_markdown or status bars might read
|
| 545 |
active_mushrooms.append({
|
| 546 |
+
"name": name, # This will now work correctly!
|
| 547 |
+
"rarity": getattr(mushroom, "rarity", "Common"), # Adjusted assuming 'field' is a typo or missing utility
|
| 548 |
+
"habitat": getattr(mushroom, "habitat", "Glow Undergrowth"),
|
| 549 |
+
"lore": getattr(mushroom, "lore", "A rapid micro-sprout spawned during a bloom."),
|
| 550 |
+
"edible": getattr(mushroom, "edible", "Unknown"),
|
| 551 |
+
"magic": getattr(mushroom, "magic", "Unknown"),
|
| 552 |
+
"danger": getattr(mushroom, "danger", "Unknown"),
|
| 553 |
"poison": "Yes" if name in POISONOUS_MUSHROOM_NAMES else "No",
|
| 554 |
"mush_x": mush_x,
|
| 555 |
"mush_y": mush_y,
|
|
|
|
| 557 |
"clue": "Harvested instantly!",
|
| 558 |
"studied": "No"
|
| 559 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
|
| 561 |
|
| 562 |
def myco_reply(message=None, history=None, current=None, collection=None, position=None):
|