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

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

##########################################
# Generic upgrades....
##########################################
upgrade_roads = {
	picture = GFX_upgrade_icon_crates

	potential = {
	}

	allow = {
	}

	active = {
	}

	flags = {
		is_plural
		roads
	}

	build_time = 24
	gold_cost_flat = 450
	gold_cost_ticking = 1

	local_modifier = {
		local_movement_speed = 0.1
	}

	owner_modifier = {
	}
}

upgrade_watchtower_network = {
	picture = GFX_upgrade_icon_walls

	potential = {
	}

	allow = {
	}

	active = {
	}

	flags = {
		is_singular
		watchtower_network
	}

	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
		spikes
	}

	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
		trigger = {
			# Can the pope PLS stop building spikes?!
			NOT = { has_landed_title = k_papacy }
		}

		mult_modifier = {
			factor = 3
			trait = impaler
		}
	}
}

upgrade_tower = {
	picture = GFX_upgrade_icon_stones

	potential = {
	}

	allow = {
	}

	active = {
	}

	flags = {
		towering
		is_singular
		tower
	}

	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
		hypocausts
	}

	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
		heating_pipes
	}

	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
		retinue
	}

	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
		torture_chamber
	}

	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

		mult_modifier = {
			factor = 2
			has_evil_trait_trigger = yes
		}

		mult_modifier = {
			factor = 0.25
			has_landed_title = k_papacy
		}
	}
}

upgrade_brewery = {
	picture = GFX_upgrade_icon_crates

	potential = {
	}

	allow = {
	}

	active = {
	}

	flags = {
		is_singular
		secluded
		entertainment
		produces_alcohol
		brewery
	}

	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

		mult_modifier = {
			factor = 2
			trait = drunkard
		}

		mult_modifier = {
			factor = 0.25
			has_landed_title = k_papacy
		}
	}
}

upgrade_vineyard = {
	picture = GFX_upgrade_icon_crates

	potential = {
	}

	allow = {
	}

	active = {
	}

	flags = {
		is_singular
		secluded
		produces_alcohol
		vineyard
	}

	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
		historical_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
		road_tolls
	}

	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 = {
		trigger_if = {
			limit = { religion_group = muslim }
			NOT = { trait = zealous }
		}
	}

	active = {
		trigger_if = {
			limit = { religion_group = muslim }
			NOT = { trait = zealous }
		}
	}

	flags = {
		air_bnb
		is_singular
		tavern
	}

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