﻿##################
# Mandala Capital (Temple Complex)
##################

# USED IN CODE, DO NOT RENAME OR REMOVE
mandala_capital_01 = {

	type_icon = "tgp_icon_building_mandala_capital_tier_01.dds"

	#We only build this through Decision -> Great Projects
	can_construct_potential = {
		always = no #This should never show up
	}

    asset = {
		type = entity
		name = "tgp_great_building_mandala_capital_01_entity"
	}

	is_enabled = {
		#It needs to be your capital
		scope:county.holder = { 
			government_has_flag = government_is_mandala
			capital_province = root #The province		
		}
	}

	show_disabled = yes

	rebuild_cost = {
		gold = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { value = standard_rebuild_value }
		}
		piety = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { value = standard_rebuild_value }
		}
	}

	can_rebuild = {
		scope:county.holder = {
			custom_tooltip = {
				text = not_already_full_on_mandala_capitals
				less_than_max_amount_of_mandala_capitals_trigger = yes
			}
		}
	}

	character_modifier = {
		domain_limit = 1
		court_grandeur_baseline_add = 1 #Most likely you don't have a court yet
		vassal_limit_max = 1 #Added to the base for Mandala of 3 Max
		domain_limit_max = 1
		monthly_county_control_growth_add = 0.1
	}

	province_modifier = {
		stationed_maa_damage_mult = 0.1
		levy_size = 0.15
		garrison_size = 0.15
		monthly_income = 0.2
	}

	county_modifier = {
		development_growth = 0.1
		tax_mult = 0.1
	}

	fallback = {
		province_modifier = {
			monthly_income = 0.1
		}
	}
	
	next_building = mandala_capital_02

	type = great_building
	is_mandala_capital = yes

	flag = mandala_capital_building
	flag = first_tier_mandala_capital_building

}

mandala_capital_02 = {

	type_icon = "tgp_icon_building_mandala_capital_tier_02.dds"

	#We only build this through Decision -> Great Projects
	can_construct_potential = {
		scope:holder.capital_province = { has_building_with_flag = first_tier_mandala_capital_building }
	}

    asset = {
		type = entity
		name = "tgp_great_building_mandala_capital_02_entity"
	}

	is_enabled = {
		#It needs to be your capital
		scope:holder = { 
			government_has_flag = government_is_mandala
			capital_province = root #The province
		}
	}
	can_rebuild = {
		scope:county.holder = {
			custom_tooltip = {
				text = not_already_full_on_mandala_capitals
				less_than_max_amount_of_mandala_capitals_trigger = yes
			}
		}
	}

	show_disabled = yes

	rebuild_cost = {
		gold = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 1.25
				}
			}
		}
		piety = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 1.25
				}
			}
		}
	}

	character_modifier = {
		domain_limit = 1
		court_grandeur_baseline_add = 3
		vassal_limit_max = 2 #Added to the base for Mandala of 4 Max
		monthly_county_control_growth_add = 0.15
		domain_limit_max = 2
	}

	province_modifier = {
		stationed_maa_damage_mult = 0.1
		levy_size = 0.25
		garrison_size = 0.25
		monthly_income = 0.4
	}

	county_modifier = {
		development_growth = 0.15
		tax_mult = 0.2
	}

	fallback = {
		province_modifier = {
			monthly_income = 0.1
		}
	}

	next_building = mandala_capital_03
	great_project_type = mandala_capital_02
	is_mandala_capital = yes

	type = great_building

	flag = mandala_capital_building
	flag = second_tier_mandala_capital_building

}

mandala_capital_03 = {

	type_icon = "tgp_icon_building_mandala_capital_tier_03.dds"

	#We only build this through Decision -> Great Projects
	can_construct_potential = {
		scope:holder.capital_province = { has_building_with_flag = second_tier_mandala_capital_building }
	}

    asset = {
		type = entity
		name = "tgp_great_building_mandala_capital_03_entity"
	}

	is_enabled = {
		#It needs to be your capital
		scope:holder = { 
			government_has_flag = government_is_mandala
			capital_province = root #The province
		}
	}
	can_rebuild = {
		scope:county.holder = {
			custom_tooltip = {
				text = not_already_full_on_mandala_capitals
				less_than_max_amount_of_mandala_capitals_trigger = yes
			}
		}
	}

	show_disabled = yes

	rebuild_cost = {
		gold = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 1.5
				}
			}
		}
		piety = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 1.5
				}
			}
		}
	}

	character_modifier = {
		domain_limit = 2
		court_grandeur_baseline_add = 5
		vassal_limit_max = 8 #Added to the base for Mandala of 10 Max
		monthly_county_control_growth_add = 0.2
		diplomatic_range_mult = 0.15
		domain_limit_max = 3
	}

	province_modifier = {
		stationed_maa_damage_mult = 0.1
		levy_size = 0.35
		garrison_size = 0.35
		monthly_income = 0.5
	}

	county_modifier = {
		development_growth = 0.2
		tax_mult = 0.25
	}

	fallback = {
		province_modifier = {
			monthly_income = 0.1
		}
	}

	next_building = mandala_capital_04
	great_project_type = mandala_capital_03
	is_mandala_capital = yes

	type = great_building

	flag = mandala_capital_building
	flag = third_tier_mandala_capital_building

}

mandala_capital_04 = {

	type_icon = "tgp_icon_building_mandala_capital_tier_04.dds"

	#We only build this through Decision -> Great Projects
	can_construct_potential = {
		scope:holder.capital_province = { has_building_with_flag = third_tier_mandala_capital_building }
	}

    asset = {
		type = entity
		name = "tgp_great_building_mandala_capital_04_entity"
	}

	is_enabled = {
		#It needs to be your capital
		scope:holder = { 
			government_has_flag = government_is_mandala
			capital_province = root #The province
		}
	}
	can_rebuild = {
		scope:county.holder = {
			custom_tooltip = {
				text = not_already_full_on_mandala_capitals
				less_than_max_amount_of_mandala_capitals_trigger = yes
			}
		}
	}

	show_disabled = yes

	rebuild_cost = {
		gold = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 1.75
				}
			}
		}
		piety = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 1.75
				}
			}
		}
	}

	character_modifier = {
		domain_limit = 3
		court_grandeur_baseline_add = 7
		vassal_limit_max = 16 #Added to the base for Mandala of 18 Max
		monthly_county_control_growth_add = 0.25
		diplomatic_range_mult = 0.25
		diplomatic_range_mult = 0.2
		domain_limit_max = 5
	}

	province_modifier = {
		stationed_maa_damage_mult = 0.1
		levy_size = 0.4
		garrison_size = 0.5
		monthly_income = 0.5
	}

	county_modifier = {
		development_growth = 0.3
		tax_mult = 0.3
	}

	fallback = {
		province_modifier = {
			monthly_income = 0.1
		}
	}

	next_building = mandala_capital_05
	great_project_type = mandala_capital_04
	is_mandala_capital = yes

	type = great_building

	flag = mandala_capital_building
	flag = fourth_tier_mandala_capital_building

}

mandala_capital_05 = {

	type_icon = "tgp_icon_building_mandala_capital_tier_05.dds"

	#We only build this through Decision -> Great Projects
	can_construct_potential = {
		scope:holder.capital_province = { has_building_with_flag = fourth_tier_mandala_capital_building }
	}

    asset = {
		type = entity
		name = "tgp_great_building_mandala_capital_05_entity"
	}

	is_enabled = {
		#It needs to be your capital
		scope:holder = { 
			government_has_flag = government_is_mandala
			capital_province = root #The province
		}
	}
	can_rebuild = {
		scope:county.holder = {
			custom_tooltip = {
				text = not_already_full_on_mandala_capitals
				less_than_max_amount_of_mandala_capitals_trigger = yes
			}
		}
	}

	show_disabled = yes

	rebuild_cost = {
		gold = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 2
				}
			}
		}
		piety = {
			if = {
				limit = { is_ai = yes }
				value = ai_rebuild_value
			}
			else = { 
				value = {
					add = standard_rebuild_value
					multiply = 2
				}
			}
		}
	}

	character_modifier = {
		domain_limit = 4
		court_grandeur_baseline_add = 10
		vassal_limit_max = 28 #Added to the base for Mandala of 30 Max
		monthly_county_control_growth_add = 0.35
		diplomatic_range_mult = 0.3
		domain_limit_max = 7
	}

	province_modifier = {
		stationed_maa_damage_mult = 0.1
		monthly_income = 0.75
	}

	county_modifier = {
		development_growth = 0.4
		tax_mult = 0.35
		levy_size = 0.5
		garrison_size = 0.5
	}

	fallback = {
		province_modifier = {
			monthly_income = 0.1
		}
	}

	great_project_type = mandala_capital_05
	is_mandala_capital = yes

	type = great_building

	flag = mandala_capital_building
	flag = final_tier_mandala_capital_building

}

# Great Barracks
celestial_great_barracks_01 = {
	effect_desc = {
		desc = unlocks_building_desc
		desc = celestial_great_barracks_effect_desc
	}
	
	type_icon = "icon_structure_celestial_great_barracks.dds"

	can_construct_potential = {
		always = no # This building is the result of a great project
	}

	# Only enabled for military governors - Viable for all admin types though
	is_enabled = {
		county.holder = {
			has_title = prev.duchy
			custom_tooltip = {
				text = celestial_great_barracks_enabled_desc
				OR = {
					vassal_contract_has_flag = celestial_military_appointment # Only for celestial military governors
					government_has_flag = government_is_administrative # All regular admin types are eligible
					is_independent_ruler = yes # The top liege can always use it
				}
			}
		}
	}

	show_disabled = yes
	
	cost_gold = expensive_building_tier_2_cost

	character_modifier = {
		monthly_influence_mult = 0.05
		men_at_arms_title_limit = 1
		men_at_arms_title_cap = 1
		men_at_arms_recruitment_cost = -0.1
		men_at_arms_maintenance = -0.12
	}

	duchy_capital_county_modifier = {
		supply_limit_mult = 1
		garrison_size = 1.5
		hostile_raid_time = 0.5
		defender_holding_advantage = 15
		additional_fort_level = normal_building_fort_level_tier_6
		travel_danger = -30
		monthly_county_control_growth_add = 0.2
	}

	type = duchy_capital
}

# The Great Wall - Qin Era
the_great_wall_01 = {
	type_icon = "icon_structure_the_great_wall.dds"

	can_construct_potential = {
	}

	is_enabled = {
	}

	show_disabled = yes
	
	province_modifier = {
		fort_level = 1
		hostile_raid_time = 0.1
		defender_holding_advantage = 2
	}
	
	type = great_building
}

# The Great Wall - Han Era
the_great_wall_02 = {
	type_icon = "icon_structure_the_great_wall.dds"

	can_construct_potential = {
	}

	is_enabled = {
	}

	show_disabled = yes
	
	province_modifier = {
		fort_level = 2
		hostile_raid_time = 0.2
		stationed_maa_toughness_mult = 0.05
		defender_holding_advantage = 4
	}
	
	type = great_building
}

# The Great Wall - Northern Wei/Qi/Sui Era (we bundle these together since they overlap somewhat)
the_great_wall_03 = {
	type_icon = "icon_structure_the_great_wall.dds"

	can_construct_potential = {
	}

	is_enabled = {
	}

	show_disabled = yes
	
	province_modifier = {
		fort_level = 3
		hostile_raid_time = 0.3
		stationed_maa_toughness_mult = 0.05
		defender_holding_advantage = 6
	}
	
	type = great_building
}

# The Great Wall - Ming Era (this is also what you can build in-game)
the_great_wall_04 = {
	type_icon = "icon_structure_the_great_wall.dds"

	can_construct_potential = {
	}

	is_enabled = {
	}

	show_disabled = yes
	
	province_modifier = {
		fort_level = 5
		hostile_raid_time = 0.5
		stationed_maa_toughness_mult = 0.05
		defender_holding_advantage = 8
	}
	
	type = great_building
}

the_great_wall_shanhai_pass = {
	asset = {
		type = pdxmesh
		name = "tgp_great_wall_04_mesh"
	}

	type_icon = "icon_structure_the_great_wall.dds"

	can_construct_potential = {
	}

	is_enabled = {
	}

	show_disabled = yes
	
	province_modifier = {
		fort_level = 5
		hostile_raid_time = 0.5
		stationed_maa_toughness_mult = 0.05
		defender_holding_advantage = 8
	}
	
	type = great_building
}

the_great_wall_liaodong = {
	asset = {
		type = pdxmesh
		name = "tgp_great_wall_05_mesh"
	}

	type_icon = "icon_structure_the_great_wall.dds"

	can_construct_potential = {
	}

	is_enabled = {
	}

	show_disabled = yes
	
	province_modifier = {
		fort_level = 5
		hostile_raid_time = 0.5
		stationed_maa_toughness_mult = 0.05
		defender_holding_advantage = 8
	}
	
	type = great_building
}
