namespace = HF
# Some additional flavor for Africa

#########################################

# Story-telling
character_event = {
    id = HF.15000
    title = EVTTITLE_HF_15000
    desc = EVTDESC_HF_15000
    picture = GFX_evt_moonlit_mountains_hf
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    
    }

    immediate = {
    	if = {
    		limit = {
    			any_owned_bloodline = {
    				founder = {
    					NOT = {
    						character = ROOT
    					}
    				}
    			}
    		}
    		random_owned_bloodline = {
    			founder = {
    				save_event_target_as = bloodline_founder
    			}
    		}    		
    	}
    }

    option = { # Lunatic option
        name = EVTOPTA_HF_15000
        add_character_modifier = {
			modifier = told_story_nr_1
			years = 5			
		}

		tooltip_info = lunatic

		trigger = { trait = lunatic }
    }
    option = { # Dumb option
        name = EVTOPTB_HF_15000
        add_character_modifier = {
			modifier = told_story_nr_2
			years = 5			
		}

		tooltip_info_custom = available_because_dumb

		ai_chance = {
			factor = 100
		}

		trigger = { is_dumb_trigger = yes }
    }
    option = { # Bloodline option (not dumb)
        name = EVTOPTC_HF_15000
        add_character_modifier = {
			modifier = told_story_nr_3
			years = 5			
		}
		trigger = {
			event_target:bloodline_founder = { always = yes }
		}
    }
    option = { # About bravery
        name = EVTOPTD_HF_15000
        add_character_modifier = {
			modifier = told_story_nr_4
			years = 5			
		}
    }
    option = { # About religion
        name = EVTOPTE_HF_15000
        add_character_modifier = {
			modifier = told_story_nr_5
			years = 5			
		}
    }
    option = { # About your tribe
        name = EVTOPTF_HF_15000
        add_character_modifier = {
			modifier = told_story_nr_6
			years = 5			
		}
		trigger = { is_tribal = yes }
    }

    after = {
    	clr_character_flag = choosing_a_story_flag
    }
}

# Rains down in Africa (SETUP)
character_event = {
    id = HF.15099
    is_triggered_only = yes
    hide_window = yes
    has_dlc = "Holy Fury"
    only_playable = yes

    trigger = {
    	any_realm_province = {
    		is_land = yes
	    	region_africa_west_central_or_east_trigger = yes
	    	has_rain_or_drought_modifier_trigger = no
    	}
    }

    immediate = {
    	any_realm_province = {
    		limit = {
	    		is_land = yes
		    	region_africa_west_central_or_east_trigger = yes
		    	has_rain_or_drought_modifier_trigger = no
    		}
    		# Solid start... Activate this for more sunny weather from the get-go...
    		add_province_modifier = {
    			name = africa_light_rain
    			duration = -1
    		}
    		change_rain_effect = yes #Activate this instead, if you want it more random...
    	}
    }
}


# Rain development (on 5 year pulse)
character_event = {
    id = HF.15100
    is_triggered_only = yes
    hide_window = yes
    has_dlc = "Holy Fury"
    only_playable = yes

    trigger = {
        any_demesne_province = {
            is_land = yes
            region_africa_west_central_or_east_trigger = yes
            has_rain_or_drought_modifier_trigger = yes
        }
    }

    immediate = {
        #save_event_target_as = rain_liege

#       while = { # As long as there are some provinces left to change the weather of...
#           limit = {
#               any_demesne_province = {
#                   is_land = yes
#                   region_africa_west_central_or_east_trigger = yes
#                   NOT = { has_province_modifier = africa_weather_updated }
#               }
#           }

            ### Current setup: Runs through all demesne provinces and chain-changes them (based on previous status and neighbor's status)
            any_demesne_province = { #Change weather...
                limit = {
                    is_land = yes
                    region_africa_west_central_or_east_trigger = yes
                    NOT = { has_province_modifier = africa_weather_updated }
                }
                change_rain_effect = yes
            }
#               preferred_limit = {
#                   is_capital = yes #An attempt to make your capital the most important choice for the rain :p
#                   is_land = yes
#                   region_africa_west_central_or_east_trigger = yes
#                   NOT = { has_province_modifier = africa_weather_updated }
#               }
                #save_event_target_as = target_province


#               location = { duchy = { save_event_target_as = target_duchy_title } }
#
#               # Spread it to the duchy...             
#               event_target:target_duchy_title = {
#                   any_de_jure_vassal = {
#                       location = {
#                           if = {
#                               limit = { NOT = { has_province_modifier = africa_weather_updated } }
#                               event_target:target_province = { clone_weather_to_prev_effect = yes }
#                           }
#                       }
#                   }
#               }
#           }
#       }   
    }
}


# Delay for the tombola below (from on bi_yearly_pulse)
character_event = {
    id = HF.15098
    hide_window = yes
    is_triggered_only = yes
    
    only_playable = yes
    min_age = 16
    capable_only = yes
    prisoner = no
    has_dlc = "Holy Fury"

    immediate = { character_event = { id = HF.15120 days = 5 } }
}

# Tombola for flavor/risks/bonuses related to the rain/drought... (from event above )
character_event = {
    id = HF.15120
    is_triggered_only = yes
    hide_window = yes
    
    only_playable = yes
    #only_independent = yes
    min_age = 16
    capable_only = yes
    prisoner = no
    has_dlc = "Holy Fury"

    trigger = {
    	any_demesne_province = {
    		region_africa_west_central_or_east_trigger = yes
    		has_rain_or_drought_modifier_trigger = yes
    	}
    }

    immediate = {
    	calculate_weather_status_in_demesne_effect = yes #Run this in an effect file for testing individual events

    	#The Winds over [PrimaryTitle] (Rain prep)......... HF.15110
		#Rain dances have effect (?) ...................... HF.15101
		#To dance or not to dance ......................... HF.15102

    	#Landslide in province............................. HF.15121
		#Molding Library................................... HF.15123
		#Flooded Armory ................................... HF.15124
    	
    	#The Winds over [PrimaryTitle] (Drought prep)......	HF.15111
		#Drought causes starvation (notification only) .... HF.15125
		#Drought spreads disease .......................... HF.15122

    	random_list = {
    		### Any rain...
    		10 = { # The Winds over [PrimaryTitle] (Rain)
    			character_event = { id = HF.15110 }
    			trigger = {
    				OR = {
	    				has_character_flag = mostly_heavy_rain
						has_character_flag = mostly_light_rain
    				}
					NOR = {
						has_character_flag = mostly_drought_risk
						has_character_flag = mostly_drought	
					}
		    		capital_scope = {
			    		OR = {
			    			has_province_modifier = africa_heavy_rain
			    			has_province_modifier = africa_light_rain
			    		}
			    	}
    			}
    		}
    		10 = { # Rain dances have effect (?)
    			character_event = { id = HF.15101 }
    			modifier = {
    				factor = 1.5
    				OR = {
	    				has_character_flag = mostly_heavy_rain
	    				has_character_flag = mostly_light_rain
    				}
					NOR = {
						has_character_flag = mostly_drought_risk
						has_character_flag = mostly_drought	
					}
    			}
    			modifier = {
    				factor = 1.5
    				NOT = { #If there are is *no* drought at all
	    				any_demesne_province = {
	    					OR = {
								has_province_modifier = africa_drought_risk
								has_province_modifier = africa_drought
							}
	    				}
    				}
    			}
	    		trigger = {
	    			any_demesne_province = {
						OR = {
		    				has_province_modifier = africa_light_rain
		    				has_province_modifier = africa_heavy_rain
						}
						OR = {
							has_province_modifier = africa_rain_dance_1
							has_province_modifier = africa_rain_dance_2
						}
					}
	    		}
	    	}
	    	10 = { # To dance or not to dance
    			character_event = { id = HF.15102 }
    			modifier = {
    				factor = 1.5
    				OR = {
	    				has_character_flag = mostly_heavy_rain
	    				has_character_flag = mostly_light_rain
    				}
					NOR = {
						has_character_flag = mostly_drought_risk
						has_character_flag = mostly_drought	
					}
    			}
	    		trigger = {
		    		any_demesne_province = {
	    				has_province_modifier = africa_light_rain		    		
	    				NOT = { has_province_modifier = africa_rain_dance_1 }
	    				NOT = { has_province_modifier = africa_rain_dance_2 }
	    				
	    				NOT = { #You've had it great for way too long...
			    			had_province_flag = {
								flag = africa_light_rain_flag
								days = 18250 # 50 years...
							}
	    				}
	    			}
	    		}
	    	}
    		### Heavy Rain...
    		10 = { # Landslide in a province...
    			character_event = { id = HF.15121 }
    			modifier = {
    				factor = 1.5
    				has_character_flag = mostly_heavy_rain
					NOR = {
						has_character_flag = mostly_light_rain
						has_character_flag = mostly_drought_risk
						has_character_flag = mostly_drought	
					}
    			}
                modifier = {
                    factor = 0.1
                    any_demesne_province = { has_province_modifier = good_bida_sacrifice }
                }
                modifier = {
                    factor = 2
                    any_demesne_province = {
                        has_province_modifier = africa_heavy_rain
                        OR = {
                            has_province_modifier = bad_bida_sacrifice
                            has_province_modifier = canceled_bida_sacrifice
                        }
                    }
                }
    			trigger = {
    				has_character_flag = mostly_heavy_rain
    				any_demesne_province = {
			    		has_province_modifier = africa_heavy_rain
			    		NOT = { has_province_modifier = africa_heavy_rain_cooldown_1 }
                        any_province_holding = {
                            num_of_buildings = 1
                        }
                        any_province_holding = {
                            holder_scope = {
                                any_courtier = {
                                    count = 3
                                    ai = yes
                                }
                            }
                        }
                    }
    			}
    		}
    		10 = { # Rotting Library...
    			character_event = { id = HF.15123 }
    			modifier = {
    				factor = 1.5
    				has_character_flag = mostly_heavy_rain
					NOR = {
						has_character_flag = mostly_light_rain
						has_character_flag = mostly_drought_risk
						has_character_flag = mostly_drought	
					}
    			}
    			modifier = {
    				factor = 1.5
    				capital_scope = {
    					has_province_modifier = africa_heavy_rain
    				}
    			}
    			modifier = {
    				factor = 0.1
    				has_character_flag = had_book_event
    			}
                modifier = {
                    factor = 0.1
                    capital_scope = { has_province_modifier = good_bida_sacrifice }
                }
                modifier = {
                    factor = 2
                    capital_scope = {
                        has_province_modifier = africa_heavy_rain
                        OR = {
                            has_province_modifier = bad_bida_sacrifice
                            has_province_modifier = canceled_bida_sacrifice
                        }
                    }
                }
    			trigger = {
    				any_demesne_province = {
			    		has_province_modifier = africa_heavy_rain
			    		NOT = { has_province_modifier = africa_heavy_rain_cooldown_2 }
			    	}
			    	any_artifact = {
		    			has_artifact_flag = book
			    	}
    			}
    		}
    		10 = { # Rusting Armory...
    			character_event = { id = HF.15124 }
    			modifier = {
    				factor = 1.5
    				has_character_flag = mostly_heavy_rain
					NOR = {
						has_character_flag = mostly_light_rain
						has_character_flag = mostly_drought_risk
						has_character_flag = mostly_drought	
					}
    			}
    			modifier = {
    				factor = 1.5
    				capital_scope = {
    					has_province_modifier = africa_heavy_rain
    				}
    			}
    			modifier = {
    				factor = 1.5
    				any_artifact = {
    					count = 5
    				}
    			}
    			modifier = {
    				factor = 0.1
    				has_character_flag = had_weapon_event
    			}
                modifier = {
                    factor = 0.1
                    capital_scope = { has_province_modifier = good_bida_sacrifice }
                }
                modifier = {
                    factor = 2
                    capital_scope = {
                        has_province_modifier = africa_heavy_rain
                        OR = {
                            has_province_modifier = bad_bida_sacrifice
                            has_province_modifier = canceled_bida_sacrifice
                        }
                    }
                }
    			trigger = {
    				any_demesne_province = {
			    		has_province_modifier = africa_heavy_rain
			    		NOT = { has_province_modifier = africa_heavy_rain_cooldown_3 }
			    	}
			    	any_artifact = {
			    		OR = {
			    			has_artifact_flag = armor
			    			has_artifact_flag = combat_weapon
						}
			    	}
    			}
    		}
    		### Any drought...
			10 = {
	    		character_event = { id = HF.15103 } # Rain dances maybe?
	    		modifier = {
    				factor = 1.5
    				OR = {
						has_character_flag = mostly_drought_risk
    					has_character_flag = mostly_drought
    				}
    			}
    			trigger = {
		    		any_demesne_province = {
						has_province_modifier = africa_drought_risk
						NOT = { has_province_modifier = africa_rain_dance_1 }
						NOT = { has_province_modifier = africa_rain_dance_2 }
					}
		    	}
    		}    		
    		10 = { # The Winds over [PrimaryTitle] (Drought)
	    		character_event = { id = HF.15111 } 
	    		modifier = {
    				factor = 1.5
					NOT = { has_character_flag = mostly_drought } #Means you have more to share
    			}
    			trigger = {
    				OR = {
	    				has_character_flag = mostly_drought_risk
	    				has_character_flag = mostly_drought
    				}
    				NOR = {
	    				has_character_flag = mostly_heavy_rain
	    				has_character_flag = mostly_light_rain
    				}
	    			any_realm_province = {
			        	NOT = { has_province_modifier = local_relief_efforts_food }
			    		OR = {
			        		has_province_modifier = africa_drought_risk
			        		has_province_modifier = africa_drought
			    		}
			    	}
			    	capital_scope = {
			    		NOT = { has_province_modifier = local_relief_efforts_food }
			    		NOT = { has_province_modifier = africa_drought } # Can't be completely starving themselves
			    	}
		    	}
    		}
    		10 = { #Disease outbreak... (Requires Reaper's Due)
    			character_event = { id = HF.15122 }
    			modifier = {
    				factor = 1.5
    				has_character_flag = mostly_drought
					NOR = {
						has_character_flag = mostly_heavy_rain
						has_character_flag = mostly_light_rain
						has_character_flag = mostly_drought_risk
					}
    			}
    			modifier = {
    				factor = 0.5 # less likely if all the affected areas have taken precautions earlier...
    				NOT = {
    					any_demesne_province = {
   							has_province_modifier = africa_drought
    						NOT = { has_province_modifier = africa_surplus_grain }
    					}
    				}
    			}
    			modifier = {
    				factor = 1.5 # more likely if an area has already suffered from extra starvation...
					any_demesne_province = {
						has_province_modifier = africa_drought
						has_province_modifier = africa_drought_cooldown_2
					}
    			}
                modifier = {
                    factor = 0.1
                    any_demesne_province = { has_province_modifier = good_bida_sacrifice }
                }
                modifier = {
                    factor = 2
                    any_demesne_province = {
                        has_province_modifier = africa_drought
                        OR = {
                            has_province_modifier = bad_bida_sacrifice
                            has_province_modifier = canceled_bida_sacrifice
                        }
                    }
                }
    			trigger = {
    				has_dlc = "Reapers"
    				any_demesne_province = {
			    		has_province_modifier = africa_drought
						NOT = { disease = typhoid_fever }
						NOT = { has_province_modifier = africa_drought_cooldown_1 }
			    	}
    			}
    		}
    		10 = { #Starvation... (notification only) 
    			character_event = { id = HF.15125 }
    			modifier = {
    				factor = 2
    				has_character_flag = mostly_drought
					NOR = {
						has_character_flag = mostly_heavy_rain
						has_character_flag = mostly_light_rain
						has_character_flag = mostly_drought_risk
					}
    			}
    			modifier = {
    				factor = 0.5 # less likely if all the affected areas have taken precautions earlier...
    				NOT = {
    					any_demesne_province = {
   							has_province_modifier = africa_drought
    						NOT = { has_province_modifier = africa_surplus_grain }
    					}
    				}
    			}
    			modifier = {
    				factor = 0.5 # less likely if all the affected areas have taken precautions earlier...
    				NOT = {
    					any_demesne_province = {
   							has_province_modifier = africa_drought
    						NOT = { has_province_modifier = local_relief_efforts_food }
    					}
    				}
    			}
                modifier = {
                    factor = 0.1
                    any_demesne_province = { has_province_modifier = good_bida_sacrifice }
                }
                modifier = {
                    factor = 2
                    any_demesne_province = {
                        has_province_modifier = africa_drought
                        OR = {
                            has_province_modifier = bad_bida_sacrifice
                            has_province_modifier = canceled_bida_sacrifice
                        }
                    }
                }
    			trigger = {
    				any_demesne_province = {
			    		has_province_modifier = africa_drought
			    		NOT = { has_province_modifier = africa_drought_cooldown_2 }
			    	}
    			}
    		}
    		#10 = {
    			# Nothing happens...
    		#}
    	}
    }
}

# Positive news (Rain dances had an effect??)
character_event = {
    id = HF.15101
    title = africa_rain_positive_title
    picture = GFX_evt_west_african_ruler
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
        is_alive = yes
    }

    desc = {
        text = EVTDESC_HF_15101_A #Light rain, rain dances
        trigger = {
            event_target:rain_dance_province = {
                has_province_modifier = africa_light_rain
                has_province_modifier = africa_rain_dance_1
            }
        }
    }
    desc = {
        text = EVTDESC_HF_15101_B #Light rain, prosperity festivals
        trigger = {
            event_target:rain_dance_province = {
                has_province_modifier = africa_light_rain
                has_province_modifier = africa_rain_dance_2
            }
        }
    }
    desc = {
        text = EVTDESC_HF_15101_C #Heavy rain, rain dances
        trigger = {
            event_target:rain_dance_province = {
                has_province_modifier = africa_heavy_rain
                has_province_modifier = africa_rain_dance_1
            }
        }
    }
    desc = {
        text = EVTDESC_HF_15101_D #Heavy rain, prosperity festivals
        trigger = {
            event_target:rain_dance_province = {
                has_province_modifier = africa_heavy_rain
                has_province_modifier = africa_rain_dance_2
            }
        }
    }


    immediate = {
		#If things are looking up and you had rain dances...!
		random_demesne_province = {
			limit = {
				OR = {
    				has_province_modifier = africa_light_rain
    				has_province_modifier = africa_heavy_rain
				}
				OR = {
					has_province_modifier = africa_rain_dance_1
					has_province_modifier = africa_rain_dance_2   				
				}
			}
			save_event_target_as = rain_dance_province
		}
    }

    option = { # Our rituals have clearly had an effect!
        name = EVTOPTA_HF_15101
        piety = 25
    }

    option = { # This is all me
        name = EVTOPTB_HF_15101
        prestige = 50
    }
    after = {
    	any_demesne_province = {
    		show_scope_change = no
    		limit = {
    			OR = {
    				has_province_modifier = africa_light_rain
    				has_province_modifier = africa_heavy_rain
				}
				OR = {
					has_province_modifier = africa_rain_dance_1
					has_province_modifier = africa_rain_dance_2
				}
    		}
    		hidden_effect = {
	    		remove_province_modifier = africa_rain_dance_1
				remove_province_modifier = africa_rain_dance_2
    		}
    		add_province_modifier = {
				name = africa_rain_dance_successful
				duration = 3650 #10 years
			}
    	}
    }
}

# Positive news (Surprise, things are great - keep it going?)
character_event = {
    id = HF.15102
    title = africa_rain_positive_title
    desc = EVTDESC_HF_15102
    picture = GFX_evt_west_african_ruler
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	is_alive = yes
    }

    immediate = {
		random_demesne_province = {
			limit = {
   				has_province_modifier = africa_light_rain
				NOT = { has_province_modifier = africa_rain_dance_1 }
				NOT = { has_province_modifier = africa_rain_dance_2 }
			}
			save_event_target_as = rainy_province
		}
    }

    option = { # Hold a festival to make sure it keeps coming!
        name = EVTOPTA_HF_15102

        if = {
            limit = {
                is_tribal = yes
            }
    	    scaled_wealth = {
    		    value = -0.5
    		    min = -10
    		    max = -50
    		}
        }
        else = {
            scaled_wealth = {
                value = -1
                min = -15
                max = -550
            }
        }

        piety = 5

        event_target:rainy_province = {
        	show_scope_change = no
    		add_province_modifier = {
				name = africa_rain_dance_2 # Keep it coming-dance
				duration = 3650 #10 years
			}
        }
    }

    option = { # This is good news
        name = EVTOPTB_HF_15102
        #custom_tooltip = { text = EVTOPTB_HF_15102_TT }
    }
}

# Negative news (Attempt a rain dance?)
character_event = {
    id = HF.15103
    title = africa_rain_negative_title
    picture = GFX_evt_desert
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    
    trigger = {
    	is_alive = yes
    }

    desc = {
        text = EVTDESC_HF_15103_A #Risk of drought
        trigger = {
            event_target:drought_province = {
                has_province_modifier = africa_drought_risk
            }
        }
    }
    desc = {
        text = EVTDESC_HF_15103_B #Actual drought
        trigger = {
            event_target:drought_province = {
                has_province_modifier = africa_drought
            }
        }
    }

    immediate = {
		random_demesne_province = {
			limit = {
				OR = {
					has_province_modifier = africa_drought_risk
					has_province_modifier = africa_drought
				}
				NOT = { has_province_modifier = africa_rain_dance_1 }
				NOT = { has_province_modifier = africa_rain_dance_2 }
			}
			save_event_target_as = drought_province
		}
    }

    option = { # Perhaps a rain dance?
        name = EVTOPTA_HF_15103
        if = {
            limit = {
                is_tribal = yes
            }
            scaled_wealth = {
                value = -0.1
                min = -5
                max = -15
            }
            prestige = -25
        }
        else = {
            scaled_wealth = {
                value = -1
                min = -15
                max = -550
            }
        }

        event_target:drought_province = {
        	show_scope_change = no
    		add_province_modifier = {
				name = africa_rain_dance_1 # Praying for water
				duration = -1
			}
        }
    }
    option = { # Do nothing
        name = EVTOPTB_HF_15103
    }
}

# Rains: "The Winds Over <Realm>" (Choose to prepare for the future somehow)
character_event = {
    id = HF.15110
    title = africa_rain_status_title
    desc = EVTDESC_HF_15110
    picture = GFX_evt_market_hf
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    portrait = event_target:my_steward
    
    trigger = {
    	is_alive = yes
    	capital_scope = {
    		NOR = {
    			has_province_modifier = africa_drought_risk
    			has_province_modifier = africa_drought
    		}
    	}
    }

    immediate = {
    	if = {
    		limit = {
    			job_treasurer = {
    				always = yes
    			}
    		}
    		job_treasurer = { save_event_target_as = my_steward } # For loc...
    	}
    }

    option = { # [ALWAYS VISIBLE] Make sure traders are well-stocked
        name = EVTOPTA_HF_15110
        
        if = {
            limit = {
                is_tribal = yes
            }
            scaled_wealth = {
                value = -0.2
                min = -10
                max = -25
            }
            prestige = -50
        }
        else = {
            scaled_wealth = {
                value = -1.5
                min = -20
                max = -700
            }
        }


		capital_scope = {
        	show_scope_change = no
    		add_province_modifier = {
				name = focused_traders
				duration = 1460 # 4 years
			}
        }

        if = {
        	limit = { trait = greedy }
        	remove_trait = greedy
        }
    }
    option = { # [LIGHT RAIN ONLY] Let's look into our irrigation 
        name = EVTOPTB_HF_15110_light_rain
		
        if = {
            limit = {
                is_tribal = yes
            }
            if = { # Pay some Prestige instead, based around how many of these modifiers you're getting...
                limit = {
                    any_demesne_province = {
                        count = 10
                        NOT = { has_province_modifier = improved_irrigation }
                    }
                }
                prestige = -150
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 8
                        NOT = { has_province_modifier = improved_irrigation }
                    }
                }
                prestige = -120
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 6
                        NOT = { has_province_modifier = improved_irrigation }
                    }
                }
                prestige = -90
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 4
                        NOT = { has_province_modifier = improved_irrigation }
                    }
                }
                prestige = -60
            }
            else = { #means you have less than 4 provinces this is happening to anyway
                prestige = -35
            }

            scaled_wealth = { #Also pay less money
                value = -0.1
                min = -5
                max = -10
            }
        }
        else = { #If you're not Tribal
            scaled_wealth = {
                value = -1
                min = -25
                max = -375
            }
        }
		any_demesne_province = {
			show_scope_change = no
			limit = {
				NOT = { has_province_modifier = improved_irrigation }
			}
			add_province_modifier = {
				name = improved_irrigation
				duration = 1820 # 5 years
			}
		}

		trigger = {
			has_character_flag = mostly_light_rain
			NOT = { has_character_flag = mostly_heavy_rain }

			any_demesne_province = {
				is_capital = no
				NOT = { has_province_modifier = improved_irrigation }
			}
		}
    }
    option = { # [HEAVY RAIN ONLY] Keep an eye on rivers & lakes
        name = EVTOPTB_1_HF_15110
        if = {
            limit = {
                is_tribal = yes
            }
            if = { # Pay some Prestige instead, based around how many of these modifiers you're getting...
                limit = {
                    any_demesne_province = {
                        count = 10
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -150
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 8
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -120
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 6
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -90
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 4
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -60
            }
            else = { #means you have less than 4 provinces this is happening to anyway
                prestige = -35
            }
        }
        else = { #If you're not Tribal
            scaled_wealth = {
                value = -1
                min = -15
                max = -350
            }
        }

		custom_tooltip = {
			text = water_watch_1_tt
			any_demesne_province = {
				show_scope_change = no
				limit = {
					has_province_modifier = africa_heavy_rain
				}
				add_province_modifier = {
					name = water_watch_1
					duration = 1820 # 5 years
				}
			}
		}

		trigger = {
			has_character_flag = mostly_heavy_rain
			NOT = { has_character_flag = mostly_light_rain }
			any_demesne_province = { #If you have lakes and stuff nearby
				OR = {
					borders_lake = yes
					borders_major_river = yes
					any_neighbor_province = { is_land = no }
				}
			}
		}
    }
    option = { # [HEAVY RAIN ONLY] Keep an eye on roads
        name = EVTOPTB_2_HF_15110
        if = {
            limit = {
                is_tribal = yes
            }
            if = { # Pay some Prestige instead, based around how many of these modifiers you're getting...
                limit = {
                    any_demesne_province = {
                        count = 10
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -150
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 8
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -120
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 6
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -90
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 4
                        has_province_modifier = africa_heavy_rain
                    }
                }
                prestige = -60
            }
            else = { #means you have less than 4 provinces this is happening to anyway
                prestige = -35
            }
        }
        else = { #If you're not Tribal
            scaled_wealth = {
                value = -1
                min = -15
                max = -350
            }
        }

		custom_tooltip = {
			text = water_watch_2_tt
			any_demesne_province = {
				show_scope_change = no
				limit = {
					has_province_modifier = africa_heavy_rain
				}
				add_province_modifier = {
					name = water_watch_2
					duration = 1820 # 5 years
				}
			}
		}
		trigger = {
			has_character_flag = mostly_heavy_rain
			NOT = { has_character_flag = mostly_light_rain }
			any_demesne_province = { #If you *don't* have lakes and stuff nearby
				NOR = {
					borders_lake = yes
					borders_major_river = yes
					any_neighbor_province = { is_land = no }
				}
			}
		}
    }
    option = { # [ALWAYS VISIBLE] We should put away grain for the future
        name = EVTOPTC_HF_15110
        if = {
            limit = {
                is_tribal = yes
            }
            if = { # Pay some Prestige instead, based around how many of these modifiers you're getting...
                limit = {
                    any_demesne_province = {
                        count = 10
                        OR = {
    						has_province_modifier = africa_heavy_rain
    						has_province_modifier = africa_light_rain
    					}
                    }
                }
                prestige = -150
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 8
                        OR = {
    						has_province_modifier = africa_heavy_rain
    						has_province_modifier = africa_light_rain
    					}
                    }
                }
                prestige = -120
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 6
                        OR = {
    						has_province_modifier = africa_heavy_rain
    						has_province_modifier = africa_light_rain
    					}
                    }
                }
                prestige = -90
            }
            else_if = {
                limit = {
                    any_demesne_province = {
                        count = 4
                        OR = {
    						has_province_modifier = africa_heavy_rain
    						has_province_modifier = africa_light_rain
    					}
                    }
                }
                prestige = -60
            }
            else = { #means you have less than 4 provinces this is happening to anyway
                prestige = -35
            }
        }
        else = { #If you're not Tribal
            scaled_wealth = {
    		    value = -1
    		    min = -10
    		    max = -350
    		}
        }

		custom_tooltip = {
			text = africa_surplus_grain_tt
			any_demesne_province = {
				show_scope_change = no
				limit = {
					OR = {
						has_province_modifier = africa_heavy_rain
						has_province_modifier = africa_light_rain
					}
				}
				add_province_modifier = {
					name = africa_surplus_grain
					duration = 3650 # 10 years
					hidden = yes
				}
			}
		}
    }
    option = { # [ALWAYS VISIBLE] Do nothing
        name = SO_IT_IS
    }
}

# Drought: "The Winds Over <Realm>" (Choose a province to feed)
character_event = {
    id = HF.15111
    title = africa_drought_status_title
    desc = EVTDESC_HF_15110
    picture = GFX_evt_market_hf
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    
    trigger = {
    	is_alive = yes
    	any_demesne_province = {
    		OR = {
        		has_province_modifier = africa_drought_risk
        		has_province_modifier = africa_drought
    		}
    		is_capital = no
    	}
    }

    immediate = {
    	hidden_effect = {
    		if = {
	    		limit = {
	    			job_treasurer = {
	    				always = yes
	    			}
	    		}
	    		job_treasurer = { save_event_target_as = my_steward } #For loc...
	    	}
    		if = {	# Select a province to randomly help out...
    			limit = {
		        	any_realm_province = {
		        		OR = {
			        		has_province_modifier = africa_drought_risk
			        		has_province_modifier = africa_drought
		        		}
		        		is_capital = no
		        	}
    			}
    			random_realm_province = {
    				limit = {
		        		OR = {
			        		has_province_modifier = africa_drought_risk
			        		has_province_modifier = africa_drought
		        		}
		        		is_capital = no
    				}
    				preferred_limit = { #prefers to select something you are yourself the liege of...
    					has_province_modifier = africa_drought
		        		holder_scope = { character = ROOT }
    				}
    				preferred_limit = { #prefers to select something you are yourself the liege of...
    					has_province_modifier = africa_drought
		        		holder_scope = { character = ROOT }
    				}
    				preferred_limit = { #prefers to select something you are yourself the liege of...
		        		holder_scope = { character = ROOT }
    				}
    				save_event_target_as = province_to_save
	        	}
    		}
	    }
    }

    option = { # Feed our capital province
        name = EVTOPTA_HF_15111
        capital_scope = {
        	show_scope_change = no
	        custom_tooltip = {
	        	text = EVTOPTA_HF_15111_TT
	        }
        }
        if = {
            limit = {
                is_tribal = yes
            }
            if = { # Pay some Prestige instead, based around how many of these modifiers you're getting...
                limit = { num_of_count_titles_in_realm = 15 }
                prestige = -150
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 12 }
                prestige = -120
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 12 }
                prestige = -120
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 9 }
                prestige = -90
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 7 }
                prestige = -70
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 5 }
                prestige = -50
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 3 }
                prestige = -30
            }
            else = { #means you have a small realm
                prestige = -15
            }
        }
        else = { #If you're not Tribal
            scaled_wealth = {
                value = -1
                min = -25
                max = -350
            }
        }

		capital_scope = {
        	show_scope_change = no
    		add_province_modifier = {
				name = local_relief_efforts_food 
				duration = 1460 # 4 years
			}
        }
        trigger = {
        	capital_scope = {
        		OR = {
	        		has_province_modifier = africa_drought_risk
	        		has_province_modifier = africa_drought
        		}
        	}
        }
    }
    option = { # Help random province
        name = EVTOPTB_HF_15111
        event_target:province_to_save = {
        	show_scope_change = no
	        custom_tooltip = {
	        	text = EVTOPTA_HF_15111_TT
	        }
        }
        if = {
            limit = {
                is_tribal = yes
            }
            if = { # Pay some Prestige instead, based around how many of these modifiers you're getting...
                limit = { num_of_count_titles_in_realm = 15 }
                prestige = -150
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 12 }
                prestige = -120
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 12 }
                prestige = -120
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 9 }
                prestige = -90
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 7 }
                prestige = -70
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 5 }
                prestige = -50
            }
            else_if = {
                limit = { num_of_count_titles_in_realm = 3 }
                prestige = -30
            }
            else = { #means you have a small realm
                prestige = -15
            }
        }
        else = { #If you're not Tribal
            scaled_wealth = {
                value = -1
                min = -25
                max = -350
            }
        }
        if = {
        	limit = { trait = greedy }
        	remove_trait = greedy
        }
		event_target:province_to_save = {
			show_scope_change = no
    		add_province_modifier = {
				name = local_relief_efforts_food 
				duration = 1460 # 4 years
			}
        }
        trigger = {
        	event_target:province_to_save = { always = yes } # Only exists if you have more than one province
        }
    }
    option = { # Character modifier (pious)
        name = EVTOPTC_HF_15111

        if = {
        	limit = { NOT = { trait = zealous } }
        	add_trait = zealous
        }
        else_if = {
        	limit = { trait = cynical }
        	remove_trait = cynical
        }
        add_character_modifier = {
        	modifier = superstitious_ruler
        	years = 5
        }
    }
    option = { # Do nothing
        name = SO_IT_IS
    }
}


# Landslide (negative heavy rain)
character_event = {
    id = HF.15121
    title = EVTTITLE_HF_15121 
    desc = EVTDESC_HF_15121
    picture = GFX_evt_dead_body_hf
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	is_alive = yes
    }

    immediate = {
    	hidden_effect = {
	    	random_demesne_province = {
	    		limit = {
	    			has_province_modifier = africa_heavy_rain
	    		}
	    		preferred_limit = {
	    			terrain = mountain
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
                preferred_limit = {
                    terrain = mountain
                }
                preferred_limit = {
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
	    		save_event_target_as = flooded_province
	    		add_province_modifier = {
	        		name = africa_heavy_rain_cooldown_1
	        		duration = 1095 # 3 years
	        		hidden = yes
	        	}
				random_province_holding = {
                    limit = { num_of_buildings = 1 }
					save_event_target_as = flooded_holding

					holder_scope = {
                        if = { # if the holder of this holding has a few courtiers around...
                            limit = {
                                any_courtier = {
                                    count = 3
                                    ai = yes
                                }
                            }
                            save_event_target_as = flooded_court_liege
                        }
                        else = { # Otherwise, find someone in the province that *does* have courtiers...
                            event_target:flooded_province = {
                                random_province_holding = {
                                    limit = {
                                        holder_scope = {
                                            any_courtier = {
                                                count = 3
                                                ai = yes
                                            }
                                        }
                                    }
                                    holder_scope = {
                                        save_event_target_as = flooded_court_liege
                                    }
                                }
                            }
                        }
                    }
                    event_target:flooded_court_liege = { # Now, use that character's court to find flood_victims...
						while = {
                            count = 5
							limit = {
								NOT = {
									any_courtier = {
										count = 3
										ai = yes
										has_character_flag = flood_victim
									}
								}
							}
							random_courtier = {
								limit = { ai = yes }
								preferred_limit = {
									prisoner = no
									is_landed = no
									is_rival = ROOT
									at_location = event_target:flooded_province
								}
								preferred_limit = {
									prisoner = no
									is_landed = no
									is_rival = ROOT
								}
								preferred_limit = {
									prisoner = no
									is_landed = no
									at_location = event_target:flooded_province
								}
								preferred_limit = {
									at_location = event_target:flooded_province
								}
								set_character_flag = flood_victim
							}
						}
					}
				}
	    	}
    	}
    }

    option = { # Save the people (destroy building)
        name = EVTOPTA_HF_15121
        scaled_wealth = {
		    value = -1
		    min = -35
		    max = -200
		}
        piety = 10

        event_target:flooded_holding = {
            show_scope_change = no
            custom_tooltip = {
                text = random_building_is_destroyed_tt
        	    destroy_random_building = THIS
            }
    	}
    }
    option = { # Save ... some people (building destroyed and rival dies)
        name = EVTOPTB_HF_15121_rival
        tooltip_info_custom = available_because_rivals_tt

        custom_tooltip = { text = EVTOPTB_HF_15121_TT }

        scaled_wealth = {
		    value = -1
		    min = -15
		    max = -250
		}

        piety = -10

        if = {
        	limit = { trait = honest }
        	remove_trait = honest
        }
        else_if = {
        	limit = {
        		NOT = { trait = deceitful }
        	}
        	add_trait = deceitful
        }

        event_target:flooded_holding = {
            show_scope_change = no
            custom_tooltip = {
                text = random_building_is_destroyed_tt
                destroy_random_building = THIS
            }
        }

        event_target:flooded_court_liege = {
        	show_scope_change = no
        	any_courtier = {
        		show_scope_change = no
        		limit = {
                    has_character_flag = flood_victim
                    is_rival = ROOT
                }
        		death = {
        			death_reason = death_accident_drowning
        			KILLER = ROOT
        		}
        	}
        }
        
        ai_chance = {
        	factor = 100
        }

        trigger = {
		    event_target:flooded_court_liege = {
		    	any_courtier = {
					has_character_flag = flood_victim
		    		is_rival = ROOT
		    	}
		    }
        }
    }
    option = { # Save the buildings (people die)
        name = EVTOPTB_HF_15121

        scaled_wealth = {
		    value = -1
		    min = -25
		    max = -200
		}
        prestige = 20

        event_target:flooded_court_liege = {
        	show_scope_change = no
        	any_courtier = {
        		show_scope_change = no
        		limit = { has_character_flag = flood_victim }
        		death = {
        			death_reason = death_accident_drowning
        			KILLER = ROOT
        		}
        	}
        }
    }
    option = {      
        name = EVTOPTC_HF_15121 #Tragic!

    	piety = -5
    	prestige = -10

        event_target:flooded_holding = {
            show_scope_change = no
            custom_tooltip = {
                text = random_building_is_destroyed_tt
                destroy_random_building = THIS
            }
        }

        event_target:flooded_court_liege = {
        	show_scope_change = no
        	any_courtier = {
        		show_scope_change = no
        		limit = { has_character_flag = flood_victim }
        		death = {
        			death_reason = death_accident_drowning
        			KILLER = ROOT
        		}
        	}
        }
        if = {
        	limit = {
        		NOT = { trait = cruel }
        	}
        	add_trait = cruel
        }
    }
}

# Drought kills people (negative drought)
character_event = {
    id = HF.15122
    title = EVTTITLE_HF_15122
    desc = EVTDESC_HF_15122
    picture = GFX_evt_desert
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	is_alive = yes
    }

    immediate = {
    	hidden_effect = {
#    		random_demesne_province = {
#	    		limit = {
#	    			has_province_modifier = africa_drought
#	    			NOT = { disease = typhoid_fever }
#	    		}
#	    		spawn_disease = typhoid_fever
#	    	}
	    	random_demesne_province = {
	    		limit = {
	    			has_province_modifier = africa_drought
	    			NOT = { disease = typhoid_fever }
	    		}
	    		preferred_limit = {
	    			terrain = desert
					has_province_modifier = africa_drought_cooldown_2
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
	    		preferred_limit = {
	    			terrain = desert
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
	    		preferred_limit = {
	    			terrain = desert
	    		}
	    		preferred_limit = {
	    			has_province_modifier = africa_drought_cooldown_2
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
                preferred_limit = {
                    has_province_modifier = africa_drought_cooldown_2
	    		}
	    		save_event_target_as = starved_province

#				random_province_holding = {
#					holder_scope = {
#						random_courtier = {
#							limit = {
#								NOT = { has_character_flag = immune_typhoid_fever }
#								ai = yes
#							}
#							set_character_flag = starvation_victim
#							add_trait = has_typhoid_fever
#
#							set_character_flag = manifest_typhoid_fever 
#							add_disease_level_effect = yes
#							scrying_omen_fulfilled_by_gaining_disease_effect = yes
#							clr_character_flag = developing_illness
#							clr_character_flag = got_typhoid_fever
#						}
#					}
#				}

				random_province_holding = {
					holder_scope = {
						save_event_target_as = starved_court_liege
						while = {
							limit = {
								NOT = {
									any_courtier = {
										count = 3
										has_character_flag = starvation_victim
									}
								}
							}
							random_courtier = {
								limit = {
									NOT = { has_character_flag = immune_typhoid_fever }
									ai = yes
								}
								set_character_flag = starvation_victim
								add_trait = has_typhoid_fever

								set_character_flag = manifest_typhoid_fever 
								add_disease_level_effect = yes
								scrying_omen_fulfilled_by_gaining_disease_effect = yes
								clr_character_flag = developing_illness
								clr_character_flag = got_typhoid_fever
							}
						}
					}
				}
	    	}
    	}
    }

    option = { # Kill whoever is currently sick...
        name = EVTOPTB_HF_15122
        custom_tooltip = { text = EVTOPTB_HF_15122_TT }

        tooltip_info = intrigue

        scaled_wealth = {
		    value = -1
		    min = -15
		    max = -250
		}

        piety = -10

        if = {
        	limit = { NOT = { trait = paranoid } }
        	add_trait = paranoid
        }
        else_if = {
        	limit = { trait = honest }
        	remove_trait = honest
        }
        else_if = {
        	limit = {
        		NOT = { trait = deceitful }
        	}
        	add_trait = deceitful
        }
        else_if = {
        	limit = { trait = kind }
        	remove_trait = kind
        }
        else_if = {
        	limit = { NOT = { trait = cruel } }
        	add_trait = cruel
        }
    	any_realm_character = {
    		show_scope_change = no
    		limit = { has_character_flag = starvation_victim }
    		random_accident_death_effect = yes
    	}
        ai_chance = {
        	factor = 100
        }
        trigger = {
        	intrigue = 10
        }
    }
    option = { # Spend money to recruit builders...
        name = EVTOPTC_HF_15122

        prestige = 15

        scaled_wealth = {
		    value = -3
		    min = -65
		    max = -350
		}

        add_character_modifier = {
        	modifier = relief_efforts_builders
        	years = 5
        }

        custom_tooltip = {
        	text = spawn_slow_fever_tt
	        event_target:starved_province = {
	        	spawn_disease = typhoid_fever
	        	add_province_modifier = {
	        		name = africa_drought_cooldown_1
	        		duration = 1095 # 3 years
	        		hidden = yes
	        	}
	        }
        }
        trigger = {
        	NOT = { has_character_modifier = relief_efforts_builders }
        }
    }
    option = { # Start disease...
        name = EVTOPTA_HF_15122

        custom_tooltip = {
        	text = spawn_slow_fever_tt
	        event_target:starved_province = {
	        	spawn_disease = typhoid_fever
	        	add_province_modifier = {
	        		name = africa_drought_cooldown_1
	        		duration = 1095 # 3 years
	        		hidden = yes
	        	}
	        }
        }
    }
}

# Rotting Library (negative heavy rain)
character_event = {
    id = HF.15123
    title = EVTTITLE_HF_15123
    desc = EVTDESC_HF_15123
    picture = GFX_evt_monk
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    portrait = event_target:my_spiritual

    trigger = {
    	is_alive = yes
    	any_artifact = {
    		has_artifact_flag = book
    	}
    }

    immediate = {
    	hidden_effect = {
	    	random_demesne_province = {
	    		limit = {
	    			has_province_modifier = africa_heavy_rain
	    			NOT = { has_province_modifier = africa_heavy_rain_cooldown_2 }
	    		}
                preferred_limit = {
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
                }
	    		save_event_target_as = flooded_province
	    		add_province_modifier = {
	        		name = africa_heavy_rain_cooldown_2
	        		duration = 1095 # 3 years
	        		hidden = yes
	        	}
	    	}
    	}
    	random_artifact = {
    		limit = {
    			has_artifact_flag = book
    		}
    		preferred_limit = {
				is_artifact_equipped = yes #Means it reads as in your "Library" in the Treasury UI
			}
    		save_event_target_as = target_artifact
    	}
    	if = {
    		limit = {
    			job_spiritual = {
    				always = yes
    			}
    		}
    		job_spiritual = { save_event_target_as = my_spiritual } # For loc...
    	}
    }
    
    option = { # Spend money to save the book...
        name = EVTOPTA_HF_15123

        scaled_wealth = {
		    value = -1
		    min = -55
		    max = -350
		}
		reverse_opinion = {
			modifier = opinion_agreed_with_opinion
			who = event_target:my_spiritual
			years = 5
		}
		set_character_flag = had_book_event
    }
    option = { # Let the book be destroyed
        name = EVTOPTB_HF_15123

        event_target:target_artifact = {
        	show_scope_change = no
        	destroy_artifact = yes
        }
    }
}

# Flooded Armory (negative heavy rain)
character_event = {
    id = HF.15124
    title = EVTTITLE_HF_15124
    desc = EVTDESC_HF_15124
    picture = GFX_evt_armory
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    portrait = event_target:my_marshal

    trigger = {
    	is_alive = yes
    	any_artifact = {
    		OR = {
    			has_artifact_flag = armor
    			has_artifact_flag = combat_weapon
			}
    	}
    }

    immediate = {
    	hidden_effect = {
	    	random_demesne_province = {
	    		limit = {
	    			has_province_modifier = africa_heavy_rain
	    			NOT = { has_province_modifier = africa_heavy_rain_cooldown_3 }
	    		}
                preferred_limit = {
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
                }
	    		save_event_target_as = flooded_province
	    		add_province_modifier = {
	        		name = africa_heavy_rain_cooldown_3
	        		duration = 1095 # 3 years
	        		hidden = yes
	        	}
	    	}
    	}
    	random_artifact = {
    		limit = {
    			OR = {
	    			has_artifact_flag = armor
	    			has_artifact_flag = combat_weapon
    			}
    		}
			preferred_limit = {
				is_artifact_equipped = no # In case you are out and about
			}
    		save_event_target_as = target_artifact
    	}
    	if = {
    		limit = {
    			job_marshal = {
    				always = yes
    			}
    		}
    		job_marshal = { save_event_target_as = my_marshal } # For loc...
    	}
    }
    
    option = { # Spend money to save the weapon/armor...
        name = EVTOPTA_HF_15124

        scaled_wealth = {
		    value = -1
		    min = -55
		    max = -350
		}
		reverse_opinion = {
			modifier = opinion_was_praised
			who = event_target:my_marshal
			years = 5
		}
		set_character_flag = had_weapon_event
    }
    option = { # Let the book be destroyed
        name = EVTOPTB_HF_15124

        event_target:target_artifact = {
        	show_scope_change = no
        	destroy_artifact = yes
        }
    }
}


# People are suffering from the drought. (negative drought)
character_event = {
    id = HF.15125
    is_triggered_only = yes
    picture = GFX_evt_desert
    notification = yes

    desc = {
    	text = EVTDESC_HF_15125_A #People are starving...
    	trigger = {
    		NOT = { event_target:starving_province = { has_province_modifier = local_relief_efforts_food } }
    	}
    }
    desc = {
    	text = EVTDESC_HF_15125_B #In spite of our efforts, people are starving..
    	trigger = {
    		event_target:starving_province = { has_province_modifier = local_relief_efforts_food }
    	}
    }
    desc = {
    	text = EVTDESC_HF_15125_C #In spite of storages, people are starving..
    	trigger = {
    		event_target:starving_province = { has_province_modifier = africa_surplus_grain }
    	}
    }

    trigger = {
    	is_alive = yes
    	any_demesne_province = {
    		has_province_modifier = africa_drought
    		NOT = { has_province_modifier = africa_drought_cooldown_2 }
    	}
    }

    immediate = {
    	hidden_effect = {
	    	random_demesne_province = {
	    		limit = {
	    			has_province_modifier = africa_drought
	    			NOT = { has_province_modifier = africa_drought_cooldown_2 }
	    		}
	    		preferred_limit = {
	    			NOT = { has_province_modifier = africa_surplus_grain }
	    			NOT = { has_province_modifier = local_relief_efforts_food }
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
                preferred_limit = {
                    NOT = { has_province_modifier = africa_surplus_grain }
                    NOT = { has_province_modifier = local_relief_efforts_food }
                }
	    		preferred_limit = {
	    			NOT = { has_province_modifier = local_relief_efforts_food }
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
                preferred_limit = {
                    NOT = { has_province_modifier = local_relief_efforts_food }
                }
	    		preferred_limit = {
	    			NOT = { has_province_modifier = africa_surplus_grain }
                    OR = {
                        has_province_modifier = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}
                preferred_limit = {
                    NOT = { has_province_modifier = africa_surplus_grain }
                }
                preferred_limit = {
                    OR = {
                        has_province_modifer = bad_bida_sacrifice
                        has_province_modifier = canceled_bida_sacrifice
                    }
	    		}	    		
	    		save_event_target_as = starving_province
	    		
	    		add_province_modifier = {
	    			name = africa_drought_cooldown_2
	    			duration = 365 #a year
	    			hidden = yes
	    		}

	    		holder_scope = {
	    			any_courtier = {
	    				lose_weight_medium_effect = yes
	    				weight_trait_check_effect = yes
	    			}
	    		}
	    	}
    	}
    }
    option = {
    	name = OK
    }
}


