﻿
on_war_started = {
	on_actions = { gpt_reinforcements }
}


gpt_reinforcements = {
	effect = {
		scope:attacker = {
			stress_impact = {
				ambitious = -20
				greedy = -20
				vengeful = -10
				brave = -20
				wrathful = -10
				arbitrary = -10
				impatient = -10
				zealous = -10
			}
			stress_impact = {
				lazy = 40
				craven = 20
				forgiving = 20
				compassionate = 30
				calm = 15
				just = 10
				patient = 10
				fickle = 10
			}
		}
		scope:defender = {
			stress_impact = {
				lazy = 40
				craven = 30
				forgiving = 10
				compassionate = 20
				calm = 10
				just = 10
				patient = 10
				fickle = 10
			}
		}
		if = {
			limit = {
				has_game_rule = GPT_wareffects_enabled
			 	NOT = { has_global_variable = miv_is_loaded }
			}
			scope:attacker = {
				if = {
					limit = {
						any_vassal = {
							count >= 9
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.50
							OR = {
								is_allied_to = scope:attacker
								opinion = {
									target = scope:attacker
									value >= 40
								}
								AND = {
									ai_vengefulness >= 0
									opinion = {
										target = scope:defender
										value <= -40
									}
								}
								AND = {
									ai_vengefulness >= 40
									opinion = {
										target = scope:defender
										value < 0
									}
								}
								AND = {
									ai_boldness >= 40
									opinion = {
										target = scope:attacker
										value >= 0
									}
								}
								AND = {
									ai_greed <= -20
									opinion = {
										target = scope:attacker
										value >= 20
									}
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					custom_tooltip = gpt_vassal_reinforcements_tip
					spawn_army = {
						name = gpt_reinforcement_troops
						levies = {
							add = {
								value = 10
								add = { value = dread multiply = 4 }
								add = { value = vassal_count multiply = 12 }
								add = { value = sub_realm_size multiply = 3 }
								add = { value = piety_level multiply = 30 }
								add = { value = prestige_level multiply = 45 }
								add = { value = legitimacy_level multiply = 80 }
								add = { value = capital_province.county.development_level multiply = 10 }
								add = { value = capital_province.combined_building_level multiply = 20 }
								divide = highest_held_title_tier
								divide = highest_held_title_tier
								multiply = 20
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
							}
						}
						location = scope:attacker.capital_province
						origin = scope:attacker.capital_province
						uses_supply = yes
						war = scope:war
						inheritable = no
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 7
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.45
							OR = {
								is_allied_to = scope:attacker
								opinion = {
									target = scope:attacker
									value >= 40
								}
								AND = {
									ai_vengefulness >= 0
									opinion = {
										target = scope:defender
										value <= -40
									}
								}
								AND = {
									ai_vengefulness >= 40
									opinion = {
										target = scope:defender
										value < 0
									}
								}
								AND = {
									ai_boldness >= 40
									opinion = {
										target = scope:attacker
										value >= 0
									}
								}
								AND = {
									ai_greed <= -20
									opinion = {
										target = scope:attacker
										value >= 20
									}
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					custom_tooltip = gpt_vassal_reinforcements_tip
					spawn_army = {
						name = gpt_reinforcement_troops
						levies = {
							add = {
								value = 10
								add = { value = dread multiply = 4 }
								add = { value = vassal_count multiply = 12 }
								add = { value = sub_realm_size multiply = 3 }
								add = { value = piety_level multiply = 30 }
								add = { value = prestige_level multiply = 45 }
								add = { value = legitimacy_level multiply = 80 }
								add = { value = capital_province.county.development_level multiply = 10 }
								add = { value = capital_province.combined_building_level multiply = 20 }
								divide = highest_held_title_tier
								divide = highest_held_title_tier
								multiply = 16
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
							}
						}
						location = scope:attacker.capital_province
						origin = scope:attacker.capital_province
						uses_supply = yes
						war = scope:war
						inheritable = no
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 5
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.40
							OR = {
								is_allied_to = scope:attacker
								opinion = {
									target = scope:attacker
									value >= 40
								}
								AND = {
									ai_vengefulness >= 0
									opinion = {
										target = scope:defender
										value <= -40
									}
								}
								AND = {
									ai_vengefulness >= 40
									opinion = {
										target = scope:defender
										value < 0
									}
								}
								AND = {
									ai_boldness >= 40
									opinion = {
										target = scope:attacker
										value >= 0
									}
								}
								AND = {
									ai_greed <= -20
									opinion = {
										target = scope:attacker
										value >= 20
									}
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					custom_tooltip = gpt_vassal_reinforcements_tip
					spawn_army = {
						name = gpt_reinforcement_troops
						levies = {
							add = {
								value = 10
								add = { value = dread multiply = 4 }
								add = { value = vassal_count multiply = 12 }
								add = { value = sub_realm_size multiply = 3 }
								add = { value = piety_level multiply = 30 }
								add = { value = prestige_level multiply = 45 }
								add = { value = legitimacy_level multiply = 80 }
								add = { value = capital_province.county.development_level multiply = 10 }
								add = { value = capital_province.combined_building_level multiply = 20 }
								divide = highest_held_title_tier
								divide = highest_held_title_tier
								multiply = 12
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
							}
						}
						location = scope:attacker.capital_province
						origin = scope:attacker.capital_province
						uses_supply = yes
						war = scope:war
						inheritable = no
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 3
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.35
							OR = {
								is_allied_to = scope:attacker
								opinion = {
									target = scope:attacker
									value >= 40
								}
								AND = {
									ai_vengefulness >= 0
									opinion = {
										target = scope:defender
										value <= -40
									}
								}
								AND = {
									ai_vengefulness >= 40
									opinion = {
										target = scope:defender
										value < 0
									}
								}
								AND = {
									ai_boldness >= 40
									opinion = {
										target = scope:attacker
										value >= 0
									}
								}
								AND = {
									ai_greed <= -20
									opinion = {
										target = scope:attacker
										value >= 20
									}
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					custom_tooltip = gpt_vassal_reinforcements_tip
					spawn_army = {
						name = gpt_reinforcement_troops
						levies = {
							add = {
								value = 10
								add = { value = dread multiply = 4 }
								add = { value = vassal_count multiply = 12 }
								add = { value = sub_realm_size multiply = 3 }
								add = { value = piety_level multiply = 30 }
								add = { value = prestige_level multiply = 40 }
								add = { value = legitimacy_level multiply = 80 }
								add = { value = capital_province.county.development_level multiply = 10 }
								add = { value = capital_province.combined_building_level multiply = 20 }
								divide = highest_held_title_tier
								divide = highest_held_title_tier
								multiply = 8
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
							}
						}
						location = scope:attacker.capital_province
						origin = scope:attacker.capital_province
						uses_supply = yes
						war = scope:war
						inheritable = no
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 1
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.30
							OR = {
								is_allied_to = scope:attacker
								opinion = {
									target = scope:attacker
									value >= 40
								}
								AND = {
									ai_vengefulness >= 0
									opinion = {
										target = scope:defender
										value <= -40
									}
								}
								AND = {
									ai_vengefulness >= 40
									opinion = {
										target = scope:defender
										value < 0
									}
								}
								AND = {
									ai_boldness >= 40
									opinion = {
										target = scope:attacker
										value >= 0
									}
								}
								AND = {
									ai_greed <= -20
									opinion = {
										target = scope:attacker
										value >= 20
									}
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					custom_tooltip = gpt_vassal_reinforcements_tip
					spawn_army = {
						name = gpt_reinforcement_troops
						levies = {
							add = {
								value = 10
								add = { value = dread multiply = 4 }
								add = { value = vassal_count multiply = 12 }
								add = { value = sub_realm_size multiply = 3 }
								add = { value = piety_level multiply = 30 }
								add = { value = prestige_level multiply = 45 }
								add = { value = legitimacy_level multiply = 80 }
								add = { value = capital_province.county.development_level multiply = 10 }
								add = { value = capital_province.combined_building_level multiply = 20 }
								divide = highest_held_title_tier
								divide = highest_held_title_tier
								multiply = 4
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
							}
						}
						location = scope:attacker.capital_province
						origin = scope:attacker.capital_province
						uses_supply = yes
						war = scope:war
						inheritable = no
					}
				}
				else = {
					custom_tooltip = gpt_vassal_reinforcements_tip
					spawn_army = {
						name = gpt_reinforcement_troops
						levies = {
							add = {
								value = 10
								add = { value = dread multiply = 4 }
								add = { value = vassal_count multiply = 12 }
								add = { value = sub_realm_size multiply = 3 }
								add = { value = piety_level multiply = 30 }
								add = { value = prestige_level multiply = 45 }
								add = { value = legitimacy_level multiply = 80 }
								add = { value = capital_province.county.development_level multiply = 10 }
								add = { value = capital_province.combined_building_level multiply = 20 }
								divide = highest_held_title_tier
								divide = highest_held_title_tier
								multiply = 2
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
							}
						}
						location = scope:attacker.capital_province
						origin = scope:attacker.capital_province
						uses_supply = yes
						war = scope:war
						inheritable = no
					}
				}
			}

			scope:defender = {
				if = {
					limit = {
						any_vassal = {
							count >= 9
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.50
							OR = {
								ai_honor >= 20
								is_allied_to = scope:defender
								opinion = {
									target = scope:defender
									value >= 0
								}
								opinion = {
									target = scope:defender
									value <= -40
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					hidden_effect = {
						spawn_army = {
							name = gpt_reinforcement_troops
							levies = {
								add = {
									value = 10
									add = { value = dread multiply = 4 }
									add = { value = vassal_count multiply = 12 }
									add = { value = sub_realm_size multiply = 3 }
									add = { value = piety_level multiply = 30 }
									add = { value = prestige_level multiply = 45 }
									add = { value = legitimacy_level multiply = 80 }
									add = { value = capital_province.county.development_level multiply = 10 }
									add = { value = capital_province.combined_building_level multiply = 20 }
									divide = highest_held_title_tier
									divide = highest_held_title_tier
									multiply = 30
									if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
								if = {
									limit = {
										highest_held_title_tier < scope:attacker.highest_held_title_tier
									}
									multiply = scope:attacker.highest_held_title_tier
									divide = highest_held_title_tier
								}
								if = {
									limit = {
										is_independent_ruler = yes
										vassal_count > 50
									}
									multiply = 0.80
								}
								if = {
									limit = {
										is_independent_ruler = yes
										vassal_count > 25
									}
									multiply = 0.80
								}
								if = {
									limit = {
										is_independent_ruler = yes
										highest_held_title_tier = 3
									}
									multiply = 1.2
								}
								if = {
									limit = {
										is_independent_ruler = yes
										highest_held_title_tier = 2
									}
									multiply = 1.4
								}
								}
							}
							location = scope:defender.capital_province
							origin = scope:defender.capital_province
							uses_supply = yes
							war = scope:war
							inheritable = no
						}
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 7
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.45
							OR = {
								ai_honor >= 20
								is_allied_to = scope:defender
								opinion = {
									target = scope:defender
									value >= 0
								}
								opinion = {
									target = scope:defender
									value <= -40
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					hidden_effect = {
						spawn_army = {
							name = gpt_reinforcement_troops
							levies = {
									add = {
									value = 10
									add = { value = dread multiply = 4 }
									add = { value = vassal_count multiply = 12 }
									add = { value = sub_realm_size multiply = 3 }
									add = { value = piety_level multiply = 30 }
									add = { value = prestige_level multiply = 45 }
									add = { value = legitimacy_level multiply = 80 }
									add = { value = capital_province.county.development_level multiply = 10 }
									add = { value = capital_province.combined_building_level multiply = 20 }
									divide = highest_held_title_tier
									divide = highest_held_title_tier
									multiply = 24
									if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
								if = {
									limit = {
										highest_held_title_tier < scope:attacker.highest_held_title_tier
									}
									multiply = scope:attacker.highest_held_title_tier
									divide = highest_held_title_tier
								}
								if = {
									limit = {
										is_independent_ruler = yes
										vassal_count > 50
									}
									multiply = 0.80
								}
								if = {
									limit = {
										is_independent_ruler = yes
										vassal_count > 25
									}
									multiply = 0.80
								}
								if = {
									limit = {
										is_independent_ruler = yes
										highest_held_title_tier = 3
									}
									multiply = 1.2
								}
								if = {
									limit = {
										is_independent_ruler = yes
										highest_held_title_tier = 2
									}
									multiply = 1.4
								}
								}
							}
							location = scope:defender.capital_province
							origin = scope:defender.capital_province
							uses_supply = yes
							war = scope:war
							inheritable = no
						}
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 5
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.40
							OR = {
								ai_honor >= 20
								is_allied_to = scope:defender
								opinion = {
									target = scope:defender
									value >= 0
								}
								opinion = {
									target = scope:defender
									value <= -40
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					hidden_effect = {
						spawn_army = {
							name = gpt_reinforcement_troops
							levies = {
								add = {
									value = 10
									add = { value = dread multiply = 4 }
									add = { value = vassal_count multiply = 12 }
									add = { value = sub_realm_size multiply = 3 }
									add = { value = piety_level multiply = 30 }
									add = { value = prestige_level multiply = 45 }
									add = { value = legitimacy_level multiply = 80 }
									add = { value = capital_province.county.development_level multiply = 10 }
									add = { value = capital_province.combined_building_level multiply = 20 }
									divide = highest_held_title_tier
									divide = highest_held_title_tier
									multiply = 18
									if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
								}
								if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_1
											has_realm_law = tribal_authority_1
											has_realm_law = imperial_bureaucracy_1
										}
									}
									multiply = 0.75
								}
								if = {
									limit = {
										has_realm_law_flag = max_authority_level
									}
									multiply = 1.25
								}
								if = {
									limit = {
										government_has_flag = government_is_tribal
									}
									multiply = 1.5
								}
								if = {
									limit = {
										highest_held_title_tier < scope:attacker.highest_held_title_tier
									}
									multiply = scope:attacker.highest_held_title_tier
									divide = highest_held_title_tier
								}
								if = {
									limit = {
										is_independent_ruler = yes
										vassal_count > 50
									}
									multiply = 0.80
								}
								if = {
									limit = {
										is_independent_ruler = yes
										vassal_count > 25
									}
									multiply = 0.80
								}
								if = {
									limit = {
										is_independent_ruler = yes
										highest_held_title_tier = 3
									}
									multiply = 1.2
								}
								if = {
									limit = {
										is_independent_ruler = yes
										highest_held_title_tier = 2
									}
									multiply = 1.4
								}
								}
							}
							location = scope:defender.capital_province
							origin = scope:defender.capital_province
							uses_supply = yes
							war = scope:war
							inheritable = no
						}
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 3
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.35
							OR = {
								ai_honor >= 20
								is_allied_to = scope:defender
								opinion = {
									target = scope:defender
									value >= 0
								}
								opinion = {
									target = scope:defender
									value <= -40
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					hidden_effect = {
						spawn_army = {
							name = gpt_reinforcement_troops
							levies = {
								add = {
									value = 10
									add = { value = dread multiply = 4 }
									add = { value = vassal_count multiply = 12 }
									add = { value = sub_realm_size multiply = 3 }
									add = { value = piety_level multiply = 30 }
									add = { value = prestige_level multiply = 45 }
									add = { value = legitimacy_level multiply = 80 }
									add = { value = capital_province.county.development_level multiply = 10 }
									add = { value = capital_province.combined_building_level multiply = 20 }
									divide = highest_held_title_tier
									divide = highest_held_title_tier
									multiply = 12
									if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
									}
									if = {
										limit = {
											OR = {
												has_realm_law = crown_authority_1
												has_realm_law = tribal_authority_1
												has_realm_law = imperial_bureaucracy_1
											}
										}
										multiply = 0.75
									}
									if = {
										limit = {
											has_realm_law_flag = max_authority_level
										}
										multiply = 1.25
									}
									if = {
										limit = {
											government_has_flag = government_is_tribal
										}
										multiply = 1.5
									}
									if = {
										limit = {
											highest_held_title_tier < scope:attacker.highest_held_title_tier
										}
										multiply = scope:attacker.highest_held_title_tier
										divide = highest_held_title_tier
									}
									if = {
										limit = {
											is_independent_ruler = yes
											vassal_count > 50
										}
										multiply = 0.80
									}
									if = {
										limit = {
											is_independent_ruler = yes
											vassal_count > 25
										}
										multiply = 0.80
									}
									if = {
										limit = {
											is_independent_ruler = yes
											highest_held_title_tier = 3
										}
										multiply = 1.2
									}
									if = {
										limit = {
											is_independent_ruler = yes
											highest_held_title_tier = 2
										}
										multiply = 1.4
									}
								}
							}
							location = scope:defender.capital_province
							origin = scope:defender.capital_province
							uses_supply = yes
							war = scope:war
							inheritable = no
						}
					}
				}
				else_if = {
					limit = {
						any_vassal = {
							count >= 1
							highest_held_title_tier >= 2
						}
						any_vassal = {
							percent >= 0.30
							OR = {
								ai_honor >= 20
								is_allied_to = scope:defender
								opinion = {
									target = scope:defender
									value >= 0
								}
								opinion = {
									target = scope:defender
									value <= -40
								}
								AND = {
									scope:attacker = {
										is_house_head = yes
									}
									house = scope:attacker.house
								}
							}
						}
					}
					hidden_effect = {
						spawn_army = {
							name = gpt_reinforcement_troops
							levies = {
								add = {
									value = 10
									add = { value = dread multiply = 4 }
									add = { value = vassal_count multiply = 12 }
									add = { value = sub_realm_size multiply = 3 }
									add = { value = piety_level multiply = 30 }
									add = { value = prestige_level multiply = 45 }
									add = { value = legitimacy_level multiply = 80 }
									add = { value = capital_province.county.development_level multiply = 10 }
									add = { value = capital_province.combined_building_level multiply = 20 }
									divide = highest_held_title_tier
									divide = highest_held_title_tier
									multiply = 6
									if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
									}
									if = {
										limit = {
											OR = {
												has_realm_law = crown_authority_1
												has_realm_law = tribal_authority_1
												has_realm_law = imperial_bureaucracy_1
											}
										}
										multiply = 0.75
									}
									if = {
										limit = {
											has_realm_law_flag = max_authority_level
										}
										multiply = 1.25
									}
									if = {
										limit = {
											government_has_flag = government_is_tribal
										}
										multiply = 1.5
									}
									if = {
										limit = {
											highest_held_title_tier < scope:attacker.highest_held_title_tier
										}
										multiply = scope:attacker.highest_held_title_tier
										divide = highest_held_title_tier
									}
									if = {
										limit = {
											is_independent_ruler = yes
											vassal_count > 50
										}
										multiply = 0.80
									}
									if = {
										limit = {
											is_independent_ruler = yes
											vassal_count > 25
										}
										multiply = 0.80
									}
									if = {
										limit = {
											is_independent_ruler = yes
											highest_held_title_tier = 3
										}
										multiply = 1.2
									}
									if = {
										limit = {
											is_independent_ruler = yes
											highest_held_title_tier = 2
										}
										multiply = 1.4
									}
								}
							}
							location = scope:defender.capital_province
							origin = scope:defender.capital_province
							uses_supply = yes
							war = scope:war
							inheritable = no
						}
					}
				}
				else = {
					hidden_effect = {
						spawn_army = {
							name = gpt_reinforcement_troops
							levies = {
								add = {
									value = 10
									add = { value = dread multiply = 4 }
									add = { value = vassal_count multiply = 12 }
									add = { value = sub_realm_size multiply = 3 }
									add = { value = piety_level multiply = 30 }
									add = { value = prestige_level multiply = 45 }
									add = { value = legitimacy_level multiply = 80 }
									add = { value = capital_province.county.development_level multiply = 10 }
									add = { value = capital_province.combined_building_level multiply = 20 }
									divide = highest_held_title_tier
									divide = highest_held_title_tier
									multiply = 3
									if = {
									limit = {
										OR = {
											has_realm_law = crown_authority_0
											has_realm_law = tribal_authority_0
											has_realm_law = imperial_bureaucracy_0
										}
									}
									multiply = 0.5
									}
									if = {
										limit = {
											OR = {
												has_realm_law = crown_authority_1
												has_realm_law = tribal_authority_1
												has_realm_law = imperial_bureaucracy_1
											}
										}
										multiply = 0.75
									}
									if = {
										limit = {
											has_realm_law_flag = max_authority_level
										}
										multiply = 1.25
									}
									if = {
										limit = {
											government_has_flag = government_is_tribal
										}
										multiply = 1.5
									}
									if = {
										limit = {
											highest_held_title_tier < scope:attacker.highest_held_title_tier
										}
										multiply = scope:attacker.highest_held_title_tier
										divide = highest_held_title_tier
									}
									if = {
										limit = {
											is_independent_ruler = yes
											vassal_count > 50
										}
										multiply = 0.80
									}
									if = {
										limit = {
											is_independent_ruler = yes
											vassal_count > 25
										}
										multiply = 0.80
									}
									if = {
										limit = {
											is_independent_ruler = yes
											highest_held_title_tier = 3
										}
										multiply = 1.2
									}
									if = {
										limit = {
											is_independent_ruler = yes
											highest_held_title_tier = 2
										}
										multiply = 1.4
									}
								}
							}
							location = scope:defender.capital_province
							origin = scope:defender.capital_province
							uses_supply = yes
							war = scope:war
							inheritable = no
						}
					}
				}
			}
		}
	}
}



