Author: zookeeper
Date: Fri May 6 09:36:41 2011
New Revision: 49397
URL: http://svn.gna.org/viewcvs/wesnoth?rev=49397&view=rev
Log:
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.
Modified:
trunk/data/core/macros/abilities.cfg
Modified: trunk/data/core/macros/abilities.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/macros/abilities.cfg?rev=49397&r1=49396&r2=49397&view=diff
==============================================================================
--- trunk/data/core/macros/abilities.cfg (original)
+++ trunk/data/core/macros/abilities.cfg Fri May 6 09:36:41 2011
@@ -527,8 +527,18 @@
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,12 +548,27 @@
not_living="yes"
[/status]
[/filter_wml]
+
+ [or]
+ [filter_wml]
+ [variables]
+ killed_by_feeding="on_turn_$turn_number"
+ [/variables]
+ [/filter_wml]
+ [/or]
[/not]
[/filter]
[filter_second]
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
@@ -566,6 +591,25 @@
increase=1
[/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
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits