# Scripted AI desire for peace actions

# *** How to access data from the peace action ***
# ROOT - Negotiator country
# FROM - Taker country
# FROM.FROM - Giver country
# FROM.FROM.FROM - State (if peace action refers to a state)
# You might have to use e.g. ROOT.FROM to access the variable from inside another scope

# Peace actions
    # take_states
    # puppet
    # force_government
    # liberate

peace_ai_desires = {

    # French Yalta wants
    FRA_yalta_puppet = {
        peace_action_type = puppet
        enable = {
            has_global_flag = yalta_agreed_flag
            ROOT = {
                original_tag = FRA
                has_government = democratic
            }
            FROM.FROM = {
                original_tag = GER
            }
            FROM.FROM.FROM = {
                state = 42 #MOSELLAND
            }
        }
        ai_desire = 250
    }

    # American Yalta wants
    USA_yalta_puppet = {
        peace_action_type = puppet
        enable = {
            has_global_flag = yalta_agreed_flag
            ROOT = {
                original_tag = USA
                has_government = democratic
            }
            FROM.FROM = {
                original_tag = GER
            }
            FROM.FROM.FROM = {
                OR = {
                    state = 55
                    state = 54
                    state = 52
                    state = 53
                    state = 50
                    state = 978 #BADEN
                }
            }
        }
        ai_desire = 250
    }
    # Don't contest American Yalta wants
    allies_USA_yalta_puppet = {
        peace_action_type = puppet
        enable = {
            has_global_flag = yalta_agreed_flag
            ROOT = {
                NOT = { original_tag = USA }
               # has_government = democratic
               # is_in_faction_with = USA
                USA = {
                    has_war_with = GER 
                }
            }
            FROM.FROM = {
                original_tag = GER
            }
            FROM.FROM.FROM = {
                OR = {
                    state = 55
                    state = 54
                    state = 52
                    state = 53
                    state = 50
                    state = 978 #BADEN
                }
            }
        }
        ai_desire = -100
    }

    # British Yalta wants
    ENG_yalta_puppet = {
        peace_action_type = puppet
        enable = {
            has_global_flag = yalta_agreed_flag
            ROOT = {
                original_tag = ENG
                has_government = democratic
            }
            FROM = {
                original_tag = GER
            }
            FROM.FROM.FROM = {
                OR = {
                    state = 51
                    state = 1414
                    state = 56
                    state = 57
                    state = 1413
                    state = 58
                    state = 909
                    state = 59
                }
            }
        }
        ai_desire = 250
    }

    # Don't interfere with British areas
    allies_ENG_yalta_puppet = {
        peace_action_type = puppet
        enable = {
            has_global_flag = yalta_agreed_flag
            ROOT = {
                NOT = { original_tag = ENG }
                #has_government = democratic
                #is_in_faction_with = ENG 
                ENG = { has_war_with = GER }
            }
            FROM.FROM = {
                original_tag = GER
            }
           
            FROM.FROM.FROM = {
                OR = {
                    state = 51
                    state = 1414
                    state = 56
                    state = 57
                    state = 1413
                    state = 58
                    state = 909
                    state = 59
                }
            }
        }
        ai_desire = -100
    }

    # Allies try not to take French states, please
    allies_give_france_something_to_puppet = {
        peace_action_type = puppet
        enable = {
            has_global_flag = yalta_agreed_flag
            ROOT = {
                NOT = { original_tag = FRA }
               #has_government = democratic
               #is_in_faction_with = FRA
                any_country_with_original_tag = {
                    original_tag_to_check = FRA
                    has_war_with = GER
                }
            }
            FROM.FROM = {
                original_tag = GER
            }
            FROM.FROM.FROM = {
                state = 42 #MOSELLAND 
            }
        }
        ai_desire = -250
    }
}