Class SkillDeprecationTool

java.lang.Object
mekhq.campaign.personnel.skills.SkillDeprecationTool

public class SkillDeprecationTool extends Object
The SkillDeprecationTool class checks and manages deprecated skills for a Person.

It identifies deprecated skills from the person's current skill set and allows the user to remove them while refunding the appropriate amount of XP. This process involves calculating XP refunds using the skill's cost and reasoning multiplier, and providing a dialog for managing the refund.

The class is initialized with a Campaign and a Person, and directly modifies the person's skills and XP as necessary.

Resources such as messages and button labels are loaded from a localized resource bundle.

  • Field Details

    • DEPRECATED_SKILLS

      public static final List<SkillType> DEPRECATED_SKILLS
      A list of deprecated skills.

      These are skills that have been scheduled for removal.

      Once the skill is removed from this list, players will no longer be able to benefit from skill refund. This list should be updated following each Milestone release. If there are no skills in the list an empty array MUST be left; otherwise we will run into NPEs during campaign loading.

      Last Updated: 50.05

  • Constructor Details

    • SkillDeprecationTool

      public SkillDeprecationTool(Campaign campaign, Person person, boolean refundAll)
      Constructs a new SkillDeprecationTool for the specified campaign and person.

      Upon initialization, this constructor immediately checks the person's skills for any deprecated skills and handles them if necessary.

      Parameters:
      campaign - the Campaign instance that provides context for the operation
      person - the Person whose skills will be checked for deprecation
    • SkillDeprecationTool

      @Deprecated(since="0.50.05", forRemoval=true) public SkillDeprecationTool(Campaign campaign, Person person)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • isSkipAll

      public boolean isSkipAll()
    • isRefundAll

      public boolean isRefundAll()
    • getRefundValue

      public int getRefundValue(Skills skills, SkillType skillType, String skillName)
      Calculates the total XP refund value for a deprecated skill by summing the XP required to reach the current level of the skill.
      Parameters:
      skills - the Skills object containing details about the person's skills
      skillType - the SkillType of the deprecated skill
      skillName - the name of the deprecated skill
      Returns:
      the total XP refund value for the deprecated skill