russia2_peace_deal = {
	enable = {
		OR = {
            tag = SOV
            tag = SOJ
            tag = UKR
            is_in_array = { global.russia_reworked_russian_states = ROOT }
        }
	}

	annex_randomness = 10
	liberate_randomness = 1
	puppet_randomness = 10
	take_states_randomness = 10
	force_government_randomness = 1

	annex = {
		factor = 5000

        modifier = {
            add = 5000
            FROM = {
				OR = {
					is_claimed_by = ROOT
					is_core_of = ROOT
				}
			}
        }
		modifier = {
			factor = 0
			FROM = {
				any_owned_state = {
					NOT = {
						OR = {
							is_claimed_by = ROOT
							is_core_of = ROOT
						}
					}
				}
			}
		}
	}

	# ROOT = Taker, FROM = Liberated
	liberate = { #Liberate might be buggy and might require country-specific workarounds...
		factor = 0
        modifier = {
            factor = 0
            always = yes
        }
	}

	# ROOT = Taker, FROM = Giver
	puppet = {
		factor = 4000
        modifier = {
            factor = 0
            FROM = {
                any_owned_state = {
                    OR = {
                        is_core_of = ROOT
                        is_claimed_by = ROOT
                    }
                    NOT = {
                        any_country = {
                            PREV = {
                                has_claimed_state_in_peace_conference = PREV
                            }
                        }
                    }
                }
            }
        }
	}

	# ROOT = Taker, FROM = Giver
	puppet_all = {
		base = 100
	}

	# ROOT = STATE, FROM = Taker, FROM.FROM = Giver
	puppet_state = {
		base = 0
		modifier = { #puppet state only if already puppeted
			add = 100000
			#only if already puppetted the country
			is_in_array = { subject_countries@FROM = FROM.FROM }
			#only if already puppetted a neighbor state
			any_neighbor_state = {
				is_in_array = { subject_states@FROM = THIS }
			}
            ROOT = {
                NOT = {
                    is_claimed_by = FROM
                    is_core_of = FROM
                }
            }
		}
	}

	# ROOT = Taker, FROM = State
	take_states = {
		factor = 1000
		modifier = {
			add = 9000

			FROM = {
				OR = {
					is_claimed_by = ROOT
					is_core_of = ROOT
				}
			}
		}
		modifier = { # prefer not to take from humans in our own faction
			factor = 0.5
			NOT = {
				FROM = {
					OR = {
						is_claimed_by = ROOT
						is_core_of = ROOT
					}
				}
			}
			FROM = {
				controller = {
					is_ai = no
					has_capitulated = no
					is_puppet = no
					is_in_faction_with = ROOT
				}
			}
		}
		modifier = { #Don't steal claims and cores from faction members unless we also have a right to that clay unless they are puppets
			factor = 0
			NOT = {
				FROM = {
					OR = {
						is_claimed_by = ROOT
						is_core_of = ROOT
					}
				}
			}
			any_country = {
				is_in_faction_with = ROOT
				is_puppet = no
				FROM = {
					OR = {
						is_claimed_by = PREV
						is_core_of = PREV
					}
				}
			}
		}
	}

	# ROOT = Taker, FROM = Giver
	force_government = {
		factor = 0
        modifier = {
            factor = 0
            always = yes
        }
	}
}