﻿
RICE_setup_magadha_flavor_pack_effect = {


	############################################################
	#
	# CULTURE CHANGES
	#
	############################################################


    if = {
        limit = {
			NOT = { exists = culture:soissons }
		}

        # Bengali/Gaudi, Oriya, and Kamarupi changes are based on suggestions/research by Soraya

        # Gaudi/Bengali culture
        culture:bengali = {

            set_culture_pillar = ethos_courtly

            if = {
                limit = { has_cultural_tradition = tradition_agrarian }
                remove_culture_tradition = tradition_agrarian
            }

            # Soraya says Philosopher Culture and Religious Patronage can be kept, but here are Soraya's notes anyways:
            # Philosopher Culture: Early Medieval Bengal produced many great Buddhist theologians like Atisha, and also many Hindu ones like Chaitanya particularly in later periods
            # Religious Patronage: Palas and Chandras be funding a lot of Viharas

            # Soraya: Bengal be trading with SEA, and rivers were used in trade through which this tradition allows sailing
            add_culture_tradition = tradition_seafaring
            # Soraya: Bengal be full of rainforests yo, it should have more in-game but what can you do
            add_culture_tradition = tradition_jungle_dwellers
            # Soraya: Kulinism began in this period, and thus Brahmins and Kayasthas began a process of creating excessively prestigious North Indian ancestries for themselves and a strict code of exogamy, the "Kulin Pratha" should really have its own system in a potential Bengal flavor pack
            add_culture_tradition = tradition_hereditary_hierarchy
            remove_variable = tradition_cooldown
        }

        # Oriya
        culture:oriya = {

            set_culture_pillar = ethos_egalitarian

            add_culture_tradition = tradition_fervent_temple_builders
            add_culture_tradition = tradition_festivities
            remove_variable = tradition_cooldown

        }

        # Kamrupi/Assamese
        culture:assamese = {

            add_culture_tradition = tradition_lords_of_the_elephant
            remove_variable = tradition_cooldown

        }

        title:c_magadha = {
            set_county_culture = culture:magadhi
        }

        title:c_mudgagiri = {
            set_county_culture = culture:magadhi
        }

        title:c_gaya = {
            set_county_culture = culture:magadhi
        }

        # Soraya says no
        title:c_sasaram = {
            set_county_culture = culture:hindustani
        }

        title:c_mithila = {
            set_county_culture = culture:magadhi
        }

        title:c_simaramapura = {
            set_county_culture = culture:magadhi
        }

        # Soraya says no
        title:c_kusinagara = {
            set_county_culture = culture:hindustani
        }

        title:c_bangaon = {
            set_county_culture = culture:magadhi
        }

        # Soraya says no
        title:c_jharkand = {
            set_county_culture = culture:hindustani
        }

        # Soraya says no
        title:c_rothas = {
            set_county_culture = culture:hindustani
        }

        title:c_rajrappa = {
            set_county_culture = culture:magadhi
        }

        title:c_damin_i_koh = {
            set_county_culture = culture:magadhi
        }

        title:c_janakpur = {
            set_county_culture = culture:magadhi
        }

		every_ruler = {
			limit = {
				culture = { has_cultural_pillar = heritage_indo_aryan }
				capital_county = {
					culture = culture:magadhi
				}
			}
			make_magadhi_culture_effect = yes
		}

		every_ruler = {
			limit = {
				culture = { has_cultural_pillar = heritage_indo_aryan }
                OR = {
                    capital_county = { this = title:c_sasaram }
                    capital_county = { this = title:c_kusinagara }
                    capital_county = { this = title:c_jharkand }
                    capital_county = { this = title:c_rothas }		
                }
			}
			make_hindustani_culture_effect = yes
		}

		every_ruler = {
			limit = {
				culture = { has_cultural_pillar = heritage_indo_aryan }
                any_held_county = {
                    culture = culture:magadhi
                }
				NOT = {
                    capital_county = {
                        culture = culture:magadhi
                    }
                }
			}
            every_courtier_or_guest = {
                limit = {
                    culture = { has_cultural_pillar = heritage_indo_aryan }
                    is_lowborn = yes
                }
                random = {
                    chance = 33
                    set_culture = culture:magadhi
                }
            }
		}

    }

    



	############################################################
	#
	# MISCELLANEOUS
	#
	############################################################

    title:c_magadha = {
        add_county_modifier = {
            modifier = RICE_magadha_rajgir_hot_springs_buddhist
        }
    }

	if = {
		limit = {
			game_start_date = 1066.9.15
		}	
        title:c_magadha.holder = {
            get_title = title:c_gaya
        }
	}

    faith:mahayana = {
        add_doctrine = rice_mahayana_canon_doctrine
    }
    faith:theravada = {
        add_doctrine = rice_theravada_canon_doctrine
    }
    faith:vajrayana = {
        add_doctrine = rice_vajrayana_canon_doctrine
    }
    faith:lamaism = {
        add_doctrine = rice_vajrayana_canon_doctrine
    }
    faith:ari = {
        add_doctrine = rice_vajrayana_canon_doctrine # rice_theravada_canon_doctrine
    }
    faith:zenzong = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:vijna = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:maitreya = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:tiantai = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:jingtu = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:kegon = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:shin = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:phat_giao = {
        add_doctrine = rice_mahayana_canon_doctrine 
    }
    faith:azhaliism = {
        add_doctrine = rice_vajrayana_canon_doctrine 
    }
    if = {
        limit = {
            # OR = {
            #     is_dharmachakra_loaded = yes
            #     is_tip_trigger = yes
            # }
            exists = faith:pudgalavada
        }
        faith:pudgalavada = {
            add_doctrine = rice_pudgalavada_canon_doctrine
        }
    }
    if = {
        limit = {
            #is_tip_trigger = yes
            exists = faith:vibhajyavada
        }
        faith:vibhajyavada = {
            add_doctrine = rice_theravada_canon_doctrine
        }
    }
    if = {
        limit = {
            #is_tip_trigger = yes
            exists = faith:sarvastivada
        }
        faith:sarvastivada = {
            add_doctrine = rice_mahayana_canon_doctrine
        }
    }
    if = {
        limit = {
            #is_tip_trigger = yes
            exists = faith:chan
        }
        faith:chan = {
            add_doctrine = rice_mahayana_canon_doctrine
        }
    }
    # Other ROA faiths
    if = {
        limit = {
            roa_is_active = yes
        }
        faith:phat_giao = {
            add_doctrine = rice_mahayana_canon_doctrine
        }
        faith:zenzong = {
            add_doctrine = rice_mahayana_canon_doctrine
        }
        faith:azhaliism = {
            add_doctrine = rice_vajrayana_canon_doctrine
        }
    }
    # Failsafe in case other mods add in other variations of Buddhism
    religion:buddhism_religion = {
        every_faith = {
            limit = {
                NOR = {
                    has_doctrine = rice_mahayana_canon_doctrine
                    has_doctrine = rice_theravada_canon_doctrine
                    has_doctrine = rice_vajrayana_canon_doctrine
                    has_doctrine = rice_pudgalavada_canon_doctrine
                }
            }
            add_doctrine = rice_theravada_canon_doctrine
        }
    }	


}

RICE_give_mahabodhi_modifiers = {
    add_character_modifier = {
        modifier = RICE_magadha_great_royal_donation_mahabodhi_character
    }
    title:c_gaya = {
        add_county_modifier = {
            modifier = RICE_magadha_great_royal_donation_mahabodhi
            years = 25
        }
    }
}

RICE_magadha_build_holy_site_small = {
    if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_temple
        }
        add_piety = 50
        add_prestige = 100
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_temple_small
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_temple_small
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_monastery
        }
        add_piety = 100
        add_prestige = 50
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_monastery_small
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_monastery_small
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_stupa
        }
        add_piety = 75
        add_prestige = 75
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_stupa_small
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_stupa_small
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_pagoda
        }
        add_piety = 100
        add_prestige = 100
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_pagoda_small
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_pagoda_small
                years = 10
            }			
        }      
    }
}

RICE_magadha_build_holy_site_medium = {
    if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_temple
        }
        add_piety = 100
        add_prestige = 200
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_temple_medium
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_temple_medium
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_monastery
        }
        add_piety = 200
        add_prestige = 100
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_monastery_medium
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_monastery_medium
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_stupa
        }
        add_piety = 150
        add_prestige = 150
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_stupa_medium
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_stupa_medium
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_pagoda
        }
        add_piety = 200
        add_prestige = 200
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_pagoda_medium
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_pagoda_medium
                years = 10
            }			
        }      
    }
}

RICE_magadha_build_holy_site_large = {
    if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_temple
        }
        add_piety = 150
        add_prestige = 300
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_temple_large
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_temple_large
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_monastery
        }
        add_piety = 300
        add_prestige = 150
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_monastery_large
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_monastery_large
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_stupa
        }
        add_piety = 225
        add_prestige = 225
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_stupa_large
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_stupa_large
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_pagoda
        }
        add_piety = 300
        add_prestige = 300
        add_character_modifier = {
            modifier = RICE_magadha_recently_built_pagoda_large
            years = 10
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_pagoda_large
                years = 10
            }			
        }      
    }
}

RICE_magadha_build_holy_site_small_converted = {
    if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_temple
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_temple_small
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_monastery
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_monastery_small
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_stupa
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_stupa_small
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_pagoda
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_pagoda_small
                years = 10
            }			
        }      
    }
}

RICE_magadha_build_holy_site_medium_converted = {
    if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_temple
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_temple_medium
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_monastery
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_monastery_medium
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_stupa
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_stupa_medium
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_pagoda
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_pagoda_medium
                years = 10
            }			
        }      
    }
}

RICE_magadha_build_holy_site_large_converted = {
    if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_temple
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_temple_large
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_monastery
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_monastery_large
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_stupa
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_stupa_large
                years = 10
            }			
        }      
    }
    else_if = {
        limit = {
            has_character_flag = RICE_magadha_building_buddhist_pagoda
        }
        capital_county = {
            add_county_modifier = {
                modifier = RICE_magadha_new_pagoda_large
                years = 10
            }			
        }      
    }
}


RICE_magadha_build_holy_site_clear_flags = {
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_temple }
        remove_character_flag = RICE_magadha_building_buddhist_temple
    }
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_monastery }
        remove_character_flag = RICE_magadha_building_buddhist_monastery
    }
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_stupa }
        remove_character_flag = RICE_magadha_building_buddhist_stupa
    }
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_pagoda }
        remove_character_flag = RICE_magadha_building_buddhist_pagoda
    }
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_site_small }
        remove_character_flag = RICE_magadha_building_buddhist_site_small
    }
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_site_medium }
        remove_character_flag = RICE_magadha_building_buddhist_site_medium
    }
    if = {
        limit = { has_character_flag = RICE_magadha_building_buddhist_site_large }
        remove_character_flag = RICE_magadha_building_buddhist_site_large
    }
    if = {
        limit = { has_character_flag = RICE_magadha_currently_building_buddhist_site }
        remove_character_flag = RICE_magadha_currently_building_buddhist_site
    }
}


RICE_magadha_life_release_finished = {
    stress_impact = {
        compassionate = minor_stress_impact_loss
        sadistic = minor_stress_impact_gain
    }
    if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = special_type
                    option = RICE_magadha_life_liberation_court
                }
            }
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_merit_intent
            }
            add_piety = 75
        }
        else = {
            add_piety = 50
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_spectacle_intent
            }
            add_prestige = 75
        }
        else = {
            add_prestige = 50
        }
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = special_type
                    option = RICE_magadha_life_liberation_temple
                }
            }
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_merit_intent
            }
            add_piety = 225
        }
        else = {
            add_piety = 150
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_spectacle_intent
            }
            add_prestige = 75
        }
        else = {
            add_prestige = 50
        }
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = special_type
                    option = RICE_magadha_life_liberation_wilderness
                }
            }
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_merit_intent
            }
            add_piety = 150
        }
        else = {
            add_piety = 100
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_spectacle_intent
            }
            add_prestige = 150
        }
        else = {
            add_prestige = 100
        }
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = special_type
                    option = RICE_magadha_life_liberation_public
                }
            }
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_merit_intent
            }
            add_piety = 75
        }
        else = {
            add_piety = 50
        }
        if = {
            limit = {                
                has_activity_intent = RICE_life_liberation_spectacle_intent
            }
            add_prestige = 225
        }
        else = {
            add_prestige = 150
        }
    }

    if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = RICE_magadha_life_liberation_animal_type
                    option = RICE_magadha_life_liberation_animal_type_birds
                }
            }
        }
        if = {
            limit = {
                has_activity_intent = RICE_life_liberation_compassion_intent
            }
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_birds
                years = 10
            }
        }
        else = {
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_birds
                years = 5
            }
        }
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = RICE_magadha_life_liberation_animal_type
                    option = RICE_magadha_life_liberation_animal_type_turtles
                }
            }
        }
        if = {
            limit = {
                has_activity_intent = RICE_life_liberation_compassion_intent
            }
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_turtles
                years = 10
            }
        }
        else = {
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_turtles
                years = 5
            }
        }
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = RICE_magadha_life_liberation_animal_type
                    option = RICE_magadha_life_liberation_animal_type_fish
                }
            }
        }
        if = {
            limit = {
                has_activity_intent = RICE_life_liberation_compassion_intent
            }
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_fish
                years = 10
            }
        }
        else = {
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_fish
                years = 5
            }
        }
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = RICE_magadha_life_liberation_animal_type
                    option = RICE_magadha_life_liberation_animal_type_insects
                }
            }
        }
        if = {
            limit = {
                has_activity_intent = RICE_life_liberation_compassion_intent
            }
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_insects
                years = 10
            }
        }
        else = {
            add_character_modifier = {
                modifier = RICE_magadha_performed_life_release_insects
                years = 5
            }
        }
    }
}


# RICE_magadha_life_release_cleanup = {
#     if = {
#         limit = { has_character_flag = RICE_magadha_liberating_birds }
#         remove_character_flag = RICE_magadha_liberating_birds
#     }
#     if = {
#         limit = { has_character_flag = RICE_magadha_liberating_turtles }
#         remove_character_flag = RICE_magadha_liberating_turtles
#     }
#     if = {
#         limit = { has_character_flag = RICE_magadha_liberating_fish }
#         remove_character_flag = RICE_magadha_liberating_fish
#     }
#     if = {
#         limit = { has_character_flag = RICE_magadha_liberating_insects }
#         remove_character_flag = RICE_magadha_liberating_insects
#     }
# }



RICE_magadha_convert_rajgir_hot_springs_effect = {
    add_piety = 150
    add_character_modifier = {
        modifier = RICE_magadha_transformed_rajgir
        years = 10
    }
    if = {
        limit = { religion = religion:buddhism_religion }
        custom_tooltip = RICE_magadha_convert_rajgir_hot_springs_effect_tooltip_1.buddhist
        title:c_magadha = {
            add_county_modifier = {
                modifier = RICE_magadha_rajgir_hot_springs_buddhist
            }			
        }
    }
    if = {
        limit = { religion = religion:hinduism_religion }
        custom_tooltip = RICE_magadha_convert_rajgir_hot_springs_effect_tooltip_1.hindu
        title:c_magadha = {
            add_county_modifier = {
                modifier = RICE_magadha_rajgir_hot_springs_hindu
            }			
        }
    }
    if = {
        limit = { religion = religion:jainism_religion }
        custom_tooltip = RICE_magadha_convert_rajgir_hot_springs_effect_tooltip_1.jain
        title:c_magadha = {
            add_county_modifier = {
                modifier = RICE_magadha_rajgir_hot_springs_jain
            }			
        }
    }
    if = {
        limit = {
            NOT = { religion = religion:buddhism_religion }
            title:c_magadha = {
				has_county_modifier = RICE_magadha_rajgir_hot_springs_buddhist
			}
        }
        custom_tooltip = RICE_magadha_convert_rajgir_hot_springs_effect_tooltip_2.buddhist
        title:c_magadha = {
            remove_county_modifier = RICE_magadha_rajgir_hot_springs_buddhist
        }
    }
    if = {
        limit = {
            NOT = { religion = religion:hinduism_religion }
            title:c_magadha = {
				has_county_modifier = RICE_magadha_rajgir_hot_springs_hindu
			}
        }
        custom_tooltip = RICE_magadha_convert_rajgir_hot_springs_effect_tooltip_2.hindu
        title:c_magadha = {
            remove_county_modifier = RICE_magadha_rajgir_hot_springs_hindu
        }
    }
    if = {
        limit = {
            NOT = { religion = religion:jainism_religion }
            title:c_magadha = {
				has_county_modifier = RICE_magadha_rajgir_hot_springs_jain
			}
        }
        custom_tooltip = RICE_magadha_convert_rajgir_hot_springs_effect_tooltip_2.jain
        title:c_magadha = {
            remove_county_modifier = RICE_magadha_rajgir_hot_springs_jain
        }
    }
}


RICE_magadha_visit_rajgir_effect = {
    add_piety = 50
    if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = special_type
                    option = RICE_hot_springs_visit_type_private
                }
            }
        }
        stress_impact = {
            base = medium_stress_impact_loss
            lazy = miniscule_stress_impact_loss
            calm = miniscule_stress_impact_loss
            zealous = miniscule_stress_impact_loss
        }	
    }
    else_if = {
        limit = {
            scope:activity = {
                has_activity_option = {
                    category = special_type
                    option = RICE_hot_springs_visit_type_public
                }
            }
        }
        add_prestige = 50
        stress_impact = {
            base = minor_stress_impact_loss
            lazy = miniscule_stress_impact_loss
            calm = miniscule_stress_impact_loss
            zealous = miniscule_stress_impact_loss
        }
    }
    if = {
        limit = {
            religion = religion:buddhism_religion
            title:c_magadha = {
				has_county_modifier = RICE_magadha_rajgir_hot_springs_buddhist
			}
        }
        add_character_modifier = {
            modifier = RICE_magadha_rajgir_bonus_buddhist
            years = 6
        }
    }
    if = {
        limit = {
            religion = religion:hinduism_religion
            title:c_magadha = {
				has_county_modifier = RICE_magadha_rajgir_hot_springs_hindu
			}
        }
        add_character_modifier = {
            modifier = RICE_magadha_rajgir_bonus_hindu
            years = 6
        }
    }
    if = {
        limit = {
            religion = religion:jainism_religion
            title:c_magadha = {
				has_county_modifier = RICE_magadha_rajgir_hot_springs_jain
			}
        }
        add_character_modifier = {
            modifier = RICE_magadha_rajgir_bonus_jain
            years = 6
        }
    }
}


RICE_magadha_claim_pithipati_effect = {
    add_piety = 100
    add_character_modifier = {
        modifier = RICE_magadha_pithipati_of_bodh_gaya  
    }
    if = {
        limit = { has_dlc_feature = legends }
        create_legend_seed = {
            type = holy
            quality = famed
            chronicle = RICE_magadha_pithipati_legend
            properties = {
                guardian = root
                religion = root.religion
                title = title:c_gaya
            }
        }
    }
}


RICE_magadha_display_potential_vassa_trait_reform = {
    if = {
        limit = {
            has_trait = lustful
            faith = { NOT = { trait_is_virtue = lustful } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.lustful
    }
    if = {
        limit = {
            has_trait = greedy
            faith = { NOT = { trait_is_virtue = greedy } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.greedy
    }
    if = {
        limit = {
            has_trait = sadistic
            faith = { NOT = { trait_is_virtue = sadistic } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.sadistic
    }
    if = {
        limit = {
            has_trait = callous
            faith = { NOT = { trait_is_virtue = callous } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.callous
    }
    if = {
        limit = {
            has_trait = wrathful
            faith = { NOT = { trait_is_virtue = wrathful } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.wrathful
    }
    if = {
        limit = {
            has_trait = vengeful
            faith = { NOT = { trait_is_virtue = vengeful } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.vengeful
    }
    if = {
        limit = {
            has_trait = gluttonous
            faith = { NOT = { trait_is_virtue = gluttonous } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.gluttonous
    }
    if = {
        limit = {
            has_trait = arrogant
            faith = { NOT = { trait_is_virtue = arrogant } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.arrogant
    }
    if = {
        limit = {
            has_trait = impatient
            faith = { NOT = { trait_is_virtue = impatient } }
        }
        custom_tooltip = RICE_magadha_observe_vassa_effect_tooltip_trait.impatient
    }
}


RICE_magadha_life_liberation_completed_log_entry_effect = {
	scope:activity = {
		add_activity_log_entry = {
			key = RICE_magadha_life_liberation_completed_log
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = root
            root = {
                RICE_magadha_life_release_finished = yes
            }
            every_attending_character = {
                limit = { NOT = { this = root } }
                custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT
                add_opinion = {
                    target = root
                    modifier = RICE_magadha_invited_me_to_life_release
                }
                add_character_modifier = {
                    modifier = RICE_magadha_participated_in_life_release
                    years = 5
                }	
            }	
            # if = {
            #     limit = {
            #         root = scope:host
            #     }
            #     RICE_magadha_life_release_finished = yes
            #     show_as_tooltip = {
            #         scope:activity = {
            #             every_attending_character = {
            #                 limit = { NOT = { this = root } }
            #                 custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT
            #                 add_opinion = {
            #                     target = root
            #                     modifier = RICE_magadha_invited_me_to_life_release
            #                 }
            #                 add_character_modifier = {
            #                     modifier = RICE_magadha_participated_in_life_release
            #                     years = 5
            #                 }	
            #             }					
            #         }
            #     }
            # }
            # else = {
            #     add_opinion = {
            #         target = root
            #         modifier = RICE_magadha_invited_me_to_life_release
            #     }
            #     add_character_modifier = {
            #         modifier = RICE_magadha_participated_in_life_release
            #         years = 5
            #     }			
            # }
		}
	}
}

RICE_magadha_bodhi_tree_bathing_ceremony_completed_log_entry_effect = {
	scope:activity = {
		add_activity_log_entry = {
			key = RICE_magadha_bodhi_tree_bathing_ceremony_completed_log
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = root
            show_as_tooltip = {
                scope:host = {
                    custom_tooltip = RICE_activity_result_gained_piety
                    if = {
                        limit = {
                            has_activity_intent = RICE_magadha_bodhi_tree_bathing_ceremony_devotion_intent
                        }
                        stress_impact = {
                            zealous = miniscule_stress_impact_loss
                        }
                    }
                    else_if = {
                        limit = {
                            has_activity_intent = RICE_magadha_bodhi_tree_bathing_ceremony_contemplation_intent
                        }
                        stress_impact = {
                            humble = miniscule_stress_impact_loss
                            patient = miniscule_stress_impact_loss
                        }
                    }
                    else_if = {
                        limit = {
                            has_activity_intent = RICE_magadha_bodhi_tree_bathing_ceremony_serenity_intent
                        }
                        stress_impact = {
                            base = minor_stress_impact_loss
                            calm = minor_stress_impact_loss
                            content = minor_stress_impact_loss
                        }
                    }
                    if = {
                        limit = {
                            has_character_modifier = RICE_magadha_inspired_bodhi_tree_ashoka
                        }
                        add_character_modifier = {
                            modifier = RICE_magadha_inspired_bodhi_tree_ashoka
                            years = 5
                        }
                    }
                    else_if = {
                        limit = {
                            has_character_modifier = RICE_magadha_inspired_bodhi_tree_mara
                        }
                        add_character_modifier = {
                            modifier = RICE_magadha_inspired_bodhi_tree_mara
                            years = 5
                        }
                    }
                    else_if = {
                        limit = {
                            has_character_modifier = RICE_magadha_inspired_bodhi_tree_sujata
                        }
                        add_character_modifier = {
                            modifier = RICE_magadha_inspired_bodhi_tree_sujata
                            years = 5
                        }
                    }
                    else_if = {
                        limit = {
                            has_character_modifier = RICE_magadha_inspired_bodhi_tree_pushyamitra
                        }
                        add_character_modifier = {
                            modifier = RICE_magadha_inspired_bodhi_tree_pushyamitra
                            years = 5
                        }
                    }
                    else_if = {
                        limit = {
                            has_character_modifier = RICE_magadha_inspired_bodhi_tree_jaya_sri_maha_bodhi
                        }
                        add_character_modifier = {
                            modifier = RICE_magadha_inspired_bodhi_tree_jaya_sri_maha_bodhi
                            years = 5
                        }
                    }
                    else_if = {
                        limit = {
                            has_character_modifier = RICE_magadha_inspired_bodhi_tree_navel_of_the_earth
                        }
                        add_character_modifier = {
                            modifier = RICE_magadha_inspired_bodhi_tree_navel_of_the_earth
                            years = 5
                        }
                    }
                }
                every_attending_character = {
                    limit = { NOT = { this = root } }
                    custom = EVERY_ACTIVITY_PARTICIPANT_EFFECT
                    custom_tooltip = RICE_activity_result_gained_piety
                }                
            }	
		}
	}
}



make_magadhi_culture_effect = {	
	#Convert your, and your whole family's, culture
	set_culture = culture:magadhi
	if = {
		limit = {
			any_spouse = {
				is_landed = no	
                culture = { has_cultural_pillar = heritage_indo_aryan }
			}
		}
		every_spouse = {
			limit = {
				is_landed = no										
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
			set_culture = culture:magadhi
		}
	}
	if = {
		limit = {
			any_close_family_member = {
				is_landed = no										
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
		}
		every_close_family_member = {
			custom = all_family_members
			limit = {
				is_landed = no											
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
			set_culture = culture:magadhi
		}
	}

	#Convert appropriate vassals, and their family
	if = {
		limit = {
			any_vassal = {							
				culture = { has_cultural_pillar = heritage_indo_aryan }		
				capital_county = {
					culture = culture:magadhi
				}
			}
		}
		every_vassal = {
			limit = {							
				culture = { has_cultural_pillar = heritage_indo_aryan }		
				capital_county = {
					culture = culture:magadhi
				}
			}
			set_culture = culture:magadhi
			hidden_effect = {
				if = {
					limit = {
						any_spouse = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
					}
					every_spouse = {
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
						set_culture = culture:magadhi
					}
				}
				if = {
					limit = {
						any_close_family_member = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
					}
					every_close_family_member = {
						custom = all_family_members
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
						set_culture = culture:magadhi
					}
				}
				if = {
					limit = {
						any_courtier = {
							is_landed = no								
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
					}
					every_courtier = {
						limit = {
							is_landed = no								
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
						set_culture = culture:magadhi
					}
				}
			}
		}
	}

	#Convert appropriate courtiers
	if = {
		limit = {
			any_courtier_or_guest = {							
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
		}
		every_courtier_or_guest = {
			limit = {						
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
			set_culture = culture:magadhi
			hidden_effect = {
				if = {
					limit = {
						any_spouse = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
					}
					every_spouse = {
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
						set_culture = culture:magadhi
					}
				}
				if = {
					limit = {
						any_close_family_member = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
					}
					every_close_family_member = {
						custom = all_family_members
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
						set_culture = culture:magadhi
					}
				}
			}
		}
	}
}







make_hindustani_culture_effect = {	
	#Convert your, and your whole family's, culture
	set_culture = culture:hindustani
	if = {
		limit = {
			any_spouse = {
				is_landed = no	
                culture = { has_cultural_pillar = heritage_indo_aryan }
			}
		}
		every_spouse = {
			limit = {
				is_landed = no										
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
			set_culture = culture:hindustani
		}
	}
	if = {
		limit = {
			any_close_family_member = {
				is_landed = no										
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
		}
		every_close_family_member = {
			custom = all_family_members
			limit = {
				is_landed = no											
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
			set_culture = culture:hindustani
		}
	}

	#Convert appropriate vassals, and their family
	if = {
		limit = {
			any_vassal = {							
				culture = { has_cultural_pillar = heritage_indo_aryan }		
				capital_county = {
					culture = culture:hindustani
				}
			}
		}
		every_vassal = {
			limit = {							
				culture = { has_cultural_pillar = heritage_indo_aryan }		
				capital_county = {
					culture = culture:hindustani
				}
			}
			set_culture = culture:hindustani
			hidden_effect = {
				if = {
					limit = {
						any_spouse = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
					}
					every_spouse = {
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
						set_culture = culture:hindustani
					}
				}
				if = {
					limit = {
						any_close_family_member = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
					}
					every_close_family_member = {
						custom = all_family_members
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
						set_culture = culture:hindustani
					}
				}
				if = {
					limit = {
						any_courtier = {
							is_landed = no								
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
					}
					every_courtier = {
						limit = {
							is_landed = no								
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
						set_culture = culture:hindustani
					}
				}
			}
		}
	}

	#Convert appropriate courtiers
	if = {
		limit = {
			any_courtier_or_guest = {							
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
		}
		every_courtier_or_guest = {
			limit = {						
				culture = { has_cultural_pillar = heritage_indo_aryan }
			}
			set_culture = culture:hindustani
			hidden_effect = {
				if = {
					limit = {
						any_spouse = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
					}
					every_spouse = {
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }	
						}
						set_culture = culture:hindustani
					}
				}
				if = {
					limit = {
						any_close_family_member = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
					}
					every_close_family_member = {
						custom = all_family_members
						limit = {
							is_landed = no									
							culture = { has_cultural_pillar = heritage_indo_aryan }
						}
						set_culture = culture:hindustani
					}
				}
			}
		}
	}
}








