on_actions = {
	
	### SCRIPTED PEACE DEAL ###
	### ON_CAPITULATION * ON_CAPITULATION_IMMEDIATE (IF TRANSFER NAVY IS USED) ###
	### FROM = WINNER , ROOT = LOSER ###

	on_capitulation = {
		effect = {
			if = {
				limit = {
					NOT = {
						ROOT = {
							any_other_country = {
								is_in_faction_with = PREV
								has_capitulated = no
							}
							is_in_faction = yes
						}
					}
				}
				if = { 
					limit = {
						FROM = {
							OR = {
								original_tag = WRA
								original_tag = WRS
							}
						}

						ROOT = {
							OR = {
								original_tag = WRA
								original_tag = WRS
							}
						}
					}
					FROM = {
						white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
				}
			}
			else={
				if = { # cali warfare
					limit = {
						FROM = {
							OR = {
								original_tag = WRA
								original_tag = WRS
							}
						}

						ROOT = {
							OR = {
								original_tag = WRA
								original_tag = WRS
							}
						}
					}
					FROM = {
						every_state = {
							limit = {
								is_core_of = ROOT
							}
							add_core_of = FROM
							remove_core_of = ROOT
						}
						#white_peace = ROOT
						annex_country = {
							target = ROOT
							transfer_troops = no
						}
					}
				}
			}
		}
	}
}