﻿{
	"counters":
	[
		{ "sid": "infinite_turn_start", "value": 0, "comment": "счетчик включения бесконечного хода в миссии" },
		
		{ "sid": "valentina_freed", 	"value": 0, "comment": "мейнквест, Валентина освобождена из клетки" },

		{ "sid": "angel_quest", 		"value": 0, "comment": "квест с ангелом: 0 - не начат, 1 - в процессе, 2 - завершен/провален, 3 - прогнал ангела в конце у Валентины" },
		{ "sid": "angel_quest_failed", 	"value": 0, "comment": "квест с ангелом провален тем или иным образом" },
		{ "sid": "angel_with_gunnar", 	"value": 0, "comment": "несет ли гуннар ангела с собой в данный момент" },
		{ "sid": "angel_with_filacus", 	"value": 0, "comment": "несет ли филакус ангела с собой в данный момент" },
		{ "sid": "angel_by_herself", 	"value": 0, "comment": "ангел отправилась в путь сама по себе" },

		{ "sid": "trogl_quest", 		"value": 0, "comment": "квест с троглом: 0 - не начат, 1 - в процессе, 2 - завершен/провален" },
		{ "sid": "trogl_quest_failed", 	"value": 0, "comment": "провален ли квест с троглом" },
		{ "sid": "trogl_with_filacus", 	"value": 0, "comment": "несет ли филакус трогла с собой в данный момент" },
		{ "sid": "trogl_lost", 			"value": 0, "comment": "потерял ли игрок трогла" },
		{ "sid": "trogl_home", 			"value": 0, "comment": "донес ли игрок трогла до его пещеры успешно" },

		{ "sid": "altar1_interacted", 	"value": 0, "comment": "вспомогательный счетчик для Q7, пробовал ли игрок челлендж алтаря Удачи" },
		{ "sid": "altar2_interacted", 	"value": 0, "comment": "вспомогательный счетчик для Q7, пробовал ли игрок челлендж алтаря Света" },
		{ "sid": "altar3_interacted", 	"value": 0, "comment": "вспомогательный счетчик для Q7, пробовал ли игрок челлендж алтаря Денег" }
	],

	"quests":
	[
		{
			"sid": "intro",
			"hidden": true,
			"activeOnStart": true,

			"comment": "intro",

			"name": "1",
			"sharing": "Clone",

			"subQuests":
			[	
				{
					"sid": "1",
					"activeOnStart": true,

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "StartTurn", "p": [ "1", "1" ] }
							],
 
							"actions":
							[
								{ "a": "Dialog", "p": [ "M6Q1_dial1" ] },
								{ "a": "RevealFogOfWar", "p": [ "2206", "2" ] }
							]
						},
						{
							"conditions":
							[
								{ "c": "StartTurn", "p": [ "1", "1" ] }
							],

							"actions":
							[
								{ "a": "SpawnSquadNPC", "p": [ "squad_M11_dungeon_medusa_upg", "272", "40000", "true", "medusa_squad" ] },
								{ "a": "SetFlagEscape", "p": [ "medusa_squad", "false" ] },
								{ "a": "SetFlagAutobattle", "p": [ "medusa_squad", "false" ] },
								{ "a": "ChangeSquadReactionType", "p": [ "medusa_squad", "Aggressive" ] },

								{ "a": "SpawnHero", "p": [ "campaign_M6_hero_unfrozen", "146", "1" ] },
								{ "a": "DisableAiHero", "p": [ "campaign_M6_hero_unfrozen" ] },
								{ "a": "HeroToNode", "p": [ "campaign_M6_hero_unfrozen", "209" ] },

								{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_03", "3469", "false", "true", "pm_portal0" ] },
								{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_03", "3849", "false", "true", "pm_portal1" ] },
								{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_03", "1278", "false", "true", "pm_portal2" ] },
								{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_03", "2514", "false", "true", "pm_portal3" ] },
								{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_03", "1729", "false", "true", "pm_portal4" ] },
								{ "a": "CreateVFX", "p": [ "fx_quest_mark_silver_01", "209", "false", "true", "qm_sister" ] },
								{ "a": "SetQuestMarker", "p": [ "boss1", "effects/global_map/quest_mark_gold_02" ] },
								{ "a": "SetQuestMarker", "p": [ "boss2", "effects/global_map/quest_mark_gold_02" ] },
								{ "a": "SetQuestMarker", "p": [ "cage", "effects/global_map/quest_mark_gold_01" ] },
								{ "a": "SetQuestMarker", "p": [ "trogl", "effects/global_map/quest_mark_silver_01" ] },
								{ "a": "SetQuestMarker", "p": [ "altar1", "effects/global_map/quest_mark_silver_01" ] },
								{ "a": "SetQuestMarker", "p": [ "altar2", "effects/global_map/quest_mark_silver_01" ] },
								{ "a": "SetQuestMarker", "p": [ "altar3", "effects/global_map/quest_mark_silver_01" ] },
								{ "a": "SetQuestMarker", "p": [ "angel", "effects/global_map/quest_mark_silver_01" ] },
								{ "a": "SetQuestMarker", "p": [ "spy", "effects/global_map/quest_mark_silver_01" ] }
							]
						}
					]
				},
				{
					"sid": "2",
					"activeOnStart": true,
					"comment": "difficulty settings",

					"triggers":
					[
						{
							"conditionsLogic": "And",

							"conditions":
							[
								{ "c": "StartTurn", "p": [ "1", "1" ] },
								{ "c": "Difficulty", "p": [ "0" ] }
							],

							"actions":
							[
								{ "a": "AddBuffHeroDays", "p": [ "campaign_heroStatBuff_easy_2", "campaign_hero_1", "-1" ] },
								{ "a": "AddBuffHeroDays", "p": [ "campaign_heroStatBuff_easy_2", "campaign_hero_2", "-1" ] }
							]
						}
					]
				}
			]
		},
		{
			"sid": "intro_ChangeCampaignOneStep",

			"hidden": true,

			"comment": "intro",

			"activeOnStart": true,
			"sharing": "Clone",

			"name": "1",

			"subQuests":
			[	
				{
					"sid": "1",
					"activeOnStart": true,

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "infinite_turn_start", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "ChangeCampaignOneStep", "p": [ "true" ] }							
							]
						}
					]
				}
			]
		},

		{
			"sid": "Questlog0",
			"main": true,

			"comment": "Квест 'Герои не должны умереть'",

			"activeOnStart": true,
			"sharing": "Clone",

			"name": "quest_name_genericQ0",

			"subQuests":
			[
				{
					"sid": "Questlog0_1",
					"activeOnStart": true,
					
					"name": "quest_sub_M4Q0_1",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "valentina_freed", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "CurrentSubQuestDone" }
							]
						},
						{
							"conditionsLogic": "Or",
							"conditions":
							[
								{ "c": "HeroKill", "p": [ "campaign_hero_1" ] },
								{ "c": "HeroKill", "p": [ "campaign_hero_2" ] }
							],

							"actions":
							[
								{ "a": "GameLose" }
							]
						}
					]
				}
			]
		},
		
		{
			"sid": "Questlog1",
			"main": true,

			"comment": "main quest - find valentina",

			"activeOnStart": true,
			"sharing": "Clone",

			"name": "quest_name_M6Q1",

			"subQuests":
			[	
				{
					"sid": "Questlog1_1",
					"activeOnStart": true,
					
					"name": "quest_sub_M6Q1_1",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "ObjectInteractionBefore", "p": [ "before_cage" ] }
							],

							"actions":
							[
								{ "a": "CurrentSubQuestDone" },
								{ "a": "NextSubQuest", "p": [ "Questlog1_2" ] }
							]
						}
					]
				},
				{
					"sid": "Questlog1_2",
					
					"name": "quest_sub_M6Q1_2",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "valentina_freed", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "CurrentSubQuestDone" }
							]
						}
					]
				}				
			]
		},
			{
				"sid": "setupQuestlog3",
				"hidden": true,

				"comment": "quest to setup angel quest",

				"activeOnStart": true,
				"sharing": "Clone",

				"subQuests":
				[	
					{
						"sid": "1",
						"activeOnStart": true,

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "SquadKill", "p": [ "angel" ] }
								],

								"actions":
								[
									{ "a": "AutoSave" }
								]
							},
							{
								"conditions":
								[
									{ "c": "UnitLose", "p": [ "sentinel" ], "counter": 1 }
								],

								"actions":
								[
									{ "a": "Dialog", "p": [ "M6Q3_dial8" ] }
								]
							},
							{
								"conditions":
								[
									{ "c": "Counter", "p": [ "angel_quest", "=", "1" ] }
								],

								"actions":
								[
									{ "a": "NextQuest", "p": [ "Questlog3" ] }
								]
							}
						]
					},
					{
						"sid": "2",
						"activeOnStart": false,

						"comment": "automatically interact with the angel //DISABLED",

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "SquadKill", "p": [ "worldwatcher" ] }
								],

								"actions":
								[
									{ "a": "HeroToNode", "p": [ "campaign_hero_1", "1655" ] }
								]
							}
						]
					}
				]
			},
		{
			"sid": "Questlog3",

			"comment": "angel quest",

			"activeOnStart": false,
			"sharing": "Clone",

			"name": "quest_name_M6Q3",

			"subQuests":
			[	
				{
					"sid": "Questlog3_1",
					"activeOnStart": true,
					
					"name": "quest_sub_M6Q3_1",

					"triggers":
					[
						{
							"conditionsLogic": "And",
							"conditions":
							[
								{ "c": "UnitLose", "p": [ "sentinel" ], "counter": 1 },
								{ "c": "Counter", "p": [ "angel_quest", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "Dialog", "p": [ "M6Q3_dial8" ] }
							]
						},
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "angel_quest_failed", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "CounterSet", "p": [ "angel_quest", "2" ] },
								{ "a": "NextQuest" }
							]
						},
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "angel_quest", "=", "2" ] }
							],

							"actions":
							[
								{ "a": "CurrentSubQuestDone" },
								{ "a": "NextQuest" }
							]
						}
					]
				}
			]
		},
			{
				"sid": "supportQuestlog3",
				"hidden": true,

				"comment": "angel quest tracking",

				"activeOnStart": true,
				"sharing": "Clone",

				"subQuests":
				[						
					{
						"sid": "1",
						"activeOnStart": true,

						"comment": "angel location tracking",

						"triggers":
						[
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "UnitOwnHero", "p": [ "campaign_hero_2", "sentinel", "=", "0" ] }
								],

								"actions":
								[
									{ "a": "CounterSet", "p": [ "angel_with_filacus", "0" ] }
								]
							},
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "UnitOwnHero", "p": [ "campaign_hero_2", "sentinel", ">", "0" ] }
								],

								"actions":
								[
									{ "a": "CounterSet", "p": [ "angel_with_filacus", "1" ] }
								]
							},
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "UnitOwnHero", "p": [ "campaign_hero_1", "sentinel", "=", "0" ] }
								],

								"actions":
								[
									{ "a": "CounterSet", "p": [ "angel_with_gunnar", "0" ] },
									{ "a": "SetActiveMarker", "p": [ "zone_angel_ambush", "false" ] }
								]
							},
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "UnitOwnHero", "p": [ "campaign_hero_1", "sentinel", ">", "0" ] }
								],

								"actions":
								[
									{ "a": "CounterSet", "p": [ "angel_with_gunnar", "1" ] },
									{ "a": "SetActiveMarker", "p": [ "zone_angel_ambush", "true" ] }
								]
							}
						]
					},
					{
						"sid": "2",
						"activeOnStart": true,

						"comment": "summoning dialog after dismissing the angel",

						"triggers":
						[
							{

								"conditions":
								[
									{ "c": "Counter", "p": [ "angel_quest", "=", "3" ] }
								],

								"actions":
								[
									{ "a": "Dialog", "p": [ "M6Q1_dial5_valentine" ] }
								]
							}
						]
					},
					{
						"sid": "3",
						"activeOnStart": true,

						"comment": "disabling dialog upon angels death",

						"triggers":
						[
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "Counter", "p": [ "angel_quest", "<>", "1" ] }
								],

								"actions":
								[
									{ "a": "TriggerClearCustom", "p": [ "Questlog3", "Questlog3_1", "0", "1" ] }
								]
							}
						]
					}
				]
			},
			
			{
				"sid": "setupQuestlog6",
				"hidden": true,

				"comment": "quest to setup trogl quest",

				"activeOnStart": true,
				"sharing": "Clone",

				"subQuests":
				[	
					{
						"sid": "setupQuestlog6_1",
						"activeOnStart": true,

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "Counter", "p": [ "trogl_quest", "=", "1" ] }
								],

								"actions":
								[
									{ "a": "NextQuest", "p": [ "Questlog6" ] },

									{ "a": "SetActiveMarker", "p": [ "zone_trogl", "true" ] },
									{ "a": "CreateVFX", "p": [ "fx_quest_mark_silver_03", "1533", "false", "true", "pm_trogl_home" ] }
								]
							}
						]
					}
				]
			},
		{
			"sid": "Questlog6",

			"comment": "trogl quest",

			"activeOnStart": false,
			"sharing": "Clone",

			"name": "quest_name_M6Q6",

			"subQuests":
			[	
				{
					"sid": "Questlog6_1",
					"activeOnStart": true,
					
					"name": "quest_sub_M6Q6_1",

					"triggers":
					[
						{
							"conditionsLogic": "And",
							"conditions":
							[
								{ "c": "UnitLose", "p": [ "trogl" ], "counter": 1 },
								{ "c": "Counter", "p": [ "trogl_quest", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "Dialog", "p": [ "M6Q6_dial7" ] }
							]
						},
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "trogl_quest_failed", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "CounterSet", "p": [ "trogl_quest", "2" ] },
								{ "a": "NextQuest" },

								{ "a": "SetActiveVFX", "p": [ "pm_trogl_home", "false" ] }
							]
						},
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "trogl_home", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "CounterSet", "p": [ "trogl_quest", "2" ] },
								{ "a": "NextQuest" },

								{ "a": "SetActiveVFX", "p": [ "pm_trogl_home", "false" ] },
								{ "a": "AutoSave" }
							]
						}
					]
				}
			]
		},
			{
				"sid": "supportQuestlog6",
				"hidden": true,

				"comment": "trogl quest tracking",

				"activeOnStart": true,
				"sharing": "Clone",

				"subQuests":
				[						
					{
						"sid": "supportQuestlog6_1",
						"activeOnStart": true,

						"comment": "trogl location tracking",

						"triggers":
						[
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "UnitOwnHero", "p": [ "campaign_hero_2", "trogl", "=", "0" ] }
								],

								"actions":
								[
									{ "a": "CounterSet", "p": [ "trogl_with_filacus", "0" ] },
									{ "a": "SetActiveMarker", "p": [ "trogl_home_zone", "false" ] }
								]
							},
							{
								"repeat": true,

								"conditions":
								[
									{ "c": "UnitOwnHero", "p": [ "campaign_hero_2", "trogl", ">", "0" ] }
								],

								"actions":
								[
									{ "a": "CounterSet", "p": [ "trogl_with_filacus", "1" ] },
									{ "a": "SetActiveMarker", "p": [ "trogl_home_zone", "true" ] }
								]
							}
						]
					}
				]
			},
			{
				"sid": "supportQuestlog8",
				"hidden": true,

				"comment": "quest with sister, dialog after medusae",

				"activeOnStart": true,
				"sharing": "Clone",

				"subQuests":
				[						
					{
						"sid": "supportQuestlog8_1",
						"activeOnStart": true,

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "SquadKill", "p": [ "medusa_squad" ] }
								],

								"actions":
								[
									{ "a": "Dialog", "p": [ "M6Q8_dial2"] }
								]
							}
						]
					}
				]
			}
	]
}