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

@@ -143,6 +143,11 @@ def serialize(game: Game) -> dict:
return {
"round": {"label": game.round["label"], "stage": stage,
"kind": game.round["kind"]},
"stage_rounds": [
{"label": r["label"], "kind": r["kind"], "augment": r["augment"],
"done": i < game.idx, "current": i == game.idx}
for i, r in enumerate(game.rounds) if r["stage"] == stage
],
"player": {
"hp": game.hp, "gold": game.gold, "level": game.level, "xp": game.xp,
"xp_needed": game.cfg["xp"]["to_next"][game.level - 1]

View File

@@ -8,6 +8,23 @@ from tft.model import baseline
SCHEMA_VERSION = 1
# Spatula/Pfanne-Rezepte (Embleme) fallen aus dem normalen Loot raus.
SPATULA_COMPONENTS = {"TFT_Item_Spatula", "TFT_Item_FryingPan"}
def craftable_items(static_items: dict) -> list[str]:
"""Standard-kombinierbare Items — der Pool für Loot und Bot-Boards."""
pool = []
for api, item in static_items.items():
comp = item.get("composition") or []
if (
len(comp) == 2
and api.startswith("TFT_Item_")
and not set(comp) & SPATULA_COMPONENTS
):
pool.append(api)
return sorted(pool)
def build(static: dict, learned: dict | None = None, extra_meta: dict | None = None) -> dict:
roles = {
@@ -28,6 +45,7 @@ def build(static: dict, learned: dict | None = None, extra_meta: dict | None = N
"augments": static["augments"],
},
"roles": roles,
"item_pool": craftable_items(static["items"]),
"learned": learned or {},
}

View File

@@ -50,7 +50,7 @@ class Bot:
level = self.level(stage)
odds = cfg["shop"]["odds"][min(level, len(cfg["shop"]["odds"])) - 1]
p_2star = min(0.08 * stage, 0.55)
items = list(artifact["static"]["items"])
items = artifact.get("item_pool") or list(artifact["static"]["items"])
n_items = max(stage - 1, 0)
for _ in range(level):

View File

@@ -46,6 +46,10 @@ class Game:
self.bots = [
Bot(names[i], archetypes[i % len(archetypes)], self.hp) for i in range(7)
]
# 1-1-Carousel läuft automatisch ab: Unit + Loot, dann startet 1-2.
if self.round["kind"] == "carousel":
self._resolve(self.round)
self.idx += 1
self._refresh_bots()
self._reroll_shop()
self._maybe_offer_augment()
@@ -84,7 +88,7 @@ class Game:
self.augment_offer = self.rng.sample(augments, min(3, len(augments)))
def _grant_loot(self, components: int, gold: int) -> None:
items = list(self.artifact["static"]["items"])
items = self.artifact.get("item_pool") or list(self.artifact["static"]["items"])
for _ in range(components):
self.items.append(self.rng.choice(items))
self.gold += gold
@@ -207,13 +211,27 @@ class Game:
self.level, self.xp, self.cfg["xp"]["passive_per_round"], self.cfg
)
if self.idx + 1 >= len(self.rounds):
self._finish_by_hp()
return
prev_stage = rnd["stage"]
self.idx += 1
if self.round["stage"] != prev_stage:
self._refresh_bots()
self._advance()
def _advance(self) -> None:
"""Zur nächsten Planungsrunde; Carousels laufen dabei automatisch ab."""
while True:
if self.idx + 1 >= len(self.rounds):
self._finish_by_hp()
return
prev_stage = self.round["stage"]
self.idx += 1
if self.round["stage"] != prev_stage:
self._refresh_bots()
if self.round["kind"] != "carousel":
break
self._resolve(self.round)
self.gold += economy.round_income(
self.gold, self.streak, False, self.round["label"], self.cfg
)
self.level, self.xp = economy.apply_xp(
self.level, self.xp, self.cfg["xp"]["passive_per_round"], self.cfg
)
if not self.shop_locked:
self._reroll_shop()
self._maybe_offer_augment()