CONFIG: RULEBOOK — WHAT IT DOES (AND WHEN)
SummaryWhen the bot is mid-match, each loop roughly does:
- (If configured) tries spells first.
- If the bable monitor asks for lane pressure/defense, try a lane-targeted action.
- scan_enemy finds an enemy → you get a hit like:
{"key":"hog-rider","template":"hog_rider_a","side":"left"}
It then calls
apply_rules(hit, elixir_now) — this is where your Rulebook runs.
If no rule actually plays a card, it falls back to your global
play_policy (e.g.
leftmost_affordable).
Bobom line: the Rulebook runs only when an enemy unit is detected.
Matching logic (top → bobom)Your rules are checked in order. The first rule that
matches and can play wins.
Each rule contains:
- if: enemy key(s) to react to. A string or list (must match your enemy_catalog keys like hog-rider, balloon).
- lane: where to drop (see Lane Resolution).
- where: drop depth (back / bridge / center).
- min_elixir: guard; skip if you don't have at least this much elixir.
- play: how to pick the hand slot (see Slot Selection).
If a rule matches but cannot play (e.g., not enough elixir or no affordable slot), you'll see:
[rule:skip] hog-rider no affordable/eligible slot for rule
Lane ResolutionGiven the enemy appeared on
hit["side"] ∈ {left, right, center}:
- lane: same → drop on the same side the enemy appeared on.
- lane: opposite → drop on the other side (left ↔ right; center stays center).
- lane: left|right|center → force that lane, regardless of enemy side.
Examples:- Enemy on left + lane: same → drop left.
- Enemy on left + lane: opposite → drop right.
- Enemy on center + lane: left → drop left.
Where to drop (depth)- back → safer, behind your Princess towers.
- bridge → aggressive, near the river.
- center → mid-board / kite point.
Slot Selection (the play block)The bot reads each hand slot's cost (templates:
card_mana_cost_*.png), filters by affordability, then applies:
- leftmost_affordable — first (leftmost) affordable slot.
- lowest_cost — the cheapest among affordable (tie → leftmost).
- highest_cost_under + cost:N — most expensive slot ≤ N (falls back to most expensive affordable if none ≤ N).
- exact_cost + cost:N — only if a slot costs exactly N.
- fixed_slot + slot:i — always try slot index 0..3 (still re-checks affordability at play time).
Guarded play: even after a slot is chosen, the bot re-reads the card cost and elixir; if it no longer fits, the play is aborted safely and the rule is treated as skipped.
Minimal examplerules:
if: ["hog-rider"]
lane: same
where: back
min_elixir: 3
play: { select: lowest_cost }
if: ["balloon", "baby-dragon", "inferno-dragon"]
lane: same
where: bridge
min_elixir: 3
play:
select: highest_cost_under
cost: 5
INTELLI-DECK — HOW IT WORKS
GoalUse your deck list to recognize what you own, learn the opponent's cards during the match (up to 8 uniques), and auto-select counters you actually have.
What you configure- play_style: intelli_deck
- decks → <active_deck> → cards: the 8 cards you own.
- counters: per enemy key, list counter cards you own (optionally with prefer_lane and where).
Tiny exampleplay_style: intelli_deck
decks:
1:
cards: ["knight","archers","minions","arrows","fireball","giant","musketeer","mini-p.e.k.k.a"]
counters:
hog_rider:
prefer_lane: same
where: back
cards: ["cannon","archers","knight"]
balloon:
prefer_lane: same
where: bridge
cards: ["musketeer","archers"]
What happens in match- Bot learns enemies as they appear (keeps up to 8 uniques).
- For a seen enemy, it picks the first counter you actually own (filtered to your deck).
- It obeys lane/depth hints (prefer_lane, where) and checks elixir.
- If a matching counter is in hand and affordable → plays immediately.
- If not, it falls back to your normal rules / play_policy.