apply code cleanup from Eftboren to Battle for Zocthanol Isle

This commit is contained in:
Simon Forsyth 2012-03-03 15:18:05 +00:00
parent 1d7c0e8d08
commit 911bbfd739

View file

@ -49,8 +49,9 @@
{TRAIT_INTELLIGENT}
{TRAIT_RESILIENT}
[/modifications]
# gold and income will be set later - this ensures saurians have no gold until then
gold=0
income=0
income=-50
controller=ai
shroud=no
fog=no
@ -391,32 +392,9 @@
#initialize starting variables
{VARIABLE encountered_saurians no}
{VARIABLE captured_fort no}
{VARIABLE found_door no}
{VARIABLE num_keys_found 0}
{VARIABLE time_of_day 1}
# flag to store if first night has happened or not, starts at false
{VARIABLE first_night no}
# flag to store if second_dawn has happened or not, starts at false
{VARIABLE second_dawn no}
# number of bats to appear each night
#ifdef EASY
{VARIABLE number_vamp_bats 5}
{VARIABLE number_blood_bats 0}
#endif
#ifdef NORMAL
{VARIABLE number_vamp_bats 3}
{VARIABLE number_blood_bats 3}
#endif
#ifdef HARD
{VARIABLE number_vamp_bats 3}
{VARIABLE number_blood_bats 4}
#endif
# set starting scenario objectives
@ -596,47 +574,15 @@
side=1
[/filter]
[if]
[variable]
name=captured_fort
boolean_equals=no
[/variable]
[message]
speaker=Nym
message= _ "I dont get it. All we see are ruins, bones, some sand and patches of grass. I thought we would be attacked the moment we set foot on this island. Where is everybody?"
[/message]
[then]
[message]
speaker=Nym
message= _ "I dont get it. All we see are ruins, bones, some sand and patches of grass. I thought we would be attacked the moment we set foot on this island. Where is everybody?"
[/message]
[message]
speaker=Kaleh
message= _ "Thats what worries me. I keep thinking that something is going to jump out from behind the next rock or stone wall and attack, but everything is silent. Too silent."
[/message]
[/then]
[/if]
[/event]
# Event 3.5 Reset Saurians Gold to 0
# Until player meets Saurians, keep their gold at 0
[event]
name=new turn
first_time_only=no
[if]
[variable]
name=encountered_saurians
boolean_equals=no
[/variable]
[then]
[modify_side]
side=2
gold=0
[/modify_side]
[/then]
[/if]
[message]
speaker=Kaleh
message= _ "Thats what worries me. I keep thinking that something is going to jump out from behind the next rock or stone wall and attack, but everything is silent. Too silent."
[/message]
[/event]
# Event 4: Encountering the Saurians
@ -687,25 +633,10 @@
{NAMED_GENERIC_UNIT 2 (Saurian Oracle) 20 42 () ( _ "Fanatical Saurian")}
#endif
{VARIABLE encountered_saurians 1}
[modify_side]
side=2
#ifdef EASY
income=3
gold=20
#endif
#ifdef NORMAL
income=4
gold=30
#endif
#ifdef HARD
income=5
gold=40
#endif
{INCOME 3 4 5}
{GOLD 20 30 40}
[/modify_side]
[/event]
@ -759,19 +690,8 @@
[modify_side]
side=7
#ifdef EASY
income=7
gold=75
#endif
#ifdef NORMAL
income=9
gold=95
#endif
#ifdef HARD
income=11
gold=115
#endif
{INCOME 7 9 11}
{GOLD 75 95 115}
[/modify_side]
[unit]
@ -789,19 +709,8 @@
[modify_side]
side=8
#ifdef EASY
income=9
gold=75
#endif
#ifdef NORMAL
income=11
gold=95
#endif
#ifdef HARD
income=13
gold=115
#endif
{INCOME 9 11 13}
{GOLD 75 95 115}
[/modify_side]
[/event]
@ -1566,7 +1475,6 @@
name= _ "Eloh"
side=5
x,y=26,19
ai_special=guardian
[/unit]
[redraw]
@ -1645,13 +1553,9 @@
# Kaleh disappears
[store_unit]
[filter]
id=Kaleh
[/filter]
kill=yes
variable=Kaleh_var
[/store_unit]
[hide_unit]
id=Kaleh
[/hide_unit]
[redraw]
[/redraw]
@ -1693,13 +1597,9 @@
# Nym disappears
[store_unit]
[filter]
id=Nym
[/filter]
kill=yes
variable=Nym_var
[/store_unit]
[hide_unit]
id=Nym
[/hide_unit]
[redraw]
[/redraw]
@ -1715,13 +1615,9 @@
# Zhul disappears
[store_unit]
[filter]
id=Zhul
[/filter]
kill=yes
variable=Zhul_var
[/store_unit]
[hide_unit]
id=Zhul
[/hide_unit]
{MESSAGE_DEPEND_ON_ALLY
(
@ -1749,175 +1645,61 @@
[/message]
)}
[unstore_unit]
variable=Kaleh_var
[/unstore_unit]
[unstore_unit]
variable=Nym_var
[/unstore_unit]
[unstore_unit]
variable=Zhul_var
[/unstore_unit]
{CLEAR_VARIABLE captured_fort}
{CLEAR_VARIABLE found_door}
{CLEAR_VARIABLE num_keys_found}
{CLEAR_VARIABLE encountered_saurians}
{CLEAR_VARIABLE first_night}
{CLEAR_VARIABLE Kaleh_var}
{CLEAR_VARIABLE Nym_var}
{CLEAR_VARIABLE Zhul_var}
{CLEAR_VARIABLE temp_x}
{CLEAR_VARIABLE temp_y}
{CLEAR_VARIABLE locs}
{CLEAR_VARIABLE counter}
{CLEAR_VARIABLE number_vamp_bats}
{CLEAR_VARIABLE number_blood_bats}
[/event]
# I NEED THE CLOCK FUNCTION TO GO FIRST BECAUSE LATER EVENTS CHECK TO SEE
# WHAT TIME IT IS
#clock function
#Step 0: if blackhand sign hasn't appeared, make sure leader has no gold
#Step 1: if we are going into night or day, flip daytime boolean
#Step 2: advance clock
#first day
#dawn 1
#morning 2
#mid-day 3
#afternoon 4
#dusk 5
#shortdark 6
#second day
#dawn -1
#morning -2
#mid-day -3
#afternoon -4
#dusk -5
#longdark 1 -6
#longdark 2 -7
#longdark 3 -8
#longdark 4 -9
[event]
name=new turn
first_time_only=no
[if]
[variable]
name=time_of_day
numerical_equals=-9
[/variable]
[then]
[set_variable]
name=time_of_day
value=1
[/set_variable]
[/then]
[else]
[if]
[variable]
name=time_of_day
numerical_equals=6
[/variable]
[then]
[set_variable]
name=time_of_day
value=-1
[/set_variable]
[/then]
[else]
[if]
[variable]
name=time_of_day
greater_than=0
[/variable]
[then]
[set_variable]
name=time_of_day
add=1
[/set_variable]
[/then]
[else]
[set_variable]
name=time_of_day
sub=1
[/set_variable]
[/else]
[/if]
[/else]
[/if]
[/else]
[/if]
[/event]
# create bats at dusk function
# at first dusk, Kaleh comments strange noises in jungle
# pick random hex
# of hex is a jungle, create a bat, increment counter
# else pick new random hex
# pick random hex on jungle terrain
# create bat and increment counter
# keep going until counter = number of bats to create
# at first dusk, Kaleh comments strange noises in jungle
[event]
name=bat_noise_reaction
[message]
speaker=Kaleh
message= _ "Whats that strange screeching sound coming from the jungle?"
[/message]
[/event]
[event]
name=new turn
first_time_only=no
[if]
#time of day is 5 or -5
[variable]
name=time_of_day
numerical_equals=5
[/variable]
[or]
[variable]
name=time_of_day
numerical_equals=-5
[/variable]
[/or]
[have_location]
time_of_day_id=dusk1,dusk2
[/have_location]
[then]
[if]
[variable]
name=first_night
numerical_equals=0
[/variable]
[fire_event]
name=bat_noise_reaction
[/fire_event]
[then]
[set_variable]
name=first_night
value=1
[/set_variable]
# create vampire bats and blood bats
[message]
speaker=Kaleh
message= _ "Whats that strange screeching sound coming from the jungle?"
[/message]
[/then]
[/if]
#collect suitable locations
[store_locations]
terrain=Gs^Ft
variable=locs
[/store_locations]
# create vampire bats and blood bats based on numbers defined in prestart
[set_variable]
name=array_length
value=$locs.length
[/set_variable]
# array is indexed to 1 less than its length
[set_variable]
name=array_length
sub=1
[/set_variable]
# create vampire bats
#define CREATE_BATS TYPE NUMBER
[set_variable]
name=counter
value=0
@ -1926,34 +1708,13 @@
[while]
[variable]
name=counter
less_than=$number_vamp_bats
less_than={NUMBER}
[/variable]
[do]
[store_locations]
terrain=Gs^Ft
variable=locs
[/store_locations]
[set_variable]
name=array_length
value=$locs.length
[/set_variable]
# array is indexed to 1 less than it's length
[set_variable]
name=array_length
sub=1
[/set_variable]
[set_variable]
name=random_string
value=0..$array_length
[/set_variable]
[set_variable]
name=index
rand=$random_string
rand=0..$array_length
[/set_variable]
[set_variable]
@ -1966,10 +1727,7 @@
to_variable=locs[$index].y
[/set_variable]
{CLEAR_VARIABLE array_length}
{CLEAR_VARIABLE random_string}
{NAMED_UNIT 6 (Vampire Bat) $temp_x $temp_y () ( _ "Nocturnal Pest") (upkeep=free)}
{NAMED_UNIT 6 ({TYPE}) $temp_x $temp_y () ( _ "Nocturnal Pest") (upkeep=free)}
[set_variable]
name=counter
@ -1977,73 +1735,20 @@
[/set_variable]
[/do]
[/while]
#enddef
{CREATE_BATS (Vampire Bat) {ON_DIFFICULTY 5 3 3}}
# create blood bats on medium and hard difficulties
#ifdef EASY
#else
[set_variable]
name=counter
value=0
[/set_variable]
[while]
[variable]
name=counter
less_than=$number_blood_bats
[/variable]
[do]
[store_locations]
terrain=Gs^Ft
variable=locs
[/store_locations]
[set_variable]
name=array_length
value=$locs.length
[/set_variable]
# array is indexed to 1 less than it's length
[set_variable]
name=array_length
sub=1
[/set_variable]
[set_variable]
name=random_string
value=0..$array_length
[/set_variable]
[set_variable]
name=index
rand=$random_string
[/set_variable]
[set_variable]
name=temp_x
to_variable=locs[$index].x
[/set_variable]
[set_variable]
name=temp_y
to_variable=locs[$index].y
[/set_variable]
{CLEAR_VARIABLE array_length}
{CLEAR_VARIABLE random_string}
{NAMED_UNIT 6 (Blood Bat) $temp_x $temp_y () ( _ "Nocturnal Pest") (upkeep=free)}
[set_variable]
name=counter
add=1
[/set_variable]
[/do]
[/while]
#ifndef EASY
{CREATE_BATS (Blood Bat) {ON_DIFFICULTY 0 3 4}}
#endif
#undef CREATE_BATS
{CLEAR_VARIABLE array_length}
{CLEAR_VARIABLE temp_x}
{CLEAR_VARIABLE temp_y}
{CLEAR_VARIABLE locs}
{CLEAR_VARIABLE counter}
[/then]
[/if]
[/event]
@ -2051,25 +1756,30 @@
# destroy all bats at morning
# at first morning, Nym comments on bats fleeing
[event]
name=bat_leave_reaction
[message]
speaker=Nym
message= _ "Thats odd. Why did those bats suddenly fly off?"
[/message]
[message]
speaker=Zhul
message= _ "They must be nocturnal."
[/message]
[/event]
[event]
name=new turn
first_time_only=no
[if]
#time of day is 2 or -2
[variable]
name=time_of_day
numerical_equals=-2
[/variable]
[or]
[variable]
name=time_of_day
numerical_equals=2
[/variable]
[/or]
[have_location]
time_of_day_id=dawn1,dawn2
[/have_location]
[have_unit]
side=6
[/have_unit]
[then]
[kill]
@ -2078,34 +1788,9 @@
fire_event=no
[/kill]
[if]
[variable]
name=first_night
numerical_equals=1
[/variable]
[variable]
name=second_dawn
numerical_equals=0
[/variable]
[then]
[set_variable]
name=second_dawn
value=1
[/set_variable]
[message]
speaker=Nym
message= _ "Thats odd. Why did those bats suddenly fly off?"
[/message]
[message]
speaker=Zhul
message= _ "They must be nocturnal."
[/message]
[/then]
[/if]
[fire_event]
name=bat_leave_reaction
[/fire_event]
[/then]
[/if]
[/event]