﻿je_nihilist_movement = {
	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	group = je_group_internal_affairs

	is_progressing = {
		OR = {
			AND = {
				OR = {
					has_law = law_type:law_outlawed_dissent
					has_law = law_type:law_censorship
				}
				any_political_movement = {
					is_political_movement_type = movement_nihilist
					is_being_suppressed = yes
				}
			}
			ig:ig_intelligentsia = {
				OR = {
					ig_approval > 0
					is_marginal = yes
				}
			}
		}
	}

	is_shown_when_inactive = {
		has_technology_researched = realism
		NOT = {
			has_technology_researched = socialism
		}
		has_law = law_type:law_state_religion
	}

	possible = {
		has_technology_researched = realism
		empty_agitator_slots >= 1
		NOT = {
			has_technology_researched = socialism
		}
		has_law = law_type:law_state_religion
		OR = {
			has_law = law_type:law_monarchy
			has_law = law_type:law_theocracy
		}
		OR = {
			has_law = law_type:law_autocracy
			has_law = law_type:law_oligarchy
		}
		ig:ig_intelligentsia = {
			is_marginal = no
			ig_approval < 0
		}
	}

	immediate = {
		set_variable = {
			name = nihilism_progress_var
			value = 1
		}
		show_as_tooltip = {
			if = {
				limit = {
					NOT = {
						any_political_movement = {
							is_political_movement_type = movement_nihilist
						}
					}
				}
				create_political_movement = { type = movement_nihilist }
			}
		}
		ig:ig_intelligentsia = {
			save_scope_as = nihilist_ig
		}
		trigger_event = { id = nihilism.1 popup = yes }
	}

	complete = {
		OR = {
			custom_tooltip = {
				text = je_nihilist_movement_trigger_tt_1
				scope:journal_entry = {
					is_goal_complete = yes
				}
				AND = {
					OR = {
						has_law = law_type:law_outlawed_dissent
						has_law = law_type:law_censorship
					}
					any_political_movement = {
						is_political_movement_type = movement_nihilist
						is_being_suppressed = yes
					}
				}
			}
			custom_tooltip = {
				text = je_nihilist_movement_trigger_tt_2
				scope:journal_entry = {
					is_goal_complete = yes
				}
				ig:ig_intelligentsia = {
					OR = {
						ig_approval > 0
						is_marginal = yes
					}
				}
			}
			trigger_if = {
				limit = {
					has_variable = nihilism_je_started
				}
				custom_tooltip = {
					text = has_no_nihilist_movement_tt
					NOT = {
						any_political_movement = {
							is_political_movement_type = movement_nihilist
						}
					}
				}
			}
		}
	}

	on_complete = {
		trigger_event = { id = nihilism.2 popup = yes }
	}

	fail = {
		OR = {
			has_law = law_type:law_state_atheism
			has_law = law_type:law_total_separation
		}
	}

	on_fail = {
		add_loyalists = {
			value = medium_radicals
			pop_type = academics
		}
	}

	on_monthly_pulse = {
		effect = {
			if = {
				limit = {
					OR = {
						ig:ig_intelligentsia = {
							ig_approval > 0
						}
						ig:ig_intelligentsia = {
							is_marginal = yes
						}
						AND = {
							OR = {
								has_law = law_type:law_outlawed_dissent
								has_law = law_type:law_censorship
							}
							any_political_movement = {
								is_political_movement_type = movement_nihilist
								is_being_suppressed = yes
							}
						}
					}
					
				}
				change_variable = {
					name = nihilism_progress_var
					add = 1
				}
			}
		}
		random_events = {
			160 = 0
			30 = nihilism.4
			10 = nihilism.5
			10 = nihilism.6
			10 = nihilism.7
			10 = nihilism.8
			10 = nihilism.9
			10 = nihilism.10
			10 = nihilism.11
			10 = nihilism.12
		}
	}

	timeout = 3650

	on_timeout = {
		trigger_event = { id = nihilism.3 popup = yes }
	}

	current_value = {
		value = root.var:nihilism_progress_var
	}

	goal_add_value = {
		add = 60
	}

	weight = 100

	progressbar = yes

	should_be_pinned_by_default = yes
}
