Completely rework how the orc ambushers work in Crossroads.
Now they are pre-placed (randomly) on the map, and remain hidden and immobile until stumbled upon (just like woses and other real ambushers). The gameplay effect is that ambushes can now happen at any time during movement across hills, not only when ending movement there. Needs balance-checking.
This commit is contained in:
parent
628789a4f8
commit
a7606df535
1 changed files with 218 additions and 196 deletions
|
@ -131,9 +131,11 @@
|
|||
[/avoid]
|
||||
{ATTACK_DEPTH 5 5 5}
|
||||
[/ai]
|
||||
[/side]
|
||||
|
||||
{STARTING_VILLAGES 1 10}
|
||||
[village]
|
||||
x,y=3,5
|
||||
[/village]
|
||||
[/side]
|
||||
|
||||
#define CROSSROADS_AI_PARAMS
|
||||
[ai]
|
||||
|
@ -170,6 +172,8 @@
|
|||
{CROSSROADS_AI_PARAMS}
|
||||
[/side]
|
||||
|
||||
{STARTING_VILLAGES 2 18}
|
||||
|
||||
[side]
|
||||
type=Orcish Warrior
|
||||
description=Mokho Kimer
|
||||
|
@ -182,148 +186,13 @@
|
|||
{GOLD 40 90 150}
|
||||
team_name=orcs
|
||||
{CROSSROADS_AI_PARAMS}
|
||||
|
||||
[village]
|
||||
x,y=39,27
|
||||
[/village]
|
||||
[/side]
|
||||
|
||||
{STARTING_VILLAGES 2 12}
|
||||
{STARTING_VILLAGES_AREA 2 18 7 4}
|
||||
|
||||
#define TRAP1 NUM
|
||||
{RANDOM $random_string}
|
||||
{VARIABLE_OP trapx{NUM} to_variable possible_ambush_locations[$random].x}
|
||||
{VARIABLE_OP trapy{NUM} to_variable possible_ambush_locations[$random].y}
|
||||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
side=1
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
[/filter]
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Orcish Archer
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Orcish Grunt
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
#ifdef HARD
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=2
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Orcish Archer
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
#endif
|
||||
[print]
|
||||
text=_"Ambushed!"
|
||||
red,green,blue=255,0,0
|
||||
size=32
|
||||
[/print]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=victory
|
||||
{CLEAR_VARIABLE (trapx{NUM})}
|
||||
{CLEAR_VARIABLE (trapy{NUM})}
|
||||
[/event]
|
||||
#enddef
|
||||
|
||||
#define TRAP2 NUM
|
||||
{RANDOM $random_string}
|
||||
{VARIABLE_OP trapx{NUM} to_variable possible_ambush_locations[$random].x}
|
||||
{VARIABLE_OP trapy{NUM} to_variable possible_ambush_locations[$random].y}
|
||||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
side=1
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
[/filter]
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Wolf Rider
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Troll Whelp
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
#ifdef NORMAL
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Orcish Archer
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
#endif
|
||||
#ifdef HARD
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Orcish Archer
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
|
||||
[unit]
|
||||
generate_description=yes
|
||||
side=3
|
||||
x=$trapx{NUM}
|
||||
y=$trapy{NUM}
|
||||
type=Troll Whelp
|
||||
[modifications]
|
||||
{TRAIT_LOYAL}
|
||||
[/modifications]
|
||||
[/unit]
|
||||
#endif
|
||||
[print]
|
||||
text=_"Ambushed!"
|
||||
red,green,blue=255,0,0
|
||||
size=32
|
||||
[/print]
|
||||
[/event]
|
||||
[event]
|
||||
name=victory
|
||||
{CLEAR_VARIABLE (trapx{NUM})}
|
||||
{CLEAR_VARIABLE (trapy{NUM})}
|
||||
[/event]
|
||||
#enddef
|
||||
|
||||
{STARTING_VILLAGES 3 20}
|
||||
{STARTING_VILLAGES 3 17}
|
||||
|
||||
#signs at the crossroads for decoration
|
||||
{PLACE_IMAGE scenery/signpost.png 16 16}
|
||||
|
@ -351,65 +220,220 @@
|
|||
[/event]
|
||||
|
||||
[event]
|
||||
name=start
|
||||
[store_locations]
|
||||
x=13-35,1-35
|
||||
y=3-16,17-30
|
||||
terrain=Hh, Gg^Vh, Mm
|
||||
variable=possible_ambush_locations
|
||||
[/store_locations]
|
||||
{VARIABLE_OP last_possibility to_variable possible_ambush_locations.length}
|
||||
{VARIABLE_OP last_possibility add -1}
|
||||
{VARIABLE_OP random_string format 0..$last_possibility}
|
||||
name=prestart
|
||||
|
||||
# Here we set up an array that holds the possible ambusher unit types.
|
||||
# We do this instead of just using a random type when creating the
|
||||
# ambusher so that the even distribution of different types is
|
||||
# guaranteed. For now, Orcish Archer is listed twice, so they appear
|
||||
# more often than the other types.
|
||||
|
||||
{VARIABLE random_ambusher_type_table[0].type "Orcish Grunt"}
|
||||
{VARIABLE random_ambusher_type_table[1].type "Orcish Archer"}
|
||||
{VARIABLE random_ambusher_type_table[2].type "Orcish Archer"}
|
||||
{VARIABLE random_ambusher_type_table[3].type "Orcish Assassin"}
|
||||
{VARIABLE random_ambusher_type_table[4].type "Goblin Spearman"}
|
||||
|
||||
{VARIABLE random_ambusher_type_i 0}
|
||||
|
||||
# With this macro we place a set number of ambushers (from the above list) to a
|
||||
# given rectangular area. We do this in blocks so that we can guarantee that
|
||||
# every major area has at least some ambushers: if we randomized the ambush
|
||||
# locations across all possible locations at once, the RNG could theoretically
|
||||
# clump all the ambushers into a single corner of the map.
|
||||
|
||||
#define ORC_AMBUSH_AREA SIDE X Y NUMBER
|
||||
# Any hill that's completely surrounded by other hills, mountains or
|
||||
# forest is eligible as an ambush location.
|
||||
|
||||
[store_locations]
|
||||
x,y={X},{Y}
|
||||
terrain=Hh
|
||||
|
||||
[not]
|
||||
[filter_adjacent_location]
|
||||
[not]
|
||||
terrain=Hh*,Mm*,Gs^Fp
|
||||
[/not]
|
||||
[/filter_adjacent_location]
|
||||
[/not]
|
||||
|
||||
variable=possible_ambush_locations
|
||||
[/store_locations]
|
||||
|
||||
{VARIABLE ambusher 0}
|
||||
|
||||
[while]
|
||||
[variable]
|
||||
name=ambusher
|
||||
less_than={NUMBER}
|
||||
[/variable]
|
||||
|
||||
[do]
|
||||
{RANDOM 0..$possible_ambush_locations.length}
|
||||
|
||||
# Check if the random location picked already contains an ambusher
|
||||
# and if it does, we loop again to pick another one until an empty
|
||||
# one is found.
|
||||
|
||||
[if]
|
||||
[have_unit]
|
||||
x,y=$possible_ambush_locations[$random].x,$possible_ambush_locations[$random].y
|
||||
[/have_unit]
|
||||
|
||||
[else]
|
||||
# random_ambusher_type_i is just a counter variable with
|
||||
# which we point to a given element of the
|
||||
# random_ambusher_type_table array. Here we make it loop
|
||||
# over the array continuously.
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=random_ambusher_type_i
|
||||
less_than=4
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{VARIABLE_OP random_ambusher_type_i add 1}
|
||||
[/then]
|
||||
|
||||
[else]
|
||||
{VARIABLE random_ambusher_type_i 0}
|
||||
[/else]
|
||||
[/if]
|
||||
|
||||
# And here we place an ambusher of a type specified by the
|
||||
# random_ambusher_type_table and random_ambusher_type_i
|
||||
# variables, thus always having the same ratio of different
|
||||
# types.
|
||||
|
||||
[unit]
|
||||
x,y=$possible_ambush_locations[$random].x,$possible_ambush_locations[$random].y
|
||||
type=$random_ambusher_type_table[$random_ambusher_type_i].type
|
||||
side={SIDE}
|
||||
facing=sw
|
||||
role=ambusher
|
||||
random_traits=yes
|
||||
|
||||
[status]
|
||||
hides=yes
|
||||
[/status]
|
||||
[/unit]
|
||||
|
||||
[object]
|
||||
silent=yes
|
||||
|
||||
[filter]
|
||||
x,y=$possible_ambush_locations[$random].x,$possible_ambush_locations[$random].y
|
||||
[/filter]
|
||||
|
||||
[effect]
|
||||
apply_to=new_ability
|
||||
|
||||
[abilities]
|
||||
[hides]
|
||||
id=orc_ambush
|
||||
affect_self=yes
|
||||
|
||||
[filter_self]
|
||||
role=ambusher
|
||||
|
||||
[filter_location]
|
||||
terrain=Hh,Mm
|
||||
[/filter_location]
|
||||
[/filter_self]
|
||||
[/hides]
|
||||
[/abilities]
|
||||
[/effect]
|
||||
[/object]
|
||||
|
||||
{VARIABLE_OP ambusher add 1}
|
||||
[/else]
|
||||
[/if]
|
||||
[/do]
|
||||
[/while]
|
||||
#enddef
|
||||
|
||||
# Only the number of ambushers differs by difficulty here.
|
||||
|
||||
#ifdef EASY
|
||||
{ORC_AMBUSH_AREA 2 5-35 1-7 5}
|
||||
{ORC_AMBUSH_AREA 2 9-24 8-15 5}
|
||||
{ORC_AMBUSH_AREA 3 1-17 17-24 9}
|
||||
{ORC_AMBUSH_AREA 3 18-26 16-23 5}
|
||||
{ORC_AMBUSH_AREA 3 26-40 16-23 5}
|
||||
#endif
|
||||
#ifdef NORMAL
|
||||
{ORC_AMBUSH_AREA 2 5-35 1-7 6}
|
||||
{ORC_AMBUSH_AREA 2 9-24 8-15 6}
|
||||
{ORC_AMBUSH_AREA 3 1-17 17-24 10}
|
||||
{ORC_AMBUSH_AREA 3 18-26 16-23 6}
|
||||
{ORC_AMBUSH_AREA 3 26-40 16-23 6}
|
||||
#endif
|
||||
#ifdef HARD
|
||||
{ORC_AMBUSH_AREA 2 5-35 1-7 7}
|
||||
{ORC_AMBUSH_AREA 2 9-24 8-15 7}
|
||||
{ORC_AMBUSH_AREA 3 1-17 17-24 11}
|
||||
{ORC_AMBUSH_AREA 3 18-26 16-23 7}
|
||||
{ORC_AMBUSH_AREA 3 26-40 16-23 7}
|
||||
#endif
|
||||
|
||||
{CLEAR_VARIABLE possible_ambush_locations}
|
||||
{CLEAR_VARIABLE random_ambusher_type_table}
|
||||
{CLEAR_VARIABLE random_ambusher_type_i}
|
||||
{CLEAR_VARIABLE ambusher}
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=ai turn
|
||||
first_time_only=no
|
||||
|
||||
#25 ambushes total
|
||||
{TRAP1 0}
|
||||
{TRAP2 1}
|
||||
{TRAP1 2}
|
||||
{TRAP2 3}
|
||||
[if]
|
||||
[variable]
|
||||
name=warlord_count
|
||||
numerical_equals=3
|
||||
name=side_number
|
||||
equals=2
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{MODIFY_UNIT side,role=2,ambusher moves 0}
|
||||
[/then]
|
||||
[else]
|
||||
{TRAP1 4}
|
||||
{TRAP2 5}
|
||||
{TRAP1 6}
|
||||
{TRAP2 7}
|
||||
{TRAP1 8}
|
||||
{TRAP2 9}
|
||||
{TRAP1 10}
|
||||
{TRAP2 11}
|
||||
{TRAP1 12}
|
||||
{TRAP2 13}
|
||||
[if]
|
||||
[variable]
|
||||
name=warlord_count
|
||||
numerical_equals=2
|
||||
[/variable]
|
||||
[then]
|
||||
[/then]
|
||||
[else]
|
||||
{TRAP1 14}
|
||||
{TRAP2 15}
|
||||
{TRAP1 16}
|
||||
{TRAP2 17}
|
||||
{TRAP1 18}
|
||||
{TRAP2 19}
|
||||
{TRAP1 20}
|
||||
{TRAP2 21}
|
||||
{TRAP1 22}
|
||||
{TRAP2 23}
|
||||
{TRAP1 24}
|
||||
[/else]
|
||||
[/if]
|
||||
[/else]
|
||||
[/if]
|
||||
{CLEAR_VARIABLE warlord_count}
|
||||
{CLEAR_VARIABLE possible_ambush_locations}
|
||||
|
||||
[if]
|
||||
[variable]
|
||||
name=side_number
|
||||
equals=3
|
||||
[/variable]
|
||||
|
||||
[then]
|
||||
{MODIFY_UNIT side,role=3,ambusher moves 0}
|
||||
[/then]
|
||||
[/if]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
name=moveto
|
||||
first_time_only=no
|
||||
|
||||
[filter]
|
||||
side=1
|
||||
|
||||
[filter_adjacent]
|
||||
side=2,3
|
||||
role=ambusher
|
||||
[/filter_adjacent]
|
||||
[/filter]
|
||||
|
||||
{MODIFY_UNIT (
|
||||
side=2,3
|
||||
role=ambusher
|
||||
|
||||
[filter_adjacent]
|
||||
x,y=$x1,$y1
|
||||
[/filter_adjacent]
|
||||
) role not_ambusher}
|
||||
|
||||
[redraw][/redraw]
|
||||
[/event]
|
||||
|
||||
[event]
|
||||
|
@ -498,8 +522,6 @@ SE - Fort Tahn"
|
|||
description=Konrad
|
||||
message= _ "Victory is ours, men. Let us proceed northeast!"
|
||||
[/message]
|
||||
{CLEAR_VARIABLE last_possibility}
|
||||
{CLEAR_VARIABLE random_string}
|
||||
[/event]
|
||||
|
||||
{campaigns/Heir_To_The_Throne/utils/deaths.cfg}
|
||||
|
|
Loading…
Add table
Reference in a new issue