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
|
|
@ -11,6 +11,7 @@ extends Node
|
|||
const THEME := preload("res://scripts/ui/ui_theme.gd")
|
||||
const SCHATTEN := preload("res://scenes/common/schatten.gd")
|
||||
const KREATUR := preload("res://scenes/common/kreatur.gd")
|
||||
const CHARAKTER := preload("res://scripts/systems/charakter.gd")
|
||||
|
||||
func _ready() -> void:
|
||||
var args := OS.get_cmdline_args() + OS.get_cmdline_user_args()
|
||||
|
|
@ -183,6 +184,53 @@ func _selbstpruefung() -> bool:
|
|||
ok = _pruefe("Kontur-Shader: Dither-Schalter",
|
||||
kontur != null and kontur.code.contains("verdeckt")) and ok
|
||||
|
||||
# Charaktererstellung: Punktekauf, Volksbonus, Ableitung, Roster-Grenze
|
||||
# (docs/charaktererstellung.md).
|
||||
var c: Charakter = CHARAKTER.neu()
|
||||
c.name = "Probe"
|
||||
c.volk_setzen("human")
|
||||
c.klasse_setzen("fighter")
|
||||
ok = _pruefe("Punktekauf: Start 8, 30 frei",
|
||||
c.punkte_frei() == 30 and c.endwert("str") == 8) and ok
|
||||
ok = _pruefe("Mensch: zwei verschiedene Boni",
|
||||
c.mensch_waehlen("str", "str") == false
|
||||
and c.mensch_waehlen("str", "con")) and ok
|
||||
ok = _pruefe("Punktekauf: 19 abgelehnt", not c.setze("str", 19)) and ok
|
||||
ok = _pruefe("Punktekauf: 18 + Volksbonus abgelehnt",
|
||||
not c.setze("str", 18)) and ok
|
||||
var werte := {"str": 16, "dex": 12, "con": 14, "int": 10, "wis": 9, "cha": 11}
|
||||
for attribut in werte:
|
||||
c.setze(attribut, int(werte[attribut]))
|
||||
ok = _pruefe("Punktekauf: 24 von 30 verbraucht",
|
||||
c.punkte_verbraucht() == 24 and c.punkte_frei() == 6) and ok
|
||||
c.setze("cha", 17)
|
||||
ok = _pruefe("Punktekauf: über Pool abgelehnt", not c.erhoehe("cha")) and ok
|
||||
c.setze("cha", 11)
|
||||
ok = _pruefe("Volksbonus: Mensch STÄ 17, KON 15",
|
||||
c.endwert("str") == 17 and c.endwert("con") == 15) and ok
|
||||
ok = _pruefe("Charakterprüfung ohne Fehler", c.pruefe().is_empty()) and ok
|
||||
|
||||
var figur: Dictionary = Game.neue_figur("pc_probe", c.vorgabe())
|
||||
ok = _pruefe("Figur: TP 9, RK 10, Angriff +1",
|
||||
int(figur["hp"]["max"]) == 9 and Game.rk(figur) == 10
|
||||
and Game.angriffsbonus(figur) == 1) and ok
|
||||
|
||||
# Roster: 1..6, siebte Figur abgelehnt, Entfernen gibt den Platz frei.
|
||||
var sicherung: Array = Game.party.duplicate(true)
|
||||
Game.party_leeren()
|
||||
ok = _pruefe("Roster: leer ist nicht bereit", not Game.party_bereit()) and ok
|
||||
for i in Game.PARTY_MAX:
|
||||
Game.party_aufnehmen(c.vorgabe())
|
||||
ok = _pruefe("Roster: sechs Figuren", Game.party.size() == 6
|
||||
and Game.party_bereit()) and ok
|
||||
ok = _pruefe("Roster: siebte abgelehnt",
|
||||
Game.party_aufnehmen(c.vorgabe()).is_empty()
|
||||
and Game.party.size() == 6) and ok
|
||||
ok = _pruefe("Roster: Entfernen und neue id",
|
||||
Game.party_entfernen("pc_3") and Game.party.size() == 5
|
||||
and str(Game.party_aufnehmen(c.vorgabe()).get("id", "")) == "pc_3") and ok
|
||||
Game.party = sicherung
|
||||
|
||||
# Spielstand: schreiben, lesen, vergleichen.
|
||||
# JSON kennt nur "Zahl", Godot liest sie als float zurück; vor dem Vergleich
|
||||
# werden ganze Zahlen normalisiert (1.0 -> 1), sonst wäre der Test unehrlich
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue