update
Some checks failed
Tests / headless (push) Has been cancelled
Tests / fenster-schnell (push) Has been cancelled
Tests / fenster-voll (push) Has been cancelled
Tests / balance (push) Has been cancelled

This commit is contained in:
team3
2026-10-06 18:16:17 +02:00
parent 0a612f91b3
commit 5bc8569717
15 changed files with 43 additions and 170 deletions

View File

@@ -60,7 +60,6 @@ func _initialize() -> void:
test_verdeckt()
test_elementboni()
test_spott_und_regeneration()
test_verbessern()
test_verschmelzen()
test_limits()
test_gleiche_regeln()
@@ -383,33 +382,6 @@ func test_spott_und_regeneration() -> void:
check(g2.events.any(func(e): return e.type == "heal" and e.uid == reg.uid), "Ereignis fürs Heilen")
## Verbessern: Eigenschaften für Mana, je Exemplar, auf Hand und Brett.
func test_verbessern() -> void:
var s := setup(["f_wolf"])
var g: Game = s[0]
var h: Game.Player = s[1]
var o: Game.Player = s[2]
h.energy = 20
var card: Cards.Card = h.hand[0]
check(g.upgrade(h, card, "Spott") == "" and h.energy == 20 - 2 and "Spott" in h.hand[0].keywords, "Spott für die Handkarte gekauft")
check(h.hand[0] != card and Cards.by_id("f_wolf").keywords.is_empty(), "eigenes Exemplar, der Pool bleibt sauber")
check(g.upgrade(h, h.hand[0], "Spott") != "", "nicht doppelt")
g.play_card(h, h.hand[0])
var wolf: Game.Creature = h.board[0]
var after_play := h.energy
check(wolf.has("Spott") and not wolf.can_attack(), "mit Spott gelegt, greift noch nicht an")
check(g.upgrade(h, wolf, "Flink") == "" and wolf.can_attack() and h.energy == after_play - 2, "Flink: greift sofort an")
check(g.upgrade(h, wolf, "Doppelschlag") == "" and wolf.attacks_per_turn() == 2 and wolf.attacks_left() == 2 and h.energy == after_play - 6, "Doppelschlag: zwei Angriffe")
check(g.upgrade(h, wolf, "Regeneration") == "" and h.energy == after_play - 9, "Regeneration kostet 3")
check(wolf.card.text() == "Spott, Flink, Regeneration, Doppelschlag.", "Kartentext zeigt die Eigenschaften")
check(g.upgrade(h, wolf, "Doppelschlag") != "" and g.upgrade(h, put(o, "e_wall"), "Spott") != "" and g.upgrade(h, wolf, "Schild") != "", "nicht doppelt, nicht fremd, nicht unbekannt")
h.energy = 1
var k2 := put(h, "f_kobold")
check(g.upgrade(h, k2, "Spott") == "Nicht genug Mana", "zu teuer")
h.perks = ["verbessern_billig"]
check(g.upgrade(h, k2, "Spott") == "" and h.energy == 0, "Merkmal: Eigenschaften kosten 1 weniger")
## Verschmelzen: besserer Wert plus ein Drittel des schwächeren, Eigenschaften beider, Kosten 1, 2, 4, 8 …; auch auf der Hand.
func test_verschmelzen() -> void:
var s := setup()
@@ -612,8 +584,6 @@ func test_kopie() -> void:
check(g2.players[1].life == 11 and o.life == 15, "Kopie verändert das Original nicht")
g2.play_card(g2.players[0], g2.players[0].hand[0])
check(h.hand.size() == 1 and g2.players[0].hand.is_empty(), "Hand der Kopie unabhängig")
g2.upgrade(g2.players[0], a2, "Spott")
check(not a.has("Spott") and a.card.keywords.is_empty() and a2.has("Spott"), "Verbessern in der Kopie lässt das Original unberührt")
check(g2.log.is_empty() and g2.events.is_empty(), "Kopie schreibt keinen Verlauf")
@@ -781,21 +751,22 @@ func test_merkmale() -> void:
func test_ki_zwei_schritte() -> void:
# Gegner hat 5 Leben und kein Wesen; der Wüstenkönig (5 Angriff) liegt frisch auf dem Brett:
# erst Flink kaufen, dann mit ihm töten.
# Gegner hat 5 Leben und einen Kobold davor; der Wüstenkönig (5 Angriff) und der Wolf sind bereit:
# erst den Kobold mit dem Wolf wegräumen, dann mit dem König töten.
var s := setup()
var g: Game = s[0]
var h: Game.Player = s[1]
var o: Game.Player = s[2]
h.turns = 2
o.life = 5
var king := put(h, "el_koenig", false)
put(h, "f_wolf", false)
var king := put(h, "el_koenig")
var wolf := put(h, "f_wolf")
var blocker := put(o, "f_kobold")
var act := AI.choose_action(g, h)
check(act.type == "upgrade" and act.creature == king and act.keyword == "Flink", "KI kauft zuerst Flink für den König")
check(act.type == "attack" and act.creature == wolf and act.target == blocker, "KI räumt zuerst mit dem Wolf den Kobold weg")
AI.apply_action(g, h, act)
var act2 := AI.choose_action(g, h)
check(act2.type == "attack" and act2.target == o, "dann tödlicher Angriff")
check(act2.type == "attack" and act2.creature == king and act2.target == o, "dann tödlicher Angriff mit dem König")
AI.apply_action(g, h, act2)
check(g.winner == "human", "Zwei-Schritt-Plan gewinnt")
@@ -805,7 +776,6 @@ func test_snapshot() -> void:
var g: Game = s[0]
var h: Game.Player = s[1]
var o: Game.Player = s[2]
g.upgrade(h, h.hand[0], "Spott")
g.play_card(h, h.hand[0])
var troll := put(o, "e_troll")
troll.attacks_done = 1
@@ -822,7 +792,7 @@ func test_snapshot() -> void:
check(g2.players[hi].hand.size() == 1 and g2.players[hi].hand[0].id == h.hand[0].id, "eigene Hand sichtbar")
check(g2.players[oi].hand.size() == 1 and g2.players[oi].hand[0].id != "w_frost", "fremde Hand nur als Anzahl")
var cr2 := g2.find_creature(h.board[0].uid)
check(cr2 != null and cr2.card.id == "f_wolf" and cr2.owner() == g2.players[hi] and cr2.has("Spott") and not cr2.ready, "Wesen mit Besitzer, Zustand und gekaufter Eigenschaft")
check(cr2 != null and cr2.card.id == "f_wolf" and cr2.owner() == g2.players[hi] and not cr2.ready, "Wesen mit Besitzer und Zustand")
var troll2 := g2.find_creature(troll.uid)
check(troll2.ready and troll2.attacks_done == 1, "Bereitschaft und Angriffe reisen mit")
check(g2.events.size() == g.events.size() and g2.events.back().type == g.events.back().type, "Ereignisse übertragen")
@@ -871,12 +841,12 @@ func test_ki_zeitbudget() -> void:
var act := AI.choose_action(g, h)
var ms := Time.get_ticks_msec() - t0
AI.time_budget_ms = 150
check(act.type in ["play", "attack", "upgrade", "fuse", "draw", "end"] and ms < 80, "Zeitbudget greift (%d ms)" % ms)
check(act.type in ["play", "attack", "fuse", "draw", "end"] and ms < 80, "Zeitbudget greift (%d ms)" % ms)
var v := Profile.from_dict(JSON.parse_string(JSON.stringify(Profile.starter().to_dict())))
check(v.settings.has("big_font") and v.coins == Profile.START_COINS, "Starterstand gelesen")
## Englisch: jede Karte hat einen englischen Namen, gekaufte Eigenschaften werden übersetzt.
## Englisch: jede Karte hat einen englischen Namen, Eigenschaften werden übersetzt.
func test_englische_karten() -> void:
check(Cards.all().all(func(c): return c.name_en != ""), "alle Karten mit englischem Namen")
var ritter := C("f_ritter")