﻿council_defend_claim = {
	icon = extoll_reign_intent
	scripted_animation = { animation = aggressive_spear }

	auto_complete = yes

	is_valid = {
		this = involved_activity.activity_host
	}
}

council_weaken_pretender = {
	icon = isolate_opponents_intent
	scripted_animation = { animation = personality_vengeful }

	auto_complete = yes

	is_valid = {
		this = involved_activity.activity_host
	}
}

council_press_claim = {
	icon = profess_rights_intent
	scripted_animation = { animation = debating }

	auto_complete = yes

	is_valid = {
		this = involved_activity.special_guest:the_pretender
	}
}

council_support_host = {
	icon = altruism_intent
	scripted_animation = { animation = admiration }

	auto_complete = yes

	is_valid = {
		this != involved_activity.activity_host
		this != involved_activity.special_guest:the_pretender
		is_lowborn = no
	}

	ai_will_do = {
		value = 50
		if = {
			limit = {
				has_character_flag = pledged_to_heir
				involved_activity.special_guest:the_pretender = {
					has_character_flag = active_crisis_rebel
				}
			}
			add = 1000
		}
		if = {
			limit = {
				has_character_flag = pledged_to_claimant
				involved_activity.activity_host = {
					has_character_flag = active_crisis_rebel
				}
			}
			add = 1000
		}
		
		# Relationship Modifiers
		if = {
			limit = {
				OR = {
					has_relation_lover = involved_activity.activity_host
					has_relation_soulmate = involved_activity.activity_host
				}
			}
			add = 200
		}
		if = {
			limit = {
				OR = {
					has_relation_friend = involved_activity.activity_host
					has_relation_best_friend = involved_activity.activity_host
				}
			}
			add = 150
		}
		if = {
			limit = {
				is_close_family_of = involved_activity.activity_host
			}
			add = 100
		}
		if = {
			limit = {
				is_allied_to = involved_activity.activity_host
			}
			add = 200
		}

		# Demographic Modifiers
		if = {
			limit = {
				faith = involved_activity.activity_host.faith
			}
			add = 50
		}
		if = {
			limit = {
				involved_activity.activity_host = { is_male = yes }
			}
			add = 25
		}
		if = {
			limit = {
				involved_activity.activity_host = { is_female = yes }
			}
			subtract = 25
		}
		if = {
			limit = {
				involved_activity.activity_host = { age < 30 }
			}
			add = 25
		}
		if = {
			limit = {
				involved_activity.activity_host = { age >= 50 }
			}
			subtract = 25
		}
		
		# Host Diplomacy Skill
		if = {
			limit = {
				involved_activity.activity_host = {
					diplomacy >= 10
				}
			}
			add = 50
		}
		if = {
			limit = {
				involved_activity.activity_host = {
					diplomacy >= 15
				}
			}
			add = 50
		}

		# Opinion Checks
		if = {
			limit = {
				exists = involved_activity.activity_host
				opinion = {
					target = involved_activity.activity_host
					value >= 25
				}
			}
			add = 50
		}
		if = {
			limit = {
				exists = involved_activity.activity_host
				opinion = {
					target = involved_activity.activity_host
					value < 0
				}
			}
			subtract = 25
		}

		# Rivals never support
		if = {
			limit = {
				OR = {
					has_relation_rival = involved_activity.activity_host
					has_relation_nemesis = involved_activity.activity_host
				}
			}
			multiply = 0
		}
	}
}

council_support_pretender = {
	icon = disrupt_loyalists_intent
	scripted_animation = { animation = scheme }

	auto_complete = yes

	is_valid = {
		this != involved_activity.activity_host
		this != involved_activity.special_guest:the_pretender
		is_lowborn = no
	}

	ai_will_do = {
		value = 40
		if = {
			limit = {
				has_character_flag = pledged_to_claimant
				involved_activity.special_guest:the_pretender = {
					has_character_flag = active_crisis_rebel
				}
			}
			add = 1000
		}
		if = {
			limit = {
				has_character_flag = pledged_to_heir
				involved_activity.activity_host = {
					has_character_flag = active_crisis_rebel
				}
			}
			add = 1000
		}

		# Relationship Modifiers
		if = {
			limit = {
				OR = {
					has_relation_lover = involved_activity.special_guest:the_pretender
					has_relation_soulmate = involved_activity.special_guest:the_pretender
				}
			}
			add = 200
		}
		if = {
			limit = {
				OR = {
					has_relation_friend = involved_activity.special_guest:the_pretender
					has_relation_best_friend = involved_activity.special_guest:the_pretender
				}
			}
			add = 150
		}
		if = {
			limit = {
				is_close_family_of = involved_activity.special_guest:the_pretender
			}
			add = 100
		}
		if = {
			limit = {
				is_allied_to = involved_activity.special_guest:the_pretender
			}
			add = 200
		}

		# Demographic Modifiers
		if = {
			limit = {
				faith = involved_activity.special_guest:the_pretender.faith
			}
			add = 50
		}
		if = {
			limit = {
				involved_activity.special_guest:the_pretender = { is_male = yes }
			}
			add = 25
		}
		if = {
			limit = {
				involved_activity.special_guest:the_pretender = { is_female = yes }
			}
			subtract = 25
		}
		if = {
			limit = {
				involved_activity.special_guest:the_pretender = { age < 30 }
			}
			add = 25
		}
		if = {
			limit = {
				involved_activity.special_guest:the_pretender = { age >= 50 }
			}
			subtract = 25
		}
		
		# Pretender Diplomacy Skill
		if = {
			limit = {
				involved_activity.special_guest:the_pretender = {
					diplomacy >= 10
				}
			}
			add = 50
		}
		if = {
			limit = {
				involved_activity.special_guest:the_pretender = {
					diplomacy >= 15
				}
			}
			add = 50
		}

		# Personality and Opinion Checks
		if = {
			limit = {
				exists = involved_activity.activity_host
				opinion = {
					target = involved_activity.activity_host
					value < 0
				}
			}
			add = 25
		}
		if = {
			limit = {
				exists = involved_activity.special_guest:the_pretender
				opinion = {
					target = involved_activity.special_guest:the_pretender
					value >= 25
				}
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = deceitful
			}
			add = 50
		}

		# Rivals never support
		if = {
			limit = {
				OR = {
					has_relation_rival = involved_activity.special_guest:the_pretender
					has_relation_nemesis = involved_activity.special_guest:the_pretender
				}
			}
			multiply = 0
		}
	}
}

council_opportunist = {
	icon = seize_advantages_intent
	scripted_animation = { animation = interested }

	auto_complete = yes

	is_valid = {
		this != involved_activity.activity_host
		this != involved_activity.special_guest:the_pretender
	}

	ai_will_do = {
		value = 25
		if = {
			limit = {
				OR = {
					has_trait = ambitious
					has_trait = greedy
					has_trait = deceitful
				}
			}
			add = 50
		}
	}
}

council_bear_witness = {
	icon = bear_witness_intent
	scripted_animation = { animation = admiration }

	auto_complete = yes

	is_valid = {
		this != involved_activity.activity_host
		this != involved_activity.special_guest:the_pretender
	}

	ai_will_do = {
		value = 25
		if = {
			limit = { is_lowborn = yes }
			add = 10000
		}
		if = {
			limit = {
				has_trait = content
			}
			add = 25
		}
		if = {
			limit = {
				exists = involved_activity.activity_host
				opinion = {
					target = involved_activity.activity_host
					value < 0
				}
			}
			subtract = 50
		}
	}
}