﻿# Game Rules Values
agot_dragon_cull_limit = {
	value = 0
	if = {
		limit = {
			has_game_rule = agot_dragon_culling_high
		}
		add = 35
	}
	else_if = {
		limit = {
			has_game_rule = agot_dragon_culling_normal
		}
		add = 27
	}
	else_if = {
		limit = {
			has_game_rule = agot_dragon_culling_low
		}
		add = 20
	}
	else = {
		add = 9999
	}
}

#DYNASTY PRESTIGE

#Note! These are base values, use loss/gain below
agot_mini_dynasty_prestige_value = 10

agot_mini_dynasty_prestige_loss = {
	value = 0
	subtract = agot_mini_dynasty_prestige_value
}

agot_mini_dynasty_prestige_gain = agot_mini_dynasty_prestige_value


#CURRENT COURT GRANDEUR VALUES
agot_mini_court_grandeur_value = 1

## Positives.
agot_mini_court_grandeur_gain = agot_mini_court_grandeur_value

## Negatives.
agot_mini_court_grandeur_loss = {
	value = 0
	subtract = agot_mini_court_grandeur_value
}


#PRESTIGE
agot_mini_prestige_value = 15

agot_mini_prestige_loss = {
	value = 0
	subtract = agot_mini_prestige_value
}

agot_mini_prestige_gain = agot_mini_prestige_value

days_since_conquest = {
	value = current_year
	subtract = 8000
	multiply = 365
}

agot_historic_outcome_2 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 100
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 75
		}
	}
	else = {
		add = {
			value = 50
		}
	}
}

agot_historic_outcome_3 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 100
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 60
		}
	}
	else = {
		add = {
			value = 33
		}
	}
}

agot_historic_outcome_4 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 100
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 50
		}
	}
	else = {
		add = {
			value = 25
		}
	}
}

agot_historic_outcome_5 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 100
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 42
		}
	}
	else = {
		add = {
			value = 20
		}
	}
}

agot_nonhistoric_outcome_2 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 0
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 25
		}
	}
	else = {
		add = {
			value = 50
		}
	}
}

agot_nonhistoric_outcome_3 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 0
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 20
		}
	}
	else = {
		add = {
			value = 33
		}
	}
}

agot_nonhistoric_outcome_4 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 0
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 17
		}
	}
	else = {
		add = {
			value = 25
		}
	}
}

agot_nonhistoric_outcome_5 = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 0
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 14
		}
	}
	else = {
		add = {
			value = 20
		}
	}
}

agot_historic_event_chance = {
	value = 0
	if = {
		limit = {
			agot_has_historical_events_trigger = yes
		}
		add = {
			value = 100
		}
	}
	else = {
		add = {
			value = 50
		}
	}
}

agot_nonhistoric_event_chance = {
	value = 0
	if = {
		limit = {
			agot_has_historical_events_trigger = yes
		}
		add = {
			value = 0
		}
	}
	else = {
		add = {
			value = 50
		}
	}
}

agot_historic_chain_outcome = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 100
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 90
		}
	}
	else = {
		add = {
			value = 70
		}
	}
}

agot_nonhistoric_chain_outcome = {
	value = 0
	if = {
		limit = { has_game_rule = agot_story_historical_events_historical_outcomes }
		add = {
			value = 0
		}
	}
	else_if = {
		limit = { has_game_rule = agot_story_historical_events_weighted_outcomes }
		add = {
			value = 10
		}
	}
	else = {
		add = {
			value = 30
		}
	}
}

calc_actor_rough_opinion_target_opinion_value = {
	if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 100
				}
			}
		}
		add = 100
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 95
				}
			}
		}
		add = 95
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 90
				}
			}
		}
		add = 90
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 85
				}
			}
		}
		add = 85
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 80
				}
			}
		}
		add = 80
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 75
				}
			}
		}
		add = 75
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 70
				}
			}
		}
		add = 70
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 655
				}
			}
		}
		add = 65
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 60
				}
			}
		}
		add = 60
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 55
				}
			}
		}
		add = 55
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 50
				}
			}
		}
		add = 50
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 45
				}
			}
		}
		add = 45
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 40
				}
			}
		}
		add = 40
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 35
				}
			}
		}
		add = 35
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 30
				}
			}
		}
		add = 30
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 25
				}
			}
		}
		add = 25
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 20
				}
			}
		}
		add = 20
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 15
				}
			}
		}
		add = 15
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 10
				}
			}
		}
		add = 10
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 5
				}
			}
		}
		add = 5
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= 0
				}
			}
		}
		add = 0
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -5
				}
			}
		}
		add = -5
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -10
				}
			}
		}
		add = -10
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -15
				}
			}
		}
		add = -15
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -20
				}
			}
		}
		add = -20
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -25
				}
			}
		}
		add = -25
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -30
				}
			}
		}
		add = -30
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -35
				}
			}
		}
		add = -35
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -40
				}
			}
		}
		add = -40
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -45
				}
			}
		}
		add = -45
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -50
				}
			}
		}
		add = -50
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -55
				}
			}
		}
		add = -55
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -60
				}
			}
		}
		add = -60
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -65
				}
			}
		}
		add = -65
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -70
				}
			}
		}
		add = -70
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -75
				}
			}
		}
		add = -75
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -80
				}
			}
		}
		add = -80
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >=-85
				}
			}
		}
		add = -85
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -90
				}
			}
		}
		add = -90
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -95
				}
			}
		}
		add = -95
	}
	else_if = {
		limit = {
			scope:actor = {
				opinion = {
					target = scope:opinion_target
					value >= -100
				}
			}
		}
		add = -100
	}
}

dragonrider_xp_gain_miniscule_value = {
	value = { 1 3 }
}

dragonrider_xp_gain_minor_value = {
	value = { 3 7 }
}

dragonrider_xp_gain_medium_value = {
	value = { 8 12 }
}

dragonrider_xp_gain_major_value = {
	value = { 13 17 }
}

opinion_of_root = {
	value = 0
	if = {
		limit = { save_temporary_opinion_value_as = { name = temp_op target = root } }
		add = scope:temp_op
	}
}

opinion_of_owner = {
	value = 0
	if = {
		limit = { save_temporary_opinion_value_as = {name = temp_op target = scope:owner}}
		add = scope:temp_op
	}
}

opinion_of_this = { # The value of root's opinion of target for sorting - Dan
	value = 0
	save_temporary_scope_as = target
	if = {
		limit = { root = { save_temporary_opinion_value_as = { name = temp_op target = scope:target } } }
		add = scope:temp_op
	}
}

appropriate_parent_age = {
	value = age
	add = 16
	if = {
		limit = { learning < 20 }
		add = learning
	}
	else_if = {
		limit = { diplomacy < 20 }
		add = diplomacy
	}
	else_if = {
		limit = { stewardship < 20 }
		add = stewardship
	}
	else_if = {
		limit = { martial < 20 }
		add = martial
	}
	else_if = {
		limit = { intrigue < 20 }
		add = intrigue
	}
	else = {
		add = 5
	}
}

accept_horn_blowing = {
	value = opinion_of_root
	add = ai_honor
	add = {
		value = ai_rationality
		multiply = -1
	}
	add = {
		value = root.dread
		multiply = 2
	}
	if = {
		limit = {
			is_imprisoned = yes
		}
		add = 50
	}
	if = {
		limit = {
			is_close_family_of = root
		}
		multiply = 0.75
	}

}

decline_horn_blowing = {
	value = 0
	add = {
		value = opinion_of_root
		multiply = -1
	}
	add = ai_greed
	if = {
		limit = {
			is_imprisoned = yes
		}
		add = {
			value = 50
			multiply = -1
		}
	}
}

horn_blowing_difference = {
	value = accept_horn_blowing
	subtract = decline_horn_blowing
}

agot_conversion_faith_harder_to_convert = {
	value = 0
	if = {
		limit = {
			exists = scope:county
			scope:county.faith = {
				has_doctrine_parameter = counties_harder_to_convert
			}
		}
		subtract = court_chaplain_conversion_base_total
		multiply = 0.3
	}
}

dev_level_to_convert_into_pirate_holding = 15