namespace = slavery_law_events

# The Classical Case for Chains
slavery_law_events.1 = { # Advancing the cause of slavery
	type = country_event

	title = slavery_law_events.1.t
	desc = slavery_law_events.1.d
	flavor = slavery_law_events.1.f

	event_image = {
		video = "gfx/event_pictures/unspecific_ruler_speaking_to_people.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/unspecific/leader_speaking_to_a_group_of_people"

	icon = "gfx/interface/icons/event_icons/event_newspaper.dds"

	duration = 3

	cooldown = { months = normal_modifier_time }
	
	trigger = {
		NOT = { has_modifier = natural_state_of_man }
		has_law = law_type:law_slavery_banned
		OR = {
			is_enacting_law = law_type:law_debt_slavery
			is_enacting_law = law_type:law_slave_trade
			is_enacting_law = law_type:law_legacy_slavery
		}
		any_interest_group = {
			is_marginal = no
			law_stance = {
				law = owner.currently_enacting_law.type
				value > neutral
			}
		}
	}
	
	immediate = {
		currently_enacting_law = {
			save_scope_as = current_law_scope
		}
		random_interest_group = {
			limit = {
				is_marginal = no
				law_stance = {
					law = owner.currently_enacting_law.type
					value > neutral
				}
			}
			save_scope_as = slaver_ig_scope
			leader = {
				save_scope_as = slaver_ig_leader_scope
			}
		}
	}

	cancellation_trigger = {
		NOT = { currently_enacting_law = scope:current_law_scope }
	}

	option = {
		name = slavery_law_events.1.a
        default_option = yes

		add_enactment_modifier = {
			name = natural_state_of_man
		}
		scope:slaver_ig_leader_scope = {
			add_modifier = {
				name = erudite_slaver
				months = normal_modifier_time
			}
		}
	}

	option = {
		name = slavery_law_events.1.b

		add_enactment_modifier = {
			name = natural_state_of_man
		}
		scope:slaver_ig_scope = {
			add_modifier = {
				name = erudite_praise
				months = normal_modifier_time
			}
		}
	}
}

# Slavery, Hypothetically
slavery_law_events.2 = { # debating slavery
	type = country_event

	title = slavery_law_events.2.t
	desc = slavery_law_events.2.d
	flavor = slavery_law_events.2.f

	event_image = {
		video = "gfx/event_pictures/southamerica_election.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/southamerica/election"

	icon = "gfx/interface/icons/event_icons/event_newspaper.dds"

	duration = 3

	cooldown = { months = normal_modifier_time }
	
	trigger = {
		has_law = law_type:law_slavery_banned
		OR = {
			is_enacting_law = law_type:law_debt_slavery
			is_enacting_law = law_type:law_slave_trade
			is_enacting_law = law_type:law_legacy_slavery
		}
		any_interest_group = {
			is_marginal = no
			law_stance = {
				law = owner.currently_enacting_law.type
				value > neutral
			}
		}
		NOT = {
			has_variable = slave_law_debate_timer
		}
	}

	immediate = {
		currently_enacting_law = {
			save_scope_as = current_law_scope
		}
		random_interest_group = {
			limit = {
				is_marginal = no
				law_stance = {
					law = owner.currently_enacting_law.type
					value > neutral
				}
			}
			save_scope_as = slaver_ig_scope
			leader = {
				save_scope_as = slaver_ig_leader_scope
			}
		}
		set_variable = {
			name = slave_law_debate_timer
			days = 730 # two years
		}
	}

	cancellation_trigger = {
		NOT = { currently_enacting_law = scope:current_law_scope }
	}

	option = {
		name = slavery_law_events.2.a
		default_option = yes
		add_enactment_modifier = {
			name = slaver_debate
		}
	}
	option = {
		name = slavery_law_events.2.b
		random_list = {
			1 = {
				add_enactment_modifier = {
					name = slaver_debate_success
				}
			}
			3 = {
				add_enactment_modifier = {
					name = slaver_debate_fail
				}
			}
		}
	}
}

# Imported Slave Narratives
slavery_law_events.3 = { # Stall event
	type = country_event
	placement = root
	title = slavery_law_events.3.t
	desc = slavery_law_events.3.d
	flavor = slavery_law_events.3.f

	duration = 3

	event_image = {
		video = "gfx/event_pictures/southamerica_slaves_night.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/southamerica/slaves_night"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	cooldown = { months = normal_modifier_time }

	trigger = {
		has_law = law_type:law_slavery_banned
		OR = {
			is_enacting_law = law_type:law_debt_slavery
			is_enacting_law = law_type:law_slave_trade
			is_enacting_law = law_type:law_legacy_slavery
		}

		any_interest_group = {
			is_marginal = no
			law_stance = {
				law = owner.currently_enacting_law.type
				value > neutral
			}
		}
		NOT = {
			has_variable = slave_law_stall_timer
		}	
	}

	immediate = {
		currently_enacting_law = {
    		save_scope_as = current_law_scope
    	}

    	random_interest_group = {
			limit = {
				is_marginal = no
				law_stance = {
					law = owner.currently_enacting_law.type
					value > neutral
				}
			}
			save_scope_as = book_burning_ig
    	}

		set_variable = {
			name = slave_law_stall_timer
			days = 730 # two years
		}
	}

	cancellation_trigger = {
		NOT = { currently_enacting_law = scope:current_law_scope }
	}

	option = {
		name = slavery_law_events.3.a
		default_option = yes
		add_enactment_modifier = {
			name = slave_narrative_stall
		}
	}
	option = { 
		name = slavery_law_events.3.b
		random_list = {
			1 = {
				add_enactment_modifier = {
					name = slave_narrative_stall_fail
				}
			}
			3 = {
				add_enactment_modifier = {
					name = slave_narrative_stall_success
				}
			}
		}
	}
}

# Life Among the Lowly
slavery_law_events.4 = { # Advancing the cause of Abolition
	type = country_event

	title = slavery_law_events.4.t
	desc = slavery_law_events.4.d
	flavor = slavery_law_events.4.f

	event_image = {
		video = "gfx/event_pictures/southamerica_slaves_night.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/southamerica/slaves_night"

	icon = "gfx/interface/icons/event_icons/event_newspaper.dds"

	duration = 3

	cooldown = { months = normal_modifier_time }
	
	trigger = {
		NOT = { has_modifier = life_among_the_lowly_well_received }
		is_enacting_law = law_type:law_slavery_banned
		any_interest_group = {
			is_marginal = no
			law_stance = {
				law = law_type:law_debt_slavery
				value < neutral
			}
		}
	}
	
	immediate = {
		random_interest_group = {
			limit = {
				is_marginal = no
				law_stance = {
					law = law_type:law_debt_slavery
					value < neutral
				}
			}
			save_scope_as = abolitionist_ig_scope
			leader = {
				save_scope_as = abolitionist_ig_leader_scope
			}
		}
		currently_enacting_law = {
			save_scope_as = current_law_scope
		}
	}

	cancellation_trigger = {
		NOT = { currently_enacting_law = scope:current_law_scope }
	}

	option = {
		name = slavery_law_events.4.a
        default_option = yes
        
		add_enactment_modifier = {
			name = life_among_the_lowly_well_received
		}
		scope:abolitionist_ig_leader_scope = {
			add_modifier = {
				name = life_among_the_lowly_author
				months = normal_modifier_time
			}
		}
	}

	option = {
		name = slavery_law_events.4.b

		add_enactment_modifier = {
			name = life_among_the_lowly_well_received
		}
		scope:abolitionist_ig_scope = {
			add_modifier = {
				name = life_among_the_lowly_ig
				months = normal_modifier_time
			}
		}
	}
}

# The Great Debates
slavery_law_events.5 = { # debating abolition
	type = country_event

	title = slavery_law_events.5.t
	desc = slavery_law_events.5.d
	flavor = slavery_law_events.5.f

	event_image = {
		video = "gfx/event_pictures/southamerica_election.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/southamerica/election"

	icon = "gfx/interface/icons/event_icons/event_newspaper.dds"

	duration = 3

	cooldown = { months = normal_modifier_time }
	
	trigger = {
		has_law = law_type:law_slavery_banned
		OR = {
			is_enacting_law = law_type:law_debt_slavery
			is_enacting_law = law_type:law_slave_trade
			is_enacting_law = law_type:law_legacy_slavery
		}
		any_interest_group = {
			is_in_government = no
			is_marginal = no
			law_stance = {
				law = owner.currently_enacting_law.type
				value > neutral
			}
		}
		NOT = {
			has_variable = law_debate_timer
		}
	}

	immediate = {
		currently_enacting_law = {
			save_scope_as = current_law_scope
		}
		random_interest_group = {
			limit = {
				is_marginal = no
				law_stance = {
					law = owner.currently_enacting_law.type
					value > neutral
				}
			}
			save_scope_as = slaver_ig_scope
			leader = {
				save_scope_as = slaver_ig_leader_scope
			}
		}
		set_variable = {
			name = law_debate_timer
			days = 730 # two years
		}
	}

	cancellation_trigger = {
		NOT = { currently_enacting_law = scope:current_law_scope }
	}

	option = {
		name = slavery_law_events.5.a
		default_option = yes
		add_enactment_modifier = {
			name = great_debates
		}
	}
	option = {
		name = slavery_law_events.5.b
		random_list = {
			1 = {
				add_enactment_modifier = {
					name = great_debates_success
				}
			}
			3 = {
				add_enactment_modifier = {
					name = great_debates_fail
				}
			}
		}
	}
}

# Plantation Proponents Publicize Policies
slavery_law_events.6 = { # Stall event
	type = country_event
	placement = root
	title = slavery_law_events.6.t
	desc = slavery_law_events.6.d
	flavor = slavery_law_events.6.f

	duration = 3

	cooldown = { months = normal_modifier_time }

	event_image = {
		video = "gfx/event_pictures/southamerica_aristocrats.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/southamerica/aristocrats"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	trigger = {
		is_enacting_law = law_type:law_slavery_banned
		OR = {
			has_law = law_type:law_debt_slavery
			has_law = law_type:law_slave_trade
			has_law = law_type:law_legacy_slavery
		}
		NOT = {
			has_variable = law_stall_timer
		}
	}

	immediate = {
		set_variable = {
			name = law_stall_timer
			days = 730 # two years
		}
		currently_enacting_law = {
			save_scope_as = current_law_scope
		}
	}

	cancellation_trigger = {
		NOT = { currently_enacting_law = scope:current_law_scope }
	}

	option = {
		name = slavery_law_events.6.a
		default_option = yes
		add_enactment_modifier = {
			name = plantation_reaction_stall
		}
	}
	option = { 
		name = slavery_law_events.6.b
		random_list = {
			1 = {
				add_enactment_modifier = {
					name = plantation_reaction_stall_fail
				}
			}
			3 = {
				add_enactment_modifier = {
					name = plantation_reaction_stall_success
				}
			}
		}
	}
}

######

#Forgiveness and Forgetting
slavery_law_events.7 = {
	type = country_event
	placement = root
	title = slavery_law_events.7.t
	desc = slavery_law_events.7.d
	flavor = slavery_law_events.7.f

	duration = 3

	cooldown = { months = long_modifier_time }

	event_image = {
		video = "gfx/event_pictures/southamerica_aristocrats.bk2"
	}

	on_created_soundeffect = "event:/SFX/UI/Alerts/event_appear"
	on_opened_soundeffect = "event:/SFX/Events/southamerica/aristocrats"

	icon = "gfx/interface/icons/event_icons/event_protest.dds"

	trigger = {
		has_law = law_type:law_slavery_banned
		any_interest_group = {
			has_ideology = ideology_pro_slavery
		}
		#OR = {	
		#	NOT = {
		#		this = c:USA
		#		has_variable = slavery_forget
		#	}
		#	AND = {
		#		this = c:USA
		#		OR = {
		#			has_variable = je_acw_countdown_complete
		#			NOT = {
		#				has_journal_entry = je_acw_countdown
		#			}	
		#		}
		#	}
		#}
	}

	immediate = {
		random_interest_group = {
			limit = {
				has_ideology = ideology_pro_slavery
			}
			save_scope_as = slaver_ig
		}

		random_law = {
			limit = { type = law_type:law_slavery_banned }
			save_scope_as = slavery_banned_scope
		}
	}

	option = {
		name = slavery_law_events.7.a
		default_option = yes
		scope:slaver_ig = {
			add_modifier = {
				name = modifier_slavery_forgotten
				months = normal_modifier_time
			}
		}
		add_modifier = {
			name = modifier_slavery_whitewashing
			months = long_modifier_time
		}
		every_interest_group = {
			limit = {
				has_ideology = ideology_pro_slavery
			}
			remove_ideology = ideology_pro_slavery
		}
	}
	option = { 
		name = slavery_law_events.7.b
		scope:slaver_ig = {
			add_modifier = {
				name = modifier_slavery_forgotten_bad
				months = normal_modifier_time
			}
		}
		add_radicals = {
			value = small_radicals
			strata = rich
		}
		every_interest_group = {
			limit = {
				has_ideology = ideology_pro_slavery
			}
			remove_ideology = ideology_pro_slavery
		}
	}
}
