﻿namespace = regula_childhood_event

# Decision tree for making wards the Paelices' problem (except for the player's primary heir).
# global_var:regula_wards values:
# Both sexes = 3
# Male only = 2
# Female only = 1
# None = 0

regula_childhood_event.0011 = {        #moves children out of magisters court so the player doesn't have to maintain them
    type = character_event
    hidden = yes
    theme = education

   trigger = {
        # Make sure this is a child, and is not landed/married
        is_adult = no
        is_landed = no
        is_married = no
        global_var:regula_wards = 3  # Insurance.

        # Make sure the Dad is the Magister
        father = global_var:magister_character

        # Does not already have a guardian
        num_of_relation_guardian = 0

        # Check Mother is alive and landed (and that this child isn't already there)
        has_mother = yes
        root.mother = { is_landed = yes }
        NOT = { host = root.mother }    # Not already in their mothers court
    }

    immediate = {
        # Move to mothers court
        host = {
            remove_courtier_or_guest = ROOT
        }
        ROOT = {
            ROOT.mother = { add_courtier = prev }
            hidden_effect = {
                return_to_court = yes
            }
        }

        # Send message to Magister
        global_var:magister_character = {
            send_interface_message = {
                type = event_spouse_good
                title = regula_childhood_event_sent_message.t
                desc = regula_childhood_event_sent_message.desc
                left_icon = ROOT
                right_icon = ROOT.mother
            }
        }
    }
}

regula_childhood_event.0012 = {        #Moves male children out of magisters court so the player doesn't have to maintain them
    type = character_event
    hidden = yes
    theme = education

   trigger = {
        # Make sure this is a child, and is not landed/married and is male
        is_adult = no
        is_landed = no
        is_married = no
        is_male = yes
        global_var:regula_wards = 2  # Insurance.

        # Make sure the Dad is the Magister
        father = global_var:magister_character

        # Does not already have a guardian
        num_of_relation_guardian = 0

        # Check Mother is alive and landed (and that this child isn't already there)
        has_mother = yes
        root.mother = { is_landed = yes }
        NOT = { host = root.mother }    # Not already in their mothers court
    }

    immediate = {
        # Move to mothers court
        host = {
            remove_courtier_or_guest = ROOT
        }
        ROOT = {
            ROOT.mother = { add_courtier = prev }
            hidden_effect = {
                return_to_court = yes
            }
        }

        # Send message to Magister
        global_var:magister_character = {
            send_interface_message = {
                type = event_spouse_good
                title = regula_childhood_event_sent_message.t
                desc = regula_childhood_event_sent_message.desc
                left_icon = ROOT
                right_icon = ROOT.mother
            }
        }
    }
}

regula_childhood_event.0013 = {        #Moves female children out of Magisters court so the player doesn't have to maintain them
    type = character_event
    hidden = yes
    theme = education

   trigger = {
        # Make sure this is a child, and is not landed/married and is female
        is_adult = no
        is_landed = no
        is_married = no
        is_male = no
        global_var:regula_wards = 1

        # Make sure the Dad is the Magister
        father = global_var:magister_character

        # Does not already have a guardian
        num_of_relation_guardian = 0

        # Check Mother is alive and landed (and that this child isn't already there)
        has_mother = yes
        root.mother = { is_landed = yes }
        NOT = { host = root.mother }    # Not already in their mothers court
    }

    immediate = {
        # Move to mothers court
        host = {
            remove_courtier_or_guest = ROOT
        }
        ROOT = {
            ROOT.mother = { add_courtier = prev }
            hidden_effect = {
                return_to_court = yes
            }
        }

        # Send message to Magister
        global_var:magister_character = {
            send_interface_message = {
                type = event_spouse_good
                title = regula_childhood_event_sent_message.t
                desc = regula_childhood_event_sent_message.desc
                left_icon = ROOT
                right_icon = ROOT.mother
            }
        }
    }
}
