Auto-Carousel, Standings mit Spieler, Runden-Tracker, Item-Rail links, sinnvoller Item-Pool

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
team3
2026-07-23 06:18:07 +02:00
parent 885bf28fd4
commit 76acd026ec
9 changed files with 169 additions and 51 deletions

View File

@@ -20,7 +20,7 @@ def client(monkeypatch):
def test_full_game_via_api(client):
state = client.post("/api/game", params={"seed": 3}).json()
game_id = state["game_id"]
assert state["round"]["label"] == "1-1"
assert state["round"]["label"] == "1-2" # 1-1-Carousel läuft automatisch ab
assert state["player"]["hp"] == 100
assert len(state["opponents"]) == 7

View File

@@ -78,7 +78,7 @@ def test_invalid_actions_raise(art, cfg):
with pytest.raises(InvalidAction):
game.buy_xp()
with pytest.raises(InvalidAction):
game.sell("bench", 0)
game.sell("bench", 99)
def test_shop_lock_survives_step(art, cfg):
@@ -87,3 +87,19 @@ def test_shop_lock_survives_step(art, cfg):
before = list(game.shop)
game.step()
assert game.shop == before
def test_carousel_never_a_planning_round(art, cfg):
game = Game(art, cfg, seed=5)
seen = []
while not game.over:
seen.append(game.round["kind"])
game.step()
assert "carousel" not in seen
assert seen[0] == "pve" # Spiel startet bei 1-2
def test_carousel_grants_unit_and_loot(art, cfg):
game = Game(art, cfg, seed=5)
assert len(game.bench) == 1 # Unit vom 1-1-Carousel
assert len(game.items) == 1 # Item-Komponente vom Carousel

View File

@@ -74,3 +74,15 @@ def test_spearman():
assert spearman([1, 2, 3, 4], [10, 20, 30, 40]) == pytest.approx(1.0)
assert spearman([1, 2, 3, 4], [40, 30, 20, 10]) == pytest.approx(-1.0)
assert spearman([1, 2, 3, 4], [10, 10, 10, 10]) == 0.0
def test_craftable_item_pool():
from tft.model.artifact import craftable_items
items = {
"TFT_Item_InfinityEdge": {"composition": ["TFT_Item_BFSword", "TFT_Item_SparringGloves"]},
"TFT_Item_BFSword": {"composition": []},
"TFT_Item_Emblem": {"composition": ["TFT_Item_Spatula", "TFT_Item_BFSword"]},
"TFT17_Item_Weird": {"composition": ["TFT_Item_BFSword", "TFT_Item_BFSword"]},
"TFT_Item_Radiant": {"composition": None},
}
assert craftable_items(items) == ["TFT_Item_InfinityEdge"]