Read docs/work-queue.md and do the next unchecked batch. For each batch:
mtg-engine/src/abilities.rs, mtg-engine/src/game.rs) to understand current Effect/StaticEffect variantsgame.rs mod tests)cargo check -p mtg-cards && cargo test --libdocs/{fdn,tla,tdm,ecl}-remediation.md, update ROADMAP.mddocs/work-queue.md with today's dateIf a batch turns out to be wrong or more complex than described, update the queue with what you learned and move on to the next one.
Let me start by reading the work queue to find the next unchecked batch.
The next unchecked batch is Batch 8: Fight/Bite mechanic. Let me read the engine files and investigate the cards that need this.
Let me read game.rs in parts and search for the fight/bite cards.
Let me get more context on each of these cards to understand their exact effects.
Let me also check TLA for Earth Rumble and other fight cards mentioned in the work queue.
Let me look at how the engine handles execute_effects, especially how targets work.
Now I have a full picture. Let me check Earth Rumble's Java source and read the existing test patterns.
Let me check how Permanent::power() and apply_damage() work.
Good. Now I have everything I need. Let me implement the batch. I'll:
Effect::Fight and Effect::Bite variants + constructorsexecute_effectscargo check and cargo testLet me start with the engine changes.
Now add the constructors:
Now add the match arms in execute_effects in game.rs. I'll add them right before the _ => catch-all.
Now I need to add the helper methods find_fight_creature and find_fight_target. Let me add them near the other helper methods like matches_filter.
Now I'll add the fight helper methods right after card_matches_filter:
Now let me add the test. I'll add it right before the closing } of the tests module:
Now let me check that the engine compiles before fixing cards:
Engine compiles. Now let me fix the cards. Let me fix them all with sed:
Tests pass. Now let me fix the cards. Let me fix each one:
1. FDN: Bite Down — pure bite spell
2. FDN: Affectionate Indrik — ETB fight trigger
Wait, sed replacing TargetSpec::None), could hit many places. Let me check.
That sed replaced ALL TargetSpec::None), with TargetSpec::Creature), — that's a disaster. Let me undo that.
Let me be much more careful with the edits. I'll use specific context in sed or read/edit individual cards.
Now for Affectionate Indrik, I need to change both the Effect and the TargetSpec on surrounding lines. Let me use a more precise approach:
3. FDN: Felling Blow — +1/+1 counter + bite
4. ECL: Assert Perfection — boost + fight
5. TDM: Piercing Exhale — pure fight
That should have fixed both Piercing Exhale (pure fight) and Knockout Maneuver (counter + fight). Let me verify:
Lines 1231 (Knockout Maneuver) and 1255 (Piercing Exhale) are fixed. Dragonclaw Strike (1215) is still Custom (expected — it has "double P/T" which we can't implement).
Now let me check if there are any remaining fight customs to handle:
Good. The remaining ones are:
These are all correctly deferred. Let me compile and test:
All 252 tests pass. Now let me update the documentation. First, let me update the work queue:
Now update the per-set remediation docs. Let me check the current state of the remediation docs for the affected cards:
Now let me check for Affectionate Indrik and Felling Blow in fdn-remediation.md:
Now update ROADMAP.md:
Now update the "next batches" section in the roadmap:
Let me verify the fixes are all correct by re-checking the modified card lines:
All 6 cards fixed. Let me do a final full test run to confirm everything is green:
All tests pass. Let me verify the remediation doc fixes took effect:
All done. Here's a summary of Batch 8: Fight/Bite mechanic:
Engine changes:
Effect::Fight — two creatures deal damage equal to their power to each other (mutual)Effect::Bite — source creature deals damage equal to its power to target (one-way)Effect::fight() and Effect::bite() constructorsfind_fight_creature() helper — uses source creature if on battlefield, otherwise auto-selects controller's strongest creaturefind_fight_target() helper — uses first target on battlefield, otherwise auto-selects opponent's strongest creatureCards fixed (6):
Custom → Effect::bite()Custom → Effect::fight() + TargetSpec::CreatureCustom → add_p1p1_counters(1), Effect::bite()Custom(fight) → Effect::fight()Custom → Effect::fight()Custom → add_p1p1_counters(1), Effect::fight()Tests added: fight_and_bite_effects, fight_auto_selects_creatures
252 tests passing (was 245 → 163 engine + 18 cards + 52 AI + 19 tests = 252).
Does the description of the mechanic work the same way as the Java implementation? +#### Fight/Bite Mechanic (DONE)
60 +Effect::Fight (mutual damage) and Effect::Bite (one-way damage) auto-select the controller's strongest creature as fighter and use explicit targets or opponen
+t's strongest creature. Fixed 6 cards. Remaining fight/bite cards blocked by modal spells (Batch 11), X-cost (Batch 15), or complex compound effects.
Good question. Let me check the Java implementation to see if fight/bite actually works differently.
No, it doesn't. The Java implementation is meaningfully different:
Java (FightTargetsEffect):
Java (DamageWithPowerFromOneToAnotherTargetEffect — bite):
Our implementation:
TargetSpecThe core issue is our TargetSpec system only supports one target type per ability, so we can't model the two-target "your creature + their creature" pattern that fight/bite spells actually use. The auto-select-strongest heuristic is a workaround.
For ETB triggers (Affectionate Indrik), it's mostly correct — the source is the creature, and the target is the opponent's creature. But for spells, the player should be choosing which creature fights, not auto-picking strongest.
Let me update the ROADMAP to be honest about this limitation:
Also update the phase summary:
And update the work queue similarly:
The docs now accurately describe the gap. To summarize: the Java implementation uses proper two-target selection where the player chooses both creatures, while our engine auto-picks the strongest creature as a heuristic since TargetSpec doesn't support multi-target with different filters. The damage mechanics (mutual for fight, one-way for bite) are correct — it's the creature selection that's simplified.
Let
Let's fix the gap please
Let me understand how targets flow through the system so I can design the fix properly.
Now let me see how targets are resolved when a spell is cast — how the engine goes from TargetSpec to the targets: &[ObjectId] that gets passed to execute_effects.
Now let me see how targets get selected when a spell goes on the stack.