﻿add_namespace = wtt_japan

#Jakob ID 1-100
#Drikus ID 101-200
#Gabriel ID 201-300

 ##  #   # ### ###  #    ##  ###  ###  
#  # #   # #   #  # #   #  # #  # #  # 
#  #  # #  ##  ###  #   #  # ###  #  # 
#  #  # #  #   #  # #   #  # #  # #  # 
 ##    #   ### #  # ###  ##  #  # ###  

#Japans asks to take overlordship if country has capitulated
country_event = {
	id = wtt_japan.1
	title = wtt_japan.1.t
	desc = wtt_japan.1.desc
	picture = GFX_report_event_japanese_transport_soldiers

	is_triggered_only = yes
	
	#Accept transfer puppet
	#Checking for puppet in decision that fires event.
	option = {
		name = wtt_japan.1.a
		ai_chance = {
			base = 10
		}
		if = {
			limit = { ROOT = { tag = HOL }
			}
			FROM = { puppet = INS }
		}

		if = {
			limit = { ROOT = { tag = ENG }
			}
			FROM = { puppet = MAL }
		}

		if = {
			limit = { 
				ROOT = { tag = FRA } 
				NOT = { country_exists = VIN }
			}
			if = {
				limit = {
					670 = {
						is_fully_controlled_by = FRA
					}
				}
				FROM = { transfer_state = 670 }
			}
			if = {
				limit = {
					671 = {
						is_fully_controlled_by = FRA
					}
				}
				FROM = { transfer_state = 671 }
			}
			if = {
				limit = {
					286 = {
						is_fully_controlled_by = FRA
					}
				}
				FROM = { transfer_state = 286 }
			}
			if = {
				limit = {
					741 = {
						is_fully_controlled_by = FRA
					}
				}
				FROM = { transfer_state = 741 }
			}
			if = {
				limit = {
					728 = {
						is_fully_controlled_by = FRA
					}
				}
				FROM = { transfer_state = 728 }
			}
		}
		if = {
			limit = { 
				ROOT = { tag = FRA } 
				country_exists = VIN
			}
			FROM = { puppet = VIN }
			hidden_effect = {
				VIN = {
					set_appropriate_ruler = yes
					set_appropriate_focus_tree = yes
					set_ticking_guerilla_resistance = yes
				}
			}
			if = {
				limit = { country_exists = LAO }
				FROM = { puppet = LAO }
			}
			if = {
				limit = { country_exists = CAM }
				FROM = { puppet = CAM }
			}
		}

		FROM = { country_event = { id = wtt_japan.2 days = 1 } }
	}

	#Refuse
	option = {
		name = wtt_japan.1.b
		ai_chance = {
			base = 0
		}
		FROM = { country_event = { id = wtt_japan.3 days = 1 } }
	}
}

#Answer from wtt_japan.1 - FROM accepts
country_event = {
	id = wtt_japan.2
	title = wtt_japan.2.t
	desc = wtt_japan.2.desc
	picture = GFX_report_event_generic_sign_treaty3

	is_triggered_only = yes
	
	#Accept transfer puppet
	#Checking for puppet in decision that fires event.
	option = {
		name = wtt_japan.2.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			if = {
				limit = { FROM = { tag = HOL }
				}
				puppet = INS
			}

			if = {
				limit = { FROM = { tag = ENG }
				}
				puppet = MAL
			}

			if = {
				limit = { FROM = { tag = FRA } }
				if = {
					limit = { 670 = { is_fully_controlled_by = ROOT } }
					transfer_state = 670
				}
				if = {
					limit = { 671 = { is_fully_controlled_by = ROOT } }
					transfer_state = 671
				}
				if = {
					limit = { 286 = { is_fully_controlled_by = ROOT } }
					transfer_state = 286
				}
				if = {
					limit = { 741 = { is_fully_controlled_by = ROOT }
					}
					transfer_state = 741
				}
			}
			hidden_effect = {
				news_event = { id = wtt_news.25 hours = 6 }
			}		
		}		
	}
}

#Answer from wtt_japan.1 - FROM refuses
country_event = {
	id = wtt_japan.3
	title = wtt_japan.3.t
	desc = wtt_japan.3.desc
	picture = GFX_report_event_japanese_transport_soldiers

	is_triggered_only = yes
	
	
	option = {
		name = wtt_japan.3.a
		ai_chance = {
			base = 0
		}
	}
}

#  #  ##  #  #     ##   ##   ##  ###  ###  ##  ## ###  ##  #  #     ###   ##   ##  ### 
## # #  # ## #    #  # #    #    #  # #   #   #    #  #  # ## #     #  # #  # #  #  #  
# ## #  # # ## ## #### # ## # ## ###  ##   #   #   #  #  # # ##     ###  #### #     #  
#  # #  # #  #    #  # #  # #  # #  # #     #   #  #  #  # #  #     #    #  # #  #  #  
#  #  ##  #  #    #  #  ##   ##  #  # ### ##  ##  ###  ##  #  #     #    #  #  ##   #  


#Japan propose NAP to ROOT
country_event = {
	id = wtt_japan.11
	title = wtt_japan.11.t
	desc = wtt_japan.11.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	#Accept NAP
	option = {
		name = wtt_japan.11.a
		ai_chance = {
			base = 10
		}
		diplomatic_relation = {
			country = FROM
			relation = non_aggression_pact
			active = yes
		}
		FROM = { country_event = { id = wtt_japan.12 days = 1 } }
	}


	#Refuse NAP
	option = {
		name = wtt_japan.11.b
		ai_chance = {
			base = 0
		}
		FROM = { country_event = { id = wtt_japan.13 days = 1 } }	
	}
}

#Japan propose NAP to ROOT
country_event = {
	id = wtt_japan.12
	title = wtt_japan.12.t
	desc = wtt_japan.12.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.12.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			diplomatic_relation = {
				country = FROM
				relation = non_aggression_pact
				active = yes
			}
		}
	}
}

#Japan propose NAP to ROOT
country_event = {
	id = wtt_japan.13
	title = wtt_japan.13.t
	desc = wtt_japan.13.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.13.a
		ai_chance = {
			base = 10
		}
	}
}

 ##  ### #  # ### ###   ##  #    ##     ###  ##      #   #  ##  #  # 
#    #   ## # #   #  # #  # #   #        #  #  #     ## ## #  # ## # 
# ## ##  # ## ##  ###  #### #    #       #  #  #     # # # #### # ## 
#  # #   #  # #   #  # #  # #     #      #  #  #     #   # #  # #  # 
 ##  ### #  # ### #  # #  # ### ##       #   ##      #   # #  # #  # 


#Japan propse all samurai generals go to MAN
country_event = {
	id = wtt_japan.21
	title = wtt_japan.21.t
	desc = wtt_japan.21.desc
	picture = GFX_report_event_japanese_officers

	is_triggered_only = yes
	
	#Accept generals
	option = {
		name = wtt_japan.21.a
		ai_chance = {
			base = 10
		}
		FROM = {		
			every_army_leader = {
				limit = { has_trait = JAP_samurai_lineage }
				set_nationality = ROOT
			}
		}		
		FROM = { country_event = { id = wtt_japan.22 } }
	}
}

#MAN Answers Japan yes
country_event = {
	id = wtt_japan.22
	title = wtt_japan.22.t
	desc = wtt_japan.22.desc
	picture = GFX_report_event_japanese_officers

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.22.a
		ai_chance = {
			base = 10
		}
	}
}

### #   # ###  ### ###  ###  ##  #       ###  ##  #   # ### #   #   # 
 #  ## ## #  # #   #  #  #  #  # #       #   #  # ## ##  #  #    # #  
 #  # # # ###  ##  ###   #  #### #       ##  #### # # #  #  #     #   
 #  #   # #    #   #  #  #  #  # #       #   #  # #   #  #  #     #   
### #   # #    ### #  # ### #  # ###     #   #  # #   # ### ###   #   

#Event to JAP with choice of what to do
country_event = {
	id = wtt_japan.31
	title = wtt_japan.31.t
	desc = wtt_japan.31.desc
	picture = GFX_report_event_jap_imperial_family

	is_triggered_only = yes
	
	#Exile them
	option = {
		name = wtt_japan.31.a
		trigger = {
			country_exists = MAN
		}
		ai_chance = {
			base = 5
		}
		MAN = {
			country_event = { id = wtt_japan.32 }
			effect_tooltip = {
				add_ideas = MAN_exiled_imperial_family
			}
		}
	}

	#Execute them
	option = {
		name = wtt_japan.31.b
		ai_chance = {
			base = 5
		}
		add_stability = -0.1
	}
}

#Event to MAN. Exiled imperial family comes knocking
country_event = {
	id = wtt_japan.32
	title = wtt_japan.32.t
	desc = wtt_japan.32.desc
	picture = GFX_report_event_jap_imperial_family

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.32.a
		ai_chance = {
			base = 10
		}
		add_ideas = MAN_exiled_imperial_family
	}
}

#Event from Communist China: turn over Manchuria OR ELSE
country_event = {
	id = wtt_japan.40
	title = wtt_japan.40.t
	desc = wtt_japan.40.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.40.a
		ai_chance = {
			base = 100
		}
		if = {
			limit = {
				controls_state = 610
			}
			FROM = {
				transfer_state = 610
			}
		}
		if = {
			limit = {
				controls_state = 609
			}
			FROM = {
				transfer_state = 609
			}
		}
		if = {
			limit = {
				controls_state = 716
			}
			FROM = {
				transfer_state = 716
			}
		}
		if = {
			limit = {
				controls_state = 745
			}
			FROM = {
				transfer_state = 745
			}
		}
		if = {
			limit = {
				controls_state = 328
			}
			FROM = {
				transfer_state = 328
			}
		}
		if = {
			limit = {
				controls_state = 717
			}
			FROM = {
				transfer_state = 717
			}
		}
		if = {
			limit = {
				controls_state = 714
			}
			FROM = {
				transfer_state = 714
			}
		}
		if = {
			limit = {
				controls_state = 715
			}
			FROM = {
				transfer_state = 715
			}
		}
		if = {
			limit = {
				controls_state = 761
			}
			FROM = {
				transfer_state = 761
			}
		}
		if = {
			limit = {
				controls_state = 611
			}
			FROM = {
				transfer_state = 611
			}
		}
		if = {
			limit = {
				controls_state = 612
			}
			FROM = {
				transfer_state = 612
			}
		}
	}
	option = {
		name = wtt_japan.40.b
		ai_chance = {
			base = 0
		}
		JAP = {
			remove_from_faction = FROM
		}
	}
}

#Event to MAN. Japan sends guns
country_event = {
	id = wtt_japan.41
	title = wtt_japan.41.t
	desc = wtt_japan.41.desc
	picture = GFX_report_event_

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.41.a
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			JAP = { 
				send_equipment = {
					target = MAN
					equipment = infantry_equipment
					amount = 2000
					old_prioritised = yes
				}
			}
		}
	}
}

# Liberate Manchuria notification event
country_event = {
	id = wtt_japan.101
	title = wtt_japan.101.t
	desc = wtt_japan.101.desc
	picture = GFX_report_event_japanese_soldiers_03

	is_triggered_only = yes
	
	# Yes we will ally
	option = {
		name = wtt_japan.101.a
		ai_chance = {
			base = 1
		}
		JAP = {
			add_to_faction = ROOT
			country_event = { id = wtt_japan.102 days = 1 }
		}
	}

	# No ty
	option = {
		name = wtt_japan.101.b
		ai_chance = {
			base = 0
		}
		JAP = {
			country_event = { id = wtt_japan.103 days = 1 }
		}
	}
}

# Liberate Manchuria alliance notification event for Japan
country_event = {
	id = wtt_japan.102
	title = wtt_japan.101.t
	desc = wtt_japan.102.desc
	picture = GFX_report_event_japanese_soldiers_03

	is_triggered_only = yes
	
	option = {
		name = excellent
		effect_tooltip = { add_to_faction = FROM }
	}
}

# Liberate Manchuria alliance rejected notification event for Japan
country_event = {
	id = wtt_japan.103
	title = wtt_japan.101.t
	desc = wtt_japan.103.desc
	picture = GFX_report_event_japanese_soldiers_03

	is_triggered_only = yes
	
	option = {
		name = unfortunate
	}
}

# Event for USA - Root demanding full sovereignty for the Phillipines
country_event = {
	id = wtt_japan.104
	title = wtt_japan.104.t
	desc = wtt_japan.104.desc
	picture = GFX_report_event_japanese_parade

	is_triggered_only = yes
	
	# They deserve freedom
	option = {
		name = wtt_japan.104.a
		ai_chance = {
			base = 1
		}
		set_autonomy = { target = PHI autonomy_state = autonomy_free }
		JAP = { country_event = { id = wtt_japan.105 days = 1 } }
		"PHI" = { country_event = { id = wtt_japan.107 days = 1 } }
	}

	# Never!
	option = {
		name = wtt_japan.104.b
		ai_chance = {
			base = 0
		}
		JAP = { country_event = { id = wtt_japan.106 days = 1 } }
	}
}

# Notification event for Japan upon USA giving full sovereignty to the Phillipines
country_event = {
	id = wtt_japan.105
	title = wtt_japan.104.t
	desc = wtt_japan.105.desc
	picture = GFX_report_event_generic_usa_treaty

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.105.a
		ai_chance = {
			base = 1
		}
		effect_tooltip = {
			FROM = { set_autonomy = { target = PHI autonomy_state = autonomy_free } }
		}
	}
}

# Notification event for Japan upon USA denying full sovereignty to the Phillipines
country_event = {
	id = wtt_japan.106
	title = wtt_japan.104.t
	desc = wtt_japan.106.desc
	picture = GFX_report_event_generic_usa_treaty

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.106.a
		ai_chance = {
			base = 1
		}
		create_wargoal = {
			type = annex_everything
			target = FROM
		}
	}
}

# Notification event for Phillipines upon USA giving full sovereignty to the Phillipines
country_event = {
	id = wtt_japan.107
	title = wtt_japan.104.t
	desc = wtt_japan.107.desc
	picture = GFX_report_event_generic_usa_treaty

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.107.a
		ai_chance = {
			base = 1
		}
		effect_tooltip = {
			FROM = { set_autonomy = { target = PHI autonomy_state = autonomy_free } }
		}
		hidden_effect = {
			news_event = { id = wtt_news.26 hours = 6 }
		}
	}
}

# Coup placing Hirohito back in full control of the country
country_event = {
	id = wtt_japan.108
	title = wtt_japan.108.t
	desc = wtt_japan.108.desc
	picture = GFX_report_event_japanese_parade

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.108.a
		set_politics = { ruling_party = neutrality elections_allowed = no }
		add_popularity = { ideology = neutrality popularity = 0.9 }
		add_timed_idea = { idea = JAP_military_purges days = 90 }
		if = { #MM: I honestly have no idea about how this works, so checking just in case
			limit = {
				JAP_emperor_hirohito = {
					is_country_leader = yes
				}
			}
			remove_country_leader_role = {
				character = JAP_emperor_hirohito
				ideology = fascism_ideology
			}
		}
		add_country_leader_role = {
			character = JAP_emperor_hirohito
			country_leader = {
				expire = "1989.1.1"
				ideology = despotism
				traits = {
					warrior_code
					emperor_showa
				}
				id = 700 #Hirohito
			}
			promote_leader = yes
		}
		hidden_effect = { news_event = { id = wtt_news.27 hours = 6 } }
	}
}

### ###  ### ###   ##  ###  ### ### ### ###     ###   ##   ##  ### 
 #  #  #  #  #  # #  # #  #  #   #   #  #       #  # #  # #  #  #  
 #  ###   #  ###  #### ###   #   #   #  ##      ###  #### #     #  
 #  #  #  #  #    #  # #  #  #   #   #  #       #    #  # #  #  #  
 #  #  # ### #    #  # #  #  #  ###  #  ###     #    #  #  ##   #  

 # Event for Germany to accept Tripartite Pact
country_event = {
	id = wtt_japan.109
	title = wtt_japan.109.t
	desc = wtt_japan.109.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			FROM = { save_event_target_as = JAP_initiator }
			save_event_target_as = GER_fascism
			random_country = {
				limit = {
					original_tag = ITA
					has_government = fascism
				}
				save_event_target_as = ITA_fascism
			}
		}
	}
	
	option = {
		name = wtt_japan.109.a #accept
		ai_chance = {
			base = 10
		}

		event_target:ITA_fascism = {
			country_event = { id = wtt_japan.110 hours = 6 }
		}
	}

	option = {
		name = wtt_japan.109.b #refuse
		ai_chance = {
			base = 0
		}

		event_target:JAP_initiator = { country_event = { id = wtt_japan.112 hours = 6 } }
		event_target:ITA_fascism = { country_event = { id = wtt_japan.112 hours = 6 } }
	}
}

 # Event for Italy to accept Tripartite Pact
country_event = {
	id = wtt_japan.110
	title = wtt_japan.109.t
	desc = wtt_japan.110.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.109.a ##accept
		ai_chance = {
			base = 0
			modifier = {
				add = 10
				OR = {
					ITA_is_historical_ai = yes
					ITA_is_alt_fascist_balbo_ai = yes
				}
			}
		}
		event_target:JAP_initiator = {
			give_guarantee = event_target:ITA_fascism
			give_guarantee = event_target:GER_fascism
		}
		event_target:GER_fascism = {
			give_guarantee = event_target:ITA_fascism
			give_guarantee = event_target:JAP_initiator
		}
		event_target:ITA_fascism = {
			give_guarantee = event_target:JAP_initiator
			give_guarantee = event_target:GER_fascism
		}
		event_target:JAP_initiator = { country_event = { id = wtt_japan.111 hours = 6 } }
		event_target:GER_fascism = { country_event = { id = wtt_japan.113 hours = 6 } }
	}

	option = {
		name = wtt_japan.109.b ##refuse
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					ITA_is_historical_ai = yes
					ITA_is_alt_fascist_balbo_ai = yes
				}
			}
		}
		
		event_target:GER_fascism = { country_event = { id = wtt_japan.112 hours = 6 } }
		event_target:JAP_initiator = { country_event = { id = wtt_japan.112 hours = 6 } }
	}
}

 #Notification event that Tripartite Pact has been signed
country_event = {
	id = wtt_japan.111
	title = wtt_japan.111.t
	desc = wtt_japan.111.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = excellent
		ai_chance = {
			base = 10
		}
		effect_tooltip = {
			event_target:JAP_initiator = {
				give_guarantee = event_target:ITA_fascism
				give_guarantee = event_target:GER_fascism
			}
			event_target:GER_fascism = {
				give_guarantee = event_target:ITA_fascism
				give_guarantee = event_target:JAP_initiator
			}
			event_target:ITA_fascism = {
				give_guarantee = event_target:JAP_initiator
				give_guarantee = event_target:GER_fascism
			}
		}
		hidden_effect = {
			every_country = {
				limit = {
					is_literally_china = yes
				}
				event_target:ITA_fascism = {
					add_ai_strategy = {
						type = alliance
						id = PREV
						value = -500
					}
				}
				event_target:GER_fascism = {
					add_ai_strategy = {
						type = alliance
						id = PREV
						value = -500
					}
				}
			}
		}
	}
}

 #Notification event that FROM has rejected Tripartite Pact
country_event = {
	id = wtt_japan.112
	title = wtt_japan.112.t
	desc = wtt_japan.112.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = unfortunate
	}
}

 #Notification event for GER that ITA has accepted Tripartite Pact
country_event = {
	id = wtt_japan.113
	title = wtt_japan.113.t
	desc = wtt_japan.113.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = excellent
		effect_tooltip = {
			event_target:JAP_initiator = {
				give_guarantee = event_target:ITA_fascism
				give_guarantee = event_target:GER_fascism
			}
			event_target:GER_fascism = {
				give_guarantee = event_target:ITA_fascism
				give_guarantee = event_target:JAP_initiator
			}
			event_target:ITA_fascism = {
				give_guarantee = event_target:JAP_initiator
				give_guarantee = event_target:GER_fascism
			}
		}
	}
}

###  ### #   #  ##   ##  ###   ##  ### ###  ##       ##   ##  #  # ###  
#  # #   ## ## #  # #  # #  # #  #  #   #  #  #     #  # #  # #  # #  # 
#  # ##  # # # #  # #    ###  ####  #   #  #        #    #  # #  # ###  
#  # #   #   # #  # #  # #  # #  #  #   #  #  #     #  # #  # #  # #    
###  ### #   #  ##   ##  #  # #  #  #  ###  ##       ##   ##   ##  #    

#Democratic Coup event
country_event = {
	id = wtt_japan.114
	title = wtt_japan.114.t
	desc = wtt_japan.114.desc
	picture = GFX_report_event_japanese_soldiers_02

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.114.a
		if = {
			limit = {
				MAN = { is_subject_of = ROOT }
			}
			set_autonomy = { target = MAN autonomy_state = autonomy_free }
			if = {
				limit = {
					MEN = { is_subject_of = ROOT }
				}
				MAN = { puppet = MEN }
			}
			MAN = {
				set_cosmetic_tag = MAN_kwantung_army
			}
		}
		if = {
			limit = {
				MAN = { has_idea = MAN_kwantung_veto }
			}
			MAN = { remove_ideas = MAN_kwantung_veto }
		}
		add_popularity = { ideology = democratic popularity = 0.1 }
		start_civil_war = {
			ruling_party = democratic
			ideology = fascism
			size = 0.5
		}
		if = {
			limit = {
				any_state = {
					is_controlled_by = ROOT
					is_core_of = KOR
				}
			}
			release = KOR
			set_autonomy = { target = KOR autonomy_state = autonomy_free }
		}
	}
}

###  ###  ###    ### #   # ###  ### ### #   # ###     #   #  ##  ###  
#  # #  # #      #   ## ## #  #  #   #  #   # #       #   # #  # #  # 
###  ###  ##  ## ##  # # # ###   #   #   # #  ##      # # # #### ###  
#    #  # #      #   #   # #     #   #   # #  #       # # # #  # #  # 
#    #  # ###    ### #   # #     #  ###   #   ###      # #  #  # #  # 

#German notification event that Japan has gone to war with USSR despite mol-rib pact
country_event = {
	id = wtt_japan.115
	title = wtt_japan.115.t
	desc = wtt_japan.115.desc
	picture = GFX_report_event_japanese_parade

	is_triggered_only = yes
	
	# Join the war
	option = {
		name = wtt_japan.115.a
		add_to_war = { targeted_alliance = JAP enemy = SOV hostility_reason = ally }
		JAP = { country_event = { id = wtt_japan.116 hours = 6 } }
	}

	# Keep the NAP
	option = {
		name = wtt_japan.115.b
		add_opinion_modifier = { target = JAP modifier = unilateral_war }
		reverse_add_opinion_modifier = { target = JAP modifier = betrayed_alliance }
		JAP = { country_event = { id = wtt_japan.117 hours = 6 } }
	}
}

#Japanese notification event that Germany has decided to join war against SOV
country_event = {
	id = wtt_japan.116
	title = wtt_japan.116.t
	desc = wtt_japan.116.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.116.a
	}
}

#Japanese notification event that Germany has decided to not join war against SOV
country_event = {
	id = wtt_japan.117
	title = wtt_japan.117.t
	desc = wtt_japan.117.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.117.a
	}
}

 ##   ##  #   # #   # #  # #  # ###  ## ###      ##  ### #   # ### #       #   #  ##  ###  
#  # #  # ## ## ## ## #  # ## #  #  #    #      #  #  #  #   #  #  #       #   # #  # #  # 
#    #  # # # # # # # #  # # ##  #   #   #      #     #   # #   #  #       # # # #### ###  
#  # #  # #   # #   # #  # #  #  #    #  #      #  #  #   # #   #  #       # # # #  # #  # 
 ##   ##  #   # #   #  ##  #  # ### ##   #       ##  ###   #   ### ###      # #  #  # #  # 

# Event for SOV: Japan offering South Sakhalin in exchange for Soviet assistance
country_event = {
	id = wtt_japan.118
	title = wtt_japan.118.t
	desc = wtt_japan.118.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	# Accept
	option = {
		name = wtt_japan.118.a
		ai_chance = {
			base = 10
		}
		FROM = { country_event = { id = wtt_japan.119 hours = 6 } }
		hidden_effect = { set_country_flag = sent_volunteers_to_JAP }
		add_manpower = -105000
		effect_tooltip = {
			transfer_state = 537
		}
	}

	# Decline
	option = {
		name = wtt_japan.118.b
		ai_chance = {
			base = 0
		}
		FROM = { country_event = { id = wtt_japan.120 hours = 6 } }
		custom_effect_tooltip = wtt_japan_118_TT
	}
}

# Event for JAP: SOV accepted
country_event = {
	id = wtt_japan.119
	title = wtt_japan.119.t
	desc = wtt_japan.119.desc
	picture = GFX_report_event_soviet_soldiers

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.119.a
		FROM = { transfer_state = 537 }
		division_template = { 
			name = "Soviet Volunteers"
			division_names_group = SOV_INF_01
			is_locked = yes
			regiments = { 
				infantry = { x = 0 y = 0 }
				infantry = { x = 1 y = 0 }
				infantry = { x = 2 y = 0 }
				infantry = { x = 3 y = 0 }

				infantry = { x = 0 y = 1 }
				infantry = { x = 1 y = 1 }
				infantry = { x = 2 y = 1 }
				infantry = { x = 3 y = 1 }

				infantry = { x = 0 y = 2 }
				infantry = { x = 1 y = 2 }
				infantry = { x = 2 y = 2 }
				infantry = { x = 3 y = 2 }
			}
			support = {
				recon = { x = 0 y = 0 }
				engineer = { x = 0 y = 1 }
				artillery = { x = 0 y = 2 }
			}
		}
		random_owned_controlled_state = {
			prioritize = { 535 }
			custom_effect_tooltip = wtt_japan.119.TT
			hidden_effect = {
				create_unit = { 
					division = "name = \"1. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"2. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"3. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"4. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"5. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"6. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"7. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
				create_unit = { 
					division = "name = \"8. Soviet Volunteers\" division_template = \"Soviet Volunteers\" start_experience_factor = 0.5" 
					owner = ROOT
				}
			}
		}
	}
}

# Event for JAP: SOV declined
country_event = {
	id = wtt_japan.120
	title = wtt_japan.120.t
	desc = wtt_japan.120.desc
	picture = GFX_report_event_japan_europe_pact

	is_triggered_only = yes
	
	option = {
		name = wtt_japan.120.a
	}
}

# Event for MAN: Commie JAP took Tokyo
country_event = {
	id = wtt_japan.121
	title = wtt_japan.121.t
	desc = wtt_japan.121.desc
	picture = GFX_report_event_japanese_army_parade

	is_triggered_only = yes
	fire_only_once = yes
	
	# Annex them!
	option = {
		name = wtt_japan.121.a
		ai_chance = {
			base = 10
		}
		event_target:jap_civ_loser = { delete_unit_template_and_units = { division_template = "Japanese Loyalist Regiment" } }
		FROM = {
			delete_unit_template_and_units = { division_template = "Japanese People's Regiment" }
			delete_unit_template_and_units = { division_template = "Soviet Volunteers" }
			transfer_state = 529
			transfer_state = 530
			transfer_state = 528
			transfer_state = 282
			transfer_state = 533
			transfer_state = 536
			transfer_state = 555
			country_event = { id = wtt_japan.122 }
		}
		if = {
			limit = {
				SOV = { has_country_flag = sent_volunteers_to_JAP }
			}
			effect_tooltip = {
				SOV = { add_manpower = 105000 }
			}
			country_event = { id = wtt_japan.124 }
		}
		annex_country = { target = event_target:jap_civ_loser transfer_troops = yes }
		set_cosmetic_tag = MAN_kwantung_army
	}

	# This is not our fight.
	option = {
		name = wtt_japan.121.b
		ai_chance = {
			base = 0
		}
		FROM = {
			annex_country = { target = event_target:jap_civ_loser }
			country_event = { id = wtt_japan.123 }
		}
		if = {
			limit = {
				SOV = { has_country_flag = sent_volunteers_to_JAP }
			}
			effect_tooltip = {
				SOV = { add_manpower = 105000 }
			}
			country_event = { id = wtt_japan.124 }
		}
	}
}

# Event for JAP: MAN takes rest of Japan but war is over
country_event = {
	id = wtt_japan.122
	title = wtt_japan.122.t
	desc = wtt_japan.122.desc
	picture = GFX_report_event_japanese_officers

	is_triggered_only = yes
	
	# Annex them!
	option = {
		name = wtt_japan.122.a
		effect_tooltip = {
			transfer_state = 529
			transfer_state = 530
			transfer_state = 528
			transfer_state = 282
			transfer_state = 533
			transfer_state = 536
			transfer_state = 555
			FROM = { annex_country = { target = event_target:jap_civ_loser transfer_troops = yes } }
		}
	}
}

# Event for JAP: MAN does not take rest of Japan but war is over
country_event = {
	id = wtt_japan.123
	title = wtt_japan.123.t
	desc = wtt_japan.123.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	# Annex them!
	option = {
		name = wtt_japan.123.a
		effect_tooltip = {
			annex_country = { target = event_target:jap_civ_loser }
		}
	}
}

# Event for SOV: war is over, volunteers return home.
country_event = {
	id = wtt_japan.124
	title = wtt_japan.124.t
	desc = wtt_japan.124.desc
	picture = GFX_report_event_soviet_soldiers

	is_triggered_only = yes
	
	option = {
		name = excellent
		SOV = { add_manpower = 90143 }
	}
}

#   #  ##  #  #  ##  #  # #  # ###  ###  ##  
## ## #  # ## # #  # #  # #  # #  #  #  #  # 
# # # #### # ## #    #### #  # ###   #  #### 
#   # #  # #  # #  # #  # #  # #  #  #  #  # 
#   # #  # #  #  ##  #  #  ##  #  # ### #  # 

# Notification event that SOV returns Manchuria
country_event = {
	id = wtt_japan.125
	title = wtt_japan.125.t
	desc = wtt_japan.125.desc
	picture = GFX_report_event_soviet_soldiers

	is_triggered_only = yes
	
	option = {
		name = excellent
		effect_tooltip = {
			transfer_state = 609
			transfer_state = 610
			transfer_state = 716
			transfer_state = 715
			transfer_state = 328
			transfer_state = 717
			transfer_state = 714
		}
	}
}

 ## #  # ###  ###  ### #  # ###  ### ###  
#   #  # #  # #  # #   ## # #  # #   #  # 
 #  #  # ###  ###  ##  # ## #  # ##  ###  
  # #  # #  # #  # #   #  # #  # #   #  # 
##   ##  #  # #  # ### #  # ###  ### #  # 

# Event for China that Japan wants to surrender
country_event = {
	id = wtt_japan.126
	title = wtt_japan.126.t
	desc = wtt_japan.126.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	# We accept their surrender.
	option = {
		name = wtt_japan.126.a
		effect_tooltip = {
			if = {
				limit = {
					NOT = {
						MAN = {
							controls_state = 525
							controls_state = 527
						}
					}
				}
				FROM = { release = KOR }
			}
			if = {
				limit = {
					524 = {
						is_controlled_by = JAP
					}
				}
				event_target:WTT_current_china_leader = {
					transfer_state = 524
				}
			}
			if = {
				limit = {
					event_target:WTT_current_china_leader = { #Chinese United Front
						is_faction_leader = yes
					}
				}
				every_country = {
					limit = {
						is_literally_china = yes
						has_war_with = ROOT
						is_in_faction_with = event_target:WTT_current_china_leader
					}
					every_controlled_state = {
						limit = {
							OWNER = {
								OR = {
									original_tag = JAP
									is_subject_of = JAP
									is_in_faction_with = JAP
								}
							}
						}
						CONTROLLER = {
							transfer_state = PREV
						}
					}
				}
				every_other_country = {
					limit = {
						is_literally_china = yes
						has_war_with = ROOT
						is_in_faction_with = event_target:WTT_current_china_leader
					}
					white_peace = ROOT
				}
			}
			else = {
				every_other_country = {
					limit = {
						is_literally_china = yes
						has_war_with = ROOT
					}
					every_controlled_state = {
						limit = {
							OWNER = {
								OR = {
									original_tag = JAP
									is_subject_of = JAP
									is_in_faction_with = JAP
								}
							}
						}
						CONTROLLER = {
							transfer_state = PREV
						}
					}
				}
				every_other_country = {
					limit = {
						is_literally_china = yes
						has_war_with = ROOT
					}
					white_peace = ROOT
				}
			}
		}
		FROM = {
			country_event = { id = wtt_japan.127 }
		}
		set_country_flag = achievement_JAP_sue_for_peace_CHI_completed
		
		ai_chance = {
			factor = 90
			modifier = {
				factor = 0
				JAP = { surrender_progress > 0 } #lmao you are sooo done for
			}
		}
	}

	# No surrender! We want total victory!
	option = {
		name = wtt_japan.126.b
		FROM = {
			country_event = { id = wtt_japan.128 }
		}
		
		ai_chance = { # If Japan has lots of major enemies, the AI will not make a separate peace
			factor = 10
			modifier = {
				add = 50
				USA = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
			modifier = {
				add = 40
				ENG = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
			modifier = {
				add = 30
				SOV = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
			modifier = {
				add = 20
				FRA = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
			modifier = {
				add = 10
				GER = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
			modifier = {
				add = 10
				HOL = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
			modifier = {
				add = 10
				ITA = {
					has_war_with = JAP
					NOT = {
						has_war_with = ROOT
					}
				}
			}
		}
	}
}

# Event for Japan that China has accepted
country_event = {
	id = wtt_japan.127
	title = wtt_japan.127.t
	desc = wtt_japan.127.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	# They have accepted.
	option = {
		name = wtt_japan.127.a
		if = {
			limit = {
				NOT = {
					MAN = {
						controls_state = 525
						controls_state = 527
					}
				}
			}
			release = KOR
			KOR = {
				transfer_state = 525
				transfer_state = 527
			}
		}
		if = {
			limit = {
				524 = { #Taiwan
					is_controlled_by = JAP
				}
			}
			event_target:WTT_current_china_leader = {
				transfer_state = 524
			}
		}
		if = {
			limit = {
				event_target:WTT_current_china_leader = { #Chinese United Front
					is_faction_leader = yes
				}
			}
			every_country = {
				limit = {
					is_literally_china = yes
					has_war_with = ROOT
					is_in_faction_with = event_target:WTT_current_china_leader
				}
				every_controlled_state = {
					limit = {
						OWNER = {
							OR = {
								original_tag = JAP
								is_subject_of = JAP
								is_in_faction_with = JAP
							}
						}
					}
					CONTROLLER = {
						transfer_state = PREV
					}
				}
			}
			every_other_country = {
				limit = {
					is_literally_china = yes
					has_war_with = ROOT
					is_in_faction_with = event_target:WTT_current_china_leader
				}
				white_peace = ROOT
			}
		}
		else = {
			every_other_country = {
				limit = {
					is_literally_china = yes
					has_war_with = ROOT
				}
				every_controlled_state = {
					limit = {
						OWNER = {
							OR = {
								original_tag = JAP
								is_subject_of = JAP
								is_in_faction_with = JAP
							}
						}
					}
					CONTROLLER = {
						transfer_state = PREV
					}
				}
			}
			every_other_country = {
				limit = {
					is_literally_china = yes
					has_war_with = ROOT
				}
				white_peace = ROOT
			}
		}
		hidden_effect = {
			set_truce = {
				target = PRC
				days = 730
			}
			set_truce = {
				target = CHI
				days = 730
			}
			set_truce = {
				target = XSM
				days = 730
			}
			set_truce = {
				target = SHX
				days = 730
			}
			set_truce = {
				target = GXC
				days = 730
			}
			set_truce = {
				target = YUN
				days = 730
			}
			set_truce = {
				target = SIK
				days = 730
			}
		}
	}
}

# Event for Japan that China has rejected
country_event = {
	id = wtt_japan.128
	title = wtt_japan.128.t
	desc = wtt_japan.128.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	# They have rejected our surrender offer.
	option = {
		name = wtt_japan.128.a
	}
}

# Event for MAN that Japan wants to surrender
country_event = {
	id = wtt_japan.129
	title = wtt_japan.126.t
	desc = wtt_japan.126.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	# We accept their surrender.
	option = {
		name = wtt_japan.126.a
		ai_chance = {
			factor = 1
		}
		effect_tooltip = {
			if = {
				limit = {
					NOT = {
						any_country = {
							is_literally_china = yes
							controls_state = 525
							controls_state = 527
						}
					}
				}
				FROM = { release = KOR }
				KOR = {
					transfer_state = 525
					transfer_state = 527
				}
			}
			if = {
				limit = {
					524 = {
						is_controlled_by = JAP
					}
				}
				transfer_state = 524
			}
			MAN = {
				every_controlled_state = {
					limit = {
						OR = {
							is_owned_by = JAP
							AND = {
								is_owned_by = MEN
								MEN = { is_subject_of = JAP }
							}
						}
						NOT = {
							state = 525
							state = 527
						}
					}
					every_country = {
						limit = {
							original_tag = MAN
							controls_state = PREV
						}
						transfer_state = PREV
					}
				}
				white_peace = JAP
			}
		}
		FROM = {
			country_event = { id = wtt_japan.130 }
		}
	}

	# No surrender! We want total victory!
	option = {
		name = wtt_japan.126.b
		ai_chance = {
			factor = 0
			modifier = {
				add = 100
				JAP = { surrender_progress > 0 }
			}
		}
		FROM = {
			country_event = { id = wtt_japan.128 }
		}
	}
}

# Event for Japan that MAN has accepted
country_event = {
	id = wtt_japan.130
	title = wtt_japan.127.t
	desc = wtt_japan.127.desc
	picture = GFX_report_event_japanese_chinese_surrender

	is_triggered_only = yes
	
	# They have accepted.
	option = {
		name = wtt_japan.127.a
		if = {
			limit = {
				NOT = {
					any_country = {
						is_literally_china = yes
						controls_state = 525
						controls_state = 527
					}
				}
			}
			release = KOR
			KOR = {
				transfer_state = 525
				transfer_state = 527
			}
		}
		if = {
			limit = {
				524 = {
					is_controlled_by = JAP
				}
			}
			MAN = { transfer_state = 524 }
		}
		MAN = {
			every_controlled_state = {
				limit = {
					OR = {
						is_owned_by = JAP
						AND = {
							is_owned_by = MEN
							MEN = { is_subject_of = JAP }
						}
					}
				}
				MAN = {
					transfer_state = PREV
				}
			}
			white_peace = ROOT
		}
	}
}

###   ##  ###  ###  ### ###       ##   ##  #  # ### #   ###  ##  ###  ## 
#  # #  # #  # #  # #   #  #     #  # #  # ## # #   #    #  #  #  #  #   
###  #  # ###  #  # ##  ###      #    #  # # ## ##  #    #  #     #   #  
#  # #  # #  # #  # #   #  #     #  # #  # #  # #   #    #  #  #  #    # 
###   ##  #  # ###  ### #  #      ##   ##  #  # #   ### ###  ##   #  ##  

add_namespace = japan_border_conflict

#initial border incident against Soviet Union
country_event = {
	id = japan_border_conflict.1
	title = japan_border_conflict.1.t
	desc = japan_border_conflict.1.desc
	picture = GFX_report_event_japan_army_mountainside

	is_triggered_only = yes

	option = {
		name = japan_border_conflict.1.a
	}
}
#Japan wins
country_event = {
	id = japan_border_conflict.2
	title = japan_border_conflict.2.t
	desc = japan_border_conflict.2.desc
	picture = GFX_report_event_japanese_transport_soldiers

	is_triggered_only = yes

	option = {
		name = japan_border_conflict.2.a
		trigger = {
			original_tag = JAP
		}
		add_doctrine_cost_reduction = {
			name = sov_jap_border_conflict_won
			cost_reduction = 0.35
			uses = 2
			category = land_doctrine
		}
		add_tech_bonus = {
			name = sov_jap_border_conflict_won
			category = armor
			bonus = 1.0
		}
	}
	option = {
		name = japan_border_conflict.2.b
		trigger = {
			original_tag = SOV
		}
		army_experience = 35
	}
}
#Japan loses
country_event = {
	id = japan_border_conflict.3
	title = japan_border_conflict.3.t
	desc = japan_border_conflict.3.desc
	picture = GFX_report_event_japanese_soldiers_03

	is_triggered_only = yes

	option = {
		name = japan_border_conflict.3.a
		trigger = {
			original_tag = JAP
		}
		army_experience = 35
	}
	option = {
		name = japan_border_conflict.3.b
		trigger = {
			original_tag = SOV
		}
		add_doctrine_cost_reduction = {
			name = sov_jap_border_conflict_won
			cost_reduction = 0.45
			uses = 1
			category = land_doctrine
		}
	}
}

#stalemate
country_event = { 
	id = japan_border_conflict.4
	title = japan_border_conflict.4.t
	desc = japan_border_conflict.4.desc
	picture = GFX_report_event_japanese_army_parade

	is_triggered_only = yes

	option = {
		name = japan_border_conflict.4.a
		trigger = {
			original_tag = JAP
		}
		army_experience = 75
	}
	option = {
		name = japan_border_conflict.3.b
		trigger = {
			original_tag = SOV
		}
		army_experience = 75
	}
}

#japan escalates
country_event = {
	id = japan_border_conflict.5
	title = japan_border_conflict.5.t
	desc = japan_border_conflict.5.desc
	picture = GFX_report_event_japanese_parade

	is_triggered_only = yes

	option = {
		name = japan_border_conflict.5.a
		
	}
	
}

#Soviet escalates
country_event = {
	id = japan_border_conflict.6
	title = japan_border_conflict.6.t
	desc = japan_border_conflict.6.desc
	picture = GFX_report_event_SOV_tank_column

	is_triggered_only = yes

	option = {
		name = japan_border_conflict.6.a
		
	}
	
}