Fixed bug #22799 and improved the related code
This commit is contained in:
parent
e342e5364e
commit
c11efe47c0
3 changed files with 114 additions and 215 deletions
|
@ -69,6 +69,7 @@ Version 1.13.0-dev:
|
|||
* Set Masked Dwarvish Lord range attack same as for Dwarvish Lord
|
||||
* Under the Burning Suns
|
||||
* Fixed bug #22800: Cloaked Figure appears in strange location.
|
||||
* Fixed bug #22799: No allies killed by enemy reinforcements.
|
||||
* C++ Engine:
|
||||
* Purge "human_ai" controller type. This is a fixup of bugfix #18829 below.
|
||||
* Editor:
|
||||
|
|
|
@ -1746,8 +1746,6 @@
|
|||
# run 2 troll shamans up to western threatre, and 1 up to eastern
|
||||
# bottleneck (reduced to 1 on each side)
|
||||
|
||||
# they destroy (Easy:33% Medium: 50% Hard: 50%) of your allies
|
||||
|
||||
#define ENEMY_ATTACK
|
||||
|
||||
[if]
|
||||
|
@ -1838,127 +1836,86 @@
|
|||
message= _ "Those new troll shamans are decimating the dwarves with blasts of fire! This doesn’t look good."
|
||||
[/message]
|
||||
|
||||
#store dwarves in main cave in array
|
||||
#main cave = x 32-51 y 21-33
|
||||
#store length of array as X
|
||||
#divide X in half = Y
|
||||
#loop Y times:
|
||||
# (store dwarves in main cave in array)
|
||||
# (store length of array as Z)
|
||||
# (Random 0 to Z-1)
|
||||
# (Kill random dwarf)
|
||||
|
||||
[store_unit]
|
||||
x=24-46
|
||||
y=19-35
|
||||
[filter]
|
||||
role="Dwarf Defender"
|
||||
x=24-46
|
||||
y=19-35
|
||||
[/filter]
|
||||
variable=victims
|
||||
kill=no
|
||||
[/store_unit]
|
||||
|
||||
[set_variable]
|
||||
name=i
|
||||
value=$victims.length
|
||||
[/set_variable]
|
||||
#if easy kill 50%
|
||||
#if medium kill 60%
|
||||
#if hard kill 75%
|
||||
|
||||
#if easy kill 60%
|
||||
#if medium kill 70%
|
||||
#if hard kill 80%
|
||||
{VARIABLE deaths $victims.length}
|
||||
{VARIABLE_OP deaths multiply {ON_DIFFICULTY 0.6 0.7 0.8}}
|
||||
{VARIABLE_OP deaths round 0}
|
||||
|
||||
[set_variable]
|
||||
name=i
|
||||
multiply={ON_DIFFICULTY 0.6 0.7 0.8}
|
||||
[/set_variable]
|
||||
{DEBUG_MSG "Killing $deaths defenders out of $victims.length"}
|
||||
|
||||
[set_variable]
|
||||
name=i
|
||||
round=0
|
||||
[/set_variable]
|
||||
{VARIABLE i 1}
|
||||
{REPEAT $deaths (
|
||||
{RANDOM "1..$victims.length"}
|
||||
{VARIABLE_OP random sub 1}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
greater_than=0
|
||||
[/variable]
|
||||
[then]
|
||||
[set_variable]
|
||||
name=number_of_victims
|
||||
value=$victims.length
|
||||
[/set_variable]
|
||||
{VARIABLE casualty $victims[$random].id}
|
||||
|
||||
{STARTLOOP i}
|
||||
#have some dwarves scream as they die
|
||||
[switch]
|
||||
variable=i
|
||||
|
||||
#subtract 1 because arrays go from 0 to length-1
|
||||
[set_variable]
|
||||
name=number_of_victims
|
||||
sub=1
|
||||
[/set_variable]
|
||||
[case]
|
||||
value=1
|
||||
|
||||
[set_variable]
|
||||
name=death
|
||||
rand=0..$number_of_victims
|
||||
[/set_variable]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Aauughh!"
|
||||
[/message]
|
||||
[/case]
|
||||
|
||||
[set_variable]
|
||||
name=casualty
|
||||
to_variable=victims[$death].id
|
||||
[/set_variable]
|
||||
[case]
|
||||
value=2
|
||||
|
||||
#have some dwarves scream as they die
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "No...!"
|
||||
[/message]
|
||||
[/case]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
numerical_equals=-1
|
||||
[/variable]
|
||||
[case]
|
||||
value=3
|
||||
|
||||
[then]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Aauughh!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Help me!!"
|
||||
[/message]
|
||||
[/case]
|
||||
[/switch]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
numerical_equals=-2
|
||||
[/variable]
|
||||
[kill]
|
||||
id=$casualty
|
||||
animate=yes
|
||||
fire_event=no
|
||||
[/kill]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "No...!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
{VARIABLE_OP i add 1}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
numerical_equals=-3
|
||||
[/variable]
|
||||
# Update the victims array
|
||||
[store_unit]
|
||||
[filter]
|
||||
find_in=victims
|
||||
[not]
|
||||
id=$casualty
|
||||
[/not]
|
||||
[/filter]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Help me!!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
|
||||
[kill]
|
||||
id=$casualty
|
||||
animate=yes
|
||||
fire_event=no
|
||||
[/kill]
|
||||
|
||||
{ENDLOOP i}
|
||||
[/then]
|
||||
[/if]
|
||||
variable=victims
|
||||
kill=no
|
||||
[/store_unit]
|
||||
)}
|
||||
|
||||
[message]
|
||||
speaker=Dwarf Leader
|
||||
|
@ -2068,116 +2025,85 @@
|
|||
[/message]
|
||||
|
||||
[store_unit]
|
||||
x=24-46
|
||||
y=19-35
|
||||
[filter]
|
||||
role="Troll Defender"
|
||||
x=24-46
|
||||
y=19-35
|
||||
[/filter]
|
||||
variable=victims
|
||||
kill=no
|
||||
[/store_unit]
|
||||
|
||||
[set_variable]
|
||||
name=i
|
||||
value=$victims.length
|
||||
[/set_variable]
|
||||
|
||||
#if easy kill 50%
|
||||
#if medium kill 60%
|
||||
#if hard kill 75%
|
||||
|
||||
[set_variable]
|
||||
name=i
|
||||
multiply={ON_DIFFICULTY 0.5 0.6 0.75}
|
||||
[/set_variable]
|
||||
{VARIABLE deaths $victims.length}
|
||||
{VARIABLE_OP deaths multiply {ON_DIFFICULTY 0.5 0.6 0.75}}
|
||||
{VARIABLE_OP deaths round 0}
|
||||
|
||||
[set_variable]
|
||||
name=i
|
||||
round=0
|
||||
[/set_variable]
|
||||
{DEBUG_MSG "Killing $deaths defenders out of $victims.length"}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
greater_than=0
|
||||
[/variable]
|
||||
[then]
|
||||
[set_variable]
|
||||
name=number_of_victims
|
||||
value=$victims.length
|
||||
[/set_variable]
|
||||
{VARIABLE i 1}
|
||||
{REPEAT $deaths (
|
||||
{RANDOM "1..$victims.length"}
|
||||
{VARIABLE_OP random sub 1}
|
||||
|
||||
{STARTLOOP i}
|
||||
{VARIABLE casualty $victims[$random].id}
|
||||
|
||||
#subtract 1 because arrays go from 0 to length-1
|
||||
[set_variable]
|
||||
name=number_of_victims
|
||||
sub=1
|
||||
[/set_variable]
|
||||
#have some trolls scream as they die
|
||||
[switch]
|
||||
variable=i
|
||||
|
||||
[set_variable]
|
||||
name=death
|
||||
rand=0..$number_of_victims
|
||||
[/set_variable]
|
||||
[case]
|
||||
value=1
|
||||
|
||||
[set_variable]
|
||||
name=casualty
|
||||
to_variable=victims[$death].id
|
||||
[/set_variable]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Aaughh!"
|
||||
[/message]
|
||||
[/case]
|
||||
|
||||
#have some trolls scream as they die
|
||||
[case]
|
||||
value=2
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
numerical_equals=-1
|
||||
[/variable]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "No...!"
|
||||
[/message]
|
||||
[/case]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Aaughh!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
[case]
|
||||
value=3
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
numerical_equals=-2
|
||||
[/variable]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Gaaghh!" # wmllint: no spellcheck
|
||||
[/message]
|
||||
[/case]
|
||||
[/switch]
|
||||
|
||||
[then]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "No...!"
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
[kill]
|
||||
id=$casualty
|
||||
animate=yes
|
||||
fire_event=no
|
||||
[/kill]
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=i
|
||||
numerical_equals=-3
|
||||
[/variable]
|
||||
{VARIABLE_OP i add 1}
|
||||
|
||||
[then]
|
||||
[message]
|
||||
id=$casualty
|
||||
message= _ "Gaaghh!" # wmllint: no spellcheck
|
||||
[/message]
|
||||
[/then]
|
||||
[/if]
|
||||
# Update the victims array
|
||||
[store_unit]
|
||||
[filter]
|
||||
find_in=victims
|
||||
[not]
|
||||
id=$casualty
|
||||
[/not]
|
||||
[/filter]
|
||||
|
||||
[kill]
|
||||
id=$casualty
|
||||
animate=yes
|
||||
fire_event=no
|
||||
[/kill]
|
||||
|
||||
{ENDLOOP i}
|
||||
[/then]
|
||||
[/if]
|
||||
variable=victims
|
||||
kill=no
|
||||
[/store_unit]
|
||||
)}
|
||||
|
||||
[message]
|
||||
speaker=Troll Leader
|
||||
|
@ -2191,7 +2117,7 @@
|
|||
[/else]
|
||||
[/if]
|
||||
|
||||
{CLEAR_VARIABLE casualty,victims,number_of_victims,i}
|
||||
{CLEAR_VARIABLE casualty,deaths,victims,i}
|
||||
|
||||
#enddef
|
||||
|
||||
|
@ -2491,7 +2417,7 @@
|
|||
|
||||
[event]
|
||||
name="turn $($turn_number+3)"
|
||||
delayed_variable_substitution=no
|
||||
delayed_variable_substitution=yes
|
||||
{ENEMY_ATTACK}
|
||||
[/event]
|
||||
|
||||
|
|
|
@ -44,34 +44,6 @@
|
|||
{CLEAR_VARIABLE random_placement_locations}
|
||||
#enddef
|
||||
|
||||
# wmlindent: start ignoring
|
||||
#define STARTLOOP VAR
|
||||
# Loop VAR times, counting from -VAR to -1.
|
||||
[set_variable]
|
||||
name={VAR}
|
||||
multiply=-1
|
||||
[/set_variable]
|
||||
|
||||
[while]
|
||||
[variable]
|
||||
name={VAR}
|
||||
less_than=0
|
||||
[/variable]
|
||||
[do] #enddef
|
||||
|
||||
# Same as mainline NEXT
|
||||
#define ENDLOOP VAR
|
||||
# Macro to end a WML clause that iterates over an array.
|
||||
[set_variable]
|
||||
name={VAR}
|
||||
add=1
|
||||
[/set_variable]
|
||||
[/do]
|
||||
[/while]
|
||||
{CLEAR_VARIABLE {VAR}}
|
||||
#enddef
|
||||
# wmlindent: stop ignoring
|
||||
|
||||
# The amount of extra recruit cost is kept in $recruit_cost_extra; when this
|
||||
# macro is called for the first time, it'll disallow recruitment of
|
||||
# "Desert Fighter" and then allow recruitment of "Desert FighterX". The second
|
||||
|
|
Loading…
Add table
Reference in a new issue