############################################################
##           Elite Recruitment Steward Helpers            ##
############################################################
##                                                        ##
## Steward helper effects to add flavor to the Elite      ##
## Recruitment mod.                                       ##
##                                                        ##
############################################################

# Create male steward in your culture and religion with dynasty lottery
create_male_steward_dynasty_lottery_effect = {
  random_list = {
    # New random house
    33 = { create_random_steward = {
      dynasty = random
      female = no
      random_traits = yes
      age = 16
      religion = ROOT
      culture = ROOT
    } }

    # Lowborn
    33 = { create_random_steward = {
      dynasty = none
      female = no
      random_traits = yes
      age = 16
      religion = ROOT
      culture = ROOT
    } }

    # Random existing house matching your culture
    33 = { create_random_steward = {
      dynasty = actually_culture
      female = no
      random_traits = yes
      age = 16
      religion = ROOT
      culture = ROOT
    } }
  }
}

# Create female steward in your culture and religion with dynasty lottery
create_female_steward_dynasty_lottery_effect = {
  random_list = {
    # New random house
    33 = { create_random_steward = {
      dynasty = random
      female = yes
      random_traits = yes
      age = 16
      religion = ROOT
      culture = ROOT
    } }

    # Lowborn
    33 = { create_random_steward = {
      dynasty = none
      female = yes
      random_traits = yes
      age = 16
      religion = ROOT
      culture = ROOT
    } }

    # Random existing house matching your culture
    33 = { create_random_steward = {
      dynasty = actually_culture
      female = yes
      random_traits = yes
      age = 16
      religion = ROOT
      culture = ROOT
    } }
  }
}

# Assign the base steward attributes to the base character
assign_steward_base_attributes_effect = {
  change_stewardship = 12
  change_diplomacy = 4
  change_intrigue = 4
  change_learning = 4
  change_martial = 4
}

# Assign the steward traits to the base character (orchestrator)
assign_steward_traits_effect = {
  remove_steward_negative_traits_effect = yes
  set_elite_steward_education_effect = yes
  assign_steward_flavor_effect = yes
  assign_religion_traits_effect = yes

  set_character_flag = elite_recruit_steward
  save_event_target_as = invited_character
}

# Remove drawbacks unbecoming of an elite steward. A treasurer must be sharp and diligent,
# so dullness and sloth are stripped; gluttonous (wasteful) and arbitrary (corrupt) ill
# befit a steady hand on the realm's coffers.
remove_steward_negative_traits_effect = {
  # Incompetence / sloth
  remove_trait = slow
  remove_trait = imbecile
  remove_trait = dull
  remove_trait = inbred
  remove_trait = slothful

  # Unbecoming of a careful administrator
  remove_trait = gluttonous
  remove_trait = arbitrary

  remove_lifestyle_trait_effect = yes
}

# Guaranteed top stewardship education
set_elite_steward_education_effect = {
  clear_education_trait = yes
  add_trait = midas_touched
}

# Weighted "flavor" roll: usually a small, fitting bonus, rarely something bigger
assign_steward_flavor_effect = {
  random_list = {
    15 = {
      change_stewardship = 2
    }
    10 = {
      change_stewardship = 4
    }
    10 = {
      add_trait = gardener
    }
    10 = {
      add_trait = architect
    }
    10 = {
      add_trait = administrator
    }
    5 = {
      add_trait = shrewd
    }
    15 = {
      add_trait = temperate
    }
    10 = {
      add_trait = just
    }
    5 = {
      add_trait = diligent
    }
    5 = {
      add_trait = quick
    }
    5 = {
      add_trait = genius
    }
  }
}
