###########################
# China Events
###########################

add_namespace = china


# beifangsiling
country_event = {
	id = beifangsiling.2
	title = beifangsiling.2.t
	desc = beifangsiling.2.d
	picture = GFX_report_event_polish_tanks_01
	
	is_triggered_only = yes
	
	option = {
		name = beifangsiling.2.a
		ai_chance = { factor = 30 }
		effect_tooltip = {
			CHI = {
				if = {
					limit = { SOV = { owns_state = 408 controls_state = 408 } }
					transfer_state = 408
				}
				if = {
					limit = { SOV = { owns_state = 409 controls_state = 409 } }
					transfer_state = 409
				}
				if = {
					limit = { SOV = { owns_state = 560 controls_state = 560 } }
					transfer_state = 560
				}
				if = {
					limit = { SOV = { owns_state = 561 controls_state = 561 } }
					transfer_state = 561
				}
				if = {
					limit = { SOV = { owns_state = 563 controls_state = 563 } }
					transfer_state = 563
				}
				if = {
					limit = { SOV = { owns_state = 657 controls_state = 657 } }
					transfer_state = 657
				}
				if = {
					limit = { SOV = { owns_state = 655 controls_state = 655 } }
					transfer_state = 655
				}
			}
		}
		CHI = {country_event = { id = beifangsiling.3} }
	}

	option = {
		name = beifangsiling.2.b
		ai_chance = { factor = 70 }
		effect_tooltip = {
			SOV = {
				create_wargoal = {
					type = take_state_focus
					target = SOV
					generator = { 408 409 560 561 563 657 655 }
				}
			}
		}
		SOV = { country_event = { id = beifangsiling.4 } }
	}
}

# Poland Cedes the East
country_event = {
	id = beifangsiling.3
	title = poland.3.t
	desc = poland.3.d
	picture = GFX_report_event_polish_tanks_01
	
	is_triggered_only = yes
	
	option = {
		name = poland.3.a
		if = {
			limit = { 
				SOV = { 
					owns_state = 408
					controls_state = 408
				}
			}
			transfer_state = 408
		}
		if = {
			limit = { 
				SOV = { 
					owns_state = 409
					controls_state = 409
				}
			}
			transfer_state = 409
		}
		if = {
			limit = { 
				SOV = { 
					owns_state = 560
					controls_state = 560
				}
			}
			transfer_state = 560
		}
		if = {
			limit = { 
				SOV = { 
					owns_state = 561
					controls_state = 561
				}
			}
			transfer_state = 561
		}
		if = {
			limit = { 
				SOV = { 
					owns_state = 563
					controls_state = 563
				}
			}
			transfer_state = 563
		}
		if = {
			limit = { 
				SOV = { 
					owns_state = 657
					controls_state = 657
				}
			}
			transfer_state = 657
		}
		if = {
			limit = { 
				SOV = { 
					owns_state = 655
					controls_state = 655
				}
			}
			transfer_state = 655
		}
		hidden_effect = {
			news_event = { id = news.194 }
		}
	}
}

# Poland Refuses to Cede the East
country_event = {
	id = beifangsiling.4
	title = poland.4.t
	desc = poland.4.d
	picture = GFX_report_event_polish_tanks_01
	
	is_triggered_only = yes
	
	option = {
		name = poland.4.a
		create_wargoal = {
			type = take_state_focus
			target = POL
			generator = { 408 409 560 561 563 657 655 }
		}
	}
}

#Eastern Poland Ceded to the Soviet Union
news_event = {
	id = news.194
	title = news.194.t
	desc = news.194.d
	picture = GFX_news_event_generic_sign_treaty1

	major = yes

	is_triggered_only = yes

	fire_for_sender = no

	immediate = {
		SOV = {
			save_event_target_as = beifangsiling
		}
	}

	#[Poland.GetName] recognises the strength of the [From.GetFactionName]!
	option = {
		name = news.194.a
		trigger = {
			is_in_faction_with = CHI
		}
	}

	#The [From.GetName] consumes everything in its path.
	option = {
		name = news.194.b
		trigger = {
			NOT = {
				is_in_faction_with = CHI
			}
			is_in_faction = yes
		}
	}

	#[Poland.GetName] must have been left with no other choice.
	option = {
		name = news.194.c
		trigger = {
			is_in_faction = no
		}
	}
}