game: Kampf — 18×9-Raster, Initiative, Bewegung, Angriff, Sieg
This commit is contained in:
parent
aed14b9b22
commit
45df888d4b
18 changed files with 1205 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ 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")
|
||||
const KAMPF_REGELN := preload("res://scripts/systems/kampf_regeln.gd")
|
||||
|
||||
func _ready() -> void:
|
||||
var args := OS.get_cmdline_args() + OS.get_cmdline_user_args()
|
||||
|
|
@ -19,6 +20,9 @@ func _ready() -> void:
|
|||
get_tree().quit(0 if _selbstpruefung() else 1)
|
||||
return
|
||||
_ohne_erstellung = args.has("--ohne-erstellung")
|
||||
for arg in args:
|
||||
if arg.begins_with("--kampf="):
|
||||
_kampf_debug = arg.substr(8)
|
||||
_bericht()
|
||||
_stadt()
|
||||
|
||||
|
|
@ -28,12 +32,16 @@ var _aktuell: Node = null
|
|||
var _blende: ColorRect
|
||||
var _wechselnd := false
|
||||
var _ohne_erstellung := false
|
||||
var _kampf_debug := ""
|
||||
|
||||
func _stadt() -> void:
|
||||
_blende_bauen()
|
||||
if _ohne_erstellung:
|
||||
Game.party_schnellstart()
|
||||
zeige_ortsbild()
|
||||
if not _kampf_debug.is_empty():
|
||||
zeige_kampf(_kampf_debug)
|
||||
else:
|
||||
zeige_ortsbild()
|
||||
else:
|
||||
zeige_titel()
|
||||
|
||||
|
|
@ -104,7 +112,22 @@ func zeige_ortsbild() -> void:
|
|||
func _gebiet_betreten(_karte_id: String) -> void:
|
||||
_wechsel_zu(load("res://scenes/world/stadt.tscn"),
|
||||
func(k: Node) -> void: k.set("gedaempft", true),
|
||||
func(k: Node) -> void: k.zurueck.connect(zeige_ortsbild))
|
||||
func(k: Node) -> void:
|
||||
k.zurueck.connect(zeige_ortsbild)
|
||||
k.kampf_starten.connect(zeige_kampf))
|
||||
|
||||
|
||||
func zeige_kampf(kampf_id: String) -> void:
|
||||
_wechsel_zu(load("res://scenes/combat/kampf.tscn"),
|
||||
func(k: Node) -> void: k.set("encounter_id", kampf_id),
|
||||
func(k: Node) -> void: k.beendet.connect(_kampf_ende))
|
||||
|
||||
|
||||
func _kampf_ende(sieg: bool) -> void:
|
||||
if sieg:
|
||||
_gebiet_betreten("garana")
|
||||
else:
|
||||
zeige_titel()
|
||||
|
||||
|
||||
func _wechsel_zu(szene: PackedScene, vorbereiten: Callable = Callable(),
|
||||
|
|
@ -353,6 +376,21 @@ func _selbstpruefung() -> bool:
|
|||
Game.gold = 20
|
||||
Game.party = sicherung
|
||||
|
||||
# Kampfmathematik: Wurfbereiche, kritische Treffer, Footprint-Abstand.
|
||||
var aw: Dictionary = KAMPF_REGELN.angriff(0, 10)
|
||||
ok = _pruefe("Kampf: Angriffswurf 1..20",
|
||||
int(aw["wurf"]) >= 1 and int(aw["wurf"]) <= 20
|
||||
and int(aw["total"]) == int(aw["wurf"])) and ok
|
||||
var schaden: int = KAMPF_REGELN.schaden("1d6", true)
|
||||
ok = _pruefe("Kampf: kritischer Schaden 2..12",
|
||||
schaden >= 2 and schaden <= 12) and ok
|
||||
var ini: int = KAMPF_REGELN.initiative(2)
|
||||
ok = _pruefe("Kampf: Initiative 3..22", ini >= 3 and ini <= 22) and ok
|
||||
var links := {"tile": Vector2i(1, 1), "size": Vector2i(1, 1)}
|
||||
var rechts := {"tile": Vector2i(3, 2), "size": Vector2i(1, 1)}
|
||||
ok = _pruefe("Kampf: Footprint-Abstand 2",
|
||||
KAMPF_REGELN.abstand(links, rechts) == 2) and ok
|
||||
|
||||
# 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