Fixed a typo that prevented ghosts from disappearing.

Ogre ambush is balanced by applying thirst.

Villages aren't captured by outlaws to force the AI leader to recruit.
This commit is contained in:
Jan Rietema 2007-09-19 13:32:10 +00:00
parent 49385249e4
commit 7fc30877f9

View file

@ -326,7 +326,7 @@
#define SETUP_ENEMY_THIRST SIDE THIRST
[store_unit]
variable=enemy
kill=no
kill=yes
[filter]
side={SIDE}
[/filter]
@ -380,6 +380,197 @@
{NEXT i}
#enddef
# macro for all hydration effects to all units stored in
# a variable called "affected_unit"
# EFFECT > 0 is dehydration
# EFFECT = 0 is silent rehydration
# EFFECT < 0 is rehydration with notification
#define APPLY_HYDRATION_EFFECT EFFECT
{FOREACH affected_unit i}
{VARIABLE effect {EFFECT}}
{VARIABLE thirst $affected_unit[$i].variables.dehydration}
{VARIABLE hp_to_regain 0}
# are we dehydrating or rehydrating?
[if]
[variable]
name=effect
greater_than=0
[/variable]
[then]
{VARIABLE_OP thirst add 1}
{VARIABLE green -30}
{VARIABLE_OP green multiply $thirst}
{VARIABLE_OP green add 280}
[if]
[variable]
name=green
less_than=0
[/variable]
[then]
{VARIABLE green 0}
[/then]
[/if]
{VARIABLE red 250}
{VARIABLE blue 52}
[/then]
[else]
# rehydrate
{VARIABLE hp_to_regain $thirst}
{VARIABLE_OP hp_to_regain multiply 2}
{VARIABLE red 170}
{VARIABLE green 230}
{VARIABLE blue 245}
[if]
[variable]
name=hp_to_regain
#ifdef EASY
greater_than=8
#else
greater_than=4
#endif
[/variable]
[then]
#ifdef EASY
{VARIABLE hp_to_regain 8}
#else
{VARIABLE hp_to_regain 4}
#endif
[/then]
[/if]
# make rehydrate silent if the unit isn't
# suffering dehydration
[if]
[variable]
name=thirst
less_than=1
[/variable]
[then]
{VARIABLE effect 0}
[/then]
[/if]
{VARIABLE thirst 0}
[/else]
[/if]
# modify attacks
{FOREACH affected_unit[$i].attack j}
[if]
[variable]
name=affected_unit[$i].attack[$j].range
equals=melee
[/variable]
[then]
{VARIABLE damage_multiplier 10}
[/then]
[else]
{VARIABLE damage_multiplier 20}
[/else]
[/if]
{VARIABLE damage_divisor $damage_multiplier}
{VARIABLE_OP damage_multiplier add -$thirst}
# store real_damage
[if]
[variable]
name=affected_unit[$i].attack[$j].real_damage
greater_than=0
[/variable]
[else]
{VARIABLE affected_unit[$i].attack[$j].real_damage $affected_unit[$i].attack[$j].damage}
[/else]
[/if]
{VARIABLE new_damage $affected_unit[$i].attack[$j].real_damage}
{VARIABLE_OP new_damage multiply $damage_multiplier}
{VARIABLE_OP new_damage divide $damage_divisor}
[if]
[variable]
name=new_damage
less_than=1
[/variable]
[then]
{VARIABLE new_damage 1}
[/then]
[/if]
{VARIABLE affected_unit[$i].attack[$j].damage $new_damage}
{NEXT j}
# adjust current hp
[if]
[variable]
name=thirst
greater_than=0
[/variable]
[then]
{VARIABLE_OP affected_unit[$i].hitpoints add -$dehydration_loss}
{VARIABLE_OP affected_unit[$i].max_hitpoints add -$dehydration_loss}
{VARIABLE affected_unit[$i].variables.dehydration $thirst}
[/then]
[else]
#ifdef HARD
#else
{VARIABLE_OP affected_unit[$i].hitpoints add $hp_to_regain}
#endif
{VARIABLE affected_unit[$i].max_hitpoints $affected_unit[$i].variables.max_hitpoints}
{VARIABLE affected_unit[$i].variables.dehydration 0}
[/else]
[/if]
{VARIABLE hp_check $affected_unit[$i].hitpoints}
# check hp
[if]
[variable]
name=hp_check
less_than=1
[/variable]
[then]
{VARIABLE affected_unit[$i].hitpoints 1}
[/then]
[/if]
[if]
[variable]
name=effect
greater_than=0
[/variable]
[then]
[unstore_unit]
variable=affected_unit[$i]
find_vacant=no
red,green,blue=$red,$green,$blue
text= _ "thirst"
[/unstore_unit]
[/then]
[else]
[if]
[variable]
name=effect
not_equals=0
[/variable]
[then]
[unstore_unit]
variable=affected_unit[$i]
find_vacant=no
red,green,blue=$red,$green,$blue
text= _ "refreshed"
[/unstore_unit]
[/then]
[else]
# silent unstore
[unstore_unit]
variable=affected_unit[$i]
find_vacant=no
[/unstore_unit]
[/else]
[/if]
[/else]
[/if]
{NEXT i}
{CLEAR_VARIABLE hp_check}
{CLEAR_VARIABLE thirst}
{CLEAR_VARIABLE hp_to_regain}
{CLEAR_VARIABLE damage_multiplier}
{CLEAR_VARIABLE damage_divisor}
{CLEAR_VARIABLE new_damage}
{CLEAR_VARIABLE green}
{CLEAR_VARIABLE red}
{CLEAR_VARIABLE blue}
#enddef
# Special Encounter events
@ -579,10 +770,38 @@
{RANDOM_PLACEMENT_AREA 17 49 2}
{PLACE_UNITS_RANDOMLY 3 3 "Young Ogre" "Hunting Ogre" (ai_special="guardian")}
{PLACE_UNITS_RANDOMLY 2 3 "Ogre" "Hunting Ogre" (ai_special="guardian")}
{PLACE_UNITS_RANDOMLY 3 3 "Young Ogre" "Hunting Ogre" (ai_special="guardian"
random_traits="no")}
{PLACE_UNITS_RANDOMLY 2 3 "Ogre" "Hunting Ogre" (ai_special="guardian"
random_traits="no")}
{CLEAR_PLACEMENT_AREA}
#ifdef EASY
{VARIABLE ogre_thirst 3}
#endif
#ifdef NORMAL
{VARIABLE ogre_thirst 1}
#endif
#ifdef HARD
{VARIABLE ogre_thirst -1}
#endif
{SETUP_ENEMY_THIRST 3 $ogre_thirst}
# also need to apply thirst right away
[store_unit]
variable=affected_unit
kill=no
[filter]
side=3
x=13-22
y=44-54
[/filter]
[/store_unit]
{APPLY_HYDRATION_EFFECT 1}
{VARIABLE ogres_killed 0}
#enddef
@ -617,10 +836,9 @@
side=1
[/filter]
[message]
type=Ogre
message= _ "Fresh meat!"
[/message]
{MOBILIZE_SIDE 3}
type=Ogre
message= _ "Fresh meat!"
[/message]
[/event]
[/then]
@ -653,30 +871,6 @@
[/event]
[/else]
[/if]
#ifdef EASY
{VARIABLE ogre_thirst 4}
#endif
#ifdef NORMAL
{VARIABLE ogre_thirst 2}
#endif
#ifdef HARD
{VARIABLE ogre_thirst 0}
#endif
{SETUP_ENEMY_THIRST 3 $ogre_thirst}
{VARIABLE ogres_killed 0}
[event]
name=attack
[filter]
role="Hunting Ogre"
[/filter]
[filter_second]
side=1
[/filter_second]
{MOBILIZE_SIDE 3}
[/event]
[event]
name=die
@ -802,6 +996,8 @@
description=Zhul
message=_"Girl, I told you not to open it. Let's go, I'd really like to get to an oasis soon."
[/message]
{CLEAR_VARIABLE ogres_killed}
[/then]
[/if]
[/event]
@ -847,6 +1043,8 @@
{CLEAR_PLACEMENT_AREA}
{SETUP_ENEMY_THIRST 2 0}
{VARIABLE bandits_mobilized 0}
[if]
[have_unit]
@ -905,7 +1103,16 @@
[/message]
{VARIABLE black_patrol_dialogue 1}
{MOBILIZE_SIDE 2}
[if]
[variable]
name=bandits_mobilized
less_than=1
[/variable]
[then]
{MOBILIZE_SIDE 2}
{VARIABLE bandits_mobilized 1}
[/then]
[/if]
[/then]
[/if]
[/event]
@ -920,7 +1127,16 @@
[filter_second]
side=2
[/filter_second]
{MOBILIZE_SIDE 2}
[if]
[variable]
name=bandits_mobilized
less_than=1
[/variable]
[then]
{MOBILIZE_SIDE 2}
{VARIABLE bandits_mobilized 1}
[/then]
[/if]
[/event]
[event]
name=sighted
@ -952,7 +1168,16 @@
[/message]
{VARIABLE black_hand_dialogue 1}
{MOBILIZE_SIDE 2}
[if]
[variable]
name=bandits_mobilized
less_than=1
[/variable]
[then]
{MOBILIZE_SIDE 2}
{VARIABLE bandits_mobilized 1}
[/then]
[/if]
[/then]
[/if]
[/event]
@ -971,15 +1196,13 @@
[/filter_second]
[if]
[variable]
name=ogres_killed
equals=3
name=bandits_mobilized
less_than=1
[/variable]
[then]
{MOBILIZE_SIDE 2}
{VARIABLE bandits_mobilized 1}
[/then]
[else]
{VARIABLE_OP ogres_killed add 1}
[/else]
[/if]
[/event]
# an ogre being killed by a player unit
@ -991,7 +1214,23 @@
type=Giant Scorpion
[/not]
[/filter]
{MOBILIZE_SIDE 2}
[if]
[variable]
name=ogres_killed
equals=3
[/variable]
[variable]
name=bandits_mobilized
less_than=1
[/variable]
[then]
{MOBILIZE_SIDE 2}
{VARIABLE bandits_mobilized 1}
[/then]
[else]
{VARIABLE_OP ogres_killed add 1}
[/else]
[/if]
[/event]
[/else]
[/if]
@ -1201,49 +1440,24 @@
y=22-33
[/filter]
{VARIABLE turn_temp $turn_number}
{VARIABLE_OP turn_temp modulo 15}
[if]
[have_unit]
x=22-26
y=24-27
side=1
x=25-40
y=22-33
[filter_location]
[not]
time_of_day=lawful
[/not]
[/filter_location]
[/have_unit]
[or]
[have_unit]
x=26-30
y=24-30
x=26-37
y=30-33
side=1
[/have_unit]
[/or]
[or]
[have_unit]
x=30-37
y=24-33
side=1
[/have_unit]
[/or]
[variable]
name=turn_temp
greater_than=4
[/variable]
[variable]
name=turn_temp
less_than=8
[/variable]
[or]
[variable]
name=turn_temp
greater_than=10
[/variable]
[/or]
[or]
[variable]
name=turn_temp
numerical_equals=0
[/variable]
[/or]
#!***Do wraith event***
[then]
@ -1524,22 +1738,6 @@
[/ai]
[/modify_side]
[capture_village]
side=2
x,y=17,7
[/capture_village]
[capture_village]
side=2
x,y=19,10
[/capture_village]
[capture_village]
side=2
x,y=24,10
[/capture_village]
[capture_village]
side=2
x,y=27,7
[/capture_village]
[/event]
@ -1736,198 +1934,6 @@
[/event]
# macro for all hydration effects to all units stored in
# a variable called "affected_unit"
# EFFECT > 0 is dehydration
# EFFECT = 0 is silent rehydration
# EFFECT < 0 is rehydration with notification
#define APPLY_HYDRATION_EFFECT EFFECT
{FOREACH affected_unit i}
{VARIABLE effect {EFFECT}}
{VARIABLE thirst $affected_unit[$i].variables.dehydration}
{VARIABLE hp_to_regain 0}
# are we dehydrating or rehydrating?
[if]
[variable]
name=effect
greater_than=0
[/variable]
[then]
{VARIABLE_OP thirst add 1}
{VARIABLE green -30}
{VARIABLE_OP green multiply $thirst}
{VARIABLE_OP green add 280}
[if]
[variable]
name=green
less_than=0
[/variable]
[then]
{VARIABLE green 0}
[/then]
[/if]
{VARIABLE red 250}
{VARIABLE blue 52}
[/then]
[else]
# rehydrate
{VARIABLE hp_to_regain $thirst}
{VARIABLE_OP hp_to_regain multiply 2}
{VARIABLE red 170}
{VARIABLE green 230}
{VARIABLE blue 245}
[if]
[variable]
name=hp_to_regain
#ifdef EASY
greater_than=8
#else
greater_than=4
#endif
[/variable]
[then]
#ifdef EASY
{VARIABLE hp_to_regain 8}
#else
{VARIABLE hp_to_regain 4}
#endif
[/then]
[/if]
# make rehydrate silent if the unit isn't
# suffering dehydration
[if]
[variable]
name=thirst
less_than=1
[/variable]
[then]
{VARIABLE effect 0}
[/then]
[/if]
{VARIABLE thirst 0}
[/else]
[/if]
# modify attacks
{FOREACH affected_unit[$i].attack j}
[if]
[variable]
name=affected_unit[$i].attack[$j].range
equals=melee
[/variable]
[then]
{VARIABLE damage_multiplier 10}
[/then]
[else]
{VARIABLE damage_multiplier 20}
[/else]
[/if]
{VARIABLE damage_divisor $damage_multiplier}
{VARIABLE_OP damage_multiplier add -$thirst}
# store real_damage
[if]
[variable]
name=affected_unit[$i].attack[$j].real_damage
greater_than=0
[/variable]
[else]
{VARIABLE affected_unit[$i].attack[$j].real_damage $affected_unit[$i].attack[$j].damage}
[/else]
[/if]
{VARIABLE new_damage $affected_unit[$i].attack[$j].real_damage}
{VARIABLE_OP new_damage multiply $damage_multiplier}
{VARIABLE_OP new_damage divide $damage_divisor}
[if]
[variable]
name=new_damage
less_than=1
[/variable]
[then]
{VARIABLE new_damage 1}
[/then]
[/if]
{VARIABLE affected_unit[$i].attack[$j].damage $new_damage}
{NEXT j}
# adjust current hp
[if]
[variable]
name=thirst
greater_than=0
[/variable]
[then]
{VARIABLE_OP affected_unit[$i].hitpoints add -$dehydration_loss}
{VARIABLE_OP affected_unit[$i].max_hitpoints add -$dehydration_loss}
{VARIABLE affected_unit[$i].variables.dehydration $thirst}
[/then]
[else]
#ifdef HARD
#else
{VARIABLE_OP affected_unit[$i].hitpoints add $hp_to_regain}
#endif
{VARIABLE affected_unit[$i].max_hitpoints $affected_unit[$i].variables.max_hitpoints}
{VARIABLE affected_unit[$i].variables.dehydration 0}
[/else]
[/if]
{VARIABLE hp_check $affected_unit[$i].hitpoints}
# check hp
[if]
[variable]
name=hp_check
less_than=1
[/variable]
[then]
{VARIABLE affected_unit[$i].hitpoints 1}
[/then]
[/if]
[if]
[variable]
name=effect
greater_than=0
[/variable]
[then]
[unstore_unit]
variable=affected_unit[$i]
find_vacant=no
red,green,blue=$red,$green,$blue
text= _ "thirst"
[/unstore_unit]
[/then]
[else]
[if]
[variable]
name=effect
not_equals=0
[/variable]
[then]
[unstore_unit]
variable=affected_unit[$i]
find_vacant=no
red,green,blue=$red,$green,$blue
text= _ "refreshed"
[/unstore_unit]
[/then]
[else]
# silent unstore
[unstore_unit]
variable=affected_unit[$i]
find_vacant=no
[/unstore_unit]
[/else]
[/if]
[/else]
[/if]
{NEXT i}
{CLEAR_VARIABLE hp_check}
{CLEAR_VARIABLE thirst}
{CLEAR_VARIABLE hp_to_regain}
{CLEAR_VARIABLE damage_multiplier}
{CLEAR_VARIABLE damage_divisor}
{CLEAR_VARIABLE new_damage}
{CLEAR_VARIABLE green}
{CLEAR_VARIABLE red}
{CLEAR_VARIABLE blue}
#enddef
# store full_hitpoints at start, recruit and on advance
[event]
name=start
@ -2325,7 +2331,7 @@
[/filter_adjacent_location]
[/have_location]
[else]
{RANDOM_TRAIT_UNIT 4 "Ghost" $spawn[$random].x $spawn[$random].y "Lost Soul" (role="Lost Soul")}
{RANDOM_TRAIT_UNIT 4 "Ghost" $spawn[$random].x $spawn[$random].y "Lost Soul" (role="LostSoul")}
{VARIABLE_OP ghosts_already_spawned add 1}
[/else]
[/if]