megamek.common
Class Mounted

java.lang.Object
  extended by megamek.common.Mounted
All Implemented Interfaces:
java.io.Serializable, RoundUpdated

public class Mounted
extends java.lang.Object
implements java.io.Serializable, RoundUpdated

This describes equipment mounted on a mech.

Version:
Author:
Ben
See Also:
Serialized Form

Field Summary
protected  int baseDamageAbsorptionRate
           
protected  int baseDamageCapacity
           
protected  int damageTaken
           
static int MINE_ACTIVE
           
static int MINE_COMMAND_DETONATED
           
static int MINE_CONVENTIONAL
           
static int MINE_EMP
           
static int MINE_INFERNO
           
static int MINE_NONE
           
static int MINE_VIBRABOMB
           
 
Constructor Summary
Mounted(Entity entity, EquipmentType type)
          Creates new Mounted
 
Method Summary
 void addAmmoToBay(int a)
           
 void addWeaponToBay(int w)
           
 boolean ammoInBay(int mAmmoId)
           
 boolean byShot()
           
 boolean canFire()
          Confirm that the given entity can fire the indicated equipment.
 boolean canInstantSwitch(int newMode)
          Can the switch from the current mode to the new mode happen instantly?
 void changeAmmoType(AmmoType at)
          Changing ammo loadouts allows updating AmmoTypes of existing bins.
 void clearQuirks()
           
 int countQuirks()
          count all the quirks for this unit, positive and negative
 EquipmentMode curMode()
           
 int getBaseDamageAbsorptionRate()
           
 int getBaseDamageCapacity()
           
 java.util.Vector<java.lang.Integer> getBayAmmo()
           
 java.util.Vector<java.lang.Integer> getBayWeapons()
           
 CalledShot getCalledShot()
           
 int getCurrentDamageCapacity(Entity entity, int location)
          Rules say every time a shield is critted it loses 5 points from its Damage Capacity. basically count down from the top then subtract the amount of damage its already take.
 int getCurrentHeat()
          returns the heat for this weapon taking account of rapid-fire weapon status
 int getCurrentShots()
          Returns how many shots the weapon is using
 int getDamageAbsorption(Entity entity, int location)
          Rules state that every time the shield takes a crit its damage absorption for each attack is reduced by 1.
 int getDamageTaken()
           
 java.lang.String getDesc()
           
 Entity getEntity()
           
 int getExplosionDamage()
           
 int getFoundCrits()
           
 Mounted getLinked()
           
 Mounted getLinkedBy()
           
 int getLocation()
           
 int getMineType()
           
 java.lang.String getName()
          Shortcut to type.getName()
 int getNSantaAnna()
           
 int getNWeapons()
           
 java.lang.String getQuirkList(java.lang.String sep)
          Returns a string of all the quirk "codes" for this entity, using sep as the separator
 WeaponQuirks getQuirks()
           
 int getSecondLocation()
           
 int getShotsLeft()
           
 EquipmentType getType()
           
 int getVibraSetting()
          get the vibrabomb sensitivity
 boolean hasChargedCapacitor()
          does this Mounted have a linked and charged PPC Capacitor?
 boolean isAmmoUsable()
          Returns false if this ammo should not be loaded.
 boolean isArmored()
           
 boolean isBodyMounted()
           
 boolean isBombMounted()
           
 boolean isBreached()
           
 boolean isDestroyed()
           
 boolean isDumping()
           
 boolean isFired()
           
 boolean isHit()
           
 boolean isHotLoaded()
          Checks to see if the current ammo for this weapon is hotloaded
 boolean isInoperable()
           
 boolean isJammed()
           
 boolean isMissing()
           
 boolean isPendingDump()
           
 boolean isRapidfire()
           
 boolean isReady()
           
 boolean isRearMounted()
           
 boolean isRepairable()
           
 boolean isSplit()
           
 boolean isSplitable()
           
 boolean isUsedThisRound()
           
 boolean isWeaponGroup()
           
 void newRound(int roundNumber)
           
 EquipmentMode pendingMode()
           
 void restore()
          Restores the equipment from the name
 void setArmored(boolean armored)
           
 void setBodyMounted(boolean bodyMounted)
           
 void setBombMounted(boolean b)
           
 void setBreached(boolean breached)
           
 void setByShot(boolean b)
           
 void setDestroyed(boolean destroyed)
          Set this Mounted's destroyed status NOTE: only set this if this Mounted cannot be used in the current phase anymore.
 void setDumping(boolean b)
           
 void setFired(boolean val)
           
 void setFoundCrits(int n)
           
 void setHit(boolean hit)
          set that this mounted was or was not hit with a crit this phase Note: stuff that was hit in a phase can still be used in that phase, if that's not desired, use setDestroyed instead
 void setHotLoad(boolean hotload)
          Sets the hotloading parameter for this weapons ammo.
 void setJammed(boolean j)
           
 void setLinked(Mounted linked)
           
protected  void setLinkedBy(Mounted linker)
           
 void setLocation(int location)
           
 void setLocation(int location, boolean rearMounted)
           
 void setMineType(int mineType)
          set the type of mine this should be
 void setMissing(boolean missing)
           
 boolean setMode(int newMode)
          Sets the equipment mode to the mode denoted by the given mode number
 int setMode(java.lang.String newMode)
          Sets the equipment mode to the mode denoted by the given mode name
 void setNSantaAnna(int n)
           
 void setNWeapons(int i)
           
 void setPendingDump(boolean b)
           
 void setQuirks(WeaponQuirks quirks)
           
 void setRapidfire(boolean rapidfire)
           
 void setRepairable(boolean repair)
           
 void setSecondLocation(int location)
           
 void setSecondLocation(int location, boolean rearMounted)
           
 void setShotsLeft(int shotsLeft)
           
 void setSplit(boolean b)
           
 void setUsedThisRound(boolean usedThisRound)
           
 void setVibraSetting(int vibraSetting)
          set the vibrabomb sensitivity
 void setWeaponGroup(boolean b)
           
 int switchMode()
          Switches the equipment mode to the next available.
 java.lang.String toString()
           
 void unlink()
           
 IGame.Phase usedInPhase()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MINE_NONE

public static final int MINE_NONE
See Also:
Constant Field Values

MINE_CONVENTIONAL

public static final int MINE_CONVENTIONAL
See Also:
Constant Field Values

MINE_VIBRABOMB

public static final int MINE_VIBRABOMB
See Also:
Constant Field Values

MINE_ACTIVE

public static final int MINE_ACTIVE
See Also:
Constant Field Values

MINE_INFERNO

public static final int MINE_INFERNO
See Also:
Constant Field Values

MINE_EMP

public static final int MINE_EMP
See Also:
Constant Field Values

MINE_COMMAND_DETONATED

public static final int MINE_COMMAND_DETONATED
See Also:
Constant Field Values

baseDamageAbsorptionRate

protected int baseDamageAbsorptionRate

baseDamageCapacity

protected int baseDamageCapacity

damageTaken

protected int damageTaken
Constructor Detail

Mounted

public Mounted(Entity entity,
               EquipmentType type)
Creates new Mounted

Method Detail

changeAmmoType

public void changeAmmoType(AmmoType at)
Changing ammo loadouts allows updating AmmoTypes of existing bins. This is the only circumstance under which this should happen.


restore

public void restore()
Restores the equipment from the name


getType

public EquipmentType getType()

curMode

public EquipmentMode curMode()
Returns:
the current mode of the equipment, or null if it's not available.

pendingMode

public EquipmentMode pendingMode()
Returns:
the pending mode of the equipment.

switchMode

public int switchMode()
Switches the equipment mode to the next available.

Returns:
new mode number, or -1 if it's not available.

setMode

public int setMode(java.lang.String newMode)
Sets the equipment mode to the mode denoted by the given mode name

Parameters:
newMode - the name of the desired new mode
Returns:
new mode number on success, -1 otherwise.

setMode

public boolean setMode(int newMode)
Sets the equipment mode to the mode denoted by the given mode number

Parameters:
newMode - the number of the desired new mode

canInstantSwitch

public boolean canInstantSwitch(int newMode)
Can the switch from the current mode to the new mode happen instantly?

Parameters:
newMode - - integer for the new mode
Returns:

newRound

public void newRound(int roundNumber)
Specified by:
newRound in interface RoundUpdated

getName

public java.lang.String getName()
Shortcut to type.getName()


getDesc

public java.lang.String getDesc()

isReady

public boolean isReady()

isUsedThisRound

public boolean isUsedThisRound()

setUsedThisRound

public void setUsedThisRound(boolean usedThisRound)

usedInPhase

public IGame.Phase usedInPhase()

isBreached

public boolean isBreached()

setBreached

public void setBreached(boolean breached)

isDestroyed

public boolean isDestroyed()

setDestroyed

public void setDestroyed(boolean destroyed)
Set this Mounted's destroyed status NOTE: only set this if this Mounted cannot be used in the current phase anymore. If it still can, use setHit instead

Parameters:
destroyed -
See Also:
setHit(boolean)

isInoperable

public boolean isInoperable()

isHit

public boolean isHit()

setHit

public void setHit(boolean hit)
set that this mounted was or was not hit with a crit this phase Note: stuff that was hit in a phase can still be used in that phase, if that's not desired, use setDestroyed instead

Parameters:
hit -
See Also:
setDestroyed(boolean)

isMissing

public boolean isMissing()

setMissing

public void setMissing(boolean missing)

isJammed

public boolean isJammed()

setJammed

public void setJammed(boolean j)

getShotsLeft

public int getShotsLeft()

setShotsLeft

public void setShotsLeft(int shotsLeft)

getCurrentShots

public int getCurrentShots()
Returns how many shots the weapon is using


isPendingDump

public boolean isPendingDump()

setPendingDump

public void setPendingDump(boolean b)

isDumping

public boolean isDumping()

setDumping

public void setDumping(boolean b)

isRapidfire

public boolean isRapidfire()

setRapidfire

public void setRapidfire(boolean rapidfire)

isHotLoaded

public boolean isHotLoaded()
Checks to see if the current ammo for this weapon is hotloaded

Returns:
true if ammo is hotloaded or false if not

setHotLoad

public void setHotLoad(boolean hotload)
Sets the hotloading parameter for this weapons ammo.

Parameters:
hotload -

hasChargedCapacitor

public boolean hasChargedCapacitor()
does this Mounted have a linked and charged PPC Capacitor?


getLocation

public int getLocation()

getSecondLocation

public int getSecondLocation()

isRearMounted

public boolean isRearMounted()

setLocation

public void setLocation(int location)

setSecondLocation

public void setSecondLocation(int location)

setLocation

public void setLocation(int location,
                        boolean rearMounted)

setSecondLocation

public void setSecondLocation(int location,
                              boolean rearMounted)

getLinked

public Mounted getLinked()

getLinkedBy

public Mounted getLinkedBy()

setLinked

public void setLinked(Mounted linked)

setLinkedBy

protected void setLinkedBy(Mounted linker)

getFoundCrits

public int getFoundCrits()

setFoundCrits

public void setFoundCrits(int n)

isSplit

public boolean isSplit()

isSplitable

public boolean isSplitable()

setSplit

public void setSplit(boolean b)

getExplosionDamage

public int getExplosionDamage()

isFired

public boolean isFired()

setFired

public void setFired(boolean val)

canFire

public boolean canFire()
Confirm that the given entity can fire the indicated equipment.

Returns:
true if the equipment can be fired by the entity; false otherwise.

isAmmoUsable

public boolean isAmmoUsable()
Returns false if this ammo should not be loaded. Checks if the ammo is already destroyed, is being dumped, has been breached, is already used up, or is locationless (oneshot ammo).


getMineType

public int getMineType()
Returns:
the type of mine this mounted is, or -1 if it isn't a mine

setMineType

public void setMineType(int mineType)
set the type of mine this should be

Parameters:
mineType -

setVibraSetting

public void setVibraSetting(int vibraSetting)
set the vibrabomb sensitivity

Parameters:
vibraSetting - the int sensitivity to set

getVibraSetting

public int getVibraSetting()
get the vibrabomb sensitivity

Returns:
the int vibrabomb sensitity this mine is set to.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBaseDamageAbsorptionRate

public int getBaseDamageAbsorptionRate()

getBaseDamageCapacity

public int getBaseDamageCapacity()

getDamageAbsorption

public int getDamageAbsorption(Entity entity,
                               int location)
Rules state that every time the shield takes a crit its damage absorption for each attack is reduced by 1. Also for every Arm actuator critted damage absorption is reduced by 1 and finally if the shoulder is hit the damage absorption is reduced by 2 making it possble to kill a shield before its gone through its full damage capacity.

Parameters:
entity -
location -
Returns:

getCurrentDamageCapacity

public int getCurrentDamageCapacity(Entity entity,
                                    int location)
Rules say every time a shield is critted it loses 5 points from its Damage Capacity. basically count down from the top then subtract the amount of damage its already take. The damage capacity is used to determine if the shield is still viable.

Parameters:
entity -
location -
Returns:
damage capacity(no less then 0)

getDamageTaken

public int getDamageTaken()

addWeaponToBay

public void addWeaponToBay(int w)

getBayWeapons

public java.util.Vector<java.lang.Integer> getBayWeapons()

addAmmoToBay

public void addAmmoToBay(int a)

getBayAmmo

public java.util.Vector<java.lang.Integer> getBayAmmo()

setByShot

public void setByShot(boolean b)

byShot

public boolean byShot()

isBombMounted

public boolean isBombMounted()

setBombMounted

public void setBombMounted(boolean b)

ammoInBay

public boolean ammoInBay(int mAmmoId)

getCurrentHeat

public int getCurrentHeat()
returns the heat for this weapon taking account of rapid-fire weapon status


getNSantaAnna

public int getNSantaAnna()

setNSantaAnna

public void setNSantaAnna(int n)

isBodyMounted

public boolean isBodyMounted()

setBodyMounted

public void setBodyMounted(boolean bodyMounted)

isWeaponGroup

public boolean isWeaponGroup()

setWeaponGroup

public void setWeaponGroup(boolean b)

getNWeapons

public int getNWeapons()

setNWeapons

public void setNWeapons(int i)

unlink

public void unlink()

setArmored

public void setArmored(boolean armored)

isArmored

public boolean isArmored()

setQuirks

public void setQuirks(WeaponQuirks quirks)

getQuirks

public WeaponQuirks getQuirks()

clearQuirks

public void clearQuirks()

countQuirks

public int countQuirks()
count all the quirks for this unit, positive and negative


getQuirkList

public java.lang.String getQuirkList(java.lang.String sep)
Returns a string of all the quirk "codes" for this entity, using sep as the separator


getCalledShot

public CalledShot getCalledShot()

setRepairable

public void setRepairable(boolean repair)

isRepairable

public boolean isRepairable()

getEntity

public Entity getEntity()