#################################
# BLACK DEATH SERIES		    #
#################################

#################################
# The Bubonic Plague arrives	#
#################################
province_event = {
	id = 1069

	picture = "event_plague"

	trigger = {
		condition = { type = year value = 1100 }		
		condition = {
			type = or
			condition = { type = area value = 693 } 	#Baghdad
			condition = { type = area value = 628 }		#Bukhara
			condition = { type = area value = 796 }		#Fustat
			condition = { type = area value = 646 }		#Isfahan
		}
		condition = { type = not value = { type = has_province_effect value = { bubonic_plague = yes } } }
		condition = { type = not value = { type = has_province_effect value = { bubonic_plague_immunity = yes } } }
	}

	mean_time_to_happen = {
		years = 1666

		modifier = {
			condition = { type = not value = { type = year value = 1175 } }
			factor = 100
		}
		modifier = {
			condition = { type = year value = 1175 }
			condition = { type = not value = { type = year value = 1250 } }
			factor = 50
		}
		modifier = {
			condition = { type = year value = 1250 }
			condition = { type = not value = { type = year value = 1325 } }
			factor = 25
		}
	}

	action_a = {
		effect = { type = add_province_effect value = bubonic_plague }
	}
}
#################################
# The Pneumonic Plague arrives	#
#################################
province_event = {
	id = 1070

	picture = "event_plague"

	trigger = {
		condition = { type = year value = 1100 }		
		condition = {
			type = or
			condition = { type = area value = 693 } 	#Baghdad
			condition = { type = area value = 628 }		#Bukhara
			condition = { type = area value = 796 }		#Fustat
			condition = { type = area value = 646 }		#Isfahan
		}
		condition = { type = not value = { type = has_province_effect value = { pneumonic_plague = yes } } }
		condition = { type = has_province_effect value = { bubonic_plague_immunity = yes } }
		condition = { type = not value = { type = has_province_effect value = { pneumonic_plague_immunity = yes } } }
	}

	mean_time_to_happen = {
		years = 1093

		modifier = {
			condition = { type = not value = { type = year value = 1175 } }
			factor = 100
		}
		modifier = {
			condition = { type = year value = 1175 }
			condition = { type = not value = { type = year value = 1250 } }
			factor = 50
		}
		modifier = {
			condition = { type = year value = 1250 }
			condition = { type = not value = { type = year value = 1325 } }
			factor = 25
		}
	}

	action_a = {
		effect = { type = add_province_effect value = pneumonic_plague }
	}
}
#################################
# The Bubonic Plague on retreat	#
#################################
province_event = {
	id = 1071

	picture = "event_plague"

	trigger = {
		condition = {
			type = has_province_effect
			value = { bubonic_plague = yes }
		}
	}

	mean_time_to_happen = {
		months = 48
	}

	action_a = {
		effect = { type = add_province_effect value = bubonic_plague_immunity }
		effect = { type = remove_province_effect value = bubonic_plague }
	}
}

###################################
# The Pneumonic Plague on retreat #
###################################
province_event = {
	id = 1072

	picture = "event_plague"

	trigger = {
		condition = {
			type = has_province_effect
			value = { pneumonic_plague = yes }
		}
	}

	mean_time_to_happen = {
		months = 48
	}

	action_a = {
		effect = { type = add_province_effect value = pneumonic_plague_immunity }
		effect = { type = remove_province_effect value = pneumonic_plague }
	}

}
#############################
# The Bubonic Plague spread	#
#############################

province_x_province_event = {
	id = 1073

	picture = "event_plague"

	trigger	= {
		condition = {
			type = from
			condition = {
				type = has_province_effect
				value = {
					bubonic_plague = yes
				}
			}
		}

		condition = {
			type = to
			condition = {
				type = not
				value = {
					type = has_province_effect
					value = {
						bubonic_plague = yes
					}
				}
			}
			condition = {
				type = not
				value = {
					type = has_province_effect
					value = {
						bubonic_plague_immunity = yes
					}
				}
			}
		}
	}

	mean_time_to_happen = {
	 	days = 30

		modifier = {
			condition = { type = same_culture }
			factor = 0.9
		}
		modifier = {
			condition = { type = same_realm }
			factor = 0.85
		}
		modifier = {
			condition = { type = same_ruler }
			factor = 0.75
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { roadnet = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { extensive_roadnet = yes } }
			}
			factor = 0.8
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { civilian_harbour = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { naval_harbour = yes } }
			}
			factor = 0.75
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { grand_shipyard = yes } }
			}
			factor = 0.5
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { templar_house = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { monastery = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { roadnet = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { extensive_roadnet = yes } }
			}
			factor = 0.8
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { civilian_harbour = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { naval_harbour = yes } }
			}
			factor = 0.75
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { grand_shipyard = yes } }
			}
			factor = 0.5
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { templar_house = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { monastery = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = to
				condition = { type = terrain value = Mountain  }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = from
				condition = { type = terrain value = Mountain  }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = to
				condition = { type = terrain value = Desert }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = from
				condition = { type = terrain value = Desert }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = to
				condition = { type = terrain value = March }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = from
				condition = { type = terrain value = March }
			}
			factor = 1.25
		}
	}

	action_a = {
		effect = {
			type = to

			effect = {
				type = add_province_effect
				value = bubonic_plague
			}
		}
	}
}
###############################
# The Pneumonic Plague spread #
###############################

province_x_province_event = {
	id = 1074

	picture = "event_plague"

	trigger	= {
		condition = {
			type = from
			condition = {
				type = has_province_effect
				value = {
					pneumonic_plague = yes
				}
			}
		}

		condition = {
			type = to
			condition = {
				type = not
				value = {
					type = has_province_effect
					value = {
						pneumonic_plague = yes
					}
				}
			}
			condition = {
				type = not
				value = {
					type = has_province_effect
					value = {
						pneumonic_plague_immunity = yes
					}
				}
			}
		}
	}

	mean_time_to_happen = {
	 	days = 30

		modifier = {
			condition = { type = same_culture }
			factor = 0.9
		}
		modifier = {
			condition = { type = same_realm }
			factor = 0.85
		}
		modifier = {
			condition = { type = same_ruler }
			factor = 0.75
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { roadnet = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { extensive_roadnet = yes } }
			}
			factor = 0.8
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { civilian_harbour = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { naval_harbour = yes } }
			}
			factor = 0.75
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { grand_shipyard = yes } }
			}
			factor = 0.5
		}
		modifier = {
			condition = {
				type = to
				condition = { type = has_improvement value = { templar_house = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { monastery = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { roadnet = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { extensive_roadnet = yes } }
			}
			factor = 0.8
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { civilian_harbour = yes } }
			}
			factor = 0.9
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { naval_harbour = yes } }
			}
			factor = 0.75
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { grand_shipyard = yes } }
			}
			factor = 0.5
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { templar_house = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = from
				condition = { type = has_improvement value = { monastery = yes } }
			}
			factor = 1.05
		}
		modifier = {
			condition = {
				type = to
				condition = { type = terrain value = Mountain  }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = from
				condition = { type = terrain value = Mountain  }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = to
				condition = { type = terrain value = Desert }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = from
				condition = { type = terrain value = Desert }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = to
				condition = { type = terrain value = March }
			}
			factor = 1.25
		}
		modifier = {
			condition = {
				type = from
				condition = { type = terrain value = March }
			}
			factor = 1.25
		}
	}
	action_a = {
		effect = {
			type = to

			effect = {
				type = add_province_effect
				value = pneumonic_plague
			}
		}
	}
}
#################################
#  The Great Cattle Disease	    #
#################################
province_event = {
	id = 1075

	picture = "event_agriculture"

	trigger = {
		condition = { type = has_improvement value = { cheese_dairy = yes } }
	 }

	mean_time_to_happen = {
		years = 1200
		modifier = {
			condition = { type = year value = 1310 }
			factor = 0.05
		}
	}

	action_a = {
		effect = { type = remove_improvement value = cheese_dairy }
	}

}
#################################
#  Malaria arrives	    		#
#################################

province_event = {
	id = 1076

	picture = "event_sickness"

	trigger = {
		condition = {
			type = not
			value = {
				type = has_province_effect
				value = { malaria = yes }
			}
		}
		condition = {
			type = or
			condition = { type = region value = asia_minor }
			condition = { type = region value = italy }
			condition = { type = region value = spain }
			condition = { type = region value = middle_east }
			condition = { type = region value = north_africa }
		}
	}

	mean_time_to_happen = {
		months = 2400

		modifier = {
			condition = { type = has_improvement value = { civilian_harbour = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = has_improvement value = { extensive_roadnet = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = neighbor_province_effect value = { malaria = yes } }
			factor = 0.1
		}
	}

	action_a = {
		effect = { type = add_province_effect value = malaria }
	}

}

#################################
#  Malaria on retreat	    	#
#################################
province_event = {
	id = 1077

	picture = "event_sickness"

	trigger = {
		condition = {
				type = has_province_effect
				value = { malaria = yes }
		}
	}

	mean_time_to_happen = {
		months = 18
	}

	action_a = {
		effect = { type = remove_province_effect value = malaria }
	}

}
#################################
#  Dysentery arrives	    	#
#################################
province_event = {
	id = 1078

	picture = "event_sickness"

	trigger = {
		condition = {
			type = not
			value = {
				type = has_province_effect
				value = { dysentery = yes }
			}
		}
	}

	mean_time_to_happen = {
		months = 2400

		modifier = {
			condition = { type = has_improvement value = { civilian_harbour = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = has_improvement value = { extensive_roadnet = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = neighbor_province_effect value = { dysentery = yes } }
			factor = 0.1
		}
	}

	action_a = {
		effect = { type = add_province_effect value = dysentery }
	}

}
#################################
#  Dysentery on retreat	    	#
#################################
province_event = {
	id = 1079

	picture = "event_sickness"

	trigger = {
		condition = {
				type = has_province_effect
				value = { dysentery = yes }
		}
	}

	mean_time_to_happen = {
		months = 18
	}

	action_a = {
		effect = { type = remove_province_effect value = dysentery }
	}

}
#################################
#  Small Pox arrives 	    	#
#################################
province_event = {
	id = 1080

	picture = "event_sickness"

	trigger = {
		condition = {
			type = not
			value = {
				type = has_province_effect
				value = { small_pox = yes }
			}
		}
	}

	mean_time_to_happen = {
		months = 2400

		modifier = {
			condition = { type = has_improvement value = { civilian_harbour = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = has_improvement value = { extensive_roadnet = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = neighbor_province_effect value = { small_pox = yes } }
			factor = 0.1
		}
	}

	action_a = {
		effect = { type = add_province_effect value = small_pox }
	}

}
#################################
#  Small Pox on retreat 	    #
#################################
province_event = {
	id = 1081

	picture = "event_sickness"

	trigger = {
		condition = {
				type = has_province_effect
				value = { small_pox = yes }
		}
	}

	mean_time_to_happen = {
		months = 18
	}

	action_a = {
		effect = { type = remove_province_effect value = small_pox }
	}

}
#################################
#  The Typhoid Fever arrives	#
#################################
province_event = {
	id = 1082

	picture = "event_sickness"

	trigger = {
		condition = {
			type = not
			value = {
				type = has_province_effect
				value = { typhoid_fever = yes }
			}
		}
	}

	mean_time_to_happen = {
		months = 2400

		modifier = {
			condition = { type = has_improvement value = { civilian_harbour = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = has_improvement value = { extensive_roadnet = yes } }
			factor = 0.9
		}
		modifier = {
			condition = { type = neighbor_province_effect value = { typhoid_fever = yes } }
			factor = 0.1
		}
	}

	action_a = {
		effect = { type = add_province_effect value = typhoid_fever }
	}

}
#################################
#  The Typhoid Fever on retreat	#
#################################
province_event = {
	id = 1083

	picture = "event_sickness"

	trigger = {
		condition = {
			type = has_province_effect
			value = { typhoid_fever = yes }
		}
	}

	mean_time_to_happen = {
		months = 18
	}

	action_a = {
		effect = { type = remove_province_effect value = typhoid_fever }
	}

}