game: Charaktererstellung als Party — Punktekauf, Roster, Prüfung
This commit is contained in:
parent
9015367407
commit
b47c392e85
10 changed files with 492 additions and 1 deletions
85
game/tools/probe_party.gd
Normal file
85
game/tools/probe_party.gd
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
extends Node
|
||||
## Probe für die Charaktererstellung (docs/charaktererstellung.md).
|
||||
##
|
||||
## godot --headless --path game res://tools/probe_party.tscn -- --check
|
||||
##
|
||||
## Baut die vier Papierprobe-Figuren über den Punktekauf, prüft die Ableitung
|
||||
## und die Roster-Grenze (1..6). Kein UI, keine Kunst — nur Regeln.
|
||||
|
||||
const CHARAKTER := preload("res://scripts/systems/charakter.gd")
|
||||
|
||||
## Dieselbe Besetzung wie docs/systeme.md §11. Mensch: Basis 15/13 plus
|
||||
## Menschen-Wahl STÄ/KON ergibt die 16/14 der Papierprobe.
|
||||
const BESETZUNG := [
|
||||
{"name": "Aldric", "volk": "human", "klasse": "fighter",
|
||||
"werte": {"str": 15, "dex": 12, "con": 13, "int": 10, "wis": 9, "cha": 11},
|
||||
"wahl": ["str", "con"]},
|
||||
{"name": "Bruna", "volk": "dwarf", "klasse": "cleric",
|
||||
"werte": {"str": 12, "dex": 9, "con": 15, "int": 10, "wis": 16, "cha": 11},
|
||||
"wahl": []},
|
||||
{"name": "Cael", "volk": "elf", "klasse": "magier",
|
||||
"werte": {"str": 8, "dex": 14, "con": 11, "int": 17, "wis": 12, "cha": 10},
|
||||
"wahl": []},
|
||||
{"name": "Dorn", "volk": "halfling", "klasse": "thief",
|
||||
"werte": {"str": 11, "dex": 16, "con": 12, "int": 12, "wis": 10, "cha": 13},
|
||||
"wahl": []},
|
||||
]
|
||||
|
||||
var fehler := 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Game.party_leeren()
|
||||
_bericht()
|
||||
var ok := fehler == 0
|
||||
for drei in BESETZUNG:
|
||||
var c := _bauen(drei)
|
||||
ok = _pruefe("%s: Punkte und Regeln" % c.name,
|
||||
c.pruefe().is_empty()) and ok
|
||||
Game.party_aufnehmen(c.vorgabe())
|
||||
|
||||
# Roster-Grenze: sechs ist das Maximum, die siebte wird abgelehnt.
|
||||
var fueller := _bauen(BESETZUNG[0]).vorgabe()
|
||||
for i in Game.PARTY_MAX - Game.party.size():
|
||||
Game.party_aufnehmen(fueller)
|
||||
ok = _pruefe("Roster: sechs Figuren", Game.party.size() == 6) and ok
|
||||
ok = _pruefe("Roster: siebte abgelehnt",
|
||||
Game.party_aufnehmen(fueller).is_empty()) and ok
|
||||
print("\nRoster: %d/%d, bereit: %s" % [
|
||||
Game.party.size(), Game.PARTY_MAX, "ja" if Game.party_bereit() else "nein"])
|
||||
|
||||
print("\nProbe: %s" % ("bestanden" if ok else "FEHLGESCHLAGEN"))
|
||||
if OS.get_cmdline_user_args().has("--check"):
|
||||
get_tree().quit(0 if ok else 1)
|
||||
|
||||
|
||||
func _bauen(drei: Dictionary) -> Charakter:
|
||||
var c: Charakter = CHARAKTER.neu()
|
||||
c.name = drei["name"]
|
||||
c.volk_setzen(drei["volk"])
|
||||
c.klasse_setzen(drei["klasse"])
|
||||
for attribut in drei["werte"]:
|
||||
c.setze(attribut, int(drei["werte"][attribut]))
|
||||
if not drei["wahl"].is_empty():
|
||||
c.mensch_waehlen(drei["wahl"][0], drei["wahl"][1])
|
||||
return c
|
||||
|
||||
|
||||
func _bericht() -> void:
|
||||
print("Name Volk/Klasse STÄ GES KON INT WEI CHA Punkte TP RK Angriff Fehler")
|
||||
for drei in BESETZUNG:
|
||||
var c := _bauen(drei)
|
||||
var fehlertext := ", ".join(c.pruefe()) if not c.pruefe().is_empty() else "—"
|
||||
print("%-8s %-17s %3d %3d %3d %3d %3d %3d %2d/%d %2d %2d +%d %s" % [
|
||||
c.name, "%s/%s" % [c.volk_id, c.klasse_id],
|
||||
c.endwert("str"), c.endwert("dex"), c.endwert("con"),
|
||||
c.endwert("int"), c.endwert("wis"), c.endwert("cha"),
|
||||
c.punkte_verbraucht(), Charakter.POOL,
|
||||
c.tp_max(), c.rk(), c.angriff(), fehlertext])
|
||||
|
||||
|
||||
func _pruefe(name: String, wahr: bool) -> bool:
|
||||
if not wahr:
|
||||
fehler += 1
|
||||
print(" %s %s" % [("ok " if wahr else "FEHL"), name])
|
||||
return wahr
|
||||
1
game/tools/probe_party.gd.uid
Normal file
1
game/tools/probe_party.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://drtsr45sks7ul
|
||||
6
game/tools/probe_party.tscn
Normal file
6
game/tools/probe_party.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://tools/probe_party.gd" id="1"]
|
||||
|
||||
[node name="ProbeParty" type="Node"]
|
||||
script = ExtResource("1")
|
||||
Loading…
Add table
Add a link
Reference in a new issue