# Scripted cost modifiers for peace actions.
# See documentation.info file for more detailed scripting information.

peace_action_modifiers = {

    ### Take States

    # Is Core of Taker, and taker is not Puppet of someone
    generic_is_core = {
        category = is_core
        peace_action_type = take_states

        enable = {
            FROM.FROM.FROM = { is_core_of = ROOT.FROM }
            OR = {
                FROM = { pc_is_puppeted = no } # Taker is free
                FROM = { tag = ROOT } # Taker might be subject but negotiating for itself
            }
        }

        cost_multiplier = 0.25 # Reduced by ~75%
    }


    generic_is_core_of_puppet = {
        category = is_core
        peace_action_type = take_states

        enable = {
            FROM.FROM.FROM = { is_core_of = ROOT.FROM }
            ROOT.FROM = { pc_is_puppeted = yes } # Taker is puppet or will be
        }

        cost_multiplier = 0.5
    }

    # State isn't Core of losing country - cheaper to take colonies
    generic_is_not_losers_core = {
        category = is_core
        peace_action_type = take_states

        enable = {
            FROM.FROM.FROM = { is_core_of = ROOT.FROM }
            NOT = { FROM.FROM.FROM = { is_core_of = ROOT.FROM.FROM } }
        }

        cost_multiplier = 0.95 # Reduced by 5%
    }


    # Is Claimed by Taker
    generic_has_claim = {
        category = has_claim
        peace_action_type = take_states

        enable = {
            FROM.FROM.FROM = { is_claimed_by = ROOT.FROM }
            ROOT.FROM = {
                is_subject = no
                pc_is_puppeted = no
            }
        }

        cost_multiplier = 0.9
    }


    # Control
    generic_occupies_state = {
        category = occupation
        peace_action_type = { take_states puppet liberate force_government }

        enable = {
            FROM.FROM.FROM = { 
				is_controlled_by = ROOT 
				compliance > 0 #To prevent capitulation-occupation kicking in
			}
        }
        cost_multiplier = 0.80
    }


    ### Ideology

    fascism_take_state = {
        category = ideology
        peace_action_type = take_states
        enable = {
            ROOT = { has_government = fascism }
        }
        cost_multiplier = 0.9
    }


    fascism_liberate = {
        category = ideology
        peace_action_type = liberate
        enable = {
            ROOT = { has_government = fascism }
        }
        cost_multiplier = 1.3
    }


    fascism_puppet = {
        category = ideology
        peace_action_type = puppet
        enable = {
            ROOT = { has_government = fascism }
        }
        cost_multiplier = 0.95
    }


    communism_take_state = {
        category = ideology
        peace_action_type = take_states
        enable = {
            ROOT = { has_government = communism } # should use negotiator or taker???
        }
        cost_multiplier = 1.0
    }


    communism_liberate = {
        category = ideology
        peace_action_type = liberate
        enable = {
            ROOT = { has_government = communism }
        }
        cost_multiplier = 1.3
    }


    communism_puppet = {
        category = ideology
        peace_action_type = puppet
        enable = {
            ROOT = { has_government = communism }
        }
        cost_multiplier = 0.9
    }


    democracy_take_state = {
        category = ideology
        peace_action_type = take_states
        enable = {
            ROOT = { has_government = democratic }
            NOT = { # state is not taker's core
                FROM.FROM.FROM = { is_core_of = ROOT.FROM }
            }
        }
        cost_multiplier = 1.3
    }


    democracy_liberate = {
        category = ideology
        peace_action_type = liberate
        enable = {
            ROOT = { has_government = democratic }
            ROOT.FROM = { has_government = democratic }
        }
        cost_multiplier = 0.9
    }


    democracy_force_government_on_evil_fascism = {
        category = ideology
        peace_action_type = force_government
        enable = {
            ROOT = { has_government = democratic }
            ROOT.FROM = { has_government = fascism }
        }
        cost_multiplier = 0.9
    }


    democracy_force_government_on_evil_communism = {
        category = ideology
        peace_action_type = force_government
        enable = {
            ROOT = { has_government = democratic }
            ROOT.FROM = { has_government = communism }
        }
        cost_multiplier = 0.9
    }


    democracy_puppet = {
        category = ideology
        peace_action_type = puppet
        enable = {
            ROOT = { has_government = democratic }
        }
        cost_multiplier = 1.2
    }


    ### Ally has Core Modifiers

    generic_major_participant_has_core = {
        category = core_of_ally
        peace_action_type = { take_states puppet force_government }
        enable = {
            any_country = {
                NOT = { tag = ROOT.FROM }
                pc_is_on_same_side_as = ROOT
                pc_is_liberated = no
                pc_is_puppeted = no
                is_major = yes
                ROOT.FROM.FROM.FROM = {
                    is_core_of = PREV
                }
            }
        }
        cost_multiplier = 3.0
    }


    # Test to see if we can apply Defensive War modifiers where appropriate without adding a separate wargoal 
    defensive_war_liberate = {
        category = defensive_war # Should possibly be a "wargoal" category. Esp if we move other wrgoals to here
        peace_action_type = { liberate force_government }
        enable = {
            OR = {
                ROOT = { has_defensive_war_with = ROOT.FROM.FROM } # Attacked by country directly
                AND = { # Loser probably got pulled in by another attacker
                    has_offensive_war = no
                    has_defensive_war = yes
                }
            }
        }
        cost_multiplier = 0.95
    }


    defensive_war_take_state = {
        category = defensive_war
        peace_action_type = take_state
        enable = {
            OR = {
                ROOT = { has_defensive_war_with = ROOT.FROM.FROM } # Attacked by country directly
                AND = { # Loser probably got pulled in by another attacker
                    has_offensive_war = no
                    has_defensive_war = yes
                }
            }
        }
        cost_multiplier = 1.1
    }


    ### Other

    belonged_to_someone_else = {
        category = belonged_to_someone_else
        peace_action_type = { take_states puppet force_government }

        enable = {
            any_country = {
                NOT = { tag = ROOT.FROM }
                ROOT.FROM.FROM.FROM = {
                    is_core_of = PREV
                    NOT = {
                        is_owned_by = PREV
                    }
                }
            }
        }

        cost_multiplier = 1.05
    }

    war_of_independence = {
        category = other
        peace_action_type = { take_states puppet force_government liberate }
        enable = {
            FROM.FROM.FROM = { NOT = { is_core_of = ROOT }}
            ROOT = {
                has_war_with_wargoal_against = {
                    target = FROM
                    type = independence_wargoal  # (optional: if not specified any wargoal will do)
                  }
            }
        }
        cost_multiplier = 1.25
    }


    # Retake territory spawned into new country
    war_of_independence_crushed = {
        category = other
        peace_action_type = { take_states }
        enable = {
            FROM.FROM = {
                has_war_with_wargoal_against = {
                  target = ROOT
                  type = independence_wargoal
                }

            }
        }
        cost_multiplier = 0.5
    }


    eat_the_rich = {
        category = ideology
        peace_action_type = { take_states puppet force_government liberate }

        enable = {
            ROOT = { is_major = yes }
            ROOT.FROM = { tag = ROOT }
            ROOT.FROM.FROM = {
                is_major = yes
				NOT = { has_government = fascism }
				NOT = { has_government = neutrality }
            }
        }
        cost_multiplier = 0.80
    }


    democracy_major_force_gov = {
        category = ideology
        peace_action_type = { force_government }

        enable = {
            ROOT = {
                has_government = democratic
                is_major = yes
            }
            ROOT.FROM.FROM = {
                is_major = yes
            }
        }
        cost_multiplier = 0.70
    }


    continuous_force_gov = {
        category = continuous_political_action
        peace_action_type = { force_government }

        enable = {
            FROM.FROM = { pc_is_forced_government_by = ROOT }
        }
        cost_multiplier = 0.85
    }


    continuous_puppet = {
        category = continuous_political_action
        peace_action_type = { puppet }

        enable = {
            FROM.FROM = { pc_is_puppeted_by = ROOT }
        }
        cost_multiplier = 0.85
    }

}
