﻿### メインキャラクタービュー / Main Character View ###

# 配偶者をキャラクターの隣に表示 / Show Spouse next to Character
RUI_Ch_is_at_same_location = {
	scope = character
	saved_scopes = { SECONDARY }

	is_shown = {
		exists = scope:SECONDARY
		is_at_same_location = scope:SECONDARY

		is_imprisoned = no
		is_in_army = no

		scope:SECONDARY = {
			is_imprisoned = no
			is_in_army = no
		}

		trigger_if = {
			limit = {
				OR = {
					is_travelling = yes
					scope:SECONDARY = { is_travelling = yes }
				}
			}
			OR = {
				current_travel_plan ?= {
					any_entourage_character = { exists = scope:SECONDARY }
				}
				scope:SECONDARY.current_travel_plan ?= {
					any_entourage_character = { exists = root }
				}
			}
		}

		trigger_if = {
			limit = {
				OR = {
					root = {
						exists = involved_activity
						NOT = { has_activity_state = travel }
					}
					scope:SECONDARY = {
						exists = involved_activity
						NOT = { has_activity_state = travel }
					}
				}
			}
			OR = {
				involved_activity ?= {
					any_attending_character = { exists = scope:SECONDARY }
				}
				scope:SECONDARY.involved_activity ?= {
					any_attending_character = { exists = root }
				}
			}
		}

		HJCL_triggers_01 = yes	# NO spouse portrait for anime characters since they are toooooooo wide
		AGOT_triggers_01 = yes	# NO spouse for fake death character
	}
}

# 現在地を表示 / Show Current Location
RUI_Ch_show_current_location = {
	scope = character
	saved_scopes = { PLAYER }

	is_shown = {
		NOT = {
			scope:PLAYER ?= { is_at_war_with = root }
		}
		OR = {
			is_in_army = yes
			is_travelling_at_activity = yes
			trigger_if = {
				limit = { is_ruler = yes }
				NOT = { root.capital_province ?= root.location }
			}
			trigger_else_if = {
				limit = { is_courtier = yes }
				NOT = { root.court_owner.capital_province ?= root.location }
			}
			trigger_else = {
				always = yes
			}
		}
	}
}

### キャラクタープロフィールサブビュー / Character Profile Sub View ###

# 同じ信仰である / Is same Faith
#RUI_Ch_is_same_faith = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		faith = scope:TARGET.faith
#	}
#}

# 正義である / Is Righteous
#RUI_Ch_is_righteous_faith = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		faith = {
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value >= faith_fully_accepted_level
#			}
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value < faith_astray_level
#			}
#		}
#		NOT = { faith = scope:TARGET.faith }
#	}
#}

# 迷信である / Is Astray
#RUI_Ch_is_astray_faith = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		faith = {
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value >= faith_astray_level
#			}
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value < faith_hostile_level
#			}
#		}
#	}
#}

# 敵対的である / Is Hostile
#RUI_Ch_is_hostile_faith = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		faith = {
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value >= faith_hostile_level
#			}
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value < faith_evil_level
#			}
#		}
#	}
#}

# 邪悪である / Is Evil
#RUI_Ch_is_evil_faith = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		faith = {
#			faith_hostility_level = {
#				target = scope:TARGET.faith
#				value >= faith_evil_level
#			}
#		}
#	}
#}

# 同じ文化である / Is same Culture
#RUI_Ch_is_same_culture = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		culture = scope:TARGET.culture
#	}
#}

# 同じ遺産を持っている / Has same Heritage
#RUI_Ch_has_same_heritage = {
#	scope = character

#	is_shown = {
#		exists = scope:TARGET

#		NOT = { culture = scope:TARGET.culture }
#		culture = { has_same_culture_heritage = scope:TARGET.culture }
#	}
#}

# 恐怖がある / Has Dread
RUI_has_dread = {
	scope = character

	is_shown = {
		OR = {
			scriptedtests_dread_base > 0
			dread > 0
		}
	}
}



### 政治タブ / Politics Tab ###

# 生きている子供がいる / Have a living child
RUI_Ch_living_child = {
	scope = character

	is_shown = {
		any_child = {
			is_alive = yes
		}
	}
}

# 生きている兄弟姉妹がいる / Have a living sibling
RUI_Ch_living_sibling = {
	scope = character

	is_shown = {
		any_sibling = {
			is_alive = yes
		}
	}
}

# Have a dead child
RUI_Ch_dead_child = {
	scope = character

	is_shown = {
		any_child = {
			even_if_dead = yes
			is_alive = no
		}
	}
}

# Have a dead sibling
RUI_Ch_dead_sibling = {
	scope = character

	is_shown = {
		any_sibling = {
			even_if_dead = yes
			is_alive = no
		}
	}
}

# 封臣との同盟 / Alliance with Vassal
RUI_Ch_is_alliance_with_vassal = {
	scope = character
	saved_scopes = { TARGET }

	is_shown = {
		exists = scope:TARGET

		is_allied_to = scope:TARGET
		OR = {
			trigger_if = {
				limit = { exists = scope:TARGET.liege }
				scope:TARGET.liege = root
			}
			trigger_if = {
				limit = { exists = scope:TARGET.liege.liege }
				scope:TARGET.liege.liege = root
			}
			trigger_if = {
				limit = { exists = scope:TARGET.liege.liege.liege }
				scope:TARGET.liege.liege.liege = root
			}
			trigger_if = {
				limit = { exists = scope:TARGET.liege.liege.liege.liege }
				scope:TARGET.liege.liege.liege.liege = root
			}
		}
	}
}

# 主君との同盟 / Alliance with Liege
RUI_Ch_is_alliance_with_liege = {
	scope = character
	saved_scopes = { TARGET }

	is_shown = {
		exists = scope:TARGET

		is_allied_to = scope:TARGET
		OR = {
			trigger_if = {
				limit = { exists = root.liege }
				liege = scope:TARGET
			}
			trigger_if = {
				limit = { exists = root.liege.liege }
				liege.liege = scope:TARGET
			}
			trigger_if = {
				limit = { exists = root.liege.liege.liege }
				liege.liege.liege = scope:TARGET
			}
			trigger_if = {
				limit = { exists = root.liege.liege.liege.liege }
				liege.liege.liege.liege = scope:TARGET
			}
		}
	}
}

# 封臣との戦争 / War with Vassal
RUI_Ch_is_war_with_vassal = {
	scope = character
	saved_scopes = { TARGET }

	is_shown = {
		exists = scope:TARGET

		is_at_war_with = scope:TARGET
		OR = {
			trigger_if = {
				limit = { exists = scope:TARGET.liege }
				scope:TARGET.liege = root
			}
			trigger_if = {
				limit = { exists = scope:TARGET.liege.liege }
				scope:TARGET.liege.liege = root
			}
			trigger_if = {
				limit = { exists = scope:TARGET.liege.liege.liege }
				scope:TARGET.liege.liege.liege = root
			}
			trigger_if = {
				limit = { exists = scope:TARGET.liege.liege.liege.liege }
				scope:TARGET.liege.liege.liege.liege = root
			}
		}
	}
}

# 主君との戦争 / War with Liege
RUI_Ch_is_war_with_liege = {
	scope = character
	saved_scopes = { TARGET }

	is_shown = {
		exists = scope:TARGET

		is_at_war_with = scope:TARGET
		OR = {
			trigger_if = {
				limit = { exists = root.liege }
				liege = scope:TARGET
			}
			trigger_if = {
				limit = { exists = root.liege.liege }
				liege.liege = scope:TARGET
			}
			trigger_if = {
				limit = { exists = root.liege.liege.liege }
				liege.liege.liege = scope:TARGET
			}
			trigger_if = {
				limit = { exists = root.liege.liege.liege.liege }
				liege.liege.liege.liege = scope:TARGET
			}
		}
	}
}


### 拡張表示 / Expanded ###

RUI_Ch_cannot_inherit = {
	scope = character

	is_shown = {
		OR = {
			has_trait = bastard
			has_trait = disinherited
		}
	}
}

# 私生児 / Bastard
RUI_Ch_is_bastard = {
	scope = character

	is_shown = {
		has_trait = bastard
	}
}

# 廃嫡者 / Disinherited
RUI_Ch_is_disinherited = {
	scope = character

	is_shown = {
		has_trait = disinherited
	}
}

# 母系である / Is Matrilinear
RUI_Ch_is_matrilinear = {
	scope = character

	is_shown = {
		matrilinear_marriage = yes
	}
}

# 母系である（婚約） / Is Matrilinear (betrothal)
RUI_Ch_is_matrilinear_betrothal = {
	scope = character

	is_shown = {
		matrilinear_betrothal = yes
	}
}

# 慣習的フィルター / De jure Filter
RUI_Ch_de_jure_filter = {
	scope = character
	saved_scopes = { TITLE }

	is_shown = {
		exists = scope:TITLE
		OR = {
			root.primary_title = scope:TITLE
			root.primary_title = scope:TITLE.de_jure_liege
			root.primary_title = scope:TITLE.de_jure_liege.de_jure_liege
			root.primary_title = scope:TITLE.de_jure_liege.de_jure_liege.de_jure_liege
			root.primary_title = scope:TITLE.de_jure_liege.de_jure_liege.de_jure_liege.de_jure_liege
		}
	}
}

# 同盟フィルター / Alliance Filter
RUI_Ch_alliance_filter = {
	scope = character
	saved_scopes = { TARGET }

	is_shown = {
		exists = scope:TARGET

		is_allied_to = scope:TARGET
	}
}

# 休戦フィルター / Truce Filter
RUI_Ch_truce_filter = {
	scope = character
	saved_scopes = { TARGET }

	is_shown = {
		exists = scope:TARGET

		has_truce = scope:TARGET
	}
}