Skip to content

Commit

Permalink
NR: Fix Krash resurrection bug
Browse files Browse the repository at this point in the history
After changes in 618659c, the leader keys in Krash's side caused him
to be reborn if he was killed in the previous scenario for S11a-S13a.

[ci skip]
  • Loading branch information
sigurdfdragon committed Mar 8, 2018
1 parent 35d32a0 commit 673e33b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
Expand Up @@ -130,7 +130,7 @@
[/side]

# Krash may not actually still be alive at this point, but setting up
# his side this way is the only way to reliasbly pick up his recall
# his side this way is the only way to reliably pick up his recall
# list if he is.
[side]
side=7
Expand All @@ -141,11 +141,7 @@
{GOLD 250 200 150}
team_name=knalgans
user_team_name= _ "Alliance"

type=Drake Burner
id=Krash
name= _ "Krash"
canrecruit=yes
no_leader=yes
[/side]

{STARTING_VILLAGES 1 6}
Expand All @@ -154,6 +150,7 @@
[event]
name=prestart

{RECALL_KRASH}
[if]
[not]
[have_unit]
Expand Down
Expand Up @@ -251,11 +251,7 @@
{GOLD 250 200 150}
team_name=knalgans
user_team_name= _ "Alliance"

type=Drake Burner
id=Krash
name= _ "Krash"
canrecruit=yes
no_leader=yes
[/side]

# Empty side - player will assume control of it if Eryssa is alive
Expand All @@ -279,6 +275,7 @@
{VARIABLE path_get_the_gold yes}

# Here’s where we edit out Krash's side if he's dead.
{RECALL_KRASH}
[if]
[not]
[have_unit]
Expand Down
20 changes: 13 additions & 7 deletions data/campaigns/Northern_Rebirth/scenarios/13a_Showdown.cfg
Expand Up @@ -283,18 +283,17 @@
# list if he is. Later, we'll edit in another leader if he's dead.
[side]
side=7
type=Drake Burner
id=Krash
name= _ "Krash"
canrecruit=yes
save_id=Krash
side_name= _ "Krash"
gold=100
recruit=Drake Fighter,Drake Glider,Drake Burner,Drake Clasher
team_name=knalgans
user_team_name=_"Alliance"
controller=human
no_leader=yes
defeat_condition=never
[/side]
# STARTING_VILLAGES works due to defeat_condition & having a starting location
{STARTING_VILLAGES 7 10}

# Allied AI
Expand Down Expand Up @@ -353,9 +352,8 @@
name=prestart

# Check if Krash is alive, if yes place him at helm of side 7,
# otherwise it's taken over by older lich. We can't use a normal
# recall followed by have_unit test here because we had to declare
# Krash as a side leader in order to get recall list carryover.
# otherwise it's taken over by older lich.
{RECALL_KRASH}
[recall]
id="Ro'Arthian"
[/recall]
Expand Down Expand Up @@ -386,6 +384,10 @@
variable=place_lich_at
[/unstore_unit]
{UNMAKE_HERO "Ro'Arthian"}
[kill]
side=7
race=drake
[/kill]
[disallow_recruit]
side=7
type=Drake Fighter,Drake Glider,Drake Burner,Drake Clasher
Expand All @@ -401,6 +403,10 @@
{CLEAR_VARIABLE place_lich_at}
[/then]
[/if]
[modify_side]
side=7
defeat_condition=no_leader_left
[/modify_side]

# Hide unit for spectacular entrance
[hide_unit]
Expand Down
28 changes: 28 additions & 0 deletions data/campaigns/Northern_Rebirth/utils/utils.cfg
Expand Up @@ -55,6 +55,34 @@
[/if]
#enddef

#define RECALL_KRASH
# In S11a-13a Krash starts as the leader of a side if he is alive. He is not
# defined in the corresponding side tags for these scenarios, since if he is,
# that would cause Krash to be reborn if he was dead. Since [recall] requires
# a leader on the map, do this to get him off of his recall list without one.
[store_unit]
[filter]
id=Krash
[/filter]
variable=krash
kill=yes
[/store_unit]
[if]
{VARIABLE_CONDITIONAL krash.id equals Krash}
[then]
[store_starting_location]
side=$krash.side
variable=start_loc
[/store_starting_location]
[unstore_unit]
variable=krash
x,y=$start_loc.x,$start_loc.y
[/unstore_unit]
[/then]
[/if]
{CLEAR_VARIABLE krash,start_loc}
#enddef

#define STORY_PART_HAMEL SPEECH_STRING
{STORY_PART_SPEECH portraits/Hamel.png (_ "Hamel") {SPEECH_STRING} }
#enddef
Expand Down

0 comments on commit 673e33b

Please sign in to comment.