Fix rare bug in FORCE_CHANCE_TO_HIT
If in attack end in FORCE_CHANCE_TO_HIT macro, unit or second unit doesn't exist anymore because rare case where unit disapear before attack end event was calledthen we have an error message like "Invalid WML found: [unstore_unit]: variable 'second_unit' doesn't exist" because presence of unit not condition of execution of event.
This commit is contained in:
parent
5fa2ba279e
commit
edab243b9d
2 changed files with 49 additions and 0 deletions
|
@ -514,6 +514,8 @@
|
|||
#! greater_than=10
|
||||
#! [/variable]
|
||||
#! )}
|
||||
# WARNING : if an unit must disappear in mid-battle before attack end was fired, recreate unit instead to unstore or cth modifications
|
||||
# persist. Or don't use this macro.
|
||||
[event]
|
||||
name=attack
|
||||
first_time_only=no
|
||||
|
@ -564,6 +566,9 @@
|
|||
id=forced_cth
|
||||
value={CTH_NUMBER}
|
||||
cumulative=no
|
||||
[filter_opponent]
|
||||
{SECOND_FILTER}
|
||||
[/filter_opponent]
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/do]
|
||||
|
@ -578,6 +583,12 @@
|
|||
name=attack end
|
||||
delayed_variable_substitution=yes
|
||||
|
||||
[filter_condition]
|
||||
[have_unit]
|
||||
id=$unit.id
|
||||
[/have_unit]
|
||||
[/filter_condition]
|
||||
|
||||
[foreach]
|
||||
array=unit.attack
|
||||
[do]
|
||||
|
@ -651,6 +662,9 @@
|
|||
id=forced_cth
|
||||
value={CTH_NUMBER}
|
||||
cumulative=no
|
||||
[filter_opponent]
|
||||
{SECOND_FILTER}
|
||||
[/filter_opponent]
|
||||
[/value]
|
||||
[/set_variables]
|
||||
[/do]
|
||||
|
@ -665,6 +679,12 @@
|
|||
name=attack end
|
||||
delayed_variable_substitution=yes
|
||||
|
||||
[filter_condition]
|
||||
[have_unit]
|
||||
id=$second_unit.id
|
||||
[/have_unit]
|
||||
[/filter_condition]
|
||||
|
||||
[foreach]
|
||||
array=second_unit.attack
|
||||
[do]
|
||||
|
|
|
@ -4063,6 +4063,35 @@ unplagueable: $wml_unit.status.unplagueable"
|
|||
{CLEAR_VARIABLE x_len}
|
||||
{CLEAR_VARIABLE xy_len}
|
||||
[/event]
|
||||
{FORCE_CHANCE_TO_HIT (type=Silver Mage) (type="Orcish Archer") 50 ()}
|
||||
[event]
|
||||
name=attack end
|
||||
[filter]
|
||||
type=Silver Mage
|
||||
[/filter]
|
||||
|
||||
[store_unit]
|
||||
[filter]
|
||||
id=$unit.id
|
||||
[/filter]
|
||||
variable=blink_test
|
||||
kill=yes
|
||||
[/store_unit]
|
||||
[/event]
|
||||
[event]
|
||||
name=turn 2
|
||||
[unstore_unit]
|
||||
variable=blink_test
|
||||
x,y=17,3
|
||||
[/unstore_unit]
|
||||
[unit]
|
||||
side=2
|
||||
x,y=18,3
|
||||
type="Orcish Archer"
|
||||
generate_name=yes
|
||||
jamming=5
|
||||
[/unit]
|
||||
[/event]
|
||||
[/test]
|
||||
|
||||
[units]
|
||||
|
|
Loading…
Add table
Reference in a new issue