﻿{
	"counters":
	[	
		{ "sid": "Counter_P1", "value": 0, "comment": "playing as Temple" },	
		{ "sid": "Counter_P2", "value": 0, "comment": "playing as Dungeon" },
		{ "sid": "FogEnemyCounterDays", "value": 4, "comment": "counter for time between encounters" },
		{ "sid": "scroll_progression", "value": 0, "comment": "auxiliary counter for unlocking relics when player interacts with 4 scrolls in the correct order" },
		{ "sid": "scroll_puzzle_completed", "value": 0, "comment": "1 = player completed the puzzle and can grab the relics" },
		{ "sid": "letter_read", "value": 0, "comment": "counter to start MainQuest2" },
		{ "sid": "relics_found", "value": 0, "comment": "auxiliary counter for alt main quest" },
		{ "sid": "relics_taken", "value": 0, "comment": "auxiliary counter for alt main quest" },
		{ "sid": "chose_violence", "value": 0, "comment": "whether the player decided to keep the relics" }
	],

	"quests":
	[	
		{
			"sid": "intro_custom_map_2",
			"hidden": true,

			"comment": "intro",

			"activeOnStart": true,
			"sharing": "Clone",

			"name": "1",

			"subQuests":
			[	
				{
					"sid": "1",
					"activeOnStart": true,

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "StartTurn", "p": [ "1", "1" ] }
							],

							"actions":
							[
								{ "a": "AiBanArea", "p": [ "1816" ] },
								{ "a": "CreateVFX", "p": [ "fx_quest_mark_silver_01", "3767", "false", "true", "qm_relics_silver" ] },

								{ "a": "Dialog", "p": [ "god_intro" ] }
							]
						}
					]
				}
			]
		},

			{
				"sid": "setupMainQuest1",
				"hidden": true,
				"activeOnStart": true,

				"sharing": "Clone",

				"subQuests":
				[	
					{
						"sid": "1",
						"activeOnStart": true,

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "Counter", "p":[ "Counter_P1", "=", "1" ] }
								],

								"actions":
								[
									{ "a": "DeleteEntity", "p": [ "zone_fogEnter_dungeon1" ] },
									{ "a": "DeleteEntity", "p": [ "zone_fogEnter_dungeon2" ] },
									{ "a": "SubQuestActivate", "p":[ "MainQuest1", "MainQuest1a_1" ]},
									{ "a": "SubQuestActivate", "p":[ "MainQuest1", "MainQuest1a_2" ]}
								]
							},
							{
								"conditions":
								[
									{ "c": "Counter", "p":[ "Counter_P2", "=", "1" ] }
								],

								"actions":
								[
									{ "a": "DeleteEntity", "p": [ "zone_fogEnter_temple1" ] }, 
									{ "a": "DeleteEntity", "p": [ "zone_fogEnter_temple2" ] },
									{ "a": "DeleteEntity", "p": [ "zone_fogEnter_temple3" ] },
									{ "a": "SubQuestActivate", "p":[ "MainQuest1", "MainQuest1b_1" ]},
									{ "a": "SubQuestActivate", "p":[ "MainQuest1", "MainQuest1b_2" ]}
								]
							}
						]
					}
				]
			},
		{
			"sid": "MainQuest1",
			"main": true,
			"activeOnStart": true,

			"sharing": "Clone",

			"comment": "main quest = defeat opponents + do not lose starting hero",

			"name": "god_quest_name_q1",
			"desc": "god_quest_desc_q1",

			"subQuests":
			[	
				{
					"sid": "MainQuest1a_1",
					"activeOnStart": false,
					"name": "god_sub_name_q1a_1",

					"triggers":
					[	
						{							
							"conditions":
							[
								{ "c": "PlayerDefeated", "p": [ "1" ] }
							],

							"actions":
							[
								{ "a": "CurrentSubQuestDone" },
								{ "a": "SubQuestDone", "p": [ "MainQuest1", "MainQuest1a_2" ] },
								{ "a": "Dialog", "p":[ "god_defeated_enemy" ] }
							]
						}
					]
				},
				{
					"sid": "MainQuest1b_1",
					"activeOnStart": false,
					"name": "god_sub_name_q1b_1",

					"triggers":
					[	
						{							
							"conditions":
							[
								{ "c": "PlayerDefeated", "p": [ "0" ] }
							],

							"actions":
							[
								{ "a": "CurrentSubQuestDone" },
								{ "a": "SubQuestDone", "p": [ "MainQuest1", "MainQuest1b_2" ] },
								{ "a": "Dialog", "p":[ "god_defeated_enemy" ] }
							]
						}
					]
				},
				{
					"sid": "MainQuest1a_2",
					"activeOnStart": false,
					"name": "god_sub_name_q1a_2",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "HeroKill", "p": [ "human_hero_11" ] }
							],

							"actions":
							[	
								{ "a": "GameLose" }
							]
						}
					]
				},
				{
					"sid": "MainQuest1b_2",
					"activeOnStart": false,
					"name": "god_sub_name_q1b_2",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "HeroKill", "p": [ "dungeon_hero_18" ] }
							],

							"actions":
							[	
								{ "a": "GameLose" }
							]
						}
					]
				}
			]
		},
			{
				"sid": "setupMainQuest2",
				"hidden": true,
				"activeOnStart": true,

				"sharing": "Clone",

				"subQuests":
				[	
					{
						"sid": "1",
						"activeOnStart": true,

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "Counter", "p":[ "letter_read", "=", "1" ] }
								],

								"actions":
								[
									{ "a": "DeleteEntity", "p": [ "tree_before_book" ] },
									{ "a": "SpawnObject", "p": [ "campaign_lost_library_empty", "1755", "false", "diary" ] },
									{ "a": "SetQuestMarker", "p": [ "diary", "effects/global_map/quest_mark_gold_01" ] },
									{ "a": "SetActiveVFX", "p": [ "qm_relics_silver", "false" ] },
									{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_02", "3767", "false", "true", "em_relics_gold" ] },
									{ "a": "CreateVFX", "p": [ "fx_quest_mark_gold_03", "3767", "false", "false", "pm_relics_gold" ] },
									
									
									{ "a": "NextQuest", "p": [ "MainQuest2" ] },
									{ "a": "CounterPlus", "p": [ "relics_found", "0" ] }
								]
							}
						]
					},
					{
						"sid": "2",
						"activeOnStart": true,
						
						"comment": "disabling quest if relics are already unlocked",

						"triggers":
						[
							{
								"conditions":
								[
									{ "c": "Counter", "p": [ "scroll_puzzle_completed", "=", "1" ] }
								],

								"actions":
								[
									{ "a": "SetActiveVFX", "p": [ "qm_relics_silver", "false" ] },
									{ "a": "NextQuest" }
								]
							}
						]
					}
				]
			},
		{
			"sid": "MainQuest2",
			"main": true,
			"activeOnStart": false,

			"sharing": "Clone",

			"comment": "alternative way to finish the map = find and collect cursed relics",

			"name": "god_quest_name_q2",
			"desc": "god_quest_desc_q2",

			"subQuests":
			[
				{
					"sid": "MainQuest2_1",
					"activeOnStart": true,
					"name": "god_sub_name_q2_1",

					"comment": "find relics",

					"triggers":
					[	
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "relics_found", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "SetActiveVFX", "p": [ "em_relics_gold", "false" ] },
								{ "a": "SetActiveVFX", "p": [ "pm_relics_gold", "true" ] },
								{ "a": "CurrentSubQuestDone" },
								{ "a": "NextSubQuest", "p": [ "MainQuest2_2" ] }
							]
						}
					]
				},
				{
					"sid": "MainQuest2_2",
					"activeOnStart": false,
					"name": "god_sub_name_q2_2",

					"comment": "solving the scroll puzzle (night->primal->day->arcane)",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "scroll_puzzle_completed", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "SetQuestMarker", "p": [ "relic1", "effects/global_map/quest_mark_gold_02" ] },
								{ "a": "SetQuestMarker", "p": [ "relic2", "effects/global_map/quest_mark_gold_02" ] },
								{ "a": "SetQuestMarker", "p": [ "relic3", "effects/global_map/quest_mark_gold_02" ] },
								{ "a": "SetQuestMarker", "p": [ "relic4", "effects/global_map/quest_mark_gold_02" ] },
								{ "a": "CurrentSubQuestDone" },
								{ "a": "SubQuestActivate", "p": [ "MainQuest2", "MainQuest2_3a" ] },
								{ "a": "SubQuestActivate", "p": [ "MainQuest2", "MainQuest2_3b" ] },
								{ "a": "SubQuestActivate", "p": [ "MainQuest2", "MainQuest2_3c" ] },
								{ "a": "SubQuestActivate", "p": [ "MainQuest2", "MainQuest2_3d" ] }
							]
						},
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "relics_taken", "=", "4" ] }
							],

							"actions":
							[
								{ "a": "SetActiveQuestMarker", "p": [ "diary", "false" ] },
								{ "a": "CurrentSubQuestDone" },
								{ "a": "Dialog", "p": [ "god_relics_collected" ] }
							]
						},
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "chose_violence", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "NextQuest" }
							]
						}
					]
				},
				{
					"sid": "MainQuest2_3a",
					"activeOnStart": false,
					"name": "god_sub_name_q2_3a",

					"triggers":
					[	
						{
							"conditions": [ { "c": "ItemOwnSide", "p": [ "shadow_of_death_second_shade_artifact", ">", "0" ] } ],

							"actions": [ { "a": "CounterPlus", "p": [ "relics_taken", "1" ] }, { "a": "CurrentSubQuestDone" } ]
						}
					]
				},
				{
					"sid": "MainQuest2_3b",
					"activeOnStart": false,
					"name": "god_sub_name_q2_3b",

					"triggers":
					[	
						{							
							"conditions": [ { "c": "ItemOwnSide", "p": [ "shadow_of_death_dark_hatchet_artifact", ">", "0" ] } ],

							"actions": [ { "a": "CounterPlus", "p": [ "relics_taken", "1" ] }, { "a": "CurrentSubQuestDone" } ]
						}
					]
				},
				{
					"sid": "MainQuest2_3c",
					"activeOnStart": false,
					"name": "god_sub_name_q2_3c",

					"triggers":
					[	
						{							
							"conditions": [ { "c": "ItemOwnSide", "p": [ "shadow_of_death_cursed_armor_artifact", ">", "0" ] } ],

							"actions": [ { "a": "CounterPlus", "p": [ "relics_taken", "1" ] }, { "a": "CurrentSubQuestDone" } ]
						}
					]
				},
				{
					"sid": "MainQuest2_3d",
					"activeOnStart": false,
					"name": "god_sub_name_q2_3d",

					"triggers":
					[	
						{							
							"conditions": [ { "c": "ItemOwnSide", "p": [ "shadow_of_death_bone_boots_artifact", ">", "0" ] } ],

							"actions": [ { "a": "CounterPlus", "p": [ "relics_taken", "1" ] }, { "a": "CurrentSubQuestDone" } ]
						}
					]
				}
			]
		},
			{
				"sid": "supportMainQuest2_1",
				"hidden": true,
				"activeOnStart": true,

				"sharing": "Clone",

				"comment": "finding relics + unblocking them once all the scrolls are lit in the correct order",

				"subQuests":
				[	
					{
						"sid": "1",
						"activeOnStart": true,

						"triggers":
						[	
							{
								"conditionsLogic": "Or",
								"conditions":
								[
									{ "c": "NodeRevealed", "p": [ "3895" ] },
									{ "c": "NodeRevealed", "p": [ "3768" ] },
									{ "c": "NodeRevealed", "p": [ "3703" ] },
									{ "c": "NodeRevealed", "p": [ "3766" ] }
								],

								"actions":
								[
									{ "a": "HeroStop" },
									{ "a": "MoveCamera", "p": [ "3767" ] },
									{ "a": "RevealFogOfWar", "p": [ "3767", "2" ] },
									{ "a": "Dialog", "p":[ "god_found_relics" ] },
									{ "a": "CounterSet", "p":[ "relics_found", "1" ] }
								]
							}
						]
					},
					{
						"sid": "2",
						"activeOnStart": true,

						"triggers":
						[	
							{							
								"conditions":
								[
									{ "c": "Counter", "p": [ "scroll_progression", "=", "4" ] }
								],

								"actions":
								[
									{ "a": "Dialog", "p": [ "god_scrolls_completed" ] },
									{ "a": "SetActiveVFX", "p": [ "light_scroll1", "false" ] },
									{ "a": "SetActiveVFX", "p": [ "light_scroll2", "false" ] },
									{ "a": "SetActiveVFX", "p": [ "light_scroll3", "false" ] },
									{ "a": "SetActiveVFX", "p": [ "light_scroll4", "false" ] },
									{ "a": "CounterSet", "p": [ "scroll_puzzle_completed", "1" ] }
								]
							}
						]
					}
				]
			},			
			{
				"sid": "supportMainQuest2_2",
				"hidden": true,
				"activeOnStart": true,

				"sharing": "Clone",

				"comment": "triggering dialogue to re-read the diary",

				"subQuests":
				[	
					{
						"sid": "1",
						"activeOnStart": true,

						"triggers":
						[	
							{
								"repeat": true,					
								"conditions":
								[
									{ "c": "ObjectInteractionBefore", "p": [ "diary" ] }
								],

								"actions":
								[
									{ "a": "Dialog", "p": [ "god_diary_repeatable_reading" ] }
								]
							}
						]
					}
				]
			},

		{
			"sid": "captured_center_city",
			"hidden": true,
			"activeOnStart": true,

			"sharing": "Clone",

			"comment": "dialogues when finding and capturing the central city",

			"subQuests":
			[	
				{
					"sid": "1",
					"activeOnStart": true,

					"triggers":
					[	
						{
							"conditionsLogic": "Or",
							"conditions":
							[
								{ "c": "NodeRevealed", "p": [ "1945" ] },
								{ "c": "NodeRevealed", "p": [ "1947" ] },
								{ "c": "NodeRevealed", "p": [ "1819" ] },
								{ "c": "NodeRevealed", "p": [ "1817" ] }
							],

							"actions":
							[
								{ "a": "HeroStop" },
								{ "a": "MoveCamera", "p": [ "1882" ] },
								{ "a": "RevealFogOfWar", "p": [ "1882", "2" ] },
								{ "a": "Dialog", "p": [ "god_found_library" ] }
							]
						}
					]
				},
				{
					"sid": "2",
					"activeOnStart": true,

					"triggers":
					[	
						{
							"conditions":
							[
								{ "c": "ObjectInteractionBefore", "p": [ "library_city" ] }
							],

							"actions":
							[
								{ "a": "AiUnbanArea", "p": [ "1816" ] },
								{ "a": "Dialog", "p": [ "god_reached_library" ] }
							]
						}
					]
				},
				{
					"sid": "3",
					"activeOnStart": true,
					
					"comment": "disabling quest if relics are already unlocked",

					"triggers":
					[
						{
							"conditions":
							[
								{ "c": "Counter", "p": [ "scroll_puzzle_completed", "=", "1" ] }
							],

							"actions":
							[
								{ "a": "NextQuest" }
							]
						}
					]
				}
			]
		},

		{
			"sid": "spawning_enemies",
			"hidden": true,
			"activeOnStart": true,

			"sharing": "Clone",

			"comment": "pseudo random encounters in the fog",

			"subQuests":
			[	
				{
					"sid": "1",
					"activeOnStart": true,

					"comment": "triggering one of random dialogues + battle",

					"triggers":
					[	
						{
							"repeat": true,
							"conditionsLogic": "Or",

							"conditions":
							[
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy1" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy2" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy3" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy4" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy5" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy6" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy7" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy8" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy9" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy10" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy11" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy12" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy13" ] },
								{ "c": "ObjectInteractionBefore", "p": [ "zoneFogEnemy14" ] }
							],

							"actions":
							[
								{ "a": "CounterSet", "p": [ "FogEnemyCounterDays", "0" ] },

								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy1", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy2", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy3", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy4", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy5", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy6", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy7", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy8", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy9", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy10", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy11", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy12", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy13", "false" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy14", "false" ] },

								{ "a": "DeleteEntity", "p": [ "enemyFog" ] },
								
								{ "a": "RandomDialog", "p": [ "god_fog_fight1", "god_fog_fight2", "god_fog_fight3", "god_fog_fight4", "god_fog_fight5" ] }
							]
						}
					]
				},
				{
					"sid": "2",
					"activeOnStart": true,

					"comment": "counting turns between encounters",

					"triggers":
					[	
						{	
							"repeat": true,

							"conditions":
							[
								{ "c": "StartTurn" }
							],

							"actions":
							[
								{ "a": "CounterPlus", "p": [ "FogEnemyCounterDays", "1" ] }
							]
						}
					]
				},
				{
					"sid": "3",
					"activeOnStart": true,

					"comment": "activating zones when counter reaches set number",

					"triggers":
					[	
						{
							"repeat": true,

							"conditions":
							[
								{ "c": "Counter", "p": [ "FogEnemyCounterDays", "=", "4" ] }
							],

							"actions":
							[
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy1", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy2", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy3", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy4", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy5", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy6", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy7", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy8", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy9", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy10", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy11", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy12", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy13", "true" ] },
								{ "a": "SetActiveMarker", "p": [ "zoneFogEnemy14", "true" ] }
							]
						}
					]
				}
			]
		}
	]
}