game: Party-Erstellung als Einstieg — Roster, Figurenmaske, UI-Probe
This commit is contained in:
parent
b47c392e85
commit
f8d8f56b86
16 changed files with 707 additions and 17 deletions
56
game/tools/probe_erstellung.gd
Normal file
56
game/tools/probe_erstellung.gd
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
extends Node
|
||||
## Probe für die Erstellungs-Szene (docs/charaktererstellung.md).
|
||||
##
|
||||
## godot --headless --path game res://tools/probe_erstellung.tscn -- --check
|
||||
##
|
||||
## Baut die Szene, öffnet die Figurenmaske, setzt Punkte, übernimmt die Figur
|
||||
## und prüft, dass sie im Roster landet. Prüft die UI-Wege, die `--check` nicht
|
||||
## abdeckt (Knopf → `Game.party_aufnehmen`).
|
||||
|
||||
const SZENE := preload("res://scenes/creation/erstellung.tscn")
|
||||
|
||||
var fehler := 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Game.party_leeren()
|
||||
var sicht: Control = SZENE.instantiate()
|
||||
add_child(sicht)
|
||||
await get_tree().process_frame
|
||||
ok("Roster baut", sicht.get_child_count() > 0)
|
||||
|
||||
sicht.call("_oeffne_erstellung")
|
||||
await get_tree().process_frame
|
||||
ok("Figurenmaske baut", sicht.get("_c") != null)
|
||||
|
||||
var c: Charakter = sicht.get("_c")
|
||||
sicht.get("_name_feld").text = "Probe"
|
||||
c.volk_setzen("human")
|
||||
c.mensch_waehlen("str", "con")
|
||||
var werte := {"str": 15, "dex": 12, "con": 13, "int": 10, "wis": 9, "cha": 11}
|
||||
for attribut in werte:
|
||||
c.setze(attribut, int(werte[attribut]))
|
||||
c.portrait = "portrait_elfin"
|
||||
sicht.call("_aktualisiere")
|
||||
|
||||
sicht.call("_uebernehmen_druecken")
|
||||
await get_tree().process_frame
|
||||
ok("Figur im Roster", Game.party.size() == 1)
|
||||
var figur: Dictionary = Game.party[0] if not Game.party.is_empty() else {}
|
||||
ok("Name übernommen", str(figur.get("name", "")) == "Probe")
|
||||
ok("Volksbonus im Datensatz",
|
||||
int(figur.get("attributes", {}).get("str", 0)) == 16
|
||||
and int(figur.get("attributes", {}).get("con", 0)) == 14)
|
||||
ok("Porträt im Datensatz",
|
||||
str(figur.get("portrait", "")) == "portrait_elfin")
|
||||
ok("TP 9", int(figur.get("hp", {}).get("max", 0)) == 9)
|
||||
|
||||
print("\nProbe: %s" % ("bestanden" if fehler == 0 else "FEHLGESCHLAGEN"))
|
||||
if OS.get_cmdline_user_args().has("--check"):
|
||||
get_tree().quit(0 if fehler == 0 else 1)
|
||||
|
||||
|
||||
func ok(name: String, wahr: bool) -> void:
|
||||
if not wahr:
|
||||
fehler += 1
|
||||
print(" %s %s" % [("ok " if wahr else "FEHL"), name])
|
||||
6
game/tools/probe_erstellung.tscn
Normal file
6
game/tools/probe_erstellung.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://tools/probe_erstellung.gd" id="1"]
|
||||
|
||||
[node name="ProbeErstellung" type="Node"]
|
||||
script = ExtResource("1")
|
||||
Loading…
Add table
Add a link
Reference in a new issue