### TODO - GFX ###
# upgrade_cow_district_generic.dds

#####################################################################
############################ INDEX ##################################
#####################################################################
### ANYONE ADDING UPGRADES(features): Keep this updated, please!
###
### Template:
###
###		upgrade_example_name
###			picture = GFX_upgrade_icon_crates
###			show_in_history = yes
###			allow = { }
###			potential = { }
###			active = { }
###			flags = { }
###			build_time = 20
###			gold_cost_flat = 450
###			gold_cost_ticking = 1
###			local_modifier = { }
###			owner_modifier = { }
###		}
###

# Note: Names are reference points, but likely displayed differently in game
# Upgrades are referred to as "features" in game
# Scopes: ROOT is the character, FROM is the upgrade, FROMFROM the wonder, and FROMFROMFROM the province.

################### Available Upgrades ###########################

#### COW DISTRICTS ####
## Temples ##
# Great Sept .............................. upgrade_cow_district_great_sept
# Great Sept of Baelor .................... upgrade_cow_district_great_sept_baelor # Unique - King's Landing
# Starry Sept ............................. upgrade_cow_district_great_sept_starry # Unique - Oldtown
# Great Red Temple ........................ upgrade_cow_district_red_temple
# Temple of the Lord of Light ..........    upgrade_cow_district_red_temple_volantis # Unique - Volantis
# Great Synagogue ......................... upgrade_cow_district_synagogue
# Great Temple ............................ upgrade_cow_district_temple_pagan
# Great Temple (Hellenic) ................. upgrade_cow_district_temple_hellenic
# Buddhist Temple ......................... upgrade_cow_district_temple_buddhist
# Hindu Temple ............................ upgrade_cow_district_temple_hindu

## Statues ##
# Ruler Statue ............................ upgrade_cow_district_statue_ruler
# Titan of Braavos ........................ upgrade_cow_district_titan_of_braavos # Unique - Braavos
# Statue of a Horse ....................... upgrade_cow_district_horse_statue

## Fortifications ##
# Great Walls ............................. upgrade_cow_district_grand_walls
# Grand Fortress .......................... upgrade_cow_district_fortress
# Red Keep ................................ upgrade_cow_district_red_keep # Unique - King's Landing
# Great Underground City .................. upgrade_cow_district_underground_city

## Great Harbor ##
# Great Harbor ............................ upgrade_cow_district_harbor

## Great Lighthouse ##
# Great Lighthouse ........................ upgrade_cow_district_lighthouse
# Hightower ............................... upgrade_cow_district_hightower # Unique - Oldtown

## Royal Palace ##
# Royal Palace ............................ upgrade_cow_district_palace
# Maegor's Holdfast ....................... upgrade_cow_district_maegors_holdfast # Unique - King's Landing

## Cultural ##
# Grand Amphitheater ...................... upgrade_cow_district_amphitheatre
# Dragonpit ............................... upgrade_cow_district_kl_dragonpit # Unique - King's Landing
# Magnificent Garden ...................... upgrade_cow_district_garden

## Learning Centers ##
# Great Library ........................... upgrade_cow_district_library
# Library of the Citadel .................. upgrade_cow_district_library_citadel # Unique - Oldtown
# Grand University ........................ upgrade_cow_district_university
# Citadel ................................. upgrade_cow_district_university_citadel # Unique - Oldtown

## Burial Places/Religious (OTHER) ##
# Grand Mausoleum ......................... upgrade_cow_district_mausoleum
# Great Pyramid ........................... upgrade_cow_district_pyramid
# Great Stone Circle ...................... upgrade_cow_district_pagan_stones
# Aztec Pyramid ........................... upgrade_cow_district_aztec_pyramid

### COW DISTRICTS ###
# Temples (Religious):
upgrade_cow_district_great_sept = { # Great Sept
	picture = GFX_upgrade_cow_district_great_sept
	
	potential = {
		religion = the_seven
		FROMFROMFROM = { NOT = { has_cow_unique_great_sept_district_trigger = yes } }		
	}
	active = {
		ROOT = {
			religion = the_seven
		}		
	}
	allow = { 
		ROOT = {
			religion = the_seven
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_great_sept_district_trigger = yes } }
			}
		}
	}

	flags = {
		holy_building
		inspires_piety
		cost_medium
		# gives_artifact
		# gives_artifact_bells
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 8

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		monthly_character_piety = 0.3
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_great_sept_baelor = { # Great Sept of Baelor
	picture = GFX_upgrade_cow_district_great_sept_baelor
	
	potential = {
		religion = the_seven
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_great_sept }	
		}		
	}
	active = {
		ROOT = {
			religion = the_seven
		}		
	}
	allow = { 
		ROOT = {
			religion = the_seven
		}
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_great_sept }	
		}	
	}

	flags = {
		is_historical
		holy_building
		inspires_piety
		cost_medium
		# gives_artifact
		# gives_artifact_bells
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 8

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		monthly_character_piety = 0.3
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_great_sept_starry = { # Starry Sept
	picture = GFX_upgrade_cow_district_great_sept_starry
	
	potential = {
		religion = the_seven
		FROMFROMFROM = {
			province_id = 286 # Oldtown
			NOT = { has_wonder_upgrade = upgrade_cow_district_great_sept }	
		}		
	}
	active = {
		ROOT = {
			religion = the_seven
		}		
	}
	allow = { 
		ROOT = {
			religion = the_seven
		}
		FROMFROMFROM = {
			province_id = 286 # Oldtown
			NOT = { has_wonder_upgrade = upgrade_cow_district_great_sept }	
		}	
	}

	flags = {
		is_historical
		holy_building
		inspires_piety
		cost_medium
		# gives_artifact
		# gives_artifact_bells
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 8

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		monthly_character_piety = 0.3
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_red_temple = { # Great Red Temple
	picture = GFX_upgrade_cow_district_red_temple
	
	potential = {
		religion = rhllor
		FROMFROMFROM = { NOT = { has_cow_unique_red_temple_district_trigger = yes } }
	}
	active = {
		ROOT = {
			religion = rhllor
		}
	}
	allow = { 
		ROOT = {
			religion = rhllor
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_red_temple_district_trigger = yes } }
			}
		}
	}

	flags = {
		holy_building
		inspires_piety
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.15
		monthly_character_piety = 0.2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_red_temple_volantis = { # Temple of the Lord of Light (Volantis)
	picture = GFX_upgrade_cow_district_red_temple_volantis
	
	potential = {
		religion = rhllor
		FROMFROMFROM = {
			province_id = 419 # Old Volantis
			NOT = { has_wonder_upgrade = upgrade_cow_district_red_temple }	
		}		
	}
	active = {
		ROOT = {
			religion = rhllor
		}
	}
	allow = { 
		ROOT = {
			religion = rhllor
		}
		FROMFROMFROM = {
			province_id = 419 # Old Volantis
			NOT = { has_wonder_upgrade = upgrade_cow_district_red_temple }	
		}
	}

	flags = {
		is_historical
		holy_building
		inspires_piety
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.15
		monthly_character_piety = 0.2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_synagogue = { # Great Synagogue
	picture = GFX_upgrade_cow_district_synagogue
	
	potential = {
		religion_group = jewish_group
		FROMFROMFROM = { NOT = { has_cow_unique_synagogue_district_trigger = yes } }
	}
	active = {
		ROOT = {
			religion_group = jewish_group
		}		
	}
	allow = { 
		ROOT = {
			religion_group = jewish_group
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_synagogue_district_trigger = yes } }
			}
		}
	}

	flags = {
		holy_building
		inspires_piety
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.15
		monthly_character_piety = 0.2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_temple_pagan = { # Great Temple
	picture = GFX_upgrade_cow_district_temple_pagan
	
	potential = {
		religion_group = pagan_group
		is_reformed_religion = yes
		NOT = { religion_openly_hellenic_or_reformed_trigger = yes }
	}
	active = {
		ROOT = {
			OR = { 
				AND = { 
					religion_group = pagan_group
					is_reformed_religion = yes
				}
				religion = hellenic_pagan
			}
		}
	}
	allow = { 
		ROOT = {
			AND = { 
				religion_group = pagan_group
				is_reformed_religion = yes
			}
			NOT = { religion_openly_hellenic_or_reformed_trigger = yes }
		}
	}

	flags = {
		holy_building
		inspires_piety
		burial_ground
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.3
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}
 
upgrade_cow_district_temple_hellenic = { # Great Temple (Hellenic)
	picture = GFX_upgrade_cow_district_temple_hellenic
	
	potential = {
		religion_openly_hellenic_or_reformed_trigger = yes
		FROMFROMFROM = {
			NOT = { has_cow_unique_hellenic_temple_district_trigger = yes }
		}
	}
	active = {
		ROOT = {
			OR = { 
				AND = { 
					religion_group = pagan_group
					is_reformed_religion = yes
				}
				religion = hellenic_pagan
			}
		}
	}
	allow = { 
		ROOT = {
			OR = { 
				AND = { 
					religion_group = pagan_group
					is_reformed_religion = yes
				}
				religion = hellenic_pagan
			}
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_hellenic_temple_district_trigger = yes } }
			}
		}
	}

	flags = {
		holy_building
		inspires_piety
		burial_ground
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.5
		monthly_character_piety = 0.6
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_temple_buddhist = { # Buddhist Temple
	picture = GFX_upgrade_cow_district_temple_buddhist
	
	potential = {
		religion = buddhist
	}
	active = {
		ROOT = {
			religion = buddhist
		}
	}
	allow = { 
		ROOT = {
			religion = buddhist
		}
	}

	flags = {
		holy_building
		inspires_piety
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.15
		monthly_character_piety = 0.2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

upgrade_cow_district_temple_hindu = { # Hindu Temple
	picture = GFX_upgrade_cow_district_temple_hindu
	
	potential = {
		religion = hindu
		FROMFROMFROM = { NOT = { has_cow_unique_hindu_temple_district_trigger = yes } }
	}
	active = {
		ROOT = {
			religion = hindu
		}
	}
	allow = { 
		ROOT = {
			religion = hindu
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_hindu_temple_district_trigger = yes } }
			}
		}
	}

	flags = {
		holy_building
		inspires_piety
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.15
		monthly_character_piety = 0.3
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
	}	
}

# Statues:
upgrade_cow_district_statue_ruler = { # Ruler Statue 
	picture = GFX_upgrade_cow_district_statue
	
	potential = {
		FROMFROMFROM = {
			NOT = { has_cow_unique_statue_district_trigger = yes }
		}
	}
	active = {
	}
	allow = { 
		NOT = { trait = humble }
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_statue_district_trigger = yes } }
			}
		}
	}

	flags = {
		statue
		inspires_greatness
		cost_low
	}
	build_time = 300
	gold_cost_flat = 2400
	gold_cost_ticking = 6

	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		monthly_character_prestige = 0.65
		short_reign_length = -1
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = proud
		}
	}	
}

upgrade_cow_district_titan_of_braavos = { # Titan of Braavos
	picture = GFX_upgrade_cow_district_titan_of_braavos
	
	potential = {
		FROMFROMFROM = {
			province_id = 470 # Braavos
			NOT = { has_wonder_upgrade = upgrade_cow_district_statue_ruler }	
		}
	}
	active = {
	}
	allow = {
		FROMFROMFROM = {
			province_id = 470 # Braavos
			NOT = { has_wonder_upgrade = upgrade_cow_district_statue_ruler }	
		}
	}

	flags = {
		is_historical
		statue
		inspires_greatness
		cost_low
	}
	build_time = 300
	gold_cost_flat = 2400
	gold_cost_ticking = 6

	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		monthly_character_prestige = 0.65
		short_reign_length = -1
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = proud
		}
	}	
}

upgrade_cow_district_horse_statue = { # Statue of a Horse
	picture = GFX_upgrade_cow_district_horse_statue
	
	potential = {
		OR = {
			trait = lunatic
			culture = horse
			government = nomadic_government
		}
		FROMFROMFROM = { NOT = { has_cow_unique_horse_statue_district_trigger = yes } }
	}
	active = {
		OR = {
			trait = lunatic
			culture = horse
			government = nomadic_government
		}
	}
	allow = { 
		OR = {
			trait = lunatic
			culture = horse
			government = nomadic_government
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_horse_statue_district_trigger = yes } }
			}
		}
	}

	flags = {
		statue
		inspires_greatness
		cost_low
	}
	build_time = 300
	gold_cost_flat = 2400
	gold_cost_ticking = 6

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.4
		horse_opinion = 10
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = proud
		}
		modifier = {
			factor = 3
			trait = lunatic
		}
	}	
}

# Fortifications:
upgrade_cow_district_grand_walls = { # Great Walls
	picture = GFX_upgrade_cow_district_grand_walls
	
	potential = {
		FROMFROMFROM = { NOT = { has_cow_unique_grand_walls_district_trigger = yes } }
	}
	active = {
	}
	allow = { 
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_grand_walls_district_trigger = yes } }
			}
		}
	}

	flags = {
		defensive
		cost_high
	}
	build_time = 350
	gold_cost_flat = 3000
	gold_cost_ticking = 6

	local_modifier = {
		fort_level = 1.5
		siege_defence = 0.05
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = craven
		}
		modifier = {
			factor = 0.5
			trait = brave
		}
	}	
}

upgrade_cow_district_fortress = { # Grand Fortress
	picture = GFX_upgrade_cow_district_fortress
	
	potential = {
		FROMFROMFROM = { NOT = { has_cow_unique_fortress_district_trigger = yes } }
	}
	active = {
	}
	allow = { 
		# FROMFROMFROM = {
		# }
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_fortress_district_trigger = yes } }
			}
		}
	}

	flags = {
		defensive
		cost_medium
	}
	build_time = 350
	gold_cost_flat = 4100
	gold_cost_ticking = 6

	local_modifier = {
		fort_level = 1.5
		siege_defence = 0.1
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		court_size_maintenance_cost_modifier = -0.1
		court_size_modifier = 10
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = craven
		}
		modifier = {
			factor = 0.5
			trait = brave
		}
	}	
}

upgrade_cow_district_red_keep = { # Red Keep
	picture = GFX_upgrade_cow_district_red_keep
	
	potential = {
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_fortress }	
		}
	}
	active = {
	}
	allow = { 
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_fortress }	
		}
	}

	flags = {
		is_historical
		defensive
		cost_medium
	}
	build_time = 350
	gold_cost_flat = 4100
	gold_cost_ticking = 6

	local_modifier = {
		fort_level = 1.5
		siege_defence = 0.1
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		court_size_maintenance_cost_modifier = -0.1
		court_size_modifier = 10
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = craven
		}
		modifier = {
			factor = 0.5
			trait = brave
		}
	}	
}

upgrade_cow_district_underground_city = { # Great Underground City 
	picture = GFX_upgrade_cow_district_underground_city
	
	potential = {
		FROMFROMFROM = {
			OR = {
				terrain = desert
				terrain = mountain
			}
			any_neighbor_province = {
				OR = {
					terrain = mountain
					terrain = hills
				}
			}
			NOT = { has_cow_unique_underground_city_district_trigger = yes }
		}
	}
	active = {
	}
	allow = {
		FROMFROMFROM = {
			OR = {
				terrain = desert
				terrain = mountain
			}
			any_neighbor_province = {
				OR = {
					terrain = mountain
					terrain = hills
				}
			}
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_underground_city_district_trigger = yes } }
			}
		}
	}
	flags = {
		defensive
		cost_medium
	}
	build_time = 350
	gold_cost_flat = 3000
	gold_cost_ticking = 6

	local_modifier = {
		siege_defence = 0.1
	}
	owner_modifier = {
		monthly_character_prestige = 0.4
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = craven
		}
		modifier = {
			factor = 0.5
			trait = brave
		}
	}	
}

# Great Harbor:
upgrade_cow_district_harbor = { # Great Harbor
	picture = GFX_upgrade_cow_district_harbor
	
	potential = {
		FROMFROMFROM = { 
			is_coastal = yes
			NOT = { has_cow_unique_harbor_district_trigger = yes }
		}
	}
	active = {
	}
	allow = { 
		FROMFROMFROM = { is_coastal = yes }
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_harbor_district_trigger = yes } }
			}
		}
	}

	flags = {
		defensive
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 2900
	gold_cost_ticking = 6

	local_modifier = {
		local_tax_modifier = 0.1
		tradevalue = 100
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		build_cost_modifier = -0.05
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = administrator
		}
		modifier = {
			factor = 3
			trait = greedy
		}
	}	
}

# Great Lighthouse:
upgrade_cow_district_lighthouse = { # Great Lighthouse
	picture = GFX_upgrade_cow_district_lighthouse
	
	potential = { 
		FROMFROMFROM = { 
			is_coastal = yes
			NOT = { has_cow_unique_lighthouse_district_trigger = yes }
		}
	}
	active = { }
	allow = { 
		FROMFROMFROM = { is_coastal = yes }
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_lighthouse_district_trigger = yes } }
			}
		}
	}

	flags = {
		defensive
		cost_medium
		is_singular
	}
	build_time = 300
	gold_cost_flat = 2900
	gold_cost_ticking = 6
	local_modifier = {
		tradevalue = 50
		local_tax_modifier = 0.15
	}
	owner_modifier = {
			monthly_character_prestige = 0.6
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = administrator
		}
		modifier = {
			factor = 3
			trait = greedy
		}
	}
}

upgrade_cow_district_hightower = { # Hightower (Lighthouse/Palace)
	picture = GFX_upgrade_cow_district_hightower
	
	potential = { 
		FROMFROMFROM = { 
			is_coastal = yes
			province_id = 286 # Oldtown
			NOR = { 
				has_wonder_upgrade = upgrade_cow_district_lighthouse
				has_wonder_upgrade = upgrade_cow_district_palace
			}
		}
	}
	active = { }
	allow = { 
		FROMFROMFROM = { 
			is_coastal = yes
			province_id = 286 # Oldtown
			NOR = { 
				has_wonder_upgrade = upgrade_cow_district_lighthouse
				has_wonder_upgrade = upgrade_cow_district_palace
			}
		}
	}

	flags = {
		is_historical
		defensive
		inspires_relaxing
		inspires_contentedness
		cost_medium
		is_singular
	}
	build_time = 300
	gold_cost_flat = 2900
	gold_cost_ticking = 6
	local_modifier = {
		levy_size = 0.1
		tradevalue = 50
		local_tax_modifier = 0.15
	}
	owner_modifier = {
		monthly_character_prestige = 1.1
		land_morale = 0.03
		court_size_modifier = 10
		court_size_maintenance_cost_modifier = -0.15
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = administrator
		}
		modifier = {
			factor = 3
			trait = greedy
		}
	}
}

# Royal Palace:
upgrade_cow_district_palace = { # Royal Palace
	picture = GFX_upgrade_cow_district_palace
	
	potential = {
		FROMFROMFROM = { NOT = { has_cow_unique_palace_district_trigger = yes } }
	}
	allow = { 
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_palace_district_trigger = yes } }
			}
		}
	}
	active = { }

	flags = {
		inspires_relaxing
		inspires_contentedness
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 3600
	gold_cost_ticking = 2
	local_modifier = {
		levy_size = 0.1
	}
	owner_modifier = {
		land_morale = 0.03
		monthly_character_prestige = 0.5
		court_size_modifier = 10
		court_size_maintenance_cost_modifier = -0.15
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = proud
		}
		modifier = {
			factor = 3
			trait = architect
		}
	}
}

upgrade_cow_district_maegors_holdfast = { # Maegor's Holdfast
	picture = GFX_upgrade_cow_district_maegors_holdfast
	
	potential = {
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_palace }	
		}
	}
	allow = { 
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_palace }
			has_wonder_upgrade = upgrade_cow_district_red_keep
		}
	}
	active = { }

	flags = {
		is_historical
		inspires_relaxing
		inspires_contentedness
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 3600
	gold_cost_ticking = 2
	local_modifier = {
		levy_size = 0.1
	}
	owner_modifier = {
		land_morale = 0.03
		monthly_character_prestige = 0.5
		court_size_modifier = 10
		court_size_maintenance_cost_modifier = -0.15
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = proud
		}
		modifier = {
			factor = 3
			trait = architect
		}
	}
}

# Cultural:
upgrade_cow_district_amphitheatre = { # Grand Amphitheater
	picture = GFX_upgrade_cow_district_amphitheatre
	
	potential = {
		OR = {
			culture_group = valyrian
			culture_group = ghiscari_group
			has_religion_feature = religion_ritual_sacrifice
		}
		NOT = {
			has_religion_feature = religion_peaceful
		}
		FROMFROMFROM = { NOT = { has_cow_unique_amphitheatre_district_trigger = yes } }
	}
	active = {
	}
	allow = { 
		OR = {
			culture_group = valyrian
			culture_group = ghiscari_group
			has_religion_feature = religion_ritual_sacrifice
		}
		NOT = {
			has_religion_feature = religion_peaceful
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_amphitheatre_district_trigger = yes } }
			}
		}
	}

	flags = {
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 3500
	gold_cost_ticking = 6

	local_modifier = {
		local_revolt_risk = -0.04
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		same_religion_opinion = 1
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = gamer
		}
		modifier = {
			factor = 3
			trait = hedonist
		}
		modifier = {
			factor = 0.5
			trait = temperate
		}
	}	
}

upgrade_cow_district_kl_dragonpit = { # Dragonpit
	picture = GFX_upgrade_cow_district_kl_dragonpit
	
	potential = {
		OR = {
			culture_group = valyrian
			religion_group = valyrian_rel_group
			has_religion_feature = religion_ritual_sacrifice
		}
		NOT = {
			has_religion_feature = religion_peaceful
		}
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_amphitheatre }	
		}
	}
	active = {
		OR = {
			trait = dragon_rider
			culture_group = valyrian
			religion_group = valyrian_rel_group
			has_religion_feature = religion_ritual_sacrifice
		}
		NOT = { trait = dragon_slayer }
	}
	allow = { 
		OR = {
			culture_group = valyrian
			religion_group = valyrian_rel_group
			has_religion_feature = religion_ritual_sacrifice
		}
		NOT = {
			has_religion_feature = religion_peaceful
		}
		FROMFROMFROM = {
			province_id = 226 # King's Landing
			NOT = { has_wonder_upgrade = upgrade_cow_district_amphitheatre }	
		}
	}

	flags = {
		is_historical
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 3500
	gold_cost_ticking = 6

	local_modifier = {
		local_revolt_risk = -0.04
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		same_religion_opinion = 1
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = gamer
		}
		modifier = {
			factor = 3
			trait = hedonist
		}
		modifier = {
			factor = 0.5
			trait = temperate
		}
	}	
}

upgrade_cow_district_garden = { # Magnificent Garden
	picture = GFX_upgrade_cow_district_garden
	
	potential = {
		FROMFROMFROM = { NOT = { has_cow_unique_garden_district_trigger = yes } }
	}
	active = {
	}
	allow = { 
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_garden_district_trigger = yes } }
			}
		}
	}

	flags = {
		inspires_relaxing
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 2800
	gold_cost_ticking = 6

	local_modifier = {
		disease_defence = 0.1
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		health = 0.2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = socializer
		}
		modifier = {
			factor = 3
			trait = gregarious
		}
		modifier = {
			factor = 0.5
			trait = shy
		}
	}	
}

# Learning Centers:
upgrade_cow_district_library = { # Great Library
	picture = GFX_upgrade_cow_district_library
	
	potential = {
		is_nomadic = no
		FROMFROMFROM = { NOT = { has_cow_unique_library_district_trigger = yes } }
	}

	allow = { 
		is_nomadic = no
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_library_district_trigger = yes } }
			}
		}
	}

	active = {
	}


	flags = {
		inspires_learning
		cost_high
		gives_artifact
		gives_artifact_book
	}
	build_time = 300
	gold_cost_flat = 3000
	gold_cost_ticking = 6
	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.5
		learning = 2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = scholar
		}
		modifier = {
			factor = 3
			trait = theologian
		}
		modifier = {
			factor = 3
			trait = erudite
		}
		modifier = {
			factor = 3
			trait = mastermind_theologian
		}
	}	
}

upgrade_cow_district_library_citadel = { # Library of the Citadel
	picture = GFX_upgrade_cow_district_library_citadel
	
	potential = {
		is_nomadic = no
		FROMFROMFROM = {
			province_id = 286 # Oldtown
			NOT = { has_wonder_upgrade = upgrade_cow_district_library }	
		}
	}

	allow = { 
		is_nomadic = no
		FROMFROMFROM = {
			province_id = 286 # Oldtown
			NOT = { has_wonder_upgrade = upgrade_cow_district_library }	
		}
	}

	active = {
	}


	flags = {
		is_historical
		inspires_learning
		cost_high
		gives_artifact
		gives_artifact_book
	}
	build_time = 300
	gold_cost_flat = 3000
	gold_cost_ticking = 6
	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.5
		learning = 2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = scholar
		}
		modifier = {
			factor = 3
			trait = theologian
		}
		modifier = {
			factor = 3
			trait = erudite
		}
		modifier = {
			factor = 3
			trait = mastermind_theologian
		}
	}	
}

upgrade_cow_district_university = { # Grand University
	picture = GFX_upgrade_cow_district_university
	
	potential = {
		is_nomadic = no
		FROMFROMFROM = { NOT = { has_cow_unique_university_district_trigger = yes } }
	}
	active = {
	}
	allow = { 
		is_nomadic = no
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_university_district_trigger = yes } }
			}
		}
	}

	flags = {
		inspires_learning
		cost_high
		gives_artifact
		gives_artifact_book
	}
	build_time = 300
	gold_cost_flat = 2500
	gold_cost_ticking = 6
	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		learning = 1
		martial = 1
		stewardship = 1
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = scholar
		}
		modifier = {
			factor = 3
			trait = theologian
		}
		modifier = {
			factor = 3
			trait = erudite
		}
		modifier = {
			factor = 3
			trait = mastermind_theologian
		}
	}	
}

upgrade_cow_district_university_citadel = { # Citadel
	picture = GFX_upgrade_cow_district_university_citadel
	
	potential = {
		is_nomadic = no
		FROMFROMFROM = {
			province_id = 286 # Oldtown
			NOT = { has_wonder_upgrade = upgrade_cow_district_university }	
		}
	}
	active = {
	}
	allow = { 
		is_nomadic = no
		FROMFROMFROM = {
			province_id = 286 # Oldtown
			NOT = { has_wonder_upgrade = upgrade_cow_district_university }	
		}
	}

	flags = {
		is_historical
		inspires_learning
		cost_high
		gives_artifact
		gives_artifact_book
	}
	build_time = 300
	gold_cost_flat = 2500
	gold_cost_ticking = 6
	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.2
		learning = 1
		martial = 1
		stewardship = 1
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = scholar
		}
		modifier = {
			factor = 3
			trait = theologian
		}
		modifier = {
			factor = 3
			trait = erudite
		}
		modifier = {
			factor = 3
			trait = mastermind_theologian
		}
	}	
}

# Burial Places/Religious (OTHER):
upgrade_cow_district_mausoleum = { # Grand Mausoleum
	picture = GFX_upgrade_cow_district_mausoleum
	
	potential = {
		FROMFROMFROM = { NOT = { has_cow_unique_mausoleum_district_trigger = yes } }
	}
	active = {
	}
	allow = { 
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_mausoleum_district_trigger = yes } }
			}
		}
	}

	flags = {
		burial_ground
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 2800
	gold_cost_ticking = 6

	local_modifier = {
		local_revolt_risk = -0.01
	}
	owner_modifier = {
		monthly_character_prestige = 0.9
		dynasty_opinion = 3
	}	
}

upgrade_cow_district_pyramid = { # Great Pyramid
	picture = GFX_upgrade_cow_district_pyramid
	
	potential = {
		OR = {
			culture_group = ghiscari_group
			trait = lunatic
		}
		FROMFROMFROM = { NOT = { has_cow_unique_pyramid_district_trigger = yes } }
	}
	active = {
	}
	allow = {
		OR = {
			culture_group = ghiscari_group
			trait = lunatic
		}
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_pyramid_district_trigger = yes } }
			}
		}
	}

	flags = {
		burial_ground
		cost_high
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 8

	local_modifier = {
		local_revolt_risk = -0.01
	}
	owner_modifier = {
		monthly_character_prestige = 0.8
	}
	ai_will_do = {
		factor = 0.5
		modifier = {
			factor = 3
			trait = proud
		}
		modifier = {
			factor = 3
			trait = lunatic
		}
		modifier = {
			factor = 0.5
			trait = humble
		}
	}
}

upgrade_cow_district_pagan_stones = { # Great Stone Circle
	picture = GFX_upgrade_cow_district_pagan_stones
	
	potential = {
		religion_group = pagan_group # TODO?
		FROMFROMFROM = { NOT = { has_cow_unique_pagan_stones_district_trigger = yes } }
	}
	active = {
		religion_group = pagan_group # TODO?
	}
	allow = { 
		religion_group = pagan_group # TODO?
		custom_tooltip = { # Custom tooltip to explain the in-game tooltip
			text = DOES_NOT_HAVE_UNIQUE_COW_DISTRICT
			hidden_tooltip = {
				FROMFROMFROM = { NOT = { has_cow_unique_pagan_stones_district_trigger = yes } }
			}
		}
	}

	flags = {
		cost_medium
	}
	build_time = 300
	gold_cost_flat = 2400
	gold_cost_ticking = 8

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.5
		monthly_character_piety = 0.55
		same_religion_opinion = 2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 3
			trait = zealous
		}
		modifier = {
			factor = 3
			trait = mystic
		}
	}
}

upgrade_cow_district_aztec_pyramid = { # Aztec Pyramid
	picture = GFX_upgrade_cow_district_aztec
	
	potential = {
		OR = {
			religion = aztec_reformed # TODO?
			religion = aztec
		}
	}
	active = {
		OR = {
			religion = aztec_reformed # TODO?
			religion = aztec
		}
	}
	allow = {
		OR = {
			religion = aztec_reformed # TODO?
			religion = aztec
		}
	}

	flags = {
		burial_ground
		cost_high
	}
	build_time = 300
	gold_cost_flat = 4400
	gold_cost_ticking = 8

	local_modifier = {
	}
	owner_modifier = {
		monthly_character_prestige = 0.7
		monthly_character_piety = 0.3
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 2
			trait = zealous
		}
		modifier = {
			factor = 2
			trait = bloodthirsty_gods_1
		}
		modifier = {
			factor = 3
			trait = bloodthirsty_gods_2
		}
		modifier = {
			factor = 4
			trait = bloodthirsty_gods_3
		}
	}
}