#####################################################################
############################ 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 ###########################

#### GENERIC
# Great Roads ..................... upgrade_roads
# Watchtower Network ..............	upgrade_watchtower_network
# Spikes .......................... upgrade_spikes
# Tower ........................... upgrade_tower
# Hypocausts ...................... upgrade_hypocausts
# Heating Pipes ................... upgrade_heating_pipes
# Retinue ......................... upgrade_retinue
# Torture Chamber ................. upgrade_torture_chamber
# Road Tolls ...................... upgrade_road_tolls 
# Mural ........................... upgrade_historical_mural
# Tavern .......................... upgrade_tavern

#### CATHEDRAL
# Gargoyles ....................... upgrade_gargoyles
# Grand Bells ..................... upgrade_bells
# Stained Glass Window ............ upgrade_stained_glass_window
# Relic Tomb ...................... upgrade_relic_tomb
# Grand Basilica .................. upgrade_grand_basilica
# Catacombs ....................... upgrade_catacombs
# Giant Cross ..................... upgrade_giant_cross
# Golden Bells .................... upgrade_bells_golden

#### TEMPLE
# God Statue ...................... upgrade_statue_god
# Temple Guards ................... upgrade_temple_guards
# Sacrificial Altar ............... upgrade_sacrificial_altar
# Sacred Grove .................... upgrade_sacred_grove
# Prophecy Rooms .................. upgrade_prophecy_rooms
# Walled Paved Precinct ........... upgrade_temple_precinct
# Inner Sanctuary ................. upgrade_inner_sanctuary
# Custodian of the Temple ......... upgrade_custodian_of_temple

#### MOSQUE
# Minaret ......................... upgrade_minaret
# Open Courtyard .................. upgrade_open_courtyard
# Dome ............................ upgrade_dome
# Hanging Lamps ................... upgrade_lamps_hanging
# Soup Kitchen .................... upgrade_soup_kitchen
# School .......................... upgrade_school_mosque
# Hostel for travelers ............ upgrade_hostel
# Custodian of the Mosque ......... upgrade_custodian_of_the_mosque

#### SYNAGOGUE
# The Tallest Building ............ upgrade_tallest_building
# Outer Wall and Open Garden ...... upgrade_garden_outer
# Torah Ark ....................... upgrade_holy_ark
# Elaborate Decorations ........... upgrade_decorations
# Choir Rooms ..................... upgrade_choir_rooms
# School .......................... upgrade_school_synagogue

#### BUDDHIST TEMPLE
# Chaitya-Grihas .................. upgrade_chaitya-grihas
# Gompa ........................... upgrade_gompa
# Bodhi Tree ...................... upgrade_bodhi_tree
# Cave Complex .................... upgrade_cave_complex
# Vihara .......................... upgrade_vihara
# School .......................... upgrade_school_buddhist
# Relic Stupa ..................... upgrade_relic_stupa
# Object Stupa .................... upgrade_object_stupa
# Commemorative Stupa ............. upgrade_commerative_stupa
# Symbolic Stupa .................. upgrade_symbolic_stupa
# Votive Stupa .................... upgrade_votive_stupa

#### HINDU TEMPLE
# Gopuram ......................... upgrade_high_gopura
# Shikara ......................... upgrade_shikhara
# Mandapa ......................... upgrade_mandapa
# Temple Complex .................. upgrade_temple_complex
# Calai ........................... upgrade_school_hindu
# Hospital ........................ upgrade_hospital_hindu

#### UNIVERSITY
# Great Seminars .................. upgrade_great_seminars
# Wing of Diplomacy ............... upgrade_wing_of_diplomacy
# Wing of Strategy ................ upgrade_wing_of_martial
# Wing of Finance ................. upgrade_wing_of_stewardship
# Wing of Secrets ................. upgrade_wing_of_intrigue
# Wing of Learning ................ upgrade_wing_of_learning
# Guardian of Knowledge ........... upgrade_guardian_of_knowledge

#### STATUE
# Gold Plating .................... upgrade_plating_gold
# Silver Plating .................. upgrade_plating_silver
# Bronze Plating .................. upgrade_plating_bronze
# Statues of Family ............... upgrade_statues_family
# Golden crown .................... upgrade_golden_crown
# Watcher of Giants ............... upgrade_watcher_of_giants

#### STATUE OF HORSE
# Great Stable .................... upgrade_stable
# Animal Statues .................. upgrade_statues_animals
# Horse Graveyard ................. upgrade_horse_graveyard

#### GREAT HARBOR
# Cothon .......................... upgrade_cothon
# Piers ........................... upgrade_piers
# Harbor Office ................... upgrade_office_harbor
# Lighthouse ...................... upgrade_lighthouse
# Military Wharf .................. upgrade_military_wharf
# Master of the Tides ............. upgrade_master_of_tides

#### GREAT LIGHTHOUSE
# Treasure Chamber ................ upgrade_treasure_chamber
# Giant Banners ................... upgrade_giant_banners
# Custodian of the Lighthouse ..... upgrade_lighthouse_custodian
# Royal Apartments ................ upgrade_royal_apartments

#### MAUSOLEUM
# Statues of the Dead ............. upgrade_statues_dead
# Eternal Flame ................... upgrade_eternal_flame
# Unmarked Tombs .................. upgrade_unmarked_tombs
# Quadriga Statue ................. upgrade_quadriga_statue
# Keeper of the Dead .............. upgrade_keeper_of_the_dead

#### AMPHITHEATER
# Naval Spectacle ................. upgrade_naval_spectacle
# Animal Cages .................... upgrade_animal_cages
# Hippodrome/Circus ............... upgrade_hippodrome
# Training Academy ................ upgrade_training_academy
# Theater Stage ................... upgrade_theater_stage
# Master of the Game .............. upgrade_master_of_the_games

#### GARDENS
# Fountains ....................... upgrade_fountains
# Fountain of youth ............... upgrade_fountain_of_youth
# Hanging Gardens ................. upgrade_hanging_gardens
# Secluded Groves ................. upgrade_secluded_groves
# Hidden Burial Area .............. upgrade_hidden_burial
# Poisonous Flowers ............... upgrade_poisonous_flowers
# Herb Garden ..................... upgrade_herb_garden
# Statues ......................... upgrade_statues_garden
# Vineyard ........................ upgrade_vineyard
# Pet Graveyard ................... upgrade_pet_graveyard

#### FORTRESS
# Armory .......................... upgrade_armory
# Watch Tower ..................... upgrade_watch_tower
# Vault  .......................... upgrade_vault
# Pit Moat ........................ upgrade_moat_pit
# Spike Moat ...................... upgrade_moat_spike
# Water Moat ...................... upgrade_moat_water
# Moat of Bones ................... upgrade_moat_bones
# Hidden Passageways .............. upgrade_hidden_passageways
# Inner Garden .................... upgrade_garden_inner
# Dueling Room .................... upgrade_dueling_room

#### Mercantile Walls
# Sea Walls ....................... upgrade_walls_sea
# Studded Bastions ................ upgrade_studded_bastions
# Strategic Exclaves .............. upgrade_strategic_exclaves
# Soaring Fortresses .............. upgrade_soaring_fortresses
# Hidden Gates .................... upgrade_hidden_gates
# Gatehouse-Forts ................. upgrade_gatehouse_forts
# Staged Killing Fields ........... upgrade_killing_fields
# Deep Defense Architecture ....... upgrade_deep_defense_architecture
# Artificial Islands .............. upgrade_artificial_islands
# Wall Walker ..................... upgrade_wall_walker

#### UNDERGROUND CITY
# Dungeon ......................... upgrade_dungeon
# Natural Caves ................... upgrade_caves_natural
# Travel Tunnels .................. upgrade_tunnels_travel
# Precious metal mine ............. upgrade_metal_mine_precious
# Guardian of the Deep............. upgrade_guardian_of_the_deep

#### ROYAL PALACE
# Fancy Throne Room ............... upgrade_throne_fancy
# Trap Door ....................... upgrade_trap_door
# Royal Bed Chamber ............... upgrade_royal_bedchamber
# Throne of Skulls ................ upgrade_skull_throne
# Throne of Gold .................. upgrade_golden_throne
# Royal Custodian ................. upgrade_royal_custodian

#### STONEHENGE
# Runestones ...................... upgrade_runestones
# More stones ..................... upgrade_more_stones
# Custodian of the Stone .......... upgrade_stone_custodian

#### GRAND LIBRARY
# Poetry and Drama Collection ..... upgrade_collection_drama
# Architecture Collection ......... upgrade_collection_architecture
# History Collection .............. upgrade_collection_history
# Natural Sciences Collection ..... upgrade_collection_science
# Math and Philosophy Collection .. upgrade_collection_math
# Scribe Room ..................... upgrade_scribe_room
# Keeper of the Tomes ............. upgrade_keeper_of_tomes

#### PYRAMID
# Extra Pyramids .................. upgrade_extra_pyramids
# Sphinx/Beast .................... upgrade_mythological_beast
# Hidden Room ..................... upgrade_hidden_room
# Necropolis ...................... upgrade_necropolis
# Lime Stone Casing ............... upgrade_lime_stone_casing
# Traps ........................... upgrade_traps
# Overseer of Rites ............... upgrade_overseer_of_rites

###################################################################

##########################################
# Generic upgrades....
##########################################
upgrade_roads = {
	picture = GFX_upgrade_icon_crates
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_movement_speed = 0.1
	}
}

upgrade_watchtower_network = {
	picture = GFX_upgrade_icon_walls

	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 72
	gold_cost_flat = 500
	gold_cost_ticking = 1
	local_modifier = {
		levy_size = 0.1
	}
	owner_modifier = {
	}
}

upgrade_spikes = {
	picture = GFX_upgrade_icon_skulls

	potential = { }
	allow = { }
	active = { }

	flags = {
		scary
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.05
	}
	owner_modifier = {
		custom_modifier_text = execution_possible_modifier_tt
	}
	ai_will_do = {
		factor = 0.5
		modifier = {
			factor = 3
			trait = impaler
		}
		modifier = { #can the pope PLS stop building spikes?!
			factor = 0
			k_papal_state = {
    			holder_scope = {
    				character = ROOT
    			}
    		}
		}
	}
}

upgrade_tower = {
	picture = GFX_upgrade_icon_stones

	potential = { }
	allow = { }
	allow = { }
	active = { }

	flags = {
		towering
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.05
	}
	owner_modifier = {
		monthly_character_prestige = 0.02
	}
}
upgrade_hypocausts = {
	picture = GFX_upgrade_icon_brazier

	potential = { }
	allow = { }
	active = { }

	flags = {
		heating
		is_plural
	}
	build_time = 12
	gold_cost_flat = 300
	gold_cost_ticking = 1
	local_modifier = {
		disease_defence = 0.01
	}
	owner_modifier = {
		monthly_character_prestige = 0.02
	}
}

upgrade_heating_pipes = {
	picture = GFX_upgrade_icon_brazier

	potential = { }
	allow = { FROMFROM = { has_wonder_upgrade = upgrade_hypocausts } }
	active = { FROMFROM = { has_wonder_upgrade = upgrade_hypocausts } }

	flags = {
		heating
		is_plural
	}
	build_time = 12
	gold_cost_flat = 500
	gold_cost_ticking = 1
	local_modifier = {
		disease_defence = 0.02
	}
	owner_modifier = {
		monthly_character_prestige = 0.02
	}
}

upgrade_retinue = {
	picture = GFX_upgrade_icon_guard_helmet

	potential = { }
	allow = { }
	active = { }

	flags = {
		unit
		defensive
		is_singular
	}
	build_time = 24
	gold_cost_flat = 550
	gold_cost_ticking = 1
	local_modifier = {
		garrison_size = 0.1
		supply_limit = 1
	}
	owner_modifier = {
		land_organisation = 0.05
	}
}

upgrade_torture_chamber = {
	picture = GFX_upgrade_icon_skulls

	potential = { }
	allow = { }
	active = { }

	flags = {
		scary
		secluded
		is_singular
	}
	build_time = 24
	gold_cost_flat = 550
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		cruel_opinion = 10
		custom_modifier_text = execution_possible_modifier_tt
		custom_modifier_text = intimidation_possible_modifier_tt
		custom_modifier_text = private_talk_possible_modifier_tt
	}
	ai_will_do = {
		factor = 0.5
		modifier = {
			factor = 2
			has_evil_trait_trigger = yes
		}
		modifier = {
			factor = 0.25
			k_papal_state = {
    			holder_scope = {
    				character = ROOT
    			}
    		}
		}
	}
}

upgrade_brewery = {
	picture = GFX_upgrade_icon_crates
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		secluded
		entertainment
		produces_alcohol
	}
	build_time = 36
	gold_cost_flat = 300
	gold_cost_ticking = 1
	local_modifier = {

	}
	owner_modifier = {
		drunkard_opinion = 10
		custom_modifier_text = produces_alcohol_modifier_tt
		custom_modifier_text = private_talk_possible_modifier_tt
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 2
			trait = drunkard
		}
		modifier = {
			factor = 0.25
			k_papal_state = {
    			holder_scope = {
    				character = ROOT
    			}
    		}
		}
	}
}

upgrade_vineyard = {
	picture = GFX_upgrade_icon_crates
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		secluded
		produces_alcohol
	}
	build_time = 36
	gold_cost_flat = 500
	gold_cost_ticking = 1
	local_modifier = {
	}
	owner_modifier = {
		drunkard_opinion = 10
		custom_modifier_text = produces_alcohol_modifier_tt
		custom_modifier_text = private_talk_possible_modifier_tt
	}
	
}

upgrade_historical_mural = {
	picture = GFX_upgrade_icon_decorative
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		decorative
		mural
	}
	build_time = 30
	gold_cost_flat = 300
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		dynasty_opinion = 3
	}
}


upgrade_road_tolls = {
	picture = GFX_upgrade_icon_ingots_gold

	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 18
	gold_cost_flat = 250
	gold_cost_ticking = 1
	local_modifier = {
		local_tax_modifier = 0.05
	}
	owner_modifier = {
	}
}

upgrade_tavern = {
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		air_bnb
		is_singular
	}
	build_time = 18
	gold_cost_flat = 300
	gold_cost_ticking = 1
	local_modifier = {
	}
	owner_modifier = {
		drunkard_opinion = 5
		custom_modifier_text = tavern_custom_modifier_tt
		court_size_modifier = 5
	}
}

##########################################
############### Cathedral ################
##########################################

upgrade_gargoyles = {
	picture = GFX_upgrade_icon_skulls

	potential = { }
	allow = { }
	active = { }

	flags = {
		scary
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		cruel_opinion = 5
		custom_modifier_text = execution_possible_modifier_tt
		custom_modifier_text = intimidation_possible_modifier_tt
		
	}
}

upgrade_bells = {
	picture = GFX_upgrade_icon_ingots_silver

	potential = { }
	allow = { }
	active = { }

	flags = {
		defensive
		decorative
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.1
	}
}

upgrade_stained_glass_window = {
	picture = GFX_upgrade_icon_roses_red

	potential = { }
	active = { }

	flags = {
		decorative
		is_singular
		contemplative
	}
	build_time = 20
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		church_opinion = 5
	}
}

upgrade_relic_tomb = {
	picture = GFX_upgrade_icon_key
	
	potential = { }
	allow = { }
	active = { 
		hidden_tooltip = {
			FROMFROM = { is_active = yes }
		}
		FROM = {
			show_scope_change = no
			trigger_if = {
			    limit = {
			        NOT = { FROMFROM = { is_building_wonder_upgrade = yes } }
			    }
			    custom_tooltip = {
			        text = must_be_storing_a_relic_TT
			        FROMFROM = { has_wonder_upgrade_flag = is_storing_relic }
			    }
			}
		}
	}

	flags = {
		valuable
		is_singular
		holy
		stores_relic
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_piety = 0.25
		custom_modifier_text = storing_a_relic_possible_modifier_tt
	}
}

upgrade_grand_basilica = {
	picture = GFX_upgrade_icon_crates

	potential = { }
	allow = { }
	active = { }

	flags = {
		decorative
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		town_opinion = 5
	}
}

upgrade_catacombs = {
	picture = GFX_upgrade_icon_skulls

	potential = { }
	allow = { }
	active = { }

	flags = {
		decorative
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_piety = 0.05
	}
	local_modifier = {
		siege_defence = 0.1
	}
}

upgrade_giant_cross = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion_group = christian }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = christian } }
			religion_group = christian
		}
	}
	active = { religion_group = christian }

	flags = {
		decorative
		is_singular
		contemplative
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 2
	}
}

upgrade_bells_golden = {
	picture = GFX_upgrade_icon_ingots_gold

	potential = { religion_group = christian }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = christian } }
			religion_group = christian
		}
		FROMFROM = { has_wonder_upgrade = upgrade_bells }
	}
	active = { religion_group = christian }

	flags = {
		defensive
		decorative
		is_plural
		golden
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		proud_opinion = 5
	}
}

##########################################
################# Temple #################
##########################################

upgrade_statue_god = {
	picture = GFX_upgrade_icon_statue

	potential = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}
	allow = {
	}
	active = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}

	flags = {
		decorative
		holy
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_piety = 0.05
	}
}

upgrade_temple_guards = { 
	picture = GFX_upgrade_icon_guard
	
	potential = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}
	allow = {		
	}
	active = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}

	flags = {
		defensive
		#unit
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.1
	}
}

upgrade_sacrificial_altar = { 
	picture = GFX_upgrade_icon_skulls

	potential = { has_religion_feature = religion_ritual_sacrifice }
	allow = { }
	active = { has_religion_feature = religion_ritual_sacrifice }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.05
	}
	owner_modifier = {
		zealous_opinion = 5
	}
}

upgrade_sacred_grove = { 
	picture = GFX_upgrade_icon_roses_white

	potential = { 
		OR = {
			religion = druidic
			religion = dryad_religion
			religion = freya # Hindar
		}
	}
	allow = { }
	active = { 
		OR = {
			religion = druidic
			religion = dryad_religion
			religion = freya
		}
	}

	flags = {
		holy
		decorative
		nature
		is_singular
		secluded
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.04
	}
	owner_modifier = {
		custom_modifier_text = private_talk_possible_modifier_tt
	}
}

upgrade_prophecy_rooms = { 
	picture = GFX_upgrade_icon_crates

	potential = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}
	allow = {
	}
	active = {
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}

	flags = {
		room
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		zealous_opinion = 5
	}
}

upgrade_temple_precinct = { 
	picture = GFX_upgrade_icon_crates

	potential = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}
	allow = {
	}
	active = {
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 2
	}
}

upgrade_inner_sanctuary = { 
	picture = GFX_upgrade_icon_crates

	potential = {
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}
	allow = {		
	}
	active = { 
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}

	flags = {
		room
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		diligent_opinion = 5
	}
	local_modifier = {
		local_revolt_risk = -0.05
	}
}

upgrade_custodian_of_temple = {
	picture = GFX_upgrade_icon_key
	potential = {
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}
	allow = {
	}
	active = {
		OR = {
			religion = melitele
			religion = kreve
			religion = lebioda
			religion = eternal_fire
			religion = freya
			religion = solar
		}
	}

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = custodian_of_temple_custom_modifier_tt
	}
}

##########################################
################# Mosque #################
##########################################

upgrade_minaret = { 
	picture = GFX_upgrade_icon_tower

	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = { religion_group = muslim }

	flags = {
		towering
		religion_conversion_faster
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 2
		custom_modifier_text = religious_spread_custom_modifier_tt
	}
}

upgrade_open_courtyard = { # Sahn
	picture = GFX_upgrade_icon_tower

	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
		num_of_wonder_upgrades = 2
	}
	active = { religion_group = muslim }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		disease_defence = 0.05
	}
}

upgrade_dome = { # Qubba
	picture = GFX_upgrade_icon_crates

	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = { religion_group = muslim }

	flags = {
		towering
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 4
	}
}

upgrade_lamps_hanging = { # Magnificent Hanging Lamps
	picture = GFX_upgrade_icon_crates # Arc?

	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = { religion_group = muslim }

	flags = {
		decorative
		is_plural
	}
	build_time = 24
	gold_cost_flat = 400
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 2
	}
}

upgrade_soup_kitchen = { # 
	# Not only for prayer, the mosque is a civic center, caring for the needy.
	picture = GFX_upgrade_icon_door# House?

	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = {  } # Should be active even if the owner is not Muslim?

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.02
		disease_defence = 0.025
	}
	owner_modifier = {
		kind_opinion = 5
	}
}

upgrade_school_mosque = { 
	picture = GFX_upgrade_icon_book_red

	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = { religion_group = muslim }

	flags = {
		culture_conversion_faster
		inspires_learning
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.01
	}
	owner_modifier = {
		scholar_opinion = 5
		custom_modifier_text = culture_convertion_custom_modifier_tt
	}
}

upgrade_hostel = { # Hostel for travelers (Caravanserai)
	picture = GFX_upgrade_icon_house
	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = { religion_group = muslim }

	flags = {
		air_bnb
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_piety = 0.05
	}
}

upgrade_custodian_of_the_mosque = {
	picture = GFX_upgrade_icon_key
	potential = { religion_group = muslim }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = muslim } }
			religion_group = muslim
		}
	}
	active = { religion_group = muslim }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = custodian_of_mosque_custom_modifier_tt
	}
}

##########################################
############### Synagogue ################
##########################################

upgrade_tallest_building = {
	picture = GFX_upgrade_icon_stones

	potential = { religion_group = jewish_group }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = jewish_group } }
			religion_group = jewish_group
		}
	}
	active = { religion_group = jewish_group }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
		land_morale = 0.01
	}
}
upgrade_garden_outer = { #Outer Wall and Open Garden
	picture = GFX_upgrade_icon_roses_yellow

	potential = { religion_group = jewish_group }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = jewish_group } }
			religion_group = jewish_group
		}
		num_of_wonder_upgrades = 2
	}
	active = { religion_group = jewish_group }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		land_organisation = 0.1
	}
}
upgrade_holy_ark = { #aka the "Torah Ark"
	picture = GFX_upgrade_icon_door # Arc?

	potential = { religion_group = jewish_group }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = jewish_group } }
			religion_group = jewish_group
		}
	}
	active = { religion_group = jewish_group }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		church_opinion = 5
	}
}
upgrade_decorations = { # Elaborate Decorations
	# Elaborate decorations will help elevate the spirit of the faithful to the heavens.
	picture = GFX_upgrade_icon_door # Arc? Gold details?

	potential = { religion_group = jewish_group }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = jewish_group } }
			religion_group = jewish_group
		}
	}
	active = { religion_group = jewish_group }

	flags = {
		is_plural
		decorative
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 2
	}
}
upgrade_choir_rooms = { # Choir Rooms
	picture = GFX_upgrade_icon_door # Arc? Gold details?

	potential = { religion_group = jewish_group }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = jewish_group } }
			religion_group = jewish_group
		}
	}
	active = { religion_group = jewish_group }

	flags = {
		room
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_piety = 0.05
		monthly_character_prestige = 0.05
	}
}
upgrade_school_synagogue = { 
	picture = GFX_upgrade_icon_book_red

	potential = { religion_group = jewish_group }
	allow = {
		trigger_if = {
			limit = { NOT = { religion_group = jewish_group } }
			religion_group = jewish_group
		}
	}
	active = { religion_group = jewish_group }

	flags = {
		culture_conversion_faster
		inspires_learning
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.01
	}
	owner_modifier = {
		scholar_opinion = 5
		custom_modifier_text = culture_convertion_custom_modifier_tt
	}
}
##########################################
########### Buddhist Temple ##############
##########################################


upgrade_chaitya-grihas = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { religion = buddhist }

	flags = {
		is_plural
		contemplative
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.04
	}
	owner_modifier = {

	}

}

upgrade_gompa= {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = {  } #active even if owner not of the same religion

	flags = {
		is_singular
		defensive
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.10
	}
	owner_modifier = {
	
	}
}

upgrade_bodhi_tree = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { religion = buddhist }

	flags = {
		is_singular
		contemplative
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		same_religion_opinion = 2
	}
}

upgrade_cave_complex = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { } # active even if owner is not a Budhist?

	flags = {
		is_singular
		defensive
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.10
	}
	owner_modifier = {
	
	}
}

upgrade_vihara = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { religion = buddhist }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		disease_defence = 0.05
	}
	owner_modifier = {
	}
}

upgrade_school_buddhist = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { religion = buddhist }

	flags = {
		culture_conversion_faster
		inspires_learning
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		scholar_opinion = 5
		custom_modifier_text = culture_convertion_custom_modifier_tt
	}
}

upgrade_relic_stupa = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { 
		religion = buddhist
		hidden_tooltip = {
			FROMFROM = { is_active = yes }
		}
		FROM = {
			show_scope_change = no
			trigger_if = {
			    limit = {
			        NOT = { FROMFROM = { is_building_wonder_upgrade = yes } }
			    }
			    custom_tooltip = {
			        text = must_be_storing_a_relic_TT
			        FROMFROM = { has_wonder_upgrade_flag = is_storing_relic }
			    }
			}
		}
	}

	flags = {
		valuable
		is_singular
		holy
		stores_relic
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		monthly_character_piety = 0.25
		custom_modifier_text = storing_a_relic_possible_modifier_tt
	}
}

upgrade_commerative_stupa = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { religion = buddhist }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		indian_group_opinion = 2
	}

}

upgrade_symbolic_stupa = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
	}
	active = { religion = buddhist }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		buddhist_opinion = 3
	}
}

upgrade_votive_stupa = {
	picture = GFX_upgrade_icon_crates
	
	potential = { religion = buddhist }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = buddhist } }
			religion = buddhist
		}
		num_of_wonder_upgrades = 6
	}
	active = { religion = buddhist }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_tax_modifier = 0.10
	}
	owner_modifier = {
	}
}

##########################################
############# Hindu Temple ###############
##########################################


upgrade_high_gopura = { 
	picture = GFX_upgrade_icon_crates

	potential = { religion = hindu }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = hindu } }
			religion = hindu
		}
	}
	active = { religion = hindu }

	flags = {
		towering
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.10
	}
	owner_modifier = {
		same_religion_opinion = 2
	}
}

upgrade_shikhara = { 
	picture = GFX_upgrade_icon_crates

	potential = { religion = hindu }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = hindu } }
			religion = hindu
		}
	}
	active = { religion = hindu }

	flags = {
		towering
		is_singular
		religion_conversion_faster
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		church_opinion = 3
		custom_modifier_text = religious_spread_custom_modifier_tt
	}
}

upgrade_mandapa = { 
	picture = GFX_upgrade_icon_crates

	potential = { religion = hindu }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = hindu } }
			religion = hindu
		}
	}
	active = { religion = hindu }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		land_organisation = 0.05
	}
}

upgrade_temple_complex = { 
	picture = GFX_upgrade_icon_crates

	potential = { religion = hindu }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = hindu } }
			religion = hindu
		}
		num_of_wonder_upgrades = 4
	}
	active = { religion = hindu }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		dynasty_opinion = 3
	}
}

upgrade_school_hindu = { 
	picture = GFX_upgrade_icon_book_red

	potential = { religion = hindu }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = hindu } }
			religion = hindu
		}
	}
	active = { religion = hindu }

	flags = {
		culture_conversion_faster
		inspires_learning
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.02
	}
	owner_modifier = {
		scholar_opinion = 5
		custom_modifier_text = culture_convertion_custom_modifier_tt
	}
}

upgrade_hospital_hindu = { # 
	picture = GFX_upgrade_icon_house

	potential = { religion = hindu }
	allow = {
		trigger_if = {
			limit = { NOT = { religion = hindu } }
			religion = hindu
		}
	}
	active = {  }  #active even if owner is not of same religion

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		disease_defence = 0.05
	}
	owner_modifier = {
		monthly_character_piety = 0.05
	}
}

##########################################
############### University ###############
##########################################

upgrade_great_seminars = { # Great Seminars
	picture = GFX_upgrade_icon_written_paper

	potential = { }
	allow = { }
	active = { }

	flags = {
		great_lecture_decision
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		scholar_opinion = 5
		town_opinion = 3
		tech_growth_modifier = 0.1
	}
}


upgrade_wing_of_diplomacy = { # Wing of Diplomacy
	picture = GFX_upgrade_icon_written_paper

	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		culture_techpoints = 0.05
	}
	owner_modifier = {
		diplomacy = 1
	}
}

upgrade_wing_of_martial = { # Wing of Strategy
	picture = GFX_upgrade_icon_book_red
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		military_techpoints = 0.05
	}
	owner_modifier = {
		martial = 1
	}
}

upgrade_wing_of_stewardship = { # Wing of Finance
	picture = GFX_upgrade_icon_written_paper
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		economy_techpoints = 0.05
	}
	owner_modifier = {
		stewardship = 1
	}
}

upgrade_wing_of_intrigue = { # Wing of Secrets
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		culture_techpoints = 0.05
	}
	owner_modifier = {
		intrigue = 1
	}
}

upgrade_wing_of_learning = { # Wing of Learning
	picture = GFX_upgrade_icon_book_blue
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		tech_growth_modifier = 0.05
	}
	owner_modifier = {
		learning = 1
	}
}

upgrade_guardian_of_knowledge = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = guardian_of_knowledge_custom_modifier_tt
	}
}

##########################################
################# Statue #################
##########################################

upgrade_plating_gold = {
	picture = GFX_upgrade_icon_ingots_gold

	potential = { }
	allow = {
		custom_tooltip = {
			text = no_other_plating_tt
			hidden_trigger = {
				NOT = {
					FROMFROM = { has_wonder_upgrade_flag = plating }
				}
			}
		}
	}
	active = { }

	flags = {
		plating
		is_singular
		golden
	}
	build_time = 24
	gold_cost_flat = 700
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.3
	}
}

upgrade_plating_silver = {
	picture = GFX_upgrade_icon_ingots_silver
	
	potential = { }
	allow = {
		custom_tooltip = {
			text = no_other_plating_tt
			hidden_trigger = {
				NOT = {
					FROMFROM = { has_wonder_upgrade_flag = plating }
				}
			}
		}
	}
	active = { }

	flags = {
		plating
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.2
	}
}

upgrade_plating_bronze = {
	#....
	picture = GFX_upgrade_icon_ingots_bronze

	potential = { }
	allow = {
		custom_tooltip = {
			text = no_other_plating_tt
			hidden_trigger = {
				NOT = {
					FROMFROM = { has_wonder_upgrade_flag = plating }
				}
			}
		}
	}
	active = { }

	flags = {
		plating
		is_singular
	}
	build_time = 24
	gold_cost_flat = 350
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.1
	}
}

upgrade_statues_family = {
	#....
	picture = GFX_upgrade_icon_stones

	potential = { }
	allow = { }
	active = { }

	flags = {
		statues
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		dynasty_opinion = 3
	}
}

upgrade_golden_crown = {
	#....
	picture = GFX_upgrade_icon_statue

	potential = { 
		FROMFROM = { wonder_stage = 4 }
	}
	allow = { }
	active = { }

	flags = {
		statues
		is_plural
	}
	build_time = 575
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		vassal_opinion = 3
	}
}

upgrade_watcher_of_giants = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = watcher_of_giants_custom_modifier_tt
	}
}

##########################################
############ Statue of Horse #############
##########################################

# Can use plating from regular statues 

upgrade_stable = { # Grand Stable
	# A stable containing horses descending from your trusty steed
	picture = GFX_upgrade_icon_crates

	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		command_modifier = {
			cavalry = 0.05
			archers = 0.05
		}
	}
}

upgrade_statues_animals = { # Statues of other animals
	#....
	picture = GFX_upgrade_icon_statue
	potential = { }
	allow = { }
	active = { }

	flags = {
		statues
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		kind_opinion = 5
	}
}

upgrade_horse_graveyard = { # Put your beloved horses to rest
	#....
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		horse_opinion = 5
	}
}

##########################################
############## Great Harbor ##############
##########################################

upgrade_cothon = { # Cothon
	picture = GFX_upgrade_icon_crates
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		siege_defence = 0.10
		supply_limit = 0.5
	}
}

upgrade_piers = { # Piers
	picture = GFX_upgrade_icon_anchor
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		tradevalue = 30
		supply_limit = 0.25
		local_tax_modifier = 0.0025
	}
}

upgrade_office_harbor = { # Harbor Office
	picture = GFX_upgrade_icon_written_paper
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_tax_modifier = 0.1
		supply_limit = 0.25
	}
}

upgrade_lighthouse = { # Lighthouse
	#....
	picture = GFX_upgrade_icon_brazier
	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		tradevalue = 30
		local_tax_modifier = 0.05
		supply_limit = 0.25
	}
}

upgrade_military_wharf = {
	picture = GFX_upgrade_icon_anchor
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		galleys_perc = 0.5
	}
	owner_modifier = {
		siege_speed = 0.15
	}
}

upgrade_master_of_tides = { # master of the Tides
	picture = GFX_upgrade_icon_anchor
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = master_of_tides_custom_modifier_tt
	}
}

##########################################
########### Great Lighthouse #############
##########################################

upgrade_treasure_chamber = { # Treasure Chamber
	#.... 
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		artifact_protection
		is_singular
		valuable
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = less_likely_to_be_looted_modifier_tt
	}
}

upgrade_giant_banners = { # Giant Banners
	#.... 
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		land_morale = 0.05
	}
}

upgrade_lighthouse_custodian = { # Custodian of the Lighthouse
	#.... 
	picture = GFX_upgrade_icon_brazier
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = lighthouse_custodian_custom_modifier_tt
	}
}

upgrade_royal_apartments = { # Royal Apartments
	#.... 
	picture = GFX_upgrade_icon_roses_red
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
		romantic
		secluded
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		sex_appeal_opinion = 3
		custom_modifier_text = private_talk_possible_modifier_tt
		court_size_modifier = 2
	}
}

##########################################
############### Mausoleum ###############
##########################################
upgrade_statues_dead = { # Statues of the Dead
	#.... 
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { }
	active = { }

	flags = {
		statues
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		dynasty_opinion = 3
	}
}

upgrade_eternal_flame = { #Eternal flame
	#.... 
	picture = GFX_upgrade_icon_brazier
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_revolt_risk = -0.05
	}
	owner_modifier = {
		zun_pagan_opinion = 5
		zun_pagan_reformed_opinion = 5
	}
}

upgrade_unmarked_tombs = { #Unmarked Tombs
	#.... 
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
		scary
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		assassinate_chance_modifier = 0.1
		custom_modifier_text = intimidation_possible_modifier_tt
	}
}

upgrade_quadriga_statue = { #Quadriga
	#.... 
	picture = GFX_upgrade_icon_stones
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		statues
		decorative
		
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
	}
}

upgrade_keeper_of_the_dead = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = kepper_of_dead_custom_modifier_tt
	}
}

##########################################
############## Amphitheater ##############
##########################################
upgrade_naval_spectacle = { # Naval Spectacle
	picture = GFX_upgrade_icon_anchor
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		entertainment
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_tax_modifier = 0.025
	}
	owner_modifier = {
		monthly_character_prestige = 0.1
	}
}

upgrade_animal_cages = { # Animal Cages
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		animal_cages
		is_plural
		entertainment
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.1
		hunter_opinion = 5
	}
}

upgrade_hippodrome = { # Hippodrome/Circus
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		entertainment
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		command_modifier = {
			cavalry = 0.05
		}
	}
}

upgrade_training_academy = { # Training Academy 
	picture = GFX_upgrade_icon_guards
	potential = { }
	allow = { }
	active = { }

	flags = {
		summon_commander
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = recruit_gladiator_modifier_tt #Allows you to summon a warrior every year or so
	}
}

upgrade_theater_stage = { # Theater Stage
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
		poet_opinion = 5
	}
}

upgrade_master_of_the_games = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 12
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = game_master_custom_modifier_tt
	}
}

##########################################
################# Gardens ################
##########################################

upgrade_fountains = {
	picture = GFX_upgrade_icon_roses_blue
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
		poet_opinion = 5
	}
}

upgrade_fountain_of_youth = {
	picture = GFX_upgrade_icon_roses_yellow
	potential = {
		NOT = {
			has_game_rule = {
				name = supernatural_events
				value = off
			}
		}
	}
	allow = {
		trait = mystic
	}
	active = { }

	flags = {
		life_granting
		is_singular
	}
	build_time = 36
	gold_cost_flat = 550
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = fountain_of_youth_custom_modifier_tt
	}
}

upgrade_hanging_gardens = {
	picture = GFX_upgrade_icon_roses_white
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.1
		gardener_opinion = 5
	}
}

upgrade_secluded_groves = {
	picture = GFX_upgrade_icon_roses_black
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
		secluded
		romantic
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		fertility = 0.05
		custom_modifier_text = private_talk_possible_modifier_tt
	}
}

upgrade_hidden_burial = { # Hidden Burial Area
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { }
	active = { }

	flags = {
		body_stash
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		defensive_plot_power_modifier = 0.05
		plot_power_modifier = 0.05
	}
}

upgrade_poisonous_flowers = { 
	picture = GFX_upgrade_icon_roses_black
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		plot_power_modifier = 0.05
	}
}

upgrade_herb_garden = { 
	picture = GFX_upgrade_icon_roses_pink

	potential = { }
	allow = { society_member_of = hermetics }
	active = { society_member_of = hermetics }

	flags = {
		produces_herbs
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		health = 0.1
		custom_modifier_text = herb_event_modifier_tt #Periodically gives you herbs (Hermetic artifact)
	}
}

upgrade_statues_garden = { 
	picture = GFX_upgrade_icon_statue
	potential = { }
	allow = { }
	active = { }

	flags = {
		statues
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
		defensive_plot_power_modifier = 0.05
	}
}

upgrade_pet_graveyard = { 
	picture = GFX_upgrade_icon_statue
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		child_opinion = 5
	}
}

##########################################
################ Fortress ################
##########################################

upgrade_armory = {	
	picture = GFX_upgrade_icon_equipment	
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {		
	}
	local_modifier = {
		heavy_infantry = 100
	}
}

upgrade_watch_tower = {	
	picture = GFX_upgrade_icon_bow_and_arrows
	potential = {}
	allow = { }
	active = { }

	flags = {
		is_singular
		towering
	}
	build_time = 48
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		arrest_chance_modifier = 0.05
	}
	local_modifier = {
		siege_defence = 0.05
	}
}

upgrade_vault = {	
	picture = GFX_upgrade_icon_key
	potential = {}
	allow = { }
	active = { }

	flags = {
		is_singular
		artifact_protection
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = less_likely_to_be_looted_modifier_tt
	}
}

upgrade_moat_pit = { # Pit Moat	
	picture = GFX_upgrade_icon_stones
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = execution_possible_modifier_tt
	}
	local_modifier = {
		siege_defence = 0.05
	}
}

upgrade_moat_spike = { # Spike Moat
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { 
		FROMFROM = { has_wonder_upgrade = upgrade_moat_pit }
	}
	active = {
		FROMFROM = { has_wonder_upgrade = upgrade_moat_pit }
	}

	flags = {
		is_singular
		scary
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = execution_possible_modifier_tt
		custom_modifier_text = intimidation_possible_modifier_tt
	}
	local_modifier = {
		siege_defence = 0.05
	}
}

upgrade_moat_water = { # Water Moat
	picture = GFX_upgrade_icon_anchor
	potential = { }
	allow = { 
		FROMFROM = { has_wonder_upgrade = upgrade_moat_pit }
	}
	active = { 
		FROMFROM = { has_wonder_upgrade = upgrade_moat_pit }
	}

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = execution_possible_modifier_tt
	}
	local_modifier = {
		siege_defence = 0.05
	}
}

upgrade_moat_bones = { # Moat of Bones
	picture = GFX_upgrade_icon_skulls
	potential = { 
		trait = cruel
	}
	allow = {
		FROMFROM = { has_wonder_upgrade = upgrade_moat_pit }
		any_kill_list_character = { # At least 50 kills
			count = 50
		}
	}
	active = {
		FROMFROM = { has_wonder_upgrade = upgrade_moat_pit }
		trait = cruel
	}

	flags = {
		is_singular
		scary
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = execution_possible_modifier_tt
		custom_modifier_text = intimidation_possible_modifier_tt
	}
	local_modifier = {
		siege_defence = 0.05
	}
}
upgrade_hidden_passageways = { # Hidden Passageways
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 36
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		assassinate_chance_modifier = 0.05
	}
	owner_modifier = {
		custom_modifier_text = hidden_passageways_modifier_tt
		court_size_modifier = 2
	}
}

upgrade_garden_inner = { # Inner Garden
	picture = GFX_upgrade_icon_roses_blue
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		secluded
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		land_organisation = 0.1
	}
	owner_modifier = {
		custom_modifier_text = private_talk_possible_modifier_tt
	}
}

upgrade_dueling_room = { # Dueling Room
	picture = GFX_upgrade_icon_equipment
	potential = { }
	allow = { }
	active = { }

	flags = {
		room
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		combat_rating = 3
		brave_opinion = 5
	}
}

##########################################
############## Great Walls ###############
##########################################

upgrade_walls_sea = { # Sea Walls
	#Attack from the sea is often the last thing a city considers. Not so for this wealthy settlement, which has poured money and men into a thick blanket of interconnected walls, defending them from all but the most savage of ocean-going assaults.
	#Technical: Extra layers of walls around the harbor to protect from the sea.
	picture = GFX_upgrade_icon_anchor

	potential = {
		FROMFROMFROM = {
			is_coastal = yes
		}
	}
	allow = {

	}
	build_time = 60
	gold_cost_flat = 500
	gold_cost_ticking = 1

	owner_modifier = {
		town_opinion = 5
	}
	
	local_modifier = {
		siege_defence = 0.20
	}
	flags = {

	}
	active = {
		#always
	}
}

upgrade_studded_bastions = { # Studded Bastions
	#The city's defenses have begun to spill out onto the land, with ropes of well-maintained walls criss-crossing the main approach to the burgh. Adding extra bastions to these will bulge the amount of walkable perimeter (and so how many troops can man them) without noticeably increasing cost.
	#Construct additional bastions along the walls, bulging the amount of walkable perimeter that can be used for defense along any given stretch.
	picture = GFX_upgrade_icon_stones

	potential = {

	}
	allow = {

	}
	
	build_time = 60
	gold_cost_flat = 500
	gold_cost_ticking = 1

	owner_modifier = {
	}
	
	local_modifier = {
		siege_defence = 0.05
		archers = 200
	}
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_strategic_exclaves = { # Strategic Exclaves
	#A city is nothing without its countryside, and this city takes that seriously. Vital local townships are now guarded by their own fortifications, paid for and maintained by the capital-settlement, and the closest are even connected by short walls to form a single, defensible sprawl.
	#Extend the defenses to nearby local townships, forming a huge fortified complex.
	picture = GFX_upgrade_icon_stones

	potential = {

	}
	allow = {

	}
	
	build_time = 120
	gold_cost_flat = 1000
	gold_cost_ticking = 5

	owner_modifier = {
 		town_opinion = 3
		#" * Immediately gain maximum walls & fortification buildings in all currently-built baronies in the county (irrelevant of technology or other construction concerns, because wonder).
 		custom_modifier_text = holdings_walls_upgrade_custom_modifier_tt
	}
	
	
	local_modifier = {
		local_tax_modifier = 0.05
	}
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_soaring_fortresses = { # Soaring Fortresses
	#These dire, imposing stoneworks punch upwards like massive, artificial fists. Crowned with rows of bastions and studded with fortified towers, none may approach without being seen, and no amount of lesser walls captured will stop the enfilading from their legions of archers.
	#Construct massive individual fortresses within the wider network.
	picture = GFX_upgrade_icon_stones

	potential = {
	
	}
	allow = {

	}
	
	build_time = 60
	gold_cost_flat = 500
	gold_cost_ticking = 1

	owner_modifier = {
	}
	
	local_modifier = {
		heavy_infantry = 100
		siege_defence = 0.05
	}
	local_modifier = {
	
	}
	owner_modifier = {
		custom_modifier_text = castellan_custom_modifier_tt
	}
	flags = {
		towering
	}
	active = {
		#always
	}
}

upgrade_hidden_gates = { # Hidden Gates
	# Secreted behind sewer shafts, diving under the moats, cut into the side of obscuring bastions: the defenders of this city strike often and without warning from their many and varied hiding places, before vanishing back into the night.
	# Secret gates and sally ports to make easier strikes outwards.
	
	picture = GFX_upgrade_icon_key

	potential = {

	}
	allow = {

	}
	
	build_time = 24
	gold_cost_flat = 500
	gold_cost_ticking = 1

	owner_modifier = {
		custom_modifier_text = better_chance_of_defender_siege_events_custom_modifier_tt
	}
	
	local_modifier = {
		siege_defence = 0.10
	}
	
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_gatehouse_forts = { # Gatehouse-Forts
	#Turn each gatehouse into a full-scale fortress in its own right, and so turn each layer of the walls into a separate mini-siege.
	
	picture = GFX_upgrade_icon_stones

	potential = {

	}
	allow = {

	}
	
	build_time = 24
	gold_cost_flat = 400
	gold_cost_ticking = 1

	owner_modifier = {
	}
	
	local_modifier = {
		siege_defence = 0.05
		archers = 150
	}
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_killing_fields = { # Staged Killing Fields
	#Planned routes through the defenses that are simple, clear, devoid of cover, and looked over by the maximum possible number of defenses, always with a difficult fortress guarded the next killing ground along.
	picture = GFX_upgrade_icon_skulls

	potential = {

	}
	allow = {

	}
	
	build_time = 24
	gold_cost_flat = 400
	gold_cost_ticking = 1

	owner_modifier = {
	}
	
	local_modifier = {
		archers = 100
		siege_defence = 0.10
	}
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_deep_defense_architecture = { # Deep Defense Architecture
	picture = GFX_upgrade_icon_crates
	potential = {

	}
	allow = {

	}
	
	build_time = 60
	gold_cost_flat = 500
	gold_cost_ticking = 1

	owner_modifier = {
	}
	
	local_modifier = {
		siege_defence = 0.10
	}
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_artificial_islands = { # Artificial Islands
	#Redirect local rivers and channel defensive islands out of the sea itself, adding a naval element to any siege that few attackers are equipped to deal with.
	picture = GFX_upgrade_icon_stones

	potential = {
		FROMFROMFROM = { is_coastal = yes }
	}
	allow = {

	}
	
	build_time = 120
	gold_cost_flat = 300
	gold_cost_ticking = 1

	owner_modifier = {
	}
	
	local_modifier = {
		siege_defence = 0.10
	}
	
	flags = {

	}
	active = {
		#always
	}
}

upgrade_wall_walker = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 12
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = wall_walker_custom_modifier_tt
	}
}

##########################################
############ Underground City ############
##########################################

upgrade_dungeon = { # Dungeon 
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { }
	active = { }

	flags = {
		room
		is_singular
		scary
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		arrest_chance_modifier = 0.1
	}
}

upgrade_caves_natural = { # Natural Caves
	picture = GFX_upgrade_icon_stones
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		defensive_plot_power_modifier = 0.1
	}
}

upgrade_tunnels_travel = { # Travel Tunnels
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 60
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_movement_speed = 0.1
		court_size_modifier = 2
	}
}

upgrade_metal_mine_precious = {  # Precious metal mine
	picture = GFX_upgrade_icon_ingots_silver
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 36
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		local_tax_modifier = 0.1
	}
}

upgrade_guardian_of_the_deep = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 12
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = deep_guardian_custom_modifier_tt
	}
}

##########################################
############## Royal Palace ##############
##########################################

upgrade_throne_fancy = { # Fancy Throne Room
	# ... Some rulers are happy to settle for a simple metal chair. You are not just any ruler
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		room
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
	}
}

upgrade_trap_door = { # Trap Door
	# ... A trap door that opens up in front of the throne room
	picture = GFX_upgrade_icon_skull
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		scary
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		arrest_chance_modifier = 0.1
		court_size_maintenance_cost_modifier = -0.01
	}
	ai_will_do = {
		factor = 0.5
		modifier = {
			factor = 2
			has_evil_trait_trigger = yes
		}
	}
}

upgrade_royal_bedchamber = { # royal bed chamber
	# ... A royal bed chamber
	picture = GFX_upgrade_roses_red
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		secluded
		romantic
	}
	build_time = 24
	gold_cost_flat = 250
	gold_cost_ticking = 1
	owner_modifier = {
		fertility = 0.05
		custom_modifier_text = private_talk_possible_modifier_tt
		court_size_modifier = 2
	}
	ai_will_do = {
		factor = 1
		modifier = {
			factor = 2
			trait = lustful
		}
	}
}

upgrade_skull_throne = { # a throne made of skulls
	# ... A throne made of skulls and other bones
	picture = GFX_upgrade_icon_skulls
	potential = {	
		trait = cruel
	}
	allow = { 
		any_kill_list_character = { # At least 100 kills
			count = 100
		}
	}
	active = {
		trait = cruel
	}

	flags = {
		is_singular
		scary
	}
	build_time = 10
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		cruel_opinion = 20
	}
	ai_will_do = {
		factor = 0.5
		modifier = {
			factor = 2
			has_evil_trait_trigger = yes
		}
	}
}

upgrade_golden_throne = { # a throne made of gold
	# ... A throne made of gold
	picture = GFX_upgrade_icon_ingots_gold
	potential = { }
	allow = { 
		
	}
	active = { }

	flags = {
		golden
		valuable
	}
	build_time = 25
	gold_cost_flat = 1000
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 1
	}
}

upgrade_automata_throne = { # Automata Throne
	picture = GFX_upgrade_icon_stones
	potential = {
		OR = {
			government = roman_imperial_government
			TECH_CONSTRUCTION = 5
		}	
	}
	allow = { 
		
	}
	active = { }

	flags = {
		valuable
	}
	build_time = 25
	gold_cost_flat = 1000
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 2
	}
}

upgrade_royal_custodian = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 12
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = royal_custodian_custom_modifier_tt
	}
}

##########################################
############### Pagan Stones ###############
##########################################

upgrade_runestones = {
	picture = GFX_upgrade_icon_stones

	potential = {
		religion_openly_norse_or_reformed_trigger = yes
	}
	allow = { religion_openly_norse_or_reformed_trigger = yes }
	active = { religion_openly_norse_or_reformed_trigger = yes }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		dynasty_opinion = 3
	}
}

upgrade_stone_custodian = { # Custodian of the Stone
	picture = GFX_upgrade_icon_bricks
	potential = {
	}
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 575
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = stone_custodian_custom_modifier_tt
	}
}

upgrade_more_stones = { # Additional stones
	picture = GFX_upgrade_icon_logistics
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 575
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		same_religion_opinion = 2
	}
}

##########################################
############## Grand Library #############
##########################################

upgrade_collection_drama = { # Poetry and Drama Collection
	picture = GFX_upgrade_icon_book_turquoise
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		poetry_and_drama
		romantic
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		tech_growth_modifier_culture = 0.05
	}
}

upgrade_collection_architecture = { # Architecture Collection
	picture = GFX_upgrade_icon_written_paper
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		architecture
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		tech_growth_modifier_economy = 0.05
	}
}

upgrade_collection_history = { # History Collection
	picture = GFX_upgrade_icon_book_beige
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		history_flag
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		tech_growth_modifier_military = 0.05		
	}
}

upgrade_collection_science = { # Natural Sciences Collection
	picture = GFX_upgrade_icon_book_green
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		natural_sciences
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		tech_growth_modifier_military = 0.05		
	}
}

upgrade_collection_math = { # Math and Philosophy Collection
	picture = GFX_upgrade_icon_written_paper
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		math_and_philosophy
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		tech_growth_modifier_economy = 0.05		
	}
}

upgrade_scribe_room = { # Scribe Room
	picture = GFX_upgrade_icon_written_paper
	potential = { }
	allow = { }
	active = { }

	flags = {
		room
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		tech_growth_modifier = 0.01
		monthly_character_prestige = 0.1
	}
}

upgrade_keeper_of_tomes = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 12
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		tech_growth_modifier_culture = 0.05
	}
	owner_modifier = {
		custom_modifier_text = keeper_of_tomes_custom_modifier_tt
	}
}

##########################################
################ Pyramids ################
##########################################

upgrade_extra_pyramids = { #for relatives, etc	
	picture = GFX_upgrade_icon_stones
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 120
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		dynasty_opinion = 3
		monthly_character_prestige = 0.05
	}
}

upgrade_mythological_beast = { #think sphinx
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 60
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		proud_opinion = 5
		same_religion_opinion = 2
	}
}

upgrade_hidden_room = {
	#A hidden room to hide loot
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		room
		is_singular
		artifact_protection
		secluded
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = less_likely_to_be_looted_modifier_tt
		custom_modifier_text = private_talk_possible_modifier_tt
	}
}

upgrade_necropolis = {
	picture = GFX_upgrade_icon_skulls
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		artifact_protection
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		custom_modifier_text = less_likely_to_be_looted_modifier_tt
	}
}

upgrade_traps = {	
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		#LT.60401 that has a high chance of killing members of the new court.
		custom_modifier_text = traps_custom_modifier_tt
	}
}

upgrade_lime_stone_casing = { #For pyramids
	picture = GFX_upgrade_icon_stones
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_piety = 0.01
		monthly_character_prestige = 0.05
	}
}

upgrade_overseer_of_rites = {
	picture = GFX_upgrade_icon_key
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		unlocks_minor_title
	}
	build_time = 12
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = {
		
	}
	owner_modifier = {
		custom_modifier_text = overseer_of_rites_custom_modifier_tt
	}
}

##########################################
############ Temple of Solomon ###########
##########################################

upgrade_vestibule = {
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		#Prestige/Opinion Bonus with Jewish Subjects
	}
}

upgrade_holy_place = {
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		#Prestige/Opinion Bonus with Jewish Subjects
	}
}

upgrade_holy_of_holies = {
	#"The most holy place, this area of the temple contains the seat of God"
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		#Moral Authority for Jewish Religions
	}
}

upgrade_cherubim = {
	#"Two gigantic Cherubim made out of cedar wood, their outstretched wings touching in the middle of the Holy Place"
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_plural
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = 0.05
	}
}

upgrade_great_court = {
	#The outer Court is used by the population for worship
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		#Reduction of revolt risk in jewish religion provinces
	}
}

upgrade_inner_court = {
	picture = GFX_upgrade_icon_crates
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		church_opinion = 5
	}
}

#Negative Upgrades
upgrade_earthquake_damage_small = {
	picture = GFX_upgrade_icon_stones
	show_in_history = no
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		negative
		repairable
		earthquake_damage
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = -0.30
	}	
}

upgrade_earthquake_damage_medium = {
	picture = GFX_upgrade_icon_stones
	show_in_history = no
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		negative
		repairable
		earthquake_damage
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = -0.30
	}
}

upgrade_earthquake_damage_large = {
	picture = GFX_upgrade_icon_stones
	show_in_history = no
	potential = { }
	allow = { }
	active = { }

	flags = {
		is_singular
		negative
		repairable
		earthquake_damage
	}
	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1
	owner_modifier = {
		monthly_character_prestige = -0.30
	}
}
