fix(bot): correct combat estimates and enforce client and runner failures
This commit is contained in:
parent
62693618db
commit
3f243eaeee
10 changed files with 859 additions and 273 deletions
|
|
@ -1075,16 +1075,37 @@ check("...and the executor finds the line",
|
|||
bool(brain._lethal_line(bf.playable, bf.energy, bf.player_status, bf.enemies[0])),
|
||||
True)
|
||||
|
||||
strong = combat(hand=[card(index=n) for n in range(2)],
|
||||
strong = combat(hand=[card(index=n, desc="Deal 12 damage.") for n in range(2)],
|
||||
enemies=[enemy("E_0", hp=18, intent=0)],
|
||||
status=[{"name": "Strength", "amount": 6, "type": "Buff"}])
|
||||
sf = facts.combat_facts(strong)
|
||||
check("the executor sees the player's Strength",
|
||||
check("the executor uses Strength-adjusted hand text",
|
||||
[c["name"] for c in (brain._lethal_line(sf.playable, sf.energy,
|
||||
sf.player_status, sf.enemies[0]) or [])],
|
||||
["Strike", "Strike"])
|
||||
check("...where an empty status list finds nothing",
|
||||
brain._lethal_line(sf.playable, sf.energy, [], sf.enemies[0]), None)
|
||||
check("...and does not need to add Strength again",
|
||||
bool(brain._lethal_line(sf.playable, sf.energy, [], sf.enemies[0])), True)
|
||||
|
||||
print()
|
||||
print("=== correctness: shared damage and block plans ===")
|
||||
|
||||
adjusted = combat(hand=[card(index=5, desc="Deal 8 damage.")],
|
||||
enemies=[enemy("E_0", hp=9, intent=0)],
|
||||
status=[{"name": "Strength", "amount": 2}])
|
||||
af = facts.combat_facts(adjusted)
|
||||
check("executor does not invent a Strength-based lethal line",
|
||||
brain._lethal_line(af.playable, af.energy, af.player_status, af.enemies[0]), None)
|
||||
|
||||
defenders = [card("Big Block", index=5, cost="2", desc="Gain 9 Block.", ctype="Skill", target="Self"),
|
||||
card("Small Block", index=8, desc="Gain 6 Block.", ctype="Skill", target="Self"),
|
||||
card("Small Block", index=11, desc="Gain 6 Block.", ctype="Skill", target="Self")]
|
||||
blocking = combat(hand=defenders, enemies=[enemy("E_0", hp=100, intent=12)], hp=30)
|
||||
blocking["player"]["energy"] = 2
|
||||
bd = brain.decide(blocking, None)
|
||||
check("forced defense starts a maximum-block plan", bd.params.get("card_index") in (8, 11), True)
|
||||
covered = combat(hand=[card("Defend", index=5, desc="Gain 5 Block.", ctype="Skill", target="Self"),
|
||||
card(index=8)], enemies=[enemy("E_0", hp=100, intent=12)], hp=30, block=12)
|
||||
check("fully blocked incoming does not force Defend", brain.decide(covered, None).params.get("card_index"), 8)
|
||||
|
||||
print()
|
||||
print(f"=== {PASS} passed, {FAIL} failed ===")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue