﻿convert_court_artifact_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}
	
	cooldown = { days = standard_commission_artifact_cooldown_time }
	sort_order = 100
	
	is_shown = {
		is_landed = yes
		highest_held_title_tier >= tier_county
		exists = capital_province
		has_dlc_feature = royal_court
		
	}
	
	is_valid = {
		has_royal_court = yes
		custom_description = {
			text = has_non_euipped_artifact_tt
			any_character_artifact = {
				is_equipped = no
				ep1_artifact_is_court_artifact_trigger = yes
			}
		}
	}
	

	effect = {
		custom_tooltip = has_non_euipped_artifact_tt2
		every_character_artifact = {
			limit = {
				is_equipped = no
				ep1_artifact_is_court_artifact_trigger = yes
			}
			reforge_artifact ={
				type = court_i
			}
		}
	}

	ai_check_interval = 0
	

	ai_will_do = {
		base = 0
	}
}



combine_relic_weapon_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}
	
	cooldown = { days = standard_commission_artifact_cooldown_time }
	sort_order = 100
	
	is_shown = {
		is_landed = yes
		highest_held_title_tier >= tier_county
		exists = capital_province
		has_dlc_feature = royal_court
		
	}
	
	is_valid = {
		custom_description = {
			text = has_euipped_weapon_tt
			any_character_artifact = {
				artifact_slot_type = primary_armament
				is_equipped = yes
			}
		}
		custom_description = {
			text = has_relic_tt
			any_character_artifact = {
				exists = var:relic
				artifact_slot_type = court_i_slot
				is_equipped = yes
			}
		}

		employs_court_position = antiquarian_court_position
	}
	

	effect = {
		custom_tooltip = embed_weapon_tt
		trigger_event = rhox_artifact_event.1
		random_character_artifact = {
			limit = {
				artifact_slot_type = primary_armament
				is_equipped = yes
			}
			if ={
				limit = {
					OR = {
						NOT = { has_variable = enhanced_number }	
						var:enhanced_number<=1
					}	
				}
				custom_tooltip = rhox_combine_cost_1_tt
			}
			else_if ={
				limit = {
					var:enhanced_number<=4
				}
				custom_tooltip = rhox_combine_cost_2_tt
			}
			else ={
				custom_tooltip = rhox_combine_cost_3_tt
			}
		}
	}

	ai_check_interval = 0
	

	ai_will_do = {
		base = 0
	}
}

combine_historic_armor_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}
	
	cooldown = { days = standard_commission_artifact_cooldown_time }
	sort_order = 100
	
	is_shown = {
		is_landed = yes
		highest_held_title_tier >= tier_county
		exists = capital_province
		has_dlc_feature = royal_court
		
	}
	
	is_valid = {
		custom_description = {
			text = has_euipped_armor_tt
			any_character_artifact = {
				artifact_slot_type = armor
				is_equipped = yes
			}
		}
		custom_description = {
			text = has_historical_unique_tt
			any_character_artifact = {
				exists = var:historical_unique_artifact
				artifact_slot_type = court_i_slot
				is_equipped = yes
			}
		}

		employs_court_position = antiquarian_court_position
	}
	

	effect = {
		custom_tooltip = attach_armor_tt
		trigger_event = rhox_artifact_event.2
		random_character_artifact = {
			limit = {
				artifact_slot_type = armor
				is_equipped = yes
			}
			if ={
				limit = {
					OR = {
						NOT = { has_variable = enhanced_number }	
						var:enhanced_number<=1
					}	
				}
				custom_tooltip = rhox_combine_cost_1_tt
			}
			else_if ={
				limit = {
					var:enhanced_number<=4
				}
				custom_tooltip = rhox_combine_cost_2_tt
			}
			else ={
				custom_tooltip = rhox_combine_cost_3_tt
			}
		}
	}

	ai_check_interval = 0
	

	ai_will_do = {
		base = 0
	}
}



upgrade_artifact_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}
	
	cooldown = { days = standard_commission_artifact_cooldown_time }
	sort_order = 100
	
	is_shown = {
		is_landed = yes
		highest_held_title_tier >= tier_county
		exists = capital_province
		has_dlc_feature = royal_court
		
	}
	
	is_valid = {
		custom_description = {
			text = has_valid_artifact_for_upgrade_tt
			any_character_artifact = {
				NOT = {
					exists = var:historical_unique_artifact
				}
				rarity = illustrious
				artifact_has_room_for_improvement = yes
				is_equipped = yes
			}
		}
		custom_description = {
			text = has_valid_courtier_for_upgrade_tt
			OR = {
				any_courtier_or_guest = {
					rhox_artifact_4040_relevant_courtier_trigger = yes
				}
				any_knight = {
					rhox_artifact_4040_relevant_courtier_trigger = yes
				}
			}
		}
		
		
	}
	

	effect = {
		trigger_event = rhox_upgrade_artifact_event.1
	}

	ai_check_interval = 0
	

	ai_will_do = {
		base = 0
	}
}




sell_all_unused_artifact_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}
	
	cooldown = { days = standard_commission_artifact_cooldown_time }
	sort_order = 100
	
	is_shown = {
		is_landed = yes
		highest_held_title_tier >= tier_county
		exists = capital_province
		has_dlc_feature = royal_court
	}
	
	is_valid = {
		custom_description = {
			text = any_unequipped_artifact_tt
			any_character_artifact = {
				is_equipped = no
			}
		}
	}
	

	effect = {
		every_character_artifact = {
			limit = {
				is_equipped = no
			}
			save_scope_as = this_artifact
			root = {
				add_gold = {
					value = scope:this_artifact.artifact_wealth_quality_average_value
					multiply = 3.5
				}
			}
			destroy_artifact = scope:this_artifact
			
		}
		
	}

	ai_check_interval = 0
	

	ai_will_do = {
		base = 0
	}
}