60 lines
2.1 KiB
GDScript
60 lines
2.1 KiB
GDScript
extends Node
|
|
## Prüft Erfahrung, Schwellen und Stufenaufstieg.
|
|
##
|
|
## godot --headless --path game res://tools/probe_erfahrung.tscn -- --check
|
|
|
|
const SCHWELLEN := {2: 300, 3: 900, 4: 1800, 5: 3000}
|
|
|
|
var fehler := 0
|
|
|
|
|
|
func _ready() -> void:
|
|
Game.party_schnellstart()
|
|
var a: Dictionary = Game.party[0] # Aldric, Kämpfer, KON 14 (+2)
|
|
var b: Dictionary = Game.party[1] # Bruna, Klerikerin, KON 15 (+2)
|
|
ok("Start: Stufe 1, 0 XP", int(a["level"]) == 1 and int(a["xp"]) == 0)
|
|
|
|
for stufe in SCHWELLEN:
|
|
ok("Schwelle Stufe %d = %d" % [stufe, SCHWELLEN[stufe]],
|
|
Game.stufen_schwelle(stufe) == SCHWELLEN[stufe])
|
|
ok("Schwelle Stufe 1 = 0", Game.stufen_schwelle(1) == 0)
|
|
|
|
var tp_max: int = int(a["hp"]["max"])
|
|
var tp_ist: int = int(a["hp"]["current"])
|
|
var angriff: int = Game.angriffsbonus(a)
|
|
|
|
Game.erfahrung(299)
|
|
ok("299 XP: noch Stufe 1", int(a["level"]) == 1)
|
|
ok("299 XP: keine Meldung", Game.erfahrung(0).is_empty())
|
|
|
|
var meldungen := Game.erfahrung(1)
|
|
ok("300 XP: Stufe 2", int(a["level"]) == 2)
|
|
ok("Aufstieg meldet jede Figur", meldungen.size() == Game.party.size()
|
|
and str(meldungen[0]).contains("Aldric"))
|
|
ok("TP-Maximum wächst um 5 + KON 1", int(a["hp"]["max"]) == tp_max + 6)
|
|
ok("aktuelle TP wachsen mit", int(a["hp"]["current"]) == tp_ist + 6)
|
|
ok("Angriff steigt auf +2", Game.angriffsbonus(a) == 2)
|
|
ok("ganze Partei bekommt XP", int(b["xp"]) == int(a["xp"]))
|
|
ok("Klerikerin wächst um 4 + KON 2",
|
|
int(b["hp"]["max"]) == 8 + 4 + 2)
|
|
|
|
# Ein großer Sprung steigt mehrmals auf: 300 + 1701 = 2001 → Stufe 4.
|
|
Game.erfahrung(1701)
|
|
ok("2001 XP: Stufe 4", int(a["level"]) == 4)
|
|
|
|
Game.erfahrung(2000) # 4001 XP → über 3000: Stufe 5
|
|
ok("4001 XP: Stufe 5", int(a["level"]) == 5)
|
|
ok("Angriff auf Höchststufe +5", Game.angriffsbonus(a) == 5)
|
|
|
|
Game.erfahrung(100000)
|
|
ok("bleibt auf der Höchststufe", int(a["level"]) == 5)
|
|
ok("Höchststufe sammelt trotzdem XP", int(a["xp"]) > 100000)
|
|
|
|
print("\nProbe: %s" % ("bestanden" if fehler == 0 else "FEHLGESCHLAGEN"))
|
|
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])
|