# anger_china_effect
# roman_victory_triumph_effect
# fire_haruspicy_event_effect
# landless_pope_effect

# increase_council_power_effect
# increase_vassal_freedom_effect

# Used in on_add for most CBs
anger_china_effect = {
	if = {
		limit = {
			defender = {
				offmap_china = {
					governor = {
						character = PREVPREV
					}
				}
			}
		}

		# Clunky stuff to get a nicer tooltip for third-party claimant CBs
		ROOT = {
			show_scope_change = no
			if = {
				limit = {
					PREV = {
						character = yes
						NOT = { character = PREV }
					}
				}

				# Attacker in third-party claimant CBs
				PREV = {
					sound_effect = china_angered_emperor
					detract_grace_super_huge_effect = yes
				}
			}
		}

		# Attacker, claimant in third-party CBs
		ROOT = {
			sound_effect = china_angered_emperor
			detract_grace_super_huge_effect = yes
		}
	}
}

roman_victory_triumph_effect = {
	hidden_effect = {
		if = {
			limit = {
				has_dlc = "Legacy of Rome"

				OR = {
					has_landed_title = e_byzantium
					has_landed_title = e_roman_empire

					AND = {
						independent = yes
						higher_real_tier_than = COUNT

						OR = {
							culture = roman
							religion = roman_pagan
						}
					}
				}

				OR = {
					religion_group = christian

					trigger_if = {
						limit = { is_alternate_start = no }
						religion_openly_hellenic_or_reformed_trigger = yes
					}
				}
			}

			character_event = {
				id = LoR.30 # Victory Triumph
				days = 12
			}
		}
	}
}

fire_haruspicy_event_effect = {
	# Divination
	hidden_effect = {
		if = {
			limit = {
				attacker = {
					OR = {
						religion_openly_hellenic_or_reformed_trigger = yes
						has_religion_feature = religion_haruspicy
						has_religion_feature = religion_feature_celtic
					}
				}
			}

			attacker = {
				character_event = {
					id = HF.23005 # Chance to divine outcome
				}
			}
		}

		if = {
			limit = {
				defender = {
					OR = {
						religion_openly_hellenic_or_reformed_trigger = yes
						has_religion_feature = religion_haruspicy
						has_religion_feature = religion_feature_celtic
					}
				}
			}

			defender = {
				character_event = {
					id = HF.23005 # Chance to divine outcome
				}
			}
		}
	}
}

landless_pope_effect = {
	if = {
		limit = {
			has_landed_title = k_papacy
			num_of_count_titles_in_realm == 0
			is_landed = no
			catholic = { is_name_randomized = no }
		}

		destroy_landed_title = k_papal_state

		k_papal_state = {
			any_direct_de_jure_vassal_title = {
				de_jure_liege = k_romagna
			}
		}

		narrative_event = { id = HFP.40037 } # Papal States becomes Romagna when the Pope holds no lands in Italy

		activate_title = {
			title = d_papal_guards
			status = no
		}
	}
}

increase_council_power_effect = {
	custom_tooltip = {
		text = council_power_increased

		while = {
			count = 2

			trigger_switch = {
				on_trigger = has_law

				law_voting_power_0          = { add_law_w_cooldown = law_voting_power_1 }
				war_voting_power_0          = { add_law_w_cooldown = war_voting_power_1 }
				grant_title_voting_power_0  = { add_law_w_cooldown = grant_title_voting_power_1 }
				revoke_title_voting_power_0 = { add_law_w_cooldown = revoke_title_voting_power_1 }
				imprison_voting_power_0     = { add_law_w_cooldown = imprison_voting_power_1 }
				banish_voting_power_0       = { add_law_w_cooldown = banish_voting_power_1 }
				execution_voting_power_0    = { add_law_w_cooldown = execution_voting_power_1 }
			}
		}
	}
}

increase_vassal_freedom_effect = {
	trigger_switch = {
		on_trigger = has_law

		vassal_wars_law_1 = { add_law_w_cooldown = vassal_wars_law_0 }
		vassal_wars_law_2 = { add_law_w_cooldown = vassal_wars_law_1 }
	}
}