TestWML
The tags and macros on this page are for use in unit tests, they're defined in data/test and enabled when #ifdef TEST is true.
The main [test] tag is documented on the ScenarioWML page.
The [test_do_attack_by_id] tag
The [test_do_attack_by_id] tag is a wrapper for [do_command][attack], taking unit ids instead of map coordinates. It has the following attributes:
- attacker the unit that initiates the attack
- defender the unit being attacked
- weapon (unset by default) if set, is used as the value for [do_command][attack]weapon=
- defender_weapon (unset by default) if set, is used as the value for [do_command][attack]defender_weapon=
- resupply_attacks_left (unset by default) if set to an integer higher than attacker.attacks_left, then attacker.attacks_left will be set to this value before calling [do_command][attack]
The reason for making this a test-only tag is that it can handle errors by failing the test, or by doing nothing and having the test fail later. Using unit IDs helps avoid hardcoding map coordinates in tests, and in tests the author is expected to know exactly which units should be involved. Even if this was a generic tag, it's likely that its only use outside tests would only be in events that already auto-store $unit, and either auto-store $second_unit or already include a hardcoded x,y= filter.
An alternative would be a generic tag taking SUFs for attacker and defender, but outside unit tests, there's a possibility of there being no unit matching the SUF, many units matching the SUF, or that the two units aren't adjacent to each other.