Rewrote feeding's code to give units only one object, not one per kill
This commit is contained in:
parent
0a809fde2c
commit
dba586ce53
1 changed files with 38 additions and 0 deletions
|
@ -364,9 +364,21 @@ Enemy units cannot see this unit while it is in deep water, except if they have
|
|||
[object]
|
||||
silent=yes
|
||||
duration=forever
|
||||
feeding=yes
|
||||
|
||||
[filter]
|
||||
x,y=$x2,$y2
|
||||
|
||||
# Add the object only once, so the unit is not bloated by an object per kill
|
||||
[not]
|
||||
[filter_wml]
|
||||
[modifications]
|
||||
[object]
|
||||
feeding=yes
|
||||
[/object]
|
||||
[/modifications]
|
||||
[/filter_wml]
|
||||
[/not]
|
||||
[/filter]
|
||||
|
||||
[effect]
|
||||
|
@ -374,6 +386,32 @@ Enemy units cannot see this unit while it is in deep water, except if they have
|
|||
increase_total=1
|
||||
increase=1
|
||||
[/effect]
|
||||
|
||||
# If the unit already had the object, update its and the unit's properties
|
||||
[else]
|
||||
{FOREACH second_unit.modifications.object i}
|
||||
[if]
|
||||
[variable]
|
||||
name=second_unit.modifications.object[$i].feeding
|
||||
boolean_equals=yes
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE_OP second_unit.modifications.object[$i].effect.increase_total add 1}
|
||||
{VARIABLE_OP second_unit.hitpoints add 1}
|
||||
{VARIABLE_OP second_unit.max_hitpoints add 1}
|
||||
|
||||
# Not needed, so might as well remove these
|
||||
{CLEAR_VARIABLE second_unit.modifications.object[$i].filter,second_unit.modifications.object[$i].else}
|
||||
|
||||
[unstore_unit]
|
||||
variable=second_unit
|
||||
find_vacant=no
|
||||
[/unstore_unit]
|
||||
[/then]
|
||||
[/if]
|
||||
{NEXT i}
|
||||
[/else]
|
||||
[/object]
|
||||
[/event]
|
||||
[+abilities]
|
||||
|
|
Loading…
Add table
Reference in a new issue