@base_reward_weight = 2 #Base Reward weight value
@reward_weight_factor_theme = 0.25 # Applied to factor - Used to reduce chances of repeating the same reward theme within the same project (ie. Failure 1 & Failure 2)

#"Good"
sp_air_scientist_xp_generic_reward = {
	fire_only_once = no
	
	threshold = { 
		min = 0
		max = 100
	}
	
	weight = {
		base = 1
	}
	
	option = {
		token = sp_air_scientist_xp_generic_reward_option
				
		iteration_output = {
			scientist_effects = {
				add_scientist_xp = {
					experience = constant:sp_scientist_xp_gain.very_high
					specialization = specialization_air
				}
			}
		}
	}
}

sp_air_generic_major_breakthrough_reward = {
	fire_only_once = no
	
	threshold = { 
		min = 0
		max = 100
	}
	
	weight = {
		base = 1
	}
	
	option = {
		token = sp_air_generic_major_breakthrough_reward_option
				
		iteration_output = {
			country_effects = {
				FROM = { add_project_progress_ratio = constant:sp_progress.gain.medium }
			}
		}
	}
}

sp_air_generic_aerodynamics_advancements_reward = {
	fire_only_once = no
	
	threshold = { 
		min = 0
		max = 100
	}
	
	weight = {
		base = 1
	}
	
	option = {
		token =sp_air_generic_avionics_advancements_reward_option
				
		iteration_output = {
			country_effects = {
				air_experience = 25
			}
		}
	}
}

sp_air_generic_discoveries_reward = {
	fire_only_once = no
	
	threshold = { 
		min = 0
		max = 100
	}
	
	weight = {
		base = 1
	}
	
	option = {
		token =sp_air_generic_avionics_advancements_reward_option
				
		iteration_output = {
			country_effects = {
				add_tech_bonus = {
					name = sp_air_generic_discoveries_reward
					bonus = 0.25
					uses = 1
					category = air_equipment
				} 
			}
		}
	}
}

# "Bad"
sp_air_political_interference_generic_reward = {
	fire_only_once = no
	
	threshold = { 
		min = 0
		max = 70
	}
	
	weight = {
		base = 0.5
		modifier = {
			factor = 2
			FROM = { has_government = fascism }
		}
	}
	
	option = {
		token = sp_air_minor_progress_generic_reward_option
				
		iteration_output = {
			country_effects = {
				FROM = { add_project_progress_ratio = constant:sp_progress.loss.low }
			}
		}
	}
}


# EXPANDED AIR GENERIC AIR REWARDS

#Low Scientist XP gain
sp_air_generic_reward_scientist_xp_1 = {

	fire_only_once = yes

	threshold = {
		min = 0
		max = 100
	}

	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_scientist_xp_flag
		}
		modifier = {
			factor = 0
			var:scientist = {
				has_scientist_level = {
					level > 4
					specialization = specialization_air
				}
			}
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_scientist_xp
		
		iteration_output = {
			scientist_effects = {
				if = {
					limit = {
						
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
				FROM = { set_project_flag = sp_air_generic_reward_scientist_xp_flag }
			}
		}
	}
}

#Medium Scientist XP gain
sp_air_generic_reward_scientist_xp_2 = {

	fire_only_once = yes

	threshold = {
		min = 0
		max = 100
	}

	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_scientist_xp_flag
		}
		modifier = {
			factor = 0
			var:scientist = {
				has_scientist_level = {
					level > 4
					specialization = specialization_air
				}
			}
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_scientist_xp
		
		iteration_output = {
			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.medium
						specialization = specialization_air
					}
				}
				FROM = { set_project_flag = sp_air_generic_reward_scientist_xp_flag }
			}
		}
	}
}

#High Scientist XP gain
sp_air_generic_reward_scientist_xp_3 = {

	fire_only_once = yes

	threshold = {
		min = 0
		max = 100
	}

	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_scientist_xp_flag
		}
		modifier = {
			factor = 0
			var:scientist = {
				has_scientist_level = {
					level > 4
					specialization = specialization_air
				}
			}
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_scientist_xp
		
		iteration_output = {
			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.high
						specialization = specialization_air
					}
				}
				FROM = { set_project_flag = sp_air_generic_reward_scientist_xp_flag }
			}

			country_effects = {
				add_breakthrough_progress = {
					specialization = specialization_air
					value = sp_breakthrough_progress.medium
				}
			}
		}
	}
}

#Low air XP
sp_air_generic_reward_air_xp_1 = {
	fire_only_once = yes
	
	threshold = {
		min = 50
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_air_xp_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_air_xp
		
		iteration_output = {
			country_effects = {
				air_experience = constant:sp_military_xp_gain.low
				FROM = { set_project_flag = sp_air_generic_reward_air_xp_flag }
			}
		}
	}
}

#medium air XP
sp_air_generic_reward_air_xp_2 = {
	fire_only_once = yes
	
	threshold = {
		min = 50
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_air_xp_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_air_xp
		
		iteration_output = {
			country_effects = {
				air_experience = constant:sp_military_xp_gain.medium
				FROM = { set_project_flag = sp_air_generic_reward_air_xp_flag }
			}
		}
	}
}

#High air XP
sp_air_generic_reward_air_xp_3 = {
	fire_only_once = yes
	
	threshold = {
		min = 50
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_air_xp_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_air_xp
		
		iteration_output = {
			country_effects = {
				air_experience = constant:sp_military_xp_gain.high
				
				add_breakthrough_progress = {
					specialization = specialization_air
					value = sp_breakthrough_progress.medium
				}

				FROM = { set_project_flag = sp_air_generic_reward_air_xp_flag }
			}
		}
	}
}

#Low Extra Progress
sp_air_generic_reward_major_progress_1 = {
	fire_only_once = yes

	threshold = {
		min = 0
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_major_progress_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_major_breakthrough
		
		iteration_output = {
			country_effects = {
				FROM = {
					add_project_progress_ratio = constant:sp_progress.gain.low				
					
					set_project_flag = sp_air_generic_reward_major_progress_flag
				}
			}

			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
			}
		}
	}
}

#Medium Extra Progress
sp_air_generic_reward_major_progress_2 = {
	fire_only_once = yes

	threshold = {
		min = 0
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_major_progress_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_major_breakthrough
		
		iteration_output = {
			country_effects = {
				FROM = {
					add_project_progress_ratio = constant:sp_progress.gain.medium				
					
					set_project_flag = sp_air_generic_reward_major_progress_flag
				}
			}

			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
			}
		}
	}
}

#High Extra Progress
sp_air_generic_reward_major_progress_3 = {
	fire_only_once = yes

	threshold = {
		min = 0
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_major_progress_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_major_breakthrough
		
		iteration_output = {
			country_effects = {
				FROM = {
					add_project_progress_ratio = constant:sp_progress.gain.high				
					
					set_project_flag = sp_air_generic_reward_major_progress_flag
				}

				add_breakthrough_progress = {
					specialization = specialization_air
					value = sp_breakthrough_progress.medium
				}
			}

			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
			}
		}
	}
}

#Low Progress Loss
sp_air_generic_reward_test_failure_1 = {
	fire_only_once = yes
	
	threshold = {
		min = 15 #Loss is 5
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_test_failure_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_test_failure
		
		iteration_output = {
			country_effects = { 
				FROM = {
					add_project_progress_ratio = constant:sp_progress.loss.low

					set_project_flag = sp_air_generic_reward_test_failure_flag
				}
			}

			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
			}
		}
	}
}

#Medium Progress Loss
sp_air_generic_reward_test_failure_2 = {
	fire_only_once = yes
	
	threshold = {
		min = 30 #Loss is 10
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_test_failure_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_test_failure
		
		iteration_output = {
			country_effects = { 
				FROM = {
					add_project_progress_ratio = constant:sp_progress.loss.medium

					set_project_flag = sp_air_generic_reward_test_failure_flag
				}
			}

			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
			}
		}
	}
}

#High Progress Loss
sp_air_generic_reward_test_failure_3 = {
	fire_only_once = yes
	
	threshold = {
		min = 50 #Loss is 15
		max = 100
	}
	
	# ROOT is the project
	# FROM is the Country
	# var:facility_state is the State where the facility is (ensured to be set in this case)
	# var:facility_province_id is the province ID where the facility is (ensured to be set in this case)
	# var:scientist is the Scientist (ensured to be set in this case)
	weight = {
		base = @base_reward_weight
		modifier = {
			factor = @reward_weight_factor_theme
			has_project_flag = sp_air_generic_reward_test_failure_flag
		}
	}
	
	option = {
		token = sp_air_generic_reward_option_test_failure
		
		iteration_output = {
			country_effects = { 
				FROM = {
					add_project_progress_ratio = constant:sp_progress.loss.high

					set_project_flag = sp_air_generic_reward_test_failure_flag
				}

				add_breakthrough_progress = {
					specialization = specialization_air
					value = sp_breakthrough_progress.medium
				}
			}

			scientist_effects = {
				if = {
					limit = {
						has_scientist_level = {
							level < 5
							specialization = specialization_air
						}
					}
					add_scientist_xp = {
						experience = constant:sp_scientist_xp_gain.low
						specialization = specialization_air
					}
				}
			}
		}
	}
}
