# Defines the different values available for given Agreement terms. The terms are defined in agreement_terms scripts.
# The term values contain the main logic of Agreement terms, including the modifiers and effects.
# For Subject Agreements, the owner is the overlord and the target is the subject.

# Example:
#
# name_of_term_value = {
# 	term = name_of_term 					# References the term in agreement_terms that this value applies to
#
# 	owner_modifier = {						# A modifier that applies to the Agreement owner country. Can stack multiple times.
# 		my_owner_modifier = 1
# 	}
# 	target_modifier = {						# A modifier that applies to the Agreement target country. Can stack multiple times.
# 		my_target_modifier = 1
# 	}
# 	unique_owner_modifier = {				# A modifier that applies to the Agreement owner country. Only applies once.
# 		my_unique_owner_modifier = 1
# 	}
# 	unique_target_modifier = {				# A modifier that applies to the Agreement target country. Only applies once.
# 		my_unique_target_modifier = 1
# 	}
# 	loyalty_change = value					# How much the subject's loyalty will change when a new agreement with this term starts
# 	ai_acceptance = {
#		overlord = 1						# Willingness of AI overlord to accept this term
#		subject = 1							# Willingness of AI subject to accept this term
#	}
# 	triggered_loyalty_change = {			# How much the subject's loyalty will additionally change when a new agreement with this term starts, if "trigger" is true
# 		trigger = {
# 			agreement_scope_trigger
# 		}
# 		loyalty_change = value
#		ai_acceptance = {
#			overlord = 1
#			subject = 1
#		}
# 	}
# 	extra_term_text_subject = <LOC_KEY> 	# What should be shown in the "extra terms" panel for the subject if this term value is active (default is to not show it)
# 											# This loc key can use $SUBJECT$ and $OVERLORD$ to show the name of the relevant empire, and $MODIFIER$ to show the modifiers applying to the subject
# 	extra_term_text_overlord = <LOC_KEY>	# What should be shown in the "extra terms" panel for the overlord if this term value is active (default is to not show it)
# 											# Loc key can use $SUBJECT$ and $OVERLORD$ to show the name of the relevant empire, $MODIFIER$ for the overlord's modifiers, and $RESOURCES$ for the net resources it gains
# }
#
# name_of_resource_term_value = {
# 	term = name_of_resource_term
#	resource = <resource> (food/alloys/...)
# }

plnmg_aid_term_none = { term = planetmega_engineering_aid }
plnmg_aid_term_overlord_helper = {
	term = planetmega_engineering_aid
	target_modifier = {
		ground_megastructure_build_speed_mult = 0.15
		jobs_about_planetmega_produces_mult = 0.15
		jobs_about_planetmega_upkeep_mult = -0.2
		monthly_loyalty = 10
	}
	overlord_resources = {
		category = overlord_subsidy
		upkeep = {
			trigger = { is_variable_set = num_plnmg_mega_owned_count }
			alloys = 5
			minerals = 10
			energy = 5
			mult = num_plnmg_mega_owned_count
		}
	}

	potential = {
		owner = {
			is_ai = no
			has_technology = tech_ground_megastructure
		}
	}

	extra_term_text_subject = loyalty_effects_subject
	extra_term_text_overlord = protectorate_extra_overlord
}
plnmg_aid_term_subject_corvee = {
	term = planetmega_engineering_aid
	target_modifier = {
		monthly_loyalty = -10
		planet_jobs_produces_mult = -0.15
	}
	owner_modifier = {
		ground_megastructure_build_speed_mult = 0.15
		jobs_about_planetmega_produces_mult = 0.15
	}
	unique_owner_modifier = { jobs_about_planetmega_upkeep_mult = -0.2 }
	subject_resources = {
		category = subject_tax
		upkeep = {
			trigger = { is_variable_set = num_plnmg_mega_owned_count }
			alloys = 5
			minerals = 10
			energy = 5
			mult = num_plnmg_mega_owned_count
		}
	}

	extra_term_text_overlord = loyalty_effects_subject
	extra_term_text_subject = protectorate_extra_overlord
}

planetmega_quota_0 = {
	term = planetmega_quota
	activate_effect = { refresh_planetmega_quota_modifier = yes }
	deactivate_effect = { refresh_planetmega_quota_modifier = yes }
}
planetmega_quota_1 = { #地面巨构配额
	term = planetmega_quota
	loyalty_change = 5
	ai_acceptance = { overlord = -30 subject = 25 }
	triggered_loyalty_change = {          # 巨构崇拜的附庸格外感激
		trigger = { target = { has_civic = civic_planetmega_worshipper } }
		loyalty_change = 5
		ai_acceptance = { subject = 25 }
	}

	activate_effect = { refresh_planetmega_quota_modifier = yes }
	deactivate_effect = { refresh_planetmega_quota_modifier = yes }

	potential = {
		owner = {
			is_ai = no
			has_technology = tech_ground_megastructure
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = not_allowed_for_luminarium
			NOT = { agreement_preset = preset_luminarium }
		}
		not = {
			has_term_value = {
				term = planetmega_engineering_aid
				value = plnmg_aid_term_none
			}
		}
	}

	extra_term_text_overlord = planetmega_quota_1_tt_overlord
	extra_term_text_subject = planetmega_quota_1_tt_subject
}
planetmega_quota_2 = {
	term = planetmega_quota
	loyalty_change = 10
	ai_acceptance = { overlord = -55 subject = 50 }
	triggered_loyalty_change = {
		trigger = { target = { has_civic = civic_planetmega_worshipper } }
		loyalty_change = 10
		ai_acceptance = { subject = 50 }
	}

	activate_effect = { refresh_planetmega_quota_modifier = yes }
	deactivate_effect = { refresh_planetmega_quota_modifier = yes }

	potential = {
		owner = {
			is_ai = no
			has_technology = tech_ground_megastructure
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = not_allowed_for_luminarium
			NOT = { agreement_preset = preset_luminarium }
		}
		not = {
			has_term_value = {
				term = planetmega_engineering_aid
				value = plnmg_aid_term_none
			}
		}
		owner = { has_technology = tech_planetmega_improved }
	}

	extra_term_text_overlord = planetmega_quota_2_tt_overlord
	extra_term_text_subject = planetmega_quota_2_tt_subject
}
planetmega_quota_3 = {
	term = planetmega_quota
	loyalty_change = 15
	ai_acceptance = { overlord = -75 subject = 70 }
	triggered_loyalty_change = {
		trigger = { target = { has_civic = civic_planetmega_worshipper } }
		loyalty_change = 15
		ai_acceptance = { subject = 75 }
	}

	activate_effect = { refresh_planetmega_quota_modifier = yes }
	deactivate_effect = { refresh_planetmega_quota_modifier = yes }

	potential = {
		owner = {
			is_ai = no
			has_technology = tech_ground_megastructure
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = not_allowed_for_luminarium
			NOT = { agreement_preset = preset_luminarium }
		}
		not = {
			has_term_value = {
				term = planetmega_engineering_aid
				value = plnmg_aid_term_none
			}
		}
		owner = { has_ascension_perk = ap_planetmega_advanced }
	}

	extra_term_text_overlord = planetmega_quota_3_tt_overlord
	extra_term_text_subject = planetmega_quota_3_tt_subject
}

