Unit-Stärken präzisiert: Stat-Proxy-Multiplikatoren + gelernte Unit-Gewichte
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,3 +50,15 @@ def test_empty_rows():
|
||||
assert learned["traits"] == {}
|
||||
assert learned["pairs"] == {}
|
||||
assert learned["n_boards"] == 0
|
||||
|
||||
|
||||
def test_unit_multipliers_learned():
|
||||
def row(placement, unit):
|
||||
units = [{"character_id": unit, "tier": 2, "itemNames": []}]
|
||||
return (placement, json.dumps(units), json.dumps([]), json.dumps([]))
|
||||
|
||||
rows = [row(1, "TFT17_Strong") for _ in range(150)]
|
||||
rows += [row(8, "TFT17_Weak") for _ in range(150)]
|
||||
learned = learn(rows)
|
||||
assert learned["units"]["TFT17_Strong"] > 1.05
|
||||
assert learned["units"]["TFT17_Weak"] < 0.95
|
||||
|
||||
@@ -86,3 +86,33 @@ def test_craftable_item_pool():
|
||||
"TFT_Item_Radiant": {"composition": None},
|
||||
}
|
||||
assert craftable_items(items) == ["TFT_Item_InfinityEdge"]
|
||||
|
||||
|
||||
def test_stat_mults_rank_within_cost():
|
||||
from tft.model.baseline import compute_stat_mults
|
||||
|
||||
def unit(hp, armor, ad, aspd):
|
||||
return {"cost": 2, "traits": [], "role": "Tank",
|
||||
"stats": {"hp": hp, "armor": armor, "magicResist": armor,
|
||||
"damage": ad, "attackSpeed": aspd, "mana": 60,
|
||||
"initialMana": 0, "range": 1}}
|
||||
|
||||
units = {"tanky": unit(900, 60, 45, 0.6), "avg": unit(700, 40, 55, 0.7),
|
||||
"weak": unit(550, 25, 45, 0.6)}
|
||||
mults = compute_stat_mults(units)
|
||||
assert mults["tanky"] > mults["avg"] > mults["weak"]
|
||||
assert all(0.9 <= m <= 1.1 for m in mults.values())
|
||||
|
||||
|
||||
def test_stat_mults_identical_units_are_neutral():
|
||||
from tft.model.baseline import compute_stat_mults
|
||||
from tests.test_sim import make_static
|
||||
|
||||
mults = compute_stat_mults(make_static()["units"])
|
||||
assert all(m == 1.0 for m in mults.values())
|
||||
|
||||
|
||||
def test_stat_mult_raises_score():
|
||||
art = {**ARTIFACT, "stat_mults": {"TFT17_B": 1.1}}
|
||||
board = [{"api_name": "TFT17_B", "stars": 1, "items": []}]
|
||||
assert score_board(board, [], art) > score_board(board, [], ARTIFACT)
|
||||
|
||||
Reference in New Issue
Block a user