﻿companion_effect = {
    if = {
        limit = {
                NOT = {
                    has_trait = lifestyle_companion
                }
            is_alive = yes
        }
        companion_set_up_effects = yes
    }
    else_if = {
        limit = {
            has_trait = lifestyle_companion
            has_trait_xp = {
                trait = lifestyle_companion
                value < 100
            }
            is_alive = yes
        }
        companion_xp_effects = yes
    }
}

companion_set_up_effects = {
    add_trait = lifestyle_companion
}

companion_xp_effects = {
		if = {
			limit = {
				is_landless_adventurer = no
				is_ai = yes
			}
		add_trait_xp = {
		trait = lifestyle_companion
		value = {
		integer_range = {
		min = 12
		max = 24
		}
        }
    }
    }
		if = {
			limit = {
				is_landless_adventurer = yes
			}
		add_trait_xp = {
		trait = lifestyle_companion
		value = {
		integer_range = {
		min = 4
		max = 10
		}
        }
    }
    }
	if = {
		limit = {
				is_landless_adventurer = no
				is_ai = no
			}
		add_trait_xp = {
		trait = lifestyle_companion
		value = {
		integer_range = {
		min = 11
		max = 22
		}
        }
    	}
	}
    send_interface_message = {
        type = event_generic_good_with_text
        title = trait_improved_companion
        desc = trait_improved_companion_desc
    }
}
