summaryrefslogtreecommitdiff
path: root/events.txt
blob: 0af6299612ff0d56d343371374b84240899822e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# Events for Vijayanagara

EVENT 1
	stay_eligible
	current REBEL_FACTIONS
	prompt "Move all Governors to Provinces adjacent to Delhi."
	piece all (is_governor(p))
		space 1 (set_has(SPACES[S_DELHI].adjacent, s) && s != S_PUNJAB)
			move
		endspace
	endpiece
	free_rebel

SHADED 1
	stay_eligible
	current DS
	prompt "Select a space to move Units into and Attack for free."
	space 1 s>=0
		prompt `Move up to ${8-game.vm.pl.length} units into the selected space.`
		mark_space
		move_to (game.vm.s) (is_ds_unit(p) && is_piece_on_map(p) && !is_piece_in_event_space(p) && game.vm.pl.length < 8)
		if (has_piece_faction(game.vm.s, BK) || has_piece_faction(game.vm.s, VE))
			to_rebel BK
			to_rebel VE
			log_br
			log `Opposing Units to Rebelling in ${SPACE_NAME[game.vm.s]}.`
		endif
	endspace
	clean_cmd
	prompt `Free Attack in ${SPACE_NAME[game.vm.m[0]]}.`
	space 1 (s === game.vm.m[0] && can_attack_in_space(s))
		free_attack
	endspace


EVENT 2
	stay_eligible
	prompt "Remove up to 2 Delhi Sultanate Units in both Mountain Passes and Punjab."
	space 2 ((s === S_MOUNTAIN_PASSES || s === S_PUNJAB) && has_ds_unit(s))
		prompt "Remove up to 2 Delhi Sultanate Units."
		piece_undo_opt 2 is_ds_unit(p) && is_piece_in_event_space(p)
			summary_remove
		endpiece
	endspace
	pop_summary

SHADED 2
	stay_eligible
	current DS
	prompt "Attack in Mountain Passes or Punjab for free."
	space 1 ((s === S_MOUNTAIN_PASSES || s === S_PUNJAB) && has_ds_unit(s) && has_piece(s, MI, TROOPS))
		free_attack
	endspace
	clean_cmd
	prompt "Rearrange up to 6 Units among Mountain Passes and Punjab and one other space."
	space 1 (s !== S_MOUNTAIN_PASSES && s !== S_PUNJAB)
		mark_space
	endspace
	prompt `Move up to ${6-game.vm.pp.length} Units.`
	piece_opt 6 ([S_MOUNTAIN_PASSES, S_PUNJAB, game.vm.m[0]].includes(piece_space(p)) && is_ds_unit(p))
		prompt `Move up to ${6-game.vm.pp.length+1} Units.`
		space 1 ((s === S_MOUNTAIN_PASSES || s === S_PUNJAB || s === game.vm.m[0]) && s !== piece_space(game.vm.p))
			move
		endspace
	endpiece

EVENT 3
	current REBEL_FACTIONS
	prompt "Free Rally and gain 2 Resources in each Province adjacent to Warangal where you have a piece."
	space_opt all (is_adjacent_to_city(C_WARANGAL, s) && has_piece_faction(s, game.current))
		free_rally
		resources (game.current) 2
	endspace

SHADED 3
	current DS
	prompt "In each Province adjacent to Warangal where you have a piece, steal 2 Resources from each other Faction present."
	space_opt all (is_adjacent_to_city(C_WARANGAL, s) && has_piece_faction(s, DS) && has_piece_enemy_faction(s, DS))
		if has_piece_faction(game.vm.s, BK)
			steal DS BK 2
		endif
		if has_piece_faction(game.vm.s, VE)
			steal DS VE 2
		endif
	endspace

EVENT 4
	stay_eligible
	current REBEL_FACTIONS
	prompt `Replace a Governor with an Obedient or Rebelling ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
	piece 1 is_governor(p)
		replace_choice (game.current) ELITE
	endpiece

SHADED 4
	stay_eligible
	current DS
	prompt "Govern ignoring location requirements."
	asm game.vm.ignore_loc_req = true
	govern

EVENT 5
	stay_eligible
	current REBEL_FACTIONS
	prompt `Replace up to 2 Delhi Sultanate Units with Rebelling ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
	piece_undo_opt 2 (is_adjacent_to_city(C_CHITTOR, piece_space(p)) && is_ds_unit(p))
		replace_rebel (game.current) ELITE
	endpiece
	prompt `Place a ${PIECE_FACTION_TYPE_NAME[game.current][DISC]} in Rajput Kingdoms.`
	space_opt 1 (s === S_RAJPUT_KINGDOMS && can_place_piece(s, game.current, DISC))
		auto_place (game.current) DISC
	endspace

SHADED 5
	stay_eligible
	current DS
	prompt "Replace up to 3 opposing Units adjacent to Chittor with Troops."
	piece_undo_opt 3 (is_adjacent_to_city(C_CHITTOR, piece_space(p)) && is_enemy_unit(p))
		replace DS TROOPS
	endpiece
	prompt "Place a Qasbah in Rajput Kingdoms."
	space_opt 1 (s === S_RAJPUT_KINGDOMS && can_place_piece(s, DS, DISC))
		auto_place DS DISC
	endspace

EVENT 6
	stay_eligible
	current REBEL_FACTIONS
	prompt `Remove a Tributary marker in one Province adjacent to Warangal.`
	space_opt 1 (is_adjacent_to_city(C_WARANGAL, s))
		remove_tributary
		prompt `Place up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
		place_undo_opt 2 (game.current) ELITE
	endspace

SHADED 6
	stay_eligible
	current DS
	prompt "Execute a Campaign ending in a Province adjacent to Warangal."
	shaded_6
	shaded_6_2

EVENT 7
	stay_eligible
	current REBEL_FACTIONS
	prompt `Place up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}s in Tamilakam.`
	space 1 (s === S_TAMILAKAM)
		place_undo_opt 2 (game.current) ELITE
	endspace
	cav_resources 3

SHADED 7
	stay_eligible
	current DS
	prompt `Place up to 4 Troops and a Governor in Tamilakam.`
	space 1 (s === S_TAMILAKAM)
		place_undo_opt 4 DS TROOPS
		place_undo_opt 1 DS ELITE
	endspace
	cav_resources 3

EVENT 8
	current REBEL_FACTIONS
	prompt `In each Province adjacent to Devagiri and/or Gulbarga, replace a Delhi Sultanate Unit with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
	space_opt all (is_adjacent_to_city(C_DEVAGIRI, s) || is_adjacent_to_city(C_GULBARGA, s)) && has_ds_unit(s)
		prompt `Replace a Delhi Sultanate Unit with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
		piece 1 is_ds_unit(p) && is_piece_in_event_space(p)
			replace (game.current) ELITE
		endpiece
	endspace

SHADED 8
	current DS
	prompt `In each Province adjacent to Devagiri and/or Gulbarga, Govern for free ignoring location requirements and place a Troop.`
	asm game.vm.ignore_loc_req = true
	space_opt all (is_adjacent_to_city(C_DEVAGIRI, s) || is_adjacent_to_city(C_GULBARGA, s)) && (can_govern_in_space(s) || can_place_piece(s, DS, TROOPS))
		if (can_govern_in_space(game.vm.s))
			free_govern_in_space_skip
		endif
		if (can_place_piece(game.vm.s, DS, TROOPS))
			place_opt 1 DS TROOPS
		endif
	endspace

EVENT 9
	current VE
	prompt "Compel in a Province adjacent to Warangal that you do not control, then Build there."
	add_influence VE
	space 1 (is_adjacent_to_city(C_WARANGAL, s) && !is_faction_control(s, game.current) && can_compel_in_space(s))
		free_compel
		mark_space
	endspace
	prompt `Build in ${SPACE_NAME[game.vm.m[0]]}.`
	space_opt 1 (s === game.vm.m[0] && can_place_piece(s, game.current, DISC))
		free_build
	endspace

SHADED 9
	current DS
	resources (game.current) 3
	prompt "Place up to 4 Troops and a Governor in a Province adjacent to Warangal and Demand Obedience there."
	space 1 is_adjacent_to_city(C_WARANGAL, s)
		place_undo_opt 4 DS TROOPS
		place_undo_opt 1 DS ELITE
		demand_obedience
	endspace

EVENT 10
	stay_eligible
	prompt "Move up to 4 Delhi Sultanate Units to adjacent Provinces."
	piece_undo_opt 4 (is_ds_unit(p) && is_province(piece_space(p)))
		prompt "Move Delhi Sultanate Unit to an adjacent Province."
		space_no_undo 1 (is_adjacent(s, piece_space(game.vm.p)) && is_province(s))
			move
		endspace
	endpiece
	resources DS -5

SHADED 10
	stay_eligible
	current DS
	prompt "Move any Qasbahs to spaces containing Governors."
	piece_undo_opt all is_qasbah(p)
		prompt "Move Qasbah to any space containing a Governor."
		space 1 has_governor(s) && !has_qasbah(s)
			move
		endspace
	endpiece
	prompt "Add up to 2 Troops in each space with a Qasbah."
	space_opt all has_qasbah(s)
		place_undo_opt 2 DS TROOPS
	endspace

EVENT 11
	stay_eligible
	prompt "Place up to two Mongol Invaders in each of Mtn Passes and Punjab."
	space_opt 2 (s === S_PUNJAB || s === S_MOUNTAIN_PASSES)
		place_undo_opt 2 MI TROOPS
	endspace

SHADED 11
	stay_eligible
	current DS
	prompt "Remove up to 4 Mongol Invaders."
	piece_undo_opt 4 is_mongol_invader(p)
		summary_remove
	endpiece
	pop_summary

EVENT 12
	current REBEL_FACTIONS
	gain_cavalry 2
	prompt "Remove up to 4 Delhi Sultanate pieces from Provinces adjacent to Warangal."
	piece_undo_opt 4 (is_adjacent_to_city(C_WARANGAL, piece_space(p)) && piece_faction(p) === DS)
		summary_remove
	endpiece
	pop_summary

SHADED 12
	current DS
	gain_cavalry 2
	prompt "Place a Qasbah in a Province adjacent to Warangal."
	space_opt 1 is_adjacent_to_city(C_WARANGAL, s) && can_place_piece(s, DS, DISC)
		auto_place DS DISC
	endspace
	asm game.vm.count = 0
	repeat 4
		prompt `Place up to ${4-game.vm.count} Troops adjacent to Warangal.`
		space_opt 1 is_adjacent_to_city(C_WARANGAL, s) && can_place_piece(s, DS, TROOPS)
			auto_place DS TROOPS
			asm (game.vm.count += 1)
		endspace
	endrepeat
	prompt "Execute a free Limited Attack adjacent to Warangal."
	space 1 (is_adjacent_to_city(C_WARANGAL, s) && can_attack_in_space(s))
		free_attack
	endspace

EVENT 13
	current VE
	asm game.vm.count = (Math.min((4 - game.inf[VE]), 2) * 2)
	add_influence VE
	add_influence VE
	asm game.vm.placed = 0
	repeat (game.vm.count)
		prompt `Place up to ${game.vm.count-game.vm.placed} Rajas adjacent to Vijayanagara.`
		space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s) && can_place_piece(s, VE, ELITE)
			auto_place VE ELITE
			asm (game.vm.placed += 1)
		endspace
	endrepeat

SHADED 13
	prompt "Select a Province with Rajas adjacent to a Province with a Bahmani piece."
	space 1 (has_piece(s, VE, ELITE) && SPACES[s].adjacent.some(ss => has_piece_faction(ss, BK)))
		mark_space
	endspace
	prompt "Select a destination Province for the Rajas."
	space 1 (is_adjacent(s, game.vm.m) && has_piece_faction(s, BK))
		prompt `Move any number of Rajas into ${SPACE_NAME[game.vm.m[0]]}.`
		piece_opt all (is_raja(p) && (piece_space(p) === game.vm.m[0]))
			move
		endpiece
		mark_space
	endspace
	current BK
	prompt `Attack Vijayanagara Empire in ${SPACE_NAME[game.vm.m[0]]} for free.`
	space_opt 1 (game.vm.m[1] === s)
		free_attack VE
	endspace

EVENT 14
	current VE
	gain_cavalry 2
	prompt "Remove a Tributary marker in a Province adjacent to Vijayanagara."
	space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s) && is_tributary(s)
		remove_tributary
	endspace
	asm game.vm.count = 0
	repeat 2
		prompt `Place up to ${2-game.vm.count} Rajas adjacent to Vijayanagara.`
		space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s) && can_place_piece(s, VE, ELITE)
			auto_place VE ELITE
			asm (game.vm.count += 1)
		endspace
	endrepeat

SHADED 14
	current DS
	gain_cavalry 3
	prompt "Place up to 4 Troops and a Governor in a province adjacent to Vijayanagara and Demand Obedience there."
	space_opt 1 is_adjacent_to_city(C_VIJAYANAGARA, s)
		place_undo_opt 4 DS TROOPS
		place_undo_opt 1 DS ELITE
		demand_obedience
	endspace

EVENT 15
	stay_eligible
	prompt "Replace any Governors adjacent to Devagiri with Rebelling Amirs."
	piece_undo_opt all is_adjacent_to_city(C_DEVAGIRI, piece_space(p)) && is_governor(p)
		set_piece_space
		mark_space
		replace_rebel BK ELITE
		set_space -1
	endpiece
	prompt "Remove a Tributary marker in one affected Province."
	space_opt 1 is_tributary(s) && set_has(game.vm.m, s)
		remove_tributary
	endspace

SHADED 15
	stay_eligible
	prompt "Replace an Amir with a Governor and place a Tributary marker in a Province adjacent to Devagiri."
	space 1 (is_adjacent_to_city(C_DEVAGIRI, s) && !is_tributary(s) && has_amir(s))
		asm game.vm.p = find_piece(game.vm.s, BK, ELITE)
		replace DS ELITE
		place_tributary
	endspace

EVENT 16
	stay_eligible
	current BK
	asm game.vm.count = 0
	repeat 3
		prompt `Place up to ${3-game.vm.count} Amirs adjacent to Gulbarga.`
		space_opt 1 is_adjacent_to_city(C_GULBARGA, s) && can_place_piece(s, BK, ELITE)
			auto_place BK ELITE
			asm (game.vm.count += 1)
		endspace
	endrepeat
	prompt "Place a Fort adjacent to Gulbarga."
	space_opt 1 is_adjacent_to_city(C_GULBARGA, s) && can_place_piece(s, BK, DISC)
		auto_place BK DISC
	endspace

SHADED 16
	stay_eligible
	current [DS VE]
	if game.current === DS
		prompt "Free March into a Province with a Fort, then remove the Fort."
		space_opt 1 has_piece(s, BK, DISC) && can_march_in_space(s)
			free_march
			asm game.vm.p = find_piece(game.vm.s, BK, DISC)
			remove
		endspace
	else
		prompt "Free Migrate into a Province with a Fort, then remove the Fort."
		space_opt 1 has_piece(s, BK, DISC) && can_migrate_in_space(s)
			free_migrate
			log_br
			asm game.vm.p = find_piece(game.vm.s, BK, DISC)
			remove
		endspace
	endif

EVENT 17
	current BK
	add_influence BK
	log_br
	prompt "Remove up to 5 Delhi Sultanate pieces from Provinces where you have a piece."
	piece_undo_opt 5 (is_ds_unit(p) || is_qasbah(p)) && has_piece_faction(piece_space(p), BK)
		summary_remove
	endpiece
	pop_summary

SHADED 17
	prompt "Remove a Fort and up to 2 Amirs from one Province."
	space_opt 1 has_piece_faction(s, BK)
		prompt `Remove a Fort from ${SPACE_NAME[game.vm.s]}.`
		piece_undo_opt 1 is_piece_in_event_space(p) && is_fort(p)
			remove
		endpiece
		prompt `Remove up to 2 Amirs from ${SPACE_NAME[game.vm.s]}.`
		piece_undo_opt 2 is_piece_in_event_space(p) && is_amir(p)
			summary_remove
		endpiece
		pop_summary
	endspace
	resources BK -2

EVENT 18
	stay_eligible
	if n_province_with_both_rebels() > 0
		repeat (n_province_with_both_rebels())
			add_influence BK
		endrepeat
	else
		log "No Province containing both Bahmani and Vijayanagara pieces."
	endif

SHADED 18
	stay_eligible
	current [DS VE]
	prompt `Replace an Amir with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
	piece_opt 1 is_amir(p) && is_piece_on_map(p)
		replace (game.current) ELITE
	endpiece
	remove_influence BK

EVENT 19
	current REBEL_FACTIONS
	prompt `Place up to 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]} in Jaunpur and Bengal.`
	space_opt all (s === S_BENGAL || s === S_JAUNPUR) && can_place_piece(s, game.current, ELITE)
		place_opt 2 (game.current) ELITE
	endspace
	prompt "Remove a Tributary marker in Jaunpur or Bengal."
	space_opt 1 (s === S_BENGAL || s === S_JAUNPUR) && is_tributary(s)
		remove_tributary
	endspace

SHADED 19
	current DS
	prompt `Place up to 4 ${PIECE_FACTION_TYPE_NAME[game.current][TROOPS]} in Jaunpur and Bengal.`
	space_opt all (s === S_BENGAL || s === S_JAUNPUR) && can_place_piece(s, game.current, TROOPS)
		place_opt 4 (game.current) TROOPS
	endspace
	prompt "Place a Tributary marker in Jaunpur or Bengal."
	space_opt 1 (s === S_BENGAL || s === S_JAUNPUR) && !is_tributary(s)
		place_tributary
	endspace

EVENT 20
	current REBEL_FACTIONS
	add_influence (game.current)
	prompt "In Orissa or an adjacent Province, you may free Migrate, then free Rally, then Build."
	space 1 (is_adjacent_to_city(C_WARANGAL, s) || s === S_BENGAL)
		mark_space
		prompt `Migrate in ${SPACE_NAME[game.vm.s]} for free.`
		if (can_migrate_in_space(game.vm.s))
			free_migrate
		endif
	endspace
	prompt `Rally in ${SPACE_NAME[game.vm.m[0]]} for free.`
	space_opt 1 (game.vm.m[0] === s && can_rally_in_space(s))
		free_rally
	endspace
	prompt `Build in ${SPACE_NAME[game.vm.m[0]]}.`
	space_opt 1 (game.vm.m[0] === s && can_build_in_space(s))
		free_build
	endspace

SHADED 20
	current DS
	prompt "In Orissa, remove a Temple/Fort, place a Governor, a Qasbah, up to 2 Troops and a Tributary marker."
	space 1 (s === S_ORISSA)
		piece_opt 1 ((is_temple(p) || is_fort(p)) && is_piece_in_event_space(p))
			remove
		endpiece
		place_opt 1 DS ELITE
		place_opt 1 DS DISC
		place_opt 2 DS TROOPS
		place_tributary
	endspace

EVENT 21
	stay_eligible
	current REBEL_FACTIONS
	prompt "Move any Troops from Gondwana and Madhyadesh to Delhi."
	move_to S_DELHI (is_troop(p) && (piece_space(p) === S_GONDWANA || piece_space(p) === S_MADHYADESH))

SHADED 21
	stay_eligible
	current DS
	if (can_campaign())
		campaign
	endif
	prompt `Govern, Attack, or Demand Obedience in a Province adjacent to the Vindhya Range.`
	space 1 ([S_MALWA, S_MADHYADESH, S_JAUNPUR, S_GONDWANA].includes(s) && can_govern_attack_demand_in_space(s))
		govern_attack_demand
	endspace

EVENT 22
	stay_eligible
	current REBEL_FACTIONS
	prompt `Build in any Province with a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}.`
	space 1 can_build_in_space(s)
		free_build
	endspace

SHADED 22
	stay_eligible
	current DS
	prompt "Place a Troop in one space."
	space_opt 1 can_place_piece(s, DS, TROOPS)
		place_opt 1 DS TROOPS
	endspace
	prompt "Place up to 2 Troops in a second space."
	space_opt 1 can_place_piece(s, DS, TROOPS)
		place_opt 2 DS TROOPS
	endspace
	prompt "Place up to 4 Troops in a third space."
	space_opt 1 can_place_piece(s, DS, TROOPS)
		place_opt 4 DS TROOPS
	endspace

EVENT 23
	current VE
	add_influence VE
	prompt "Build and then replace a Unit with a Raja in each Province with a Temple."
	space_opt 1 can_build_in_space(s)
		free_build
		log_br
	endspace
	prompt "Replace a Unit with a Raja in each Province with a Temple."
	space_opt all has_temple(s) && has_units_enemy_faction(s)
		piece_opt 1 is_enemy_unit(p) && is_piece_in_event_space(p)
			replace VE ELITE
		endpiece
	endspace

SHADED 23
	prompt "Place 4 Units in a Province with a Temple."
	space_opt 1 has_temple(s)
		place_opt 4 (game.current) UNITS
		prompt "Remove the Temple."
		piece 1 (is_temple(p) && is_piece_in_event_space(p))
			remove
		endpiece
	endspace
	steal (game.current) VE 2

EVENT 24
	stay_eligible
	current VE
	prompt "Free Migrate in up to 2 locations."
	space_opt 2 can_migrate_in_space(s)
		free_migrate
		mark_space
	endspace
	log_br
	prompt "Replace a Unit with a Raja in one of the spaces."
	clean_p
	piece_opt 1 (set_has(game.vm.m, piece_space(p)) && is_enemy_unit(p))
		replace (game.current) ELITE
	endpiece

SHADED 24
	stay_eligible
	current [DS BK]
	prompt "Place up to 2 Units in each Province with a Temple."
	space_opt all has_temple(s)
		place_opt 2 (game.current) UNITS
	endspace

EVENT 25
	stay_eligible
	current REBEL_FACTIONS
	event_25

SHADED 25
	stay_eligible
	current DS
	prompt "Place up to 2 Troops in 3 Provinces adjacent to Goa or Warangal."
	space_opt 3 (is_adjacent_to_city(C_GOA, s) || is_adjacent_to_city(C_WARANGAL, s))
		mark_space
		place_opt 2 DS TROOPS
	endspace
	prompt "Govern in one of the selected Provinces for free."
	space 1 (can_govern_in_space(s) && set_has(game.vm.m, s))
		free_govern_in_space
	endspace

EVENT 26
	stay_eligible
	event_26

EVENT 27
	current BK
	add_influence BK
	prompt "Place up to 2 Amirs in each of Sindh and Gujarat."
	space_opt all (s === S_GUJARAT || s === S_SINDH) && can_place_piece(s, game.current, ELITE)
		place_opt 2 BK ELITE
	endspace
	prompt "Place a Fort and remove a Tributary marker in Sindh."
	space 1 (s === S_SINDH)
		place 1 BK DISC
		remove_tributary
	endspace

SHADED 27
	current DS
	prompt "Place up to 2 Troops and a Governor in each of Sindh and Gujarat."
	space_opt all (s === S_GUJARAT || s === S_SINDH) && (can_place_piece(s, game.current, ELITE) || can_place_piece(s, game.current, TROOPS))
		place_opt 2 DS TROOPS
		place_opt 1 DS ELITE
	endspace
	prompt "Place a Qasbah and a Tributary marker in Sindh."
	space 1 (s === S_SINDH)
		place 1 DS DISC
		place_tributary
	endspace

EVENT 28
	stay_eligible
	add_influence BK
	remove_influence VE
	current BK
	prompt "Spend a Cavalry token to place 2 Amirs and remove a Raja in Andhra."
	space_opt 1 ((s === S_ANDHRA) && (n_cavalry(BK) > 0))
		spend_cavalry 1
		prompt "Place 2 Amirs in Andhra."
		place 2 BK ELITE
		prompt "Remove a Raja in Andhra."
		piece 1 (is_raja(p) && is_piece_in_event_space(p))
			remove
		endpiece
	endspace

SHADED 28
	stay_eligible
	current [DS VE]
		if (game.current === DS)
			prompt "In a space with a Bahmani piece, place up to 2 Troops and free Attack (defender rolls no dice)."
		else
			prompt "In a space with a Bahmani piece, place up to 2 Rajas and free Attack (defender rolls no dice)."
		endif
		space 1 (has_piece_faction(s, BK))
		if (game.current === DS)
			place_opt 2 DS TROOPS
		else
			place_opt 2 VE ELITE
		endif
		free_attack BK
	endspace

EVENT 29
	stay_eligible
	current BK
	gain_cavalry 3
	prompt "Execute a free Limited Attack."
	space 1 (can_attack_in_space(s))
		free_attack
	endspace

SHADED 29
	stay_eligible
	shaded_29
	prompt "Execute a free Limited Attack."
	space 1 (can_attack_in_space(s))
		free_attack
	endspace

EVENT 30
	stay_eligible
	current BK
	prompt "Free Attack in each Province with a Fort (defender rolls no dice)."
	space_opt 5 (has_fort(s) && can_attack_in_space(s))
		free_attack
	endspace

SHADED 30
	stay_eligible
	prompt "Free limited Attack (attacker rolls 4 dice; defender rolls no dice)."
	space 1 (can_attack_in_space(s))
		free_attack
	endspace

EVENT 31
	current REBEL_FACTIONS
	prompt "Free Migrate into a Province adjacent to Vijayanagara."
	space_opt 1 (is_adjacent_to_city(C_VIJAYANAGARA, s) && can_migrate_in_space(s))
		mark_space
		free_migrate
		clean_cmd
		clean_p
		prompt `Remove an opposing Unit from ${SPACE_NAME[game.vm.s]}.`
		piece 1 (is_piece_in_event_space(p) && is_enemy_unit(p))
			remove
		endpiece
	endspace
	prompt `Free Attack in ${SPACE_NAME[game.vm.m[0]]}.`
	space_opt 1 (s === game.vm.m[0] && can_attack_in_space(s))
		free_attack
	endspace

SHADED 31
	current DS
	prompt "Remove a Fort adjacent to Vijayanagara"
	piece_opt 1 (is_fort(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p)))
		remove
	endpiece
	prompt "Remove a Temple adjacent to Vijayanagara"
	piece_opt 1 (is_temple(p) && is_adjacent_to_city(C_VIJAYANAGARA, piece_space(p)))
		remove
	endpiece
	remove_influence BK
	remove_influence VE

EVENT 32
	stay_eligible
	current REBEL_FACTIONS
	add_influence (game.current)
	remove_influence (other_rebel_faction(game.current))
	prompt `Replace up to 2 ${PIECE_FACTION_TYPE_NAME[other_rebel_faction(game.current)][ELITE]}s with 2 ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]}s.`
	piece_opt 2 is_enemy_piece(p) && is_rebel_faction_elite(p) && is_piece_on_map(p)
		replace (game.current) ELITE
	endpiece

SHADED 32
	stay_eligible
	remove_influence BK
	remove_influence VE

EVENT 33
	stay_eligible
	current (has_majority_goa())
	prompt "Remove up to 3 opposing Units adjacent to Goa."
	piece_opt 3 (is_adjacent_to_city(C_GOA, piece_space(p)) && is_enemy_unit(p))
		summary_remove
	endpiece
	pop_summary
	resources (game.current) 2

SHADED 33
	stay_eligible
	current DS
	prompt "Reduce Rebel Factions Resources by half."
	resources_opt BK (-Math.floor(game.resources[BK]/2))
	resources_opt VE (-Math.floor(game.resources[VE]/2))

EVENT 34
	stay_eligible
	current VE
	steal VE BK 2
	steal_cavalry VE BK 2

SHADED 34
	stay_eligible
	current BK
	conspire_trade

EVENT 35
	stay_eligible
	current REBEL_FACTIONS
	add_influence (game.current)
	prompt `Place a ${PIECE_FACTION_TYPE_NAME[game.current][ELITE]} in up to 3 Provinces with a ${PIECE_FACTION_TYPE_NAME[other_rebel_faction(game.current)][ELITE]}.`
	space_opt 3 has_piece(s, other_rebel_faction(game.current), ELITE) && can_place_piece(s, game.current, ELITE)
		auto_place (game.current) ELITE
	endspace

SHADED 35
	stay_eligible
	remove_influence BK
	remove_influence VE

EVENT 36
	stay_eligible
	current VE
	asm game.vm.count = 0
	repeat 4
		prompt `Place up to ${4-game.vm.count} Rajas adjacent to Chittor.`
		space_opt 1 is_adjacent_to_city(C_CHITTOR, s) && can_place_piece(s, VE, ELITE)
			auto_place VE ELITE
			asm (game.vm.count += 1)
		endspace
	endrepeat

SHADED 36
	stay_eligible
	remove_influence VE
	prompt "Remove up to 3 Rajas from the map."
	piece_opt 3 is_raja(p) && is_piece_on_map(p)
		summary_remove
	endpiece
	pop_summary

SUCC 0
	force_current DS
	log_succ DS "Power struggle in Delhi."
	flip_dynasty
	log_succ DS "The Sultanate reimposes its dominance."
	campaign
	force_current BK
	prompt "Gain Cavalry equal to Influence and Forts."
	log_succ BK "Military labor market thrives."
	gain_cavalry (game.inf[BK] + count_pieces_on_map(BK, DISC))
	force_current VE
	prompt "Gain Resources equal to Influence and Temples."
	log_succ VE "Temple towns emerge anew."
	resources VE (game.inf[VE] + count_pieces_on_map(VE, DISC))

SUCC 2
	force_current DS
	log_succ DS "Delhi monitors its interests."
	campaign
	force_current BK
	log_succ BK "Ala-ud-Din Hasan Bahman Shah gathers allies and takes the Deccan throne."
	any_limited_command
	if (game.prosperity[BK] === 0)
		log_br
		log "Not enough Prosperity."
	else
		cav_resources (Math.min(game.prosperity[BK],3))
	endif
	clean_cmd
	force_current VE
	log_succ VE "Sangama brothers establish an empire."
	any_limited_command
	if (game.prosperity[VE] === 0)
		log_br
		log "Not enough Prosperity."
	else
		cav_resources (Math.min(game.prosperity[VE],3))
	endif

SUCC 3
	force_current DS
	log_succ DS "Renewed focus on infrastructure."
	influence_succession
	force_current BK
	log_succ BK "Trade network covers the Deccan."
	influence_succession
	force_current VE
	log_succ VE "Vast, unifying medieval metropolis."
	influence_succession

SUCC 4
	force_current DS
	log_succ DS "Succession Crisis in Delhi."
	timurid_crisis

SUCC 5
	force_current DS
	prompt "Mongols attack the Mountain Passes!"
	space 1 (s === S_MOUNTAIN_PASSES && has_ds_unit(s) && has_mi_unit(s))
		free_attack DS
	endspace
	prompt "Mongols move to Punjab."
	space 1 (s === S_PUNJAB)
		timurid_advance S_MOUNTAIN_PASSES S_PUNJAB
	endspace
	prompt "Mongols attack Punjab!"
	space 1 (s === S_PUNJAB && has_ds_unit(s) && has_mi_unit(s))
		free_attack DS
	endspace
	prompt "Mongols move to Delhi."
	space 1 (s === S_DELHI)
		timurid_advance S_PUNJAB S_DELHI
	endspace
	prompt "Mongols lay siege to Delhi!"
	space 1 (s === S_DELHI && has_ds_unit(s) && has_mi_unit(s))
		while (has_ds_unit(game.vm.s) && has_mi_unit(game.vm.s))
			free_attack DS
		endwhile
	endspace
	end_game