Skip to content

Commit

Permalink
Extend special_id_active and special_type_active to account for abili…
Browse files Browse the repository at this point in the history
…ties used as specials
  • Loading branch information
newfrenchy83 committed Feb 19, 2021
1 parent f671d2a commit 05b2ea2
Show file tree
Hide file tree
Showing 19 changed files with 1,356 additions and 32 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Expand Up @@ -26,6 +26,8 @@
* Added information about the build's (not runtime) target CPU architecture to the game version info dialog and --report.
* Added terminal-style command history browsing with up-down keys for in-game consoles used by debug mode, ai and search floating textboxes.
### WML Engine
* Extent 'special_id_active' and 'special_type_active' to abilities used like weapon and to [leadership] abilities.
* abilities used like weapon can call [leading_anim] now.
### Miscellaneous and Bug Fixes
* Fixed display zoom not being taken into account when using the `x`, `y`, `directional_x` and `directional_y` attributes in unit animations.

Expand Down
Expand Up @@ -7,6 +7,7 @@
num_traits=0
image="units/human-battleprincess-resting.png"
{LEADING_ANIM "units/human-battleprincess-leading-1.png" "units/human-battleprincess-leading-2.png" 22,-22}
{INITIATIVE_ANIM "units/human-battleprincess-leading-1.png" "units/human-battleprincess-leading-2.png"}
hitpoints=62
movement_type=smallfoot
[resistance]
Expand Down
1 change: 1 addition & 0 deletions data/campaigns/Heir_To_The_Throne/units/Princess.cfg
Expand Up @@ -8,6 +8,7 @@
image="units/human-princess.png"
{DEFENSE_ANIM "units/human-princess-defend-2.png" "units/human-princess-defend-1.png" {SOUND_LIST:HUMAN_FEMALE_HIT} }
{LEADING_ANIM "units/human-princess-leading-2.png" "units/human-princess-leading-1.png" 22,-22}
{INITIATIVE_ANIM "units/human-princess-leading-2.png" "units/human-princess-leading-1.png"}
hitpoints=48
movement_type=smallfoot
[resistance]
Expand Down
31 changes: 31 additions & 0 deletions data/campaigns/Heir_To_The_Throne/utils/abilities.cfg
Expand Up @@ -15,10 +15,41 @@
[affect_adjacent]
[/affect_adjacent]
[/firststrike]
[firststrike]
id=initiative_anim
affect_self=no
affect_allies=yes
active_on=defense
[filter_student]
[filter_weapon]
special_id_active=initiative
[/filter_weapon]
[/filter_student]
[affect_adjacent]
[/affect_adjacent]
[/firststrike]
#enddef

#define NOTE_INITIATIVE
[special_note]
note=_"This unit’s grasp of melee tactics allows adjacent allies to strike the first blow even when defending."
[/special_note]
#enddef

#define INITIATIVE_ANIM FULL_IMAGE HALFWAYS_IMAGE
[leading_anim]
[filter_attack]
special_id_active=initiative_anim
[not]
special_type_active=leadership
[/not]
[not]
special_id_active=firststrike
[/not]
[/filter_attack]
start_time=-126
[frame]
image={HALFWAYS_IMAGE}:1,{FULL_IMAGE}:250,{HALFWAYS_IMAGE}:1
[/frame]
[/leading_anim]
#enddef
43 changes: 33 additions & 10 deletions data/core/macros/animation-utils.cfg
Expand Up @@ -25,20 +25,43 @@
# Define an animation of a unit waving/raising their weapon,
# with a gleam of light reflecting off it at the point specified by
# OFFSET_POSITION
[leading_anim]
start_time=-126
[frame]
image={HALFWAYS_IMAGE}:1,{FULL_IMAGE}:250,{HALFWAYS_IMAGE}:1
[/frame]
{LEADING_ANIM_FILTER {FULL_IMAGE} {HALFWAYS_IMAGE} {OFFSET_POSITION} special_type_active=leadership}
#enddef

halo_start_time=-100
[halo_frame]
halo="halo/misc/leadership-flare-[1~13].png:20"
halo_x,halo_y={OFFSET_POSITION}
[/halo_frame]
#define LEADING_ANIM_FILTER FULL_IMAGE HALFWAYS_IMAGE OFFSET_POSITION ATTACK
# Define an animation of a unit waving/raising their weapon,
# with a gleam of light reflecting off it at the point specified by
# OFFSET_POSITION
[leading_anim]
[filter_attack]
{ATTACK}
[/filter_attack]
{LEADING_BASE {FULL_IMAGE} {HALFWAYS_IMAGE} {OFFSET_POSITION}}
[/leading_anim]
#enddef

#define HELPING_ANIM FULL_IMAGE HALFWAYS_IMAGE OFFSET_POSITION
# Define an animation of a unit waving/raising their weapon,
# with a gleam of light reflecting off it at the point specified by
# OFFSET_POSITION
[resistance_anim]
{LEADING_BASE {FULL_IMAGE} {HALFWAYS_IMAGE} {OFFSET_POSITION}}
[/resistance_anim]
#enddef

#define LEADING_BASE FULL_IMAGE HALFWAYS_IMAGE OFFSET_POSITION
start_time=-126
[frame]
image={HALFWAYS_IMAGE}:1,{FULL_IMAGE}:250,{HALFWAYS_IMAGE}:1
[/frame]

halo_start_time=-100
[halo_frame]
halo="halo/misc/leadership-flare-[1~13].png:20"
halo_x,halo_y={OFFSET_POSITION}
[/halo_frame]
#enddef

#define DEFENSE_ANIM REACTION_IMAGE BASE_IMAGE HIT_SOUND
# Define a defensive animation moving from a specified BASE_IMAGE
# to REACTION_IMAGE, with HIT_SOUND playing only if a hit occurs.
Expand Down
Expand Up @@ -14,6 +14,9 @@
[/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
Expand Down Expand Up @@ -81,6 +84,7 @@
{FILTER_ALICE}
[/damage]
[chance_to_hit]
id=test_cth
value=100
{FILTER_ALICE}
[/chance_to_hit]
Expand Down Expand Up @@ -155,3 +159,6 @@
{SUCCEED}
[/event]
)}

#undef FILTER_BOB
#undef FILTER_ALICE
@@ -0,0 +1,183 @@
# This unit test defines a WML object based implementation of the "unupgradable" ability
# https://github.com/ProditorMagnus/Ageless-for-1-14/blob/52c1eaf31722bb58046a1b459d4f29daa8d88487/data/general_data/weapon_specials/unupgradable.cfg
# and checks that it works. What is being tested here is that
# [swarm] with swarm_attacks_max=swarm_attacks_min prevents strike changes
# - through [attacks]
# - through [effect] increase_attacks

{GENERIC_UNIT_TEST "swarm_disables_upgrades_with_abilities_adjacent" (
#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]
affect_self=no
affect_allies=yes
[affect_adjacent]
[/affect_adjacent]
#enddef
#define FILTER_ALICE
[filter_student]
[filter_weapon]
type=blade,pierce
[/filter_weapon]
[/filter_student]
[filter_opponent]
race=orc
[/filter_opponent]
affect_self=no
affect_allies=yes
[affect_adjacent]
[/affect_adjacent]
#enddef
[event]
name=start
[unit]
id=alex
name=_"Alex"
x,y=12,4
type=Elvish Hero
side=1
[/unit]
[unit]
id=ben
name=_"Ben"
x,y=14,3
type=Orcish Warrior
side=2
[/unit]
[modify_unit]
[filter]
[/filter]
max_hitpoints=100
hitpoints=100
attacks_left=1
[/modify_unit]
[object]
silent=yes
[effect]
apply_to=new_ability
[abilities]
[swarm]
swarm_attacks_max=1
swarm_attacks_min=1
{FILTER_BOB}
[/swarm]
[attacks]
value=10
{FILTER_BOB}
[/attacks]
[attacks]
add=13
{FILTER_BOB}
[/attacks]
[damage]
value=1
{FILTER_BOB}
[/damage]
[chance_to_hit]
value=100
{FILTER_BOB}
[/chance_to_hit]
[/abilities]
[/effect]
[filter]
id=ben
[/filter]
[/object]
[object]
silent=yes
[effect]
apply_to=new_ability
[abilities]
[attacks]
value=10
{FILTER_ALICE}
[/attacks]
[damage]
value=1
{FILTER_ALICE}
[/damage]
[chance_to_hit]
id=test_cth
value=100
{FILTER_ALICE}
[/chance_to_hit]
[/abilities]
[/effect]
[filter]
id=alex
[/filter]
[/object]
[object]
silent=yes
[filter]
id=bob
[/filter]
[effect]
apply_to=attack
increase_attacks=12
[/effect]
[/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=12,3
[/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 99})}
{ASSERT ({VARIABLE_CONDITIONAL b.hitpoints equals 90})}
{SUCCEED}
[/event]
)}

0 comments on commit 05b2ea2

Please sign in to comment.