Test weapon-special plague vs taught plague

The expectation is that the a unit's own weapon special will take
priority over a teacher's ability.
This commit is contained in:
Steve Cotton 2023-06-28 16:27:59 +02:00 committed by Steve Cotton
parent aaf2735c1c
commit 1ecc30972e
2 changed files with 171 additions and 0 deletions

View file

@ -0,0 +1,170 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [specials][plague],[abilities][plague]affect_allies=yes
##
# Actions:
# This uses a "common keep" map, with Alice and Bob already adjacent to the other units.
# Give Bob a plague weapon special that creates Blood Bats.
# Make Charlie teach a plague ability that creates Chocobones.
# Make Dave teach a plague ability that creates Dragonguards.
# Create targets around Alice and Bob.
# Have Alice and Bob kill 1 target each.
# Remove Charlie and Dave.
# Have Alice and Bob kill 1 target each.
##
# Expected end state:
# Alice's attacks created 1 unit of a type taught by Charlie or Dave.
# Bob's own weapon special had priority over Charlie and Dave's teaching ability.
# Bob's attacks created 2 Blood Bats.
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST plague_without_priority (
[event]
name=start
[object]
[filter]
id=bob
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
{WEAPON_SPECIAL_PLAGUE_TYPE (Blood Bat)}
[/set_specials]
[/effect]
[/object]
[object]
[filter]
id=charlie
[/filter]
[effect]
apply_to=new_ability
[abilities]
{WEAPON_SPECIAL_PLAGUE_TYPE Chocobone}
[+plague]
affect_self=yes
affect_allies=yes
affect_enemies=yes
[affect_adjacent]
[/affect_adjacent]
[/plague]
[/abilities]
[/effect]
[/object]
[object]
[filter]
id=dave
[/filter]
[effect]
apply_to=new_ability
[abilities]
{WEAPON_SPECIAL_PLAGUE_TYPE (Dwarvish Dragonguard)}
[+plague]
[filter_student]
[/filter_student]
affect_self=yes
affect_allies=yes
affect_enemies=yes
[affect_adjacent]
[/affect_adjacent]
[/plague]
[/abilities]
[/effect]
[/object]
# Create some targets
[for]
start=1
end=2
[do]
[unit]
location_id=1
id=target_for_alice_$i
type=Test Melee Quintain
side=2
hitpoints=1
[/unit]
[unit]
location_id=2
id=target_for_bob_$i
type=Test Melee Quintain
side=1
hitpoints=1
[/unit]
[/do]
[/for]
# With Charlie and Dave teaching plague
# The test isn't checking priority between Charlie and Dave, just that one of the teaching abilities takes effect,
# however it needs 2 teachers to check that Bob's weapon special takes priority over both left and right.
[test_do_attack_by_id]
attacker=alice
defender=target_for_alice_1
weapon=0
[/test_do_attack_by_id]
[test_do_attack_by_id]
attacker=bob
defender=target_for_bob_1
weapon=0
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
type=Blood Bat
count=1
[/have_unit]
)}
{ASSERT (
[have_unit]
type=Chocobone,Dwarvish Dragonguard
count=1
[/have_unit]
)}
# With neither Charlie nor Dave
[store_unit]
[filter]
id=charlie
[/filter]
variable=stored_charlie
kill=yes
[/store_unit]
[store_unit]
[filter]
id=dave
[/filter]
variable=stored_dave
kill=yes
[/store_unit]
[test_do_attack_by_id]
attacker=alice
defender=target_for_alice_2
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
[test_do_attack_by_id]
attacker=bob
defender=target_for_bob_2
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
type=Blood Bat
count=2
[/have_unit]
)}
{ASSERT (
[have_unit]
type=Chocobone,Dwarvish Dragonguard
count=1
[/have_unit]
)}
{SUCCEED}
[/event]
)}

View file

@ -335,6 +335,7 @@
0 effect_increase_attacks
0 opponent_weapon_has_no_special
0 opponent_weapon_has_special
0 plague_without_priority
0 student_teacher_are_same
# Math operations in ability or specials tags
0 special_calculation_add