Sort of fixed bug #17527 (Feeding ability doubles) WML-side.

The fix doesn't work in every imaginable situation though (the
exceptions should be very rare), so a proper engine-side fix is still
wanted eventually.
This commit is contained in:
Lari Nieminen 2011-05-06 07:36:41 +00:00
parent 1360e8a4bc
commit 7011083379

View file

@ -527,8 +527,18 @@ Enemy units cannot see this unit while it is in deep water, except if they have
This unit gains 1 hitpoint added to its maximum whenever it kills a living unit."
[/dummy] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag start: [abilities]
[/abilities]
# NOTE: the purpose of the unit.variables.killed_by_feeding variable is to
# prevent multiple instances of feeding stacking with each other: the first
# event will not trigger for units marked as already having been killed by
# feeding on this turn. The turn number is included in the variable value in
# order to decrease the chances of feeding not working on a unit as a result of
# a scenario event storing it upon death and bringing it back later, in which
# case the variable could still be intact. However, this doesn't work in every
# imaginable situation and therefore a better fix is still needed eventually.
[event]
name=die
name=last breath
first_time_only=no
[filter]
@ -538,6 +548,14 @@ This unit gains 1 hitpoint added to its maximum whenever it kills a living unit.
not_living="yes"
[/status]
[/filter_wml]
[or]
[filter_wml]
[variables]
killed_by_feeding="on_turn_$turn_number"
[/variables]
[/filter_wml]
[/or]
[/not]
[/filter]
@ -545,6 +563,13 @@ This unit gains 1 hitpoint added to its maximum whenever it kills a living unit.
ability=feeding
[/filter_second]
{VARIABLE unit.variables.killed_by_feeding "on_turn_$turn_number"}
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[unstore_unit]
variable=second_unit
{COLOR_HEAL}
@ -567,6 +592,25 @@ This unit gains 1 hitpoint added to its maximum whenever it kills a living unit.
[/effect]
[/object]
[/event]
[event]
name=die
first_time_only=no
[filter]
[filter_wml]
[variables]
killed_by_feeding="on_turn_$turn_number"
[/variables]
[/filter_wml]
[/filter]
{CLEAR_VARIABLE unit.variables.killed_by_feeding}
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/event]
[+abilities] # a hack to please wmlxgettext (using a bug in wmlxgettext!): dummy tag end: [/abilities]
#enddef
# wmllint: unbalanced-off