﻿agot_pay_homage_decision_ai_potential = {
    NOT = { liege = { has_character_flag = no_homage } }
	NOT = { has_trait = ruin }
}

agot_wedding_bouns_location = {
    OR = {
        has_building = agot_summerhall_01
        has_building = agot_summerhall_ruins_02
        has_building_or_higher = holy_site_great_sept_01
        has_building_or_higher = holy_site_starry_sept_01
    }
}

agot_wedding_stress_bouns_location = {
    OR = {
        has_building_or_higher = holy_site_great_sept_01
        has_building_or_higher = holy_site_starry_sept_01
    }
}

agot_basic_is_available_ai = {
	#AGOT Added
	is_human = yes
	agot_is_available_for_anything = yes
	#AGOT Added cause mutes should get less events really but we might change it later
	NOT = { has_trait = mute }
}
agot_is_available_allow_travelling = {
	# AGOT Added my maesters keep leaving me ;-;
	NOR = {
		has_trait = archmaester
		AND = {
			has_trait = maester
			has_trait_xp = {
				trait = maester
				value < 100
			}
		}
		has_character_flag = maester_researcher
	}
	is_human = yes # Non-humans shouldn't do anything not specifically handled in their own case
}
agot_is_physically_able = {
    #AGOT Added
	agot_is_available_for_anything = yes
	is_human = yes
	NOT = { has_trait = mute } #mutes should get less events
	NOT = { agot_is_fake_dead = yes }
	NOT = { has_variable = agot_rr_is_companion_leader }
	# Councillors performing tasks at a target court are not available
	# even if the task is at their home court and they are not traveling
	NOT = { has_variable = agot_councillor_target_court }
	NOT = { any_owned_story = { story_type = multi_duel_duelist_story } } #currently in a Trial of Seven
}
agot_court_position_does_not_already_have_a_job_trigger = {
    OR = {
		has_court_position = household_guard_court_position
		has_court_position = bloodrider_court_position
		has_court_position = gaoler_court_position
		has_court_position = harbormaster_court_position
		has_court_position = court_smith_court_position
		has_court_position = head_dragonkeeper_court_position
		has_court_position = first_sword_court_position
    }
}
agot_can_marry_common_trigger = {
	#AGOT Added
	is_human = yes
	NOR = {
		has_trait = kingsguard
		has_trait = nightswatch
		has_trait = maester
		AND = {
			OR = {
				has_trait = septon
				has_trait = red_priest
				has_trait = drowned_man
				has_trait = bearded_priest
			}
			faith = {
				has_doctrine = doctrine_clerical_marriage_disallowed
			}
		}
		has_character_modifier = reluctant_bride_modifier
	}
}
agot_can_raid_across_water_trigger = {
	OR = {
		government_has_flag = government_is_pirate_trigger_check
		faith = { has_doctrine_parameter = faith_can_raid_overseas }
	}
}
agot_can_be_commander_basic_trigger_early_access = {
    age >= 14
    is_current_dragonrider_warfare = yes
}
agot_cannot_be_commander_basic_trigger = {
    OR = {
		has_character_flag = agot_is_at_unknown_place
		has_trait = maester
		NOT = { is_human = yes } # TT error if trigger not formatted this way
    }
}
agot_can_be_commander_basic_trigger_as_owner = {
    OR = {
		has_trait = education_martial_prowess
		is_current_dragonrider_warfare = yes
    }
}
agot_can_be_commander_basic_trigger = {
    OR = {
		is_ai = yes
		AND = {
			OR = {
				this = $ARMY_OWNER$
				NOT = { has_character_flag = cannot_be_knight_and_commander }
			}
			is_travelling = no
			NOT = { exists = involved_activity }
		}	
	}
}
# other mod might use same key
agot_is_human = {
	is_human = yes
}
agot_can_be_combatant_based_on_gender_trigger = {
	OR = {
		has_trait = dragon
		is_current_dragonrider_warfare = yes
	}
}
agot_can_be_combatant_based_on_gender_trigger_additional_limit = {
	#AGOT Added
	trigger_if = {
		limit = {
			$ARMY_OWNER$ = { faith = { has_doctrine_parameter = men_cannot_fight } }
		}
		is_female = yes
	}
	trigger_if = {
		limit = {
			$ARMY_OWNER$ = { culture = { has_cultural_parameter = martial_custom_male_only_combatant } }
			is_female = yes
			$ARMY_OWNER$ = { faith = { has_doctrine_parameter = women_can_fight_if_they_have_martial } }
		}
		OR = {
			martial >= high_skill_rating
			prowess >= high_skill_rating
		}
	}
}
