society_decisions = { #only available to members of a society
	dragonkin_society_artefact_hunt = {
		ai_check_interval = 3

		potential = {
			society_member_of = dragonkin_society #which society
		}

		allow = {
			has_society_currency_minor_trigger = yes
			custom_tooltip = {
				text = tooltip_not_busy
				hidden_trigger = {
					block_general_event_trigger = no
				}
			}
			custom_tooltip = {
				text = artefact_hunt_cooldown_timer_tooltip
				hidden_trigger = {
					NOT = {
						has_character_modifier = artefact_hunt_decision_cooldown_timer
					}
				}
			}
		}

		effect = {
			custom_tooltip = {
				text = dragonkin_society_artefact_hunt_tooltip
			}
			add_character_modifier = {
				modifier = artefact_hunt_decision_cooldown_timer
				years = 5
				hidden = yes
			}
			character_event = { id = DRAGONKIN.260 }
		}

		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1

			modifier = { # slow down
				factor = 0.1
			}

			modifier = {
				factor = 0.2
				num_of_artifacts = 3
			}

			modifier = {
				factor = 0.2
				num_of_artifacts = 5
			}

			modifier = {
				factor = 0
				is_ruler = no
			}

			modifier = {
				factor = 0.01
				war = yes
			}
		}
	}
	
	dragonkin_society_resist_evil = {
		ai_check_interval = 3

		potential = {
			society_member_of = dragonkin_society #which society
		}

		allow = {
			OR = {
				has_quest = quest_dragonkin_society_resist_evil
				custom_tooltip = {
					text = resist_evil_decision_necessary_tooltip
					hidden_trigger = {
						OR = {
							trait = cannibal
							trait = craven
							trait = depressed
							trait = lunatic
							trait = paranoid
							trait = possessed
							trait = stressed
						}
					}
				}
			}
			custom_tooltip = {
				text = resist_evil_decision_cooldown_timer_tooltip
				hidden_trigger = {
					NOT = {
						has_character_modifier = resist_evil_decision_cooldown_timer
					}
				}
			}
			custom_tooltip = {
				text = tooltip_not_busy
				hidden_trigger = {
					OR = {
						block_general_event_trigger = no
					}
				}
			}
		}

		effect = {
			custom_tooltip = {
				text = dragonkin_society_resist_evil_tooltip
			}
			add_character_modifier = {
				modifier = resist_evil_decision_cooldown_timer
				years = 5
				hidden = yes
			}
			character_event = { id = DRAGONKIN.250 }
		}

		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0.01
				war = yes
			}
		}
	}
	
	dragonkin_society_amass_wealth_complete = {
		is_high_prio = yes
	
		potential = {
			society_member_of = dragonkin_society
			has_quest = quest_dragonkin_society_amass_wealth
		}

		allow = {
			wealth = 500
		}

		effect = {
			custom_tooltip = {
				text = dragonkin_society_amass_wealth_complete_tooltip
			}
			character_event = { id = DRAGONKIN.152 }
		}

		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	dragonkin_society_become_dragon = {
		is_high_prio = yes
	
		potential = {
			society_member_of = dragonkin_society
			has_quest = quest_dragonkin_society_become_dragon
			NOT = { has_character_flag = becoming_dragon }
		}
		
		effect = {
			custom_tooltip = {
				text = dragonkin_society_become_dragon_tooltip
			}
			character_event = { id = DRAGONKIN.220 }
			set_character_flag = becoming_dragon
			increase_visibility_effect = yes
		}
		
		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 1
		}
	}
}

targeted_decisions = {
	dragonkin_society_master_of_flame = {
		is_in_society = yes
		
		filter = self
		ai_target_filter = self
		ai_check_interval = 12
		
		potential = {
			character = FROM
			is_playable = yes
			is_adult = yes
			society_member_of = dragonkin_society
			society_rank >= 2
			NOT = { has_character_flag = choosing_warrior_training } #to stop you spamming the button
			NOT = { trait = master_of_flame }
		}
		
		allow = {
			has_society_currency_minor_trigger = yes
			NOT = { trait = master_of_flame }
		}
		
		effect = {
			hidden_tooltip = {
				character_event = { id = DRAGONKIN.221 }
			}
			set_character_flag = choosing_warrior_training
			detract_society_currency_minor_effect = yes
			increase_visibility_minor_effect = yes
		}
		
		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				lifestyle_traits = 1
			}
		}
	}
	
	dragonkin_society_dragonheart = {
		is_in_society = yes
		
		filter = self
		ai_target_filter = self
		ai_check_interval = 12
		
		potential = {
			character = FROM
			is_playable = yes
			is_adult = yes
			society_member_of = dragonkin_society
			society_rank >= 2
			NOT = { has_character_flag = gaining_dragonheart } #to stop you spamming the button
			NOT = { has_character_modifier = dragonkin_dragonheart }
		}
		
		allow = {
			has_society_currency_medium_trigger = yes
			NOT = { has_character_modifier = dragonkin_dragonheart }
		}
		
		effect = {
			hidden_tooltip = {
				character_event = { id = DRAGONKIN.222 }
			}
			set_character_flag = gaining_dragonheart
			detract_society_currency_medium_effect = yes
			increase_visibility_minor_effect = yes
		}
		
		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 1
		}
	}
	
	dragonkin_society_burn_incense = {
		is_in_society = yes
		
		filter = self
		ai_target_filter = self
		ai_check_interval = 10

		potential = {
			character = FROM
			society_member_of = dragonkin_society
			society_rank >= 3
			NOT = { has_character_flag = burning_dragon_incense }
		}
		
		allow = {
			culture = dragon_culture
			has_society_currency_minor_trigger = yes
		}

		effect = {
			custom_tooltip = {
				text = dragonkin_society_burn_incense_tooltip
				character_event = { id = DRAGONKIN.290 }
			}
			set_character_flag = burning_dragon_incense
			detract_society_currency_minor_effect = yes
			increase_visibility_minor_effect = yes
		}

		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1

			modifier = { # slow down
				factor = 0.01
			}

			modifier = {
				factor = 2
				is_ruler = no
			}

			modifier = {
				factor = 0.01
				war = yes
			}
		}
	}
	
	dragonkin_society_induct_descendant = {
		
	    only_playable = yes
	    is_high_prio = yes
		ai_check_interval = 36
	    
	    from_potential = {
	        is_playable = yes
	        is_adult = yes
	        prisoner = no
			has_regent = no
	        is_inaccessible_trigger = no
			society_member_of = dragonkin_society
			has_quest = quest_dragonkin_society_induct_child
			NOT = { has_character_modifier = induct_into_society_cooldown_timer }
	    }
	    
	    potential = {
        	NOT = { character = FROM }
	        prisoner = no
			is_descendant_of = FROM
	    }
	    
	    allow = {
		    age = 6
			custom_tooltip = {
				text = induct_descendant_not_in_society_tooltip
				hidden_tooltip = {
					interested_in_society = none
				}
			}
			is_in_society = no
	        is_inaccessible_trigger = no
	        custom_tooltip = {
	            text = characters_are_not_busy_tt
	            hidden_tooltip = {
	                FROM = {
	                    NOT = { has_character_flag = do_not_disturb }
	                    NOT = { war = yes }
	                }
	                NOT = { has_character_flag = do_not_disturb }
	                NOT = { war = yes }
	            }
	        }
	        trigger_if = {
	        	limit = { NOT = { is_within_diplo_range = FROM } }
	        	is_within_diplo_range = FROM # CPU HEAVY!
	        }
	    }
	    
	    effect = {
	    	save_event_target_as = new_recruit
	    	set_character_flag = society_join_block
			
	    	FROM = {
				add_character_modifier = {
					name = induct_into_society_cooldown_timer
					hidden = yes
					years = 20
				}
			}

			hidden_tooltip = {
				if = { # anon letter
					limit = {
						is_adult = yes
					}
					FROM = {
						character_event = { id = DRAGONKIN.800 }
					}
				}
				if = { # egg sigil
					limit = {
						is_adult = no
						graphical_culture = dragongfx
					}
					FROM = {
						character_event = { id = DRAGONKIN.804 }
					}
				}
				if = { # bedtime stories
					limit = {
						is_adult = no
						NOT = { graphical_culture = dragongfx }
					}
					FROM = {
						character_event = { id = DRAGONKIN.808 }
					}
				}
			}
	    }
	    
	    revoke_allowed = {
	        always = no
	    }
	    ai_will_do = {
	        factor = 1
	    }
	}
}

title_decisions = {
	# Rank 4 Power - Convert County
	dragonkin_society_culture_convert_county = {
		only_playable = yes
		ai_check_interval = 3
		
		from_potential = {
			is_ruler = yes
			society_member_of = dragonkin_society
			society_rank == 4
		}
		
		potential = {
			tier = COUNT
			location = { NOT = { culture = dragon_culture } }
			holder_scope = {
				OR = {
					is_liege_or_above = FROM
					character = FROM
				}
			}
		}
		
		allow = {
			FROM = {
				society_currency >= 1000
				culture = dragon_culture 
			}
			location = {
				NOT = { culture = dragon_culture }
				owner = { NOT = { culture = PREV } } # Cannot convert counties of owners who has that culture
			}
		}
		
		effect = {
			FROM = {
				change_society_currency = -1000
				hidden_tooltip = { character_event = { id = DRAGONKIN.230 } }
				increase_visibility_effect = yes
			}
			location = {
				culture = dragon_culture
				add_province_modifier = {
					name = peasant_unrest
					years = 10
				}
			}
			hidden_tooltip = {
				if = { # Notify county owner
					limit = {
						holder_scope = { NOT = { character = dragon_culture } }
					}
					holder_scope = { character_event = { id = DRAGONKIN.231 } }
				}
			}
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	# Rank 4 Power - Remove Lawless Presence
	dragonkin_society_improve_province = {
		only_playable = yes
		ai_check_interval = 3
		
		from_potential = {
			is_ruler = yes
			society_member_of = dragonkin_society
			society_rank == 4
		}
		
		potential = {
			tier = COUNT
			location = {
				culture = dragon_culture
				OR = {
					has_province_modifier = thieves_guild
					has_province_modifier = smugglers_ring
					has_province_modifier = highway_robber_band
				}
			}
			holder_scope = {
				OR = {
					is_liege_or_above = FROM
					character = FROM
				}
			}
		}
		
		allow = {
			FROM = {
				has_society_currency_major_trigger = yes
			}
		}
		
		effect = {
			FROM = {
				detract_society_currency_major_effect = yes
				hidden_tooltip = { character_event = { id = DRAGONKIN.280 } }
				increase_visibility_effect = yes
			}
			location = {
				if = {
					limit = { has_province_modifier = thieves_guild }
					remove_province_modifier = thieves_guild
				}
				if = {
					limit = { has_province_modifier = smugglers_ring }
					remove_province_modifier = smugglers_ring
				}
				if = {
					limit = { has_province_modifier = highway_robber_band }
					remove_province_modifier = highway_robber_band
				}
			}
		}
		
		ai_will_do = {
			factor = 1
			modifier = { # no point using this while broke
				factor = 0
				NOT = { wealth = 1 }
			}
		}
	}
}

settlement_decisions  =
{
	dragonkin_society_hidden_vault = {
		filter = owned
		ai_target_filter = owned
		ai_check_interval = 3
		
		from_potential = {
			is_ruler = yes
			society_member_of = dragonkin_society
		}
		
		potential = {
			holding_type = castle
			NOT = {
				has_holding_modifier = dragonkin_hidden_vault
			}
			holder_scope = {
				character = FROM
			}
		}
		
		allow = {
			FROM = {
				has_society_currency_minor_trigger = yes
			}
		}
		
		effect = {
			FROM = { 
				show_scope_change = no
				detract_society_currency_minor_effect = yes
				increase_visibility_effect = yes
				hidden_tooltip = {
					character_event = { id = DRAGONKIN.240 }
				}
			}
			add_holding_modifier = {
				name = dragonkin_hidden_vault
				years = 50
			}
		}
		
		ai_will_do = {
			factor = 0.1
		}
	}
}