﻿INJECT:ai_strategy_conservative_agenda = {
	revolution_aversion = {
		value = 93.75
		if = {
			limit = { has_journal_entry = je_tp_pool_suppress_revolts }
			add = 50
		}
		if = {
			limit = { divided_monarchists_ai_monarchist = yes }
			add = 50
		}
		if = {
			limit = { divided_monarchists_ai_republican = yes }
			subtract = 50
		}
		min = 10
	}

	min_law_chance_to_pass = {
		value = 10
		if = {
			limit = { ai_has_reasons_to_not_oppose_law = yes }
			multiply = 0.5
		}
	}

	max_regressiveness = {
		value = 50
		if = {
			limit = { has_enactment_je_or_law_commitment = yes }
			multiply = 2
		}
	}

	change_law_chance = {
		value = 10

		if = {
			limit = { any_interest_group = { is_insurrectionary = yes } }
			add = 10
		}

		if = {
			limit = {
				has_revolutionary_socialist_laws = yes
			}
			add = 25
		}

		if = {
			limit = {
				has_enactment_je_or_law_commitment = yes
			}
			add = 25
		}
	}

	weight = {
		value = -10

		every_interest_group = {
			if = {
				limit = {
					this = {
						OR = {
							is_interest_group_type = ig_devout
							is_interest_group_type = ig_landowners
							leader ?= {
								OR = {
									has_conservative_ideology = yes
									has_monarchist_ideology = yes
								}
							}
						}
					}
				}

				if = {
					limit = {
						this = { ig_counts_as_marginal = no }
					}
					add = {
						value = ig_clout
						multiply = 100
					}
				}

				if = {
					limit = {
						exists = ROOT.ruler
						this = { is_same_interest_group_type = ROOT.ruler.interest_group }
					}
					add = modifier:country_legitimacy_headofstate_add
				}
			}
		}


		if = { # Metternich System
			limit = {
				c:AUS ?= this
				has_journal_entry = je_metternich
			}
			add = 20
		}

		if = {
			limit = {
				exists = c:FRA
				c:FRA = this
				ruler = {
					var:dynasty_var ?= flag:house_orleans
				}
			}
			add = 10
		}

		if = {
			limit = {
				is_princely_state = yes
			}
			add = 10
		}

		if = {
			limit = {
				divided_monarchists_ai_active = yes
			}
			add = 1000
		}

		if = {
			limit = {
				has_radical_leftist_government = yes
			}
			multiply = {
				value = 0.75
				subtract = modifier:country_other_country_socialist_government_hostility_impact_mult
				min = 0
				max = 1
			}
		}
	}
}

INJECT:ai_strategy_reactionary_agenda = {
	revolution_aversion = {
		value = 65
		if = {
			limit = { has_journal_entry = je_tp_pool_suppress_revolts }
			add = 50
		}
	}

	min_law_chance_to_pass = {
		value = 10
		if = {
			limit = { ai_has_reasons_to_not_oppose_law = yes }
			multiply = 0.5
		}
	}

	change_law_chance = {
		value = 5

		if = {
			limit = {
				has_revolutionary_socialist_laws = yes
			}
			add = 25
		}

		if = {
			limit = {
				has_enactment_je_or_law_commitment = yes
			}
			add = 10
		}
	}

	weight = {
		value = -10

		every_interest_group = {
			if = {
				limit = {
					this = {
						leader ?= {
							has_reactionary_ideology = yes
						}
					}
				}

				if = {
					limit = {
						this = { ig_counts_as_marginal = no }
					}
					add = {
						value = ig_clout
						multiply = 100
					}
				}

				if = {
					limit = {
						exists = ROOT.ruler
						this = { is_same_interest_group_type = ROOT.ruler.interest_group }
					}
					add = modifier:country_legitimacy_headofstate_add
				}
			}
		}

		if = {
			limit = {
				c:FRA ?= this
				ruler ?= {
					has_ideology = ideology:ideology_legitimist
				}
			}
			add = 10
		}

		if = {
			limit = {
				has_modifier = forced_regime_change
				OR = {
					ig:ig_devout ?= { is_in_government = yes }
					ig:ig_landowners ?= { is_in_government = yes }
				}
			}

			add = 1000
		}

		if = {
			limit = {
				has_radical_leftist_government = yes
			}
			multiply = {
				value = 0.75
				subtract = modifier:country_other_country_socialist_government_hostility_impact_mult
				min = 0
				max = 1
			}
		}

		if = {
			limit = {
				OR = {
					has_journal_entry = je_tp_tsar_gendarme_of_europe
					has_journal_entry = je_tp_tsar_unshakable_autocracy
					has_journal_entry = je_tp_tsar_heir_of_alexander
				}
			}
			add = 25
		}

		if = {
			limit = {
				has_journal_entry = je_tp_pool_abolish_duma
			}
			add = 25
		}
	}
}

INJECT:ai_strategy_progressive_agenda = {
	revolution_aversion = {
		value = 75
	}

	min_law_chance_to_pass = {
		value = 10
		if = {
			limit = { ai_has_reasons_to_not_oppose_law = yes }
			multiply = 0.5
		}
	}

	max_regressiveness = {
		value = 50
		if = {
			limit = { has_revolutionary_socialist_laws = yes }
			multiply = 2
		}
	}

	change_law_chance = {
		value = 20

		if = {
			limit = {
				has_revolutionary_socialist_laws = yes
			}
			add = 25
		}

		if = {
			limit = {
				has_enactment_je_or_law_commitment = yes
			}
			add = 25
		}
	}

	anti_interest_groups = {
		ig_landowners
		# ig_rural_folk
	}

	weight = {
		value = -10

		every_interest_group = {
			if = {
				limit = {
					this = {
						OR = {
							is_interest_group_type = ig_intelligentsia
							is_interest_group_type = ig_industrialists
							leader ?= {
								has_liberal_ideology = yes
							}
						}
					}
				}

				if = {
					limit = {
						this = { ig_counts_as_marginal = no }
					}
					add = {
						value = ig_clout
						multiply = 100
					}
				}

				if = {
					limit = {
						exists = ROOT.ruler
						this = { is_same_interest_group_type = ROOT.ruler.interest_group }
					}
					add = modifier:country_legitimacy_headofstate_add
				}
			}
		}

		if = {
			limit = {
				has_modifier = forced_regime_change
				OR = {
					ig:ig_industrialists ?= { is_in_government = yes }
					ig:ig_intelligentsia ?= { is_in_government = yes }
				}
			}

			add = 1000
		}

		if = {
			limit = {
				AND = {
					c:CHI ?= this
					has_variable = china_warlord_explosion
					var:china_warlord_explosion <= 3
				}
			}
			add = 50
		}

		if = {
			limit = {
				has_journal_entry = je_tp_tsar_crown_of_perfection
			}
			add = 1000
		}

		if = {
			limit = {
				has_radical_leftist_government = yes
			}
			multiply = {
				value = 0.75
				subtract = modifier:country_other_country_socialist_government_hostility_impact_mult
				min = 0
				max = 1
			}
		}
	}
}

INJECT:ai_strategy_egalitarian_agenda = {
	revolution_aversion = {
		value = 43.75
	}

	min_law_chance_to_pass = {
		value = 10
		if = {
			limit = { ai_has_reasons_to_not_oppose_law = yes }
			multiply = 0.5
		}
	}

	change_law_chance = {
		value = 20

		if = {
			limit = {
				has_revolutionary_socialist_laws = yes
			}
			add = 25
		}

		if = {
			limit = {
				has_enactment_je_or_law_commitment = yes
			}
			add = 25
		}
	}

	weight = {
		value = -10

		every_interest_group = {
			if = {
				limit = {
					this = {
						OR = {
							is_interest_group_type = ig_trade_unions
							leader ?= {
								has_progressive_ideology = yes
							}
						}
					}
				}

				if = {
					limit = {
						this = { ig_counts_as_marginal = no }
					}
					add = {
						value = ig_clout
						multiply = 100
					}
				}

				if = {
					limit = {
						exists = ROOT.ruler
						this = { is_same_interest_group_type = ROOT.ruler.interest_group }
					}
					add = modifier:country_legitimacy_headofstate_add
				}
			}
		}

		if = {
			limit = {
				has_modifier = forced_regime_change
				ig:ig_trade_unions ?= { is_in_government = yes }
			}

			add = 1000
		}
	}
}

INJECT:ai_strategy_nationalist_agenda = {
	revolution_aversion = {
		value = 67.5
	}

	min_law_chance_to_pass = {
		value = 10
		if = {
			limit = { ai_has_reasons_to_not_oppose_law = yes }
			multiply = 0.5
		}
	}

	max_progressiveness = {
		value = 50
		if = {
			limit = { has_enactment_je_or_law_commitment = yes }
			multiply = 2
		}
		# KAI: Need 100 progressiveness to abolish monarchy
		if = {
			limit = {
				c:CHI ?= this
				has_variable = china_warlord_explosion
				var:china_warlord_explosion <= 3
			}
			min = 100
		}
	}

	max_regressiveness = {
		# Militarized Police and Ethnostate
		value = 100
	}

	change_law_chance = {
		value = 20

		if = {
			limit = {
				has_revolutionary_socialist_laws = yes
			}
			add = 25
		}

		if = {
			limit = {
				has_enactment_je_or_law_commitment = yes
			}
			add = 25
		}
	}

	anti_interest_groups = {
		# ig_rural_folk
		ig_trade_unions
	}

	weight = {
		value = -10

		every_interest_group = {
			if = {
				limit = {
					this = {
						OR = {
							is_interest_group_type = ig_armed_forces
							is_interest_group_type = ig_petty_bourgeoisie
							leader ?= {
								OR = {
									has_ideology = ideology:ideology_authoritarian
									has_ideology = ideology:ideology_jingoist_leader
									has_ideology = ideology:ideology_fascist
									has_ideology = ideology:ideology_ethno_nationalist
									has_ideology = ideology:ideology_integralist
									has_ideology = ideology:ideology_corporatist_leader
								}
							}
						}
					}
				}

				if = {
					limit = {
						this = { ig_counts_as_marginal = no }
					}
					add = {
						value = ig_clout
						multiply = 100
					}
				}

				if = {
					limit = {
						exists = ROOT.ruler
						this = { is_same_interest_group_type = ROOT.ruler.interest_group }
					}
					add = modifier:country_legitimacy_headofstate_add
				}
			}
		}

		if = {
			limit = {
				exists = c:FRA
				c:FRA = this
				ruler = {
					var:dynasty_var ?= flag:house_bonaparte
				}
			}
			add = 10
		}

		if = {
			limit = {
				has_modifier = forced_regime_change
				OR = {
					ig:ig_petty_bourgeoisie ?= { is_in_government = yes }
					ig:ig_armed_forces ?= { is_in_government = yes }
				}
			}

			add = 1000
		}

		if = {
			limit = {
				AND = {
					c:CHI ?= this
					has_variable = china_warlord_explosion
					var:china_warlord_explosion <= 3
				}
			}
			add = 50
		}

		# High-fervour AI is inclined to become nationalistic
		if = {
			limit = {
				country_fervor_primary_culture > 10
			}
			add = {
				value = country_fervor_primary_culture
				divide = 4
			}
		}

		if = {
			limit = {
				has_radical_leftist_government = yes
			}
			multiply = {
				value = 0.75
				subtract = modifier:country_other_country_socialist_government_hostility_impact_mult
				min = 0
				max = 1
			}
		}
	}
}

INJECT:ai_strategy_tanzimat_reforms = {
	revolution_aversion = {
		value = 67.5
	}
}

REPLACE:ai_strategy_meiji_restoration = {
	icon = "gfx/interface/icons/ai_strategy_icons/progressive_agenda.dds"

	type = political

	revolution_aversion = {
		value = 67.5
	}

	min_law_chance_to_pass = {
		value = 10
		if = {
			limit = { ai_has_reasons_to_not_oppose_law = yes }
			multiply = 0.5
		}
	}

	max_progressiveness = {
		# KAI: Not too progressive as to weaken the monarchy
		value = 75
		if = {
			limit = { has_enactment_je_or_law_commitment = yes }
			multiply = 1.5
		}
	}

	max_regressiveness = {
		# KAI: Pass Closed Borders if necessary to appease Sonno Joi
		value = 50
	}

	change_law_chance = {
		value = 50

		if = {
			limit = {
				has_revolutionary_socialist_laws = yes
			}
			add = 25
		}
	}

	pro_interest_groups = {
		ig_intelligentsia
		ig_industrialists
		# KAI: Adding PB
		ig_petty_bourgeoisie
	}

	anti_interest_groups = {
		ig_landowners
		# KAI: Use interest_group_government_weight to handle Retire the Samurai
		# ig_armed_forces
	}

	pro_movements = {
		movement_liberal
		movement_modernizer
		movement_anti_slavery
		movement_land_reform
		movement_positivist
		movement_utilitarian
		movement_feminist
		movement_corporatist
		movement_radical
		movement_royalist_absolutist
		movement_royalist_constitutional
		movement_religious_majority
		movement_cultural_majority
	}

	anti_movements = {
		movement_socialist
		movement_communist
		movement_anarchist
		movement_nihilist
		movement_fascist
		movement_reactionary
		movement_pro_slavery
		movement_religious_minority
		movement_cultural_minority
	}

	institution_scores = {
		institution_colonial_affairs = {
			value = 75
			if = {
				limit = {
					has_journal_entry = je_colonize_korea
				}
				multiply = 2
			}
		}
		institution_social_security = {
			value = 100
		}
		institution_workplace_safety = {
			value = 100
		}
		institution_schools = {
			value = 1000
		}
		institution_police = {
			value = 75
		}
		institution_health_system = {
			value = 100
		}
		institution_home_affairs = {
			value = 100
		}
	}

	interest_group_government_weight = {
		value = 0

		if = {
			limit = {
				has_journal_entry = je_meiji_army
				scope:interest_group = {
					is_interest_group_type = ig_armed_forces
				}
			}
			add = -1.5
		}
	}

	possible = {
		# The strategy should be available as soon as the emperor is restored
		OR = {
			has_journal_entry = je_meiji_restoration
			has_journal_entry = je_meiji_main
		}
		# It would be difficult to form a legitimate government with the conservative emperors before Meiji
		ruler ?= {
			has_template = JAP_meiji_yamato
		}
	}

	weight = {
		value = 10000
	}
}

INJECT:ai_strategy_great_reforms = {
	revolution_aversion = {
		value = 67.5
	}
}
