New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generalize backstab weapon special #488
Conversation
Also accessible in: - Weapon specials ([filter_self], [filter_opponent], [filter_attacker], [filter_defender]) - Abilities ([affect_adjacent][filter]) The backstab weapon special is now implemented using this. (In a weapon special filter, units are guaranteed to be facing each other.)
Note: It's no longer supported to use the macro in a unit with a non-matching level, for example giving a 2nd-level unit 4th-level leadership.
In response to zookeeper's critique of this PR, I've created a completely new generalization of the backstab ability. I believe it is much less likely to be confusing to add-on developers. Basically, some unit filters now match on two units rather than just one - this is done in any Here's a sample weapon special that uses this new variable as well as the rotate operators for directions:
It's similar to backstab, but requires two additional units positioned behind and to the side of the opponent (a position which traps the enemy via ZoC). There's still one minor problem with this in my opinion - the syntax |
…_location] - Now supports count= - Now supports is_enemy= in [filter_adjacent]
Merged manually. |
This pull request generalizes the backstab weapon special by extending the
[filter_adjacent]
tag, as well as a few other related changes (see commit list for details). The core backstab special has been rewritten in the new syntax.The implementation uses a combination of two new features:
relative_to=
key in the adjacency filters which specifies the unit to whom a unit or location must be adjacent to match. It defaults to "self", which is the original behaviour of[filter_location]
and[filter_adjacent_location]
. For backstab, it's set to "opponent", which means the matched unit or location must be adjacent to the opponent rather than the unit with the special weapon. Other possible values are "attacker" and "defender".adjacent=
key. These directions use the primary unit (by default, the unit with the special weapon) as a centre point and the secondary unit as a boundary point and find a location relative to both units. Currently, the five directions are cw (clockwise from the secondary unit), ccw (counter-clockwise from the secondary unit), opp (opposite, ie the primary unit lies directly between the secondary unit and the matched unit), -cw (clockwise from the opposite point), -ccw (counter-clockwise from the opposite point). I'm not entirely keen on these names, and if anyone has a better idea, I would welcome it.This commit also makes
[filter_adjacent]
and[filter_adjacent_location]
work more like their counterparts in standard unit and location filters, respectively - supporting thecount=
key and, in the case of[filter_adjacent]
, theis_enemy=
key (the latter being crucial for the new implementation of backstab). This change is applied to unit abilities as well as weapon specials.The only thing left to do on this branch is show deprecated messages for the use of the
backstab=
key and possibly change the names of the relative directions.