Refactor the branching logic.

In Tidings Good and Ill Gerrick now gets to recruit his own elf
escorts, and any recallable ones he doesn't recall remain with
Deoran. Will need to be tested more thorougly and also the army
mergings in the final scenario(s) need to be fixed accordingly.
This commit is contained in:
Lari Nieminen 2007-09-09 10:37:37 +00:00
parent 13276efebb
commit 4315900c79
4 changed files with 100 additions and 175 deletions

View file

@ -20,7 +20,6 @@ Hh , Hh , Hh , Mm , Hh , Hh
Hh , Mm , Mm , Mm , Hh , Gs^Fp , Rd , Gs^Fp , Ww , Ds , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Gs^Fp , Hh , Gs^Fp , Hh , Hh
Hh , Mm , Mm , Mm , Hh , Rd , Gs^Fp , Gs^Fp , Ww , Ds , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Rd , Gs^Fp , Gs^Fp , Gs^Fp , Hh
Mm , Mm , Mm , Hh , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ww , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Rd , Gs^Fp , Gs^Fp , Gs^Fp
Mm , Hh , Hh , Hh , Gs^Fp , Hh , Gs^Fp , Ww , Ww , Hh , Hh , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Rd , Gs^Fp , Gs^Fp , Gs^Fp
Hh , Gs^Fp , Hh , Gs^Fp , Hh , Gs^Fp , Gs^Fp , Ww , Hh , Gs^Fp , Hh , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , 1 Gs^Fp , Gg , Gg , Gs^Fp , Gs^Fp
Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ww , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Gs^Fp , Gs^Fp , Gs^Fp , Rd , Gs^Fp , Gs^Fp
Mm , Hh , Hh , Hh , Gs^Fp , Hh , Gs^Fp , Ww , Ww , Hh , Hh , Gs^Fp , Gs^Fp , Ce , Gs^Fp , 1 Ke , Rd , Gs^Fp , Gs^Fp , Gs^Fp
Hh , Gs^Fp , Hh , Gs^Fp , Hh , Gs^Fp , Gs^Fp , Ww , Hh , Gs^Fp , Hh , Gs^Fp , Gs^Fp , Ce , Ce , Ce , Rd , Rd , Gs^Fp , Gs^Fp
Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ww , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ce , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Rd , Gs^Fp , Gs^Fp

View file

@ -131,6 +131,7 @@
description="Mal M'brin"
user_description= _ "Mal M'brin"
profile=portraits/blue-lich.png
facing=sw
team_name=undead
controller=ai
@ -284,7 +285,7 @@
[/filter]
[message]
description=second_unit
speaker=second_unit
message= _ "The master of the undead is defeated!"
[/message]
@ -673,7 +674,9 @@
fire_event=no
[/kill]
sound=lightning.ogg
[sound]
name=lightning.ogg
[/sound]
[if]
[variable]
@ -719,7 +722,7 @@
[/message]
[message]
description=Deoran
image=portraits=deoran-glad.png
image=portraits/deoran-glad.png
message= _ "We should make haste to return to Wesnoth before the harvest. Fall has already been upon us for some time."
[/message]
[message]
@ -728,7 +731,7 @@
[/message]
[message]
description=Deoran
image=portraits=deoran-sad.png
image=portraits/deoran-sad.png
message= _ "My men are not dwarves! How are we to fight in catacombs and tunnels?"
[/message]
[message]
@ -747,27 +750,6 @@
description=Sir Gerrick
message= _ "Fare well, Deoran! I will be there to greet you when you return to Kerlath Province."
[/message]
[store_unit]
variable=Sir_Gerrick_Store
[filter]
description=Sir Gerrick
[/filter]
kill=yes
[/store_unit]
[store_unit]
variable=elvish_fighters
[filter]
type=Elvish Fighter, Elvish Captain, Elvish Hero, Elvish Champion, Elvish Marshall
[/filter]
kill=yes
[/store_unit]
[store_unit]
variable=elvish_healers
[filter]
type=Elvish Shaman
[/filter]
kill=yes
[/store_unit]
[endlevel]
result=victory
next_scenario=6a_Tidings_Good_And_Ill

View file

@ -29,13 +29,14 @@
turns=18
victory_when_enemies_defeated=no
# Sir Gerrick's Men
# Sir Gerrick's Men. Deoran, Ethiliel and her bodyguards will be removed in
# a prestart event.
[side]
side=1
type=Elvish Ranger
description=Ithelden
user_description= _ "Ithelden"
type=Horseman Commander
description=Deoran
user_description= _ "Deoran"
unrenamable=yes
team_name=South_Guard
@ -96,145 +97,68 @@
[event]
name=prestart
[store_unit]
[filter]
description=Deoran
[/filter]
kill=yes
variable=stored_Deoran
[/store_unit]
[store_unit]
[filter]
side=1
[not]
description=Sir Gerrick
[/not]
[not]
race=elf
[not]
description=Ethiliel
[/not]
[not]
description=Elvish Bodyguard
[/not]
[/not]
[/filter]
kill=yes
variable=stored_Deoran_army
[/store_unit]
[recall]
description=Sir Gerrick
x,y=16,23
[/recall]
{MODIFY_UNIT (description=Sir Gerrick) canrecruit 1}
[set_recruit]
side=1
recruit=Elvish Fighter,Elvish Shaman
[/set_recruit]
# Add the target location for Sir Gerrick to move to.
{PLACE_IMAGE (items/gohere.png) 9 1}
# Switch the leader from Ithelden to Sir Gerrick
# Thanks to "shade" for help with this!
[store_unit]
variable=leader_store
[filter]
description=Ithelden
[/filter]
kill=yes
[/store_unit]
{VARIABLE leader_store.canrecruit 0}
[unstore_unit]
variable=leader_store
[/unstore_unit]
{VARIABLE Sir_Gerrick_Store.x 17}
{VARIABLE Sir_Gerrick_Store.y 24}
{VARIABLE Sir_Gerrick_Store.canrecruit 1}
[unstore_unit]
variable=Sir_Gerrick_Store
[/unstore_unit]
{CLEAR_VARIABLE Sir_Gerrick_Store}
# Recall up to four elvish fighters and three elvish shamans
# This is an ugly hack, and I need to figure out how to do it right,
# but for the life of me, I can't get setting their x and y positions
# to the results of a [store_starting_location] to work.
{FOREACH elvish_fighters X}
[if]
[variable]
name=X
less_than=4
[/variable]
[then]
{VARIABLE elvish_fighters[$X].x 16}
{VARIABLE elvish_fighters[$X].y 24}
{VARIABLE elvish_fighters[$X].moves 5}
[unstore_unit]
variable=elvish_fighters[$X]
find_vacant=yes
[/unstore_unit]
{VARIABLE elves_recalled "yes"}
[/then]
[/if]
{NEXT X}
{CLEAR_VARIABLE elvish_fighters}
{FOREACH elvish_healers X}
[if]
[variable]
name=X
less_than=4
[/variable]
[then]
{VARIABLE elvish_healers[$X].x 16}
{VARIABLE elvish_healers[$X].y 24}
{VARIABLE elvish_healers[$X].moves 5}
[unstore_unit]
variable=elvish_healers[$X]
find_vacant=yes
[/unstore_unit]
{VARIABLE elves_recalled "yes"}
[/then]
[/if]
{NEXT X}
{CLEAR_VARIABLE elvish_healers}
{FULL_HEAL side=1}
# Fallback. If user has no surviviving elves,
# give him some.
[if]
[not]
[variable]
name=elves_recalled
equals="yes"
[/variable]
[/not]
[then]
[unit]
side=1
type=Elvish Hero
x=15
y=25
description=Thirian
user_description= _ "Thirian"
upkeep=full
animate=yes
[/unit]
[unit]
side=1
type=Elvish Fighter
x=15
y=24
description=Ardolan
user_description= _ "Ardolan"
upkeep=full
animate=yes
[/unit]
[unit]
side=1
type=Elvish Archer
x=16
y=23
description=Nyldar
user_description= _ "Nyldar"
upkeep=full
animate=yes
[/unit]
[unit]
side=1
type=Elvish Shaman
x=14
y=25
description=Lirané
user_description= _ "Lirané"
upkeep=full
animate=yes
[/unit]
[unit]
side=1
type=Elvish Shaman
x=14
y=25
description=Elendra
user_description= _ "Elendra"
upkeep=full
animate=yes
[/unit]
[/then]
[/if]
[unit]
type=Elvish Ranger
description=Ithelden
user_description= _ "Ithelden"
x,y=17,22
facing=sw
side=1
[modifications]
{TRAIT_LOYAL}
[/modifications]
[/unit]
[/event]
#start
@ -244,7 +168,7 @@
[message]
speaker=Ithelden
message= _ "Sir Gerrick, you must make it back to Kerlath Province and warn your people of the danger from the south. We will lead you through the forest and clear any foes from your path."
message= _ "Sir Gerrick, you must make it back to Kerlath Province and warn your people of the danger from the south. We will lead you through the forest and clear any foes from your path. You may choose some of our veterans to go with you as well, and any ones you leave behind will still have time to catch up with Ethiliel and Deoran."
[/message]
[message]
speaker=Sir Gerrick
@ -450,13 +374,23 @@
[/message]
[store_unit]
variable=sir_gerrick_store
variable=stored_Sir_Gerrick_army
[filter]
description=Sir Gerrick
side=1
x,y=1-99,1-99
[/filter]
kill=yes
[/store_unit]
{VARIABLE stored_Deoran.x 16}
{VARIABLE stored_Deoran.y 23}
[unstore_unit]
variable=stored_Deoran
[/unstore_unit]
{CLEAR_VARIABLE stored_Deoran}
[endlevel]
bonus=no
result=continue

View file

@ -23,7 +23,8 @@
victory_when_enemies_defeated=no
{TURNS 50 40 36}
# The South Guard
# The South Guard. Deoran and his army will be unstored in a prestart event,
# which is why there's no leader here.
[side]
side=1
@ -41,9 +42,6 @@
{GOLD 125 100 80}
{INCOME 10 8 6}
canrecruit=1
recruit=Bowman, Spearman, Cavalryman, Elvish Shaman, Elvish Fighter
[/side]
# The Undead Hordes
@ -124,6 +122,16 @@
[event]
name=prestart
{FOREACH stored_Deoran_army i}
{VARIABLE stored_Deoran_army[$i].x "recall"}
{VARIABLE stored_Deoran_army[$i].y "recall"}
[unstore_unit]
variable=stored_Deoran_army[$i]
[/unstore_unit]
{NEXT i}
[recall]
description=Ethiliel
[/recall]
@ -484,6 +492,8 @@
speaker="Mal M'Brin"
message= _ "Foolish boy! you do not understand. Come closer and I will show you my power. I will end your brief, miserable life. Thereafter, it may amuse me to cause your bones to serve me."
[/message]
[allow_undo][/allow_undo]
[/event]
[event]