Class DamageApplierChooser

java.lang.Object
megamek.common.autoResolve.damage.DamageApplierChooser

public class DamageApplierChooser extends Object
  • Constructor Details

    • DamageApplierChooser

      public DamageApplierChooser()
  • Method Details

    • choose

      public static DamageApplier<?> choose(Entity entity)
      Choose the correct DamageHandler for the given entity. A damage handler is a class that handles applying damage on an entity, be it a Mek, Infantry, etc. It can damage internal, armor, cause critical slots, kill crew, set limbs as blown-off, can even destroy the entity,
      Parameters:
      entity - the entity to choose the handler for
      Returns:
      the correct DamageHandler for the given entity
    • choose

      public static DamageApplier<?> choose(Entity entity, EntityFinalState entityFinalState)
      Choose the correct DamageHandler for the given entity. A damage handler is a class that handles applying damage on an entity, be it a Mek, Infantry, etc. It can damage internal, armor, cause critical slots, kill crew, set limbs as blown-off, can even destroy the entity, This one also accepts parameters to indicate if the crew must survive and if the entity must survive.
      Parameters:
      entity - the entity to choose the handler for
      entityFinalState - if the crew must survive and/or entity must survive
      Returns:
      the correct DamageHandler for the given entity
    • damageRemovedEntity

      public static void damageRemovedEntity(Entity entity, int removalCondition)
      Automatically applies damage to the entity based on the "removal condition" provided. The damage is calculated as being a percentage of the total armor of the unit, then it is transformed in a roll of dices which the average roll is that amount, then the total damage is calculated and applied in clusters of 5 damage. It rolls a minimum of 1 dice of damage. The removal condition is a code that indicates why the entity is being removed from the game. It will decide if the unit or entity must survive based on the type of removal condition. The removal conditions are: * RETREAT: crew must survive, entity must survive, 80% of the total armor is applied as damage * SALVAGEABLE: crew may die, entity must be destroyed, 75% of the total armor is applied as damage * CAPTURED: crew must survive, entity must be destroyed, 33% of the total armor is applied as damage * EJECTED: crew must survive, entity must be destroyed, 33% of the total armor is applied as damage * DEVASTATED: crew may survive, entity must be destroyed, 500% of the total armor is applied as damage * OTHER: crew may die, entity may be destroyed, 33% of the total armor applied as damage The amount of damage applied present right now was decided arbitrarily and can be changed later, maybe even make it follow a config file, client settings, etc.
      Parameters:
      entity - the entity to choose the handler for
      removalCondition - the reason why the entity is being removed