update
This commit is contained in:
236
scripts/ui.gd
236
scripts/ui.gd
@@ -154,9 +154,9 @@ func _hud_aktualisieren() -> void:
|
||||
[Game.known.size(), Game.offene_techniken(), TechDB.LIST.size()])
|
||||
if Game.active_mission != "":
|
||||
var h := HumanDB.by_id(Game.active_mission)
|
||||
zeilen.append("Mission: [color=#ffdd77]%s[/color] — %d %% · %d Regeln" %
|
||||
zeilen.append("Mission: [color=#ffdd77]%s[/color] — %d %% · %d %% je Tag" %
|
||||
[h["name"], int(Game.mission_progress(Game.active_mission)),
|
||||
Game.regel_anzahl(Game.active_mission)])
|
||||
int(round(Game.traum_tempo(Game.active_mission)))])
|
||||
zeilen.append("[color=#aaaaaa]%s[/color]" % h["traum"])
|
||||
elif Game.completed.size() >= HumanDB.LIST.size():
|
||||
zeilen.append("[color=#88ff99]Alle Träume erfüllt.[/color]")
|
||||
@@ -347,84 +347,126 @@ func _journal_missionen() -> void:
|
||||
_text("[color=#aaaaaa]Zurückgestellt — %d %%[/color]" %
|
||||
int(Game.mission_progress(id)), 15)
|
||||
if not Game.completed.has(id):
|
||||
_knopf("Regelwerk — %d Regeln" % Game.regel_anzahl(id),
|
||||
func() -> void: pipeline_panel(id))
|
||||
_knopf("Tagesablauf — %d Systeme" % Game.system_anzahl(id),
|
||||
func() -> void: systeme_panel(id))
|
||||
_trenner()
|
||||
|
||||
|
||||
# -------------------------------------------------------- Regelwerk einer Mission
|
||||
# ---------------------------------------------- Diagnose und Systeme
|
||||
|
||||
## Wenn-Dann-Regeln: tut der Mensch etwas Bestimmtes, greift die zugeordnete
|
||||
## Technik von allein. So automatisiert der Spieler den Fortschritt.
|
||||
func pipeline_panel(human_id: String) -> void:
|
||||
var scroll_alt := _scroll.scroll_vertical if offen and _kind == "pipeline" else 0
|
||||
## Der Traum scheitert an Ursachen. Die stehen nicht im Panel -- man findet sie,
|
||||
## indem man dabeisteht. Gegen jede gefundene Ursache baut man ein System in
|
||||
## den Tag. Je mehr abgedeckt ist, desto schneller kommt der Traum voran.
|
||||
func systeme_panel(human_id: String) -> void:
|
||||
var scroll_alt := _scroll.scroll_vertical if offen and _kind == "systeme" else 0
|
||||
var h := HumanDB.by_id(human_id)
|
||||
_leeren("Regelwerk — %s" % h["name"])
|
||||
_text("Jede Tätigkeit im Tag von %s kann eine Technik auslösen. " % h["name"] +
|
||||
"Wechselt sie hinein, greift die Regel von allein — solange du auf der Erde bist.\n" +
|
||||
"Nach jedem Einsatz braucht eine Technik Ruhe, bevor sie wieder anschlägt.", 15)
|
||||
_text("[color=#aaaaaa]Fortschritt: [b]%d %%[/b] · Regeln: [b]%d[/b][/color]" %
|
||||
[int(Game.mission_progress(human_id)), Game.regel_anzahl(human_id)], 15)
|
||||
_leeren("%s — Tagesablauf" % h["name"])
|
||||
_text("[b]Traum:[/b] %s" % h["traum"], 16)
|
||||
_text("[b]Fortschritt:[/b] %d %% · [b]Tempo:[/b] %d %% je Tag" %
|
||||
[int(Game.mission_progress(human_id)), int(round(Game.traum_tempo(human_id)))], 16)
|
||||
_trenner()
|
||||
for activity in HumanDB.aktivitaeten(human_id):
|
||||
var tat := Orte.text(activity)
|
||||
if not Game.erreichbar(activity):
|
||||
_knopf("%s → unerreichbar" % tat, func() -> void: pass, false)
|
||||
|
||||
_text("[b]Woran es scheitert[/b]", 17)
|
||||
var offene := 0
|
||||
for u in Game.ursachen_von(human_id):
|
||||
var name: String = str(u)
|
||||
if not Game.ursache_bekannt(human_id, name):
|
||||
_text("[color=#8e93a8]? — noch nicht erkannt[/color]", 15)
|
||||
offene += 1
|
||||
continue
|
||||
var tech: String = Game.regel_fuer(human_id, activity)
|
||||
var beschriftung := "%s → keine Regel" % tat
|
||||
if tech != "":
|
||||
beschriftung = "%s → %s" % [tat, TechDB.by_id(tech)["name"]]
|
||||
if not Game.bereit(tech):
|
||||
beschriftung += " (noch gesperrt)"
|
||||
_knopf(beschriftung, func() -> void: regel_panel(human_id, activity))
|
||||
var g := Game.ursache_geloest(human_id, name)
|
||||
var stand := "[color=#88ff99]gelöst[/color]" if g > 0.0 else \
|
||||
"[color=#ff9977]offen · bremst auf %d %%[/color]" % \
|
||||
int(float(Ursachen.LISTE[name]["faktor"]) * 100.0)
|
||||
_text("[b]%s[/b] — %s %s" % [Ursachen.LISTE[name]["name"],
|
||||
Ursachen.LISTE[name]["kurz"], stand], 15)
|
||||
if offene > 0:
|
||||
_text("[color=#aaaaaa]Steh dabei, wenn sie etwas tut, das du noch nicht " +
|
||||
"kennst. Dann zeigt sich, warum.[/color]", 14)
|
||||
_trenner()
|
||||
|
||||
_text("[b]Ihr Tag[/b]", 17)
|
||||
for nr in range(Game.slots(human_id).size()):
|
||||
_slot_zeile(human_id, nr)
|
||||
_trenner()
|
||||
_knopf("Zurück zum Journal", func() -> void: journal_panel("missionen"))
|
||||
_zeigen("pipeline")
|
||||
_zeigen("systeme")
|
||||
_scroll_wunsch = scroll_alt
|
||||
_scroll_frames = 4
|
||||
|
||||
|
||||
## Welche Technik soll bei dieser Tätigkeit greifen?
|
||||
func regel_panel(human_id: String, activity: String) -> void:
|
||||
var h := HumanDB.by_id(human_id)
|
||||
_leeren("Regel für »%s«" % Orte.text(activity))
|
||||
if Game.known.is_empty():
|
||||
_text("[color=#ffcc66]Du kennst keine Technik. Im Hörsaal der Wege " +
|
||||
"werden sie gelehrt.[/color]", 16)
|
||||
_knopf("Zurück", func() -> void: pipeline_panel(human_id))
|
||||
_zeigen("regel")
|
||||
func _slot_zeile(human_id: String, nr: int) -> void:
|
||||
var slot: Array = Game.slots(human_id)[nr]
|
||||
var stunde := "%02d:00" % int(slot[0])
|
||||
var grund := Game.slot_grund(human_id, nr)
|
||||
if grund == "schlaeft":
|
||||
_knopf("%s schläft" % stunde, func() -> void: pass, false)
|
||||
return
|
||||
_text("Was soll greifen, wenn %s %s? Ob eine Technik hier taugt, steht in ihr " %
|
||||
[h["name"], Orte.text(activity)] +
|
||||
"selbst — nachzulesen im Journal. Ein Fehlgriff wirft den Traum zurück.", 15)
|
||||
var sys := Game.system_in(human_id, nr)
|
||||
if not sys.is_empty():
|
||||
_knopf("%s %s ← %s" % [stunde, Game.slot_aktivitaet(human_id, nr),
|
||||
TechDB.by_id(str(sys["tech"]))["name"]],
|
||||
func() -> void: slot_panel(human_id, nr))
|
||||
return
|
||||
if not Game.erkannt(human_id, nr):
|
||||
_knopf("%s ?" % stunde, func() -> void: pass, false)
|
||||
return
|
||||
var text := Orte.text(grund)
|
||||
if Ursachen.ist_blocker(grund):
|
||||
text = "%s (%s)" % [Ursachen.BLOCKER[grund]["name"],
|
||||
Ursachen.LISTE[Ursachen.BLOCKER[grund]["ursache"]]["name"]]
|
||||
_knopf("%s %s" % [stunde, text], func() -> void: slot_panel(human_id, nr))
|
||||
|
||||
|
||||
## Was soll in diesem Slot stehen?
|
||||
func slot_panel(human_id: String, nr: int) -> void:
|
||||
var h := HumanDB.by_id(human_id)
|
||||
var grund := Game.slot_grund(human_id, nr)
|
||||
var stunde := "%02d:00" % int(Game.slots(human_id)[nr][0])
|
||||
_leeren("%s um %s" % [h["name"], stunde])
|
||||
if Ursachen.ist_blocker(grund):
|
||||
var b: Dictionary = Ursachen.BLOCKER[grund]
|
||||
_text("Sie %s.\n[b]Auslöser:[/b] %s\n[b]Belohnung:[/b] %s" %
|
||||
[b["name"], b["ausloeser"], Ursachen.belohnung_text(str(b["belohnung"]))], 16)
|
||||
_text("[color=#aaaaaa]Eine Ersatzhandlung muss dieselbe Belohnung liefern, " +
|
||||
"sonst hält sie nicht.[/color]", 15)
|
||||
else:
|
||||
_text("Hier ist Platz. Ein neues System passt in diesen Slot.", 16)
|
||||
_trenner()
|
||||
var sys := Game.system_in(human_id, nr)
|
||||
if not sys.is_empty():
|
||||
_text("[color=#88ff99]Hier steht: %s[/color]" %
|
||||
TechDB.by_id(str(sys["tech"]))["name"], 16)
|
||||
_knopf("System wieder herausnehmen", func() -> void:
|
||||
Game.system_entfernen(human_id, nr)
|
||||
systeme_panel(human_id))
|
||||
_trenner()
|
||||
for id in TechDB.ids():
|
||||
if not Game.knows(id):
|
||||
continue
|
||||
var pruef := Game.system_pruefen(human_id, nr, id)
|
||||
var t := TechDB.by_id(id)
|
||||
var ev := Game.evaluate(id, human_id, activity, false)
|
||||
var wo: Array = Game.regel_momente(human_id, id)
|
||||
var gewaehlt := ""
|
||||
if wo.has(activity):
|
||||
gewaehlt = " — hier eingestellt"
|
||||
elif not wo.is_empty():
|
||||
var namen: Array = []
|
||||
for a in wo:
|
||||
namen.append("»%s«" % Orte.text(a))
|
||||
gewaehlt = " — hängt an %s" % ", ".join(namen)
|
||||
var beschriftung := "%s · Stufe %d" % [t["name"], Game.skill_of(id)]
|
||||
if ev["blocked"]:
|
||||
beschriftung += " — " + str(ev["grund"])
|
||||
elif gewaehlt != "":
|
||||
beschriftung += gewaehlt
|
||||
_knopf(beschriftung, func() -> void:
|
||||
Game.regel_setzen(human_id, activity, id)
|
||||
pipeline_panel(human_id), not ev["blocked"])
|
||||
_knopf("Keine Regel für diese Tätigkeit", func() -> void:
|
||||
Game.regel_setzen(human_id, activity, "")
|
||||
pipeline_panel(human_id))
|
||||
_zeigen("regel")
|
||||
if not pruef["geht"]:
|
||||
beschriftung += " — " + str(pruef["grund"])
|
||||
elif float(pruef["guete"]) > Game.GUETE_NEU:
|
||||
beschriftung += " — passt genau"
|
||||
_knopf(beschriftung, func() -> void: _system_setzen(human_id, nr, id),
|
||||
bool(pruef["geht"]))
|
||||
_trenner()
|
||||
_knopf("Zurück", func() -> void: systeme_panel(human_id))
|
||||
_zeigen("slot")
|
||||
|
||||
|
||||
func _system_setzen(human_id: String, nr: int, tech_id: String) -> void:
|
||||
var res := Game.system_setzen(human_id, nr, tech_id, false)
|
||||
if not res["ok"]:
|
||||
Game.notified.emit(str(res["grund"]), Color(1, 0.6, 0.4))
|
||||
return
|
||||
if not res["erfolg"]:
|
||||
Game.notified.emit("%s greift diesmal nicht. Später noch einmal." %
|
||||
TechDB.by_id(tech_id)["name"], Color(1, 0.6, 0.5))
|
||||
systeme_panel(human_id)
|
||||
|
||||
|
||||
# -------------------------------------------------------- Lehrorte
|
||||
@@ -522,70 +564,66 @@ func brett_panel() -> void:
|
||||
_scroll_frames = 4
|
||||
|
||||
|
||||
# -------------------------------------------------------- Anwenden auf der Erde
|
||||
# -------------------------------------------------------- Vor Ort
|
||||
|
||||
## Draußen am Menschen: hier greift man in den Slot ein, der gerade läuft.
|
||||
func anwenden_panel(mensch: Node3D) -> void:
|
||||
_apply_human = mensch
|
||||
var h: Dictionary = mensch.data
|
||||
var aktiv: String = mensch.activity
|
||||
_leeren("%s — %s" % [h["name"], Orte.text(aktiv)])
|
||||
var id: String = str(h["id"])
|
||||
var nr: int = int(mensch.slot)
|
||||
_leeren("%s — %s" % [h["name"], Orte.text(mensch.activity)])
|
||||
_text("[b]Traum:[/b] %s" % h["traum"], 16)
|
||||
if Game.active_mission == h["id"]:
|
||||
_text("Fortschritt: [b]%d %%[/b]" % int(Game.mission_progress(h["id"])), 16)
|
||||
elif Game.completed.has(h["id"]):
|
||||
_text("[color=#88ff99]★ Traum erfüllt.[/color]", 16)
|
||||
else:
|
||||
_text("[color=#ffcc66]Keine aktive Mission für diesen Menschen. " +
|
||||
"Fortschritt zählt nur mit angenommener Mission.[/color]", 15)
|
||||
if Game.active_mission != id:
|
||||
_text("[color=#ffcc66]Keine aktive Mission für diesen Menschen.[/color]", 15)
|
||||
_zeigen("anwenden")
|
||||
return
|
||||
var grund := Game.slot_grund(id, nr)
|
||||
if not Game.erkannt(id, nr):
|
||||
_text("[color=#ffcc66]Was hier läuft, hast du noch nicht gesehen. " +
|
||||
"Bleib stehen und schau zu.[/color]", 16)
|
||||
_zeigen("anwenden")
|
||||
return
|
||||
if Ursachen.ist_blocker(grund):
|
||||
var b: Dictionary = Ursachen.BLOCKER[grund]
|
||||
_text("Sie %s. [b]Auslöser:[/b] %s · [b]Belohnung:[/b] %s" %
|
||||
[b["name"], b["ausloeser"], Ursachen.belohnung_text(str(b["belohnung"]))], 15)
|
||||
_trenner()
|
||||
|
||||
if Game.known.is_empty():
|
||||
_text("[color=#ffcc66]Du kennst keine Technik.[/color]")
|
||||
_zeigen("anwenden")
|
||||
return
|
||||
_text("[color=#aaaaaa]Was eine Technik tut, steht im Journal.[/color]", 15)
|
||||
|
||||
for id in TechDB.ids():
|
||||
if not Game.knows(id):
|
||||
for tid in TechDB.ids():
|
||||
if not Game.knows(tid):
|
||||
continue
|
||||
var t := TechDB.by_id(id)
|
||||
var ev := Game.evaluate(id, h["id"], aktiv, mensch.resist_left > 0.0)
|
||||
var gesperrt := not Game.bereit(id)
|
||||
var beschriftung := "%s · Stufe %d" % [t["name"], Game.skill_of(id)]
|
||||
if gesperrt:
|
||||
beschriftung += " — noch %d s gesperrt" % int(ceil(Game.cooldown_rest(id)))
|
||||
elif ev["blocked"]:
|
||||
beschriftung += " — " + str(ev["grund"])
|
||||
var pruef := Game.system_pruefen(id, nr, tid)
|
||||
var t := TechDB.by_id(tid)
|
||||
var beschriftung := "%s · Stufe %d" % [t["name"], Game.skill_of(tid)]
|
||||
if not pruef["geht"]:
|
||||
beschriftung += " — " + str(pruef["grund"])
|
||||
elif mensch.resist_left > 0.0:
|
||||
beschriftung += " — macht gerade dicht"
|
||||
_knopf(beschriftung, func() -> void: _anwenden(id), not ev["blocked"] and not gesperrt)
|
||||
_knopf(beschriftung, func() -> void: _vor_ort_setzen(tid), bool(pruef["geht"]))
|
||||
_zeigen("anwenden")
|
||||
|
||||
|
||||
func _anwenden(id: String) -> void:
|
||||
func _vor_ort_setzen(tech_id: String) -> void:
|
||||
if _apply_human == null or not is_instance_valid(_apply_human):
|
||||
schliessen()
|
||||
return
|
||||
var mensch := _apply_human
|
||||
var h: Dictionary = mensch.data
|
||||
var res := Game.apply_technique(id, h["id"], mensch.activity, mensch.resist_left > 0.0)
|
||||
var id: String = str(mensch.data["id"])
|
||||
var res := Game.system_setzen(id, int(mensch.slot), tech_id, mensch.resist_left > 0.0)
|
||||
schliessen()
|
||||
if not res["ok"]:
|
||||
Game.notified.emit(res["grund"], Color(1, 0.6, 0.4))
|
||||
Game.notified.emit(str(res["grund"]), Color(1, 0.6, 0.4))
|
||||
return
|
||||
var t := TechDB.by_id(id)
|
||||
if res["success"]:
|
||||
mensch.reagiere(true, "%s wirkt\n+%d %%" % [t["name"], int(round(float(res["gain"])))])
|
||||
Game.notified.emit("%s erreicht %s. (+%d %%)" %
|
||||
[t["name"], h["name"], int(round(float(res["gain"])))], Color(0.6, 1, 0.7))
|
||||
if res["wiederholung"] >= 2:
|
||||
Game.notified.emit("Immer dieselbe Technik wirkt schwächer. Probier eine andere.",
|
||||
Color(0.85, 0.85, 0.6))
|
||||
var t := TechDB.by_id(tech_id)
|
||||
if res["erfolg"]:
|
||||
mensch.reagiere(true, "%s\nsteht" % t["name"])
|
||||
else:
|
||||
mensch.reagiere(false, "%s prallt ab\n−%d %%" % [t["name"],
|
||||
int(round(float(res["verlust"])))])
|
||||
Game.notified.emit("%s dringt nicht durch. (−%d %%)" %
|
||||
[t["name"], int(round(float(res["verlust"])))], Color(1, 0.6, 0.5))
|
||||
mensch.reagiere(false, "%s greift nicht" % t["name"])
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
Reference in New Issue
Block a user