plot_decisions = {

	faction_guelphs_ultimatum = {
		is_high_prio = yes
		
		potential = {
			leads_faction = faction_guelphs
			OR = {
				NOT = { has_character_flag = faction_guelphs_ultimatum_taken }
				had_character_flag = { flag = faction_guelphs_ultimatum_taken days = 7 }
			}
		}
		allow = {
			war = no
			prisoner = no
			liege = {
				NOT = { war_with = ROOT }
				NOT = { reverse_has_truce = ROOT }
			}

			capital_holding = {
				controller = {
					character = ROOT
				}
			}
		}
		effect = {
			liege = {
				letter_event = { id = guelphs_ghibellines.6 days = 3 tooltip = "The Emperor will receive our ultimatum" }
			}
			hidden_tooltip = {
				set_character_flag = faction_guelphs_ultimatum_taken
			}
		}
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.5 # Slow it down a bit
			}
			
			modifier = {
				factor = 0
				NOT = { 
					faction_power = 
					{
						faction = faction_guelphs
						power = 1.25
					}
				}
			}
			
			modifier = {
				factor = 0
				liege = {
					any_war = {
						OR = {
							AND = {
								defender = { character = PREV }
								NOT = { using_cb = depose_liege }
								NOT = { using_cb = overthrow_ruler }
								NOT = { using_cb = overthrow_ruler_no_calls }
								NOT = { using_cb = succession_on_liege }
								NOT = { using_cb = other_succession_on_liege }
							}
							AND = {
								attacker = { character = PREV }
								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}
		}
	}
	
	faction_ghibellines_ultimatum = {
		is_high_prio = yes
		
		potential = {
			leads_faction = faction_ghibellines
			OR = {
				NOT = { has_character_flag = faction_ghibellines_ultimatum_taken }
				had_character_flag = { flag = faction_ghibellines_ultimatum_taken days = 7 }
			}
		}
		allow = {
			war = no
			prisoner = no
			liege = {
				NOT = { war_with = ROOT }
				NOT = { reverse_has_truce = ROOT }
			}

			capital_holding = {
				controller = {
					character = ROOT
				}
			}
		}
		effect = {
			liege = {
				letter_event = { id = guelphs_ghibellines.10 days = 3 tooltip = "The Emperor will receive our ultimatum" }
			}
			hidden_tooltip = {
				set_character_flag = faction_ghibellines_ultimatum_taken
			}
		}
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.9 # Slow it down a bit
			}
			
			modifier = {
				factor = 0
				NOT = { 
					faction_power = 
					{
						faction = faction_ghibellines
						power = 1.25
					}
				}
			}
			
			modifier = {
				factor = 0
				liege = {
					any_war = {
						OR = {
							AND = {
								defender = { character = PREV }
								NOT = { using_cb = depose_liege }
								NOT = { using_cb = overthrow_ruler }
								NOT = { using_cb = overthrow_ruler_no_calls }
								NOT = { using_cb = succession_on_liege }
								NOT = { using_cb = other_succession_on_liege }
							}
							AND = {
								attacker = { character = PREV }
								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}
		}
	}

	faction_guelphs_comunal_ultimatum = {
		is_high_prio = yes
		
		potential = {
			leads_faction = faction_guelphs_comunal
			OR = {
				NOT = { has_character_flag = faction_guelphs_comunal_ultimatum_taken }
				had_character_flag = { flag = faction_guelphs_comunal_ultimatum_taken days = 60 }
			}
		}
		allow = {
			war = no
			prisoner = no
			liege = {
				NOT = { war_with = ROOT }
				NOT = { reverse_has_truce = ROOT }
			}

			capital_holding = {
				controller = {
					character = ROOT
				}
			}
		}
		effect = {
			liege = {
				letter_event = { id = guelphs_ghibellines.85 days = 3 tooltip = "Our ghibelline liege will receive our ultimatum" }
			}
			hidden_tooltip = {
				set_character_flag = faction_guelphs_comunal_ultimatum_taken
			}
		}
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.5 # Slow it down a bit
			}
			
			modifier = {
				factor = 0
				NOT = { 
					faction_power = {
						faction = faction_guelphs_comunal
						power = 1.25
					}
				}
			}
			
			modifier = {
				factor = 0
				liege = {
					any_war = {
						OR = {
							AND = {
								defender = { character = PREV }
								NOT = { using_cb = depose_liege }
								NOT = { using_cb = overthrow_ruler }
								NOT = { using_cb = overthrow_ruler_no_calls }
							}
							AND = {
								attacker = { character = PREV }
								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}
		}
	}
	
	faction_ghibellines_comunal_ultimatum = {
		is_high_prio = yes
		
		potential = {
			leads_faction = faction_ghibellines_comunal
			OR = {
				NOT = { has_character_flag = faction_ghibellines_comunal_ultimatum_taken }
				had_character_flag = { flag = faction_ghibellines_comunal_ultimatum_taken days = 7 }
			}
		}
		allow = {
			prisoner = no
			liege = {
				NOT = { war_with = ROOT }
				NOT = { reverse_has_truce = ROOT }
			}

			capital_holding = {
				controller = {
					character = ROOT
				}
			}
		}
		effect = {
			liege = {
				letter_event = { id = guelphs_ghibellines.85 days = 3 tooltip = "Our Guelph liege will receive our ultimatum" }
			}
			hidden_tooltip = {
				set_character_flag = faction_ghibellines_comunal_ultimatum_taken
			}
		}
		revoke_allowed = {
			always = no
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0.5 # Slow it down a bit
			}
			
			modifier = {
				factor = 0
				NOT = { 
					faction_power = {
						faction = faction_ghibellines_comunal
						power = 1.25
					}
				}
			}
			
			modifier = {
				factor = 0
				liege = {
					any_war = {
						OR = {
							AND = {
								defender = { character = PREV }
								NOT = { using_cb = depose_liege }
								NOT = { using_cb = overthrow_ruler }
								NOT = { using_cb = overthrow_ruler_no_calls }
							}
							AND = {
								attacker = { character = PREV }
								OR = {
									using_cb = invasion
									using_cb = religious
									using_cb = tribal_invasion
									using_cb = muslim_invasion
									using_cb = claim_all
									using_cb = claim
									using_cb = other_claim
								}
							}
						}
					}
				}
			}
		}
	}
}


