Skip to content

Commit

Permalink
Restored a subtler Shaun and Ed easter egg
Browse files Browse the repository at this point in the history
  • Loading branch information
ln-zookeeper committed Dec 27, 2014
1 parent 47498d9 commit 9a1ff1a
Showing 1 changed file with 102 additions and 55 deletions.
157 changes: 102 additions & 55 deletions data/campaigns/Descent_Into_Darkness/scenarios/02_Peaceful_Valley.cfg
Expand Up @@ -162,51 +162,6 @@
[/message]
[/event]

# Generate a random number of guards between 0 and 2 around X,Y
#define RANDOM_GUARDS TYPE NAME_STRING SIDE X Y
{VARIABLE_OP number_of_guards rand "0..2"}

{REPEAT $number_of_guards (
[store_locations]
[filter_adjacent_location]
x,y={X},{Y}
[/filter_adjacent_location]

[not]
[filter]
[/filter]
[/not]

variable=possible_guard_locations
[/store_locations]

{IF_VAR possible_guard_locations.length greater_than 0 (
[then]
{VARIABLE_OP random_location_index rand "0..$possible_guard_locations.length"}

[move_unit_fake]
side={SIDE}
type={TYPE}
x={X},$possible_guard_locations[$random_location_index].x
y={Y},$possible_guard_locations[$random_location_index].y
[/move_unit_fake]

[unit]
name={NAME_STRING} # wmllint: ignore
type={TYPE}
side={SIDE}
x,y=$possible_guard_locations[$random_location_index].x,$possible_guard_locations[$random_location_index].y
random_traits=yes
[/unit]
[/then]
)}
)}

{CLEAR_VARIABLE number_of_guards}
{CLEAR_VARIABLE possible_guard_locations}
{CLEAR_VARIABLE random_location_index}
#enddef

# In-scenario events
[event]
name=capture
Expand All @@ -228,17 +183,110 @@
side=1
[/filter]

{IF_VAR village_$x1|_$y1|_cleared not_equals yes (
[then]
{RANDOM_GUARDS (Goblin Spearman) (_ "Villager") 2 $x1 $y1}
[filter_condition]
[variable]
name=village_$x1|_$y1|_cleared
not_equals=yes
[/variable]
[/filter_condition]

{VARIABLE_OP number_of_guards rand "0..2"}
{VARIABLE guard_i 1}

[while]
[variable]
name=guard_i
less_than_equal_to=$number_of_guards
[/variable]

[do]
[store_locations]
[filter_adjacent_location]
x,y=$x1,$y1
[/filter_adjacent_location]

{VARIABLE village_$x1|_$y1|_cleared yes}
[not]
[filter]
[/filter]
[/not]

variable=possible_guard_locations
[/store_locations]

{IF_VAR possible_guard_locations.length greater_than 0 (
[then]
{VARIABLE_OP random_location_index rand "0..$($possible_guard_locations.length - 1)"}

[move_unit_fake]
side=2
type=Goblin Spearman
x=$x1,$possible_guard_locations[$random_location_index].x
y=$y1,$possible_guard_locations[$random_location_index].y
[/move_unit_fake]

[unit]
id=guard_$x1|_$y1|_$guard_i
name= _ "Villager"
type=Goblin Spearman
side=2
x,y=$possible_guard_locations[$random_location_index].x,$possible_guard_locations[$random_location_index].y
random_traits=yes
[/unit]
[/then]
)}

{VARIABLE_OP guard_i add 1}
[/do]
[/while]

{VARIABLE village_$x1|_$y1|_cleared yes}

# Trigger an easter egg sometime after a third of villages have been taken
[if]
[variable]
name=done_shaun
not_equals=yes
[/variable]
[variable]
name=number_of_guards
numerical_equals=2
[/variable]
[have_location]
owner_side=1
count=4-99
[/have_location]

# Make sure the guards actually exist, in case there was no space for them
[have_unit]
id=guard_$x1|_$y1|_1
[/have_unit]
[have_unit]
id=guard_$x1|_$y1|_2
[/have_unit]

[then]
[modify_unit]
[filter]
id=guard_$x1|_$y1|_1
[/filter]
#po: Shaun and Ed are characters from the zombie film "Shaun of the Dead".
#po: If the names cannot be translated into your language so that the
#po: movie reference remains recognizable, then simply translate these the
#po: same as "Villager" above.
name= _ "Shaun"
[/modify_unit]
[modify_unit]
[filter]
id=guard_$x1|_$y1|_2
[/filter]
name= _ "Ed"
[/modify_unit]

{VARIABLE done_shaun yes}
[/then]
[/if]

[else]
[allow_undo][/allow_undo]
[/else]
)}
{CLEAR_VARIABLE number_of_guards,guard_i,possible_guard_locations,random_location_index}
[/event]

[event]
Expand Down Expand Up @@ -385,7 +433,6 @@
{CLEAR_VARIABLE $village_var}
{NEXT i}

{CLEAR_VARIABLE villages}
{CLEAR_VARIABLE village_var}
{CLEAR_VARIABLE villages,village_var,done_shaun}
[/event]
[/scenario]

0 comments on commit 9a1ff1a

Please sign in to comment.