﻿sas_induct_bastard_interaction = {
    icon = icon_dynasty
    category = interaction_category_friendly
    desc = sas_induct_bastard_interaction_desc

    is_shown = {
        OR = {
			has_game_rule = sas_all_modified_perks
			has_game_rule = spy_and_interactions
		}
        scope:actor = {
            is_ai = no
            has_perk = enticing_opportunity_perk
        }

        scope:recipient = {
            has_trait = disputed_heritage
            is_adult = no
            NOT = { has_trait = legitimized_bastard }
        }

        OR = {
            scope:recipient.real_father = scope:actor
            scope:recipient.real_father.dynasty = scope:actor.dynasty
        }

        NOT = {
            scope:actor.dynasty = scope:recipient.dynasty
        }
    }

    is_valid = {
        scope:actor.dynasty = {
            dynasty_prestige >= medium_dynasty_prestige_value
        }
    }

    auto_accept = yes

    cost = {
        renown = medium_dynasty_prestige_value
    }

    on_accept = {
        scope:actor = {
            stress_impact = {
                arrogant = minor_stress_impact_gain
            }
            send_interface_toast = {
                title = sas_induct_bastard_interaction_toast_title
                left_icon = scope:actor
                right_icon = scope:recipient
                custom_tooltip = {
                    text = sas_induct_bastard_interaction_toast_desc
                }
            }
        }

        scope:recipient = {
            set_father = scope:recipient.real_father
            set_house = scope:recipient.real_father.house
            remove_trait = disputed_heritage
            
            if = {
                limit = {
                    faith = { has_doctrine_parameter = bastards_legitimize }
                }
                add_trait = legitimized_bastard
            }
            add_opinion = {
                target = scope:actor
                modifier = sas_claimed_parentage_opinion_modifier
            }
        }

        hidden_effect = {
            every_sibling = {
                limit = {
                    is_landed = yes
                    NOT = { this = scope:actor }
                }
                trigger_event = bastard_interaction.0010
            }            
        }
    }
}

# Get a bastard who is not accepted by their Dynastic parent to join your dynasty instead in exchange for legitimization
sas_steal_bastard_interaction = {
    icon = icon_dynasty
    category = interaction_category_friendly
    desc = sas_steal_bastard_interaction_desc
    
    is_shown = {
        OR = {
			has_game_rule = sas_all_modified_perks
			has_game_rule = spy_and_interactions
		}
        scope:actor = {
            is_ai = no
            has_perk = enticing_opportunity_perk
        }

        scope:recipient = {
            has_trait = bastard
            OR = {
                real_father = scope:actor
                scope:actor.dynasty = scope:recipient.real_father.dynasty
            }
            is_adult = no
            NOT = { has_trait = legitimized_bastard }
        }

        NOT = {
            scope:actor.dynasty = scope:recipient.dynasty
        }
    }

    is_valid = {
        scope:actor.dynasty = {
            dynasty_prestige >= medium_dynasty_prestige_value
        }
    }

    auto_accept = yes    

    cost = {
        renown = medium_dynasty_prestige_value
    }

    on_accept = {
        scope:actor = {
            stress_impact = {
                arrogant = minor_stress_impact_gain
            }
            send_interface_toast = {
                title = sas_steal_bastard_interaction_toast_title
                left_icon = scope:actor
                right_icon = scope:recipient
                custom_tooltip = {
                    text = sas_steal_bastard_interaction_toast_desc
                }
            }
        }

        scope:recipient = {
            set_house = scope:actor.house
            remove_trait = disputed_heritage
            
            remove_trait = bastard
            add_trait = legitimized_bastard
            add_opinion = {
                target = scope:actor
                modifier = sas_claimed_parentage_opinion_modifier
            }
        }

        hidden_effect = {
            every_sibling = {
                limit = {
                    is_landed = yes
                    NOT = { this = scope:actor }
                }
                trigger_event = bastard_interaction.0010
            }            
        }
    }
    ai_frequency = 0
}
