Class LifePathBuilder

java.lang.Object
mekhq.campaign.personnel.advancedCharacterBuilder.LifePathBuilder

public class LifePathBuilder extends Object
Assembles a LifePath by name rather than by position.

LifePath has 55 components, and many neighbours share a type, so building one by listing every argument in order is a standing hazard: inserting a component anywhere but the end silently shifts the arguments after it past the compiler. This builder removes that, and gives the Life Path wizard somewhere to hold a half-finished Life Path, which the record itself cannot do because its constructor rejects the very values the wizard needs to report back to the author.

Every collection starts empty rather than null, so a caller only sets what it actually has.

Example: taking an existing Life Path and stamping it with the current version is LifePathBuilder.from(existing).version(MHQConstants.VERSION).build(), with no need to name the other 54 components at all.

Since:
0.50.11
  • Constructor Details

    • LifePathBuilder

      public LifePathBuilder()
      Creates a builder with empty collections, the current version, and no other values set.
      Since:
      0.50.11
  • Method Details

    • from

      public static LifePathBuilder from(LifePath source)
      Creates a builder holding everything from an existing Life Path.

      The collections are shared with the source rather than copied. A LifePath is immutable, so this is safe for reading; a caller that means to edit one should replace it outright through its setter.

      Parameters:
      source - the Life Path to copy
      Returns:
      a builder primed with the source's values
      Since:
      0.50.11
    • build

      public LifePath build()
      Builds the LifePath.

      The record's own constructor does the validating, so this throws IllegalArgumentException when anything required is missing or out of range. Call LifePathValidator.validate(LifePathBuilder) first to report problems to an author instead.

      Returns:
      the finished Life Path
      Since:
      0.50.11
    • id

      public LifePathBuilder id(UUID id)
      Sets id.
      Parameters:
      id - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • version

      public LifePathBuilder version(megamek.Version version)
      Sets version.
      Parameters:
      version - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • xpCost

      public LifePathBuilder xpCost(Integer xpCost)
      Sets xpCost.
      Parameters:
      xpCost - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • source

      public LifePathBuilder source(String source)
      Sets source.
      Parameters:
      source - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • name

      public LifePathBuilder name(String name)
      Sets name.
      Parameters:
      name - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flavorText

      public LifePathBuilder flavorText(String flavorText)
      Sets flavorText.
      Parameters:
      flavorText - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • age

      public LifePathBuilder age(Integer age)
      Sets age.
      Parameters:
      age - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • xpDiscount

      public LifePathBuilder xpDiscount(Integer xpDiscount)
      Sets xpDiscount.
      Parameters:
      xpDiscount - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • minimumYear

      public LifePathBuilder minimumYear(Integer minimumYear)
      Sets minimumYear.
      Parameters:
      minimumYear - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • maximumYear

      public LifePathBuilder maximumYear(Integer maximumYear)
      Sets maximumYear.
      Parameters:
      maximumYear - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • randomWeight

      public LifePathBuilder randomWeight(Double randomWeight)
      Sets randomWeight.
      Parameters:
      randomWeight - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • lifeStages

      public LifePathBuilder lifeStages(Set<ATOWLifeStage> lifeStages)
      Sets lifeStages.
      Parameters:
      lifeStages - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • categories

      public LifePathBuilder categories(Set<LifePathCategory> categories)
      Sets categories.
      Parameters:
      categories - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • isPlayerRestricted

      public LifePathBuilder isPlayerRestricted(Boolean isPlayerRestricted)
      Sets isPlayerRestricted.
      Parameters:
      isPlayerRestricted - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsFactions

      public LifePathBuilder requirementsFactions(Map<Integer,Set<String>> requirementsFactions)
      Sets requirementsFactions.
      Parameters:
      requirementsFactions - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsSystems

      public LifePathBuilder requirementsSystems(Map<Integer,Set<String>> requirementsSystems)
      Sets requirementsSystems.
      Parameters:
      requirementsSystems - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsLifePath

      public LifePathBuilder requirementsLifePath(Map<Integer,Set<UUID>> requirementsLifePath)
      Sets requirementsLifePath.
      Parameters:
      requirementsLifePath - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsCategories

      public LifePathBuilder requirementsCategories(Map<Integer,Map<LifePathCategory,Integer>> requirementsCategories)
      Sets requirementsCategories.
      Parameters:
      requirementsCategories - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsAttributes

      public LifePathBuilder requirementsAttributes(Map<Integer,Map<SkillAttribute,Integer>> requirementsAttributes)
      Sets requirementsAttributes.
      Parameters:
      requirementsAttributes - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsEdge

      public LifePathBuilder requirementsEdge(Map<Integer,Integer> requirementsEdge)
      Sets requirementsEdge.
      Parameters:
      requirementsEdge - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsFlexibleAttribute

      public LifePathBuilder requirementsFlexibleAttribute(Map<Integer,Integer> requirementsFlexibleAttribute)
      Sets requirementsFlexibleAttribute.
      Parameters:
      requirementsFlexibleAttribute - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsTraits

      public LifePathBuilder requirementsTraits(Map<Integer,Map<ATOWTraits,Integer>> requirementsTraits)
      Sets requirementsTraits.
      Parameters:
      requirementsTraits - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsSkills

      public LifePathBuilder requirementsSkills(Map<Integer,Map<String,Integer>> requirementsSkills)
      Sets requirementsSkills.
      Parameters:
      requirementsSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsMetaSkills

      public LifePathBuilder requirementsMetaSkills(Map<Integer,Map<SkillSubType,Integer>> requirementsMetaSkills)
      Sets requirementsMetaSkills.
      Parameters:
      requirementsMetaSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • requirementsAbilities

      public LifePathBuilder requirementsAbilities(Map<Integer,Map<String,Integer>> requirementsAbilities)
      Sets requirementsAbilities.
      Parameters:
      requirementsAbilities - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsFactions

      public LifePathBuilder exclusionsFactions(Map<Integer,Set<String>> exclusionsFactions)
      Sets exclusionsFactions.
      Parameters:
      exclusionsFactions - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsSystems

      public LifePathBuilder exclusionsSystems(Map<Integer,Set<String>> exclusionsSystems)
      Sets exclusionsSystems.
      Parameters:
      exclusionsSystems - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsLifePath

      public LifePathBuilder exclusionsLifePath(Map<Integer,Set<UUID>> exclusionsLifePath)
      Sets exclusionsLifePath.
      Parameters:
      exclusionsLifePath - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsCategories

      public LifePathBuilder exclusionsCategories(Map<Integer,Map<LifePathCategory,Integer>> exclusionsCategories)
      Sets exclusionsCategories.
      Parameters:
      exclusionsCategories - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsAttributes

      public LifePathBuilder exclusionsAttributes(Map<Integer,Map<SkillAttribute,Integer>> exclusionsAttributes)
      Sets exclusionsAttributes.
      Parameters:
      exclusionsAttributes - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsEdge

      public LifePathBuilder exclusionsEdge(Map<Integer,Integer> exclusionsEdge)
      Sets exclusionsEdge.
      Parameters:
      exclusionsEdge - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsFlexibleAttribute

      public LifePathBuilder exclusionsFlexibleAttribute(Map<Integer,Integer> exclusionsFlexibleAttribute)
      Sets exclusionsFlexibleAttribute.
      Parameters:
      exclusionsFlexibleAttribute - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsTraits

      public LifePathBuilder exclusionsTraits(Map<Integer,Map<ATOWTraits,Integer>> exclusionsTraits)
      Sets exclusionsTraits.
      Parameters:
      exclusionsTraits - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsSkills

      public LifePathBuilder exclusionsSkills(Map<Integer,Map<String,Integer>> exclusionsSkills)
      Sets exclusionsSkills.
      Parameters:
      exclusionsSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsMetaSkills

      public LifePathBuilder exclusionsMetaSkills(Map<Integer,Map<SkillSubType,Integer>> exclusionsMetaSkills)
      Sets exclusionsMetaSkills.
      Parameters:
      exclusionsMetaSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • exclusionsAbilities

      public LifePathBuilder exclusionsAbilities(Map<Integer,Map<String,Integer>> exclusionsAbilities)
      Sets exclusionsAbilities.
      Parameters:
      exclusionsAbilities - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPAttributes

      public LifePathBuilder fixedXPAttributes(Map<Integer,Map<SkillAttribute,Integer>> fixedXPAttributes)
      Sets fixedXPAttributes.
      Parameters:
      fixedXPAttributes - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPEdge

      public LifePathBuilder fixedXPEdge(Map<Integer,Integer> fixedXPEdge)
      Sets fixedXPEdge.
      Parameters:
      fixedXPEdge - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPFlexibleAttribute

      public LifePathBuilder fixedXPFlexibleAttribute(Map<Integer,Integer> fixedXPFlexibleAttribute)
      Sets fixedXPFlexibleAttribute.
      Parameters:
      fixedXPFlexibleAttribute - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPTraits

      public LifePathBuilder fixedXPTraits(Map<Integer,Map<ATOWTraits,Integer>> fixedXPTraits)
      Sets fixedXPTraits.
      Parameters:
      fixedXPTraits - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPSkills

      public LifePathBuilder fixedXPSkills(Map<Integer,Map<String,Integer>> fixedXPSkills)
      Sets fixedXPSkills.
      Parameters:
      fixedXPSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPMetaSkills

      public LifePathBuilder fixedXPMetaSkills(Map<Integer,Map<SkillSubType,Integer>> fixedXPMetaSkills)
      Sets fixedXPMetaSkills.
      Parameters:
      fixedXPMetaSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPNaturalAptitudes

      public LifePathBuilder fixedXPNaturalAptitudes(Map<Integer,Map<String,Integer>> fixedXPNaturalAptitudes)
      Sets fixedXPNaturalAptitudes.
      Parameters:
      fixedXPNaturalAptitudes - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPNaturalAptitudesMetaSkills

      public LifePathBuilder fixedXPNaturalAptitudesMetaSkills(Map<Integer,Map<SkillSubType,Integer>> fixedXPNaturalAptitudesMetaSkills)
      Sets fixedXPNaturalAptitudesMetaSkills.
      Parameters:
      fixedXPNaturalAptitudesMetaSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • fixedXPAbilities

      public LifePathBuilder fixedXPAbilities(Map<Integer,Map<String,Integer>> fixedXPAbilities)
      Sets fixedXPAbilities.
      Parameters:
      fixedXPAbilities - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPAttributes

      public LifePathBuilder flexibleXPAttributes(Map<Integer,Map<SkillAttribute,Integer>> flexibleXPAttributes)
      Sets flexibleXPAttributes.
      Parameters:
      flexibleXPAttributes - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPEdge

      public LifePathBuilder flexibleXPEdge(Map<Integer,Integer> flexibleXPEdge)
      Sets flexibleXPEdge.
      Parameters:
      flexibleXPEdge - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPFlexibleAttribute

      public LifePathBuilder flexibleXPFlexibleAttribute(Map<Integer,Integer> flexibleXPFlexibleAttribute)
      Sets flexibleXPFlexibleAttribute.
      Parameters:
      flexibleXPFlexibleAttribute - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPTraits

      public LifePathBuilder flexibleXPTraits(Map<Integer,Map<ATOWTraits,Integer>> flexibleXPTraits)
      Sets flexibleXPTraits.
      Parameters:
      flexibleXPTraits - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPSkills

      public LifePathBuilder flexibleXPSkills(Map<Integer,Map<String,Integer>> flexibleXPSkills)
      Sets flexibleXPSkills.
      Parameters:
      flexibleXPSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPMetaSkills

      public LifePathBuilder flexibleXPMetaSkills(Map<Integer,Map<SkillSubType,Integer>> flexibleXPMetaSkills)
      Sets flexibleXPMetaSkills.
      Parameters:
      flexibleXPMetaSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPNaturalAptitudes

      public LifePathBuilder flexibleXPNaturalAptitudes(Map<Integer,Map<String,Integer>> flexibleXPNaturalAptitudes)
      Sets flexibleXPNaturalAptitudes.
      Parameters:
      flexibleXPNaturalAptitudes - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPNaturalAptitudesMetaSkills

      public LifePathBuilder flexibleXPNaturalAptitudesMetaSkills(Map<Integer,Map<SkillSubType,Integer>> flexibleXPNaturalAptitudesMetaSkills)
      Sets flexibleXPNaturalAptitudesMetaSkills.
      Parameters:
      flexibleXPNaturalAptitudesMetaSkills - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPAbilities

      public LifePathBuilder flexibleXPAbilities(Map<Integer,Map<String,Integer>> flexibleXPAbilities)
      Sets flexibleXPAbilities.
      Parameters:
      flexibleXPAbilities - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • flexibleXPPickCounts

      public LifePathBuilder flexibleXPPickCounts(Map<Integer,Integer> flexibleXPPickCounts)
      Sets flexibleXPPickCounts, how many items the player takes from each flexible XP set, keyed by set index.
      Parameters:
      flexibleXPPickCounts - the value to use
      Returns:
      this builder
      Since:
      0.50.11
    • id

      public UUID id()
      Returns:
      the current value of id
    • version

      public megamek.Version version()
      Returns:
      the current value of version
    • xpCost

      public Integer xpCost()
      Returns:
      the current value of xpCost
    • source

      public String source()
      Returns:
      the current value of source
    • name

      public String name()
      Returns:
      the current value of name
    • flavorText

      public String flavorText()
      Returns:
      the current value of flavorText
    • age

      public Integer age()
      Returns:
      the current value of age
    • xpDiscount

      public Integer xpDiscount()
      Returns:
      the current value of xpDiscount
    • minimumYear

      public Integer minimumYear()
      Returns:
      the current value of minimumYear
    • maximumYear

      public Integer maximumYear()
      Returns:
      the current value of maximumYear
    • randomWeight

      public Double randomWeight()
      Returns:
      the current value of randomWeight
    • lifeStages

      public Set<ATOWLifeStage> lifeStages()
      Returns:
      the current value of lifeStages
    • categories

      public Set<LifePathCategory> categories()
      Returns:
      the current value of categories
    • isPlayerRestricted

      public Boolean isPlayerRestricted()
      Returns:
      the current value of isPlayerRestricted
    • requirementsFactions

      public Map<Integer,Set<String>> requirementsFactions()
      Returns:
      the current value of requirementsFactions
    • requirementsSystems

      public Map<Integer,Set<String>> requirementsSystems()
      Returns:
      the current value of requirementsSystems
    • requirementsLifePath

      public Map<Integer,Set<UUID>> requirementsLifePath()
      Returns:
      the current value of requirementsLifePath
    • requirementsCategories

      public Map<Integer,Map<LifePathCategory,Integer>> requirementsCategories()
      Returns:
      the current value of requirementsCategories
    • requirementsAttributes

      public Map<Integer,Map<SkillAttribute,Integer>> requirementsAttributes()
      Returns:
      the current value of requirementsAttributes
    • requirementsEdge

      public Map<Integer,Integer> requirementsEdge()
      Returns:
      the current value of requirementsEdge
    • requirementsFlexibleAttribute

      public Map<Integer,Integer> requirementsFlexibleAttribute()
      Returns:
      the current value of requirementsFlexibleAttribute
    • requirementsTraits

      public Map<Integer,Map<ATOWTraits,Integer>> requirementsTraits()
      Returns:
      the current value of requirementsTraits
    • requirementsSkills

      public Map<Integer,Map<String,Integer>> requirementsSkills()
      Returns:
      the current value of requirementsSkills
    • requirementsMetaSkills

      public Map<Integer,Map<SkillSubType,Integer>> requirementsMetaSkills()
      Returns:
      the current value of requirementsMetaSkills
    • requirementsAbilities

      public Map<Integer,Map<String,Integer>> requirementsAbilities()
      Returns:
      the current value of requirementsAbilities
    • exclusionsFactions

      public Map<Integer,Set<String>> exclusionsFactions()
      Returns:
      the current value of exclusionsFactions
    • exclusionsSystems

      public Map<Integer,Set<String>> exclusionsSystems()
      Returns:
      the current value of exclusionsSystems
    • exclusionsLifePath

      public Map<Integer,Set<UUID>> exclusionsLifePath()
      Returns:
      the current value of exclusionsLifePath
    • exclusionsCategories

      public Map<Integer,Map<LifePathCategory,Integer>> exclusionsCategories()
      Returns:
      the current value of exclusionsCategories
    • exclusionsAttributes

      public Map<Integer,Map<SkillAttribute,Integer>> exclusionsAttributes()
      Returns:
      the current value of exclusionsAttributes
    • exclusionsEdge

      public Map<Integer,Integer> exclusionsEdge()
      Returns:
      the current value of exclusionsEdge
    • exclusionsFlexibleAttribute

      public Map<Integer,Integer> exclusionsFlexibleAttribute()
      Returns:
      the current value of exclusionsFlexibleAttribute
    • exclusionsTraits

      public Map<Integer,Map<ATOWTraits,Integer>> exclusionsTraits()
      Returns:
      the current value of exclusionsTraits
    • exclusionsSkills

      public Map<Integer,Map<String,Integer>> exclusionsSkills()
      Returns:
      the current value of exclusionsSkills
    • exclusionsMetaSkills

      public Map<Integer,Map<SkillSubType,Integer>> exclusionsMetaSkills()
      Returns:
      the current value of exclusionsMetaSkills
    • exclusionsAbilities

      public Map<Integer,Map<String,Integer>> exclusionsAbilities()
      Returns:
      the current value of exclusionsAbilities
    • fixedXPAttributes

      public Map<Integer,Map<SkillAttribute,Integer>> fixedXPAttributes()
      Returns:
      the current value of fixedXPAttributes
    • fixedXPEdge

      public Map<Integer,Integer> fixedXPEdge()
      Returns:
      the current value of fixedXPEdge
    • fixedXPFlexibleAttribute

      public Map<Integer,Integer> fixedXPFlexibleAttribute()
      Returns:
      the current value of fixedXPFlexibleAttribute
    • fixedXPTraits

      public Map<Integer,Map<ATOWTraits,Integer>> fixedXPTraits()
      Returns:
      the current value of fixedXPTraits
    • fixedXPSkills

      public Map<Integer,Map<String,Integer>> fixedXPSkills()
      Returns:
      the current value of fixedXPSkills
    • fixedXPMetaSkills

      public Map<Integer,Map<SkillSubType,Integer>> fixedXPMetaSkills()
      Returns:
      the current value of fixedXPMetaSkills
    • fixedXPNaturalAptitudes

      public Map<Integer,Map<String,Integer>> fixedXPNaturalAptitudes()
      Returns:
      the current value of fixedXPNaturalAptitudes
    • fixedXPNaturalAptitudesMetaSkills

      public Map<Integer,Map<SkillSubType,Integer>> fixedXPNaturalAptitudesMetaSkills()
      Returns:
      the current value of fixedXPNaturalAptitudesMetaSkills
    • fixedXPAbilities

      public Map<Integer,Map<String,Integer>> fixedXPAbilities()
      Returns:
      the current value of fixedXPAbilities
    • flexibleXPAttributes

      public Map<Integer,Map<SkillAttribute,Integer>> flexibleXPAttributes()
      Returns:
      the current value of flexibleXPAttributes
    • flexibleXPEdge

      public Map<Integer,Integer> flexibleXPEdge()
      Returns:
      the current value of flexibleXPEdge
    • flexibleXPFlexibleAttribute

      public Map<Integer,Integer> flexibleXPFlexibleAttribute()
      Returns:
      the current value of flexibleXPFlexibleAttribute
    • flexibleXPTraits

      public Map<Integer,Map<ATOWTraits,Integer>> flexibleXPTraits()
      Returns:
      the current value of flexibleXPTraits
    • flexibleXPSkills

      public Map<Integer,Map<String,Integer>> flexibleXPSkills()
      Returns:
      the current value of flexibleXPSkills
    • flexibleXPMetaSkills

      public Map<Integer,Map<SkillSubType,Integer>> flexibleXPMetaSkills()
      Returns:
      the current value of flexibleXPMetaSkills
    • flexibleXPNaturalAptitudes

      public Map<Integer,Map<String,Integer>> flexibleXPNaturalAptitudes()
      Returns:
      the current value of flexibleXPNaturalAptitudes
    • flexibleXPNaturalAptitudesMetaSkills

      public Map<Integer,Map<SkillSubType,Integer>> flexibleXPNaturalAptitudesMetaSkills()
      Returns:
      the current value of flexibleXPNaturalAptitudesMetaSkills
    • flexibleXPAbilities

      public Map<Integer,Map<String,Integer>> flexibleXPAbilities()
      Returns:
      the current value of flexibleXPAbilities
    • flexibleXPPickCounts

      public Map<Integer,Integer> flexibleXPPickCounts()
      Returns:
      the current value of flexibleXPPickCounts