@BEGINEVENTS
@INITFLAG

; Victory Conditions

@IF
CITYTAKEN
city=Minas Tirith
attacker=Anybody
defender=Gondor
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=on
flag=31
@ENDIF

@IF 
CITYTAKEN
city=Minas Tirith
attacker=Gondor
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=off
flag=31
@ENDIF

@IF
CITYTAKEN
city=Lothlorien
attacker=Anybody
defender=Elves
@THEN
TEXT
Lothlorien falls to the enemy, many of the elves in their dispair decide to forsake middle earth
forever and flee over the sea !
ENDTEXT
FLAG
CONTINUOUS
who=Haradrim
state=on
flag=30
@ENDIF

@IF 
CITYTAKEN
city=Lothlorien
attacker=Elves
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=off
flag=30
@ENDIF

@IF
CITYTAKEN
city=Edoras
attacker=Anybody
defender=Rohirrim
@THEN
TEXT
Edoras has fallen ! Theoden and his people retreat into the hills and vow to fight on !
ENDTEXT
FLAG
CONTINUOUS
who=Haradrim
state=on
flag=29
@ENDIF

@IF
CITYTAKEN
city=Edoras
attacker=Rohirrim
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=off
flag=29
@ENDIF

@IF
CITYTAKEN
city=Erebor
attacker=Anybody
defender=Dwarves
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=on
flag=28
@ENDIF

@IF
CITYTAKEN
city=Erebor
attacker=Dwarves
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=off
flag=28
@ENDIF

@IF
CHECKFLAG
who=Haradrim
flag=31
state=on
@AND
CHECKFLAG
who=Haradrim
flag=30
state=on
@THEN
FLAG
CONTINUOUS
who=Mordor
state=on
flag=20
@ENDIF

@IF
CHECKFLAG
who=Haradrim
flag=29
state=on
@AND
CHECKFLAG
who=Haradrim
flag=28
state=on
@THEN
FLAG
CONTINUOUS
who=Mordor
state=on
flag=19
@ENDIF

@IF
CHECKFLAG
who=Mordor
flag=20
state=on
@AND
CHECKFLAG
who=Mordor
flag=19
state=on
@THEN
TEXT
The capitals of all the good races have been captured ! There is now not enough resistance to 
prevent Sauron covering middle earth in darkness, the surviving elves flee middle earth while
the dwarves and humans are enslaved, the forces of evil have won !
ENDTEXT
ENDGAME
endscreens=Yes
@ENDIF

@IF
CITYTAKEN
city=Barad-dur
attacker=Anybody
defender=Mordor
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=on
flag=10
@ENDIF

@IF
CITYTAKEN
city=Barad-dur
attacker=Mordor
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=off
flag=10
@ENDIF

@IF
CITYTAKEN
city=Dol Guldur
attacker=Anybody
defender=Mordor
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=on
flag=9
@ENDIF

@IF
CITYTAKEN
city=Dol Guldur
attacker=Mordor
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Haradrim
state=off
flag=9
@ENDIF

@IF
CHECKFLAG
who=Haradrim
flag=10
state=on
@AND
CHECKFLAG
who=Haradrim
flag=9
state=on
@THEN
TEXT
The enemy has been defeated, the dark towers of both Barad-dur and Dol Guldur have been cast down!
Mirkwood is renamed Greenwood and Minas Morgul in Morgul vale is razed to the ground. Ithilien 
becomes the fair land that it once was and Aragorn is crowned king of Gondor, there is much rejoicing 
all over middle earth, the forces of good have won !
ENDTEXT
ENDGAME
endscreens=Yes
@ENDIF


; No negotiations

@IF
NEGOTIATION
talkermask=0b111000011100001110000
listenermask=0b000111100011110001111
@ENDIF

@IF
NEGOTIATION
talkermask=0b000111100011110001111
listenermask=0b111000011100001110000
@ENDIF

@IF
NEGOTIATION
talkermask=0b000110000011000001100
listenermask=0b000001100000110000011
@ENDIF

@IF
NEGOTIATION
talkermask=0b000001100000110000011
listenermask=0b000110000011000001100
@ENDIF

@IF 
NEGOTIATION
talkermask=0b000100000010000001000
listenermask=0b000010000001000000100
@ENDIF

@IF
NEGOTIATION
talkermask=0b000010000001000000100
listenermask=0b000100000010000001000
@ENDIF

@IF
NEGOTIATION
talkermask=0b000000100000010000001
listenermask=0b000001000000100000010
@ENDIF

@IF
NEGOTIATION
talkermask=0b000001000000100000010
listenermask=0b000000100000010000001
@ENDIF

@IF
NEGOTIATION
talkermask=0b100000010000001000000
listenermask=0b011000001100000110000
@ENDIF

@IF
NEGOTIATION
talkermask=0b011000001100000110000
listenermask=0b100000010000001000000
@ENDIF

@IF
NEGOTIATION
talkermask=0b010000001000000100000
listenermask=0b001000000100000010000
@ENDIF

@IF
CITYTAKEN
city=Minas Tirith
attacker=Anybody
defender=Gondor
@THEN
TEXT
Minas Tirith falls ! As the enemy engulfs the city, Denethor burns himself on a pyre in his
dispair!
ENDTEXT
FLAG
CONTINUOUS
who=Gondor
state=on
flag=0
@ENDIF

@IF
CITYTAKEN
city=Minas Tirith
attacker=Gondor
defender=Anybody
@THEN
FLAG
CONTINUOUS
who=Gondor
state=off
flag=0
@ENDIF

; Intro

@IF 
Turn
turn=1
@THEN
Text
The Hobbits lived a quiet peaceful life in their homeland the Shire, the young hobbit
Frodo Baggins lived unaware of the importance of the ring he had inherited from his
uncle Bilbo, one day he received a visit from his old friend Gandalf the wizard who 
revealed to him that the ring was in fact the one long spoken of in ancient Elven verse :
EndText
@ENDIF

@IF 
Turn
turn=1
@THEN
Text
Three Rings for the Elven Kings under the sky...
EndText
@ENDIF

@IF
Turn
turn=1
@THEN
Text
...Seven for the Dwarf Lords in their halls of stone...
EndText
@ENDIF

@IF
Turn
turn=1
@THEN
Text
...Nine for mortal men doomed to die...
EndText
@ENDIF

@IF
Turn
turn=1
@THEN
Text
...One for the dark lord on his dark throne...
EndText
@ENDIF

@IF
Turn
turn=1
@THEN
Text
...in the land of Mordor where the shadows lie...
EndText
@ENDIF

@IF
Turn
turn=1
@THEN
Text
...One ring to rule them all, one ring to find them...
EndText
@ENDIF

@IF
TURN
turn=1
@THEN
Text
...One ring to bring them all and in the darkness bind them...
EndText
@ENDIF

@IF
Turn
turn=1
@THEN
Text
...in the land of Mordor where the shadows lie.
Frodo now finds himself entrusted with an immense task, he will have to take the ring across
the realms of middle earth and throw it into the fire of Mount Doom in the heart of Mordor
where it was created, Gandalf had to leave to take care of urgent business but promised
he would be back soon, he has still not arrived however and Frodo is planning to leave on 
his own...
EndText
@ENDIF

@IF
CITYPRODUCTION
builder=Anybody
improvement=66
@THEN
TEXT
Frodo at last sets out on his journey to destroy the ring, at the same time Gandalf escapes
from Isengard where he was being held captive by his fellow wizard Saruman who has become 
a traitor and rides north as quickly as possible to aid him
ENDTEXT
CREATEUNIT
owner=TriggerReceiver
unit=Ring-bearer
veteran=false
homecity=none
locations
23,40
24,40
25,40
endlocations
FLAG
CONTINUOUS
who=Elves
state=on
flag=0
@ENDIF

@IF
CITYPRODUCTION
builder=Anybody
improvement=66
@THEN
CREATEUNIT
owner=TriggerReceiver
unit=Gandalf
veteran=false
homecity=none
locations
40,70
38,70
42,70
endlocations
@ENDIF

@IF 
TURN
turn=3
@AND
CHECKFLAG
who=Elves
flag=0
state=off
@THEN
BESTOWIMPROVEMENT
improvement=66
race=Gondor
capital=Yes
wonders=Yes
TEXT
Frodo at last sets out on his journey to destroy the ring, at the same time Gandalf escapes
from Isengard where he was being held captive by his fellow wizard Saruman who has become 
a traitor and rides north as quickly as possible to aid him
ENDTEXT
CREATEUNIT
RANDOMIZE
owner=Gondor
unit=Frodo
veteran=false
homecity=none
locations
22,44
24,40
27,43
endlocations
@ENDIF

@IF 
TURN
turn=3
@AND
CHECKFLAG
who=Elves
flag=0
state=off
@THEN
CREATEUNIT
owner=Gondor
unit=Gandalf
veteran=false
homecity=none
locations
40,70
38,70
42,70
endlocations
MOVEUNIT
unit=Frodo
owner=Elves
maprect
23,35
27,35
23,43
27,43
moveto
48,44
numbertomove=All
@ENDIF

@IF
UNITKILLED
unit=Ring-bearer
Map=0
attacker=Anybody
defender=Anybody
@THEN
TEXT
The Ring Bearer has been killed and the ring captured by agents of Sauron ! The ring is taken 
back to Barad-dur. Sauron gains unimaginable power ! Balrogs and Dragons issue forth from 
Mordor ! There is now no way to stop him from covering middle earth in a second darkness.
ENDTEXT
FLAG
CONTINUOUS
who=Mordor
state=on
flag=0
GIVETECHNOLOGY
technology=7
receiver=Mordor
@ENDIF

@IF
UNITKILLED
unit=Frodo
Map=0
attacker=Anybody
defender=Anybody
@THEN
TEXT
The Ring Bearer has been killed and the ring captured by agents of Sauron ! The ring is taken 
back to Barad-dur. Sauron gains unimaginable power ! Balrogs and Dragons issue forth from 
Mordor ! There is now no way to stop him from covering middle earth in a second darkness.
ENDTEXT
FLAG
CONTINUOUS
who=Mordor
state=on
flag=0
GIVETECHNOLOGY
technology=7
receiver=Mordor
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
FLAG
who=Mordor
state=on
flag=1
TEXT
The Ring Bearer has succeeded in his quest ! The ring has been cast into the cracks of doom and 
Sauron has been destroyed, the dark tower crumbles and dread descends on the servants and allies
of Sauron, far away in the battle fields of the west a cry is heard "The eagles are coming, the 
eagles are coming!" It seems the great eagles have decided to join the war on your side!
ENDTEXT
TAKETECHNOLOGY
whom=Mordor
Collapse
technology=2
CREATEUNIT
owner=TriggerAttacker
unit=Eagle
Count=5
veteran=false
homecity=none
locations
43,77
44,76
44,78
endlocations
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
GIVETECHNOLOGY
technology=11
receiver=Gondor
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
GIVETECHNOLOGY
technology=11
receiver=Rohirrim
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
GIVETECHNOLOGY
technology=11
receiver=Dwarves
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
GIVETECHNOLOGY
technology=11
receiver=Elves
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
GIVETECHNOLOGY
technology=8
receiver=Gondor
@ENDIF

@IF
BRIBEUNIT
who=Anybody
whom=Mordor
unittype=45 
@THEN
GIVETECHNOLOGY
technology=98
receiver=Mordor
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Gondor
technology=87
@THEN
JUSTONCE
TEXT
An emmissary from Gondor arrives in Rohan to plead with Theoden to remember the ancient
alliance between Gondor and Rohan and to come to the aid of Minas Tirith, he agrees and 
dispatches many riders straight away.
ENDTEXT
MAKEAGGRESSION
who=Rohirrim
whom=Mordor
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Gondor
technology=87
@AND
CHECKFLAG
who=Gondor
flag=0
state=off
@THEN
JUSTONCE
CREATEUNIT
owner=Gondor
unit=Rohirrim
Count=4
veteran=false
homecity=none
locations
61,109
endlocations
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Elves
technology=87
@THEN
JUSTONCE
TEXT
Infuriated by Saruman's lack of respect for the trees of Fangorn forest the Ents have risen up
to help the Rohirrim overthrow the corrupt wizard
ENDTEXT
CREATEUNIT
owner=Rohirrim
unit=Ents
Count=6
veteran=false
homecity=none
locations
47,81
46,80
48,82
endlocations
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Rohirrim
technology=87
@THEN
JUSTONCE
TEXT
The dead men of Dunharrow rise from the grave to fulfill their oath to fight against Sauron !
ENDTEXT
CREATEUNIT
owner=Gondor
unit=Dead Men
Count=6
veteran=false
homecity=none
locations
48,102
47,101
49,103
endlocations
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Mordor
technology=87
@THEN
JUSTONCE
TEXT
Rumour has it that the nine are abroad once again, what could they be looking for ?
ENDTEXT
CREATEUNIT
owner=Mordor
unit=Ringwraith
Count=3
veteran=false
homecity=none
locations
30,34
32,34
28,34
endlocations
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Mordor
technology=87
@THEN
JUSTONCE
CREATEUNIT
owner=Mordor
unit=Ringwraith
Count=3
veteran=false
homecity=none
locations
61,67
63,67
59,67
endlocations
@ENDIF

@IF
RECEIVEDTECHNOLOGY
receiver=Mordor
technology=87
@THEN
JUSTONCE
CREATEUNIT
owner=Mordor
unit=Ringwraith
Count=3
veteran=false
homecity=none
locations
25,55
23,55
27,55
endlocations
@ENDIF

@IF
UNITKILLED
unit=Ringwraith
Map=0
attacker=Anybody
defender=Mordor
@THEN
TEXT
One of the nine has been de-horsed and returns to Mordor to receive a new steed from its master
ENDTEXT
CREATEUNIT
owner=Mordor
unit=Nazgul
veteran=false
homecity=none
locations
74,100
endlocations
@ENDIF

@IF
UNITKILLED
unit=Nazgul
Map=0
attacker=Anybody
defender=Mordor
@THEN
TEXT
One of the nine has at last met his match
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Balrog
map=2
attacker=Anybody
defender=Mordor
@AND
CHECKFLAG
who=Mordor
flag=0
state=off
@THEN
TEXT
The Balrog of Moria, Durin's Bane, has been killed. The Dwarves flock to their ancient halls
in Moria in an attempt to win back the city.
ENDTEXT
CREATEUNIT
owner=Dwarves
unit=Dwarves
Count=9
veteran=false
homecity=none
locations
47,63,2
46,64,2
48,64,2
endlocations
@ENDIF

@IF
UNITKILLED
unit=Balrog
map=2
attacker=Anybody
defender=Mordor
@AND
CHECKFLAG
who=Mordor
flag=0
state=off
@THEN
CREATEUNIT
owner=Dwarves
unit=Settlers
veteran=false
homecity=none
locations
47,63,2
46,64,2
48,64,2
endlocations
@ENDIF

@IF 
UNITKILLED
unit=Gandalf
map=0
attacker=Anybody
defender=Anybody
@THEN
JUSTONCE
TEXT
Gandlf the Grey has been killed, but he is restored to life as Gandalf the White !
ENDTEXT
CREATEUNIT
owner=TriggerDefender
unit=Gandalf
veteran=True
homecity=none
locations
49,75
50,76
49,77
48,78
48,74
47,75
endlocations
@ENDIF

@IF
CITYTAKEN
city=Isengard
attacker=Anybody
defender=Barbarians
@THEN
GIVETECHNOLOGY
technology=6
receiver=Gondor
TEXT
Isengard falls ! The treachorous wizard Saruman is trapped in the tower of Orthanc and refuses to 
come down ! After a while however he persuades his captors to let him go free and he is last 
seen heading north through Dunland...
ENDTEXT
CREATEUNIT
owner=Barbarians
unit=Saruman
veteran=False
homecity=none
locations
25,41
24,42
26,40
endlocations
@ENDIF

@IF
UNITKILLED
unit=Saruman
map=0
attacker=Anybody
defender=Barbarians
@THEN
JUSTONCE
TEXT
Saruman, sensing the imminent fall of Isengard retreats to the safety of the tower of Orthanc
ENDTEXT
@ENDIF

@IF
CITYTAKEN
city=Isengard
attacker=Anybody
defender=Barbarians
@THEN
CREATEUNIT
owner=Barbarians
unit=Evil Men
Count=8
veteran=False
homecity=none
locations
25,41
24,42
26,40
endlocations
@ENDIF

; Heroes

@IF
UNITKILLED
unit=Gimli
map=0
attacker=Anybody
defender=Anybody
@THEN
JUSTONCE
TEXT
Gimli the dwarf, one of the fellowship members has been killed !
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Legolas
map=0
attacker=Anybody
defender=Anybody
@THEN
TEXT
Legolas the Elf, one of the fellowship members, has been killed !
ENDTEXT
@ENDIF

@IF 
UNITKILLED
unit=Boromir
map=0
attacker=Anybody
defender=Anybody
@THEN
TEXT
Boromir, son of Denethor and fellowship member has been killed ! His body is sent down the river
Anduin and out to sea
ENDTEXT
@ENDIF

@IF 
UNITKILLED
unit=Aragorn
map=0
attacker=Anybody
defender=Rohirrim
@THEN
TEXT
Aragorn, having done great deeds for Rohan, has decided to return to Gondor to recliam his throne
ENDTEXT
CREATEUNIT
owner=Gondor
unit=Aragorn
veteran=True
homecity=none
locations
48,102
47,101
49,103
endlocations
@ENDIF

; Random units

@IF
RANDOMTURN
denominator=3
@THEN
CREATEUNIT
owner=Gondor
unit=Beornean
veteran=false
homecity=none
locations
54,42
53,41
53,43
55,41
endlocations
@ENDIF

@IF
RANDOMTURN
denominator=2
@AND
CHECKFLAG
who=Mordor
flag=1
state=off
@THEN
CREATEUNIT
RANDOMIZE
owner=Mordor
unit=Spiders
veteran=False
homecity=none
locations
59,43
63,45
63,53
59,53
61,47
61,39
endlocations
@ENDIF

@IF
TURN
turn=every
@AND
CHECKFLAG
who=Mordor
flag=1
state=off
@THEN
CREATEUNIT
RANDOMIZE
owner=Mordor
unit=Orcs
veteran=false
homecity=none
locations
48,52
50,46
50,38
49,29
50,22
endlocations
@ENDIF

@IF
TURN
turn=every
@AND
CHECKFLAG
who=Mordor
flag=1
state=off
@THEN
CREATEUNIT
RANDOMIZE
owner=Mordor
unit=Orcs
veteran=false
homecity=none
locations
68,108
69,107
68,106
67,105
67,109
endlocations
@ENDIF

@IF
RANDOMTURN
denominator=5
@THEN
TEXT
The wild men of the mountains, hoping to maintain their way of life, have come down from the
hills to help Gondor against Sauron
ENDTEXT
CREATEUNIT
owner=Gondor
unit=Wild Men
veteran=false
homecity=none
locations
57,107
56,108
55,107
endlocations
@ENDIF

@IF
RANDOMTURN
denominator=5
@THEN
TEXT
The wild men of the mountains, hoping to maintain their way of life, have come down from the
hills to help Rohan against Sauron
ENDTEXT
CREATEUNIT
owner=Rohirrim
unit=Wild Men
veteran=false
homecity=none
locations
57,107
56,108
55,107
endlocations
@ENDIF

@IF
RANDOMTURN
denominator=5
@THEN
CREATEUNIT
owner=Gondor
unit=Snow Men
veteran=False
homecity=Forochal
locations
28,10
endlocations
@ENDIF

@ENDEVENTS


