forked from wesnoth/wesnoth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
815739f
commit 92783a6
Showing
7 changed files
with
714 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
101 changes: 101 additions & 0 deletions
101
data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/firststrike/firststrike_ability.cfg
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,101 @@ | ||
#textdomain wesnoth-test | ||
|
||
##### | ||
# API(s) being tested: [firststrike] | ||
## | ||
# Actions: | ||
# Give bob a firststrike ability | ||
## | ||
# Expected end state: | ||
# At time of checking, only side 1 has been struck but side 2 has not been struck | ||
##### | ||
{COMMON_KEEP_A_B_UNIT_TEST "firststrike_ability" ( | ||
[event] | ||
name = start | ||
|
||
{VARIABLE is_event 0} | ||
|
||
[modify_unit] | ||
[filter] | ||
id = bob | ||
[/filter] | ||
[effect] | ||
apply_to = new_ability | ||
[abilities] | ||
{TEST_ABILITY_NO_VALUE firststrike () SELF=yes} | ||
[/abilities] | ||
[/effect] | ||
[/modify_unit] | ||
|
||
[modify_unit] | ||
[filter] | ||
id=alice,bob | ||
[/filter] | ||
[effect] | ||
apply_to=attack | ||
[set_specials] | ||
mode=append | ||
[attacks] | ||
value=1 | ||
[/attacks] | ||
[damage] | ||
value=1 | ||
[/damage] | ||
[chance_to_hit] | ||
value=100 | ||
[/chance_to_hit] | ||
[/set_specials] | ||
[/effect] | ||
[/modify_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=alice | ||
defender=bob | ||
weapon=0 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
[heal_unit] | ||
[filter] | ||
[/filter] | ||
amount = "full" | ||
[/heal_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=alice | ||
defender=bob | ||
weapon=1 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL is_event numerical_equals 1}} | ||
|
||
{SUCCEED} | ||
[/event] | ||
|
||
[event] | ||
name = defender hits | ||
first_time_only = no | ||
|
||
{VARIABLE is_event 1} | ||
|
||
[store_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
variable=alice | ||
[/store_unit] | ||
[store_unit] | ||
[filter] | ||
id=bob | ||
[/filter] | ||
variable=bob | ||
[/store_unit] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL alice.hitpoints numerical_equals "$($alice.max_hitpoints-1)"}} | ||
{ASSERT {VARIABLE_CONDITIONAL bob.hitpoints numerical_equals $bob.max_hitpoints}} | ||
|
||
{CLEAR_VARIABLE alice} | ||
{CLEAR_VARIABLE bob} | ||
[/event] | ||
) SIDE2_LEADER="Elvish Archer"} |
167 changes: 167 additions & 0 deletions
167
.../test/scenarios/wml_tests/UnitsWML/AbilitiesWML/firststrike/firststrike_affect_allies.cfg
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,167 @@ | ||
# wmllint: no translatables | ||
|
||
##### | ||
# API(s) being tested: [attacks]affect_allies= | ||
## | ||
# Actions: | ||
# Give the side 1 leader a firststrike ability that only affects adjacent allies | ||
# Have the side 2 leader attack the side 3 leader with both its weapons | ||
# Have the side 1 leader attack the side 4 leader with both its weapons | ||
## | ||
# Expected end state: | ||
# At time of checking, both side 1 and side 4 have been struck | ||
# At time of checking, only side 3 has been struck but side 2 has not been struck | ||
##### | ||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "firststrike_affect_allies" ( | ||
[event] | ||
name = start | ||
|
||
{VARIABLE no_firststrike 0} | ||
{VARIABLE is_firststrike 0} | ||
|
||
[modify_side] | ||
side=1,2 | ||
team_name=allies | ||
[/modify_side] | ||
|
||
[modify_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[effect] | ||
apply_to = new_ability | ||
[abilities] | ||
{TEST_ABILITY_NO_VALUE firststrike ([affect_adjacent][/affect_adjacent]) ALLIES=yes} | ||
[/abilities] | ||
[/effect] | ||
[/modify_unit] | ||
|
||
[modify_unit] | ||
[filter] | ||
id=alice,bob,charlie,dave | ||
[/filter] | ||
[effect] | ||
apply_to=attack | ||
[set_specials] | ||
mode=append | ||
[attacks] | ||
value=1 | ||
[/attacks] | ||
[damage] | ||
value=1 | ||
[/damage] | ||
[chance_to_hit] | ||
value=100 | ||
[/chance_to_hit] | ||
[/set_specials] | ||
[/effect] | ||
[/modify_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=alice | ||
defender=dave | ||
weapon=0 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
[heal_unit] | ||
[filter] | ||
[/filter] | ||
amount = "full" | ||
[/heal_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=alice | ||
defender=dave | ||
weapon=1 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
[test_do_attack_by_id] | ||
attacker=charlie | ||
defender=bob | ||
weapon=0 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
[heal_unit] | ||
[filter] | ||
[/filter] | ||
amount = "full" | ||
[/heal_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=charlie | ||
defender=bob | ||
weapon=1 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL no_firststrike numerical_equals 1}} | ||
{ASSERT {VARIABLE_CONDITIONAL is_firststrike numerical_equals 1}} | ||
|
||
{SUCCEED} | ||
[/event] | ||
|
||
# defender dave does not have firststrike, therefore alice and dave have now both been struck | ||
[event] | ||
name = defender hits | ||
first_time_only = no | ||
|
||
[filter_second] | ||
id=dave | ||
[/filter_second] | ||
|
||
{VARIABLE no_firststrike 1} | ||
|
||
[store_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
variable=alice | ||
[/store_unit] | ||
[store_unit] | ||
[filter] | ||
id=dave | ||
[/filter] | ||
variable=dave | ||
[/store_unit] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL dave.hitpoints numerical_equals "$($dave.max_hitpoints-1)"}} | ||
{ASSERT {VARIABLE_CONDITIONAL alice.hitpoints numerical_equals "$($alice.max_hitpoints-1)"}} | ||
|
||
{CLEAR_VARIABLE alice} | ||
{CLEAR_VARIABLE dave} | ||
[/event] | ||
|
||
# defender bob does have firststrike, therefore charlie has already been struck and bob has not yet been struck | ||
[event] | ||
name = defender hits | ||
first_time_only = no | ||
|
||
[filter_second] | ||
id=bob | ||
[/filter_second] | ||
|
||
{VARIABLE is_firststrike 1} | ||
|
||
[store_unit] | ||
[filter] | ||
id=bob | ||
[/filter] | ||
variable=bob | ||
[/store_unit] | ||
[store_unit] | ||
[filter] | ||
id=charlie | ||
[/filter] | ||
variable=charlie | ||
[/store_unit] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL bob.hitpoints numerical_equals $bob.max_hitpoints}} | ||
{ASSERT {VARIABLE_CONDITIONAL charlie.hitpoints numerical_equals "$($charlie.max_hitpoints-1)"}} | ||
|
||
{CLEAR_VARIABLE bob} | ||
{CLEAR_VARIABLE charlie} | ||
[/event] | ||
) SIDE_LEADER="Elvish Archer"} |
102 changes: 102 additions & 0 deletions
102
...test/scenarios/wml_tests/UnitsWML/AbilitiesWML/firststrike/firststrike_affect_enemies.cfg
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,102 @@ | ||
# wmllint: no translatables | ||
|
||
##### | ||
# API(s) being tested: [attacks]affect_enemies= | ||
## | ||
# Actions: | ||
# Give the side 1 leader a firststrike ability that only affects adjacent enemies | ||
# Have the side 1 leader attack the side 2 leader with both its weapons | ||
## | ||
# Expected end state: | ||
# At time of checking, only side 1 has been struck but side 2 has not been struck | ||
##### | ||
{COMMON_KEEP_A_B_UNIT_TEST "firststrike_affect_enemies" ( | ||
[event] | ||
name = start | ||
|
||
{VARIABLE is_event 0} | ||
|
||
[modify_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[effect] | ||
apply_to = new_ability | ||
[abilities] | ||
{TEST_ABILITY_NO_VALUE firststrike ([affect_adjacent][/affect_adjacent]) ENEMIES=yes} | ||
[/abilities] | ||
[/effect] | ||
[/modify_unit] | ||
|
||
[modify_unit] | ||
[filter] | ||
id=alice,bob | ||
[/filter] | ||
[effect] | ||
apply_to=attack | ||
[set_specials] | ||
mode=append | ||
[attacks] | ||
value=1 | ||
[/attacks] | ||
[damage] | ||
value=1 | ||
[/damage] | ||
[chance_to_hit] | ||
value=100 | ||
[/chance_to_hit] | ||
[/set_specials] | ||
[/effect] | ||
[/modify_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=alice | ||
defender=bob | ||
weapon=0 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
[heal_unit] | ||
[filter] | ||
[/filter] | ||
amount = "full" | ||
[/heal_unit] | ||
|
||
[test_do_attack_by_id] | ||
attacker=alice | ||
defender=bob | ||
weapon=1 | ||
resupply_attacks_left=1 | ||
[/test_do_attack_by_id] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL is_event numerical_equals 1}} | ||
|
||
{SUCCEED} | ||
[/event] | ||
|
||
[event] | ||
name = defender hits | ||
first_time_only = no | ||
|
||
{VARIABLE is_event 1} | ||
|
||
[store_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
variable=alice | ||
[/store_unit] | ||
[store_unit] | ||
[filter] | ||
id=bob | ||
[/filter] | ||
variable=bob | ||
[/store_unit] | ||
|
||
{ASSERT {VARIABLE_CONDITIONAL alice.hitpoints numerical_equals "$($alice.max_hitpoints-1)"}} | ||
{ASSERT {VARIABLE_CONDITIONAL bob.hitpoints numerical_equals $bob.max_hitpoints}} | ||
|
||
{CLEAR_VARIABLE alice} | ||
{CLEAR_VARIABLE bob} | ||
[/event] | ||
) SIDE2_LEADER="Elvish Archer"} |
Oops, something went wrong.