Class AbstractSkillGenerator

java.lang.Object
megamek.client.generator.skillGenerators.AbstractSkillGenerator
Direct Known Subclasses:
ConstantSkillGenerator, TotalWarfareSkillGenerator

public abstract class AbstractSkillGenerator extends Object
  • Constructor Details

  • Method Details

    • getMethod

      public SkillGeneratorMethod getMethod()
    • getLevel

      public SkillLevel getLevel()
    • setLevel

      public void setLevel(SkillLevel level)
    • getType

      public SkillGeneratorType getType()
    • setType

      public void setType(SkillGeneratorType type)
    • isForceClose

      public boolean isForceClose()
    • setForceClose

      public void setForceClose(boolean forceClose)
    • setRandomSkills

      public void setRandomSkills(Entity entity)
      Generates random skills based on an entity crewmember by crewmember, and then assigns the values to the crew before sorting them.
      Parameters:
      entity - the Entity whose skills are to be randomly set
    • setRandomSkills

      public void setRandomSkills(Entity entity, boolean forceClan)
      Generates random skills based on an entity crewmember by crewmember, and then assigns the values to the crew before sorting them.
      Parameters:
      entity - the Entity whose skills are to be randomly set
      forceClan - forces the type to be clan if the crew are led by a clan pilot
    • generateRandomSkills

      public int[] generateRandomSkills(Entity entity)
      Generates random skills for an entity based on the current settings of the random skill generator, but does not assign those new skills to that entity
      Parameters:
      entity - the Entity to generate a random skill array for
      Returns:
      an integer array containing the (Gunnery, Piloting) skill values, or an alternative pairing if applicable [(Gunnery, Anti-'Mek) for infantry]
    • generateRandomSkills

      public int[] generateRandomSkills(Entity entity, boolean forceClan)
      Generates random skills for an entity based on the current settings of the random skill generator, but does not assign those new skills to that entity. The return value MUST be cleaned with cleanReturn for this setup to work properly.
      Parameters:
      entity - the Entity to generate a random skill array for
      forceClan - forces the type to be clan if the entity is a clan unit
      Returns:
      an integer array containing the (Gunnery, Piloting) skill values, or an alternative pairing if applicable [(Gunnery, Anti-'Mek) for infantry]
    • generateRandomSkills

      public abstract int[] generateRandomSkills(Entity entity, boolean clanPilot, boolean forceClan)
      Generates random skills for an entity based on the current settings of the random skill generator, but does not assign those new skills to that entity. The return value MUST be cleaned with cleanReturn for this setup to work properly.
      Parameters:
      entity - the Entity to generate a random skill array for
      clanPilot - if the crew to generate a random skills array for are a clan crew
      forceClan - forces the type to be clan if the crew are a clan crew
      Returns:
      an integer array containing the (Gunnery, Piloting) skill values, or an alternative pairing if applicable [(Gunnery, Anti-'Mek) for infantry]
    • cleanReturn

      protected int[] cleanReturn(Entity entity, int... skills)
      This cleans up the return value before the final return, and by doing so to handling two specific use cases. The first is handling Infantry Anti-'Mek skill generation properly by directly tying it into entity being Anti-'Mek trained. The second is the force close option, which forces piloting to be gunnery plus one
      Parameters:
      entity - the entity the skill is being generated for
      skills - the skill array to cleanup before the final return
      Returns:
      the modified skill array