
#scripted_diplomatic_actions = {
#
#	action_key = { # will be used in most localizations
#	
#		# root is the initiator of action and this is the target country
#		allowed = { #if action is valid
#			always = yes
#		}
#		visible = { #if action is visible on gui
#			always = yes
#		}
#		selectable = { #if action is selectable on gui
#			always = yes
#		}
#
#		requires_acceptance = yes # if true the action will require acceptance of target country
#		cost = 10 # pp cost, can be zero
#		command_power = 10 # cp cost, can be zero
#
#		cost_string = loc_key # if you have a custom cost, use this loc to display it
#		show_acceptance_on_action_button = yes # set to no if acceptance shouldn't be displayed on the action button
#
#		icon = 1 # icon frame to use in notification
#
#       #for effects/triggers/variables, root is the sender and this is receiver
#
#		# runs when the action is sent
#		on_sent_effect = {
#		}
#
#		# runs when the action is properly sent and accepted
#		complete_effect = {
#		}
#
#		# runs when the action is properly sent and rejected
#		reject_effect = {
#		}
#
#		# SEND POPUP CUSTOMIZATION
#		# use diplomatic_action as context in scripted gui
#		# send_scripted_gui = send_scripted_gui_name # if specified, the diplomatic action will use this scripted gui before sending the request. the player (or ai) can make changes on that gui and store stuff as variable to customize action
#		reset_send_effect = { # if action has a send scripted gui, this effect will be used for clearing the state of gui (will run when player opens the scripted gui by sending the action or when ai proposes action
#			# clear action
#			if = {
#				limit = { 
#					root = {
#						is_ai = yes
#					}
#				}
#				# initialize for ai
#			}
#		}
#		can_be_sent = { # send button will be disabled if no
#			always = yes
#		}
#		send_description = loc_key_send # if there is no scripted gui, this desc will be used in send yes/no pop up
#
#
#		# RECEIVE POPUP CUSTOMIZATION
#		# use diplomatic_action as context in scripted gui
#		# receive_scripted_gui = receive_scripted_gui_name #if specified the receiver of the action will get this scripted gui instead of yes-no popup when they receive the propose
#		reset_receive_effect = {
#			# clear action
#			if = {
#				limit = { 
#					is_ai = yes
#				}
#				# change stuff for ai
#			}
#		}
#		can_be_accepted = { # accept button will be disabled if no
#			always = yes
#		}
#		receive_description = loc_key_receive # if there is no scripted gui, this desc will be used in send yes/no pop up
#
#		
#		# PLAYER FEEDBACK ON ACCEPT/REJECT
#		accept_title = loc_key_accept #can be overridden to customize accepted/rejected pop ups for the sender
#		accept_description = loc_key_accept_desc
#		reject_title = loc_key_reject
#		reject_description = loc_key_reject_desc
#	
#		
#		# AI
#		# a list of ai_will_do entries that will be used to decide if AI should accept or reject a request
#		ai_acceptance = {
#			condition = { # name is used for loc
#				base = 100
#			}
#		}
#
#		# ai_will_do to decide if AI should send this action or not
#		ai_desire = {
#			base = -1
#			modifier = {
#				ROOT = {
#					tag = ENG
#				}
#				tag = GER
#				add = 1000
#			}
#		}
#	}
#}

scripted_diplomatic_actions = {
	request_tribute = {
		icon = 13
		## Conditions ##
		allowed = {
			is_puppet = no
		}
		visible = {
			ROOT = {
				NOT = {has_government = democratic}
			}
		}
		selectable = {
			ROOT = {
				NOT = {
					has_war_with = PREV
				}
			}
			PREV = {
				is_in_faction = no
				is_subject = no
				OR = {
					is_neighbor_of = ROOT
					OR = {
						ROOT = {
							OR = {
								original_tag = PRC
								original_tag = SOV
							}
							has_completed_focus = GEN_china_offence
						}
						ROOT = {
							original_tag = CRI
							OR = {
								owns_state = 213
								owns_state = 408
								owns_state = 797
								RIF = {
									exists = yes
									is_ally_with = CRI
								}
								EGY = {
									has_country_flag = EGY_caved_to_crimea
								}
								LBV = {
									exists = yes
									is_ally_with = CRI
								}
								PAP = {
									exists = yes
									is_ally_with = CRI
								}
								TTS = {
									exists = yes
									is_ally_with = CRI
								}
								GRE = {
									exists = yes
									is_ally_with = CRI
								}
							}
						}
					}
				}
			}
		}
		can_be_accepted = {
		}
		can_be_sent = {
		}
		
		cost = 200
		requires_acceptance = yes
		show_acceptance_on_action_button = no
		
		#### ACTION LOCALISATION ####
		
		#send_scripted_gui = ultimatum_action
		
		receive_description = "[REQUEST_TRIBUTE_RECIEVER_LOC]"
		accept_title = REQUEST_TRIBUTE_ACCEPTED_TITLE
		accept_description = REQUEST_TRIBUTE_ACCEPTED_DESC
		reject_title = REQUEST_TRIBUTE_REJECTED_TITLE
		reject_description = REQUEST_TRIBUTE_REJECTED_DESC
		
		#### EFFECTS ####
		on_sent_effect = {
		}
		
		complete_effect = {
			ROOT = {
				puppet = PREV.FROM
				add_named_threat = { threat = 10 name = tribute.2.t }
			}
			
			news_event = tribute.1
		}
		
		reject_effect = {		
			ROOT = {
				add_named_threat = { threat = 10 name = tribute.3.t }
				
				add_political_power = -250
			
				create_wargoal = {
					type = puppet_wargoal_focus
					target = PREV.FROM
				}
			}
			FROM = {
				every_owned_state = {
					limit = { is_capital = yes }
					
					add_extra_state_shared_building_slots = 4
					
					add_building_construction = {
						type = arms_factory
						level = 2
						instant_build = yes
					}
					add_building_construction = {
						type = industrial_complex
						level = 2
						instant_build = yes
					}
					
				}
			}
		}
		ai_desire = {
		}
		
		ai_acceptance = {
			is_major = {
				base = 0
				modifier = {
					is_major = yes
					
					add = -100
				}					
			}
			
			army_strength = {
				base = 0
				modifier = {
					strength_ratio = {
						tag = ROOT
						ratio > 0.1
					}
					
					add = -50
				}
				modifier = {
					strength_ratio = {
						tag = ROOT
						ratio < 0.1
					}
					
					add = 25
				}
			}
			
			is_subject = {
				base = 0
			}
			
			country_spirit = {
				base = 0
				modifier = {
					has_stability > 50
					
					add = -25
				}
			}
		}
	}
}