﻿#	Example:
# 
#	example_effect = {
#		x = 100
#		y = 50
#	}
#
#
#	In a script file:
#
#	effect = {
#		example_effect = yes
#	}
#

scope_into_player_who_clicked = {
	every_country = {
		limit = {
			#is_ai = no
			exists = scope:$PLAYERCREDIT$
		}
		set_local_variable = {
			name = upper
			value = {
				add = credit
				add = 1
			}
		}
		set_local_variable = {
			name = lower
			value = {
				add = credit
				subtract = 1
			}
		}
		if = {
			limit = {
				# scope:player_credit = GetPlayer.GetMaxCredit
				exists = local_var:lower
				exists = local_var:upper
				# Check range because of rounding, i think
				scope:$PLAYERCREDIT$ >= local_var:lower
				scope:$PLAYERCREDIT$ <= local_var:upper
			}
			save_scope_as = player_who_clicked_scope
		}
		else = {
			# fail
		}
		remove_local_variable = lower
		remove_local_variable = upper
	}
}

scope_into_target_nation_clicked = {
	every_country = {
		limit = {
			#is_ai = no
			exists = scope:$AICREDIT$
		}
		set_local_variable = {
			name = upper
			value = {
				add = credit
				add = 1
			}
		}
		set_local_variable = {
			name = lower
			value = {
				add = credit
				subtract = 1
			}
		}
		if = {
			limit = {
				# scope:player_credit = GetPlayer.GetMaxCredit
				exists = local_var:lower
				exists = local_var:upper
				# Check range because of rounding, i think
				scope:$AICREDIT$ >= local_var:lower
				scope:$AICREDIT$ <= local_var:upper
			}
			save_scope_as = target_nation_clicked_scope
		}
		else = {
			# fail
		}
		remove_local_variable = lower
		remove_local_variable = upper
	}
}