﻿DH_turn_on_interaction = {
	category = interaction_category_diplomacy
    desc = DH_turn_on_interaction_desc
	common_interaction = yes
    interface_priority = 999
	auto_accept = yes
    is_shown = {
		scope:actor = {
			is_human = yes
			NOT = { has_variable = DH_turn_on }
		}
        scope:recipient = {
            this = scope:actor
            is_human = yes
        }
    }
	ai_will_do = {
		base = 0
	}
    on_accept = {
        scope:actor = {
			set_variable = DH_turn_on
        	set_variable = {
        		name = dh_egg_color
        		value = 200
			}
        	set_variable = {
        		name = dh_egg_number
        		value = 1
			}
        }
    }
}
DH_turn_off_interaction = {
	category = interaction_category_diplomacy
    desc = DH_turn_off_interaction_desc
	common_interaction = yes
    interface_priority = 999
	auto_accept = yes
    is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
        scope:recipient = {
            this = scope:actor
            is_human = yes
        }
    }
	ai_will_do = {
		base = 0
	}
    on_accept = {
        scope:actor = {
			remove_variable = DH_turn_on
			remove_variable = dh_egg_color
			remove_variable = dh_egg_number
 		}
    }
}
DH_player_dragon_tame_interaction = {
	category = interaction_category_diplomacy
    icon = DH_icon_scheme_dragon
    desc = DH_player_dragon_tame_interaction_desc
	common_interaction = yes
    interface_priority = 990
	auto_accept = yes
    is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
        scope:recipient = {
            this = scope:actor
            NOT = { has_trait = dragonrider } 
            is_human = yes
        }
    }
	ai_will_do = {
		base = 0
	}
    prompt = {
        first_valid = {
            triggered_desc = {
                trigger = {
                    exists = scope:secondary_actor
                    scope:actor = scope:recipient
                }
                desc = DH_dragons
            }
            triggered_desc = {
                trigger = {
                    exists = scope:secondary_actor
                }
                desc = DH_dragons
            }
            desc = DH_dragons
        }
    }
    populate_actor_list = {
        every_living_dragon = {
            limit = {
                NOT = {
                    exists = var:current_rider
                }
            }
            add_to_list = characters
        }
    }
    greeting = positive
    notification_text = {
        desc = DH_suggest
    }
    on_accept = {
        scope:actor = {
			add_trait = dragonrider
        }
        scope:secondary_actor = {
            add_character_flag = owned_dragon
			hidden_effect = {
				agot_bond_dragon_relation_effect = {
					ACTOR = scope:actor
					DRAGON = scope:secondary_actor
				}
				agot_tame_dragon = {
					TAMER = scope:actor
					DRAGON = scope:secondary_actor
				}
			}
        }
    }
}
DH_character_dragon_tame_interaction = {
	category = interaction_category_diplomacy
    icon = DH_icon_scheme_dragon
    desc = DH_character_dragon_tame_interaction_desc
	common_interaction = yes
    interface_priority = 990
	auto_accept = yes
    is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
        scope:recipient = {
            NOT = { this = scope:actor }
            NOT = { has_trait = dragonrider } 
            is_human = yes
        }
    }
	ai_will_do = {
		base = 0
	}
    prompt = {
        first_valid = {
            triggered_desc = {
                trigger = {
                    exists = scope:secondary_actor
                    scope:actor = scope:recipient
                }
                desc = DH_dragons
            }
            triggered_desc = {
                trigger = {
                    exists = scope:secondary_actor
                }
                desc = DH_dragons
            }
            desc = DH_dragons
        }
    }
    populate_actor_list = {
        every_living_dragon = {
            limit = {
                NOT = {
                    exists = var:current_rider
                }
            }
            add_to_list = characters
        }
    }
    greeting = positive
    notification_text = {
        desc = DH_suggest
    }
    on_accept = {
        scope:recipient = {
			add_trait = dragonrider
        }
        scope:secondary_actor = {
            add_character_flag = owned_dragon
			hidden_effect = {
				agot_bond_dragon_relation_effect = {
					ACTOR = scope:recipient
					DRAGON = scope:secondary_actor
				}
				agot_tame_dragon = {
					TAMER = scope:recipient
					DRAGON = scope:secondary_actor
				}
			}
        }
    }
}
DH_dragon_duel_interaction = {
	category = interaction_category_diplomacy
    icon = DH_icon_scheme_dragon_duel
    desc = DH_dragon_duel_interaction_desc
	common_interaction = yes
    interface_priority = 980
	auto_accept = yes
    is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
        scope:recipient = {
            has_trait = dragonrider
            is_human = yes
        }
    }
	ai_will_do = {
		base = 0
	}
    prompt = {
        first_valid = {
            triggered_desc = {
                trigger = {
                    exists = scope:secondary_actor
                    scope:actor = scope:recipient
                }
                desc = DH_dragonriders
            }
            triggered_desc = {
                trigger = {
                    exists = scope:secondary_actor
                }
                desc = DH_dragonriders
            }
            desc = DH_dragonriders
        }
    }
    populate_actor_list = {
        every_living_dragonrider = {
            add_to_list = characters
        }
    }
    greeting = positive
    notification_text = {
        desc = DH_dragonriders_fight
    }
	on_accept = {
		scope:recipient = { 
			save_scope_as = dragonrider_in_battle 
		}
		scope:recipient.var:current_dragon = {
			save_scope_as = dragon_in_battle
		}
		scope:secondary_actor = { 
			save_scope_as = enemy_dragonrider 
		}
		scope:secondary_actor.var:current_dragon = {
			save_scope_as = enemy_dragon
		}

		scope:recipient = { trigger_event = agot_dragon_combat.0001 }
	}
}
#DH_dragon_slay_interaction = {
#	category = interaction_category_diplomacy
#    icon = DH_icon_scheme_dragon_duel
#    desc = DH_dragon_slay_interaction_desc
#	common_interaction = yes
#    interface_priority = 979
#	auto_accept = yes
#    is_shown = {
#		scope:actor = {
#			is_human = yes
#			has_variable = DH_turn_on
#		}
#        scope:recipient = {
#            is_human = yes
#        }
#    }
#	ai_will_do = {
#		base = 0
#	}
#    prompt = {
#        first_valid = {
#            triggered_desc = {
#                trigger = {
#                    exists = scope:secondary_actor
#                    scope:actor = scope:recipient
#                }
#                desc = DH_dragons
#            }
#            triggered_desc = {
#                trigger = {
#                    exists = scope:secondary_actor
#                }
#                desc = DH_dragons
#            }
#            desc = DH_dragons
#        }
#    }
#    populate_actor_list = {
#        every_living_dragon = {
#            add_to_list = characters
#        }
#    }
#    greeting = positive
#    notification_text = {
#        desc = DH_dragonriders_slay
#    }
#	on_accept = {
#		scope:recipient = { 
#			save_scope_as = scope:human
#		}
#		scope:secondary_actor = { 
#			save_scope_as = scope:dragon
#		}
#
#		scope:recipient = { trigger_event = agot_dragon_slaying_events.0100 }
#	}
#}
DH_bond_dragon_interaction = {
	icon = DH_icon_scheme_dragon
    desc = DH_bond_dragon_interaction_desc
	category = interaction_category_diplomacy
	common_interaction = yes
	interface_priority = 965
	ignores_pending_interaction_block = yes
	auto_accept = yes
	is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
		scope:recipient = {
			is_human = yes
			has_trait = dragonrider
			has_trait_xp = {
				trait = dragonrider
				track = dragon_bond
				value <= 99
			}
		}
	}
	ai_will_do = {
		base = 0
	}
	on_accept = {
		scope:recipient = {
			add_trait_xp = {
				trait = dragonrider
				track = dragon_bond
				value = 100
			}
		}
	}
}
DH_training_dragon_interaction = {
	icon = DH_icon_scheme_dragon
    desc = DH_training_dragon_interaction_desc
	category = interaction_category_diplomacy
	common_interaction = yes
	interface_priority = 964
	ignores_pending_interaction_block = yes
	auto_accept = yes
	is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
		scope:recipient = {
			is_human = yes
			has_trait = dragonrider
			has_trait_xp = {
				trait = dragonrider
				track = dragon_training
				value <= 99
			}
		}
	}
	ai_will_do = {
		base = 0
	}
	on_accept = {
		scope:recipient = {
			add_trait_xp = {
				trait = dragonrider
				track = dragon_training
				value = 100
			}
		}
	}
}
DH_bond_15_dragon_interaction = {
	icon = DH_icon_scheme_dragon
    desc = DH_bond_15_dragon_interaction_desc
	category = interaction_category_diplomacy
	common_interaction = yes
	interface_priority = 963
	ignores_pending_interaction_block = yes
	auto_accept = yes
	is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
		scope:recipient = {
			is_human = yes
			has_trait = dragonrider
			has_trait_xp = {
				trait = dragonrider
				track = dragon_bond
				value <= 99
			}
		}
	}
	ai_will_do = {
		base = 0
	}
	on_accept = {
		scope:recipient = {
			add_trait_xp = {
				trait = dragonrider
				track = dragon_bond
				value = 15
			}
		}
	}
}
DH_training_15_dragon_interaction = {
	icon = DH_icon_scheme_dragon
    desc = DH_training_15_dragon_interaction_desc
	category = interaction_category_diplomacy
	common_interaction = yes
	interface_priority = 962
	ignores_pending_interaction_block = yes
	auto_accept = yes
	is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
		scope:recipient = {
			is_human = yes
			has_trait = dragonrider
			has_trait_xp = {
				trait = dragonrider
				track = dragon_training
				value <= 99
			}
		}
	}
	ai_will_do = {
		base = 0
	}
	on_accept = {
		scope:recipient = {
			add_trait_xp = {
				trait = dragonrider
				track = dragon_training
				value = 15
			}
		}
	}
}
DH_hatch_dragon_egg_interaction = {
	category = interaction_category_diplomacy
	common_interaction = yes
	interface_priority = 955
	icon = DH_icon_scheme_dragon
	desc = DH_hatch_dragon_egg_interaction_desc
	auto_accept = yes

	target_type = artifact
	target_filter = recipient_artifacts

	ai_will_do = {
		base = 0
	}	
	can_be_picked_artifact = {
		scope:target = {
			has_variable = dragon_egg
		}
	}
	is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
		scope:recipient = {
			is_human = yes
			any_character_artifact = {
				has_variable = dragon_egg
			}
		}
	}
	on_accept = {
		scope:recipient = {
			agot_spawn_owned_hatchling_from_egg_effect = {
				OWNER = scope:recipient
				EGG = scope:target
			}
		}
	}
}
DH_hatch_dragon_egg_bond_interaction = {
	category = interaction_category_diplomacy
	common_interaction = yes
	interface_priority = 954
	icon = DH_icon_scheme_dragon
	desc = DH_hatch_dragon_egg_bond_interaction_desc
	auto_accept = yes

	target_type = artifact
	target_filter = recipient_artifacts

	ai_will_do = {
		base = 0
	}	
	can_be_picked_artifact = {
		scope:target = {
			has_variable = dragon_egg
		}
	}
	is_shown = {
		scope:actor = {
			is_human = yes
			has_variable = DH_turn_on
		}
		scope:recipient = {
			is_human = yes
			any_character_artifact = {
				has_variable = dragon_egg
			}
		}
	}
	on_accept = {
		scope:recipient = {
			agot_spawn_bonded_hatchling_from_egg_effect = {
				OWNER = scope:recipient
				EGG = scope:target
			}
		}
	}
}