Augment-Effekte wirken: Gold/XP/Komponenten/Units/Spieler-HP bei Auswahl, Team-Buffs im Score, Junk gefiltert
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -243,14 +243,49 @@ def test_loot_drops_components(art, cfg):
|
||||
|
||||
|
||||
def test_bot_leveling_follows_targets(art, cfg):
|
||||
from tft.sim import policy as policy_mod
|
||||
|
||||
game = Game(art, cfg, seed=12)
|
||||
levels_at = {}
|
||||
while not game.over and game.round["label"] != "4-3":
|
||||
label = game.round["label"]
|
||||
if label in ("2-6", "3-3", "4-2"):
|
||||
levels_at[label] = [b.level for b in game.bots if b.alive]
|
||||
policy_mod.act(game.player, game.pool, game.artifact, game.cfg, game.rng,
|
||||
game.round, policy_mod.ARCHETYPES["fast8"])
|
||||
game.step()
|
||||
assert all(lvl >= 5 for lvl in levels_at["2-6"]) # L5 ab 2-5
|
||||
# L6 ab 3-1/3-2 — goldarme Bots dürfen 1-2 Runden nachhinken
|
||||
assert sum(1 for lvl in levels_at["3-3"] if lvl >= 6) >= len(levels_at["3-3"]) - 2
|
||||
assert any(lvl >= 7 for lvl in levels_at["4-2"]) # fast8/streaker auf 7
|
||||
|
||||
|
||||
def test_augment_effects_apply(art, cfg):
|
||||
game = Game(art, cfg, seed=3)
|
||||
game.artifact = {**art, "augment_specs": {
|
||||
"AUG_GOLD": {"atoms": [{"kind": "gold_now", "amount": 7},
|
||||
{"kind": "gold_per_stage", "amount": 7}], "offerable": True},
|
||||
"AUG_UNIT": {"atoms": [{"kind": "unit_grant", "cost": 2, "count": 2}], "offerable": True},
|
||||
}}
|
||||
gold_before = game.player.gold
|
||||
game.player.augment_offer = ["AUG_GOLD"]
|
||||
game.pick_augment(0)
|
||||
assert game.player.gold == gold_before + 7
|
||||
assert game.player.gold_per_stage == 7
|
||||
|
||||
bench_before = len(game.player.bench)
|
||||
pool_before = sum(game.pool.available(a) for a in game.pool.copies)
|
||||
game.player.augment_offer = ["AUG_UNIT"]
|
||||
game.pick_augment(0)
|
||||
assert len(game.player.bench) == bench_before + 2
|
||||
assert sum(game.pool.available(a) for a in game.pool.copies) == pool_before - 2
|
||||
|
||||
|
||||
def test_team_buff_augment_raises_score(art, cfg):
|
||||
from tft.model.score import score_mechanical
|
||||
buffed_art = {**art, "augment_specs": {
|
||||
"AUG_BUFF": {"atoms": [{"kind": "team_buff", "stat": "hp_pct", "value": 0.3}],
|
||||
"offerable": True}}}
|
||||
board = [{"api_name": "U2_0", "stars": 2, "items": []}]
|
||||
assert score_mechanical(board, ["AUG_BUFF"], buffed_art) > \
|
||||
score_mechanical(board, [], buffed_art)
|
||||
|
||||
@@ -62,3 +62,27 @@ def test_unit_multipliers_learned():
|
||||
learned = learn(rows)
|
||||
assert learned["units"]["TFT17_Strong"] > 1.05
|
||||
assert learned["units"]["TFT17_Weak"] < 0.95
|
||||
|
||||
|
||||
def test_augment_spec_builder():
|
||||
from tft.model.augments import build_spec
|
||||
|
||||
units = {"TFT17_Briar": {"name": "Briar", "cost": 1}}
|
||||
gold = build_spec({"desc": "Gain 6 gold now.", "effects": {"Gold": 6.0}}, units)
|
||||
assert gold["atoms"] == [{"kind": "gold_now", "amount": 6}]
|
||||
|
||||
buff = build_spec({"desc": "Your team gains 35 Health and 10% Attack Speed.",
|
||||
"effects": {"Health": 35.0, "AS": 0.10}}, units)
|
||||
kinds = {(a["kind"], a.get("stat")) for a in buff["atoms"]}
|
||||
assert ("team_buff", "hp_flat") in kinds
|
||||
assert ("team_buff", "as_pct") in kinds
|
||||
|
||||
cond = build_spec({"desc": "Your team gains 10 Health for each item.",
|
||||
"effects": {"Health": 10.0}}, units)
|
||||
assert not any(a["kind"] == "team_buff" for a in cond["atoms"])
|
||||
|
||||
unit = build_spec({"desc": "Gain a Briar and 2 gold.", "effects": {"Gold": 2.0}}, units)
|
||||
assert {"kind": "unit_grant", "units": ["TFT17_Briar"]} in unit["atoms"]
|
||||
|
||||
junk = build_spec({"desc": "", "effects": {}}, units)
|
||||
assert junk["offerable"] is False
|
||||
|
||||
Reference in New Issue
Block a user