Class MoraleUtil

java.lang.Object
megamek.client.bot.princess.MoraleUtil

public class MoraleUtil extends Object
Method for handling morale with Princess.
Since:
5/13/14 8:36 AM
  • Constructor Details

    • MoraleUtil

      public MoraleUtil()
  • Method Details

    • isUnitBroken

      @Deprecated(since="0.51.0", forRemoval=true) public boolean isUnitBroken(int unitId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      If a unit's morale is broken, this method should return TRUE.
      Parameters:
      unitId - The ID of the Entity being checked (from Entity.getId()).
      Returns:
      TRUE if the unit is broken.
    • checkMorale

      public void checkMorale(boolean forcedWithdrawal, int bravery, int selfPreservation, Player player, Game game)
      Triggers the morale check for all units controlled by the Princess bot player.
      Parameters:
      forcedWithdrawal - Set TRUE if Forced Withdrawal is in effect.
      bravery - The index of the bravery setting in BehaviorSettings.
      selfPreservation - The index of the selfPreservation setting in BehaviorSettings.
      player - The Player of the Princess bot.
      game - The current Game
    • addBrokenUnit

      protected void addBrokenUnit(int unitId)
      Parameters:
      unitId - The ID of the Entity to be added to the broken units list.
    • removeBrokenUnit

      protected void removeBrokenUnit(int unitId)
      Parameters:
      unitId - The ID of the Entity to be removed from the broken units list.
    • rollDice

      protected int rollDice()
      Returns:
      The result of a 2d6 roll from Compute.d6(int)