
namespace = yl_summon

narrative_event = {
	id = yl_summon.1
	desc = EVTDESC_ylsummon1
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	is_triggered_only = yes 
	option = { 
		name = EVTOPTylsummon
		hidden_tooltip = {
			hs_summonhero_effect = yes
			if = {
				limit = {any_player = {trait = hs_summoner}}
				any_player = {character_event = {id = yl_summon.2}}
			}
		}
	}
}

character_event = { #召唤通知
	id = yl_summon.2
	desc = EVTDESC_ylsummon100
	picture = "GFX_evt_hssummon"
	ai = no
	trigger = {
		#new_character = {
		#	age = 0
		#}
	}
	is_triggered_only = yes
	option = {
		name = EVTOPTylsummon100
	}
}
character_event = { #选拔偶像通知
	id = yl_summon.11
	hide_window = yes
	trigger = {
		#new_character = {
		#	age = 0
		#}
	}
	is_triggered_only = yes
	immediate = {
		FROM = {
			character_event = {id = yl_summon.10}
		}
	}
}
character_event = { #选拔偶像通知
	id = yl_summon.10
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hs_idoltimes"
	ai = no
	trigger = {
		#new_character = {
		#	age = 0
		#}
	}
	is_triggered_only = yes
	option = {
		name = EVTOPTylsummon10
	}
}
narrative_event = { #偶像战国时代
	id = yl_summon.3
	title = hs_idoltimes_title
	desc = EVTDESC_ylsummon3
	picture = "GFX_evt_hs_idoltimes"
	hide_from = yes
	hide_new = yes
	
	is_triggered_only = yes
	option = {
		name = EVTOPTylsummon3
		custom_tooltip = { text = hs_EVTOPTylsummon3_tooltip }
		set_global_flag = hs_idoltimes_found
	}
}
character_event = { #偶像毕业
	id = yl_summon.4
	desc = EVTDESC_ylsummon4
	picture = "GFX_evt_hs_idoltimes"

	is_triggered_only = yes
	option = {
		name = EVTOPTylsummon4
	}
}
narrative_event = {
	id = yl_summon.5
	desc = EVTDESC_ylsummon5
	picture = "GFX_evt_hs_idoltimes"
	title = hs_idoltimes_title2
	is_triggered_only = yes 
	
	option = { 
		name = EVTOPTylsummon5
		prestige = 1500
		custom_tooltip = {
			text = realm_prospers_custom_tooltip
			hidden_tooltip = {
				any_realm_province = {
					limit = {
						any_province_holding = {
							OR = {
								holding_type = city
								holding_type = castle
								holding_type = tribal
							}
						}
						NOR = {
							has_province_modifier = depopulated_1
							has_province_modifier = depopulated_2
							has_province_modifier = depopulated_3
						}
					}
					change_variable = { which = prosperity_value value = 35 }
				}
				any_realm_province = {
					limit = {
						any_province_holding = {
							OR = {
								holding_type = city
								holding_type = castle
								holding_type = tribal
							}
						}
					}
					add_province_modifier  = { name = hs_heldbiglive_pr duration = 1095 }
				}
			}
		}
	}
}
narrative_event = {#召唤失败
	id = yl_summon.6
	desc = EVTDESC_ylsummon6
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	is_triggered_only = yes 
	option = { 
		name = EVTOPTylsummon6
		prestige = -50
	}
}
character_event = {#搜寻遗物
	id = yl_summon.7
	desc = EVTDESC_ylsummon7
	picture = "GFX_evt_hssummon"
	trigger = {	
		OR ={
			ai = no
			is_landed = yes
		}
		higher_tier_than = COUNT
		NOT = {
			any_artifact = {
				has_artifact_flag = hs_flag_saintremains 
			}
		}
		NOT = {
			OR = {
				trait = incapable
				trait = imbecile
			}
		}
		NOT = {hs_summoned_allhero_trigger = yes}
	}
	mean_time_to_happen = { 	
		years = 80
		modifier = {
			factor = 1.6
			has_game_rule = { name = hs_summonremain_gamerules value = LOW }
		}
		modifier = {
			factor = 0.6
			has_game_rule = { name = hs_summonremain_gamerules value = HIGH }
		}
		
		modifier = {
			factor = 0.75
			any_courtier = {
				has_minor_title = title_hs_summoner 
			}
		}
		modifier = {
			factor = 0.8
			num_of_count_titles_in_realm = 30
		}
		modifier = {
			factor = 0.8
			num_of_count_titles_in_realm = 60
		}
		modifier = {
			factor = 0.8
			num_of_count_titles_in_realm = 100
		}
		modifier = {
			factor = 0.8
			num_of_count_titles_in_realm = 150
		}
		modifier = {
			factor = 0.5
			has_ambition = obj_hs_have_a_remains
		}
		modifier = {
			factor = 0.7
			wealth = 1000
		}
		modifier = {
			factor = 0.7
			wealth = 5000
		}
		modifier = {
			factor = 0.7
			wealth = 10000
		}
		modifier = {
			factor = 0.7
			ai = no
		}
	}
	option = { 
		name = EVTOPTAylsummon7
		ai_chance = {
			factor = 80
		}
		if = {
			limit = {
				ai = no
			}
			scaled_wealth = {
				value = -0.1
				min = -100
				max = -450
			}
		}
		
		random = {
			  chance = 30 
			  modifier = {
				factor = 1.5
				ai = yes
			  }
			  modifier = {
				factor = 1.1
				any_courtier = {
					has_minor_title = title_hs_summoner 
				}
			  }
			  modifier = {
				factor = 1.1
				learning = 20
			  }
			  modifier = {
				factor = 1.1
				learning = 25
			  }
			  modifier = {
				factor = 1.1
				intrigue = 20
			  }
			  modifier = {
				factor = 1.1
				intrigue = 25
			  }
			  modifier = {
				factor = 1.3
				has_religion_feature = religion_feature_hs_animecountry 
			  }
			 
			  character_event = { id = yl_summon.8 days = 60 random = 30 }
			  break = yes
		}
		character_event = { id = yl_summon.9 days = 60 random = 30 }
	}
	option = { 
		name = EVTOPTBylsummon7
		prestige = -10
	}
}
character_event = { #搜寻成功
	id = yl_summon.8
	desc = EVTDESC_ylsummon8
	picture = "GFX_evt_hssummon"

	is_triggered_only = yes
	option = {
		name = EVTOPTylsummon8
		hidden_tooltip = {
			random = {
				  chance = 60
				  modifier = {
					factor = 1.1
					learning = 15
				  }
				  modifier = {
					factor = 1.1
					learning = 20
				  }
				  modifier = {
					factor = 1.1
					intrigue = 15
				  }
				  modifier = {
					factor = 1.1
					intrigue = 20
				  }
				  modifier = {
					factor = 1.5
					has_religion_feature = religion_feature_hs_animecountry 
				  }
				  add_artifact = bj_saintremains
				  break = yes
			}
			add_artifact = bj_saintremainsfake
		}
	}
}
character_event = { #搜寻失败
	id = yl_summon.9
	desc = EVTDESC_ylsummon9
	picture = "GFX_evt_hssummon"

	is_triggered_only = yes
	option = {
		name = EVTOPTylsummon9
	}
}
####################萌战无双开局
character_event = {
	id = yl_summon.100
	hide_window = yes
	is_triggered_only = yes
	ai = no
	only_playable = yes
	trigger = {
		is_save_game = no
		NOT = {has_global_flag = hs_mzwsopening}
		OR = {
			has_game_rule = { name = hs_mzwsopening_gamerules value = CRAZYopen }
			has_game_rule = { name = hs_mzwsopening_gamerules value = madopen }
			has_game_rule = { name = hs_mzwsopening_gamerules value = YES }
		}
		ai = no	
	}
	
	immediate = {		
		if = {
			limit = {
				has_game_rule = {
				   name = hs_mzwsopening_gamerules
				   value = YES
				}
			}
			set_variable = { which = hscount value = 10 }
		}
		if = {
			limit = {
				has_game_rule = {
				   name = hs_mzwsopening_gamerules
				   value = CRAZYopen
				}
			}
			set_variable = { which = hscount value = 50 }
		}
		if = {
			limit = {
				has_game_rule = {
				   name = hs_mzwsopening_gamerules
				   value = madopen
				}
			}
			set_variable = { which = hscount value = 150 }
		}
		while = {
			limit = {
				check_variable = {
					which = hscount
					value = 1
				}
			}    
			subtract_variable = {
				which = hscount
				value = 1
			}
			random_playable_ruler ={
				limit = {
					is_landed = yes
					prisoner = no
					ai = yes
					NOR = {
						trait = hs_trait_shouzhao
						trait = genius
						trait = strong
						trait = quick
						is_female = yes
						martial= 18
						diplomacy= 15
						intrigue= 15
						stewardship = 15
						learning = 15
					}
					OR = {
						can_marry = yes
						is_married =yes
					}
				}
				hs_summonhero_effect = yes
				new_character = {
					save_event_target_as = hsopenhero
					wealth = 500
					piety = 1000
					prestige = 2000
					#culture = PREV
					#religion = PREV
				}
				abdicate_to = event_target:hsopenhero
				if = {
					limit = {
						event_target:hsopenhero = {
							OR = {
								trait = yl_hero174
								trait = yl_hero175
								trait = yl_hero372
								trait = yl_llx
							}
						}
					}
					event_target:hsopenhero = {
						capital_scope = {
							event_target:hsopenhero ={
								spawn_unit = {
									province = PREV
									home = PREV
									owner = THIS
									troops ={
										hs_figure = { 10 10 }
										hs_gundam = { 1 1 }
									}
									disband_on_peace = no
									reinforces = yes
									reinforce_rate_multiplier = 0.05
									merge = yes
									attrition = 0
									cannot_inherit = no
									maintenance_multiplier = 0
								}							
							}
						}
					}
					
				}
				if = {
					limit = {year = 900}
					event_target:hsopenhero = {
						capital_scope = {
							event_target:hsopenhero ={
								spawn_unit = {
									province = PREV
									home = PREV
									owner = THIS
									troops ={
										heavy_infantry = { 500 1000 }
									}
									disband_on_peace = no
									reinforces = yes
									reinforce_rate_multiplier = 0.2
									merge = yes
									attrition = 0.2
									cannot_inherit = no
									maintenance_multiplier = 0
								}							
							}
						}
					}
				}
				if = {
					limit = {year =1000}
					event_target:hsopenhero = {
						capital_scope = {
							event_target:hsopenhero ={								
								spawn_unit = {
									province = PREV
									home = PREV
									owner = THIS
									troops ={
										knights  = { 800 1500 }
									}
									disband_on_peace = no
									reinforces = yes
									reinforce_rate_multiplier = 0.2
									merge = yes
									attrition = 0.2
									cannot_inherit = yes
									maintenance_multiplier = 0
								}
							}
						}
					}
				}
				if = {
					limit = {year =1100}
					event_target:hsopenhero = {
						capital_scope = {
							event_target:hsopenhero ={								
								spawn_unit = {
									province = PREV
									home = PREV
									owner = THIS
									troops ={
										knights  = { 800 1500 }
									}
									disband_on_peace = no
									reinforces = yes
									reinforce_rate_multiplier = 0.2
									merge = yes
									attrition = 0.2
									cannot_inherit = yes
									maintenance_multiplier = 0
								}
							}
						}
					}
				}
				if = {
					limit = {year =1200}
					event_target:hsopenhero = {
						capital_scope = {
							event_target:hsopenhero ={								
								spawn_unit = {
									province = PREV
									home = PREV
									owner = THIS
									troops ={
										knights  = { 800 1500 }
									}
									disband_on_peace = no
									reinforces = yes
									reinforce_rate_multiplier = 0.2
									merge = yes
									attrition = 0.2
									cannot_inherit = yes
									maintenance_multiplier = 0
								}
							}
						}
					}
				}
				event_target:hsopenhero = {
					capital_scope = {
						event_target:hsopenhero ={
							spawn_unit = {
								province = PREV
								home = PREV
								owner = THIS
								troops ={
									heavy_infantry = { 1000 1500 }
								}
								disband_on_peace = no
								reinforces = yes
								reinforce_rate_multiplier = 0.2
								merge = yes
								attrition = 0.2
								cannot_inherit = no
								maintenance_multiplier = 0
							}							
						}
					}
				}
				if = {
					limit = {
						has_game_rule = {
						   name = hs_mzwsopening_gamerules
						   value = madopen
						}
					}
					if = {
						limit = {year = 900}
						event_target:hsopenhero = {
							capital_scope = {
								event_target:hsopenhero ={
									spawn_unit = {
										province = PREV
										home = PREV
										owner = THIS
										troops ={
											heavy_infantry = { 500 1000 }
										}
										disband_on_peace = no
										reinforces = yes
										reinforce_rate_multiplier = 0.2
										merge = yes
										attrition = 0.2
										cannot_inherit = no
										maintenance_multiplier = 0
									}							
								}
							}
						}
					}
					if = {
						limit = {year =1000}
						event_target:hsopenhero = {
							capital_scope = {
								event_target:hsopenhero ={								
									spawn_unit = {
										province = PREV
										home = PREV
										owner = THIS
										troops ={
											knights  = { 800 1500 }
										}
										disband_on_peace = no
										reinforces = yes
										reinforce_rate_multiplier = 0.2
										merge = yes
										attrition = 0.2
										cannot_inherit = yes
										maintenance_multiplier = 0
									}
								}
							}
						}
					}
					if = {
						limit = {year =1100}
						event_target:hsopenhero = {
							capital_scope = {
								event_target:hsopenhero ={								
									spawn_unit = {
										province = PREV
										home = PREV
										owner = THIS
										troops ={
											knights  = { 800 1500 }
										}
										disband_on_peace = no
										reinforces = yes
										reinforce_rate_multiplier = 0.2
										merge = yes
										attrition = 0.2
										cannot_inherit = yes
										maintenance_multiplier = 0
									}
								}
							}
						}
					}
					if = {
						limit = {year =1200}
						event_target:hsopenhero = {
							capital_scope = {
								event_target:hsopenhero ={								
									spawn_unit = {
										province = PREV
										home = PREV
										owner = THIS
										troops ={
											knights  = { 800 1500 }
										}
										disband_on_peace = no
										reinforces = yes
										reinforce_rate_multiplier = 0.2
										merge = yes
										attrition = 0.2
										cannot_inherit = yes
										maintenance_multiplier = 0
									}
								}
							}
						}
					}
					event_target:hsopenhero = {
						capital_scope = {
							event_target:hsopenhero ={
								spawn_unit = {
									province = PREV
									home = PREV
									owner = THIS
									troops ={
										heavy_infantry = { 1000 1500 }
									}
									disband_on_peace = no
									reinforces = yes
									reinforce_rate_multiplier = 0.2
									merge = yes
									attrition = 0.2
									cannot_inherit = no
									maintenance_multiplier = 0
								}							
							}
						}
					}
				}
				clear_event_target = hsopenhero
			}
		}
		set_variable = { which = hscount value = 0 }				
		set_global_flag = hs_mzwsopening
		any_player = {
			character_event = { id = yl_summon.101 days = 3 }
		}
	}
}
character_event = {#角色交换
	id = yl_summon.101
	desc = EVTDESC_ylsummon101
	picture = "GFX_evt_hssummon"
	ai = no
	
	is_triggered_only = yes 
	
	option = { 
		name = EVTOPTA_ylsummon101
		custom_tooltip = {
			text = hs_exchangehero_tooltip
			set_global_flag = hs_exchange_hero_enable		
		}
	}
	option = { 
		name = EVTOPTB_ylsummon101
		piety = 5		
	}
	
}

character_event = {#人设变换
	id = yl_summon.102
	ai = no
	hide_window = yes
	is_triggered_only = yes 
	trigger = {
		is_save_game = no
		has_game_rule = { name = hs_hischange_gamerules value = yes }
		ai = no	
	}
	immediate = {
		c_217701 = {
			set_gender = female
			add_trait = yl_hissub19
			add_trait = hs_trait_shouzhao
			add_character_modifier = {
				name = hs_jd_ruler
				duration = -1
			}
		}
		
		c_70523 = {
			set_gender = female
			add_trait = yl_hero571
			add_trait = hs_trait_shouzhao
		}
		c_6392 = {
			set_gender = female
			add_trait = yl_hissub1
			add_trait = hs_trait_shouzhao
			add_character_modifier = {
				name = hs_jd_ruler
				duration = -1
			}
		}
		c_145287 = {
			set_gender = female
			add_trait = yl_hissub7
			add_trait = hs_trait_shouzhao
		}
		c_212501 = {
			add_trait = yl_hissub13
			add_trait = hs_trait_shouzhao
			add_character_modifier = {
				name = hs_jd_ruler
				duration = -1
			}
		}
		c_252305 = {
			set_gender = female
			add_trait = yl_hissub6
			add_trait = hs_trait_shouzhao
		}
		c_101510 = {
			add_trait = yl_hissub15
			add_trait = hs_trait_shouzhao
		}
		c_166627 = {
			add_trait = yl_hissub16
			add_trait = hs_trait_shouzhao	
		}
		c_204510 = {
			set_gender = female
			add_trait = yl_hero219
			add_trait = hs_trait_shouzhao
			add_character_modifier = {
				name = hs_jd_ruler
				duration = -1
			}			
		}
		c_145290 = {
			set_gender = female
			add_trait = yl_hero220
			add_trait = hs_trait_shouzhao	
		}
		c_217704 = {
			add_trait = yl_hero204
			add_trait = hs_trait_shouzhao	
		}
	}
	
}
narrative_event = {
	id = yl_summon.103
	desc = EVTDESC_ylsummon103
	picture = "GFX_evt_hssummon103"
	title = ylsummon103_title
	ai = no	
	is_triggered_only = yes 
	
	option = { 
		name = EVTOPThssummon103				
	}	
	after = {
		hidden_tooltip = {
			create_character = {
				random_traits = yes
				dynasty = none				
			}
			set_player_character = new_character
		}
	}
}

character_event = {
    id = yl_summon.200
	has_dlc = "Jade Dragon"
    hide_window = yes
    is_triggered_only = yes
    immediate = { 
        FROMFROM = { 
			hs_jd_summon_effect = yes
            new_character = {
                #Education & other basic stuff
                #save_event_target_as = chinese_master_engineer
                #add_character_modifier = {
                #    name = jd_master_engineer
                #    duration = -1
                #}
				set_character_flag = ai_flag_refuse_concubinage
				set_character_flag = ai_flag_refuse_marriage
				set_character_flag = originated_from_chinese_court
                reverse_opinion = { 
                    who = PREV
                    modifier = opinion_my_chinese_pet
                    years = 100
                }
				set_character_flag = chinese_courtier_original_court_@PREV
                set_character_flag = no_court_invites
                #set_character_flag = is_chinese_master_engineer
                                
            }
            letter_event = { id = yl_summon.201 } 
        } 
    }
}

character_event = {
	id = yl_summon.110
	hide_window = yes
	is_triggered_only = yes
	ai = no
	only_playable = yes
	trigger = {
		is_save_game = no
		NOT = {
			has_global_flag = hs_preop_done
		}
		ai = no	
	}
	
	immediate = {		
		if = {
			limit = {has_game_rule = { name = hs_preop_gamerules value = genshin_op }}
			random_independent_ruler = {
					character_event = {id = ylextra.900 }
				
			}
		}	
		if = {
			limit = {has_game_rule = { name = hs_preop_gamerules value = Schale_op }}
			random_independent_ruler = {
				limit = {
					num_of_count_titles_in_realm > 40
				}
					character_event = {id = ylextra.910 }
				
			}
			
		}
		if = {
			limit = {has_game_rule = { name = hs_preop_gamerules value = chuhan_op }}
			random_independent_ruler = {
					character_event = {id = ylextra.920 }
				
			}
		}			
		set_global_flag = hs_preop_done
	}
}

letter_event = {
    id = yl_summon.201 
	has_dlc = "Jade Dragon"
    desc = EVTDESC_JD_20030
    border = GFX_event_letter_frame_diplomacy

    hide_new = yes

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_JD_20022
        custom_tooltip = { text = EVTOPTA_JD_20032_TT }
		new_character = {
			set_character_flag = appear_in_option
            clr_character_flag = appear_in_option
			opinion = {
				who = ROOT
				modifier = opinion_servant
				months = 1200
			}
		}
	   #event_target:chinese_master_engineer = { 
        #    show_scope_change = no
        #    if = {
        #        limit = {
        #            offmap_china = {
        #                has_status = china_golden_age
        #            }
        #        }
        #        set_character_flag = china_master_engineer_golden_age #so you can't reappoint in golden age to get better effects
        #    }
        #    set_character_flag = master_engineer_just_spawned
        #    give_minor_title = title_master_engineer #effects in minor title definition
        #}
    }
}
narrative_event = {
	id = yl_summon.990
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	ai = no
	
	is_triggered_only = yes 

	
	option = { 
		name = HSsummon1
		random_claim = {
			limit = {
				has_holder = yes
			}
			holder_scope = {
				reverse_unsafe_war = {
					target = ROOT
					casus_belli = claim
					thirdparty_title = PREV
				}
			}
		}
	}
	option = { 
		name = HSsummon5
		random_claim = {
			holder_scope = {
				reverse_unsafe_war = {
					target = ROOT
					casus_belli = claim
					thirdparty_title = PREV
				}
			}
		}	
	}
	option = { 
		name = HSsummon10	
		random_claim = {
			holder_scope = {
				reverse_unsafe_war = {
					target = ROOT
					casus_belli = claim
					thirdparty_title = PREV
				}
			}
		}	
	}
	option = { 
		name = HSsummon300
		random_claim = {
			limit = {
				has_holder = yes
			}
			holder_scope = {
				ROOT = {				
					unsafe_war = {
						target = PREV
						casus_belli = claim
						thirdparty_title = PREVPREV
					}
				}
				
			}
		}
	}
	
	after = {
		
	}
}


character_event = {
	id = yl_summon.994
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
    is_triggered_only = yes
	ai = no
	trigger = {
		#ai = no
		#is_feudal= yes
		#NOT = { government = 2dwar_imperial_government  }
	}
	immediate = {
		
	}
	option = { 
		name = HSsummon300
		random_bloodline = {
			limit = {
				founder = {
					OR = {
						trait = hs_trait_shouzhao
					}
				}
				OR = {
					any_bloodline_member = {
						is_married = no
						NOT = {
							trait = hs_trait_shouzhao
						}
						age > 13
						age < 45				
						count = 2
					}
					any_bloodline_member = {
						is_married = no
						NOT = {
							trait = hs_trait_shouzhao
						}
						age > 13
						age < 45
						count < 4
					}						
				}
				
			}
			random_bloodline_member = {
				limit = {
					is_married = no
					age > 13
					age < 45
				}
				save_event_target_as = event_target:hs_994
			}
		}
		show_portrait = event_target:hs_994
	}
	after = {
		event_target:hs_994 = {
			piety = 1
			prestige = 1
			wealth = 1
		}
	}
}	


character_event = {
	id = yl_summon.995
	hide_window = yes

    is_triggered_only = yes
	#ai = no
	trigger = {
		#ai = no
		#is_feudal= yes
		#NOT = { government = 2dwar_imperial_government  }
	}
	
	immediate = {
		character_event = { id = hstls.320 }
	}
}	

narrative_event = {#debug用
	id = yl_summon.996
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	ai = no
	
	is_triggered_only = yes 

	immediate = {
		#ROOT = {
		#	save_event_target_as = hs_gainskill_target
		#}
	}
	option = { 
		name = HSsummon1
		random = {
			chance = 90
			modifier = {
				factor = 0.7
				check_variable = { which = "hs_magic_skill_learned_varrable" value = 2 }
			}
			modifier = {
				factor = 0.6
				check_variable = { which = "hs_magic_skill_learned_varrable" value = 3 }
			}
			modifier = {
				factor = 0.5
				check_variable = { which = "hs_magic_skill_learned_varrable" value = 4 }
			}
			save_event_target_as = hs_gainskill_target
			hs_gain_random_magic_skill_effects = yes
			#break = yes
		}
		if = {
			limit = { trait = hs_magician_l }
			remove_trait = hs_magician_l
			add_trait = hs_magician
			remove_character_modifiers ={
				modifier = hs_magic_exp amount = 30
			}
			change_variable = { which = "hs_magic_varrable" value = -30 }
			break = yes
		}
		if = {
			limit = { trait = hs_magician }
			remove_trait = hs_magician
			add_trait = hs_magician_h
			remove_character_modifiers ={
				modifier = hs_magic_exp amount = 30
			}
			change_variable = { which = "hs_magic_varrable" value = -30 }
			break = yes
		}
		#if = {
		#	limit = {
		#		age = 12
		#		NOT = {
		#			OR = {
		#				trait = incapable
		#				trait = imbecile
		#			}
		#		}
		#		is_incapable = no
		#		prisoner = no
		#		is_inaccessible_trigger  = no
		#		hs_magician_trigger = yes
		#		NOT = { has_character_modifier = hs_magichatted}
		#	}
		#	wealth = -100
		#}
		#hs_gain_random_magic_skill_effects = yes
	}
	option = { 
		name = HSsummon5
		
		
		if = {
			limit = { 
				check_variable = {
					which = AB02_sex_exp_potential_diff
					value > 5
				}
			}			
			wealth = 5
		}
		if = {
			limit = { 
				check_variable = {
					which = AB02_sex_exp_potential_diff
					value > 10
				}
			}			
			wealth = 10
		}
		if = {
			limit = { 
				check_variable = {
					which = AB02_sex_exp_potential_diff
					value < -10
				}
			}			
			wealth = 100
		}
		#if = {
		#	limit = { 
		#		yearly_income = 10000
		#	}			
		#	wealth = -5
		#}
		#if = {
		#	limit = { 
		#		yearly_income = 5000
		#		NOT = {yearly_income = 10000}
		#	}			
		#	wealth = -3
		#}
		#if = {
		#	limit = { 
		#		yearly_income = 1000
		#		NOT = {yearly_income = 5000}
		#	}			
		#	wealth = -1
		#}
		#if = {
		#	limit = { 
		#		NOT = {yearly_income = 1000}
		#	}			
		#	wealth = -0.5
		#}
	}
	option = { 
		name = HSsummon10
		#random = {
		#	chance = 0
		#	AB02_sex_ROOT_fertility_score_value = yes
		#	wealth = 1000
		#}
		hs_genderchange_effect = yes
	
	}
	option = { 
		name = HSsummon300
		#capital_scope = {
		#	add_province_modifier = {
		#		name = hs_three_umamegami
		#		duration = -1
		#	}
		#}
		any_spouse = { #妻子丈夫
			wealth = 10
		}
		spouse = { #主要配偶，妻子丈夫
			wealth = 20
		}
		any_consort = {#所有婚姻关系包括妾，男人
			wealth = 30
		}
	}
	
	after = {
		
		
	}
}
narrative_event = {
	id = yl_summon.997
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	ai = no
	
	is_triggered_only = yes 

	
	option = { 
		name = HSsummon1
		#set_variable = { which = hscount value = 1 }
		#random_opinion_modifier_target = {
		#	limit = {
		#		has_character_flag = AB02_harem_joined				
		#		OR = {
		#			is_lover = ROOT
		#			is_friend = ROOT
		#			is_close_relative = ROOT
		#			has_opinion_modifier = { who = ROOT name = opinion_hs_keyiyaku }
		#			has_opinion_modifier = { who = ROOT name = opinion_hs_koikokoro }
		#			has_opinion_modifier = { who = ROOT name = opinion_hs_SISTER }
		#		}
		#	}
		#	piety = 100
		#}		
	}
	option = { 
		name = HSsummon5
		capital_scope = { save_event_target_as = home_capital }
					random_landed_title = {
						limit = {
							real_tier = COUNT
							location = {
								OR = {
									AND = { #Either you can travel via water to them...
										is_coastal = yes
										can_naval_path_to = { target = event_target:home_capital distance < 1500 }
									}
									AND = {
										#Or they are accessible via land...
										event_target:home_capital = { is_coastal = no }
										can_land_path_to = { target = event_target:home_capital distance < 1400 }
									}
									AND = { #Or not a coastal place...
										is_coastal = no
										can_land_path_to = { target = event_target:home_capital distance < 1400 }
										#event_target:home_capital = { distance = { where = PREV distance < 1000 } }
									}
								}
							}
						}
						grant_title = root
					}
	}
	option = { 
		name = HSsummon10
		set_variable = { which = hscount value = 10 }		
	}
	option = { 
		name = HSsummon300
		set_variable = { which = hscount value = 300 }
		wealth = 1000000
		prestige = 150000
		piety = 100000
		change_variable = { which = "hs_magic_varrable" value = 30 }
		change_variable = {which = "hs_idol_exp" value = 30}
		change_variable = {which = "hs_idol_popularity" value = 45}
		set_character_flag = hs_flagdebug
	}
	
	after = {
		while = {
			limit = {
				check_variable = {
					which = hscount
					value = 1
				}
			}    
			subtract_variable = {
				which = hscount
				value = 1
			}
			hs_Chaldea_summonhero_effect = yes
			#hs_jd_summon_effect = yes
			#hs_summonhero_effect = yes
		}
		set_variable = { which = hscount value = 0 }
		
	}
}
narrative_event = {
	id = yl_summon.998
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	ai = no
	
	is_triggered_only = yes 

	
	option = { 
		name = HSsummon1
		set_variable = { which = hscount value = 1 }	
	}
	option = { 
		name = HSsummon5
		set_variable = { which = hscount value = 5 }		
	}
	option = { 
		name = HSsummon10
		set_variable = { which = hscount value = 10 }		
	}
	option = { 
		name = HSsummon300
		set_variable = { which = hscount value = 300 }
		wealth = 1000000
		prestige = 150000
		piety = 100000
		change_variable = { which = "hs_magic_varrable" value = 30 }
		change_variable = {which = "hs_idol_exp" value = 30}
		change_variable = {which = "hs_idol_popularity" value = 45}
		set_character_flag = hs_flagdebug
	}
	
	after = {
		while = {
			limit = {
				check_variable = {
					which = hscount
					value = 1
				}
			}    
			subtract_variable = {
				which = hscount
				value = 1
			}
			#hs_Chaldea_summonhero_effect = yes
			#hs_jd_summon_effect = yes
			#hs_summonhero_effect = yes
			hs_emply_specidol_effect = yes
		}
		set_variable = { which = hscount value = 0 }
		
	}
}
narrative_event = {
	id = yl_summon.999
	desc = EVTDESC_ylsummon10
	picture = "GFX_evt_hssummon"
	title = ylsummon_title
	ai = no
	
	is_triggered_only = yes 

	
	option = { 
		name = HSsummon1
		set_variable = { which = hscount value = 1 }
		
	}
	option = { 
		name = HSsummon5
		set_variable = { which = hscount value = 5 }		
	}
	option = { 
		name = HSsummon10
		set_variable = { which = hscount value = 10 }		
	}
	option = { 
		name = HSsummon300
		set_variable = { which = hscount value = 300 }
		wealth = 1000000
		prestige = 150000
		piety = 100000
		change_variable = { which = "hs_magic_varrable" value = 30 }
		change_variable = {which = "hs_idol_exp" value = 30}
		change_variable = {which = "hs_idol_popularity" value = 45}
		set_character_flag = hs_flagdebug
	}
	
	after = {
		while = {
			limit = {
				check_variable = {
					which = hscount
					value = 1
				}
			}    
			subtract_variable = {
				which = hscount
				value = 1
			}
			#hs_Chaldea_summonhero_effect = yes
			#hs_jd_summon_effect = yes
			hs_summonhero_effect = yes
		}
		set_variable = { which = hscount value = 0 }
		
	}
}