﻿

namespace = manitweaks

# Establish Manichean Supremacy
manitweaks.001 = {
	type = character_event
	title = manitweaks.001.t
	desc = manitweaks.001.desc
	theme = faith
	left_portrait = {
		character = root
		animation = personality_bold 
	}
	right_portrait = {
		character = title:d_manichean.holder
		animation = admiration 
	}

	trigger = {
	}

	# weight_multiplier = {
	# 	base = 1
	# }

	immediate = {
		play_music_cue = "on_faith_created"
		
	}

	option = {
		name = manitweaks.001.a

		show_as_tooltip = { 
			faith:manichean = {
				remove_doctrine = doctrine_pluralism_pluralistic
				add_doctrine = doctrine_pluralism_righteous
				change_fervor = {
					value = 20
					desc = fervor_20
				}
			}

			add_trait_force_tooltip = trait:paragon

			#Can only happen once
			add_to_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:manichean_supremacy_decision
			}
		} 
	}
}

#Han Priest arrives
manitweaks.002 = {
	type = character_event
	title = manitweaks.002.t
	desc = {
		first_valid = {
			#Not Manichean
			triggered_desc = {
				trigger = { 
					NOT = {
						faith = faith:manichean
					}
				}
				desc = manitweaks.002.desc.2
			}
			# Manichean
			desc = manitweaks.002.desc
		}	
	}

	theme = learning 

	left_portrait = {
		character = scope:manichean_han_priest
		animation = chaplain
	}

	trigger = {
		is_available_adult = yes
		NOT = { has_character_flag = had_manitweaks_002 }
		OR = {
			capital_province = { geographical_region = world_steppe_east }
			capital_province = { geographical_region = world_steppe_tarim }
			capital_province = { geographical_region = world_middle_east_persia }
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_manitweaks_002
		}

		create_character = {
			template = manitweaks_han_priest
			location = root.capital_province
			save_scope_as = manichean_han_priest
		}
	}

	option = { #Recruit him
		name = manitweaks.002.a
		stress_impact = {
			paranoid = medium_stress_impact_gain
			shy = minor_stress_impact_gain
			gregarious = minor_stress_impact_loss
		}

		add_courtier = scope:manichean_han_priest

		ai_chance = {
			base = 15
			modifier = {
				learning >= 12
				add = 5
			}
			modifier = {
				has_trait = paranoid
				add = -10
			}
			modifier = {
				has_trait = shy
				add = -5
			}
			modifier = {
				has_trait = gregarious
				add = 5
			}
		}
	}

	option = { #Turn him away
		name = manitweaks.002.b
		#custom_tooltip = brus_slavic_yearly.02.b.tt
		stress_impact = {
			callous = medium_stress_impact_loss
			gregarious = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		hidden_effect = {
			scope:manichean_han_priest = {
				death = {
					death_reason = death_vanished
				}
			}
		}

		ai_chance = {
			base = 15
			modifier = {
				has_trait = callous
				add = 5
			}
			modifier = {
				has_trait = zealous
				NOT = {
					faith = faith:manichean
				}
				add = 10
			}
		}
	}

	option = { #Convert
	name =  manitweaks.002.c
		stress_impact = {
			cynical = medium_stress_impact_gain
		}

		add_courtier = scope:manichean_han_priest

		trigger = {
			NOT = {
				faith = faith:manichean
			}
			is_independent_ruler = yes
		}
		add_piety = -250

		set_character_faith_with_conversion = faith:manichean

		show_as_unavailable = { 
			has_trait = zealous
		}

		ai_chance = {
			base = 4
			modifier = {
				has_trait = cynical
				add = -2
			}
			modifier = {
				highest_held_title_tier >= tier_empire
				add = -3
			}
		}
	}
}


#Feast of the Bema
manitweaks.003 = {
	type = character_event
	title = manitweaks.003.t
	desc = manitweaks.003.desc
	theme = faith

	left_portrait = {
		character = cp:councillor_court_chaplain
		animation = chaplain
	}

	trigger = {
		is_available_adult = yes
		faith = faith:manichean
		NOT = { has_character_flag = had_manitweaks_003 }
	}

	immediate = {
		add_character_flag = {
			flag = had_manitweaks_003
			years = 15
		}

		create_character = {
			template = manitweaks_han_priest
			location = root.capital_province
			save_scope_as = manichean_han_priest
		}
	}

	option = { #No, dread option
		name = manitweaks.003.a
		stress_impact = {
			wrathful = medium_stress_impact_loss
			irritable = medium_stress_impact_loss
			humble  = medium_stress_impact_gain
			zealous  = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}

		add_dread = 15
		add_prestige = minor_prestige_value
		add_piety = {
			subtract = medium_piety_value
		}


		reverse_add_opinion = {
			target = cp:councillor_court_chaplain
			modifier = impious_opinion
			opinion = -25
		}


		ai_chance = {
			base = 5
			modifier = {
				has_trait = wrathful
				add = 5
			}
			modifier = {
				has_trait = humble
				add = -5
			}
			modifier = {
				has_trait = zealous
				add = -5
			}
			modifier = {
				has_trait = compassionate
				add = -5
			}
		}
	}

	option = { #Let's do it

		name = manitweaks.003.b
		stress_impact = {
			cynical = minor_stress_impact_gain
		}

		if = {
			limit = {
				has_royal_court = yes
			}
			change_current_court_grandeur = 6
		}

		add_piety = minor_piety_value

		ai_chance = {
			base = 15
			modifier = {
				has_trait = cynical
				add = -10
			}
		}
	}

	option = { # Spend more money
	name =  manitweaks.003.c
		stress_impact = {
			generous = medium_stress_impact_loss
			zealous = minor_stress_impact_loss
			greedy = medium_stress_impact_gain
		}

		remove_short_term_gold = minor_gold_value
		add_piety = medium_piety_value


		reverse_add_opinion = {
			target = cp:councillor_court_chaplain
			modifier = donated_to_church_opinion
			opinion = 25
		}
	

		ai_chance = {
			base = 5
			modifier = {
				has_trait = generous
				add = 5
			}
			modifier = {
				has_trait = greedy
				add = -5
			}
			modifier = {
				has_trait = cynical
				add = -5
			}
		}
	}

	option = { # No
		name =  manitweaks.003.d
			stress_impact = {
			}

			add_piety = {
				subtract = minor_piety_value
			}

			reverse_add_opinion = {
				target = cp:councillor_court_chaplain
				modifier = impious_opinion
				opinion = -10
			}
		
			ai_chance = {
				base = 5
				modifier = {
					has_trait = cynical
					add = 10
				}
			}
	}
}
