# HELP!!! I'm trapped inside the mod!!!
# Send beer supplies ASP!
# On second thought, maybe I've had enough beer...

conquest_invasion = {
	name = CB_NAME_INVASION
	war_name = WAR_NAME_INVASION
	sprite = 8
	truce_days = 1825
	hostile_against_others = yes
	is_permanent = yes
	is_holy_war = no
	can_ask_to_join_war = yes
	check_de_jure_tier = KING
	
	allowed_to_target_tributaries = no
	allowed_to_target_suzerains = no

	can_use_gui = {
		ROOT = {
			prestige = 300
		}
	}
	
	on_add = {
		ROOT = { prestige = -300 }
	}

	can_use = {
		ROOT = {
			ai = no
			independent = yes
			primary_title = { higher_tier_than = BARON }
			NOT = { same_realm = FROM }
			mercenary = no
			NOT = { is_liege_or_above = FROM }
		}
	}
	
	can_use_title = {
		any_direct_de_jure_vassal_title = {
			any_direct_de_jure_vassal_title = {
				OR = {
					holder_scope = {
						OR = {
							character = ROOT
							is_liege_or_above = ROOT
						}
					}
					location = {
						any_neighbor_province = {
							owner = {
								OR = {
									character = ROOT
									is_liege_or_above = ROOT
								}
							}
						}
					}
				}
			}
		}
	}
	
	is_valid = {
	}
	
	is_valid_title = {
		FROM = {
			any_realm_title = {
				de_jure_liege_or_above = PREVPREV
			}
		}
	}

	on_success = {
		ROOT = {
			prestige = 300
		}
		
		any_attacker = {
			limit = { character = ROOT }
			participation_scaled_prestige = 200	
		}
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { 
				participation_scaled_prestige = 200
			}
		}
		FROM = {
			prestige = -500
		}
	}
	
	on_success_title = {
		custom_tooltip = { 
			text = other_invasion_succ_tip
			hidden_tooltip = {
				ROOT = {
					occupy_minors_of_occupied_settlements = FROM
					gain_all_occupied_titles = FROM	
					}
					
					if = {
						limit = {
							has_nickname = no
						}
						random_list = {
							10 = { give_nickname = nick_the_conqueror }
						}
					}
				}
			}
		}
	}

	on_fail = {
		FROM = {
			prestige = 500
		}
		FROM = {
			if = {
				limit = {
					has_dlc = "Legacy of Rome"
					OR = { 
						has_landed_title = e_byzantium
						has_landed_title = e_roman_empire
					}
					religion_group = christian
				}
				hidden_tooltip = { character_event = { id = LoR.30 days = 12 } }
			}
			
			if = {
				limit = {
					has_nickname = no
				}
				random_list = {
					10 = { give_nickname = nick_the_conqueror }
				}
			}
		}
		any_defender = {
			limit = { character = FROM }
			participation_scaled_prestige = 100
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { participation_scaled_prestige = 100 }
		}
		ROOT = {
			prestige = -500
		}
	}

	on_reverse_demand = {
		ROOT = {
			prestige = -500
			piety = -200
			transfer_scaled_wealth = {
				to = FROM
				value = 40.0
			}
		}
		FROM = {
			prestige = 200
			if = {
				limit = { 
					has_dlc = "Legacy of Rome"
					OR = { 
						has_landed_title = e_byzantium
						has_landed_title = e_roman_empire
					}
					religion_group = christian
				}
				hidden_tooltip = { character_event = { id = LoR.30 days = 12 } }
			}
			if = {
				limit = {
					has_nickname = no
				}
				random_list = {
					10 = { give_nickname = nick_the_holy }
					10 = { give_nickname = nick_the_glorious }
					10 = { give_nickname = nick_the_lionheart }
					10 = { give_nickname = nick_the_great }
					10 = { give_nickname = nick_the_hammer }
					10 = { give_nickname = nick_the_magnificent }
					10 = { give_nickname = nick_the_avenger }
				}
			}
		}
		any_defender = {
			limit = { character = FROM }
			participation_scaled_prestige = 200
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { participation_scaled_prestige = 200 }
		}
	}

	attacker_ai_victory_worth = {
		factor = 100
	}
	
	attacker_ai_defeat_worth = {
		factor = 100
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 150
	}
	
	ai_will_do = { 
		factor = 0
		
		modifier = {
			factor = 0
		}
	}
}