Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add [has_ally],[has_enemy] tags for standard side filter
Unlike [allied_with] and [enemy_of], these will match if only if there is *any* ally or enemy matching the filter. The other versions of the tag match only if all sides matching the filter are allied / opposed. This commit also adds a unit test that checks that it works as expected.
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# This test checks that the [has_ally] tag is working as expected. | ||
|
||
#define TEST_HAS_ALLY_SCEN ID EVENTS | ||
[test] | ||
name = "Unit Test {ID}" | ||
map_data = "{test/maps/move_skip_sighted.map}" | ||
turns = 3 | ||
id = {ID} | ||
random_start_time = no | ||
|
||
{DAWN} | ||
|
||
[side] | ||
side=1 | ||
controller=human | ||
name = "Alice" | ||
type = Elvish Archer | ||
id=alice | ||
fog=no | ||
team_name=West | ||
[/side] | ||
[side] | ||
side=2 | ||
controller=human | ||
name = "Bob" | ||
type = Orcish Grunt | ||
id=bob | ||
fog=no | ||
team_name=East | ||
[/side] | ||
[side] | ||
side=3 | ||
controller=human | ||
name = "Dave" | ||
type = Dwarvish Fighter | ||
id=dave | ||
fog=no | ||
team_name=East | ||
[/side] | ||
[side] | ||
side=4 | ||
controller=human | ||
name= "Charlie" | ||
type = Chocobone | ||
id=charlie | ||
fog=no | ||
team_name=West | ||
[/side] | ||
|
||
{EVENTS} | ||
[/test] | ||
#enddef | ||
|
||
{TEST_HAS_ALLY_SCEN "has_ally" ( | ||
[event] | ||
name=start | ||
{ASSERT ([have_unit] | ||
id=dave | ||
[filter_side] | ||
[has_ally] | ||
[has_unit] | ||
id=bob | ||
[/has_unit] | ||
[/has_ally] | ||
[/filter_side] | ||
[/have_unit] | ||
)} | ||
{ASSERT ([have_unit] | ||
id=dave | ||
[filter_side] | ||
[has_enemy] | ||
[has_unit] | ||
id=alice | ||
[/has_unit] | ||
[/has_enemy] | ||
[/filter_side] | ||
[/have_unit] | ||
)} | ||
{ASSERT ([have_unit] | ||
id=dave | ||
[filter_side] | ||
[not] | ||
[has_ally] | ||
[has_unit] | ||
id=steve | ||
[/has_unit] | ||
[/has_ally] | ||
[/not] | ||
[/filter_side] | ||
[/have_unit] | ||
)} | ||
{ASSERT ([have_unit] | ||
id=dave | ||
[filter_side] | ||
[has_enemy] | ||
side=1,4 | ||
[/has_enemy] | ||
[/filter_side] | ||
[/have_unit] | ||
)} | ||
{ASSERT ([not] | ||
[have_unit] | ||
id=dave | ||
[filter_side] | ||
[has_ally] | ||
[has_unit] | ||
id=charlie | ||
[/has_unit] | ||
[/has_ally] | ||
[/filter_side] | ||
[/have_unit] | ||
[/not] | ||
)} | ||
{RETURN ([true][/true])} | ||
[/event] | ||
)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters