﻿### Ducal Landmarks scripted effects

# Root: province
dlm_clear_landmark_state_effect = {
	remove_variable = dlm_group
	remove_variable = dlm_type
	remove_variable = dlm_legendary
	remove_variable = dlm_grand_exchange_legendary_name
	remove_variable = dlm_quality
	remove_variable = dlm_chapter_variant
	remove_variable = dlm_merc_variant
	remove_variable = dlm_host_variant
	remove_variable = dlm_recycled_landmark_site
	remove_variable = dlm_optional_contribution_cutoff_reached
}

# Root: character
dlm_roll_quality_d100_effect = {
	remove_variable = dlm_quality_roll
	random_list = {
		1 = { set_variable = { name = dlm_quality_roll value = 5 } }
		1 = { set_variable = { name = dlm_quality_roll value = 10 } }
		1 = { set_variable = { name = dlm_quality_roll value = 15 } }
		1 = { set_variable = { name = dlm_quality_roll value = 20 } }
		1 = { set_variable = { name = dlm_quality_roll value = 25 } }
		1 = { set_variable = { name = dlm_quality_roll value = 30 } }
		1 = { set_variable = { name = dlm_quality_roll value = 35 } }
		1 = { set_variable = { name = dlm_quality_roll value = 40 } }
		1 = { set_variable = { name = dlm_quality_roll value = 45 } }
		1 = { set_variable = { name = dlm_quality_roll value = 50 } }
		1 = { set_variable = { name = dlm_quality_roll value = 55 } }
		1 = { set_variable = { name = dlm_quality_roll value = 60 } }
		1 = { set_variable = { name = dlm_quality_roll value = 65 } }
		1 = { set_variable = { name = dlm_quality_roll value = 70 } }
		1 = { set_variable = { name = dlm_quality_roll value = 75 } }
		1 = { set_variable = { name = dlm_quality_roll value = 80 } }
		1 = { set_variable = { name = dlm_quality_roll value = 85 } }
		1 = { set_variable = { name = dlm_quality_roll value = 90 } }
		1 = { set_variable = { name = dlm_quality_roll value = 95 } }
		1 = { set_variable = { name = dlm_quality_roll value = 100 } }
	}
}

# Root: province
dlm_add_special_landmark_slot_effect = {
	add_special_building_slot = $BUILDING$_01
}

# Root: province
dlm_create_special_landmark_effect = {
	if = {
		limit = { has_building = dlm_cleared_landmark_site_01 }
		remove_building = dlm_cleared_landmark_site_01
	}
	if = {
		limit = { has_special_building_slot = no }
		add_special_building_slot = $BUILDING$_01
	}
	add_special_building = $BUILDING$_01
	if = {
		limit = {
			dlm_has_colosseum = yes
			county.holder = {
				is_landed = yes
			}
		}
		county.holder = { dlm_sync_colosseum_gladiators_effect = yes }
	}
}

# Root: province
dlm_remove_landmark_family_effect = {
	if = {
		limit = { has_building = $BUILDING$_04 }
		remove_building = $BUILDING$_04
	}
	else_if = {
		limit = { has_building = $BUILDING$_03 }
		remove_building = $BUILDING$_03
	}
	else_if = {
		limit = { has_building = $BUILDING$_02 }
		remove_building = $BUILDING$_02
	}
	else_if = {
		limit = { has_building = $BUILDING$_01 }
		remove_building = $BUILDING$_01
	}
}

# Root: province
# Root: province
dlm_remove_supported_special_landmark_effect = {
	dlm_remove_landmark_family_effect = { BUILDING = dlm_mine }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_mine_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_mine_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_grand_exchange }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_grand_exchange_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_grand_exchange_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_agricultural_domain }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_agricultural_domain_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_agricultural_domain_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_grand_university }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_grand_university_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_grand_university_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_monastic_citadel }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_monastic_citadel_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_monastic_citadel_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_observatory }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_observatory_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_observatory_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_embassy_district }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_embassy_district_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_embassy_district_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_noble_assembly_hall }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_noble_assembly_hall_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_noble_assembly_hall_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_garden_of_accord }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_garden_of_accord_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_garden_of_accord_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_veiled_court }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_veiled_court_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_veiled_court_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_dread_fort }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_dread_fort_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_dread_fort_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_blood_sanctuary }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_blood_sanctuary_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_blood_sanctuary_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_great_wall }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_great_wall_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_great_wall_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_district_of_war }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_district_of_war_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_district_of_war_r }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_fortress_bastion }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_fortress_bastion_l }
	dlm_remove_landmark_family_effect = { BUILDING = dlm_fortress_bastion_r }
	if = {
		limit = { has_building = legendary_shrine }
		remove_building = legendary_shrine
	}
	if = {
		limit = { has_building = legendary_palace }
		remove_building = legendary_palace
	}
	if = {
		limit = { has_building = legendary_statue }
		remove_building = legendary_statue
	}
	if = {
		limit = { has_building = legendary_watchtower }
		remove_building = legendary_watchtower
	}
	if = {
		limit = { has_building = legendary_hunting_lodge }
		remove_building = legendary_hunting_lodge
	}
	if = {
		limit = { has_building = holy_site_cathedral_01 }
		remove_building = holy_site_cathedral_01
	}
	if = {
		limit = { has_building = holy_site_mosque_01 }
		remove_building = holy_site_mosque_01
	}
	if = {
		limit = { has_building = holy_site_fire_temple_01 }
		remove_building = holy_site_fire_temple_01
	}
	if = {
		limit = { has_building = holy_site_pagan_grand_temple_01 }
		remove_building = holy_site_pagan_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_indian_grand_temple_01 }
		remove_building = holy_site_indian_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_buddhist_grand_temple_01 }
		remove_building = holy_site_buddhist_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_japanese_temple_01 }
		remove_building = holy_site_japanese_temple_01
	}
	if = {
		limit = { has_building = holy_site_chinese_temple_01 }
		remove_building = holy_site_chinese_temple_01
	}
	if = {
		limit = { has_building = holy_site_se_asia_pagan_temple_01 }
		remove_building = holy_site_se_asia_pagan_temple_01
	}
	if = {
		limit = { has_building = holy_site_other_grand_temple_01 }
		remove_building = holy_site_other_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_mahabodhi_temple_01 }
		remove_building = holy_site_mahabodhi_temple_01
	}
	if = {
		limit = { has_building = holy_site_imam_ali_mosque_01 }
		remove_building = holy_site_imam_ali_mosque_01
	}
	if = {
		limit = { has_building = holy_site_great_mosque_of_mecca_01 }
		remove_building = holy_site_great_mosque_of_mecca_01
	}
	if = {
		limit = { has_building = holy_site_great_mosque_of_cordoba_01 }
		remove_building = holy_site_great_mosque_of_cordoba_01
	}
	if = {
		limit = { has_building = holy_site_great_mosque_of_djenne_01 }
		remove_building = holy_site_great_mosque_of_djenne_01
	}
	if = {
		limit = { has_building = holy_site_great_mosque_of_samarra_01 }
		remove_building = holy_site_great_mosque_of_samarra_01
	}
	if = {
		limit = { has_building = holy_site_cologne_cathedral_01 }
		remove_building = holy_site_cologne_cathedral_01
	}
	if = {
		limit = { has_building = holy_site_canterbury_cathedral_01 }
		remove_building = holy_site_canterbury_cathedral_01
	}
	if = {
		limit = { has_building = holy_site_canterbury_cathedral_02 }
		remove_building = holy_site_canterbury_cathedral_02
	}
	if = {
		limit = { has_building = holy_site_canterbury_cathedral_03 }
		remove_building = holy_site_canterbury_cathedral_03
	}
	if = {
		limit = { has_building = holy_site_prophetic_mosque_01 }
		remove_building = holy_site_prophetic_mosque_01
	}
	if = {
		limit = { has_building = doges_palace_01 }
		remove_building = doges_palace_01
	}
	if = {
		limit = { has_building = walls_of_genoa_01 }
		remove_building = walls_of_genoa_01
	}
	if = {
		limit = { has_building = visby_ringmur_01 }
		remove_building = visby_ringmur_01
	}
	if = {
		limit = { has_building = walls_of_benin_01 }
		remove_building = walls_of_benin_01
	}
	if = {
		limit = { has_building = the_colosseum_01 }
		remove_building = the_colosseum_01
	}
	if = {
		limit = { has_building = iron_pillar_of_delhi_01 }
		remove_building = iron_pillar_of_delhi_01
	}
	if = {
		limit = { has_building = iron_pillar_of_dhar_01 }
		remove_building = iron_pillar_of_dhar_01
	}
	if = {
		limit = { has_building = the_pyramids_01 }
		remove_building = the_pyramids_01
	}
	if = {
		limit = { has_building = stonehenge_01 }
		remove_building = stonehenge_01
	}
	if = {
		limit = { has_building = offas_dyke_01 }
		remove_building = offas_dyke_01
	}
	if = {
		limit = { has_building = hadrians_wall_01 }
		remove_building = hadrians_wall_01
	}
	if = {
		limit = { has_building = petra_01 }
		remove_building = petra_01
	}
	if = {
		limit = { has_building = buddhas_of_bamian_01 }
		remove_building = buddhas_of_bamian_01
	}
	if = {
		limit = { has_building = alhambra_01 }
		remove_building = alhambra_01
	}
	if = {
		limit = { has_building = alhambra_02 }
		remove_building = alhambra_02
	}
	if = {
		limit = { has_building = citadel_of_aleppo_01 }
		remove_building = citadel_of_aleppo_01
	}
	if = {
		limit = { has_building = citadel_of_aleppo_02 }
		remove_building = citadel_of_aleppo_02
	}
	if = {
		limit = { has_building = house_of_wisdom_01 }
		remove_building = house_of_wisdom_01
	}
	if = {
		limit = { has_building = the_tower_of_london_01 }
		remove_building = the_tower_of_london_01
	}
	if = {
		limit = { has_building = london_bridge_01 }
		remove_building = london_bridge_01
	}
	if = {
		limit = { has_building = notre_dame_01 }
		remove_building = notre_dame_01
	}
	if = {
		limit = { has_building = brihadeeswarar_temple_01 }
		remove_building = brihadeeswarar_temple_01
	}
	if = {
		limit = { has_building = shwedagon_pagoda_01 }
		remove_building = shwedagon_pagoda_01
	}
	if = {
		limit = { has_building = ananda_temple_01 }
		remove_building = ananda_temple_01
	}
	if = {
		limit = { has_building = the_friday_mosque_01 }
		remove_building = the_friday_mosque_01
	}
	if = {
		limit = { has_building = khajuraho_01 }
		remove_building = khajuraho_01
	}
	if = {
		limit = { has_building = palace_of_aachen_01 }
		remove_building = palace_of_aachen_01
	}
	if = {
		limit = { has_building = hagia_sophia_01 }
		remove_building = hagia_sophia_01
	}
	if = {
		limit = { has_building = hagia_sophia_02 }
		remove_building = hagia_sophia_02
	}
	if = {
		limit = { has_building = dome_of_the_rock_01 }
		remove_building = dome_of_the_rock_01
	}
	if = {
		limit = { has_building = temple_in_jerusalem_01 }
		remove_building = temple_in_jerusalem_01
	}
	if = {
		limit = { has_building = hall_of_heroes_01 }
		remove_building = hall_of_heroes_01
	}
	if = {
		limit = { has_building = hall_of_heroes_02 }
		remove_building = hall_of_heroes_02
	}
	if = {
		limit = { has_building = hall_of_heroes_03 }
		remove_building = hall_of_heroes_03
	}
	if = {
		limit = { has_building = hall_of_heroes_04 }
		remove_building = hall_of_heroes_04
	}
	if = {
		limit = { has_building = hall_of_heroes_05 }
		remove_building = hall_of_heroes_05
	}
	if = {
		limit = { has_building = generic_university }
		remove_building = generic_university
	}
	if = {
		limit = { has_building = al_azhar_university }
		remove_building = al_azhar_university
	}
	if = {
		limit = { has_building = sankore_university }
		remove_building = sankore_university
	}
	if = {
		limit = { has_building = siena_university }
		remove_building = siena_university
	}
	if = {
		limit = { has_building = nalanda_university }
		remove_building = nalanda_university
	}
	if = {
		limit = { has_building = special_sicilian_parliament_01 }
		remove_building = special_sicilian_parliament_01
	}
	if = {
		limit = { has_building = special_greenhouse_01 }
		remove_building = special_greenhouse_01
	}
	if = {
		limit = { has_building = hotin_fort_01 }
		remove_building = hotin_fort_01
	}
	if = {
		limit = { has_building = hotin_fort_02 }
		remove_building = hotin_fort_02
	}
	if = {
		limit = { has_building = golden_gate_of_kiev_01 }
		remove_building = golden_gate_of_kiev_01
	}
	if = {
		limit = { has_building = heddal_stave_church_01 }
		remove_building = heddal_stave_church_01
	}
	if = {
		limit = { has_building = temple_of_uppsala_01 }
		remove_building = temple_of_uppsala_01
	}
	if = {
		limit = { has_building = temple_of_uppsala_02 }
		remove_building = temple_of_uppsala_02
	}
	if = {
		limit = { has_building = lund_cathedral_01 }
		remove_building = lund_cathedral_01
	}
	if = {
		limit = { has_building = danevirke_01 }
		remove_building = danevirke_01
	}
	if = {
		limit = { has_building = roman_wall_of_lugo_01 }
		remove_building = roman_wall_of_lugo_01
	}
	if = {
		limit = { has_building = rock_of_gibraltar_01 }
		remove_building = rock_of_gibraltar_01
	}
	if = {
		limit = { has_building = aljaferia_palace_01 }
		remove_building = aljaferia_palace_01
	}
	if = {
		limit = { has_building = tower_of_hercules_01 }
		remove_building = tower_of_hercules_01
	}
	if = {
		limit = { has_building = city_wall_of_toledo_01 }
		remove_building = city_wall_of_toledo_01
	}
	if = {
		limit = { has_building = alcazar_of_segovia_01 }
		remove_building = alcazar_of_segovia_01
	}
	if = {
		limit = { has_building = holy_site_basilica_santiago_01 }
		remove_building = holy_site_basilica_santiago_01
	}
	if = {
		limit = { has_building = imam_reza_shrine_01 }
		remove_building = imam_reza_shrine_01
	}
	if = {
		limit = { has_building = soltaniyeh_01 }
		remove_building = soltaniyeh_01
	}
	if = {
		limit = { has_building = palace_of_ctesiphon_01 }
		remove_building = palace_of_ctesiphon_01
	}
	if = {
		limit = { has_building = palace_of_ctesiphon_02 }
		remove_building = palace_of_ctesiphon_02
	}
	if = {
		limit = { has_building = falak_ol_aflak_citadel_01 }
		remove_building = falak_ol_aflak_citadel_01
	}
	if = {
		limit = { has_building = minarets_and_remains_of_jam_01 }
		remove_building = minarets_and_remains_of_jam_01
	}
	if = {
		limit = { has_building = great_wall_of_gorgan_01 }
		remove_building = great_wall_of_gorgan_01
	}
	if = {
		limit = { has_building = maharloo_lake_01 }
		remove_building = maharloo_lake_01
	}
	if = {
		limit = { has_building = rainbow_mountains_01 }
		remove_building = rainbow_mountains_01
	}
	if = {
		limit = { has_building = mount_damavand_01 }
		remove_building = mount_damavand_01
	}
	if = {
		limit = { has_building = tomb_of_cyrus_01 }
		remove_building = tomb_of_cyrus_01
	}
	if = {
		limit = { has_building = ark_of_bukhara_01 }
		remove_building = ark_of_bukhara_01
	}
	if = {
		limit = { has_building = shah_i_zinda_01 }
		remove_building = shah_i_zinda_01
	}
	if = {
		limit = { has_building = shah_i_zinda_02 }
		remove_building = shah_i_zinda_02
	}
	if = {
		limit = { has_building = alamut_castle_01 }
		remove_building = alamut_castle_01
	}
	if = {
		limit = { has_building = alamut_castle_02 }
		remove_building = alamut_castle_02
	}
	if = {
		limit = { has_building = assassin_castle_01 }
		remove_building = assassin_castle_01
	}
	if = {
		limit = { has_building = event_tower_of_silence_01 }
		remove_building = event_tower_of_silence_01
	}
	if = {
		limit = { has_building = church_of_the_theotokos }
		remove_building = church_of_the_theotokos
	}
	if = {
		limit = { has_building = parthenon }
		remove_building = parthenon
	}
	if = {
		limit = { has_building = hagios_demetrios }
		remove_building = hagios_demetrios
	}
	if = {
		limit = { has_building = kassiopi_castle }
		remove_building = kassiopi_castle
	}
	if = {
		limit = { has_building = saint_lazarus }
		remove_building = saint_lazarus
	}
	if = {
		limit = { has_building = sumela_monastery_01 }
		remove_building = sumela_monastery_01
	}
	if = {
		limit = { has_building = sumela_monastery_02 }
		remove_building = sumela_monastery_02
	}
	if = {
		limit = { has_building = patras_castle }
		remove_building = patras_castle
	}
	if = {
		limit = { has_building = maiden_tower }
		remove_building = maiden_tower
	}
	if = {
		limit = { has_building = despot_palace }
		remove_building = despot_palace
	}
	if = {
		limit = { has_building = meteora_01 }
		remove_building = meteora_01
	}
	if = {
		limit = { has_building = meteora_02 }
		remove_building = meteora_02
	}
	if = {
		limit = { has_building = mount_athos_01 }
		remove_building = mount_athos_01
	}
	if = {
		limit = { has_building = mount_athos_02 }
		remove_building = mount_athos_02
	}
	if = {
		limit = { has_building = mount_athos_03 }
		remove_building = mount_athos_03
	}
	if = {
		limit = { has_building = apollinare_nuovo }
		remove_building = apollinare_nuovo
	}
	if = {
		limit = { has_building = saint_catherine }
		remove_building = saint_catherine
	}
	if = {
		limit = { has_building = jvari_monastery }
		remove_building = jvari_monastery
	}
	if = {
		limit = { has_building = etchmiadzin_cathedral }
		remove_building = etchmiadzin_cathedral
	}
	if = {
		limit = { has_building = cattolica_stilo }
		remove_building = cattolica_stilo
	}
	if = {
		limit = { has_building = hosios_loukas }
		remove_building = hosios_loukas
	}
	if = {
		limit = { has_building = sofia_ohrid }
		remove_building = sofia_ohrid
	}
	if = {
		limit = { has_building = fairy_chimneys }
		remove_building = fairy_chimneys
	}
	if = {
		limit = { has_building = cilician_gates }
		remove_building = cilician_gates
	}
	if = {
		limit = { has_building = pleasure_dome }
		remove_building = pleasure_dome
	}
	if = {
		limit = { has_building = burkhan_khaldun_01 }
		remove_building = burkhan_khaldun_01
	}
	if = {
		limit = { has_building = swahili_port_pemba }
		remove_building = swahili_port_pemba
	}
	if = {
		limit = { has_building = swahili_port_zanzibar }
		remove_building = swahili_port_zanzibar
	}
	if = {
		limit = { has_building = swahili_port_mombasa }
		remove_building = swahili_port_mombasa
	}
	if = {
		limit = { has_building = swahili_port_pate }
		remove_building = swahili_port_pate
	}
	if = {
		limit = { has_building = swahili_port_lamu }
		remove_building = swahili_port_lamu
	}
	if = {
		limit = { has_building = wulingyuan_01 }
		remove_building = wulingyuan_01
	}
	if = {
		limit = { has_building = leshan_giant_buddha_01 }
		remove_building = leshan_giant_buddha_01
	}
	if = {
		limit = { has_building = yungang_grottoes_01 }
		remove_building = yungang_grottoes_01
	}
	if = {
		limit = { has_building = wudang_mountain_temples_01 }
		remove_building = wudang_mountain_temples_01
	}
	if = {
		limit = { has_building = shaolin_monastery_01 }
		remove_building = shaolin_monastery_01
	}
	if = {
		limit = { has_building = lingyin_temple_01 }
		remove_building = lingyin_temple_01
	}
	if = {
		limit = { has_building = giant_wild_goose_pagoda_01 }
		remove_building = giant_wild_goose_pagoda_01
	}
	if = {
		limit = { has_building = kaifeng_palace_01 }
		remove_building = kaifeng_palace_01
	}
	if = {
		limit = { has_building = forbidden_city_01 }
		remove_building = forbidden_city_01
	}
	if = {
		limit = { has_building = qianling_mausoleum_01 }
		remove_building = qianling_mausoleum_01
	}
	if = {
		limit = { has_building = quanzhou_seaport_01 }
		remove_building = quanzhou_seaport_01
	}
	if = {
		limit = { has_building = angkor_wat_01 }
		remove_building = angkor_wat_01
	}
	if = {
		limit = { has_building = citadel_thang_long_01 }
		remove_building = citadel_thang_long_01
	}
	if = {
		limit = { has_building = citadel_thang_long_02 }
		remove_building = citadel_thang_long_02
	}
	if = {
		limit = { has_building = po_klong_garai_01 }
		remove_building = po_klong_garai_01
	}
	if = {
		limit = { has_building = krakatoa_01 }
		remove_building = krakatoa_01
	}
	if = {
		limit = { has_building = borobudur_01 }
		remove_building = borobudur_01
	}
	if = {
		limit = { has_building = hoshi_ryokan_01 }
		remove_building = hoshi_ryokan_01
	}
	if = {
		limit = { has_building = herat_bazaar_01 }
		remove_building = herat_bazaar_01
	}
	if = {
		limit = { has_building = herat_bazaar_02 }
		remove_building = herat_bazaar_02
	}
	if = {
		limit = { has_building = dvin_shuka_01 }
		remove_building = dvin_shuka_01
	}
	if = {
		limit = { has_building = dvin_shuka_02 }
		remove_building = dvin_shuka_02
	}
	if = {
		limit = { has_building = lhasa_market_01 }
		remove_building = lhasa_market_01
	}
	if = {
		limit = { has_building = lhasa_market_02 }
		remove_building = lhasa_market_02
	}
	if = {
		limit = { has_building = khiva_bazaar_01 }
		remove_building = khiva_bazaar_01
	}
	if = {
		limit = { has_building = khiva_bazaar_02 }
		remove_building = khiva_bazaar_02
	}
	if = {
		limit = { has_building = changan_market_01 }
		remove_building = changan_market_01
	}
	if = {
		limit = { has_building = changan_market_02 }
		remove_building = changan_market_02
	}
	if = {
		limit = { has_building = lahur_bazaar_01 }
		remove_building = lahur_bazaar_01
	}
	if = {
		limit = { has_building = lahur_bazaar_02 }
		remove_building = lahur_bazaar_02
	}
	if = {
		limit = { has_building = hamadan_bazaar_01 }
		remove_building = hamadan_bazaar_01
	}
	if = {
		limit = { has_building = hamadan_bazaar_02 }
		remove_building = hamadan_bazaar_02
	}
	if = {
		limit = { has_building = dunhuang_market_01 }
		remove_building = dunhuang_market_01
	}
	if = {
		limit = { has_building = dunhuang_market_02 }
		remove_building = dunhuang_market_02
	}
	if = {
		limit = { has_building = sunday_bazaar_01 }
		remove_building = sunday_bazaar_01
	}
	if = {
		limit = { has_building = sunday_bazaar_02 }
		remove_building = sunday_bazaar_02
	}
	if = {
		limit = { has_building = mount_fuji_01 }
		remove_building = mount_fuji_01
	}
	if = {
		limit = { has_building = itsukushima_jinja_01 }
		remove_building = itsukushima_jinja_01
	}
	if = {
		limit = { has_building = itsukushima_jinja_02 }
		remove_building = itsukushima_jinja_02
	}
	if = {
		limit = { has_building = heian_palace_01 }
		remove_building = heian_palace_01
	}
	if = {
		limit = { has_building = ise_jingu_01 }
		remove_building = ise_jingu_01
	}
	if = {
		limit = { has_building = kofuku_ji_01 }
		remove_building = kofuku_ji_01
	}
	if = {
		limit = { has_building = enryaku_ji_01 }
		remove_building = enryaku_ji_01
	}
	if = {
		limit = { has_building = dazaifu_01 }
		remove_building = dazaifu_01
	}
	if = {
		limit = { has_building = chinjufu_01 }
		remove_building = chinjufu_01
	}
	if = {
		limit = { has_building = hakata_port_01 }
		remove_building = hakata_port_01
	}
	if = {
		limit = { has_building = hwangnyongsa_01 }
		remove_building = hwangnyongsa_01
	}
	if = {
		limit = { has_building = byeokran_port_01 }
		remove_building = byeokran_port_01
	}
	if = {
		limit = { has_building = mount_baekdu_01 }
		remove_building = mount_baekdu_01
	}
	if = {
		limit = { has_building = dau_temple_01 }
		remove_building = dau_temple_01
	}
	if = {
		limit = { has_building = liuhe_pagoda_01 }
		remove_building = liuhe_pagoda_01
	}
	if = {
		limit = { has_building = muaro_jambi_01 }
		remove_building = muaro_jambi_01
	}
	if = {
		limit = { has_building = hanging_temple_01 }
		remove_building = hanging_temple_01
	}
	if = {
		limit = { has_building = pagoda_of_fogong_temple_01 }
		remove_building = pagoda_of_fogong_temple_01
	}
	if = {
		limit = { has_building = plain_of_jars_01 }
		remove_building = plain_of_jars_01
	}
	if = {
		limit = { has_building = dieng_plateau_01 }
		remove_building = dieng_plateau_01
	}
	if = {
		limit = { has_building = mount_apo_01 }
		remove_building = mount_apo_01
	}
	if = {
		limit = { has_building = besakih_temple_01 }
		remove_building = besakih_temple_01
	}
	if = {
		limit = { has_building = gongsanseong_fortress_01 }
		remove_building = gongsanseong_fortress_01
	}
	if = {
		limit = { has_building = white_deer_grotto_academy_01 }
		remove_building = white_deer_grotto_academy_01
	}
	if = {
		limit = { has_building = shigu_academy_01 }
		remove_building = shigu_academy_01
	}
	if = {
		limit = { has_building = culai_academy_01 }
		remove_building = culai_academy_01
	}
	if = {
		limit = { has_building = lize_academy_01 }
		remove_building = lize_academy_01
	}
	if = {
		limit = { has_building = maoshan_academy_01 }
		remove_building = maoshan_academy_01
	}
	if = {
		limit = { has_building = tiantai_monasteries_01 }
		remove_building = tiantai_monasteries_01
	}
	if = {
		limit = { has_building = jizu_shan_temples_01 }
		remove_building = jizu_shan_temples_01
	}
	if = {
		limit = { has_building = nanhua_temple_01 }
		remove_building = nanhua_temple_01
	}
	if = {
		limit = { has_building = mozu_tombs }
		remove_building = mozu_tombs
	}
	if = {
		limit = { has_building = trosky_castle_01 }
		remove_building = trosky_castle_01
	}
	if = {
		limit = { has_building = generic_copper_mines_01 }
		remove_building = generic_copper_mines_01
	}
	if = {
		limit = { has_building = generic_copper_mines_02 }
		remove_building = generic_copper_mines_02
	}
	if = {
		limit = { has_building = generic_copper_mines_03 }
		remove_building = generic_copper_mines_03
	}
	if = {
		limit = { has_building = generic_copper_mines_04 }
		remove_building = generic_copper_mines_04
	}
	if = {
		limit = { has_building = generic_silver_mines_01 }
		remove_building = generic_silver_mines_01
	}
	if = {
		limit = { has_building = generic_silver_mines_02 }
		remove_building = generic_silver_mines_02
	}
	if = {
		limit = { has_building = generic_silver_mines_03 }
		remove_building = generic_silver_mines_03
	}
	if = {
		limit = { has_building = generic_silver_mines_04 }
		remove_building = generic_silver_mines_04
	}
	if = {
		limit = { has_building = generic_gold_mines_01 }
		remove_building = generic_gold_mines_01
	}
	if = {
		limit = { has_building = generic_gold_mines_02 }
		remove_building = generic_gold_mines_02
	}
	if = {
		limit = { has_building = generic_gold_mines_03 }
		remove_building = generic_gold_mines_03
	}
	if = {
		limit = { has_building = generic_gold_mines_04 }
		remove_building = generic_gold_mines_04
	}
	if = {
		limit = { has_building = rammelsberg_mines_01 }
		remove_building = rammelsberg_mines_01
	}
	if = {
		limit = { has_building = rammelsberg_mines_02 }
		remove_building = rammelsberg_mines_02
	}
	if = {
		limit = { has_building = rammelsberg_mines_03 }
		remove_building = rammelsberg_mines_03
	}
	if = {
		limit = { has_building = rammelsberg_mines_04 }
		remove_building = rammelsberg_mines_04
	}
	if = {
		limit = { has_building = kutna_hora_mines_01 }
		remove_building = kutna_hora_mines_01
	}
	if = {
		limit = { has_building = kutna_hora_mines_02 }
		remove_building = kutna_hora_mines_02
	}
	if = {
		limit = { has_building = kutna_hora_mines_03 }
		remove_building = kutna_hora_mines_03
	}
	if = {
		limit = { has_building = kutna_hora_mines_04 }
		remove_building = kutna_hora_mines_04
	}
	if = {
		limit = { has_building = baofeng_mines_01 }
		remove_building = baofeng_mines_01
	}
	if = {
		limit = { has_building = baofeng_mines_02 }
		remove_building = baofeng_mines_02
	}
	if = {
		limit = { has_building = baofeng_mines_03 }
		remove_building = baofeng_mines_03
	}
	if = {
		limit = { has_building = baofeng_mines_04 }
		remove_building = baofeng_mines_04
	}
	if = {
		limit = { has_building = kremnica_mines_01 }
		remove_building = kremnica_mines_01
	}
	if = {
		limit = { has_building = kremnica_mines_02 }
		remove_building = kremnica_mines_02
	}
	if = {
		limit = { has_building = kremnica_mines_03 }
		remove_building = kremnica_mines_03
	}
	if = {
		limit = { has_building = kremnica_mines_04 }
		remove_building = kremnica_mines_04
	}
	if = {
		limit = { has_building = zijinshan_mines_01 }
		remove_building = zijinshan_mines_01
	}
	if = {
		limit = { has_building = zijinshan_mines_02 }
		remove_building = zijinshan_mines_02
	}
	if = {
		limit = { has_building = zijinshan_mines_03 }
		remove_building = zijinshan_mines_03
	}
	if = {
		limit = { has_building = zijinshan_mines_04 }
		remove_building = zijinshan_mines_04
	}
	if = {
		limit = { has_building = jiaodong_mines_01 }
		remove_building = jiaodong_mines_01
	}
	if = {
		limit = { has_building = jiaodong_mines_02 }
		remove_building = jiaodong_mines_02
	}
	if = {
		limit = { has_building = jiaodong_mines_03 }
		remove_building = jiaodong_mines_03
	}
	if = {
		limit = { has_building = jiaodong_mines_04 }
		remove_building = jiaodong_mines_04
	}
	if = {
		limit = { has_building = falun_mines_01 }
		remove_building = falun_mines_01
	}
	if = {
		limit = { has_building = falun_mines_02 }
		remove_building = falun_mines_02
	}
	if = {
		limit = { has_building = falun_mines_03 }
		remove_building = falun_mines_03
	}
	if = {
		limit = { has_building = falun_mines_04 }
		remove_building = falun_mines_04
	}
	if = {
		limit = { has_building = schwaz_mines_01 }
		remove_building = schwaz_mines_01
	}
	if = {
		limit = { has_building = schwaz_mines_02 }
		remove_building = schwaz_mines_02
	}
	if = {
		limit = { has_building = schwaz_mines_03 }
		remove_building = schwaz_mines_03
	}
	if = {
		limit = { has_building = schwaz_mines_04 }
		remove_building = schwaz_mines_04
	}
	if = {
		limit = { has_building = liangzhe_mines_01 }
		remove_building = liangzhe_mines_01
	}
	if = {
		limit = { has_building = liangzhe_mines_02 }
		remove_building = liangzhe_mines_02
	}
	if = {
		limit = { has_building = liangzhe_mines_03 }
		remove_building = liangzhe_mines_03
	}
	if = {
		limit = { has_building = liangzhe_mines_04 }
		remove_building = liangzhe_mines_04
	}
	if = {
		limit = { has_building = argentiera_mines_01 }
		remove_building = argentiera_mines_01
	}
	if = {
		limit = { has_building = argentiera_mines_02 }
		remove_building = argentiera_mines_02
	}
	if = {
		limit = { has_building = argentiera_mines_03 }
		remove_building = argentiera_mines_03
	}
	if = {
		limit = { has_building = argentiera_mines_04 }
		remove_building = argentiera_mines_04
	}
	if = {
		limit = { has_building = kollur_mines_01 }
		remove_building = kollur_mines_01
	}
	if = {
		limit = { has_building = kollur_mines_02 }
		remove_building = kollur_mines_02
	}
	if = {
		limit = { has_building = kollur_mines_03 }
		remove_building = kollur_mines_03
	}
	if = {
		limit = { has_building = kollur_mines_04 }
		remove_building = kollur_mines_04
	}
	if = {
		limit = { has_building = siderokausia_mines_01 }
		remove_building = siderokausia_mines_01
	}
	if = {
		limit = { has_building = siderokausia_mines_02 }
		remove_building = siderokausia_mines_02
	}
	if = {
		limit = { has_building = siderokausia_mines_03 }
		remove_building = siderokausia_mines_03
	}
	if = {
		limit = { has_building = siderokausia_mines_04 }
		remove_building = siderokausia_mines_04
	}
	if = {
		limit = { has_building = mali_mines_01 }
		remove_building = mali_mines_01
	}
	if = {
		limit = { has_building = mali_mines_02 }
		remove_building = mali_mines_02
	}
	if = {
		limit = { has_building = mali_mines_03 }
		remove_building = mali_mines_03
	}
	if = {
		limit = { has_building = mali_mines_04 }
		remove_building = mali_mines_04
	}
	if = {
		limit = { has_building = konasamudram_mines_01 }
		remove_building = konasamudram_mines_01
	}
	if = {
		limit = { has_building = konasamudram_mines_02 }
		remove_building = konasamudram_mines_02
	}
	if = {
		limit = { has_building = konasamudram_mines_03 }
		remove_building = konasamudram_mines_03
	}
	if = {
		limit = { has_building = konasamudram_mines_04 }
		remove_building = konasamudram_mines_04
	}
	if = {
		limit = { has_building = dean_mines_01 }
		remove_building = dean_mines_01
	}
	if = {
		limit = { has_building = dean_mines_02 }
		remove_building = dean_mines_02
	}
	if = {
		limit = { has_building = dean_mines_03 }
		remove_building = dean_mines_03
	}
	if = {
		limit = { has_building = dean_mines_04 }
		remove_building = dean_mines_04
	}
	if = {
		limit = { has_building = phnom_dek_mines_01 }
		remove_building = phnom_dek_mines_01
	}
	if = {
		limit = { has_building = phnom_dek_mines_02 }
		remove_building = phnom_dek_mines_02
	}
	if = {
		limit = { has_building = phnom_dek_mines_03 }
		remove_building = phnom_dek_mines_03
	}
	if = {
		limit = { has_building = phnom_dek_mines_04 }
		remove_building = phnom_dek_mines_04
	}
	if = {
		limit = { has_building = hanxing_mines_01 }
		remove_building = hanxing_mines_01
	}
	if = {
		limit = { has_building = hanxing_mines_02 }
		remove_building = hanxing_mines_02
	}
	if = {
		limit = { has_building = hanxing_mines_03 }
		remove_building = hanxing_mines_03
	}
	if = {
		limit = { has_building = hanxing_mines_04 }
		remove_building = hanxing_mines_04
	}
	if = {
		limit = { has_building = chihu_mines_01 }
		remove_building = chihu_mines_01
	}
	if = {
		limit = { has_building = chihu_mines_02 }
		remove_building = chihu_mines_02
	}
	if = {
		limit = { has_building = chihu_mines_03 }
		remove_building = chihu_mines_03
	}
	if = {
		limit = { has_building = chihu_mines_04 }
		remove_building = chihu_mines_04
	}
	if = {
		limit = { has_building = zawar_mines_01 }
		remove_building = zawar_mines_01
	}
	if = {
		limit = { has_building = zawar_mines_02 }
		remove_building = zawar_mines_02
	}
	if = {
		limit = { has_building = zawar_mines_03 }
		remove_building = zawar_mines_03
	}
	if = {
		limit = { has_building = zawar_mines_04 }
		remove_building = zawar_mines_04
	}
	if = {
		limit = { has_building = takkeda_mines_01 }
		remove_building = takkeda_mines_01
	}
	if = {
		limit = { has_building = takkeda_mines_02 }
		remove_building = takkeda_mines_02
	}
	if = {
		limit = { has_building = takkeda_mines_03 }
		remove_building = takkeda_mines_03
	}
	if = {
		limit = { has_building = takkeda_mines_04 }
		remove_building = takkeda_mines_04
	}
	if = {
		limit = { has_building = khetri_mines_01 }
		remove_building = khetri_mines_01
	}
	if = {
		limit = { has_building = khetri_mines_02 }
		remove_building = khetri_mines_02
	}
	if = {
		limit = { has_building = khetri_mines_03 }
		remove_building = khetri_mines_03
	}
	if = {
		limit = { has_building = khetri_mines_04 }
		remove_building = khetri_mines_04
	}
	if = {
		limit = { has_building = taghaza_mines_01 }
		remove_building = taghaza_mines_01
	}
	if = {
		limit = { has_building = taghaza_mines_02 }
		remove_building = taghaza_mines_02
	}
	if = {
		limit = { has_building = taghaza_mines_03 }
		remove_building = taghaza_mines_03
	}
	if = {
		limit = { has_building = taghaza_mines_04 }
		remove_building = taghaza_mines_04
	}
	if = {
		limit = { has_building = ijil_mines_01 }
		remove_building = ijil_mines_01
	}
	if = {
		limit = { has_building = ijil_mines_02 }
		remove_building = ijil_mines_02
	}
	if = {
		limit = { has_building = ijil_mines_03 }
		remove_building = ijil_mines_03
	}
	if = {
		limit = { has_building = ijil_mines_04 }
		remove_building = ijil_mines_04
	}
	if = {
		limit = { has_building = turda_mines_01 }
		remove_building = turda_mines_01
	}
	if = {
		limit = { has_building = turda_mines_02 }
		remove_building = turda_mines_02
	}
	if = {
		limit = { has_building = turda_mines_03 }
		remove_building = turda_mines_03
	}
	if = {
		limit = { has_building = turda_mines_04 }
		remove_building = turda_mines_04
	}
	if = {
		limit = { has_building = zigong_mines_01 }
		remove_building = zigong_mines_01
	}
	if = {
		limit = { has_building = zigong_mines_02 }
		remove_building = zigong_mines_02
	}
	if = {
		limit = { has_building = zigong_mines_03 }
		remove_building = zigong_mines_03
	}
	if = {
		limit = { has_building = zigong_mines_04 }
		remove_building = zigong_mines_04
	}
	if = {
		limit = { has_building = phocaea_mines_01 }
		remove_building = phocaea_mines_01
	}
	if = {
		limit = { has_building = phocaea_mines_02 }
		remove_building = phocaea_mines_02
	}
	if = {
		limit = { has_building = phocaea_mines_03 }
		remove_building = phocaea_mines_03
	}
	if = {
		limit = { has_building = phocaea_mines_04 }
		remove_building = phocaea_mines_04
	}
	if = {
		limit = { has_building = pansjhir_mines_01 }
		remove_building = pansjhir_mines_01
	}
	if = {
		limit = { has_building = pansjhir_mines_02 }
		remove_building = pansjhir_mines_02
	}
	if = {
		limit = { has_building = pansjhir_mines_03 }
		remove_building = pansjhir_mines_03
	}
	if = {
		limit = { has_building = pansjhir_mines_04 }
		remove_building = pansjhir_mines_04
	}
	if = {
		limit = { has_building = trepca_mines_01 }
		remove_building = trepca_mines_01
	}
	if = {
		limit = { has_building = trepca_mines_02 }
		remove_building = trepca_mines_02
	}
	if = {
		limit = { has_building = trepca_mines_03 }
		remove_building = trepca_mines_03
	}
	if = {
		limit = { has_building = trepca_mines_04 }
		remove_building = trepca_mines_04
	}
	if = {
		limit = { has_building = rudnik_mines_01 }
		remove_building = rudnik_mines_01
	}
	if = {
		limit = { has_building = rudnik_mines_02 }
		remove_building = rudnik_mines_02
	}
	if = {
		limit = { has_building = rudnik_mines_03 }
		remove_building = rudnik_mines_03
	}
	if = {
		limit = { has_building = rudnik_mines_04 }
		remove_building = rudnik_mines_04
	}
	if = {
		limit = { has_building = cevennes_mines_01 }
		remove_building = cevennes_mines_01
	}
	if = {
		limit = { has_building = cevennes_mines_02 }
		remove_building = cevennes_mines_02
	}
	if = {
		limit = { has_building = cevennes_mines_03 }
		remove_building = cevennes_mines_03
	}
	if = {
		limit = { has_building = cevennes_mines_04 }
		remove_building = cevennes_mines_04
	}
	if = {
		limit = { has_building = guiyang_mines_01 }
		remove_building = guiyang_mines_01
	}
	if = {
		limit = { has_building = guiyang_mines_02 }
		remove_building = guiyang_mines_02
	}
	if = {
		limit = { has_building = guiyang_mines_03 }
		remove_building = guiyang_mines_03
	}
	if = {
		limit = { has_building = guiyang_mines_04 }
		remove_building = guiyang_mines_04
	}
	if = {
		limit = { has_building = kaibao_mines_01 }
		remove_building = kaibao_mines_01
	}
	if = {
		limit = { has_building = kaibao_mines_02 }
		remove_building = kaibao_mines_02
	}
	if = {
		limit = { has_building = kaibao_mines_03 }
		remove_building = kaibao_mines_03
	}
	if = {
		limit = { has_building = kaibao_mines_04 }
		remove_building = kaibao_mines_04
	}
	if = {
		limit = { has_building = hetian_mines_01 }
		remove_building = hetian_mines_01
	}
	if = {
		limit = { has_building = hetian_mines_02 }
		remove_building = hetian_mines_02
	}
	if = {
		limit = { has_building = hetian_mines_03 }
		remove_building = hetian_mines_03
	}
	if = {
		limit = { has_building = hetian_mines_04 }
		remove_building = hetian_mines_04
	}
	if = {
		limit = { has_building = dushan_mines_01 }
		remove_building = dushan_mines_01
	}
	if = {
		limit = { has_building = dushan_mines_02 }
		remove_building = dushan_mines_02
	}
	if = {
		limit = { has_building = dushan_mines_03 }
		remove_building = dushan_mines_03
	}
	if = {
		limit = { has_building = dushan_mines_04 }
		remove_building = dushan_mines_04
	}
	if = {
		limit = { has_building = xiuyan_mines_01 }
		remove_building = xiuyan_mines_01
	}
	if = {
		limit = { has_building = xiuyan_mines_02 }
		remove_building = xiuyan_mines_02
	}
	if = {
		limit = { has_building = xiuyan_mines_03 }
		remove_building = xiuyan_mines_03
	}
	if = {
		limit = { has_building = xiuyan_mines_04 }
		remove_building = xiuyan_mines_04
	}
	if = {
		limit = { has_building = itoigawa_mines_01 }
		remove_building = itoigawa_mines_01
	}
	if = {
		limit = { has_building = itoigawa_mines_02 }
		remove_building = itoigawa_mines_02
	}
	if = {
		limit = { has_building = itoigawa_mines_03 }
		remove_building = itoigawa_mines_03
	}
	if = {
		limit = { has_building = itoigawa_mines_04 }
		remove_building = itoigawa_mines_04
	}
	if = {
		limit = { has_building = lantian_mines_01 }
		remove_building = lantian_mines_01
	}
	if = {
		limit = { has_building = lantian_mines_02 }
		remove_building = lantian_mines_02
	}
	if = {
		limit = { has_building = lantian_mines_03 }
		remove_building = lantian_mines_03
	}
	if = {
		limit = { has_building = lantian_mines_04 }
		remove_building = lantian_mines_04
	}
	if = {
		limit = { has_building = fengtian_mines_01 }
		remove_building = fengtian_mines_01
	}
	if = {
		limit = { has_building = fengtian_mines_02 }
		remove_building = fengtian_mines_02
	}
	if = {
		limit = { has_building = fengtian_mines_03 }
		remove_building = fengtian_mines_03
	}
	if = {
		limit = { has_building = hpakant_mines_01 }
		remove_building = hpakant_mines_01
	}
	if = {
		limit = { has_building = hpakant_mines_02 }
		remove_building = hpakant_mines_02
	}
	if = {
		limit = { has_building = hpakant_mines_03 }
		remove_building = hpakant_mines_03
	}
	if = {
		limit = { has_building = hpakant_mines_04 }
		remove_building = hpakant_mines_04
	}
	if = {
		limit = { has_building = allaq_mines_01 }
		remove_building = allaq_mines_01
	}
	if = {
		limit = { has_building = allaq_mines_02 }
		remove_building = allaq_mines_02
	}
	if = {
		limit = { has_building = allaq_mines_03 }
		remove_building = allaq_mines_03
	}
	if = {
		limit = { has_building = allaq_mines_04 }
		remove_building = allaq_mines_04
	}
	if = {
		limit = { has_building = verespatak_mines_01 }
		remove_building = verespatak_mines_01
	}
	if = {
		limit = { has_building = verespatak_mines_02 }
		remove_building = verespatak_mines_02
	}
	if = {
		limit = { has_building = verespatak_mines_03 }
		remove_building = verespatak_mines_03
	}
	if = {
		limit = { has_building = verespatak_mines_04 }
		remove_building = verespatak_mines_04
	}
	if = {
		limit = { has_building = suvarnadvipa_mines_01 }
		remove_building = suvarnadvipa_mines_01
	}
	if = {
		limit = { has_building = suvarnadvipa_mines_02 }
		remove_building = suvarnadvipa_mines_02
	}
	if = {
		limit = { has_building = suvarnadvipa_mines_03 }
		remove_building = suvarnadvipa_mines_03
	}
	if = {
		limit = { has_building = suvarnadvipa_mines_04 }
		remove_building = suvarnadvipa_mines_04
	}
	if = {
		limit = { has_building = nishapur_mines_01 }
		remove_building = nishapur_mines_01
	}
	if = {
		limit = { has_building = nishapur_mines_02 }
		remove_building = nishapur_mines_02
	}
	if = {
		limit = { has_building = nishapur_mines_03 }
		remove_building = nishapur_mines_03
	}
	if = {
		limit = { has_building = nishapur_mines_04 }
		remove_building = nishapur_mines_04
	}
	if = {
		limit = { has_building = srebrenica_mines_01 }
		remove_building = srebrenica_mines_01
	}
	if = {
		limit = { has_building = srebrenica_mines_02 }
		remove_building = srebrenica_mines_02
	}
	if = {
		limit = { has_building = srebrenica_mines_03 }
		remove_building = srebrenica_mines_03
	}
	if = {
		limit = { has_building = srebrenica_mines_04 }
		remove_building = srebrenica_mines_04
	}
	if = {
		limit = { has_building = ratnapura_mines_01 }
		remove_building = ratnapura_mines_01
	}
	if = {
		limit = { has_building = ratnapura_mines_02 }
		remove_building = ratnapura_mines_02
	}
	if = {
		limit = { has_building = ratnapura_mines_03 }
		remove_building = ratnapura_mines_03
	}
	if = {
		limit = { has_building = ratnapura_mines_04 }
		remove_building = ratnapura_mines_04
	}
	if = {
		limit = { has_building = sar_i_sang_mines_01 }
		remove_building = sar_i_sang_mines_01
	}
	if = {
		limit = { has_building = sar_i_sang_mines_02 }
		remove_building = sar_i_sang_mines_02
	}
	if = {
		limit = { has_building = sar_i_sang_mines_03 }
		remove_building = sar_i_sang_mines_03
	}
	if = {
		limit = { has_building = sar_i_sang_mines_04 }
		remove_building = sar_i_sang_mines_04
	}
	if = {
		limit = { has_building = mogok_mines_01 }
		remove_building = mogok_mines_01
	}
	if = {
		limit = { has_building = mogok_mines_02 }
		remove_building = mogok_mines_02
	}
	if = {
		limit = { has_building = mogok_mines_03 }
		remove_building = mogok_mines_03
	}
	if = {
		limit = { has_building = mogok_mines_04 }
		remove_building = mogok_mines_04
	}
	if = {
		limit = { has_building = koganeyama_mines_01 }
		remove_building = koganeyama_mines_01
	}
	if = {
		limit = { has_building = koganeyama_mines_02 }
		remove_building = koganeyama_mines_02
	}
	if = {
		limit = { has_building = koganeyama_mines_03 }
		remove_building = koganeyama_mines_03
	}
	if = {
		limit = { has_building = koganeyama_mines_04 }
		remove_building = koganeyama_mines_04
	}
	if = {
		limit = { has_building = tsushima_mines_01 }
		remove_building = tsushima_mines_01
	}
	if = {
		limit = { has_building = tsushima_mines_02 }
		remove_building = tsushima_mines_02
	}
	if = {
		limit = { has_building = tsushima_mines_03 }
		remove_building = tsushima_mines_03
	}
	if = {
		limit = { has_building = tsushima_mines_04 }
		remove_building = tsushima_mines_04
	}
	if = {
		limit = { has_building = sado_mines_01 }
		remove_building = sado_mines_01
	}
	if = {
		limit = { has_building = sado_mines_02 }
		remove_building = sado_mines_02
	}
	if = {
		limit = { has_building = sado_mines_03 }
		remove_building = sado_mines_03
	}
	if = {
		limit = { has_building = sado_mines_04 }
		remove_building = sado_mines_04
	}
	if = {
		limit = { has_building = tada_mines_01 }
		remove_building = tada_mines_01
	}
	if = {
		limit = { has_building = tada_mines_02 }
		remove_building = tada_mines_02
	}
	if = {
		limit = { has_building = tada_mines_03 }
		remove_building = tada_mines_03
	}
	if = {
		limit = { has_building = tada_mines_04 }
		remove_building = tada_mines_04
	}
	if = {
		limit = { has_building = drassanes_01 }
		remove_building = drassanes_01
	}
	if = {
		limit = { has_building = kyz_kala_01 }
		remove_building = kyz_kala_01
	}
	if = {
		limit = { has_building = cluny_abbey_01 }
		remove_building = cluny_abbey_01
	}
	if = {
		limit = { has_building = cluny_abbey_02 }
		remove_building = cluny_abbey_02
	}
	if = {
		limit = { has_building = york_walls_01 }
		remove_building = york_walls_01
	}
	if = {
		limit = { has_building = damascus_mosque_01 }
		remove_building = damascus_mosque_01
	}
	if = {
		limit = { has_building = jokhang_01 }
		remove_building = jokhang_01
	}
	if = {
		limit = { has_building = wartburg_01 }
		remove_building = wartburg_01
	}
	if = {
		limit = { has_building = beta_giyorgis_01 }
		remove_building = beta_giyorgis_01
	}
	if = {
		limit = { has_building = holy_wisdom_01 }
		remove_building = holy_wisdom_01
	}
	if = {
		limit = { has_building = kano_walls_01 }
		remove_building = kano_walls_01
	}
	if = {
		limit = { has_building = somapura_university_01 }
		remove_building = somapura_university_01
	}
	if = {
		limit = { has_building = duomo_florence_01 }
		remove_building = duomo_florence_01
	}
	if = {
		limit = { has_building = duomo_florence_02 }
		remove_building = duomo_florence_02
	}
	if = {
		limit = { has_building = duomo_florence_03 }
		remove_building = duomo_florence_03
	}
	if = {
		limit = { has_building = duomo_florence_04 }
		remove_building = duomo_florence_04
	}
	if = {
		limit = { has_building = konark_temple_01 }
		remove_building = konark_temple_01
	}
	if = {
		limit = { has_building = al_qarawiyyin_university_01 }
		remove_building = al_qarawiyyin_university_01
	}
	if = {
		limit = { has_building = kairouan_basins_01 }
		remove_building = kairouan_basins_01
	}
	if = {
		limit = { has_building = ghana_palace_01 }
		remove_building = ghana_palace_01
	}
	if = {
		limit = { has_building = visegrad_castle_01 }
		remove_building = visegrad_castle_01
	}
	if = {
		limit = { has_building = wawel_cathedral_01 }
		remove_building = wawel_cathedral_01
	}
	if = {
		limit = { has_building = wawel_cathedral_02 }
		remove_building = wawel_cathedral_02
	}
	if = {
		limit = { has_building = wawel_cathedral_03 }
		remove_building = wawel_cathedral_03
	}
	if = {
		limit = { has_building = vatapi_caves_01 }
		remove_building = vatapi_caves_01
	}
	if = {
		limit = { has_building = jaisalmer_fort_01 }
		remove_building = jaisalmer_fort_01
	}
	if = {
		limit = { has_building = holy_site_st_peters_basilica_01 }
		remove_building = holy_site_st_peters_basilica_01
	}
	if = {
		limit = { has_building = mont_st_michel_01 }
		remove_building = mont_st_michel_01
	}
	if = {
		limit = { has_building = mont_st_michel_02 }
		remove_building = mont_st_michel_02
	}
	if = {
		limit = { has_building = mont_st_michel_03 }
		remove_building = mont_st_michel_03
	}
	if = {
		limit = { has_building = mont_st_michel_04 }
		remove_building = mont_st_michel_04
	}
	if = {
		limit = { has_building = sanchi_stupa_01 }
		remove_building = sanchi_stupa_01
	}
	if = {
		limit = { has_building = boudhanath_01 }
		remove_building = boudhanath_01
	}
	if = {
		limit = { has_building = yazd_mosque_01 }
		remove_building = yazd_mosque_01
	}
	if = {
		limit = { has_building = qutb_minar_01 }
		remove_building = qutb_minar_01
	}
	if = {
		limit = { has_building = qutb_minar_02 }
		remove_building = qutb_minar_02
	}
	if = {
		limit = { has_building = qutb_minar_03 }
		remove_building = qutb_minar_03
	}
	if = {
		limit = { has_building = qutb_minar_04 }
		remove_building = qutb_minar_04
	}
	if = {
		limit = { has_building = goguryeo_tomb_01 }
		remove_building = goguryeo_tomb_01
	}
	if = {
		limit = { has_building = buddha_kamakura_01 }
		remove_building = buddha_kamakura_01
	}
	if = {
		limit = { has_building = pyramid_lingapura_01 }
		remove_building = pyramid_lingapura_01
	}
	if = {
		limit = { has_building = maijishan_grottoes_01 }
		remove_building = maijishan_grottoes_01
	}
	if = {
		limit = { has_building = three_pagodas_dali_01 }
		remove_building = three_pagodas_dali_01
	}
	if = {
		limit = { has_building = iron_lion_cangzhou_01 }
		remove_building = iron_lion_cangzhou_01
	}
	if = {
		limit = { has_building = dengfeng_observatory_01 }
		remove_building = dengfeng_observatory_01
	}
	if = {
		limit = { has_building = muara_takus_01 }
		remove_building = muara_takus_01
	}
	if = {
		limit = { has_building = stone_pagoda_01 }
		remove_building = stone_pagoda_01
	}
	if = {
		limit = { has_building = thuriang_kilns_01 }
		remove_building = thuriang_kilns_01
	}
	if = {
		limit = { has_building = yuelu_academy_01 }
		remove_building = yuelu_academy_01
	}
	if = {
		limit = { has_building = chocolate_hills_01 }
		remove_building = chocolate_hills_01
	}
	if = {
		limit = { has_building = fanfang_guangzhou_01 }
		remove_building = fanfang_guangzhou_01
	}
	if = {
		limit = { has_building = wilwatikta_palace_01 }
		remove_building = wilwatikta_palace_01
	}
	if = {
		limit = { has_building = ha_long_bay_01 }
		remove_building = ha_long_bay_01
	}
	if = {
		limit = { has_building = my_son_sanctuary_01 }
		remove_building = my_son_sanctuary_01
	}
	if = {
		limit = { has_building = gunung_api_01 }
		remove_building = gunung_api_01
	}
	if = {
		limit = { has_building = suwalesi_megaliths_01 }
		remove_building = suwalesi_megaliths_01
	}
	if = {
		limit = { has_building = izumo_taisha_01 }
		remove_building = izumo_taisha_01
	}
	if = {
		limit = { has_building = confucius_temple_01 }
		remove_building = confucius_temple_01
	}
	if = {
		limit = { has_building = citadel_linan_01 }
		remove_building = citadel_linan_01
	}
	if = {
		limit = { has_building = temples_angkor_01 }
		remove_building = temples_angkor_01
	}
	if = {
		limit = { has_building = temples_angkor_02 }
		remove_building = temples_angkor_02
	}
	if = {
		limit = { has_building = the_red_keep_01 }
		remove_building = the_red_keep_01
	}
	if = {
		limit = { has_building = the_red_keep_02 }
		remove_building = the_red_keep_02
	}
	if = {
		limit = { has_building = the_red_keep_03 }
		remove_building = the_red_keep_03
	}
	if = {
		limit = { has_building = cobblers_square_01 }
		remove_building = cobblers_square_01
	}
	if = {
		limit = { has_building = holy_site_great_sept_01 }
		remove_building = holy_site_great_sept_01
	}
	if = {
		limit = { has_building = generic_great_sept_01 }
		remove_building = generic_great_sept_01
	}
	if = {
		limit = { has_building = agot_sept_of_remembrance_01 }
		remove_building = agot_sept_of_remembrance_01
	}
	if = {
		limit = { has_building = dragonpit_01 }
		remove_building = dragonpit_01
	}
	if = {
		limit = { has_building = dragonpit_02 }
		remove_building = dragonpit_02
	}
	if = {
		limit = { has_building = dragonpit_03 }
		remove_building = dragonpit_03
	}
	if = {
		limit = { has_building = dragonpit_ruins_01 }
		remove_building = dragonpit_ruins_01
	}
	if = {
		limit = { has_building = dragonpit_ruins_02 }
		remove_building = dragonpit_ruins_02
	}
	if = {
		limit = { has_building = dragonpit_ruins_03 }
		remove_building = dragonpit_ruins_03
	}
	if = {
		limit = { has_building = winterfell_01 }
		remove_building = winterfell_01
	}
	if = {
		limit = { has_building = winterfell_02 }
		remove_building = winterfell_02
	}
	if = {
		limit = { has_building = winterfell_03 }
		remove_building = winterfell_03
	}
	if = {
		limit = { has_building = the_eyrie_01 }
		remove_building = the_eyrie_01
	}
	if = {
		limit = { has_building = casterly_rock_01 }
		remove_building = casterly_rock_01
	}
	if = {
		limit = { has_building = casterly_rock_02 }
		remove_building = casterly_rock_02
	}
	if = {
		limit = { has_building = casterly_rock_03 }
		remove_building = casterly_rock_03
	}
	if = {
		limit = { has_building = casterly_rock_04 }
		remove_building = casterly_rock_04
	}
	if = {
		limit = { has_building = highgarden_01 }
		remove_building = highgarden_01
	}
	if = {
		limit = { has_building = highgarden_02 }
		remove_building = highgarden_02
	}
	if = {
		limit = { has_building = highgarden_03 }
		remove_building = highgarden_03
	}
	if = {
		limit = { has_building = highgarden_04 }
		remove_building = highgarden_04
	}
	if = {
		limit = { has_building = highgarden_05 }
		remove_building = highgarden_05
	}
	if = {
		limit = { has_building = pyke_01 }
		remove_building = pyke_01
	}
	if = {
		limit = { has_building = sunspear_01 }
		remove_building = sunspear_01
	}
	if = {
		limit = { has_building = storms_end_01 }
		remove_building = storms_end_01
	}
	if = {
		limit = { has_building = storms_end_02 }
		remove_building = storms_end_02
	}
	if = {
		limit = { has_building = storms_end_03 }
		remove_building = storms_end_03
	}
	if = {
		limit = { has_building = storms_end_04 }
		remove_building = storms_end_04
	}
	if = {
		limit = { has_building = storms_end_05 }
		remove_building = storms_end_05
	}
	if = {
		limit = { has_building = storms_end_06 }
		remove_building = storms_end_06
	}
	if = {
		limit = { has_building = storms_end_07 }
		remove_building = storms_end_07
	}
	if = {
		limit = { has_building = riverrun_01 }
		remove_building = riverrun_01
	}
	if = {
		limit = { has_building = moat_cailin_01 }
		remove_building = moat_cailin_01
	}
	if = {
		limit = { has_building = moat_cailin_02 }
		remove_building = moat_cailin_02
	}
	if = {
		limit = { has_building = moat_cailin_03 }
		remove_building = moat_cailin_03
	}
	if = {
		limit = { has_building = the_bloody_gate_01 }
		remove_building = the_bloody_gate_01
	}
	if = {
		limit = { has_building = dragonstone_01 }
		remove_building = dragonstone_01
	}
	if = {
		limit = { has_building = the_hightower_01 }
		remove_building = the_hightower_01
	}
	if = {
		limit = { has_building = holy_site_starry_sept_01 }
		remove_building = holy_site_starry_sept_01
	}
	if = {
		limit = { has_building = the_citadel_01 }
		remove_building = the_citadel_01
	}
	if = {
		limit = { has_building = the_citadel_02 }
		remove_building = the_citadel_02
	}
	if = {
		limit = { has_building = holy_site_naggas_hill_01 }
		remove_building = holy_site_naggas_hill_01
	}
	if = {
		limit = { has_building = the_twins_01 }
		remove_building = the_twins_01
	}
	if = {
		limit = { has_building = generic_harrenhal_01 }
		remove_building = generic_harrenhal_01
	}
	if = {
		limit = { has_building = harrenhal_01 }
		remove_building = harrenhal_01
	}
	if = {
		limit = { has_building = ruins_harrenhal_01 }
		remove_building = ruins_harrenhal_01
	}
	if = {
		limit = { has_building = ruins_harrenhal_02 }
		remove_building = ruins_harrenhal_02
	}
	if = {
		limit = { has_building = ruins_harrenhal_03 }
		remove_building = ruins_harrenhal_03
	}
	if = {
		limit = { has_building = ruins_harrenhal_04 }
		remove_building = ruins_harrenhal_04
	}
	if = {
		limit = { has_building = ruins_harrenhal_05 }
		remove_building = ruins_harrenhal_05
	}
	if = {
		limit = { has_building = ruins_harrenhal_06 }
		remove_building = ruins_harrenhal_06
	}
	if = {
		limit = { has_building = ruins_harrenhal_07 }
		remove_building = ruins_harrenhal_07
	}
	if = {
		limit = { has_building = agot_gorms_port_01 }
		remove_building = agot_gorms_port_01
	}
	if = {
		limit = { has_building = agot_gorms_port_02 }
		remove_building = agot_gorms_port_02
	}
	if = {
		limit = { has_building = agot_ruins_gorms_port_01 }
		remove_building = agot_ruins_gorms_port_01
	}
	if = {
		limit = { has_building = agot_ruins_gorms_port_02 }
		remove_building = agot_ruins_gorms_port_02
	}
	if = {
		limit = { has_building = agot_ruins_gorms_port_03 }
		remove_building = agot_ruins_gorms_port_03
	}
	if = {
		limit = { has_building = agot_ruins_gorms_port_04 }
		remove_building = agot_ruins_gorms_port_04
	}
	if = {
		limit = { has_building = agot_raymons_hall_01 }
		remove_building = agot_raymons_hall_01
	}
	if = {
		limit = { has_building = agot_raymons_hall_02 }
		remove_building = agot_raymons_hall_02
	}
	if = {
		limit = { has_building = agot_ruins_raymons_hall_01 }
		remove_building = agot_ruins_raymons_hall_01
	}
	if = {
		limit = { has_building = agot_ruins_raymons_hall_02 }
		remove_building = agot_ruins_raymons_hall_02
	}
	if = {
		limit = { has_building = agot_ruins_raymons_hall_03 }
		remove_building = agot_ruins_raymons_hall_03
	}
	if = {
		limit = { has_building = agot_ruins_raymons_hall_04 }
		remove_building = agot_ruins_raymons_hall_04
	}
	if = {
		limit = { has_building = agot_halgars_keep_01 }
		remove_building = agot_halgars_keep_01
	}
	if = {
		limit = { has_building = agot_halgars_keep_02 }
		remove_building = agot_halgars_keep_02
	}
	if = {
		limit = { has_building = agot_ruins_halgars_keep_01 }
		remove_building = agot_ruins_halgars_keep_01
	}
	if = {
		limit = { has_building = agot_ruins_halgars_keep_02 }
		remove_building = agot_ruins_halgars_keep_02
	}
	if = {
		limit = { has_building = agot_ruins_halgars_keep_03 }
		remove_building = agot_ruins_halgars_keep_03
	}
	if = {
		limit = { has_building = agot_ruins_halgars_keep_04 }
		remove_building = agot_ruins_halgars_keep_04
	}
	if = {
		limit = { has_building = agot_drekis_tunnels_01 }
		remove_building = agot_drekis_tunnels_01
	}
	if = {
		limit = { has_building = agot_drekis_tunnels_02 }
		remove_building = agot_drekis_tunnels_02
	}
	if = {
		limit = { has_building = agot_ruins_drekis_tunnels_01 }
		remove_building = agot_ruins_drekis_tunnels_01
	}
	if = {
		limit = { has_building = agot_ruins_drekis_tunnels_02 }
		remove_building = agot_ruins_drekis_tunnels_02
	}
	if = {
		limit = { has_building = agot_ruins_drekis_tunnels_03 }
		remove_building = agot_ruins_drekis_tunnels_03
	}
	if = {
		limit = { has_building = agot_ruins_drekis_tunnels_04 }
		remove_building = agot_ruins_drekis_tunnels_04
	}
	if = {
		limit = { has_building = agot_ruins_fist_of_the_first_men_01 }
		remove_building = agot_ruins_fist_of_the_first_men_01
	}
	if = {
		limit = { has_building = agot_ruins_fist_of_the_first_men_02 }
		remove_building = agot_ruins_fist_of_the_first_men_02
	}
	if = {
		limit = { has_building = agot_ruins_fist_of_the_first_men_03 }
		remove_building = agot_ruins_fist_of_the_first_men_03
	}
	if = {
		limit = { has_building = agot_ruins_fist_of_the_first_men_04 }
		remove_building = agot_ruins_fist_of_the_first_men_04
	}
	if = {
		limit = { has_building = agot_btw_milkwater_cairns_01 }
		remove_building = agot_btw_milkwater_cairns_01
	}
	if = {
		limit = { has_building = agot_btw_frostfang_crypts_01 }
		remove_building = agot_btw_frostfang_crypts_01
	}
	if = {
		limit = { has_building = agot_haggons_tower_01 }
		remove_building = agot_haggons_tower_01
	}
	if = {
		limit = { has_building = agot_ruddy_hall_01 }
		remove_building = agot_ruddy_hall_01
	}
	if = {
		limit = { has_building = agot_the_heated_pools_01 }
		remove_building = agot_the_heated_pools_01
	}
	if = {
		limit = { has_building = agot_cold_cradle_01 }
		remove_building = agot_cold_cradle_01
	}
	if = {
		limit = { has_building = agot_others_arrival_01 }
		remove_building = agot_others_arrival_01
	}
	if = {
		limit = { has_building = agot_whitetree_01 }
		remove_building = agot_whitetree_01
	}
	if = {
		limit = { has_building = agot_selkie_sund_01 }
		remove_building = agot_selkie_sund_01
	}
	if = {
		limit = { has_building = agot_last_green_01 }
		remove_building = agot_last_green_01
	}
	if = {
		limit = { has_building = agot_charred_weald_01 }
		remove_building = agot_charred_weald_01
	}
	if = {
		limit = { has_building = agot_great_ice_dome_01 }
		remove_building = agot_great_ice_dome_01
	}
	if = {
		limit = { has_building = agot_thenn_great_kilns_01 }
		remove_building = agot_thenn_great_kilns_01
	}
	if = {
		limit = { has_building = agot_thenn_great_circle_01 }
		remove_building = agot_thenn_great_circle_01
	}
	if = {
		limit = { has_building = agot_thenn_small_circle_01 }
		remove_building = agot_thenn_small_circle_01
	}
	if = {
		limit = { has_building = agot_srunmued_copper_mines_01 }
		remove_building = agot_srunmued_copper_mines_01
	}
	if = {
		limit = { has_building = agot_srunmued_copper_mines_02 }
		remove_building = agot_srunmued_copper_mines_02
	}
	if = {
		limit = { has_building = agot_srunmued_copper_mines_03 }
		remove_building = agot_srunmued_copper_mines_03
	}
	if = {
		limit = { has_building = agot_srunmued_copper_mines_04 }
		remove_building = agot_srunmued_copper_mines_04
	}
	if = {
		limit = { has_building = agot_krih_tin_mines_01 }
		remove_building = agot_krih_tin_mines_01
	}
	if = {
		limit = { has_building = agot_krih_tin_mines_02 }
		remove_building = agot_krih_tin_mines_02
	}
	if = {
		limit = { has_building = agot_krih_tin_mines_03 }
		remove_building = agot_krih_tin_mines_03
	}
	if = {
		limit = { has_building = agot_krih_tin_mines_04 }
		remove_building = agot_krih_tin_mines_04
	}
	if = {
		limit = { has_building = agot_tree_of_crowns_01 }
		remove_building = agot_tree_of_crowns_01
	}
	if = {
		limit = { has_building = agot_triarchy_council_01 }
		remove_building = agot_triarchy_council_01
	}
	if = {
		limit = { has_building = agot_ruins_triarchy_council_01 }
		remove_building = agot_ruins_triarchy_council_01
	}
	if = {
		limit = { has_building = agot_ruins_triarchy_council_02 }
		remove_building = agot_ruins_triarchy_council_02
	}
	if = {
		limit = { has_building = agot_monument_of_borderland_01 }
		remove_building = agot_monument_of_borderland_01
	}
	if = {
		limit = { has_building = agot_miviyaan_slave_market_01 }
		remove_building = agot_miviyaan_slave_market_01
	}
	if = {
		limit = { has_building = agot_ormyan_palace_01 }
		remove_building = agot_ormyan_palace_01
	}
	if = {
		limit = { has_building = agot_racallios_fort_01 }
		remove_building = agot_racallios_fort_01
	}
	if = {
		limit = { has_building = agot_crab_fields_01 }
		remove_building = agot_crab_fields_01
	}
	if = {
		limit = { has_building = agot_temple_of_trade_01 }
		remove_building = agot_temple_of_trade_01
	}
	if = {
		limit = { has_building = agot_temple_of_yndros_01 }
		remove_building = agot_temple_of_yndros_01
	}
	if = {
		limit = { has_building = agot_red_temple_lys_01 }
		remove_building = agot_red_temple_lys_01
	}
	if = {
		limit = { has_building = agot_port_of_lys_01 }
		remove_building = agot_port_of_lys_01
	}
	if = {
		limit = { has_building = agot_prison_of_lys_01 }
		remove_building = agot_prison_of_lys_01
	}
	if = {
		limit = { has_building = agot_perfumed_garden_01 }
		remove_building = agot_perfumed_garden_01
	}
	if = {
		limit = { has_building = agot_qeldlen_fort_01 }
		remove_building = agot_qeldlen_fort_01
	}
	if = {
		limit = { has_building = agot_hartalari_makseon_01 }
		remove_building = agot_hartalari_makseon_01
	}
	if = {
		limit = { has_building = agot_bleeding_tower_01 }
		remove_building = agot_bleeding_tower_01
	}
	if = {
		limit = { has_building = agot_tyrosh_01 }
		remove_building = agot_tyrosh_01
	}
	if = {
		limit = { has_building = agot_grand_temple_of_trios_01 }
		remove_building = agot_grand_temple_of_trios_01
	}
	if = {
		limit = { has_building = agot_red_temple_tyrosh_01 }
		remove_building = agot_red_temple_tyrosh_01
	}
	if = {
		limit = { has_building = agot_great_wheel_01 }
		remove_building = agot_great_wheel_01
	}
	if = {
		limit = { has_building = agot_grand_temple_of_gelenei_01 }
		remove_building = agot_grand_temple_of_gelenei_01
	}
	if = {
		limit = { has_building = agot_red_temple_myr_01 }
		remove_building = agot_red_temple_myr_01
	}
	if = {
		limit = { has_building = agot_myr_01 }
		remove_building = agot_myr_01
	}
	if = {
		limit = { has_building = agot_statue_of_trios_01 }
		remove_building = agot_statue_of_trios_01
	}
	if = {
		limit = { has_building = agot_myr_cliffs_01 }
		remove_building = agot_myr_cliffs_01
	}
	if = {
		limit = { has_building = agot_taelas_gap_01 }
		remove_building = agot_taelas_gap_01
	}
	if = {
		limit = { has_building = agot_naeros_irrigation_01 }
		remove_building = agot_naeros_irrigation_01
	}
	if = {
		limit = { has_building = agot_pentos_01 }
		remove_building = agot_pentos_01
	}
	if = {
		limit = { has_building = agot_red_temple_pentos_01 }
		remove_building = agot_red_temple_pentos_01
	}
	if = {
		limit = { has_building = agot_magister_harbor_01 }
		remove_building = agot_magister_harbor_01
	}
	if = {
		limit = { has_building = agot_pentos_harbor_01 }
		remove_building = agot_pentos_harbor_01
	}
	if = {
		limit = { has_building = agot_khals_manse_01 }
		remove_building = agot_khals_manse_01
	}
	if = {
		limit = { has_building = agot_valdrizes_01 }
		remove_building = agot_valdrizes_01
	}
	if = {
		limit = { has_building = agot_nontelos_bazaar_01 }
		remove_building = agot_nontelos_bazaar_01
	}
	if = {
		limit = { has_building = agot_ar_kon_barracks_01 }
		remove_building = agot_ar_kon_barracks_01
	}
	if = {
		limit = { has_building = agot_hugor_hill_01 }
		remove_building = agot_hugor_hill_01
	}
	if = {
		limit = { has_building = agot_godworf_01 }
		remove_building = agot_godworf_01
	}
	if = {
		limit = { has_building = agot_warriors_ledge_01 }
		remove_building = agot_warriors_ledge_01
	}
	if = {
		limit = { has_building = agot_strangers_heights_01 }
		remove_building = agot_strangers_heights_01
	}
	if = {
		limit = { has_building = agot_crones_steps_01 }
		remove_building = agot_crones_steps_01
	}
	if = {
		limit = { has_building = agot_maidens_vale_01 }
		remove_building = agot_maidens_vale_01
	}
	if = {
		limit = { has_building = agot_sealords_palace_01 }
		remove_building = agot_sealords_palace_01
	}
	if = {
		limit = { has_building = agot_iron_bank_01 }
		remove_building = agot_iron_bank_01
	}
	if = {
		limit = { has_building = agot_isle_of_the_gods_01 }
		remove_building = agot_isle_of_the_gods_01
	}
	if = {
		limit = { has_building = agot_arsenal_01 }
		remove_building = agot_arsenal_01
	}
	if = {
		limit = { has_building = agot_titan_01 }
		remove_building = agot_titan_01
	}
	if = {
		limit = { has_building = agot_palace_of_truth_01 }
		remove_building = agot_palace_of_truth_01
	}
	if = {
		limit = { has_building = agot_drowned_town_01 }
		remove_building = agot_drowned_town_01
	}
	if = {
		limit = { has_building = agot_sweetwater_font_01 }
		remove_building = agot_sweetwater_font_01
	}
	if = {
		limit = { has_building = agot_mothermont_01 }
		remove_building = agot_mothermont_01
	}
	if = {
		limit = { has_building = agot_nevios_retreat_01 }
		remove_building = agot_nevios_retreat_01
	}
	if = {
		limit = { has_building = agot_castle_black_01 }
		remove_building = agot_castle_black_01
	}
	if = {
		limit = { has_building = agot_eastwatch_01 }
		remove_building = agot_eastwatch_01
	}
	if = {
		limit = { has_building = agot_shadow_tower_01 }
		remove_building = agot_shadow_tower_01
	}
	if = {
		limit = { has_building = agot_nightfort_01 }
		remove_building = agot_nightfort_01
	}
	if = {
		limit = { has_building = agot_bridge_of_skulls_01 }
		remove_building = agot_bridge_of_skulls_01
	}
	if = {
		limit = { has_building = agot_tower_of_joy_01 }
		remove_building = agot_tower_of_joy_01
	}
	if = {
		limit = { has_building = agot_ruin_tower_of_joy_01 }
		remove_building = agot_ruin_tower_of_joy_01
	}
	if = {
		limit = { has_building = agot_the_water_gardens_01 }
		remove_building = agot_the_water_gardens_01
	}
	if = {
		limit = { has_building = agot_ghaston_grey_01 }
		remove_building = agot_ghaston_grey_01
	}
	if = {
		limit = { has_building = agot_the_shadow_city_01 }
		remove_building = agot_the_shadow_city_01
	}
	if = {
		limit = { has_building = agot_starfall_01 }
		remove_building = agot_starfall_01
	}
	if = {
		limit = { has_building = agot_vultures_roost_01 }
		remove_building = agot_vultures_roost_01
	}
	if = {
		limit = { has_building = agot_skyreach_01 }
		remove_building = agot_skyreach_01
	}
	if = {
		limit = { has_building = agot_hellgate_hall_01 }
		remove_building = agot_hellgate_hall_01
	}
	if = {
		limit = { has_building = agot_ruins_hellgate_hall_01 }
		remove_building = agot_ruins_hellgate_hall_01
	}
	if = {
		limit = { has_building = agot_ruins_hellgate_hall_02 }
		remove_building = agot_ruins_hellgate_hall_02
	}
	if = {
		limit = { has_building = agot_godsgrace_01 }
		remove_building = agot_godsgrace_01
	}
	if = {
		limit = { has_building = agot_nymeros_tower_01 }
		remove_building = agot_nymeros_tower_01
	}
	if = {
		limit = { has_building = agot_plankytown_01 }
		remove_building = agot_plankytown_01
	}
	if = {
		limit = { has_building = agot_hellholt_01 }
		remove_building = agot_hellholt_01
	}
	if = {
		limit = { has_building = agot_broken_tower_01 }
		remove_building = agot_broken_tower_01
	}
	if = {
		limit = { has_building = agot_merling_port_01 }
		remove_building = agot_merling_port_01
	}
	if = {
		limit = { has_building = agot_pit_of_snakes_01 }
		remove_building = agot_pit_of_snakes_01
	}
	if = {
		limit = { has_building = agot_pit_of_snakes_02 }
		remove_building = agot_pit_of_snakes_02
	}
	if = {
		limit = { has_building = agot_sandstone_01 }
		remove_building = agot_sandstone_01
	}
	if = {
		limit = { has_building = agot_yronwood_01 }
		remove_building = agot_yronwood_01
	}
	if = {
		limit = { has_building = agot_raventree_hall_01 }
		remove_building = agot_raventree_hall_01
	}
	if = {
		limit = { has_building = agot_inn_at_the_crossroads_01 }
		remove_building = agot_inn_at_the_crossroads_01
	}
	if = {
		limit = { has_building = agot_high_heart_01 }
		remove_building = agot_high_heart_01
	}
	if = {
		limit = { has_building = agot_ruin_high_heart_01 }
		remove_building = agot_ruin_high_heart_01
	}
	if = {
		limit = { has_building = agot_ruin_high_heart_02 }
		remove_building = agot_ruin_high_heart_02
	}
	if = {
		limit = { has_building = agot_seagard_01 }
		remove_building = agot_seagard_01
	}
	if = {
		limit = { has_building = agot_walls_of_seagard_01 }
		remove_building = agot_walls_of_seagard_01
	}
	if = {
		limit = { has_building = agot_maidenpool_01 }
		remove_building = agot_maidenpool_01
	}
	if = {
		limit = { has_building = agot_oldstones_01 }
		remove_building = agot_oldstones_01
	}
	if = {
		limit = { has_building = agot_oldstones_02 }
		remove_building = agot_oldstones_02
	}
	if = {
		limit = { has_building = agot_inn_of_the_kneeling_man_01 }
		remove_building = agot_inn_of_the_kneeling_man_01
	}
	if = {
		limit = { has_building = agot_stoney_sept_01 }
		remove_building = agot_stoney_sept_01
	}
	if = {
		limit = { has_building = agot_wayfarers_rest_01 }
		remove_building = agot_wayfarers_rest_01
	}
	if = {
		limit = { has_building = agot_fairmarket_01 }
		remove_building = agot_fairmarket_01
	}
	if = {
		limit = { has_building = agot_fairmarket_02 }
		remove_building = agot_fairmarket_02
	}
	if = {
		limit = { has_building = agot_mudgrave_01 }
		remove_building = agot_mudgrave_01
	}
	if = {
		limit = { has_building = agot_atranta_01 }
		remove_building = agot_atranta_01
	}
	if = {
		limit = { has_building = agot_ruins_of_oldforge_01 }
		remove_building = agot_ruins_of_oldforge_01
	}
	if = {
		limit = { has_building = agot_ruins_of_oldforge_02 }
		remove_building = agot_ruins_of_oldforge_02
	}
	if = {
		limit = { has_building = agot_ruins_of_oldforge_03 }
		remove_building = agot_ruins_of_oldforge_03
	}
	if = {
		limit = { has_building = agot_bechester_motherhouse_01 }
		remove_building = agot_bechester_motherhouse_01
	}
	if = {
		limit = { has_building = agot_bechester_motherhouse_ruins_01 }
		remove_building = agot_bechester_motherhouse_ruins_01
	}
	if = {
		limit = { has_building = agot_bechester_motherhouse_ruins_02 }
		remove_building = agot_bechester_motherhouse_ruins_02
	}
	if = {
		limit = { has_building = agot_stone_hedge_01 }
		remove_building = agot_stone_hedge_01
	}
	if = {
		limit = { has_building = agot_pennytree_01 }
		remove_building = agot_pennytree_01
	}
	if = {
		limit = { has_building = agot_banefort_01 }
		remove_building = agot_banefort_01
	}
	if = {
		limit = { has_building = agot_castamere_01 }
		remove_building = agot_castamere_01
	}
	if = {
		limit = { has_building = agot_castamere_ruins_01 }
		remove_building = agot_castamere_ruins_01
	}
	if = {
		limit = { has_building = agot_castamere_ruins_02 }
		remove_building = agot_castamere_ruins_02
	}
	if = {
		limit = { has_building = agot_lann_sept_01 }
		remove_building = agot_lann_sept_01
	}
	if = {
		limit = { has_building = agot_lions_dock_01 }
		remove_building = agot_lions_dock_01
	}
	if = {
		limit = { has_building = agot_crakehall_01 }
		remove_building = agot_crakehall_01
	}
	if = {
		limit = { has_building = agot_midges_inn_01 }
		remove_building = agot_midges_inn_01
	}
	if = {
		limit = { has_building = agot_deep_den_01 }
		remove_building = agot_deep_den_01
	}
	if = {
		limit = { has_building = agot_cornfield_01 }
		remove_building = agot_cornfield_01
	}
	if = {
		limit = { has_building = agot_fair_isle_01 }
		remove_building = agot_fair_isle_01
	}
	if = {
		limit = { has_building = agot_feastfires_01 }
		remove_building = agot_feastfires_01
	}
	if = {
		limit = { has_building = agot_golden_tooth_01 }
		remove_building = agot_golden_tooth_01
	}
	if = {
		limit = { has_building = agot_ashemark_01 }
		remove_building = agot_ashemark_01
	}
	if = {
		limit = { has_building = agot_silverhill_01 }
		remove_building = agot_silverhill_01
	}
	if = {
		limit = { has_building = agot_griffins_roost_01 }
		remove_building = agot_griffins_roost_01
	}
	if = {
		limit = { has_building = agot_blackhaven_01 }
		remove_building = agot_blackhaven_01
	}
	if = {
		limit = { has_building = agot_stonehelm_01 }
		remove_building = agot_stonehelm_01
	}
	if = {
		limit = { has_building = agot_nightsong_01 }
		remove_building = agot_nightsong_01
	}
	if = {
		limit = { has_building = agot_morne_01 }
		remove_building = agot_morne_01
	}
	if = {
		limit = { has_building = agot_morne_02 }
		remove_building = agot_morne_02
	}
	if = {
		limit = { has_building = agot_morne_03 }
		remove_building = agot_morne_03
	}
	if = {
		limit = { has_building = agot_evenfall_hall_01 }
		remove_building = agot_evenfall_hall_01
	}
	if = {
		limit = { has_building = agot_summerhall_01 }
		remove_building = agot_summerhall_01
	}
	if = {
		limit = { has_building = agot_summerhall_ruins_01 }
		remove_building = agot_summerhall_ruins_01
	}
	if = {
		limit = { has_building = agot_summerhall_ruins_02 }
		remove_building = agot_summerhall_ruins_02
	}
	if = {
		limit = { has_building = agot_paintwood_01 }
		remove_building = agot_paintwood_01
	}
	if = {
		limit = { has_building = agot_bronzegate_01 }
		remove_building = agot_bronzegate_01
	}
	if = {
		limit = { has_building = agot_weeping_tower_01 }
		remove_building = agot_weeping_tower_01
	}
	if = {
		limit = { has_building = agot_weeping_tower_02 }
		remove_building = agot_weeping_tower_02
	}
	if = {
		limit = { has_building = agot_kingswood_brotherhood_01 }
		remove_building = agot_kingswood_brotherhood_01
	}
	if = {
		limit = { has_building = agot_ruins_kingswood_brotherhood_01 }
		remove_building = agot_ruins_kingswood_brotherhood_01
	}
	if = {
		limit = { has_building = agot_ruins_kingswood_brotherhood_02 }
		remove_building = agot_ruins_kingswood_brotherhood_02
	}
	if = {
		limit = { has_building = agot_haywater_docks_01 }
		remove_building = agot_haywater_docks_01
	}
	if = {
		limit = { has_building = agot_broken_shield_inn_01 }
		remove_building = agot_broken_shield_inn_01
	}
	if = {
		limit = { has_building = agot_barrow_keep_01 }
		remove_building = agot_barrow_keep_01
	}
	if = {
		limit = { has_building = agot_white_harbor_01 }
		remove_building = agot_white_harbor_01
	}
	if = {
		limit = { has_building = agot_sept_of_the_snows_01 }
		remove_building = agot_sept_of_the_snows_01
	}
	if = {
		limit = { has_building = agot_wolfs_den_01 }
		remove_building = agot_wolfs_den_01
	}
	if = {
		limit = { has_building = agot_wolfs_den_02 }
		remove_building = agot_wolfs_den_02
	}
	if = {
		limit = { has_building = agot_wolfs_den_03 }
		remove_building = agot_wolfs_den_03
	}
	if = {
		limit = { has_building = agot_new_castle_01 }
		remove_building = agot_new_castle_01
	}
	if = {
		limit = { has_building = agot_dreadfort_01 }
		remove_building = agot_dreadfort_01
	}
	if = {
		limit = { has_building = agot_karhold_01 }
		remove_building = agot_karhold_01
	}
	if = {
		limit = { has_building = agot_warg_king_01 }
		remove_building = agot_warg_king_01
	}
	if = {
		limit = { has_building = agot_warg_king_02 }
		remove_building = agot_warg_king_02
	}
	if = {
		limit = { has_building = agot_greywater_watch_01 }
		remove_building = agot_greywater_watch_01
	}
	if = {
		limit = { has_building = agot_rills_stables_01 }
		remove_building = agot_rills_stables_01
	}
	if = {
		limit = { has_building = agot_widows_watch_01 }
		remove_building = agot_widows_watch_01
	}
	if = {
		limit = { has_building = agot_widows_watch_02 }
		remove_building = agot_widows_watch_02
	}
	if = {
		limit = { has_building = agot_widows_watch_03 }
		remove_building = agot_widows_watch_03
	}
	if = {
		limit = { has_building = agot_flints_cliffs_01 }
		remove_building = agot_flints_cliffs_01
	}
	if = {
		limit = { has_building = agot_grey_cliffs_01 }
		remove_building = agot_grey_cliffs_01
	}
	if = {
		limit = { has_building = agot_unicorn_glen_01 }
		remove_building = agot_unicorn_glen_01
	}
	if = {
		limit = { has_building = agot_rodriks_gift_01 }
		remove_building = agot_rodriks_gift_01
	}
	if = {
		limit = { has_building = agot_ravos_base_01 }
		remove_building = agot_ravos_base_01
	}
	if = {
		limit = { has_building = agot_last_hearth_01 }
		remove_building = agot_last_hearth_01
	}
	if = {
		limit = { has_building = agot_ironrath_01 }
		remove_building = agot_ironrath_01
	}
	if = {
		limit = { has_building = agot_highpoint_01 }
		remove_building = agot_highpoint_01
	}
	if = {
		limit = { has_building = agot_blackpool_01 }
		remove_building = agot_blackpool_01
	}
	if = {
		limit = { has_building = agot_torrhens_square_01 }
		remove_building = agot_torrhens_square_01
	}
	if = {
		limit = { has_building = agot_deepwood_motte_01 }
		remove_building = agot_deepwood_motte_01
	}
	if = {
		limit = { has_building = agot_hornwood_01 }
		remove_building = agot_hornwood_01
	}
	if = {
		limit = { has_building = agot_ramsgate_01 }
		remove_building = agot_ramsgate_01
	}
	if = {
		limit = { has_building = agot_oldcastle_01 }
		remove_building = agot_oldcastle_01
	}
	if = {
		limit = { has_building = agot_port_of_oldtown_01 }
		remove_building = agot_port_of_oldtown_01
	}
	if = {
		limit = { has_building = agot_chequered_square_01 }
		remove_building = agot_chequered_square_01
	}
	if = {
		limit = { has_building = agot_seven_shrines_01 }
		remove_building = agot_seven_shrines_01
	}
	if = {
		limit = { has_building = agot_goldengrove_01 }
		remove_building = agot_goldengrove_01
	}
	if = {
		limit = { has_building = agot_bitterbridge_01 }
		remove_building = agot_bitterbridge_01
	}
	if = {
		limit = { has_building = agot_bitterbridge_02 }
		remove_building = agot_bitterbridge_02
	}
	if = {
		limit = { has_building = agot_red_lake_01 }
		remove_building = agot_red_lake_01
	}
	if = {
		limit = { has_building = agot_red_lake_02 }
		remove_building = agot_red_lake_02
	}
	if = {
		limit = { has_building = agot_tumbleton_01 }
		remove_building = agot_tumbleton_01
	}
	if = {
		limit = { has_building = agot_cider_hall_01 }
		remove_building = agot_cider_hall_01
	}
	if = {
		limit = { has_building = agot_starpike_01 }
		remove_building = agot_starpike_01
	}
	if = {
		limit = { has_building = agot_redwyne_port_01 }
		remove_building = agot_redwyne_port_01
	}
	if = {
		limit = { has_building = agot_witchs_wood_01 }
		remove_building = agot_witchs_wood_01
	}
	if = {
		limit = { has_building = agot_ashford_tourney_grounds_01 }
		remove_building = agot_ashford_tourney_grounds_01
	}
	if = {
		limit = { has_building = agot_brightwater_moat_01 }
		remove_building = agot_brightwater_moat_01
	}
	if = {
		limit = { has_building = agot_mermaids_palace_01 }
		remove_building = agot_mermaids_palace_01
	}
	if = {
		limit = { has_building = agot_merryweather_vaults_01 }
		remove_building = agot_merryweather_vaults_01
	}
	if = {
		limit = { has_building = agot_grassfield_florestries_01 }
		remove_building = agot_grassfield_florestries_01
	}
	if = {
		limit = { has_building = agot_honeyholt_apiaries_01 }
		remove_building = agot_honeyholt_apiaries_01
	}
	if = {
		limit = { has_building = agot_sept_at_holyhall_01 }
		remove_building = agot_sept_at_holyhall_01
	}
	if = {
		limit = { has_building = agot_oakenshield_bastion_01 }
		remove_building = agot_oakenshield_bastion_01
	}
	if = {
		limit = { has_building = agot_old_oak_01 }
		remove_building = agot_old_oak_01
	}
	if = {
		limit = { has_building = agot_the_ring_01 }
		remove_building = agot_the_ring_01
	}
	if = {
		limit = { has_building = agot_dunnsbridge_01 }
		remove_building = agot_dunnsbridge_01
	}
	if = {
		limit = { has_building = agot_cuy_01 }
		remove_building = agot_cuy_01
	}
	if = {
		limit = { has_building = agot_three_towers_01 }
		remove_building = agot_three_towers_01
	}
	if = {
		limit = { has_building = agot_blackcrown_01 }
		remove_building = agot_blackcrown_01
	}
	if = {
		limit = { has_building = agot_dunstonbury_01 }
		remove_building = agot_dunstonbury_01
	}
	if = {
		limit = { has_building = agot_grafton_keep_01 }
		remove_building = agot_grafton_keep_01
	}
	if = {
		limit = { has_building = agot_gull_harbor_01 }
		remove_building = agot_gull_harbor_01
	}
	if = {
		limit = { has_building = agot_maris_motherhouse_01 }
		remove_building = agot_maris_motherhouse_01
	}
	if = {
		limit = { has_building = agot_gold_feather_house_01 }
		remove_building = agot_gold_feather_house_01
	}
	if = {
		limit = { has_building = agot_osgood_square_01 }
		remove_building = agot_osgood_square_01
	}
	if = {
		limit = { has_building = agot_runestone_01 }
		remove_building = agot_runestone_01
	}
	if = {
		limit = { has_building = agot_gates_of_the_moon_01 }
		remove_building = agot_gates_of_the_moon_01
	}
	if = {
		limit = { has_building = agot_gates_of_the_moon_02 }
		remove_building = agot_gates_of_the_moon_02
	}
	if = {
		limit = { has_building = agot_sisterton_01 }
		remove_building = agot_sisterton_01
	}
	if = {
		limit = { has_building = agot_redfort_01 }
		remove_building = agot_redfort_01
	}
	if = {
		limit = { has_building = agot_waxley_candlery_01 }
		remove_building = agot_waxley_candlery_01
	}
	if = {
		limit = { has_building = agot_ironoaks_01 }
		remove_building = agot_ironoaks_01
	}
	if = {
		limit = { has_building = agot_strongsong_01 }
		remove_building = agot_strongsong_01
	}
	if = {
		limit = { has_building = agot_ruthermont_01 }
		remove_building = agot_ruthermont_01
	}
	if = {
		limit = { has_building = agot_upcliffs_haven_01 }
		remove_building = agot_upcliffs_haven_01
	}
	if = {
		limit = { has_building = agot_upcliffs_haven_02 }
		remove_building = agot_upcliffs_haven_02
	}
	if = {
		limit = { has_building = agot_sunrise_keep_01 }
		remove_building = agot_sunrise_keep_01
	}
	if = {
		limit = { has_building = agot_olafs_tomato_farm_01 }
		remove_building = agot_olafs_tomato_farm_01
	}
	if = {
		limit = { has_building = agot_ten_towers_01 }
		remove_building = agot_ten_towers_01
	}
	if = {
		limit = { has_building = agot_hoare_castle_01 }
		remove_building = agot_hoare_castle_01
	}
	if = {
		limit = { has_building = agot_hoare_castle_02 }
		remove_building = agot_hoare_castle_02
	}
	if = {
		limit = { has_building = agot_lonely_light_01 }
		remove_building = agot_lonely_light_01
	}
	if = {
		limit = { has_building = agot_hammerhorn_01 }
		remove_building = agot_hammerhorn_01
	}
	if = {
		limit = { has_building = agot_lordsport_01 }
		remove_building = agot_lordsport_01
	}
	if = {
		limit = { has_building = agot_grey_garden_01 }
		remove_building = agot_grey_garden_01
	}
	if = {
		limit = { has_building = agot_volmark_01 }
		remove_building = agot_volmark_01
	}
	if = {
		limit = { has_building = agot_flea_bottom_01 }
		remove_building = agot_flea_bottom_01
	}
	if = {
		limit = { has_building = agot_spicetown_01 }
		remove_building = agot_spicetown_01
	}
	if = {
		limit = { has_building = agot_ruins_spicetown_01 }
		remove_building = agot_ruins_spicetown_01
	}
	if = {
		limit = { has_building = agot_ruins_spicetown_02 }
		remove_building = agot_ruins_spicetown_02
	}
	if = {
		limit = { has_building = agot_claw_isle_01 }
		remove_building = agot_claw_isle_01
	}
	if = {
		limit = { has_building = agot_whispers_01 }
		remove_building = agot_whispers_01
	}
	if = {
		limit = { has_building = agot_whispers_02 }
		remove_building = agot_whispers_02
	}
	if = {
		limit = { has_building = agot_stonedance_01 }
		remove_building = agot_stonedance_01
	}
	if = {
		limit = { has_building = agot_duskendale_01 }
		remove_building = agot_duskendale_01
	}
	if = {
		limit = { has_building = agot_hightide_01 }
		remove_building = agot_hightide_01
	}
	if = {
		limit = { has_building = agot_ruins_hightide_01 }
		remove_building = agot_ruins_hightide_01
	}
	if = {
		limit = { has_building = agot_ruins_hightide_02 }
		remove_building = agot_ruins_hightide_02
	}
	if = {
		limit = { has_building = agot_driftmark_01 }
		remove_building = agot_driftmark_01
	}
	if = {
		limit = { has_building = agot_rooks_rest_01 }
		remove_building = agot_rooks_rest_01
	}
	if = {
		limit = { has_building = agot_sharp_point_beacon_01 }
		remove_building = agot_sharp_point_beacon_01
	}
	if = {
		limit = { has_building = agot_old_stone_bridge_01 }
		remove_building = agot_old_stone_bridge_01
	}
	if = {
		limit = { has_building = legendary_shrine }
		remove_building = legendary_shrine
	}
	if = {
		limit = { has_building = legendary_palace }
		remove_building = legendary_palace
	}
	if = {
		limit = { has_building = legendary_statue }
		remove_building = legendary_statue
	}
	if = {
		limit = { has_building = legendary_watchtower }
		remove_building = legendary_watchtower
	}
	if = {
		limit = { has_building = legendary_hunting_lodge }
		remove_building = legendary_hunting_lodge
	}
	if = {
		limit = { has_building = holy_site_cathedral_01 }
		remove_building = holy_site_cathedral_01
	}
	if = {
		limit = { has_building = holy_site_mosque_01 }
		remove_building = holy_site_mosque_01
	}
	if = {
		limit = { has_building = holy_site_fire_temple_01 }
		remove_building = holy_site_fire_temple_01
	}
	if = {
		limit = { has_building = holy_site_pagan_grand_temple_01 }
		remove_building = holy_site_pagan_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_indian_grand_temple_01 }
		remove_building = holy_site_indian_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_buddhist_grand_temple_01 }
		remove_building = holy_site_buddhist_grand_temple_01
	}
	if = {
		limit = { has_building = holy_site_japanese_temple_01 }
		remove_building = holy_site_japanese_temple_01
	}
	if = {
		limit = { has_building = holy_site_chinese_temple_01 }
		remove_building = holy_site_chinese_temple_01
	}
	if = {
		limit = { has_building = holy_site_se_asia_pagan_temple_01 }
		remove_building = holy_site_se_asia_pagan_temple_01
	}
	if = {
		limit = { has_building = holy_site_other_grand_temple_01 }
		remove_building = holy_site_other_grand_temple_01
	}
	if = {
		limit = { has_building = event_tower_of_silence_01 }
		remove_building = event_tower_of_silence_01
	}
	if = {
		limit = { has_building = fairy_chimneys }
		remove_building = fairy_chimneys
	}
	if = {
		limit = { has_building = pleasure_dome }
		remove_building = pleasure_dome
	}
	if = {
		limit = { has_building = generic_copper_mines_01 }
		remove_building = generic_copper_mines_01
	}
	if = {
		limit = { has_building = generic_copper_mines_02 }
		remove_building = generic_copper_mines_02
	}
	if = {
		limit = { has_building = generic_copper_mines_03 }
		remove_building = generic_copper_mines_03
	}
	if = {
		limit = { has_building = generic_copper_mines_04 }
		remove_building = generic_copper_mines_04
	}
	if = {
		limit = { has_building = generic_silver_mines_01 }
		remove_building = generic_silver_mines_01
	}
	if = {
		limit = { has_building = generic_silver_mines_02 }
		remove_building = generic_silver_mines_02
	}
	if = {
		limit = { has_building = generic_silver_mines_03 }
		remove_building = generic_silver_mines_03
	}
	if = {
		limit = { has_building = generic_silver_mines_04 }
		remove_building = generic_silver_mines_04
	}
	if = {
		limit = { has_building = generic_gold_mines_01 }
		remove_building = generic_gold_mines_01
	}
	if = {
		limit = { has_building = generic_gold_mines_02 }
		remove_building = generic_gold_mines_02
	}
	if = {
		limit = { has_building = generic_gold_mines_03 }
		remove_building = generic_gold_mines_03
	}
	if = {
		limit = { has_building = generic_gold_mines_04 }
		remove_building = generic_gold_mines_04
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_apply_landmark_bonus_effect = {
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 1 } }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_landmark_bonus_mine years = 100 } }
			}
			else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 2 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_exchange years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 3 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_agriculture years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 4 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_university years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 5 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_monastic years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 6 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_observatory years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 7 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_embassy years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 8 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_assembly years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 9 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_garden years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 10 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_veiled years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 11 } }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_landmark_bonus_dreadfort years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 12 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_blood_sanctuary years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 13 } }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_landmark_bonus_great_wall years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 14 } }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_landmark_bonus_war_district years = 100 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 15 } }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_landmark_bonus_bastion years = 100 } }
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_remove_landmark_site_modifiers_effect = {
	scope:dlm_target_county = {
		if = { limit = { has_county_modifier = dlm_quality_great } remove_county_modifier = dlm_quality_great }
		if = { limit = { has_county_modifier = dlm_quality_mighty } remove_county_modifier = dlm_quality_mighty }
		if = { limit = { has_county_modifier = dlm_quality_grand } remove_county_modifier = dlm_quality_grand }
	}
	if = {
		limit = {
			OR = {
				scope:dlm_target_county.title_province = { var:dlm_group = 1 }
				scope:dlm_target_county.title_province = { var:dlm_type = 2 }
				scope:dlm_target_county.title_province = { var:dlm_type = 3 }
			}
		}
		scope:dlm_target_county.title_province = {
			if = { limit = { has_province_modifier = dlm_pmod_stew_income_small } remove_province_modifier = dlm_pmod_stew_income_small }
			if = { limit = { has_province_modifier = dlm_pmod_stew_income_medium } remove_province_modifier = dlm_pmod_stew_income_medium }
			if = { limit = { has_province_modifier = dlm_pmod_stew_tax_small } remove_province_modifier = dlm_pmod_stew_tax_small }
			if = { limit = { has_province_modifier = dlm_pmod_stew_tax_medium } remove_province_modifier = dlm_pmod_stew_tax_medium }
			if = { limit = { has_province_modifier = dlm_pmod_stew_dev_growth } remove_province_modifier = dlm_pmod_stew_dev_growth }
			if = { limit = { has_province_modifier = dlm_pmod_stew_levy_reinf } remove_province_modifier = dlm_pmod_stew_levy_reinf }
			if = { limit = { has_province_modifier = dlm_pmod_stew_build_cost } remove_province_modifier = dlm_pmod_stew_build_cost }
			if = { limit = { has_province_modifier = dlm_pmod_stew_build_speed } remove_province_modifier = dlm_pmod_stew_build_speed }
		}
	}
	if = {
		limit = {
			OR = {
				scope:dlm_target_county.title_province = { var:dlm_group = 2 }
				scope:dlm_target_county.title_province = { var:dlm_type = 12 }
			}
		}
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_pmod_learn_build_speed } remove_county_modifier = dlm_pmod_learn_build_speed }
			if = { limit = { has_county_modifier = dlm_pmod_learn_dev_growth } remove_county_modifier = dlm_pmod_learn_dev_growth }
			if = { limit = { has_county_modifier = dlm_cmod_learn_control } remove_county_modifier = dlm_cmod_learn_control }
			if = { limit = { has_county_modifier = dlm_cmod_learn_opinion } remove_county_modifier = dlm_cmod_learn_opinion }
			title_province = {
				if = { limit = { has_province_modifier = dlm_pmod_learn_dev_growth } remove_province_modifier = dlm_pmod_learn_dev_growth }
				if = { limit = { has_province_modifier = dlm_pmod_learn_insight } remove_province_modifier = dlm_pmod_learn_insight }
			}
		}
	}
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 3 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_pmod_diplo_county_opinion } remove_county_modifier = dlm_pmod_diplo_county_opinion }
			if = { limit = { has_county_modifier = dlm_cmod_diplo_control } remove_county_modifier = dlm_cmod_diplo_control }
			if = { limit = { has_county_modifier = dlm_cmod_diplo_opinion } remove_county_modifier = dlm_cmod_diplo_opinion }
			title_province = {
				if = { limit = { has_province_modifier = dlm_pmod_diplo_dev_growth } remove_province_modifier = dlm_pmod_diplo_dev_growth }
			}
		}
	}
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 4 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_cmod_intrigue_control } remove_county_modifier = dlm_cmod_intrigue_control }
			title_province = {
				if = { limit = { has_province_modifier = dlm_pmod_intrigue_fort } remove_province_modifier = dlm_pmod_intrigue_fort }
			}
		}
	}
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 5 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_cmod_martial_control } remove_county_modifier = dlm_cmod_martial_control }
			title_province = {
				if = { limit = { has_province_modifier = dlm_pmod_martial_maa_damage } remove_province_modifier = dlm_pmod_martial_maa_damage }
				if = { limit = { has_province_modifier = dlm_pmod_martial_maa_toughness } remove_province_modifier = dlm_pmod_martial_maa_toughness }
				if = { limit = { has_province_modifier = dlm_pmod_martial_fort } remove_province_modifier = dlm_pmod_martial_fort }
				if = { limit = { has_province_modifier = dlm_pmod_martial_garrison } remove_province_modifier = dlm_pmod_martial_garrison }
				if = { limit = { has_province_modifier = dlm_pmod_martial_advantage } remove_province_modifier = dlm_pmod_martial_advantage }
				if = { limit = { has_province_modifier = dlm_pmod_martial_siege } remove_province_modifier = dlm_pmod_martial_siege }
				if = { limit = { has_province_modifier = dlm_pmod_martial_levy_reinf } remove_province_modifier = dlm_pmod_martial_levy_reinf }
				if = { limit = { has_province_modifier = dlm_pmod_martial_pursuit } remove_province_modifier = dlm_pmod_martial_pursuit }
				if = { limit = { has_province_modifier = dlm_pmod_martial_maa_damage_small } remove_province_modifier = dlm_pmod_martial_maa_damage_small }
			}
		}
	}
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 1 } }
		scope:dlm_target_county.title_province = {
			if = { limit = { has_province_modifier = dlm_landmark_bonus_mine } remove_province_modifier = dlm_landmark_bonus_mine }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 2 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_exchange } remove_county_modifier = dlm_landmark_bonus_exchange }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 3 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_agriculture } remove_county_modifier = dlm_landmark_bonus_agriculture }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 4 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_university } remove_county_modifier = dlm_landmark_bonus_university }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 5 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_monastic } remove_county_modifier = dlm_landmark_bonus_monastic }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 6 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_observatory } remove_county_modifier = dlm_landmark_bonus_observatory }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 7 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_embassy } remove_county_modifier = dlm_landmark_bonus_embassy }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 8 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_assembly } remove_county_modifier = dlm_landmark_bonus_assembly }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 9 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_garden } remove_county_modifier = dlm_landmark_bonus_garden }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 10 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_veiled } remove_county_modifier = dlm_landmark_bonus_veiled }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 11 } }
		scope:dlm_target_county.title_province = {
			if = { limit = { has_province_modifier = dlm_landmark_bonus_dreadfort } remove_province_modifier = dlm_landmark_bonus_dreadfort }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 12 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_blood_sanctuary } remove_county_modifier = dlm_landmark_bonus_blood_sanctuary }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 13 } }
		scope:dlm_target_county.title_province = {
			if = { limit = { has_province_modifier = dlm_landmark_bonus_great_wall } remove_province_modifier = dlm_landmark_bonus_great_wall }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 14 } }
		scope:dlm_target_county.title_province = {
			if = { limit = { has_province_modifier = dlm_landmark_bonus_war_district } remove_province_modifier = dlm_landmark_bonus_war_district }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 15 } }
		scope:dlm_target_county = {
			if = { limit = { has_county_modifier = dlm_landmark_bonus_bastion } remove_county_modifier = dlm_landmark_bonus_bastion }
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_commit_landmark_commission_effect = {
	dlm_pay_landmark_commission_effect = yes
	dlm_finalize_landmark_commission_effect = yes
}

# Root: character
dlm_pay_landmark_commission_effect = {
	remove_short_term_gold = dlm_commission_base_gold_cost
	add_prestige = {
		value = dlm_commission_base_prestige_cost
		multiply = -1
	}
	set_variable = { name = dlm_commission_ducal_landmark_lifetime value = yes }
	add_character_modifier = {
		modifier = dlm_recent_landmark_commission_cooldown
		years = 50
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_finalize_landmark_commission_effect = {
	if = {
		limit = { NOT = { exists = scope:dlm_active_landmark_project } }
		dlm_begin_landmark_construction_effect = yes
	}
}

# Root: character
dlm_abort_pending_landmark_project_effect = {
	if = {
		limit = { exists = scope:dlm_active_landmark_project }
		scope:dlm_active_landmark_project = {
			cancel_great_project = this
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_begin_landmark_construction_effect = {
	set_variable = { name = dlm_can_plan_landmark_project value = yes }
	scope:dlm_target_county.title_province = {
		remove_variable = dlm_quality_contribution_bonus
		plan_great_project = {
			great_project_type = dlm_landmark_construction
			founder = root
			save_scope_as = dlm_landmark_project
		}
	}
	remove_variable = dlm_can_plan_landmark_project
}

# Root: character (requires `scope:dlm_target_county`)
dlm_save_active_landmark_project_effect = {
	random_great_project = {
		limit = {
			great_project_owner = root
			great_project_type = dlm_landmark_construction
		}
		save_scope_as = dlm_active_landmark_project
	}
}

# Root: character (requires `scope:dlm_active_landmark_project`)
dlm_fund_minor_landmark_investment_effect = {
	scope:dlm_active_landmark_project = {
		every_contribution = {
			limit = {
				contribution_id = minor_patron_investment
				contribution_is_funded = no
			}
			save_scope_as = dlm_selected_landmark_contribution
		}
	}
	if = {
		limit = { exists = scope:dlm_selected_landmark_contribution }
		fund_great_project_contribution = {
			contribution = scope:dlm_selected_landmark_contribution
			cost = no
			check_can_contribute = no
		}
	}
}

# Root: character (requires `scope:dlm_active_landmark_project`)
dlm_fund_major_landmark_investment_effect = {
	scope:dlm_active_landmark_project = {
		every_contribution = {
			limit = {
				contribution_id = major_patron_investment
				contribution_is_funded = no
			}
			save_scope_as = dlm_selected_landmark_contribution
		}
	}
	if = {
		limit = { exists = scope:dlm_selected_landmark_contribution }
		fund_great_project_contribution = {
			contribution = scope:dlm_selected_landmark_contribution
			cost = no
			check_can_contribute = no
		}
	}
}

# Root: character (requires `scope:dlm_active_landmark_project`)
dlm_fund_landmark_workforce_effect = {
	scope:dlm_active_landmark_project = {
		every_contribution = {
			limit = {
				contribution_id = mobilized_workforce
				contribution_is_funded = no
			}
			save_scope_as = dlm_selected_landmark_contribution
		}
	}
	if = {
		limit = { exists = scope:dlm_selected_landmark_contribution }
		fund_great_project_contribution = {
			contribution = scope:dlm_selected_landmark_contribution
			cost = no
			check_can_contribute = no
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_complete_landmark_construction_effect = {
	dlm_roll_quality_d100_effect = yes
	set_variable = { name = dlm_debug_quality_roll value = var:dlm_quality_roll }
	set_variable = { name = dlm_quality_total value = var:dlm_quality_roll }
	change_variable = { name = dlm_quality_total add = dlm_quality_bonus_points }
	set_variable = { name = dlm_debug_quality_skill_bonus value = dlm_quality_bonus_points }
	set_variable = { name = dlm_debug_quality_contribution_bonus value = 0 }
	if = {
		limit = {
			exists = scope:dlm_active_landmark_project
			scope:dlm_active_landmark_project = {
				any_contribution = {
					contribution_id = minor_patron_investment
					contribution_is_funded = yes
				}
			}
		}
		change_variable = { name = dlm_debug_quality_contribution_bonus add = 25 }
	}
	if = {
		limit = {
			exists = scope:dlm_active_landmark_project
			scope:dlm_active_landmark_project = {
				any_contribution = {
					contribution_id = major_patron_investment
					contribution_is_funded = yes
				}
			}
		}
		change_variable = { name = dlm_debug_quality_contribution_bonus add = 80 }
	}
	if = {
		limit = {
			exists = scope:dlm_active_landmark_project
			scope:dlm_active_landmark_project = {
				any_contribution = {
					contribution_id = mobilized_workforce
					contribution_is_funded = yes
				}
			}
		}
		change_variable = { name = dlm_debug_quality_contribution_bonus add = 25 }
	}
	change_variable = { name = dlm_quality_total add = var:dlm_debug_quality_contribution_bonus }
	set_variable = { name = dlm_debug_quality_total value = var:dlm_quality_total }
	if = {
		limit = { var:dlm_quality_total >= 201 }
		set_variable = { name = dlm_quality value = 3 }
	}
	else_if = {
		limit = { var:dlm_quality_total >= 121 }
		set_variable = { name = dlm_quality value = 2 }
	}
	else = {
		set_variable = { name = dlm_quality value = 1 }
	}
	remove_variable = dlm_quality_roll
	remove_variable = dlm_quality_total
	scope:dlm_target_county.title_province = {
		if = {
			limit = { has_building = dlm_landmark_construction_early_01 }
			remove_building = dlm_landmark_construction_early_01
		}
		remove_variable = dlm_optional_contribution_cutoff_reached
	}
	if = {
		limit = { var:dlm_quality = 3 }
		scope:dlm_target_county.title_province = {
			set_variable = { name = dlm_quality value = 3 }
			set_variable = { name = dlm_legendary value = 1 }
		}
	}
	else_if = {
		limit = { var:dlm_quality = 2 }
		scope:dlm_target_county.title_province = {
			set_variable = { name = dlm_quality value = 2 }
			remove_variable = dlm_legendary
		}
	}
	else = {
		scope:dlm_target_county.title_province = {
			set_variable = { name = dlm_quality value = 1 }
			remove_variable = dlm_legendary
		}
	}
	dlm_create_landmark_from_quality_effect = yes
	if = {
		limit = { var:dlm_quality = 3 }
		add_prestige = major_prestige_gain
	}
	else_if = {
		limit = { var:dlm_quality = 2 }
		add_prestige = medium_prestige_gain
	}
}

# Root: character
dlm_apply_landmark_demolition_discount_effect = {
	if = {
		limit = { NOT = { has_variable = dlm_next_commission_gold_cost } }
		set_variable = { name = dlm_next_commission_gold_cost value = dlm_commission_base_gold_cost }
	}
	if = {
		limit = { NOT = { has_variable = dlm_next_commission_prestige_cost } }
		set_variable = { name = dlm_next_commission_prestige_cost value = dlm_commission_base_prestige_cost }
	}
	set_variable = { name = dlm_next_commission_gold_cost value = dlm_commission_discounted_gold_cost }
	set_variable = { name = dlm_next_commission_prestige_cost value = dlm_commission_discounted_prestige_cost }
	set_variable = { name = dlm_next_commission_discount_active value = yes }
	if = {
		limit = { exists = scope:root.primary_title }
		scope:root.primary_title = {
			set_variable = { name = dlm_next_commission_gold_cost value = scope:root.var:dlm_next_commission_gold_cost }
			set_variable = { name = dlm_next_commission_prestige_cost value = scope:root.var:dlm_next_commission_prestige_cost }
			set_variable = { name = dlm_next_commission_discount_active value = yes }
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_dismantle_landmark_effect = {
	scope:dlm_target_county.title_province = {
		dlm_remove_supported_special_landmark_effect = yes
		add_special_building = dlm_cleared_landmark_site_01
	}
	dlm_remove_landmark_site_modifiers_effect = yes
	if = {
		limit = {
			scope:dlm_target_county.title_province = { var:dlm_type = 8 }
			scope:dlm_target_county.holder = { is_landed = yes }
		}
		scope:dlm_target_county.holder = {
			dlm_sync_colosseum_gladiators_effect = yes
		}
	}
	scope:dlm_target_county.title_province = {
		dlm_clear_landmark_state_effect = yes
		set_variable = { name = dlm_recycled_landmark_site value = yes }
	}
	remove_character_modifier = dlm_recent_landmark_commission_cooldown
	add_character_modifier = {
		modifier = dlm_recent_landmark_dismantle_cooldown
		years = 10
	}
	scope:dlm_target_county = {
		add_county_modifier = {
			modifier = dlm_landmark_dismantled_discontent
			years = 1
		}
	}
	dlm_apply_landmark_demolition_discount_effect = yes
}

# Root: character
dlm_advance_next_commission_cost_effect = {
	set_variable = { name = dlm_next_commission_gold_cost value = dlm_commission_next_gold_cost }
	set_variable = { name = dlm_next_commission_prestige_cost value = dlm_commission_next_prestige_cost }
	remove_variable = dlm_next_commission_discount_active
	if = {
		limit = { exists = scope:root.primary_title }
		scope:root.primary_title = {
			set_variable = { name = dlm_next_commission_gold_cost value = scope:root.var:dlm_next_commission_gold_cost }
			set_variable = { name = dlm_next_commission_prestige_cost value = scope:root.var:dlm_next_commission_prestige_cost }
			remove_variable = dlm_next_commission_discount_active
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_set_chapter_variant_effect = {
	scope:dlm_target_county.title_province = {
		remove_variable = dlm_chapter_variant
		set_variable = { name = dlm_chapter_variant value = $VARIANT$ }
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_set_merc_variant_effect = {
	scope:dlm_target_county.title_province = {
		remove_variable = dlm_merc_variant
		set_variable = { name = dlm_merc_variant value = $VARIANT$ }
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_set_host_variant_effect = {
	scope:dlm_target_county.title_province = {
		remove_variable = dlm_host_variant
		set_variable = { name = dlm_host_variant value = $VARIANT$ }
	}
}

# Root: province / county capital province during construction cleanup
dlm_remove_under_construction_landmark_effect = {
	if = {
		limit = { has_building = dlm_landmark_construction_early_01 }
		remove_building = dlm_landmark_construction_early_01
	}
	remove_variable = dlm_optional_contribution_cutoff_reached
}

# Root: character (requires `scope:dlm_target_county`)
dlm_create_landmark_from_quality_effect = {
	dlm_advance_next_commission_cost_effect = yes
	scope:dlm_target_county.title_province = {
		dlm_remove_under_construction_landmark_effect = yes
		if = {
			limit = { var:dlm_type = 1 }
			if = {
				limit = { var:dlm_quality = 3 }
				set_variable = { name = dlm_legendary value = 1 }
				set_variable = { name = dlm_quality value = 3 }
				dlm_create_special_landmark_effect = { BUILDING = dlm_mine_l }
			}
			else_if = {
				limit = { var:dlm_quality = 2 }
				set_variable = { name = dlm_quality value = 2 }
				dlm_create_special_landmark_effect = { BUILDING = dlm_mine_r }
			}
			else = {
				set_variable = { name = dlm_quality value = 1 }
				dlm_create_special_landmark_effect = { BUILDING = dlm_mine }
			}
		}
		else_if = {
			limit = { var:dlm_type = 2 }
			if = {
				limit = { var:dlm_quality = 3 }
				set_variable = { name = dlm_legendary value = 1 }
				set_variable = { name = dlm_quality value = 3 }
				remove_variable = dlm_grand_exchange_legendary_name
				random_list = {
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 1 } }
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 2 } }
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 3 } }
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 4 } }
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 5 } }
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 6 } }
					1 = { set_variable = { name = dlm_grand_exchange_legendary_name value = 7 } }
				}
				dlm_create_special_landmark_effect = { BUILDING = dlm_grand_exchange_l }
			}
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_grand_exchange_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_grand_exchange } }
		}
		else_if = {
			limit = { var:dlm_type = 3 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_agricultural_domain_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_agricultural_domain_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_agricultural_domain } }
		}
		else_if = {
			limit = { var:dlm_type = 4 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_grand_university_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_grand_university_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_grand_university } }
		}
		else_if = {
			limit = { var:dlm_type = 5 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_monastic_citadel_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_monastic_citadel_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_monastic_citadel } }
		}
		else_if = {
			limit = { var:dlm_type = 6 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_observatory_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_observatory_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_observatory } }
		}
		else_if = {
			limit = { var:dlm_type = 7 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_embassy_district_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_embassy_district_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_embassy_district } }
		}
		else_if = {
			limit = { var:dlm_type = 8 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_noble_assembly_hall_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_noble_assembly_hall_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_noble_assembly_hall } }
		}
		else_if = {
			limit = { var:dlm_type = 9 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_garden_of_accord_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_garden_of_accord_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_garden_of_accord } }
		}
		else_if = {
			limit = { var:dlm_type = 10 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_veiled_court_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_veiled_court_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_veiled_court } }
		}
		else_if = {
			limit = { var:dlm_type = 11 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_dread_fort_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_dread_fort_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_dread_fort } }
		}
		else_if = {
			limit = { var:dlm_type = 12 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_blood_sanctuary_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_blood_sanctuary_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_blood_sanctuary } }
		}
		else_if = {
			limit = { var:dlm_type = 13 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_great_wall_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_great_wall_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_great_wall } }
		}
		else_if = {
			limit = { var:dlm_type = 14 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_district_of_war_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_district_of_war_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_district_of_war } }
		}
		else_if = {
			limit = { var:dlm_type = 15 }
			if = { limit = { var:dlm_quality = 3 } set_variable = { name = dlm_legendary value = 1 } set_variable = { name = dlm_quality value = 3 } dlm_create_special_landmark_effect = { BUILDING = dlm_fortress_bastion_l } }
			else_if = { limit = { var:dlm_quality = 2 } set_variable = { name = dlm_quality value = 2 } dlm_create_special_landmark_effect = { BUILDING = dlm_fortress_bastion_r } }
			else = { set_variable = { name = dlm_quality value = 1 } dlm_create_special_landmark_effect = { BUILDING = dlm_fortress_bastion } }
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_prepare_landmark_slot_from_quality_effect = {
	scope:dlm_target_county.title_province = {
		if = {
			limit = { var:dlm_type = 1 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_mine_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_mine_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_mine } }
		}
		else_if = {
			limit = { var:dlm_type = 2 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_grand_exchange_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_grand_exchange_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_grand_exchange } }
		}
		else_if = {
			limit = { var:dlm_type = 3 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_agricultural_domain_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_agricultural_domain_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_agricultural_domain } }
		}
		else_if = {
			limit = { var:dlm_type = 4 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_grand_university_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_grand_university_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_grand_university } }
		}
		else_if = {
			limit = { var:dlm_type = 5 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_monastic_citadel_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_monastic_citadel_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_monastic_citadel } }
		}
		else_if = {
			limit = { var:dlm_type = 6 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_observatory_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_observatory_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_observatory } }
		}
		else_if = {
			limit = { var:dlm_type = 7 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_embassy_district_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_embassy_district_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_embassy_district } }
		}
		else_if = {
			limit = { var:dlm_type = 8 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_noble_assembly_hall_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_noble_assembly_hall_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_noble_assembly_hall } }
		}
		else_if = {
			limit = { var:dlm_type = 9 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_garden_of_accord_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_garden_of_accord_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_garden_of_accord } }
		}
		else_if = {
			limit = { var:dlm_type = 10 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_veiled_court_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_veiled_court_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_veiled_court } }
		}
		else_if = {
			limit = { var:dlm_type = 11 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_dread_fort_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_dread_fort_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_dread_fort } }
		}
		else_if = {
			limit = { var:dlm_type = 12 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_blood_sanctuary_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_blood_sanctuary_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_blood_sanctuary } }
		}
		else_if = {
			limit = { var:dlm_type = 13 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_great_wall_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_great_wall_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_great_wall } }
		}
		else_if = {
			limit = { var:dlm_type = 14 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_district_of_war_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_district_of_war_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_district_of_war } }
		}
		else_if = {
			limit = { var:dlm_type = 15 }
			if = { limit = { var:dlm_quality = 3 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_fortress_bastion_l } }
			else_if = { limit = { var:dlm_quality = 2 } dlm_add_special_landmark_slot_effect = { BUILDING = dlm_fortress_bastion_r } }
			else = { dlm_add_special_landmark_slot_effect = { BUILDING = dlm_fortress_bastion } }
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_upgrade_landmark_from_saved_scope_effect = {
	scope:dlm_target_county.title_province = {
		if = {
			limit = { var:dlm_type = 1 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_mine_l_01 } remove_building = dlm_mine_l_01 add_special_building = dlm_mine_l_02 }
				else_if = { limit = { has_building = dlm_mine_l_02 } remove_building = dlm_mine_l_02 add_special_building = dlm_mine_l_03 }
				else_if = { limit = { has_building = dlm_mine_l_03 } remove_building = dlm_mine_l_03 add_special_building = dlm_mine_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_mine_01 } remove_building = dlm_mine_01 add_special_building = dlm_mine_02 }
				else_if = { limit = { has_building = dlm_mine_02 } remove_building = dlm_mine_02 add_special_building = dlm_mine_03 }
				else_if = { limit = { has_building = dlm_mine_03 } remove_building = dlm_mine_03 add_special_building = dlm_mine_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 2 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_grand_exchange_l_01 } remove_building = dlm_grand_exchange_l_01 add_special_building = dlm_grand_exchange_l_02 }
				else_if = { limit = { has_building = dlm_grand_exchange_l_02 } remove_building = dlm_grand_exchange_l_02 add_special_building = dlm_grand_exchange_l_03 }
				else_if = { limit = { has_building = dlm_grand_exchange_l_03 } remove_building = dlm_grand_exchange_l_03 add_special_building = dlm_grand_exchange_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_grand_exchange_01 } remove_building = dlm_grand_exchange_01 add_special_building = dlm_grand_exchange_02 }
				else_if = { limit = { has_building = dlm_grand_exchange_02 } remove_building = dlm_grand_exchange_02 add_special_building = dlm_grand_exchange_03 }
				else_if = { limit = { has_building = dlm_grand_exchange_03 } remove_building = dlm_grand_exchange_03 add_special_building = dlm_grand_exchange_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 3 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_agricultural_domain_l_01 } remove_building = dlm_agricultural_domain_l_01 add_special_building = dlm_agricultural_domain_l_02 }
				else_if = { limit = { has_building = dlm_agricultural_domain_l_02 } remove_building = dlm_agricultural_domain_l_02 add_special_building = dlm_agricultural_domain_l_03 }
				else_if = { limit = { has_building = dlm_agricultural_domain_l_03 } remove_building = dlm_agricultural_domain_l_03 add_special_building = dlm_agricultural_domain_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_agricultural_domain_01 } remove_building = dlm_agricultural_domain_01 add_special_building = dlm_agricultural_domain_02 }
				else_if = { limit = { has_building = dlm_agricultural_domain_02 } remove_building = dlm_agricultural_domain_02 add_special_building = dlm_agricultural_domain_03 }
				else_if = { limit = { has_building = dlm_agricultural_domain_03 } remove_building = dlm_agricultural_domain_03 add_special_building = dlm_agricultural_domain_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 4 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_grand_university_l_01 } remove_building = dlm_grand_university_l_01 add_special_building = dlm_grand_university_l_02 }
				else_if = { limit = { has_building = dlm_grand_university_l_02 } remove_building = dlm_grand_university_l_02 add_special_building = dlm_grand_university_l_03 }
				else_if = { limit = { has_building = dlm_grand_university_l_03 } remove_building = dlm_grand_university_l_03 add_special_building = dlm_grand_university_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_grand_university_01 } remove_building = dlm_grand_university_01 add_special_building = dlm_grand_university_02 }
				else_if = { limit = { has_building = dlm_grand_university_02 } remove_building = dlm_grand_university_02 add_special_building = dlm_grand_university_03 }
				else_if = { limit = { has_building = dlm_grand_university_03 } remove_building = dlm_grand_university_03 add_special_building = dlm_grand_university_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 5 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_monastic_citadel_l_01 } remove_building = dlm_monastic_citadel_l_01 add_special_building = dlm_monastic_citadel_l_02 }
				else_if = { limit = { has_building = dlm_monastic_citadel_l_02 } remove_building = dlm_monastic_citadel_l_02 add_special_building = dlm_monastic_citadel_l_03 }
				else_if = { limit = { has_building = dlm_monastic_citadel_l_03 } remove_building = dlm_monastic_citadel_l_03 add_special_building = dlm_monastic_citadel_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_monastic_citadel_01 } remove_building = dlm_monastic_citadel_01 add_special_building = dlm_monastic_citadel_02 }
				else_if = { limit = { has_building = dlm_monastic_citadel_02 } remove_building = dlm_monastic_citadel_02 add_special_building = dlm_monastic_citadel_03 }
				else_if = { limit = { has_building = dlm_monastic_citadel_03 } remove_building = dlm_monastic_citadel_03 add_special_building = dlm_monastic_citadel_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 6 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_observatory_l_01 } remove_building = dlm_observatory_l_01 add_special_building = dlm_observatory_l_02 }
				else_if = { limit = { has_building = dlm_observatory_l_02 } remove_building = dlm_observatory_l_02 add_special_building = dlm_observatory_l_03 }
				else_if = { limit = { has_building = dlm_observatory_l_03 } remove_building = dlm_observatory_l_03 add_special_building = dlm_observatory_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_observatory_01 } remove_building = dlm_observatory_01 add_special_building = dlm_observatory_02 }
				else_if = { limit = { has_building = dlm_observatory_02 } remove_building = dlm_observatory_02 add_special_building = dlm_observatory_03 }
				else_if = { limit = { has_building = dlm_observatory_03 } remove_building = dlm_observatory_03 add_special_building = dlm_observatory_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 7 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_embassy_district_l_01 } remove_building = dlm_embassy_district_l_01 add_special_building = dlm_embassy_district_l_02 }
				else_if = { limit = { has_building = dlm_embassy_district_l_02 } remove_building = dlm_embassy_district_l_02 add_special_building = dlm_embassy_district_l_03 }
				else_if = { limit = { has_building = dlm_embassy_district_l_03 } remove_building = dlm_embassy_district_l_03 add_special_building = dlm_embassy_district_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_embassy_district_01 } remove_building = dlm_embassy_district_01 add_special_building = dlm_embassy_district_02 }
				else_if = { limit = { has_building = dlm_embassy_district_02 } remove_building = dlm_embassy_district_02 add_special_building = dlm_embassy_district_03 }
				else_if = { limit = { has_building = dlm_embassy_district_03 } remove_building = dlm_embassy_district_03 add_special_building = dlm_embassy_district_04 }
			}
		}
			else_if = {
				limit = { var:dlm_type = 8 }
				if = {
					limit = { var:dlm_legendary = 1 }
					if = { limit = { has_building = dlm_noble_assembly_hall_l_01 } remove_building = dlm_noble_assembly_hall_l_01 add_special_building = dlm_noble_assembly_hall_l_02 }
					else_if = { limit = { has_building = dlm_noble_assembly_hall_l_02 } remove_building = dlm_noble_assembly_hall_l_02 add_special_building = dlm_noble_assembly_hall_l_03 }
					else_if = { limit = { has_building = dlm_noble_assembly_hall_l_03 } remove_building = dlm_noble_assembly_hall_l_03 add_special_building = dlm_noble_assembly_hall_l_04 }
				}
				else = {
					if = { limit = { has_building = dlm_noble_assembly_hall_01 } remove_building = dlm_noble_assembly_hall_01 add_special_building = dlm_noble_assembly_hall_02 }
					else_if = { limit = { has_building = dlm_noble_assembly_hall_02 } remove_building = dlm_noble_assembly_hall_02 add_special_building = dlm_noble_assembly_hall_03 }
					else_if = { limit = { has_building = dlm_noble_assembly_hall_03 } remove_building = dlm_noble_assembly_hall_03 add_special_building = dlm_noble_assembly_hall_04 }
				}
				if = {
					limit = {
						county.holder = {
							is_landed = yes
						}
					}
					county.holder = { dlm_sync_colosseum_gladiators_effect = yes }
				}
			}
		else_if = {
			limit = { var:dlm_type = 9 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_garden_of_accord_l_01 } remove_building = dlm_garden_of_accord_l_01 add_special_building = dlm_garden_of_accord_l_02 }
				else_if = { limit = { has_building = dlm_garden_of_accord_l_02 } remove_building = dlm_garden_of_accord_l_02 add_special_building = dlm_garden_of_accord_l_03 }
				else_if = { limit = { has_building = dlm_garden_of_accord_l_03 } remove_building = dlm_garden_of_accord_l_03 add_special_building = dlm_garden_of_accord_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_garden_of_accord_01 } remove_building = dlm_garden_of_accord_01 add_special_building = dlm_garden_of_accord_02 }
				else_if = { limit = { has_building = dlm_garden_of_accord_02 } remove_building = dlm_garden_of_accord_02 add_special_building = dlm_garden_of_accord_03 }
				else_if = { limit = { has_building = dlm_garden_of_accord_03 } remove_building = dlm_garden_of_accord_03 add_special_building = dlm_garden_of_accord_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 10 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_veiled_court_l_01 } remove_building = dlm_veiled_court_l_01 add_special_building = dlm_veiled_court_l_02 }
				else_if = { limit = { has_building = dlm_veiled_court_l_02 } remove_building = dlm_veiled_court_l_02 add_special_building = dlm_veiled_court_l_03 }
				else_if = { limit = { has_building = dlm_veiled_court_l_03 } remove_building = dlm_veiled_court_l_03 add_special_building = dlm_veiled_court_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_veiled_court_01 } remove_building = dlm_veiled_court_01 add_special_building = dlm_veiled_court_02 }
				else_if = { limit = { has_building = dlm_veiled_court_02 } remove_building = dlm_veiled_court_02 add_special_building = dlm_veiled_court_03 }
				else_if = { limit = { has_building = dlm_veiled_court_03 } remove_building = dlm_veiled_court_03 add_special_building = dlm_veiled_court_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 11 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_dread_fort_l_01 } remove_building = dlm_dread_fort_l_01 add_special_building = dlm_dread_fort_l_02 }
				else_if = { limit = { has_building = dlm_dread_fort_l_02 } remove_building = dlm_dread_fort_l_02 add_special_building = dlm_dread_fort_l_03 }
				else_if = { limit = { has_building = dlm_dread_fort_l_03 } remove_building = dlm_dread_fort_l_03 add_special_building = dlm_dread_fort_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_dread_fort_01 } remove_building = dlm_dread_fort_01 add_special_building = dlm_dread_fort_02 }
				else_if = { limit = { has_building = dlm_dread_fort_02 } remove_building = dlm_dread_fort_02 add_special_building = dlm_dread_fort_03 }
				else_if = { limit = { has_building = dlm_dread_fort_03 } remove_building = dlm_dread_fort_03 add_special_building = dlm_dread_fort_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 12 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_blood_sanctuary_l_01 } remove_building = dlm_blood_sanctuary_l_01 add_special_building = dlm_blood_sanctuary_l_02 }
				else_if = { limit = { has_building = dlm_blood_sanctuary_l_02 } remove_building = dlm_blood_sanctuary_l_02 add_special_building = dlm_blood_sanctuary_l_03 }
				else_if = { limit = { has_building = dlm_blood_sanctuary_l_03 } remove_building = dlm_blood_sanctuary_l_03 add_special_building = dlm_blood_sanctuary_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_blood_sanctuary_01 } remove_building = dlm_blood_sanctuary_01 add_special_building = dlm_blood_sanctuary_02 }
				else_if = { limit = { has_building = dlm_blood_sanctuary_02 } remove_building = dlm_blood_sanctuary_02 add_special_building = dlm_blood_sanctuary_03 }
				else_if = { limit = { has_building = dlm_blood_sanctuary_03 } remove_building = dlm_blood_sanctuary_03 add_special_building = dlm_blood_sanctuary_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 13 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_great_wall_l_01 } remove_building = dlm_great_wall_l_01 add_special_building = dlm_great_wall_l_02 }
				else_if = { limit = { has_building = dlm_great_wall_l_02 } remove_building = dlm_great_wall_l_02 add_special_building = dlm_great_wall_l_03 }
				else_if = { limit = { has_building = dlm_great_wall_l_03 } remove_building = dlm_great_wall_l_03 add_special_building = dlm_great_wall_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_great_wall_01 } remove_building = dlm_great_wall_01 add_special_building = dlm_great_wall_02 }
				else_if = { limit = { has_building = dlm_great_wall_02 } remove_building = dlm_great_wall_02 add_special_building = dlm_great_wall_03 }
				else_if = { limit = { has_building = dlm_great_wall_03 } remove_building = dlm_great_wall_03 add_special_building = dlm_great_wall_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 14 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_district_of_war_l_01 } remove_building = dlm_district_of_war_l_01 add_special_building = dlm_district_of_war_l_02 }
				else_if = { limit = { has_building = dlm_district_of_war_l_02 } remove_building = dlm_district_of_war_l_02 add_special_building = dlm_district_of_war_l_03 }
				else_if = { limit = { has_building = dlm_district_of_war_l_03 } remove_building = dlm_district_of_war_l_03 add_special_building = dlm_district_of_war_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_district_of_war_01 } remove_building = dlm_district_of_war_01 add_special_building = dlm_district_of_war_02 }
				else_if = { limit = { has_building = dlm_district_of_war_02 } remove_building = dlm_district_of_war_02 add_special_building = dlm_district_of_war_03 }
				else_if = { limit = { has_building = dlm_district_of_war_03 } remove_building = dlm_district_of_war_03 add_special_building = dlm_district_of_war_04 }
			}
		}
		else_if = {
			limit = { var:dlm_type = 15 }
			if = {
				limit = { var:dlm_legendary = 1 }
				if = { limit = { has_building = dlm_fortress_bastion_l_01 } remove_building = dlm_fortress_bastion_l_01 add_special_building = dlm_fortress_bastion_l_02 }
				else_if = { limit = { has_building = dlm_fortress_bastion_l_02 } remove_building = dlm_fortress_bastion_l_02 add_special_building = dlm_fortress_bastion_l_03 }
				else_if = { limit = { has_building = dlm_fortress_bastion_l_03 } remove_building = dlm_fortress_bastion_l_03 add_special_building = dlm_fortress_bastion_l_04 }
			}
			else = {
				if = { limit = { has_building = dlm_fortress_bastion_01 } remove_building = dlm_fortress_bastion_01 add_special_building = dlm_fortress_bastion_02 }
				else_if = { limit = { has_building = dlm_fortress_bastion_02 } remove_building = dlm_fortress_bastion_02 add_special_building = dlm_fortress_bastion_03 }
				else_if = { limit = { has_building = dlm_fortress_bastion_03 } remove_building = dlm_fortress_bastion_03 add_special_building = dlm_fortress_bastion_04 }
			}
		}
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_roll_stewardship_bonus_effect = {
	random_list = {
		20 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_income_small years = 50 } } }
		15 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_tax_small years = 50 } } }
		15 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_dev_growth years = 50 } } }
		15 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_levy_reinf years = 50 } } }
		15 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_build_cost years = 50 } } }
		15 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_build_speed years = 50 } } }
		5 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_stew_vassal_tax years = 20 } } }
	}
}
dlm_roll_stewardship_bonus_legendary_effect = {
	random_list = {
		18 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_income_small years = 50 } } }
		15 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_income_medium years = 50 } } }
		12 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_tax_small years = 50 } } }
		12 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_tax_medium years = 50 } } }
		12 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_dev_growth years = 50 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_levy_reinf years = 50 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_build_cost years = 50 } } }
		6 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_build_speed years = 50 } } }
		5 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_stew_domain_limit years = 10 } } }
	}
}

dlm_roll_learning_bonus_effect = {
	random_list = {
		18 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_xp years = 20 } } }
		18 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_piety years = 20 } } }
		18 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_learn_dev_growth years = 50 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_fascination years = 20 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_acceptance years = 20 } } }
		8 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_innovation years = 20 } } }
		6 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_renown years = 20 } } }
	}
}
dlm_roll_learning_bonus_legendary_effect = {
	random_list = {
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_xp years = 25 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_piety years = 25 } } }
		14 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_learn_dev_growth years = 75 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_fascination years = 25 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_acceptance years = 25 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_innovation years = 25 } } }
		10 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_learn_renown years = 25 } } }
	}
}

dlm_roll_diplomacy_bonus_effect = {
	random_list = {
		15 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_foreign years = 20 } } }
		15 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_vassal years = 20 } } }
		15 = { scope:dlm_target_county = { add_county_modifier = { modifier = dlm_pmod_diplo_county_opinion years = 50 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_prestige years = 20 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_range years = 20 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_stress years = 20 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_acceptance years = 20 } } }
	}
}
dlm_roll_diplomacy_bonus_legendary_effect = {
	random_list = {
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_foreign years = 25 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_vassal years = 25 } } }
		14 = { scope:dlm_target_county = { add_county_modifier = { modifier = dlm_pmod_diplo_county_opinion years = 75 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_prestige years = 25 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_range years = 25 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_stress years = 25 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_acceptance years = 25 } } }
		8 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_grandeur years = 25 } } }
		6 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_opinion_aura years = 10 } } }
		4 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_diplo_prestige_big years = 15 } } }
	}
}

dlm_roll_intrigue_bonus_effect = {
	random_list = {
		22 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_scheme years = 20 } } }
		18 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_hostile_speed years = 20 } } }
		18 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_dread years = 20 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_natural_dread years = 20 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_resist years = 20 } } }
		10 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_extra_scheme years = 10 } } }
	}
}
dlm_roll_intrigue_bonus_legendary_effect = {
	random_list = {
		20 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_scheme years = 25 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_hostile_speed years = 25 } } }
		16 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_dread years = 25 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_natural_dread years = 25 } } }
		14 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_resist years = 25 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_extra_scheme years = 15 } } }
		8 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_intrigue_exposure years = 15 } } }
	}
}

dlm_roll_martial_bonus_effect = {
	random_list = {
		18 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_maa_damage years = 50 } } }
		18 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_maa_toughness years = 50 } } }
		12 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_martial_knights years = 20 } } }
		12 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_fort years = 50 } } }
		12 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_garrison years = 50 } } }
		12 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_advantage years = 50 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_siege years = 50 } } }
		6 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_levy_reinf years = 50 } } }
	}
}
dlm_roll_martial_bonus_legendary_effect = {
	random_list = {
		16 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_maa_damage years = 75 } } }
		16 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_maa_toughness years = 75 } } }
		10 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_martial_knights years = 25 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_fort years = 75 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_garrison years = 75 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_advantage years = 75 } } }
		10 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_siege years = 75 } } }
		8 = { scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_pmod_martial_attrition years = 75 } } }
		6 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_pursuit years = 75 } } }
		4 = { scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_levy_reinf years = 75 } } }
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_roll_one_bonus_from_group_effect = {
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 1 } }
		if = { limit = { scope:dlm_target_county.title_province = { var:dlm_legendary = 1 } } dlm_roll_stewardship_bonus_legendary_effect = yes }
		else = { dlm_roll_stewardship_bonus_effect = yes }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 2 } }
		if = { limit = { scope:dlm_target_county.title_province = { var:dlm_legendary = 1 } } dlm_roll_learning_bonus_legendary_effect = yes }
		else = { dlm_roll_learning_bonus_effect = yes }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 3 } }
		if = { limit = { scope:dlm_target_county.title_province = { var:dlm_legendary = 1 } } dlm_roll_diplomacy_bonus_legendary_effect = yes }
		else = { dlm_roll_diplomacy_bonus_effect = yes }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 4 } }
		if = { limit = { scope:dlm_target_county.title_province = { var:dlm_legendary = 1 } } dlm_roll_intrigue_bonus_legendary_effect = yes }
		else = { dlm_roll_intrigue_bonus_effect = yes }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_group = 5 } }
		if = { limit = { scope:dlm_target_county.title_province = { var:dlm_legendary = 1 } } dlm_roll_martial_bonus_legendary_effect = yes }
		else = { dlm_roll_martial_bonus_effect = yes }
	}
}

# Root: character (requires `scope:dlm_target_county`)
dlm_reset_investment_result_effect = {
	remove_variable = dlm_result_slot_1
	remove_variable = dlm_result_slot_2
	set_variable = { name = dlm_investment_success_count value = 0 }
	remove_variable = dlm_investment_mode
}

dlm_record_investment_result_effect = {
	if = {
		limit = { NOT = { exists = var:dlm_result_slot_1 } }
		set_variable = { name = dlm_result_slot_1 value = $RESULT_ID$ }
		change_variable = { name = dlm_investment_success_count add = 1 }
	}
	else_if = {
		limit = { NOT = { exists = var:dlm_result_slot_2 } }
		set_variable = { name = dlm_result_slot_2 value = $RESULT_ID$ }
		change_variable = { name = dlm_investment_success_count add = 1 }
	}
}

dlm_add_selected_investment_bonus_effect = {
	if = {
		limit = { var:dlm_selected_investment_bonus = 101 }
			scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_dev_growth years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 101 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 102 }
			scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_build_speed years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 102 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 103 }
			scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_tax_small years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 103 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 104 }
			scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_dev_growth years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 104 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 105 }
			scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_levy_reinf years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 105 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 106 }
			scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_stew_income_small years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 106 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 107 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_learn_insight years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 107 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 108 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_pmod_learn_build_speed years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 108 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 109 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_pmod_learn_dev_growth years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 109 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 110 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_cmod_learn_control years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 110 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 111 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_learn_insight years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 111 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 112 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_pmod_learn_build_speed years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 112 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 113 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_cmod_diplo_opinion years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 113 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 114 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_diplo_dev_growth years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 114 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 115 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_cmod_diplo_control years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 115 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 116 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_pmod_diplo_county_opinion years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 116 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 117 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_cmod_diplo_opinion years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 117 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 118 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_diplo_dev_growth years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 118 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 119 }
		scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_pmod_martial_attrition years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 119 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 120 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_cmod_intrigue_control years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 120 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 121 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_intrigue_fort years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 121 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 122 }
		scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_pmod_martial_attrition years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 122 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 123 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_learn_insight years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 123 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 124 }
		scope:dlm_target_county = { add_county_modifier = { modifier = dlm_cmod_learn_control years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 124 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 125 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_garrison years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 125 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 126 }
		scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_pmod_martial_attrition years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 126 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 127 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_maa_toughness years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 127 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 128 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_maa_damage_small years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 128 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 129 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_fort years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 129 }
	}
	else_if = {
		limit = { var:dlm_selected_investment_bonus = 130 }
		scope:dlm_target_county.title_province = { add_province_modifier = { modifier = dlm_pmod_martial_garrison years = 100 } }
		dlm_record_investment_result_effect = { RESULT_ID = 130 }
	}
		else_if = {
			limit = { var:dlm_selected_investment_bonus = 131 }
			scope:dlm_target_county.holder = { add_character_modifier = { modifier = dlm_chmod_stew_domain_limit years = 100 } }
			dlm_record_investment_result_effect = { RESULT_ID = 131 }
		}
	remove_variable = dlm_selected_investment_bonus
}

dlm_add_investment_bonus_from_type_effect = {
	if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 1 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_dev_growth } }
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_build_speed } }
				NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_chmod_stew_domain_limit } }
			}
			random_list = {
				45 = { set_variable = { name = dlm_selected_investment_bonus value = 101 } }
				45 = { set_variable = { name = dlm_selected_investment_bonus value = 102 } }
				10 = { set_variable = { name = dlm_selected_investment_bonus value = 131 } }
			}
		}
		else_if = {
				limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_dev_growth } } }
			set_variable = { name = dlm_selected_investment_bonus value = 101 }
		}
		else_if = {
				limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_build_speed } } }
			set_variable = { name = dlm_selected_investment_bonus value = 102 }
		}
		else_if = {
			limit = { NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_chmod_stew_domain_limit } } }
			set_variable = { name = dlm_selected_investment_bonus value = 131 }
		}
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 2 } }
		if = {
			limit = {
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_tax_small } }
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_dev_growth } }
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_income_small } }
				}
				random_list = {
					45 = { set_variable = { name = dlm_selected_investment_bonus value = 103 } }
					45 = { set_variable = { name = dlm_selected_investment_bonus value = 104 } }
					10 = { set_variable = { name = dlm_selected_investment_bonus value = 106 } }
				}
			}
			else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_tax_small } } } set_variable = { name = dlm_selected_investment_bonus value = 103 } }
			else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_dev_growth } } } set_variable = { name = dlm_selected_investment_bonus value = 104 } }
			else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_income_small } } } set_variable = { name = dlm_selected_investment_bonus value = 106 } }
		}
		else_if = {
			limit = { scope:dlm_target_county.title_province = { var:dlm_type = 3 } }
			if = {
				limit = {
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_levy_reinf } }
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_dev_growth } }
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_income_small } }
				}
				random_list = {
					45 = { set_variable = { name = dlm_selected_investment_bonus value = 105 } }
					35 = { set_variable = { name = dlm_selected_investment_bonus value = 104 } }
					20 = { set_variable = { name = dlm_selected_investment_bonus value = 106 } }
				}
			}
			else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_levy_reinf } } } set_variable = { name = dlm_selected_investment_bonus value = 105 } }
			else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_dev_growth } } } set_variable = { name = dlm_selected_investment_bonus value = 104 } }
			else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_stew_income_small } } } set_variable = { name = dlm_selected_investment_bonus value = 106 } }
		}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 4 } }
		if = {
			limit = {
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_learn_insight } }
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_learn_build_speed } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 107 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 108 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_learn_insight } } } set_variable = { name = dlm_selected_investment_bonus value = 107 } }
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_learn_build_speed } } } set_variable = { name = dlm_selected_investment_bonus value = 108 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 5 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_learn_dev_growth } }
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_learn_control } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 109 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 110 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_learn_dev_growth } } } set_variable = { name = dlm_selected_investment_bonus value = 109 } }
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_learn_control } } } set_variable = { name = dlm_selected_investment_bonus value = 110 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 6 } }
		if = {
			limit = {
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_learn_insight } }
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_learn_build_speed } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 111 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 112 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_learn_insight } } } set_variable = { name = dlm_selected_investment_bonus value = 111 } }
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_learn_build_speed } } } set_variable = { name = dlm_selected_investment_bonus value = 112 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 7 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_diplo_opinion } }
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_diplo_dev_growth } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 113 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 114 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_diplo_opinion } } } set_variable = { name = dlm_selected_investment_bonus value = 113 } }
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_diplo_dev_growth } } } set_variable = { name = dlm_selected_investment_bonus value = 114 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 8 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_diplo_control } }
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_diplo_county_opinion } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 115 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 116 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_diplo_control } } } set_variable = { name = dlm_selected_investment_bonus value = 115 } }
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_pmod_diplo_county_opinion } } } set_variable = { name = dlm_selected_investment_bonus value = 116 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 9 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_diplo_opinion } }
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_diplo_dev_growth } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 117 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 118 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_diplo_opinion } } } set_variable = { name = dlm_selected_investment_bonus value = 117 } }
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_diplo_dev_growth } } } set_variable = { name = dlm_selected_investment_bonus value = 118 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 10 } }
		if = {
			limit = {
					NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_pmod_martial_attrition } }
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_intrigue_control } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 119 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 120 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_pmod_martial_attrition } } } set_variable = { name = dlm_selected_investment_bonus value = 119 } }
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_intrigue_control } } } set_variable = { name = dlm_selected_investment_bonus value = 120 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 11 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_intrigue_fort } }
					NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_pmod_martial_attrition } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 121 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 122 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_intrigue_fort } } } set_variable = { name = dlm_selected_investment_bonus value = 121 } }
		else_if = { limit = { NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_pmod_martial_attrition } } } set_variable = { name = dlm_selected_investment_bonus value = 122 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 12 } }
		if = {
			limit = {
					NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_learn_insight } }
				NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_learn_control } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 123 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 124 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_learn_insight } } } set_variable = { name = dlm_selected_investment_bonus value = 123 } }
		else_if = { limit = { NOT = { scope:dlm_target_county = { has_county_modifier = dlm_cmod_learn_control } } } set_variable = { name = dlm_selected_investment_bonus value = 124 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 13 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_garrison } }
					NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_pmod_martial_attrition } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 125 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 126 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_garrison } } } set_variable = { name = dlm_selected_investment_bonus value = 125 } }
		else_if = { limit = { NOT = { scope:dlm_target_county.holder = { has_character_modifier = dlm_pmod_martial_attrition } } } set_variable = { name = dlm_selected_investment_bonus value = 126 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 14 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_maa_toughness } }
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_maa_damage_small } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 127 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 128 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_maa_toughness } } } set_variable = { name = dlm_selected_investment_bonus value = 127 } }
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_maa_damage_small } } } set_variable = { name = dlm_selected_investment_bonus value = 128 } }
	}
	else_if = {
		limit = { scope:dlm_target_county.title_province = { var:dlm_type = 15 } }
		if = {
			limit = {
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_fort } }
				NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_garrison } }
			}
			random_list = {
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 129 } }
				50 = { set_variable = { name = dlm_selected_investment_bonus value = 130 } }
			}
		}
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_fort } } } set_variable = { name = dlm_selected_investment_bonus value = 129 } }
		else_if = { limit = { NOT = { scope:dlm_target_county.title_province = { has_province_modifier = dlm_pmod_martial_garrison } } } set_variable = { name = dlm_selected_investment_bonus value = 130 } }
	}
	if = {
		limit = { exists = var:dlm_selected_investment_bonus }
		dlm_add_selected_investment_bonus_effect = yes
	}
}

dlm_apply_arena_fighter_traits_effect = {
	random_list = {
		20 = {
			if = {
				limit = { NOT = { has_trait = lifestyle_blademaster } }
				add_trait = lifestyle_blademaster
			}
		}
		80 = { }
	}
	random_list = {
		10 = {
			if = {
				limit = { NOT = { has_trait = giant } }
				add_trait = giant
			}
		}
		90 = { }
	}
	random_list = {
		8 = {
			if = {
				limit = { NOT = { has_trait = physique_good_1 } }
				add_trait = physique_good_1
			}
		}
		1 = {
			if = {
				limit = { NOT = { has_trait = physique_good_2 } }
				add_trait = physique_good_2
			}
		}
		1 = {
			if = {
				limit = { NOT = { has_trait = physique_good_3 } }
				add_trait = physique_good_3
			}
		}
		90 = { }
	}
	random_list = {
		30 = {
			random_list = {
				20 = {
					if = {
						limit = { NOT = { has_trait = gallant } }
						add_trait = gallant
					}
				}
				20 = {
					if = {
						limit = { NOT = { has_trait = brave } }
						add_trait = brave
					}
				}
				20 = {
					if = {
						limit = { NOT = { has_trait = strong } }
						add_trait = strong
					}
				}
				20 = {
					if = {
						limit = { NOT = { has_trait = athletic } }
						add_trait = athletic
					}
				}
				20 = {
					if = {
						limit = { NOT = { has_trait = lifestyle_hunter } }
						add_trait = lifestyle_hunter
					}
				}
			}
		}
		70 = { }
	}
	random_list = {
		5 = {
			if = {
				limit = { NOT = { has_trait = strong } }
				add_trait = strong
			}
		}
		95 = { }
	}
	random_list = {
		5 = {
			if = {
				limit = { NOT = { has_trait = athletic } }
				add_trait = athletic
			}
		}
		95 = { }
	}
	random_list = {
		25 = {
			if = {
				limit = { NOT = { has_trait = scarred } }
				add_trait = scarred
			}
		}
		75 = { }
	}
	random_list = {
		10 = {
			if = {
				limit = { NOT = { has_trait = brave } }
				add_trait = brave
			}
		}
		90 = { }
	}
}

dlm_apply_colosseum_hazard_aftermath_effect = {
	if = {
		limit = { var:dlm_colosseum_round_hazard = 1 }
		if = {
			limit = {
				exists = scope:dlm_arena_last_loser
				scope:dlm_arena_last_loser = { is_alive = yes }
			}
			scope:dlm_arena_last_loser = {
				random_list = {
					35 = { death = { death_reason = death_duel } }
					30 = { if = { limit = { NOT = { has_trait = scarred } } add_trait = scarred } }
					15 = { if = { limit = { NOT = { has_trait = wounded_1 } } add_trait = wounded_1 } }
					10 = { if = { limit = { NOT = { has_trait = one_eyed } } add_trait = one_eyed } }
					10 = { if = { limit = { NOT = { has_trait = disfigured } } add_trait = disfigured } }
				}
			}
		}
		if = {
			limit = {
				exists = scope:dlm_arena_last_winner
				scope:dlm_arena_last_winner = { is_alive = yes }
			}
			scope:dlm_arena_last_winner = {
				random_list = {
					20 = { death = { death_reason = death_duel } }
					35 = { if = { limit = { NOT = { has_trait = scarred } } add_trait = scarred } }
					20 = { if = { limit = { NOT = { has_trait = wounded_1 } } add_trait = wounded_1 } }
					10 = { if = { limit = { NOT = { has_trait = one_eyed } } add_trait = one_eyed } }
					15 = { }
				}
			}
		}
	}
	else_if = {
		limit = { var:dlm_colosseum_round_hazard = 2 }
		if = {
			limit = {
				exists = scope:dlm_arena_last_loser
				scope:dlm_arena_last_loser = { is_alive = yes }
			}
			scope:dlm_arena_last_loser = {
				random_list = {
					40 = { death = { death_reason = death_duel } }
					30 = { if = { limit = { NOT = { has_trait = scarred } } add_trait = scarred } }
					15 = { if = { limit = { NOT = { has_trait = wounded_1 } } add_trait = wounded_1 } }
					5 = { if = { limit = { NOT = { has_trait = one_eyed } } add_trait = one_eyed } }
					10 = { if = { limit = { NOT = { has_trait = disfigured } } add_trait = disfigured } }
				}
			}
		}
		if = {
			limit = {
				exists = scope:dlm_arena_last_winner
				scope:dlm_arena_last_winner = { is_alive = yes }
			}
			scope:dlm_arena_last_winner = {
				random_list = {
					20 = { death = { death_reason = death_duel } }
					40 = { if = { limit = { NOT = { has_trait = scarred } } add_trait = scarred } }
					20 = { if = { limit = { NOT = { has_trait = wounded_1 } } add_trait = wounded_1 } }
					10 = { if = { limit = { NOT = { has_trait = one_eyed } } add_trait = one_eyed } }
					10 = { }
				}
			}
		}
	}
}

dlm_setup_colosseum_round_one_effect = {
	if = {
		limit = {
			var:dlm_use_court_champion = 1
			exists = scope:dlm_selected_court_champion
			scope:dlm_selected_court_champion = { is_alive = yes }
		}
		scope:dlm_selected_court_champion = { save_scope_as = dlm_arena_champion }
	}
	else = {
		remove_variable = dlm_use_court_champion
		create_character = {
			gender_female_chance = 0
			location = root.location
			template = dlm_colosseum_wanderer
			faith = root.faith
			culture = root.culture
			save_scope_as = dlm_arena_champion
		}
		scope:dlm_arena_champion = {
			add_trait = dlm_gladiator
			dlm_apply_arena_fighter_traits_effect = yes
			save_scope_as = dlm_arena_visitor_1
		}
		if = {
			limit = { var:dlm_colosseum_games_style = 2 }
			random_list = {
				75 = { add_visiting_courtier = scope:dlm_arena_visitor_1 }
				25 = { }
			}
		}
		else_if = {
			limit = { var:dlm_colosseum_games_style = 3 }
			random_list = {
				25 = { add_visiting_courtier = scope:dlm_arena_visitor_1 }
				75 = { }
			}
		}
		else = {
			random_list = {
				50 = { add_visiting_courtier = scope:dlm_arena_visitor_1 }
				50 = { }
			}
		}
	}
	create_character = {
		gender_female_chance = 0
		location = root.location
		template = dlm_colosseum_wanderer
		faith = root.faith
		culture = root.culture
		save_scope_as = dlm_arena_challenger
	}
	scope:dlm_arena_challenger = {
		add_trait = dlm_gladiator
		dlm_apply_arena_fighter_traits_effect = yes
		save_scope_as = dlm_arena_visitor_2
	}
	if = {
		limit = { var:dlm_colosseum_games_style = 2 }
		random_list = {
			75 = { add_visiting_courtier = scope:dlm_arena_visitor_2 }
			25 = { }
		}
	}
	else_if = {
		limit = { var:dlm_colosseum_games_style = 3 }
		random_list = {
			25 = { add_visiting_courtier = scope:dlm_arena_visitor_2 }
			75 = { }
		}
	}
	else = {
		random_list = {
			50 = { add_visiting_courtier = scope:dlm_arena_visitor_2 }
			50 = { }
		}
	}
	remove_variable = dlm_arena_result
}

dlm_setup_colosseum_round_two_effect = {
	create_character = {
		gender_female_chance = 0
		location = root.location
		template = dlm_colosseum_wanderer
		faith = root.faith
		culture = root.culture
		save_scope_as = dlm_arena_champion
	}
	scope:dlm_arena_champion = {
		add_trait = dlm_gladiator
		dlm_apply_arena_fighter_traits_effect = yes
		save_scope_as = dlm_arena_visitor_3
	}
	if = {
		limit = { var:dlm_colosseum_games_style = 2 }
		random_list = {
			75 = { add_visiting_courtier = scope:dlm_arena_visitor_3 }
			25 = { }
		}
	}
	else_if = {
		limit = { var:dlm_colosseum_games_style = 3 }
		random_list = {
			25 = { add_visiting_courtier = scope:dlm_arena_visitor_3 }
			75 = { }
		}
	}
	else = {
		random_list = {
			50 = { add_visiting_courtier = scope:dlm_arena_visitor_3 }
			50 = { }
		}
	}
	create_character = {
		gender_female_chance = 0
		location = root.location
		template = dlm_colosseum_wanderer
		faith = root.faith
		culture = root.culture
		save_scope_as = dlm_arena_challenger
	}
	scope:dlm_arena_challenger = {
		add_trait = dlm_gladiator
		dlm_apply_arena_fighter_traits_effect = yes
		save_scope_as = dlm_arena_visitor_4
	}
	if = {
		limit = { var:dlm_colosseum_games_style = 2 }
		random_list = {
			75 = { add_visiting_courtier = scope:dlm_arena_visitor_4 }
			25 = { }
		}
	}
	else_if = {
		limit = { var:dlm_colosseum_games_style = 3 }
		random_list = {
			25 = { add_visiting_courtier = scope:dlm_arena_visitor_4 }
			75 = { }
		}
	}
	else = {
		random_list = {
			50 = { add_visiting_courtier = scope:dlm_arena_visitor_4 }
			50 = { }
		}
	}
	remove_variable = dlm_arena_result
}

dlm_setup_colosseum_final_round_effect = {
	if = {
		limit = {
			exists = scope:activity.var:dlm_activity_round_one_winner_var
			scope:activity.var:dlm_activity_round_one_winner_var = { is_alive = yes }
		}
		scope:activity.var:dlm_activity_round_one_winner_var = { save_scope_as = dlm_arena_champion }
	}
	else_if = {
		limit = {
			exists = scope:dlm_arena_last_winner
			scope:dlm_arena_last_winner = { is_alive = yes }
		}
		scope:dlm_arena_last_winner = { save_scope_as = dlm_arena_champion }
	}
	else_if = {
		limit = {
			var:dlm_use_court_champion = 1
			exists = scope:dlm_selected_court_champion
			scope:dlm_selected_court_champion = { is_alive = yes }
		}
		scope:dlm_selected_court_champion = { save_scope_as = dlm_arena_champion }
	}
	else = {
		remove_variable = dlm_use_court_champion
		create_character = {
			gender_female_chance = 0
			location = root.location
			template = dlm_colosseum_wanderer
			faith = root.faith
			culture = root.culture
			save_scope_as = dlm_arena_champion
		}
		scope:dlm_arena_champion = {
			add_trait = dlm_gladiator
			dlm_apply_arena_fighter_traits_effect = yes
			save_scope_as = dlm_arena_visitor_5
		}
		if = {
			limit = { var:dlm_colosseum_games_style = 2 }
			random_list = {
				75 = { add_visiting_courtier = scope:dlm_arena_visitor_5 }
				25 = { }
			}
		}
		else_if = {
			limit = { var:dlm_colosseum_games_style = 3 }
			random_list = {
				25 = { add_visiting_courtier = scope:dlm_arena_visitor_5 }
				75 = { }
			}
		}
		else = {
			random_list = {
				50 = { add_visiting_courtier = scope:dlm_arena_visitor_5 }
				50 = { }
			}
		}
	}
	if = {
		limit = {
			exists = scope:activity.var:dlm_activity_round_two_winner_var
			scope:activity.var:dlm_activity_round_two_winner_var = { is_alive = yes }
		}
		scope:activity.var:dlm_activity_round_two_winner_var = { save_scope_as = dlm_arena_challenger }
	}
	else = {
		create_character = {
			gender_female_chance = 0
			location = root.location
			template = dlm_colosseum_wanderer
			faith = root.faith
			culture = root.culture
			save_scope_as = dlm_arena_challenger
		}
		scope:dlm_arena_challenger = {
			add_trait = dlm_gladiator
			dlm_apply_arena_fighter_traits_effect = yes
			save_scope_as = dlm_arena_visitor_6
		}
		if = {
			limit = { var:dlm_colosseum_games_style = 2 }
			random_list = {
				75 = { add_visiting_courtier = scope:dlm_arena_visitor_6 }
				25 = { }
			}
		}
		else_if = {
			limit = { var:dlm_colosseum_games_style = 3 }
			random_list = {
				25 = { add_visiting_courtier = scope:dlm_arena_visitor_6 }
				75 = { }
			}
		}
		else = {
			random_list = {
				50 = { add_visiting_courtier = scope:dlm_arena_visitor_6 }
				50 = { }
			}
		}
	}
	remove_variable = dlm_arena_result
}

dlm_begin_colosseum_games_activity_effect = {
	remove_variable = dlm_colosseum_games_style
	remove_variable = dlm_colosseum_games_score
	remove_variable = dlm_colosseum_games_finalized
	remove_variable = dlm_use_court_champion
	remove_variable = dlm_court_champion_defeated
	remove_variable = dlm_arena_result
	remove_variable = dlm_arena_last_winner
	remove_variable = dlm_arena_last_loser
	remove_variable = dlm_colosseum_upsets_count
	set_variable = { name = dlm_colosseum_games_score value = 0 }

	if = {
		limit = {
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = dlm_colosseum_type_lavish
				}
			}
		}
		set_variable = { name = dlm_colosseum_games_style value = 2 }
	}
	else_if = {
		limit = {
			scope:activity = {
				has_activity_option = {
					category = special_type
					option = dlm_colosseum_type_bloody
				}
			}
		}
		set_variable = { name = dlm_colosseum_games_style value = 3 }
		add_dread = 5
	}
	else = {
		set_variable = { name = dlm_colosseum_games_style value = 1 }
	}

	create_character = {
		gender_female_chance = 0
		location = root.location
		template = dlm_colosseum_wanderer
		faith = root.faith
		culture = root.culture
		save_scope_as = dlm_arena_champion
	}
	scope:dlm_arena_champion = {
		add_trait = dlm_gladiator
		dlm_apply_arena_fighter_traits_effect = yes
		save_scope_as = dlm_arena_visitor_1
	}
	if = {
		limit = { var:dlm_colosseum_games_style = 2 }
		random_list = {
			75 = { add_visiting_courtier = scope:dlm_arena_visitor_1 }
			25 = { }
		}
	}
	else_if = {
		limit = { var:dlm_colosseum_games_style = 3 }
		random_list = {
			25 = { add_visiting_courtier = scope:dlm_arena_visitor_1 }
			75 = { }
		}
	}
	else = {
		random_list = {
			50 = { add_visiting_courtier = scope:dlm_arena_visitor_1 }
			50 = { }
		}
	}
	create_character = {
		gender_female_chance = 0
		location = root.location
		template = dlm_colosseum_wanderer
		faith = root.faith
		culture = root.culture
		save_scope_as = dlm_arena_challenger
	}
	scope:dlm_arena_challenger = {
		add_trait = dlm_gladiator
		dlm_apply_arena_fighter_traits_effect = yes
		save_scope_as = dlm_arena_visitor_2
	}
	if = {
		limit = { var:dlm_colosseum_games_style = 2 }
		random_list = {
			75 = { add_visiting_courtier = scope:dlm_arena_visitor_2 }
			25 = { }
		}
	}
	else_if = {
		limit = { var:dlm_colosseum_games_style = 3 }
		random_list = {
			25 = { add_visiting_courtier = scope:dlm_arena_visitor_2 }
			75 = { }
		}
	}
	else = {
		random_list = {
			50 = { add_visiting_courtier = scope:dlm_arena_visitor_2 }
			50 = { }
		}
	}
}

dlm_finalize_colosseum_activity_effect = {
	if = {
		limit = { NOT = { has_variable = dlm_colosseum_games_finalized } }
		set_variable = { name = dlm_colosseum_games_finalized value = 1 }

		if = {
			limit = {
				exists = scope:dlm_arena_last_winner
				scope:dlm_arena_last_winner = { is_alive = yes }
			}
			scope:dlm_arena_last_winner = { save_scope_as = dlm_arena_champion }
			scope:activity = {
				add_activity_log_entry = {
					key = dlm_colosseum_victor_key
					character = scope:dlm_arena_last_winner
				}
			}
		}

			scope:host = {
				if = {
					limit = { var:dlm_colosseum_games_score >= 2 }
					add_prestige = 225
			}
			else_if = {
				limit = { var:dlm_colosseum_games_score >= 1 }
				add_prestige = 125
			}
				else = {
					add_prestige = 50
				}

				if = {
					limit = { exists = scope:activity.activity_location }
					scope:activity.activity_location.county = {
						save_scope_as = dlm_target_county
					}
				}
				if = {
					limit = { exists = scope:dlm_target_county }
					scope:dlm_target_county = {
						de_jure_liege = { save_scope_as = dlm_target_duchy }
					}
				}
				if = {
					limit = { exists = scope:dlm_target_duchy }
					if = {
						limit = { var:dlm_colosseum_games_style = 3 }
						scope:dlm_target_duchy = {
							every_de_jure_county = {
								add_county_modifier = {
									modifier = dlm_colosseum_games_bloody_repute
									years = 5
								}
								title_province = {
									add_province_modifier = {
										modifier = dlm_colosseum_games_bloody_repute_province
										years = 5
									}
								}
							}
						}
						add_dread = 10
						if = {
							limit = { var:dlm_colosseum_games_score >= 2 }
							scope:dlm_target_duchy = {
								every_de_jure_county = {
									remove_county_modifier = dlm_colosseum_games_bloody_repute
									add_county_modifier = {
										modifier = dlm_colosseum_games_bloody_triumph
										years = 5
									}
									title_province = {
										remove_province_modifier = dlm_colosseum_games_bloody_repute_province
										add_province_modifier = {
											modifier = dlm_colosseum_games_bloody_triumph_province
											years = 5
										}
									}
								}
							}
							add_dread = 10
						}
						scope:activity = {
							if = {
								limit = { var:dlm_colosseum_games_score >= 2 }
								add_activity_log_entry = { key = dlm_colosseum_rewards_grand_bloody_key character = scope:host }
							}
							else_if = {
								limit = { var:dlm_colosseum_games_score >= 1 }
								add_activity_log_entry = { key = dlm_colosseum_rewards_good_bloody_key character = scope:host }
							}
							else = {
								add_activity_log_entry = { key = dlm_colosseum_rewards_modest_bloody_key character = scope:host }
							}
						}
					}
					else = {
						scope:dlm_target_duchy = {
							every_de_jure_county = {
								add_county_modifier = {
									modifier = dlm_colosseum_games_cheered
									years = 5
								}
								title_province = {
									add_province_modifier = {
										modifier = dlm_colosseum_games_cheered_province
										years = 5
									}
								}
							}
						}
						if = {
							limit = { var:dlm_colosseum_games_score >= 2 }
							scope:dlm_target_duchy = {
								every_de_jure_county = {
									remove_county_modifier = dlm_colosseum_games_cheered
									add_county_modifier = {
										modifier = dlm_colosseum_games_triumph
										years = 5
									}
									title_province = {
										remove_province_modifier = dlm_colosseum_games_cheered_province
										add_province_modifier = {
											modifier = dlm_colosseum_games_triumph_province
											years = 5
										}
									}
								}
							}
						}
						if = {
							limit = { var:dlm_colosseum_games_style = 2 }
							if = {
								limit = { var:dlm_colosseum_games_score >= 2 }
								add_dynasty_prestige = 30
							}
							else_if = {
								limit = { var:dlm_colosseum_games_score >= 1 }
								add_dynasty_prestige = 20
							}
							else = {
								add_dynasty_prestige = 10
							}
							scope:activity = {
								if = {
									limit = { var:dlm_colosseum_games_score >= 2 }
									add_activity_log_entry = { key = dlm_colosseum_rewards_grand_lavish_key character = scope:host }
								}
								else_if = {
									limit = { var:dlm_colosseum_games_score >= 1 }
									add_activity_log_entry = { key = dlm_colosseum_rewards_good_lavish_key character = scope:host }
								}
								else = {
									add_activity_log_entry = { key = dlm_colosseum_rewards_modest_lavish_key character = scope:host }
								}
							}
						}
						else = {
							scope:activity = {
								if = {
									limit = { var:dlm_colosseum_games_score >= 2 }
									add_activity_log_entry = { key = dlm_colosseum_rewards_grand_recreational_key character = scope:host }
								}
								else_if = {
									limit = { var:dlm_colosseum_games_score >= 1 }
									add_activity_log_entry = { key = dlm_colosseum_rewards_good_recreational_key character = scope:host }
								}
								else = {
									add_activity_log_entry = { key = dlm_colosseum_rewards_modest_recreational_key character = scope:host }
								}
							}
						}
					}
				}
			}

			if = {
			limit = {
				var:dlm_use_court_champion = 1
				exists = scope:dlm_selected_court_champion
				scope:dlm_selected_court_champion = { is_alive = yes }
			}
			scope:dlm_selected_court_champion = {
				if = {
					limit = { NOT = { has_trait = dlm_gladiator } }
					add_trait = dlm_gladiator
				}
				if = {
					limit = { var:dlm_court_champion_defeated = 1 }
					random_list = {
						40 = {
							if = {
								limit = { NOT = { has_trait = wounded_1 } }
								add_trait = wounded_1
							}
						}
						15 = {
							if = {
								limit = { NOT = { has_trait = scarred } }
								add_trait = scarred
							}
						}
						5 = {
							if = {
								limit = { NOT = { has_trait = one_eyed } }
								add_trait = one_eyed
							}
						}
						5 = {
							if = {
								limit = { NOT = { has_trait = disfigured } }
								add_trait = disfigured
							}
						}
						35 = { }
					}
				}
				else = {
					random_list = {
						5 = {
							if = {
								limit = { NOT = { has_trait = lifestyle_blademaster } }
								add_trait = lifestyle_blademaster
							}
						}
						15 = {
							if = {
								limit = { NOT = { has_trait = scarred } }
								add_trait = scarred
							}
						}
						80 = { }
					}
				}
			}
		}

	}
}

dlm_release_colosseum_survivors_effect = {
	if = {
		limit = {
			exists = scope:dlm_arena_visitor_1
			scope:dlm_arena_visitor_1 = { is_alive = yes }
		}
			if = {
				limit = { var:dlm_colosseum_games_style = 2 }
				random_list = {
					75 = {
						add_visiting_courtier = scope:dlm_arena_visitor_1
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_1
							}
						}
					}
					25 = { }
				}
			}
			else_if = {
				limit = { var:dlm_colosseum_games_style = 3 }
				random_list = {
					25 = {
						add_visiting_courtier = scope:dlm_arena_visitor_1
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_1
							}
						}
					}
					75 = { }
				}
			}
			else = {
				random_list = {
					50 = {
						add_visiting_courtier = scope:dlm_arena_visitor_1
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_1
							}
						}
					}
					50 = { }
				}
			}
	}
	if = {
		limit = {
			exists = scope:dlm_arena_visitor_2
			scope:dlm_arena_visitor_2 = { is_alive = yes }
		}
			if = {
				limit = { var:dlm_colosseum_games_style = 2 }
				random_list = {
					75 = {
						add_visiting_courtier = scope:dlm_arena_visitor_2
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_2
							}
						}
					}
					25 = { }
				}
			}
			else_if = {
				limit = { var:dlm_colosseum_games_style = 3 }
				random_list = {
					25 = {
						add_visiting_courtier = scope:dlm_arena_visitor_2
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_2
							}
						}
					}
					75 = { }
				}
			}
			else = {
				random_list = {
					50 = {
						add_visiting_courtier = scope:dlm_arena_visitor_2
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_2
							}
						}
					}
					50 = { }
				}
			}
	}
	if = {
		limit = {
			exists = scope:dlm_arena_visitor_3
			scope:dlm_arena_visitor_3 = { is_alive = yes }
		}
			if = {
				limit = { var:dlm_colosseum_games_style = 2 }
				random_list = {
					75 = {
						add_visiting_courtier = scope:dlm_arena_visitor_3
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_3
							}
						}
					}
					25 = { }
				}
			}
			else_if = {
				limit = { var:dlm_colosseum_games_style = 3 }
				random_list = {
					25 = {
						add_visiting_courtier = scope:dlm_arena_visitor_3
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_3
							}
						}
					}
					75 = { }
				}
			}
			else = {
				random_list = {
					50 = {
						add_visiting_courtier = scope:dlm_arena_visitor_3
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_3
							}
						}
					}
					50 = { }
				}
			}
	}
	if = {
		limit = {
			exists = scope:dlm_arena_visitor_4
			scope:dlm_arena_visitor_4 = { is_alive = yes }
		}
			if = {
				limit = { var:dlm_colosseum_games_style = 2 }
				random_list = {
					75 = {
						add_visiting_courtier = scope:dlm_arena_visitor_4
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_4
							}
						}
					}
					25 = { }
				}
			}
			else_if = {
				limit = { var:dlm_colosseum_games_style = 3 }
				random_list = {
					25 = {
						add_visiting_courtier = scope:dlm_arena_visitor_4
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_4
							}
						}
					}
					75 = { }
				}
			}
			else = {
				random_list = {
					50 = {
						add_visiting_courtier = scope:dlm_arena_visitor_4
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_4
							}
						}
					}
					50 = { }
				}
			}
	}
	if = {
		limit = {
			exists = scope:dlm_arena_visitor_5
			scope:dlm_arena_visitor_5 = { is_alive = yes }
		}
			if = {
				limit = { var:dlm_colosseum_games_style = 2 }
				random_list = {
					75 = {
						add_visiting_courtier = scope:dlm_arena_visitor_5
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_5
							}
						}
					}
					25 = { }
				}
			}
			else_if = {
				limit = { var:dlm_colosseum_games_style = 3 }
				random_list = {
					25 = {
						add_visiting_courtier = scope:dlm_arena_visitor_5
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_5
							}
						}
					}
					75 = { }
				}
			}
			else = {
				random_list = {
					50 = {
						add_visiting_courtier = scope:dlm_arena_visitor_5
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_5
							}
						}
					}
					50 = { }
				}
			}
	}
	if = {
		limit = {
			exists = scope:dlm_arena_visitor_6
			scope:dlm_arena_visitor_6 = { is_alive = yes }
		}
			if = {
				limit = { var:dlm_colosseum_games_style = 2 }
				random_list = {
					75 = {
						add_visiting_courtier = scope:dlm_arena_visitor_6
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_6
							}
						}
					}
					25 = { }
				}
			}
			else_if = {
				limit = { var:dlm_colosseum_games_style = 3 }
				random_list = {
					25 = {
						add_visiting_courtier = scope:dlm_arena_visitor_6
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_6
							}
						}
					}
					75 = { }
				}
			}
			else = {
				random_list = {
					50 = {
						add_visiting_courtier = scope:dlm_arena_visitor_6
						scope:activity = {
							add_activity_log_entry = {
								key = dlm_colosseum_survivor_joined_key
								character = scope:dlm_arena_visitor_6
							}
						}
					}
					50 = { }
				}
			}
	}
}

dlm_sync_colosseum_gladiators_effect = {
	while = {
		limit = { "number_maa_regiments_of_type(dlm_colosseum_gladiators)" > 0 }
		random_maa_regiment = {
			limit = {
				is_title_maa_regiment = no
				is_maa_type = dlm_colosseum_gladiators
			}
			destroy_maa_regiment = yes
		}
	}
}
