Skip to content

Commit

Permalink
Wire in events for new core abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Oct 24, 2018
1 parent b5b334b commit b6e0dbf
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
1 change: 1 addition & 0 deletions data/core/_main.cfg
Expand Up @@ -7,6 +7,7 @@
code=<<
wesnoth.dofile 'lua/wml-tags.lua'
wesnoth.dofile 'lua/feeding.lua'
wesnoth.dofile 'lua/stun.lua'
wesnoth.dofile 'lua/backwards-compatibility.lua'
>>
[/lua]
Expand Down
41 changes: 20 additions & 21 deletions data/core/macros/abilities.cfg
Expand Up @@ -273,6 +273,9 @@ Enemy units cannot see this unit while it is in deep water, except if they have
female_name= _ "female^formation"
description= _ "This unit gains a +10% bonus to defense when another unit with the same ability is adjacent to it. However, this cannot raise the unit’s defense above 70%."
[/dummy]
[/abilities]
{ABILITY_FORMATION_EVENTS}
[+abilities]
#enddef

#define ABILITY_DISENGAGE
Expand All @@ -284,6 +287,9 @@ Enemy units cannot see this unit while it is in deep water, except if they have
female_name= _ "female^disengage"
description= _ "If this unit doesn’t move before attacking, it will retain its movement points after the attack."
[/dummy]
[/abilities]
{ABILITY_DISENGAGE_EVENTS}
[+abilities]
#enddef

#weapons specials
Expand Down Expand Up @@ -462,6 +468,11 @@ Enemy units cannot see this unit while it is in deep water, except if they have
name= _ "daze"
description= _ "When hit with this attack, an enemy suffers a 10% penalty both to their defense and chance to hit for one turn, except for magical attacks."
[/dummy]
[/specials]
[/attack]
{WEAPON_SPECIAL_DAZE_EVENTS}
[+attack]
[+specials]
#enddef

#define WEAPON_SPECIAL_STUN
Expand All @@ -471,11 +482,17 @@ Enemy units cannot see this unit while it is in deep water, except if they have
description= _ "This attack hits so hard that the opponent is dazed and can no longer enforce a zone of control. The effect wears off on the opponent’s next turn."
multiply=1
[/damage]
[/specials]
[/attack]
{WEAPON_SPECIAL_STUN_EVENTS}
[+attack]
[+specials]
#enddef

# TODO: Figure out where to put these
#define ABILITY_DISENGAGE_EVENTS
[event]
id=ability_disengage_event
name=attack end
first_time_only=no

Expand Down Expand Up @@ -983,6 +1000,7 @@ Enemy units cannot see this unit while it is in deep water, except if they have

#define WEAPON_SPECIAL_STUN_EVENTS
[event]
id=weapon_special_stun_event_1
name=attacker_hits
first_time_only=no

Expand Down Expand Up @@ -1030,6 +1048,7 @@ Enemy units cannot see this unit while it is in deep water, except if they have
[/event]

[event]
id=weapon_special_stun_event_2
name=defender_hits
first_time_only=no

Expand Down Expand Up @@ -1077,6 +1096,7 @@ Enemy units cannot see this unit while it is in deep water, except if they have
[/event]

[event]
id=weapon_special_stun_event_3
name=side turn end
first_time_only=no

Expand All @@ -1101,25 +1121,4 @@ Enemy units cannot see this unit while it is in deep water, except if they have

{CLEAR_VARIABLE stunned}
[/event]

[lua]
code=<<
local _ = wesnoth.textdomain "wesnoth-dw"
local old_unit_status = wesnoth.theme_items.unit_status

function wesnoth.theme_items.unit_status()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()

if u.status.stunned then
table.insert(s, { "element", { image = "misc/stunned-status-icon.png",
tooltip = _"stunned: This unit is stunned. It cannot enforce its Zone of Control."
} } )
end

return s
end
>>
[/lua]
#enddef
16 changes: 16 additions & 0 deletions data/lua/stun.lua
@@ -0,0 +1,16 @@
local _ = wesnoth.textdomain "wesnoth"
local old_unit_status = wesnoth.theme_items.unit_status

function wesnoth.theme_items.unit_status()
local u = wesnoth.get_displayed_unit()
if not u then return {} end
local s = old_unit_status()

if u.status.stunned then
table.insert(s, { "element", { image = "misc/stunned-status-icon.png",
tooltip = _"stunned: This unit is stunned. It cannot enforce its Zone of Control."
} } )
end

return s
end

0 comments on commit b6e0dbf

Please sign in to comment.