; Events file for Sobieski scenario
; 
; 

@BEGINEVENTS
@INITFLAG
@DEBUG

@IF
ScenarioLoaded
@THEN
PlayWaveFile
victoria_short.wav
@ENDIF

@IF
NOSCHISM
DEFENDER=anybody 
@THEN
@ENDIF

@IF
NEGOTIATION
talker=Crimean Tartars
talkertype=HumanOrComputer
listener=Turks
listenertype=HumanOrComputer
@THEN
@ENDIF

@IF
NEGOTIATION
talker=Turks
talkertype=HumanOrComputer
listener=Crimean Tartars
listenertype=HumanOrComputer
@THEN
@ENDIF

@IF
TURN
turn=1
@THEN
JUSTONCE
TEXT
^^ August of 1667.
^^
^^ In the small village of Andrusovo, less than a year ago, Russian diplomat Afanasy 
^^ Ordin-Naschokin and Polish ambassador Jerzy Chlebowicz sign an armistice, ceding 
^^ to Russia Smolensk and Chzernigov, giving Moscow two years' control of the city 
^^ of Kiev, and establishing a codominium over the "Wild Lands" of the western Ukraine.
^^
^^ With this treaty, the disasterous Deluge finally comes to an end.
ENDTEXT
@ENDIF

@IF
TURN
turn=1
@THEN
JUSTONCE
TEXT
^^ But the Commonwealth's conflicts are far from over.
^^
^^ Petro Doroshenko, Hetman of the Cossacks in the Right-Bank Ukraine, has made
^^ a bid for power by declaring the Cossack nation a vassal of the Ottoman Empire,
^^ thus declaring himself independant of both Moscow and Poland.
^^
^^ Allied with him are the Crimean Tatars who, despite their khan's support for 
^^ the Polish-Lithuanian republic, cannot resist the opportunity to plunder and loot
^^ the war-torn nation...
ENDTEXT
@ENDIF

@IF
TURN
turn=1
@THEN
JUSTONCE
TEXT
^^ But Poland has an ace up her sleeve.
^^
^^ For commanding much of Poland's army is a Field Hetman by the name of John Sobieski.
^^ veteran of the Chmielnicki uprising, Lubomirski's rebellion and the Deluge, John
^^ is an experience commander who knows well his Tartar and Turkish foes, both by study
^^ and experience in the field.
^^
^^ Are Poland's days of glory over, or can Sobieski renew the dual-nation Republic?
^^ Only time will tell...
ENDTEXT
@ENDIF

;Tartars (and Turks) & negotiation

@IF
Negotiation
talkermask=0b00010000000000000000000000100010
listenermask=0b00000000000000000010000000000010
@THEN
@ENDIF

@IF
Negotiation
talkermask=0b00000000000000000010000000000010
listenermask=0b00010000000000000000000000100010
@THEN
@ENDIF

@IF
TURN
turn=1
@THEN
JUSTONCE
Negotiator
who=Crimean Tartars
type=Talker
state=Set
@ENDIF

@IF
TURN
turn=1
@THEN
JUSTONCE
Negotiator
who=Crimean Tartars
type=Listener
state=Set
@ENDIF

@IF
CITYTAKEN
CITY=Zhitomer
attacker=Crimean Tartars
defender=Anybody
@THEN
BestowImprovement
improvement=8
race=Crimean Tartars
capital=False
wonders=False
@ENDIF

@IF
CityTaken
city=Chigirin
attacker=Anybody
defender=Crimean Tartars
@THEN
JUSTONCE
Negotiator
who=Crimean Tartars
type=Talker
state=Clear
@ENDIF

@IF
CityTaken
city=Chigirin
attacker=Anybody
defender=Crimean Tartars
@THEN
JUSTONCE
Negotiator
who=Crimean Tartars
type=Listener
state=Clear
@ENDIF

;Hetman/Sobieski events

@IF
UNITKILLED
unit=Polish Hetman
attacker=anybody
defender=Poles and Lithuanians
@THEN
TEXT
^A Hetman of the Kingdom of Poland is slain on the field of battle.
^
^The king quickly begins searching for a replacement.
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Polish Hetman
attacker=anybody
defender=Poles and Lithuanians
@THEN
Delay
Delay=1
CREATEUNIT
unit=Polish Hetman
Count=1
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
44,78
33,71
25,79
29,65
endlocations
@ENDIF

@IF
UNITKILLED
unit=Lithuanian Hetman
attacker=anybody
defender=Poles and Lithuanians
@THEN
TEXT
^A Hetman of the Grand Duchy of Lithuania is slain on the field of battle.
^
^The king quickly searches for a replacement.
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Lithuanian Hetman
attacker=anybody
defender=Poles and Lithuanians
@THEN
Delay
Delay=1
CREATEUNIT
unit=Lithuanian Hetman
Count=1
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
57,43
44,40
42,50
37,55
endlocations
@ENDIF

@IF
UNITKILLED
unit=John Sobieski
attacker=anybody
defender=Poles and Lithuanians
@AND
CheckFlag
Who=Poles and Lithuanians
Flag=0
State=Off
@THEN
TEXT
^John Sobieski is wounded on the battlefield.
^
^Sent home to recuperate, he should recover his health shortly.
ENDTEXT
FLAG
continuous
flag=0
Who=Poles and Lithuanians
state=on
@ENDIF

@IF
UNITKILLED
unit=John Sobieski
attacker=anybody
defender=Poles and Lithuanians
@AND
CheckFlag
Who=Poles and Lithuanians
Flag=0
State=Off
@THEN
Delay
Delay=1
CREATEUNIT
unit=John Sobieski
Count=1
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
44,78
33,71
25,79
29,65
endlocations
FLAG
continuous
flag=0
Who=Poles and Lithuanians
state=on
@ENDIF


@IF
UNITKILLED
unit=John Sobieski
attacker=anybody
defender=Poles and Lithuanians
@AND
CheckFlag
Who=Poles and Lithuanians
Flag=0
State=On
@THEN
TEXT
^John Sobieski, Hetman of the Polish Crown, is killed.
ENDTEXT
DestroyACivilization
whom=Poles and Lithuanians
@ENDIF

@IF
UNITKILLED
unit=John III Sobieski
attacker=anybody
defender=Poles and Lithuanians
@AND
CheckFlag
Who=Poles and Lithuanians
Flag=0
State=Off
@THEN
TEXT
^^ John III Sobieski is wounded on the battlefield.
^^
^^ His retinue manages to take him to safety, where he should soon recover from his wounds
^^ and be ready again for battle.
ENDTEXT
FLAG
continuous
flag=0
Who=Poles and Lithuanians
state=on
@ENDIF

@IF
UNITKILLED
unit=John III Sobieski
attacker=anybody
defender=Poles and Lithuanians
@AND
CheckFlag
Who=Poles and Lithuanians
Flag=0
State=Off
@THEN
Delay
Delay=1
CREATEUNIT
unit=John III Sobieski
Count=1
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
44,78
33,71
25,79
29,65
endlocations
@ENDIF

@IF
UNITKILLED
unit=John III Sobieski
attacker=anybody
defender=Poles and Lithuanians
@AND
CheckFlag
Who=Poles and Lithuanians
Flag=0
State=On
@THEN
TEXT
^^ John III Sobieski, King of Poland and Grand Duke of Lithuania, is killed.
ENDTEXT
DestroyACivilization
whom=Poles and Lithuanians
@ENDIF

;Ukraine events

@IF
CITYTAKEN
CITY=Kiev
attacker=Poles and Lithuanians
defender=Anybody
@THEN
Flag
CONTINUOUS
Who=Poles and Lithuanians
State=On
Flag=4
@ENDIF

@IF
CITYTAKEN
CITY=Kiev
attacker=Poles and Lithuanians
defender=Anybody
@THEN
JustOnce
PlayWaveFile
powergrow.wav
TEXT
^^ As Polish forces enter the city of Kiev after decades of absence, the residents of 
^^ the Ukrainian capital wonder if their new conquerers will try to impose their faith
^^ and culture on the Ukraine, or respect the Cossacks' desire for freedom...
ENDTEXT
@ENDIF

@IF
CITYTAKEN
CITY=Kiev
attacker=Anybody
defender=Poles and Lithuanians
@THEN
Flag
CONTINUOUS
Who=Poles and Lithuanians
State=Off
Flag=4
@ENDIF

@IF
CITYTAKEN
CITY=Sietch
attacker=Poles and Lithuanians
defender=Anybody
@THEN
JustOnce
PlayWaveFile
powergrow.wav
TEXT
^^ The Zaprohozian Sietch, stronghold of the Dneiper Cossacks and locus of the 
^^ 1647 rebellion, falls to Polish forces.
^^
^^ Eastern Europe looks on as the Poles make good their claim on the Ukraine...
ENDTEXT
@ENDIF


@IF
CITYTAKEN
CITY=Sietch
attacker=Poles and Lithuanians
defender=Anybody
@THEN
Flag
CONTINUOUS
Who=Poles and Lithuanians
State=On
Flag=5
@ENDIF

@IF
CITYTAKEN
CITY=Sietch
attacker=Anybody
defender=Poles and Lithuanians
@THEN
Flag
CONTINUOUS
Who=Poles and Lithuanians
State=Off
Flag=5
@ENDIF

@IF
CITYTAKEN
CITY=Chernigov
attacker=Poles and Lithuanians
defender=Anybody
@THEN
JustOnce
PlayWaveFile
powergrow.wav
TEXT
^^ Forces of the Polish crown cross the Dneiper and take the city of Chernigov on the
^^ eastern bank of the river.
^^
^^ With the capture of this city, it seems clear that the Polish-Lithuanian Commonwealth's
^^desire to control not only that part of the "Wild Lands" it was promised in the Treaty 
^^ of Andrusovo, but rest of the Ukraine as well...
ENDTEXT
@ENDIF

@IF
CITYTAKEN
CITY=Chernigov
attacker=Poles and Lithuanians
defender=Anybody
@THEN
Flag
CONTINUOUS
Who=Poles and Lithuanians
State=On
Flag=6
@ENDIF

@IF
CITYTAKEN
CITY=Chernigov
attacker=Anybody
defender=Poles and Lithuanians
@THEN
Flag
CONTINUOUS
Who=Poles and Lithuanians
State=Off
Flag=6
@ENDIF

;East Prussia events

@IF
CityTaken
City=Konigsberg
attacker=Poles and Lithuanians
defender=Anybody
@THEN
JustOnce
PlayWaveFile
powergrow.wav
TEXT
^^Commonwealth troops enter the East Prussian capital of Konigsburg.
^^
^^Declaring himself the Duke of the region, John Sobieski makes a formal 
^^act of submission to the Polish king, formally returning East Prussia to 
^^its status as a vassal of the Polish crown.
^^
^^John Casimir, the King of Poland, gratefully accepts the homage and praises
^^Sobieski for reclaiming the land for the Commonwealth; other Polish nobles,
^^however, note that this could also be a sign of Sobieski claiming power for
^^himself...
ENDTEXT
@ENDIF


; Scanian War Events

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
TEXT
^^ Troops under Fredrick William of Brandenberg retake the town of Fehrbellin from 
^^ the invading Swedes.
^^
^^ While the battle itself is small, the psychological impact is tremendous:
^^ Frederick has shown that the Swedish army is not invincible, and can be defeated.
^^
^^ Other countries, such as Sweden's rival Denmark, take note...
ENDTEXT
@ENDIF

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
Delay
Delay=12
TEXT
^^With the Swedes' defeat last year at Fehrbellin firmly in their minds, the Danish
^^invade Sweden via the Dane-inhabited Swedish territory of Scania.
ENDTEXT
CREATEUNIT
unit=Infantry [Dan]
Count=6
owner=Barbarians
veteran=yes
homecity=None
locations
1,45
0,46
2,46
0,44
endlocations
@ENDIF

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
Delay
Delay=12
CREATEUNIT
unit=Cavalry [Dan]
Count=4
owner=Barbarians
veteran=yes
homecity=None
locations
1,45
0,46
2,46
0,44
endlocations
@ENDIF

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
Delay
Delay=12
CREATEUNIT
unit=Dragoons [Dan]
Count=2
owner=Barbarians
veteran=yes
homecity=None
locations
1,45
0,46
2,46
0,44
endlocations
@ENDIF

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
Delay
Delay=12
CREATEUNIT
unit=Cannon
Count=3
owner=Barbarians
veteran=yes
homecity=None
locations
1,45
0,46
2,46
0,44
endlocations
@ENDIF

;Siege of Kamieniec

@IF
TURN
Turn=61
@THEN
MAKEAGGRESSION
who=Turks
whom=Poles and Lithuanians
GIVETECHNOLOGY
receiver=Turks
technology=90
@ENDIF

@IF
TURN
Turn=61
@THEN
TEXT
^^Siege text.
ENDTEXT
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Cannon [Tur]
Count=4
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Cannon
Count=2
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Janissaries
Count=12
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Sipahis
Count=6
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Azabs
Count=10
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Turfekci
Count=10
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Wallachian Inf.
Count=9
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Wallachian Cavalry
Count=4
owner=Turks
veteran=yes
homecity=None
locations
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Raiders [Tar]
Count=7
owner=Turks
veteran=yes
homecity=None
locations
47,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Cossacks
Count=3
owner=Turks
veteran=yes
homecity=None
locations
47,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Raiders [Tar]
Count=7
owner=Turks
veteran=yes
homecity=None
locations
55,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Cossacks
Count=3
owner=Turks
veteran=yes
homecity=None
locations
55,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
50,88,52,88,52,82,50,82
moveto
51,81
numbertomove=ALL
@ENDIF

@IF
TURN
Turn=61
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
46,88,48,88,48,86,46,86
moveto
50,80
numbertomove=ALL
@ENDIF

@IF
TURN
Turn=61
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
54,88,56,88,56,86,54,86
moveto
52,80
numbertomove=ALL
@ENDIF

@IF
TURNINTERVAL
interval=1
@AND
RecievedTechnology
technology=90
receiver=Turks
@THEN
MAKEAGGRESSION
who=Turks
whom=Poles and Lithuanians
@ENDIF

@IF
RecievedTechnology
technology=90
receiver=Turks
@AND
TURNINTERVAL
interval=1
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
50,88,52,88,52,82,50,82
moveto
51,81
numbertomove=ALL
@ENDIF

@IF
RecievedTechnology
technology=90
receiver=Turks
@AND
TURNINTERVAL
interval=1
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
46,88,48,88,48,86,46,86
moveto
50,80
numbertomove=ALL
@ENDIF

@IF
RecievedTechnology
technology=90
receiver=Turks
@AND
TURNINTERVAL
interval=1
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
54,88,56,88,56,86,54,86
moveto
52,80
numbertomove=ALL
@ENDIF

@IF
CityTaken
City=Kamieniec
attacker=Turks
defender=Poles and Lithuanians
@THEN
JustOnce
PlayWaveFile
wardrums.wav
TEXT
^^The forces of the Ottoman Porte take the fortress of Kamieneic Podolski,
^^the heart of the defenses of Podolia.
^^
^^In an event that will be celebrated by all of Turkey, the fortress is
^^handed over to the invading forces, who quickly convert the city's Catholic
^^cathedral into a mosque and make arrangements for the Sultan himself to 
^^visit the citadel.
^^
^^Unless something can be done, the center of Poland lies open to the Turks...
ENDTEXT
TakeTechnology		
whom=Turks
technology=90
@ENDIF

@IF
CityTaken
City=Kamieniec
attacker=Turks
defender=Poles and Lithuanians
@THEN
JUSTONCE
Negotiator
who=Turks
type=Listener
state=Clear
@ENDIF

@IF
CityTaken
City=Kamieniec
attacker=Turks
defender=Poles and Lithuanians
@THEN
JUSTONCE
Negotiator
who=Turks
type=Talker
state=Clear
@ENDIF

;Battle of Chocim
@IF
TURN
Turn=76
@THEN
PlayWaveFile
wardrums.wav
TEXT
^^In the small fortified town of Chocim (modern-day Khotym), the Ottoman commander
^^Huessein Pasha gathers his army, plotting to take the Turkish Cresecent into the
^^Polish heartland...
ENDTEXT
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Janissaries
Count=8
owner=Turks
veteran=yes
homecity=None
locations
51,83
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Sipahis
Count=13
owner=Turks
veteran=yes
homecity=None
locations
51,83
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Turfekci
Count=4
owner=Turks
veteran=yes
homecity=None
locations
51,83
51,85
51,87
endlocations
@ENDIF

@IF
TURN
Turn=61
@THEN
CREATEUNIT
unit=Azabs
Count=5
owner=Turks
veteran=yes
homecity=None
locations
51,83
51,85
51,87
endlocations
@ENDIF

;Battle of Lwow

@IF
TURN
Turn=97
@THEN
TEXT
^^August 1675 - the Battle of Lwow!
ENDTEXT
@ENDIF

@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Janissaries
Count=6
owner=Turks
veteran=yes
homecity=None
locations
50,80
50,82
51,83
endlocations
@ENDIF

@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Sipahis
Count=3
owner=Turks
veteran=yes
homecity=None
locations
50,80
50,82
51,83
endlocations
@ENDIF

@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Turfekci
Count=4
owner=Turks
veteran=yes
homecity=None
locations
50,80
50,82
51,83
endlocations
@ENDIF

@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Azabs
Count=4
owner=Turks
veteran=yes
homecity=None
locations
50,80
50,82
51,83
endlocations
@ENDIF

@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Raiders [Tar]
Count=10
owner=Turks
veteran=yes
homecity=None
locations
50,80
50,82
51,83
endlocations
@ENDIF


@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Cannon [Tur]
Count=1
owner=Turks
veteran=yes
homecity=None
locations
50,80
50,82
51,83
endlocations
@ENDIF

;Battle of Vienna (if Lwow not taken)
@IF
TURN
turn=191
@THEN
JUSTONCE
Negotiator
who=Turks
type=Talker
state=Set
@ENDIF

@IF
TURN
turn=191
@THEN
JUSTONCE
Negotiator
who=Turks
type=Listener
state=Set
@ENDIF

@IF
TURN
Turn=191
@THEN
MAKEAGGRESSION
who=Turks
whom=Poles and Lithuanians
GIVETECHNOLOGY
receiver=Turks
technology=93
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=93
@THEN
FLAG
continuous
flag=3
Who=Turks
state=on
@ENDIF


@IF
TURN
Turn=191
@THEN
MAKEAGGRESSION
who=Turks
whom=Imperials
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Wallachian Inf.
Count=10
owner=Turks
veteran=no
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Moldavian Infantry
Count=10
owner=Turks
veteran=no
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Sipahis
Count=9
owner=Turks
veteran=yes
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Azabs
Count=12
owner=Turks
veteran=yes
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Turfekci
Count=12
owner=Turks
veteran=yes
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Janissaries
Count=16
owner=Turks
veteran=yes
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=97
@THEN
CREATEUNIT
unit=Cannon [Tur]
Count=4
owner=Turks
veteran=yes
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Kara Mustafa Pasha
Count=1
owner=Turks
veteran=no
homecity=None
locations
21,95
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Raiders [Tar]
Count=10
owner=Turks
veteran=no
homecity=None
locations
16,98
endlocations
@ENDIF

@IF
TURN
Turn=191
@THEN
CREATEUNIT
unit=Raiders [Tar]
Count=10
owner=Turks
veteran=no
homecity=None
locations
16,98
endlocations
@ENDIF

@IF
CheckFlag
Who=Turks
Flag=3
State=on
@AND
TURN
turn=Every
@THEN
MOVEUNIT
unit=AnyUnit
owner=Turks
maprect
12,92,26,92,26,98,12,98
moveto
12,92
numbertomove=ALL
@ENDIF


@IF
UNITKILLED
unit=Austrian Frontier
attacker=Turks
defender=Imperials
@THEN
PlayWaveFile
wardrums.wav
TEXT
^^Looking at the massive size of the Ottoman host and correctly guessing its
^^objective, the Imperial garrison at Gyor withdraws from the fortress and
^^retreats to Vienna.
^^
^^In the Hapsburg capital, news of this withdrawl causes chaos.  Nearly sixty
^^thousand Viennese flee the city, others riot, and various decrees are issued
^^expelling foreigners and the elderly, drafting all able-bodies males, and so forth.
ENDTEXT
Randomize
CREATEUNIT
unit=Militia [Imp]
Count=4
owner=Imperials
veteran=no
homecity=None
locations
12,92
endlocations
@ENDIF

@IF
UNITKILLED
unit=Austrian Frontier
attacker=Turks
defender=Imperials
@THEN
TEXT
^^Meanwhile, the Turks make camp around the city, with Kara Mustafa visiting the
^^Neugabaude,built on the site where Suleiman the Magnificent's tent was said to
^^have been during his seige over a century and a half ago.
^^
^^The seige of Vienna has begun.
ENDTEXT
CREATEUNIT
unit=Turkish Camp
Count=1
owner=Turks
veteran=no
homecity=None
locations
13,93
endlocations
@ENDIF

@IF
TURN
Turn=192
@THEN
CREATEUNIT
unit=Bav. Cuirassiers
Count=2
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
4,94
1,93
2,94
3,95
endlocations
@ENDIF

@IF
TURN
Turn=192
@THEN
CREATEUNIT
unit=Bavarian Infantry
Count=4
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
4,94
1,93
2,94
3,95
endlocations
@ENDIF

@IF
TURN
Turn=192
@THEN
CREATEUNIT
unit=Infantry [Imp]
Count=4
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
4,94
1,93
2,94
3,95
endlocations
@ENDIF

@IF
TURN
Turn=192
@THEN
CREATEUNIT
unit=Cuirassiers [Imp]
Count=1
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
4,94
1,93
2,94
3,95
endlocations
@ENDIF

@IF
TURN
Turn=192
@THEN
CREATEUNIT
unit=Saxon Infantry
Count=4
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
2,76
3,75
3,73
1,73
1,75
endlocations
@ENDIF

@IF
TURN
Turn=192
@THEN
CREATEUNIT
unit=Saxon Cuirassiers
Count=2
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
2,76
3,75
3,73
1,73
1,75
endlocations
@ENDIF

@IF
UNITKILLED
unit=Turkish Camp
attacker=Poles and Lithuanians
defender=Turks
@THEN
PlayWaveFile
triumph.wav
TEXT
^^ In a moment that will win him worldwide fame, Sobieski leads a cavalry charge 
^^ down the Kahlenberg ridge, breaking Turkish lines and leading straight into the
^^ Ottoman camp.
^^
^^ After the chaos of battle has settled down, the Christian army explores the 
^^ camp,where they find loads of material wealth, a menagerie of exotic creatures,
^^ and other such riches.
^^
^^ With his army in flight, the Turkish commander orders all equipment destroyed and
^^ captives slain, but the Christians arrive before these orders can be executed.
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Turkish Camp
attacker=Poles and Lithuanians
defender=Turks
@THEN
TEXT
^^ The city of Vienna erupts in celebration.  The allied generals all praise the
^^ Polish king for his role in the victory, and a thanksgiving Mass is celebrated
^^ at St. Stephen's where, as Sobieski writes to his wife, "[t]he common people ... 
^^ paid their veneration even to my very garments, and made their cries and 
^^ acclamations reach the sky, of 'Long live the King of Poland!'"
^^
^^ While this day is a cause of celebration, there is much to be done.  The Imperial
^^ forces have plans for Hungary, and as Sobieski writes, "all the princes of the 
^^ Empire ... tell me they are ready to follow such a leader (such as me) not only 
^^ into Hungary, but to the end of the world."
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Turkish Camp
attacker=Poles and Lithuanians
defender=Turks
@THEN
TEXT
^^ Whether or not Sobieski will lead them there remains to be seen ...
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Turkish Camp
attacker=Poles and Lithuanians
defender=Turks
@THEN
JUSTONCE
Negotiator
who=Turks
type=Talker
state=Clear
@ENDIF

@IF
UNITKILLED
unit=Turkish Camp
attacker=Poles and Lithuanians
defender=Turks
@THEN
JUSTONCE
Negotiator
who=Turks
type=Listener
state=Clear
@ENDIF

@IF
UNITKILLED
unit=Turkish Camp
attacker=Poles and Lithuanians
defender=Turks
@THEN
FLAG
continuous
flag=3
Who=Turks
state=off
@ENDIF

;Poles take Moscow
@IF
CityTaken
City=Moscow
attacker=Poles and Lithuanians
defender=Muscovites
@THEN
JustOnce
PlayWaveFile
wardrums.wav
TEXT
^^Poles take Moscow!
ENDTEXT
@ENDIF

; Mobilizing Army Events

@IF
TURN
turn=10
@THEN
GIVETECHNOLOGY
technology=98
receiver=Imperials
@ENDIF

@IF
TURN
turn=10
@THEN
GIVETECHNOLOGY
technology=98
receiver=Muscovites
@ENDIF

@IF
TURN
turn=10
@THEN
GIVETECHNOLOGY
technology=98
receiver=Swedes
@ENDIF

@IF
TURN
turn=10
@THEN
GIVETECHNOLOGY
technology=98
receiver=House of Brandenburg
@ENDIF

@IF
TURN
turn=10
@THEN
GIVETECHNOLOGY
technology=98
receiver=Turks
@ENDIF

@IF
TURN
turn=10
@THEN
GIVETECHNOLOGY
technology=98
receiver=Crimean Tartars
@ENDIF

@IF
TurnInterval
interval=12
@THEN
Delay
Delay=10
GIVETECHNOLOGY
technology=98
receiver=Imperials
@ENDIF

@IF
TurnInterval
interval=12
@THEN
Delay
Delay=10
GIVETECHNOLOGY
technology=98
receiver=Muscovites
@ENDIF

@IF
TurnInterval
interval=12
@THEN
Delay
Delay=10
GIVETECHNOLOGY
technology=98
receiver=Swedes
@ENDIF

@IF
TurnInterval
interval=12
@THEN
Delay
Delay=10
GIVETECHNOLOGY
technology=98
receiver=House of Brandenburg
@ENDIF

@IF
TurnInterval
interval=12
@THEN
Delay
Delay=10
GIVETECHNOLOGY
technology=98
receiver=Turks
@ENDIF

@IF
TurnInterval
interval=12
@THEN
Delay
Delay=10
GIVETECHNOLOGY
technology=98
receiver=Crimean Tartars
@ENDIF

@IF
ReceivedTechnology
receiver=Imperials
technology=98
@THEN
Randomize
CREATEUNIT
unit=Infantry [Imp]
Count=6
owner=Imperials
veteran=no
homecity=None
locations
3,81
2,94
13,85
15,89
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Imperials
technology=98
@THEN
Randomize
CREATEUNIT
unit=Cuirassiers [Imp]
Count=4
owner=Imperials
veteran=no
homecity=None
locations
3,81
2,94
13,85
15,89
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Imperials
technology=98
@THEN
Randomize
CREATEUNIT
unit=Dragoons [Imp]
Count=2
owner=Imperials
veteran=no
homecity=None
locations
3,81
2,94
13,85
15,89
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=House of Brandenburg
technology=98
@THEN
Randomize
CREATEUNIT
unit=Infantry [Br]
Count=3
owner=House of Brandenburg
veteran=yes
homecity=None
locations
0,64
25,51
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=House of Brandenburg
technology=98
@THEN
Randomize
CREATEUNIT
unit=Cuirassiers [Br]
Count=2
owner=House of Brandenburg
veteran=yes
homecity=None
locations
0,64
25,51
endlocations

@IF
ReceivedTechnology
receiver=House of Brandenburg
technology=98
@THEN
Randomize
CREATEUNIT
unit=Dragoons [Br]
Count=1
owner=House of Brandenburg
veteran=yes
homecity=None
locations
0,64
25,51
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Swedes
technology=98
@THEN
Randomize
CREATEUNIT
unit=Infantry [Swd]
Count=6
owner=Swedes
veteran=no
homecity=None
locations
0,56
35,35
15,23
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Swedes
technology=98
@THEN
Randomize
CREATEUNIT
unit=Cuirassiers [Swd]
Count=4
owner=Swedes
veteran=no
homecity=None
locations
0,56
35,35
15,23
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Swedes
technology=98
@THEN
Randomize
CREATEUNIT
unit=Dragoons [Swd]
Count=2
owner=Swedes
veteran=no
homecity=None
locations
0,56
35,35
15,23
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Muscovites
technology=98
@THEN
Randomize
CREATEUNIT
unit=Infantry [Mus]
Count=6
owner=Muscovites
veteran=yes
homecity=None
locations
50,28
56,22
70,42
88,54
66,42
65,71
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Muscovites
technology=98
@THEN
Randomize
CREATEUNIT
unit=Strelets
Count=3
owner=Muscovites
veteran=yes
homecity=None
locations
50,28
56,22
70,42
88,54
66,42
65,71
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Muscovites
technology=98
@THEN
Randomize
CREATEUNIT
unit=Reitars [Mus]
Count=6
owner=Muscovites
veteran=yes
homecity=None
locations
50,28
56,22
70,42
88,54
66,42
65,71
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Muscovites
technology=98
@THEN
Randomize
CREATEUNIT
unit=Dragoons [Mus]
Count=3
owner=Muscovites
veteran=yes
homecity=None
locations
50,28
56,22
70,42
88,54
66,42
65,71
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Janissaries
Count=3
owner=Turks
veteran=yes
homecity=None
locations
59,125
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Azabs
Count=3
owner=Turks
veteran=yes
homecity=None
locations
59,125
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Turfekci
Count=3
owner=Turks
veteran=yes
homecity=None
locations
59,125
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Sipahis
Count=4
owner=Turks
veteran=yes
homecity=None
locations
59,125
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Wallachian Inf.
Count=2
owner=Turks
veteran=yes
homecity=None
locations
54,110
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Wallachian Cavalry
Count=1
owner=Turks
veteran=yes
homecity=None
locations
54,110
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Moldavian Infantry
Count=2
owner=Turks
veteran=yes
homecity=None
locations
56,92
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Transylvanian Inf.
Count=2
owner=Turks
veteran=yes
homecity=None
locations
42,100
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Turks
technology=98
@THEN
CREATEUNIT
unit=Transylvanian Cav.
Count=2
owner=Turks
veteran=yes
homecity=None
locations
42,100
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Crimean Tartars
technology=98
@THEN
Randomize
CREATEUNIT
unit=Raiders [Tar]
Count=4
owner=Crimean Tartars
veteran=yes
homecity=None
locations
73,89
79,91
82,92
70,98
86,102
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Crimean Tartars
technology=98
@THEN
Randomize
CREATEUNIT
unit=Uhlans [Tar]
Count=4
owner=Crimean Tartars
veteran=yes
homecity=None
locations
73,89
79,91
82,92
70,98
86,102
endlocations
@ENDIF

@IF
RECEIVEDTECHNOLOGY
technology=98
receiver=Imperials
@THEN
TakeTechnology
whom=Imperials
technology=98
@ENDIF

@IF
RECEIVEDTECHNOLOGY
technology=98
receiver=Muscovites
@THEN
TakeTechnology
whom=Muscovites
technology=98
@ENDIF

@IF
RECEIVEDTECHNOLOGY
technology=98
receiver=Swedes
@THEN
TakeTechnology
whom=Swedes
technology=98
@ENDIF

@IF
RECEIVEDTECHNOLOGY
technology=98
receiver=House of Brandenburg
@THEN
TakeTechnology
whom=House of Brandenburg
technology=98
@ENDIF

@IF
RECEIVEDTECHNOLOGY
technology=98
receiver=Turks
@THEN
TakeTechnology
whom=Turks
technology=98
@ENDIF

@IF
RECEIVEDTECHNOLOGY
technology=98
receiver=Crimean Tartars
@THEN
TakeTechnology
whom=Crimean Tartars
technology=98
@ENDIF

; Coronations, elections and all that
@IF
TURN
Turn=13
@THEN
PlayWaveFile
christian.wav
TEXT
^^ Broken down and exhausted after over a decade of constant warfare as well as
^^ the death of his wife, the king of Poland, John II Casimir, abdicates his throne
^^ and retires to a monastery in France.
^^
^^ As per the Polish custom, the Catholic archbishop of Krakow, as eccleastical
^^ Primate of the country, assumes the role of "interrex" as plans are made for a
^^ royal election next spring.
ENDTEXT
@ENDIF

@IF
TURN
Turn=23
@THEN
PlayWaveFile
rev.wav
TEXT
^^ On the fields outside Warsaw, the Commonwealth nobility elects a new monarch.
^^
^^ Tired of the intrigues foreign potentates (such as the Swedish Vasas) brought to 
^^ the Polish throne, the schlzata decide to elect a "Piast," a native son of the land.
^^
^^ The man they elect is Michael Korybut Wisniowiecki, son of Jarema Wisniowiecki, the
^^ brilliant if ruthless general who fought during Chmielniecki's uprising.
^^
^^ While his father had earned the nickname "Fear of the Cossacks," of Michael it was
^^ said that while he know eight languages, he could say nothing worthwhile in any of them.
ENDTEXT
FLAG
continuous
flag=1
Who=Poles and Lithuanians
state=on
@ENDIF

@IF
TURN
Turn=76
@THEN
PlayWaveFile
christian.wav
TEXT
^^ After four and a half years of passive and ineffective rule, King Michael Wisniowiecki
^^ dies [somewhere].
^^
^^ The interregnum begins again, and preparations are made for the royal elections; among
^^ candidates for the crown is the Kingdom of Poland's current Grand Hetman... 
ENDTEXT
FLAG
continuous
flag=1
Who=Poles and Lithuanians
state=off
@ENDIF

@IF
TURN
Turn=82
@THEN
PlayWaveFile
rev.wav
TEXT
^^ The nobility, as they did five years ago, assemble on the fields outside Warsaw to elect
^^ a new king.  This time, however, they choose as their monarch none other than Sobieski
^^ himself.
^^
^^ Many suspect that French money and the influence of John's Gallic wife Marie-Casimire 
^^ gained Sobieski the throne, and while they do have their points, Sobieski's victories
^^ over the Turks no doubt influenced many a Pole in their voting decisions...
ENDTEXT
FLAG
continuous
flag=2
Who=Poles and Lithuanians
state=on
@ENDIF
@ENDEVENTS