# Niche party for anarchists in specific circumstances

anarchist_party = {
	color = { 0 0 0 }
	name = {
		first_valid = {
			triggered_desc = {
				desc = party_cnt
				trigger = {
					exists = c:SPA
					THIS = c:SPA
				}
			}
			triggered_desc = {
				desc = party_socialist_league
				trigger = {
					exists = c:GBR
					THIS = c:GBR
				}
			}
			triggered_desc = {
				desc = party_maximalist_federation
				trigger = {
					country_has_primary_culture = cu:portuguese
				}
			}
			triggered_desc = {
				desc = party_young_socialists
				trigger = {
					OR = {
						country_has_primary_culture = cu:scandinavian
						country_has_primary_culture = cu:norwegian
						country_has_primary_culture = cu:danish
					}
				}
			}
			triggered_desc = {
				desc = party_italian_syndicalist_union
				trigger = {
					OR = {
						country_has_primary_culture = cu:north_italian
						country_has_primary_culture = cu:central_italian
						country_has_primary_culture = cu:south_italian
						country_has_primary_culture = cu:sardinian #DVG
						country_has_primary_culture = cu:venetian #DVG
					}
				}
			}
			triggered_desc = {
				desc = party_anarchist
				trigger = {
					always = yes
				}
			}
		}
	}
	icon = {
		default = "/gfx/interface/icons/political_parties/anarchist.dds"
	}
	unlocking_technologies = {
		anarchism
	}
	# THIS IS RUN ONLY ONCE AT GAME START
	valid_for_country = {
		always = yes
	}
	available_for_interest_group = {
		owner = {
			country_has_voting_franchise = yes
			any_interest_group = {
				is_marginal = no
				leader = {
					has_ideology = ideology_anarchist
				}
			}
		}
		leader = {
			has_ideology = ideology_anarchist
		}
	}
	    
    # Root - IG considering joining
    # scope:number - the number of IGs that would join this party before the root IG
	join_weight = {
		value = {
			value = -5
			desc = "base_value"
		}
		if = { # anarchists like anarchism
			limit = {
				leader = { has_ideology = ideology_anarchist }
			}
			add = {
				value = 6
				desc = "from_anarchy"
			}
		}
		if = { # strong anarchists like anarchism
			limit = {
				is_powerful = yes
				leader = { has_ideology = ideology_anarchist }
			}
			add = {
				value = 10
				desc = "powerful_anarachists"
			}
		}
		if = { # anarchists don't like the revolution being hijacked
			limit = {
				leader = {
					has_ideology = ideology_anarchist
				}
				owner = {
					has_law = law_type:law_council_republic
					ruler = {
						has_ideology = ideology_vanguardist
					}
				}
			}
			add = {
				value = 10
				desc = "from_vanguard_anarchy"
			}
		}
		if = { # anarchists will make their own party if there is no communist party to join
			limit = {
				leader = {
					has_ideology = ideology_anarchist
				}
				owner = {
					NOT = {
						any_interest_group = {
							is_marginal = no
							leader = {
								OR = {
									has_ideology = ideology_communist
									has_ideology = ideology_vanguardist
								}
							}
						}
					}
				}
			}
			add = {
				value = 5
				desc = "from_no_communists"
			}
		}
		if = { # radical anti-censorship
			limit = {
				leader = {
					OR = {
						has_ideology = ideology_radical
						has_ideology = ideology_anarchist
					}
				}
				owner = {
					OR = {
						has_law = law_type:law_outlawed_dissent
						has_law = law_type:law_censorship
					}
				}
			}
			add = {
				value = 3
				desc = from_censorship
			}
		}
		if = { # anti-censorship
			limit = {
				OR = {
					has_ideology = ideology_liberal
					has_ideology = ideology_egalitarian
				}
				owner = {
					has_law = law_type:law_outlawed_dissent
				}
			}
			add = {
				value = 3
				desc = from_outlawed_dissent
			}
		}
		if = { # against land-based taxation
			limit = {
				OR = {
					has_ideology = ideology_meritocratic
					has_ideology = ideology_agrarian
					leader = {
						has_ideology = ideology_social_democrat
					}
				}
				owner = {
					has_law = law_type:law_land_based_taxation
				}
			}
			add = {
				value = 3
				desc = "from_land_tax"
			}
		}
		if = { # anticlerical
			limit = {
				OR = {
					has_ideology = ideology_anti_clerical
					leader = {
						has_ideology = ideology_atheist
					}
				}
				owner = {
					has_law = law_type:law_state_religion
				}
			}
			add = {
				value = 3
				desc = "from_anticlerical"
			}
		}
		if = { # opposition to peasant levies
			limit = {
				OR = {
					has_ideology = ideology_jingoist
					has_ideology = ideology_particularist
					has_ideology = ideology_sikh_moralist
					leader = {
						OR = {
							has_ideology = ideology_anarchist
							has_ideology = ideology_pacifist
						}
					}
				}
				owner = {
					has_law = law_type:law_peasant_levies
				}
			}
			add = {
				value = 3
				desc = "from_peasant_levies"
			}
		}
		if = { # general anti-slavery
			limit = {
				owner = {
					OR = {
						has_law = law_type:law_legacy_slavery
						has_law = law_type:law_slave_trade
					}
				}
				OR = {
					has_ideology = ideology_anti_slavery
					leader = {
						has_ideology = ideology_abolitionist
					}
				}
			}
			add = {
				value = 5
				desc = "from_slavery"
			}
		}
		if = { # anti-serfdom
			limit = {
				owner = {
					has_law = law_type:law_serfdom
				}
				OR = {
					has_ideology = ideology_egalitarian
					has_ideology = ideology_anti_slavery
					has_ideology = ideology_laissez_faire
					has_ideology = ideology_particularist
					leader = {
						has_ideology = ideology_abolitionist
						has_ideology = ideology_social_democrat
						has_ideology = ideology_communist
					}
				}
			}
			add = {
				value = 5
				desc = "from_serfdom"
			}
		}
		if = { # republican
			limit = {
				OR = {
					has_ideology = ideology_republican
					has_ideology = ideology_populist
					leader = {
						OR = {
							has_ideology = ideology_atheist
							has_ideology = ideology_republican_leader
							has_ideology = ideology_radical
						}
					}
				}
				owner = {
					OR = {
						has_law = law_type:law_monarchy
						has_law = law_type:law_theocracy
					}
				}
			}
			add = {
				value = 3
				desc = "from_republican"
			}
		}
		if = {
            limit = {
                scope:number = 1
                is_powerful = no
                is_marginal = no
            }
            multiply = {
                value = 2
                desc = "from_influential_supporting_member"
            }
        }
        else_if = {
            limit = {
                scope:number = 2
            }
            multiply = {
                value = 0.5
                desc = "from_two_prior_members"
            }
        }
        else_if = {
            limit = {
                scope:number = 3
            }
            multiply = {
                value = 0.25
                desc = "from_three_prior_members"
            }
        }
        else_if = {
            limit = {
                scope:number > 3
            }
            multiply = {
                value = 0.1
                desc = "from_more_than_three_prior_members"
            }
        }
	}
}
