; 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.
^^ A 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
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

;Ukranine events
@IF
TURN
turn=18
@THEN
JUSTONCE
TEXT
^^ It is January of 1669.
^^
^^ According to the Treaty of Androsovo in 1667, Moscow is allowed to hold on to the city
^^ of Kiev for a period two years.
^^
^^ That time is up.
^^
^^ The Muscovites are not evacuating...
ENDTEXT
MakeAggression
who=Muscovites
whom=Poles and Lithuanians
@ENDIF

@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
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

; Scanian War Events

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
TEXT
^^Defeat of Sweden text.
ENDTEXT
@ENDIF

@IF
CityTaken
City=Fehrbellin
attacker=House of Brandenburg
defender=Swedes
@THEN
JustOnce
Delay
Delay=12
TEXT
^^Danish invasion text.
ENDTEXT
CREATEUNIT
unit=Infantry [Dan]
Count=21
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=Cuirassiers [Dan]
Count=14
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=7
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=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=Ottoman Cannon
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=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
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
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
^^into a mosque and make arrangements for the Sultan himself to visit the
^^citadel.
^^
^^The Poles in the city more or less accept the surrender.
ENDTEXT
TakeTechnology		
whom=Turks
technology=90
@ENDIF

@IF
CityTaken
City=Kamieniec
attacker=Turks
defender=Poles and Lithuanians
@THEN
JustOnce
TEXT
^^But not all seem to accept the surrender.
^^
^^For the day before the official handover, the gunpowerder cellar of the city's
^^Old Fortress explodes, taking with it one Jerzy Michal Wolodyjowski.
^^
^^Whether this is a portent of things to come remains to be seen...
ENDTEXT
@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
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=Ottoman Cannon
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
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=Janissaries
Count=16
owner=Turks
veteran=yes
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=Moldavian Infantry
Count=10
owner=Turks
veteran=no
homecity=None
locations
21,95
endlocations
@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=97
@THEN
CREATEUNIT
unit=Ottoman Cannon
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
TEXT
^^Having defeated Austrian forces on Hungarian soil, the Ottoman host reaches
^^the Imperial capital.
^^
^^Kara Mustafa Pasha, commander of the Porte's forces, visits the Neugebaude
^^(an Imperial palace built on the reputed site of Suleiman the Magnificent's
^^tent during his siege of 1529) before taking his place among the field of
^^tents surrounding the city.
ENDTEXT
@ENDIF

@IF
UNITKILLED
unit=Austrian Frontier
attacker=Turks
defender=Imperials
@THEN
TEXT
^^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=5
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=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=Franconian Inf.
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=2
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=3
owner=Poles and Lithuanians
veteran=no
homecity=None
locations
2,76
3,75
3,73
1,73
1,75
endlocations
@ENDIF

; Mobilizing Army Events
@IF
ReceivedTechnology
receiver=Imperials
technology=98
@THEN
CREATEUNIT
unit=Infantry [Imp]
Count=12
owner=Imperials
veteran=no
homecity=None
locations
15,89
16,90
14,90
13,89
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Imperials
technology=98
@THEN
CREATEUNIT
unit=Cuirassiers [Imp]
Count=8
owner=Imperials
veteran=no
homecity=None
locations
15,89
16,90
14,90
13,89
endlocations
@ENDIF

@IF
ReceivedTechnology
receiver=Imperials
technology=98
@THEN
CREATEUNIT
unit=Dragoons [Imp]
Count=4
owner=Imperials
veteran=no
homecity=None
locations
15,89
16,90
14,90
13,89
endlocations
@ENDIF

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

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

@IF
ReceivedTechnology
receiver=House of Brandenburg
technology=98
@THEN
CREATEUNIT
unit=Dragoons [Br]
Count=3
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=9
owner=Swedes
veteran=no
homecity=None
locations
15,23
0,56
35,35
endlocations
@ENDIF

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

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