diff --git a/data/schema/units/abilities.cfg b/data/schema/units/abilities.cfg index c8d24ba4353..cffdb78dd42 100644 --- a/data/schema/units/abilities.cfg +++ b/data/schema/units/abilities.cfg @@ -88,6 +88,8 @@ max=infinite super="units/unit_type/abilities/~generic~" {SIMPLE_KEY value f_int} + {SIMPLE_KEY add f_int} + {SIMPLE_KEY sub f_int} {FILTER_TAG "filter_weapon" weapon ()} {FILTER_TAG "filter_second_weapon" weapon ()} [/tag] diff --git a/data/test/scenarios/test_add_or_sub_in_leadership.cfg b/data/test/scenarios/test_add_or_sub_in_leadership.cfg new file mode 100644 index 00000000000..770cfd4b6b0 --- /dev/null +++ b/data/test/scenarios/test_add_or_sub_in_leadership.cfg @@ -0,0 +1,153 @@ +# This unit test is used for verify the work of abilities used like weapons, but also of special_id_active attribute. +# Here, the teacher and student are the same unit + +{GENERIC_UNIT_TEST "test_add_or_sub_in_leadership_abilities" ( +#define FILTER_BOB +[filter_student] + [filter_weapon] + type=blade + [/filter_weapon] +[/filter_student] +[filter_opponent] + race=elf + [filter_weapon] + special_id_active=test_cth #for testing if special_id_active work with abilities used like weapons + [/filter_weapon] +[/filter_opponent] +#enddef +#define FILTER_ALICE +[filter_student] + [filter_weapon] + type=blade,pierce + [/filter_weapon] +[/filter_student] +[filter_opponent] + race=orc +[/filter_opponent] +#enddef + [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] + [leadership] + id=leadership_neg + sub=50 + cumulative=no + affect_self=yes + [/leadership] + [attacks] + value=1 + {FILTER_BOB} + [/attacks] + [damage] + value=60 + {FILTER_BOB} + [/damage] + [chance_to_hit] + value=100 + {FILTER_BOB} + [/chance_to_hit] + [/abilities] + [/effect] + [filter] + id=bob + [/filter] + [/object] + [object] + silent=yes + [effect] + apply_to=new_ability + [abilities] + [leadership] + id=leadership_pos + add=25 + cumulative=no + affect_self=yes + [/leadership] + [attacks] + value=1 + {FILTER_ALICE} + [/attacks] + [damage] + value=60 + {FILTER_ALICE} + [/damage] + [chance_to_hit] + id=test_cth + value=100 + {FILTER_ALICE} + [/chance_to_hit] + [/abilities] + [/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] + {ASSERT ({VARIABLE_CONDITIONAL a.hitpoints equals 70})} + {ASSERT ({VARIABLE_CONDITIONAL b.hitpoints equals 25})} + {SUCCEED} + [/event] +)} + +#undef FILTER_BOB +#undef FILTER_ALICE diff --git a/wml_test_schedule b/wml_test_schedule index b81e9968ef8..c745cd140b0 100644 --- a/wml_test_schedule +++ b/wml_test_schedule @@ -265,6 +265,7 @@ 0 swarm_disables_upgrades_with_abilities_adjacent_fail 0 swarm_disables_upgrades_with_abilities_adjacent_leadership 0 swarm_disables_upgrades_with_abilities_adjacent_leadership_fail +0 test_add_or_sub_in_leadership_abilities 0 unslowable_status_test 0 unpetrifiable_status_test 0 test_force_chance_to_hit_macro