Files
fedora_openclaw 46116f7f4b Initial commit: DOOM x MATRIX System Failure text adventure
Modulares Python-Textadventure mit Kampfsystem (Stagger, Bullet Time,
Glory Kills, Hacking-Skill-Checks), Hub-Raum-Navigation, prozeduralen
Encountern, 3 Charakterklassen, mehreren Enden und Story-Elementen
(weißer Hase, Orakel, schwarze-Katze-Deja-vu-Glitch).
2026-07-05 18:56:44 +02:00

133 lines
5.0 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Game-Loop, Titel-Bildschirm, Klassenwahl, Szenen-Dispatch."""
import random
import sys
from doom_matrix.engine.ui import Colors, clear_screen, slow_print, dramatic_pause, menu, set_fast_mode
from doom_matrix.engine import save
from doom_matrix.entities.player import Player, CLASSES
from doom_matrix.world import layers, endings
def title_screen():
clear_screen()
print(f"""
{Colors.RED}{Colors.BOLD}
██████╗ ██████╗ ██████╗ ███╗ ███╗
██╔══██╗██╔═══██╗██╔═══██╗████╗ ████║
██║ ██║██║ ██║██║ ██║██╔████╔██║
██║ ██║██║ ██║██║ ██║██║╚██╔╝██║
██████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║
╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
{Colors.END}
{Colors.GREEN}{Colors.BOLD}
███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗
████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝
██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝
██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗
██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝
{Colors.END}
{Colors.YELLOW}{Colors.BOLD}
╔═══════════════════════════════════════╗
║ S Y S T E M F A I L U R E ║
╚═══════════════════════════════════════╝
{Colors.END}
{Colors.DIM}
"What if the Matrix was just a very
inefficient DOOM engine?"
{Colors.END}
""")
print(f"\n{Colors.CYAN}[Drücke ENTER um zu starten]{Colors.END}")
input()
def choose_class():
clear_screen()
print(f"\n{Colors.BOLD}{Colors.CYAN}═══ WÄHLE DEINE KLASSE ═══{Colors.END}\n")
keys = list(CLASSES.keys())
for i, key in enumerate(keys):
data = CLASSES[key]
print(f" {Colors.GREEN}[{i + 1}]{Colors.END} {Colors.BOLD}{data['name']}{Colors.END} — {data['description']}")
print(f" HP:{data['hp']} Armor:{data['armor']} Focus:{data['focus']} "
f"Hacking:{data['hacking']} Strength:{data['strength']}")
choice = input(f"\n{Colors.CYAN}Klasse: {Colors.END}").strip()
try:
idx = int(choice) - 1
if 0 <= idx < len(keys):
return keys[idx]
except ValueError:
pass
return keys[0]
SCENES = {
"construct_intro": layers.construct_intro,
"white_rabbit_moment": layers.white_rabbit_moment,
"agent_fight": layers.agent_fight,
"after_fight": layers.after_fight,
"mars_base": layers.mars_base,
"matrix_deep": layers.matrix_deep,
"hell_server": layers.hell_server,
"final_boss": layers.final_boss,
"layer_zero_check": layers.layer_zero_check,
}
TERMINAL_SCENES = {"ending", "game_over"}
def run_game(seed=None, fast=False):
set_fast_mode(fast)
rng = random.Random(seed) if seed is not None else random.Random()
run_count = save.register_new_run()
title_screen()
class_key = choose_class()
player = Player(class_key)
twist_line = save.loop_twist_line(run_count)
current_scene = "construct_intro"
while current_scene not in TERMINAL_SCENES:
if twist_line and current_scene == "construct_intro":
clear_screen()
slow_print(f"\n{Colors.DIM}{twist_line}{Colors.END}")
dramatic_pause(1)
func = SCENES.get(current_scene)
if func is None:
break
current_scene = func(player, rng)
if current_scene == "ending":
ending_key = endings.ending(player)
save.register_ending(ending_key)
elif current_scene == "game_over":
result = endings.game_over(player)
save.register_ending(result)
save.save_game(player, slot="autosave")
print(f"\n{Colors.CYAN}[ENTER zum Beenden]{Colors.END}")
input()
def main():
fast = "--fast" in sys.argv
seed = None
for arg in sys.argv:
if arg.startswith("--seed="):
try:
seed = int(arg.split("=", 1)[1])
except ValueError:
seed = None
try:
run_game(seed=seed, fast=fast)
except KeyboardInterrupt:
print(f"\n\n{Colors.YELLOW}Spiel unterbrochen. Bis zum nächsten Mal! 🐇{Colors.END}")
sys.exit(0)