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.
Invalid [resistance] who don't have max_value attribute
Fix wesnoth#8092 issue. If [resistance] ability don't contain "max_value" attribute, it will be removed of the list because invalid
- Loading branch information
1 parent
a320377
commit 153fefe
Showing
3 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
142 changes: 142 additions & 0 deletions
142
data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance_value.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,142 @@ | ||
# wmllint: no translatables | ||
|
||
##### | ||
# API(s) being tested: [resistance]abilitie witout max_value specified | ||
## | ||
# Actions: | ||
# Give both Alice and Bob 100% chance to hit. | ||
# Give Bob and Alice [resistance] multiply=2 without max_value attribute and give damage=12 | ||
# Move Alice next to Bob, and have Alice attack Bob. | ||
## | ||
# Expected end state: | ||
# Alice and Bob fight with damage 12 because [resistance] can't work without max_value. | ||
##### | ||
|
||
{GENERIC_UNIT_TEST "resistance_without_value_test" ( | ||
[event] | ||
name=start | ||
[modify_unit] | ||
[filter] | ||
[/filter] | ||
max_hitpoints=100 | ||
hitpoints=100 | ||
attacks_left=1 | ||
[/modify_unit] | ||
[object] | ||
silent=yes | ||
[effect] | ||
apply_to = new_ability | ||
[abilities] | ||
[resistance] | ||
id=steadfast1 | ||
multiply=2 | ||
affect_self=yes | ||
[/resistance] | ||
[/abilities] | ||
[/effect] | ||
[effect] | ||
apply_to=attack | ||
[set_specials] | ||
mode=append | ||
[attacks] | ||
value=1 | ||
[/attacks] | ||
[damage] | ||
value=12 | ||
[/damage] | ||
[chance_to_hit] | ||
value=100 | ||
[/chance_to_hit] | ||
[/set_specials] | ||
[/effect] | ||
[filter] | ||
id=bob | ||
[/filter] | ||
[/object] | ||
[object] | ||
silent=yes | ||
[effect] | ||
apply_to = new_ability | ||
[abilities] | ||
[resistance] | ||
id=steadfast1 | ||
multiply=2 | ||
affect_self=yes | ||
[/resistance] | ||
[/abilities] | ||
[/effect] | ||
[effect] | ||
apply_to=attack | ||
[set_specials] | ||
mode=append | ||
[attacks] | ||
value=1 | ||
[/attacks] | ||
[damage] | ||
value=12 | ||
[/damage] | ||
[chance_to_hit] | ||
value=100 | ||
[/chance_to_hit] | ||
[/set_specials] | ||
[/effect] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[/object] | ||
|
||
[store_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
variable=a | ||
kill=yes | ||
[/store_unit] | ||
[store_unit] | ||
[filter] | ||
id=bob | ||
[/filter] | ||
variable=b | ||
[/store_unit] | ||
[unstore_unit] | ||
variable=a | ||
find_vacant=yes | ||
x,y=$b.x,$b.y | ||
[/unstore_unit] | ||
[store_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
variable=a | ||
[/store_unit] | ||
|
||
[do_command] | ||
[attack] | ||
weapon=0 | ||
defender_weapon=0 | ||
[source] | ||
x,y=$a.x,$a.y | ||
[/source] | ||
[destination] | ||
x,y=$b.x,$b.y | ||
[/destination] | ||
[/attack] | ||
[/do_command] | ||
[store_unit] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
variable=a | ||
[/store_unit] | ||
[store_unit] | ||
[filter] | ||
id=bob | ||
[/filter] | ||
variable=b | ||
[/store_unit] | ||
#damage are 12, if test fail hitpoints !=88 | ||
{ASSERT ({VARIABLE_CONDITIONAL a.hitpoints equals 88})} | ||
{ASSERT ({VARIABLE_CONDITIONAL b.hitpoints equals 88})} | ||
{SUCCEED} | ||
[/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