Now I have a good understanding of the engine. Let me design the Fight and Bite effects.
Fight: Two creatures deal damage to each other equal to their respective powers.
- In the engine context: the source creature (from
source parameter) fights the target creature (from targets).
- For spell-based fight cards like "target creature you control fights target creature you don't control", our simplified engine will:
- Use the
source parameter for the "your creature" side (falls back to any controller's creature)
- Use
targets for the opponent's creature
- Actually, this won't work because
source is the spell itself, not a creature.
I need to reconsider how this maps to the engine. When a spell resolves, source is the spell's card ID, not a creature, and fight spells require two creature targets but our TargetSpec only supports selecting one. For the simplified approach, I'll treat the first creature (either from source or the first entry in targets) as one combatant and the remaining target as the other. For ETB triggers, source is the creature itself, so it fights the target. For spells, we need a different approach.
Looking at how the cards are currently set up:
- ETB fight (Affectionate Indrik): trigger with
TargetSpec::None currently, but should be TargetSpec::Creature (opponent's creature). The source permanent is the creature that fights.
- Spell fight (Piercing Exhale, Knockout Maneuver):
TargetSpec::Creature currently targets one creature, but they need two targets.
For a simplified engine approach:
- For ETB/triggered fight: Source is the creature. Target is opponent's creature. We deal source_power damage to target and target_power damage to source.
- For spell fight: We pick the first creature controlled by the spell controller, and it fights the target
Since we don't have proper two-target support yet, I can work around this by checking the targets list — if the first target is controlled by the spell's controller, that's the creature doing the fighting, otherwise I'll look for the first available creature they control to use instead. for the controller's strongest creature
Hmm, this is getting complicated. Let me just use a simple approach:
For Fight:
- If
source is on the battlefield (it's a creature), source fights target[0]
- If
source is NOT on the battlefield (it's a spell), pick the strongest creature the controller has and fight target[0]
For Bite:
- Same logic but one-way: source creature (or controller's strongest) deals its power as damage to target
Looking at the specific cards, I see the pattern now. Most of these are spells that target one of your creatures and one of your opponent's creatures. The spell gives your creature a boost, then they fight. For the implementation, I need to identify which target belongs to the spell controller and which doesn't, apply any buffs first, then resolve the fight or damage effect. I need to figure out the targeting logic by looking at how existing fight cards are set up. Let me check Piercing Exhale and Knockout Maneuver to see if they're using a single target or multiple targets, since that'll determine whether I need to infer the fighting creature or if it's already specified. I'm settling on a consistent approach for how Fight and Bite effects resolve: the source creature fights if it's on the battlefield, otherwise we pick the controller's strongest creature, and that creature battles the targeted opponent's creature. For the card implementations, I need to adjust the targeting and effect logic to match this framework. I'm realizing the counter placement is the tricky part here. The AddCounters effect has a source fallback, but for a spell that's the card itself, not a creature on the battlefield. For these compound spell-fight cards, I think the cleanest solution is to have the Fight effect handle putting the counter on your creature as part of its logic, rather than trying to manage two separate targets. I'm realizing the core issue: AddCounters targets either targets[0] or the spell source, but for compound fight cards like Knockout Maneuver, I need the counter to apply to the creature doing the fighting, not the target. The simplest fix is to drop the counter modeling entirely for these cards and just use the Fight effect, accepting it as a limitation of our simplified engine.
Let me categorize what I'm dealing with: pure fight spells like Piercing Exhale, fight triggers on creatures, compound cards that buff before fighting (Knockout Maneuver, Assert Perfection), and pure damage effects like Bite Down. For Assert Perfection specifically, the boost is already modeled as a temporary effect on the target creature, so I need to figure out how to chain that with the fight.
The issue is that Assert Perfection targets your own creature to buff it, then fights with that creature against an opponent's creature, while Piercing Exhale targets an opponent's creature to fight it. This inconsistency in what "target" means between different cards suggests I need a more flexible approach in the engine—either distinguishing between source and target creatures in fight effects, or handling spell-based fights differently from ETB-triggered fights. me look at this from a targeting perspective. I can introduce a new TargetSpec for two creatures:
TargetSpec::Multiple { spec: Box<TargetSpec::Creature>, count: 2 }
But that doesn't distinguish between "your creature" and "opponent's creature".
OK, ultimate pragmatic approach:
Effect::Fight: The source creature (from source or auto-selected from controller's creatures) fights the first target creature. If source is on the battlefield and is a creature, use it. Otherwise, pick controller's strongest creature. The target in targets[0] is the opponent's creature that gets fought.
Effect::Bite: Same logic but one-way damage.
For compound cards, I'll keep things simple: Knockout Maneuver uses Effect::Fight with TargetSpec::Creature for the opponent's creature, dropping the +1/+1 counter. Assert Perfection needs the boost applied to my creature before the fight happens, but that requires proper two-target support which is a bigger engine change. For now, I'm going to implement Effect::Fight and Effect::Bite variants, handle ETB triggers where the source is the creature and target is the opponent's creature, and support pure fight spells that auto-select my strongest creature against the opponent's target. I'm realizing these compound spells were already simplified in the implementation, so I shouldn't overcomplicate this. For the Fight effect, I'll have it find the controller's strongest creature as the fighter, then target the opponent's creature from the targets list, and if neither exists I'll fall back to a sensible default.
For Bite, it's the same targeting logic but only deals one-way damage. Then I can fix the three cards by assigning them the right effect combinations—Piercing Exhale gets Fight directly, while Knockout Maneuver and Assert Perfection each get their boost or counter effect followed by Fight, all using creature targeting.
Wait, I need to reconsider Knockout Maneuver—the counter and the fight target are actually the same creature, the one you control, so the implementation should reflect that the counter applies to the creature doing the fighting.
The issue is that Fight needs both creatures but our simplified system only tracks one target. I think the cleanest solution is to have Fight auto-select both combatants using a heuristic: your strongest creature as the attacker and the opponent's strongest creature as the defender, completely bypassing the targets array. This keeps the logic simple and handles all the edge cases consistently.
But wait—for something like Bite Down, the player actually chooses which of their creatures does the biting, so auto-selecting the strongest one breaks that player agency. I need to reconsider this approach.
Let me think through the implementation more carefully. If a card has a target spec for the creature doing the fighting or biting, I should use that target when it's available. For effects without explicit targets, defaulting to the strongest creature is reasonable for a simplified engine. So I'll check whether targets exist first, and only fall back to auto-selection when needed.
Now I'm looking at which cards to update in this pass. I'll handle Bite Down and Affectionate Indrik with the new effects, but I'm skipping the Dragon damage card since it has custom targeting logic that doesn't fit the pattern. Looking at what still needs to be implemented, I see several cards requiring X-cost mechanics and modal abilities that haven't been tackled yet, plus I need to investigate what Earth Rumble actually does since it's currently just a stub.