# Targeted decisions are possible vs _all_ other characters and shown are in the Diplomacy View, not the Intrigue View. The taker is in the FROM scope.
#
# filter = [self/court/home_court/vassals/sub_realm/realm/dynasty/all] ('self' MUST be set for decisions targeting only the taker, the other filter types can be set to lessen CPU load)
# ai_target_filter = [self/court/home_court/vassals/sub_realm/realm/dynasty/all] (which characters for which the AI evaluates the decision.)
#	court: all characters in the AI's host court, including prisoners, and characters currently away (wards, prisoners, etc)
#	home_court: all characters in the AI's home court, including prisoners, and characters currently away (wards, prisoners, etc)
#	vassals: direct vassal rulers of the AI's employer
#	sub_realm: all characters below the AI's employer
#	realm: all characters in the same top realm as the AI
#	dynasty: all members of the same dynasty
#	rivals: your rivals plus any character you have an opinion modifier with 'crime = yes' set (the same set of characters the 'is_foe' trigger evaluates)
#	all: all living characters (Avoid if possible. VERY CPU-HEAVY!)
#	


targetted_decisions = {

	create_titular_republic_vassal = {
		only_playable = yes
		filter = vassals				# Only those under me
		ai_target_filter = vassals		# Only those under me
		
		from_potential = {
			is_playable = yes
			is_feudal = yes
			independent = yes
			higher_tier_than = DUKE
			NOT = {
				num_of_government_vassals = {
					government = merchant_republic_government
					value = 1
				}
			}
			NOT = { has_character_flag = preparing_cash_cow }
			NOT = { has_character_flag = recently_dead_cash_cow }
		}
		
		potential = {
			vassal_of = FROM
			is_adult = yes
			is_landed = yes
			is_inaccessible_or_incapable_trigger = no
			was_conceived_a_bastard = no
			government = republic_government
			tier = COUNT
			capital_scope = {
				port = yes
			}
			capital_holding = { # rare, but in case of mayor holds castle as his capital
				holding_type = city
			}
		}
		
		allow = {
			FROM = {
				wealth = 500
			}
			war = no
			custom_tooltip = {
				text = TT_NOT_UNREFORMED_PAGAN
				hidden_tooltip = {
					OR = {
						NOT = { religion_group = pagan_group }
						is_reformed_religion = yes
					}
				}
			}
		}
		
		effect = {
			FROM = {
				set_character_flag = preparing_cash_cow
				set_character_flag = recently_dead_cash_cow 
				character_event = { id = MBF.2 }
				transfer_scaled_wealth = {
					to = ROOT
					value = 5.0
					min = 500
					max = 500
				}
			}
			give_minor_title = title_princeps_officii
		}
		
		ai_will_do = {
			factor = 0
		}
	}
}