com.planet_ink.coffee_mud.Items.Basic
Class GenSailingShip

java.lang.Object
  extended by com.planet_ink.coffee_mud.Items.Basic.StdItem
      extended by com.planet_ink.coffee_mud.Items.Basic.StdContainer
          extended by com.planet_ink.coffee_mud.Items.Basic.StdPortal
              extended by com.planet_ink.coffee_mud.Items.Basic.StdBoardable
                  extended by com.planet_ink.coffee_mud.Items.Basic.GenSailingShip
All Implemented Interfaces:
Affectable, Behavable, CloseableLockable, CMObject, Combatant, Contingent, DBIdentifiable, Environmental, Modifiable, MsgListener, Physical, PhysicalAgent, PrivateProperty, Readable, Rideable, Rider, StatsAffecting, Tickable, Exit, BoardableShip, Container, Item, SailingShip, Wearable, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class GenSailingShip
extends StdBoardable
implements SailingShip


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
Wearable.CODES
 
Field Summary
protected  PairList<Weapon,int[]> aimings
           
protected  boolean anchorDown
           
protected  PairList<Item,int[]> coordinates
           
protected  int courseDirection
           
protected  java.util.List<java.lang.Integer> courseDirections
           
protected  int directionFacing
           
protected  int lastSpamCt
           
protected  java.lang.String lastSpamMsg
           
protected  int maxHullPoints
           
protected  Room shipCombatRoom
           
protected  java.util.List<Item> smallTenderRequests
           
protected  PhysicalAgent targetedShip
           
protected  Item tenderShip
           
protected  int ticksSinceMove
           
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Basic.StdBoardable
area, homePortID, internalPrice, ownerName, price, readableText
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Basic.StdPortal
closedText, dismountString, doorName, mountString, putString, rideString, stateString, stateSubjectStr
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Basic.StdContainer
capacity, containType, defaultsClosed, defaultsLocked, hasALid, hasALock, isLocked, isOpen, openDelayTicks
 
Fields inherited from class com.planet_ink.coffee_mud.Items.Basic.StdItem
affectPhyStats, affects, baseGoldValue, basePhyStats, behaviors, cachedImageName, CODES, databaseID, description, destroyed, displayText, dispossessionTime, material, me, miscText, myContainer, myUses, myWornCode, name, owner, phyStats, properWornBitmap, rawImageName, riding, scripts, secretIdentity, tickCtr, tickStatus, wornLogicalAnd, xtraValues
 
Fields inherited from interface com.planet_ink.coffee_mud.Items.interfaces.SailingShip
COURSE_STEER_MASK
 
Fields inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
DEFAULT_WORN_CODES, DEFAULT_WORN_DEPENDENCYGRID, DEFAULT_WORN_DESCS, DEFAULT_WORN_ORDER, DEFAULT_WORN_USUAL_NAMES, DEFAULT_WORN_WEIGHT_POINTS, DEFAULT_WORN_WEIGHTS, FILTER_ANY, FILTER_MOBINVONLY, FILTER_ROOMONLY, FILTER_UNWORNONLY, FILTER_WORNONLY, HIGHEST_WORN_CODE, IN_INVENTORY, WORN_ABOUT_BODY, WORN_ARMS, WORN_BACK, WORN_EARS, WORN_EYES, WORN_FEET, WORN_FLOATING_NEARBY, WORN_HANDS, WORN_HEAD, WORN_HELD, WORN_LEFT_FINGER, WORN_LEFT_WRIST, WORN_LEGS, WORN_MOUTH, WORN_NECK, WORN_RIGHT_FINGER, WORN_RIGHT_WRIST, WORN_TORSO, WORN_WAIST, WORN_WIELD
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Rideable
RIDEABLE_AIR, RIDEABLE_DESCS, RIDEABLE_ENTERIN, RIDEABLE_LADDER, RIDEABLE_LAND, RIDEABLE_SIT, RIDEABLE_SLEEP, RIDEABLE_TABLE, RIDEABLE_WAGON, RIDEABLE_WATER
 
Fields inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Container
CONTAIN_ANYTHING, CONTAIN_BODIES, CONTAIN_CAGED, CONTAIN_CLOTHES, CONTAIN_COINS, CONTAIN_DAGGERS, CONTAIN_DESCS, CONTAIN_DRINKABLES, CONTAIN_EATABLES, CONTAIN_FOOTWEAR, CONTAIN_KEYS, CONTAIN_LIQUID, CONTAIN_ONEHANDWEAPONS, CONTAIN_OTHERWEAPONS, CONTAIN_RAWMATERIALS, CONTAIN_READABLES, CONTAIN_SCROLLS, CONTAIN_SMOKEABLES, CONTAIN_SSCOMPONENTS, CONTAIN_SWORDS
 
Constructor Summary
GenSailingShip()
           
 
Method Summary
protected  boolean amInTacticalMode()
           
protected  void announceActionToDeck(MOB mob, Environmental target, Environmental tool, java.lang.String msgStr)
           
protected  void announceActionToDeck(MOB mob, java.lang.String msgStr)
           
protected  void announceActionToDeckOrUnderdeck(MOB mob, CMMsg msg, int INDOORS)
           
protected  void announceActionToUnderDeck(MOB mob, java.lang.String msgStr)
           
protected  void announceToDeck(CMMsg msg)
           
protected  void announceToDeck(java.lang.String msgStr)
           
static void appendCondition(java.lang.StringBuilder visualCondition, double pct, java.lang.String name)
           
protected  boolean beginSail(MOB mob, Room R, int dir)
           
protected  void cleanMsgForRepeat(CMMsg msg)
           
protected  void clearTacticalMode()
           
protected  void clearTacticalModeHelper()
           
protected  Room createFirstRoom()
           
 void executeMsg(Environmental myHost, CMMsg msg)
          The general message event handler for the object.
 long expirationDate()
          If this object expires, it should have a timestamp saying when it expires, in real time.
protected  Room findNearestDocks(Room R)
           
protected  Room findOceanRoom(Area A)
           
protected  int getAnyExitDir(Room R)
           
protected  java.lang.String getAreaClassType()
           
protected static MOB getBestRider(Room R, Rideable rI)
           
protected  int getCodeNum(java.lang.String code)
           
 PhysicalAgent getCombatant()
          If this mob is in combat, this returns the mob that this mob is targeting.
protected  int[] getCoordAdjustments(int[] newOnes)
           
 java.util.List<java.lang.Integer> getCurrentCourse()
          Returns the future course of this ship.
 int getDirectionFacing()
          Returns which direction the ship is currently facing.
protected  int getDirectionFacing(int direction)
           
protected  java.lang.String getDirectionStrToTarget(PhysicalAgent targetedShip)
           
 int getDirectionToTarget()
          Gets the compass direction between this combatant and the current combat victim.
protected  int getDirectionToTarget(PhysicalAgent targetedShip)
           
protected  int getLowestTacticalDistanceFromThis()
           
protected  int[] getMagicCoords()
           
protected  int[] getMyCoords()
           
protected  java.lang.String getOtherShipInfo(PhysicalAgent targetedShip)
           
protected  Room getRandomDeckRoom()
           
 Area getShipArea()
          Space ships are unique in having an Item stand-in for dirt-side access, as well as an Area object.
 int getShipSpeed()
          Returns this ships max speed, typically >= 1
 PairList<Weapon,int[]> getSiegeWeaponAimings()
          Returns the mapping of this ships siege weapons to the coordinates they are presently aimed at.
 java.lang.String getStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 java.lang.String[] getStatCodes()
          Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.
protected  int getTacticalDistance(PhysicalAgent targetShip)
           
protected  java.lang.String getTargetedShipInfo()
           
protected  void haveEveryoneLookOverBow()
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isAnchorDown()
          Returns whether the anchor is down, thus holding the ship in place.
protected  boolean isAnyoneAtCoords(int[] xy)
           
protected  boolean isAShipSiegeWeaponReadyToFire(Item I)
           
 boolean isGeneric()
          Whether the fields of this item are set in code, or set by builders.
 boolean isInCombat()
          Returns whether this combatant is in an active combat state
 void makePeace(boolean includePlayerFollowers)
          Clears the combat state between this combatant and their target, clears the targets combat state, as well as that of any followers of this combatant.
 boolean mayIFight(PhysicalAgent victim)
          Returns whether this combatant is both permitted to attack the given combatant, and that both this combatant and the potential target are alive.
 boolean mayPhysicallyAttack(PhysicalAgent victim)
          Returns whether this combatant is permitted to attack the given combatant, both this combatant and the potential target are alive, both the combatant and the target are confirmed to be the same place.
 boolean okMessage(Environmental myHost, CMMsg msg)
          The general message event previewer for the object.
protected static boolean ownerSecurityCheck(java.lang.String ownerName, MOB mob)
           
 int rangeToTarget()
          Gets the distance between this combatant and the current combat victim.
 void recoverPhyStats()
          This method copies the basePhyStats() object into the phyStats() object, then makes repeated calls to all surrounding objects with affectPhyStats(Environmental,PhyStats) method.
protected  boolean safetyMove()
           
protected  com.planet_ink.coffee_mud.Items.Basic.GenSailingShip.SailResult sail(int direction)
           
 boolean sameAs(Environmental E)
          Whether this object instance is functionally identical to the object passed in.
 void setAnchorDown(boolean truefalse)
          Sets whether the anchor is down, thus holding the ship in place.
 void setCombatant(PhysicalAgent other)
          Sets the mob that this mob is targeting for combat, which either puts them into, or clears their combat state.
 void setCurrentCourse(java.util.List<java.lang.Integer> course)
          Sets the future course of this ship.
 void setDirectionFacing(int direction)
          Sets which direction the ship is currently facing.
 void setRangeToTarget(int newRange)
          Sets the distance between this combatant and the current combat victim.
 void setStat(java.lang.String code, java.lang.String val)
          An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders.
protected  java.lang.Boolean startAttack(MOB sourceM, Room thisRoom, java.lang.String rest)
           
protected static java.lang.String staticL(java.lang.String str, java.lang.String... xs)
           
protected  boolean steer(MOB mob, Room R, int dir)
           
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Basic.StdBoardable
announceToShip, confirmAreaMessage, copyOf, destroy, destroyThisShip, dismountString, dockHere, getDestinationRoom, getHomePortID, getIsDocked, getOwnerName, getOwnerObject, getPrice, getShipItem, getTitleID, isSavable, keyName, mountString, newInstance, okAreaMessage, putString, readableText, renameDestinationRooms, renameShip, securityCheck, sendAreaMessage, setDatabaseID, setDockableItem, setExpirationDate, setHomePortID, setKeyName, setMiscText, setOwnerName, setPrice, setReadableText, setShipArea, stopTicking, subjectToWearAndTear, text, transferOwnership, unDock, value
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Basic.StdPortal
addRider, amRiding, closedText, closeWord, defaultsClosed, defaultsLocked, delRider, displayText, doorName, exitUsage, fetchRider, getDismountString, getMountString, getPutString, getRideBuddies, getRideString, getStateString, getStateStringSubject, hasADoor, isMobileRideBasis, isReadable, lastRoomUsedFrom, mobileRideBasis, numRiders, openDelayTicks, openWord, rideBasis, riderCapacity, riders, rideString, setDismountString, setDoorsNLocks, setExitParams, setMountString, setOpenDelayTicks, setPutString, setReadable, setRideBasis, setRiderCapacity, setRideString, setStateString, setStateStringSubject, setTemporaryDoorLink, stateString, stateStringSubject, temporaryDoorLink, viewableText
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Basic.StdContainer
canContain, capacity, containTypes, emptyPlease, getContents, getDeepContents, hasALock, hasContent, isInside, isLocked, isOpen, numberOfItems, recursiveWeight, setCapacity, setContainTypes
 
Methods inherited from class com.planet_ink.coffee_mud.Items.Basic.StdItem
abilityImbuesMagic, addBehavior, addEffect, addNonUninvokableEffect, addScript, affectCharState, affectCharStats, affectPhyStats, alreadyWornMsg, amBeingWornProperly, amDestroyed, amWearingAt, baseGoldValue, basePhyStats, behaviors, canSaveDatabaseID, canWear, canWearComplete, cloneFix, compareProperLocations, compareTo, container, databaseID, delAllBehaviors, delAllEffects, delAllScripts, delBehavior, delEffect, delScript, description, description, displayText, eachBehavior, eachEffect, eachScript, effects, fetchBehavior, fetchBehavior, fetchEffect, fetchEffect, fetchScript, fitsOn, getSaveStatIndex, getTickStatus, I, image, initializeClass, isStat, L, material, maxRange, minRange, miscTextFormat, name, Name, name, numBehaviors, numEffects, numScripts, owner, phyStats, rawImage, rawLogicalAnd, rawProperLocationBitmap, rawSecretIdentity, rawWornCode, removeFromOwnerContainer, riding, scripts, secretIdentity, setBasePhyStats, setBaseValue, setContainer, setDescription, setDisplayText, setImage, setMaterial, setName, setOwner, setRawLogicalAnd, setRawProperLocationBitmap, setRawWornCode, setRiding, setSavable, setSecretIdentity, setUsesRemaining, tackOns, ultimateContainer, unWear, usesRemaining, wearAt, wearEvenIfImpossible, wearIfPossible, wearIfPossible, whereCantWear
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.BoardableShip
dockHere, getHomePortID, getIsDocked, getShipItem, renameShip, setDockableItem, setHomePortID, setShipArea, unDock
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Item
baseGoldValue, container, material, numberOfItems, owner, rawSecretIdentity, recursiveWeight, removeFromOwnerContainer, secretIdentity, setBaseValue, setContainer, setMaterial, setOwner, setSecretIdentity, setUsesRemaining, stopTicking, subjectToWearAndTear, ultimateContainer, usesRemaining, value
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.DBIdentifiable
canSaveDatabaseID, databaseID, setDatabaseID
 
Methods inherited from interface com.planet_ink.coffee_mud.Items.interfaces.Wearable
amBeingWornProperly, amWearingAt, canWear, compareProperLocations, fitsOn, rawLogicalAnd, rawProperLocationBitmap, rawWornCode, setRawLogicalAnd, setRawProperLocationBitmap, setRawWornCode, unWear, wearAt, wearEvenIfImpossible, wearIfPossible, wearIfPossible, whereCantWear
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Readable
isReadable, readableText, setReadable, setReadableText
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Rideable
addRider, amRiding, delRider, dismountString, fetchRider, getDismountString, getMountString, getPutString, getRideBuddies, getRideString, getStateString, getStateStringSubject, isMobileRideBasis, mobileRideBasis, mountString, numRiders, putString, rideBasis, riderCapacity, riders, rideString, setDismountString, setMountString, setPutString, setRideBasis, setRiderCapacity, setRideString, setStateString, setStateStringSubject, stateString, stateStringSubject
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Rider
riding, setRiding
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CloseableLockable
hasALock, isLocked, isOpen
 

Field Detail

courseDirection

protected volatile int courseDirection

anchorDown

protected volatile boolean anchorDown

courseDirections

protected final java.util.List<java.lang.Integer> courseDirections

directionFacing

protected volatile int directionFacing

ticksSinceMove

protected volatile int ticksSinceMove

targetedShip

protected volatile PhysicalAgent targetedShip

tenderShip

protected volatile Item tenderShip

shipCombatRoom

protected volatile Room shipCombatRoom

coordinates

protected PairList<Item,int[]> coordinates

aimings

protected PairList<Weapon,int[]> aimings

smallTenderRequests

protected java.util.List<Item> smallTenderRequests

maxHullPoints

protected int maxHullPoints

lastSpamCt

protected volatile int lastSpamCt

lastSpamMsg

protected volatile java.lang.String lastSpamMsg
Constructor Detail

GenSailingShip

public GenSailingShip()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdBoardable
Returns:
the name of this class

isGeneric

public boolean isGeneric()
Description copied from interface: Environmental
Whether the fields of this item are set in code, or set by builders. Generic means that they are set by builders, in which case XML is returned by the text() method containing all of the values for all the fields.

Specified by:
isGeneric in interface Environmental
Overrides:
isGeneric in class StdItem
Returns:
whether this item is modifiable by builders
See Also:
Environmental.text()

recoverPhyStats

public void recoverPhyStats()
Description copied from interface: Affectable
This method copies the basePhyStats() object into the phyStats() object, then makes repeated calls to all surrounding objects with affectPhyStats(Environmental,PhyStats) method. Surrounding objects include the room where the object is located, the Ability objects in the Effects list, the Behaviors in the behaviors list, and race/charclass/area if applicable. Those methods will then make all necessary adjustments to the values in the new phyStats() object. When it returns, phyStats() will have a totally updated object. This method must be called in code whenever the object is placed on the map, or when anything changes in its environment, such as location, effects, or other states.

Specified by:
recoverPhyStats in interface Affectable
Overrides:
recoverPhyStats in class StdPortal
See Also:
Affectable.basePhyStats(), Affectable.phyStats(), Affectable.addEffect(Ability), Behavable.addBehavior(Behavior), PhyStats

getAreaClassType

protected java.lang.String getAreaClassType()
Overrides:
getAreaClassType in class StdBoardable

createFirstRoom

protected Room createFirstRoom()
Overrides:
createFirstRoom in class StdBoardable

getShipArea

public Area getShipArea()
Description copied from interface: BoardableShip
Space ships are unique in having an Item stand-in for dirt-side access, as well as an Area object. This method returns the area object that represents the contents of the ship.

Specified by:
getShipArea in interface BoardableShip
Overrides:
getShipArea in class StdBoardable
Returns:
the official area version of this ship

announceToDeck

protected void announceToDeck(java.lang.String msgStr)

getShipSpeed

public int getShipSpeed()
Description copied from interface: SailingShip
Returns this ships max speed, typically >= 1

Specified by:
getShipSpeed in interface SailingShip
Returns:
this ships max speed, typically >= 1

announceToDeck

protected void announceToDeck(CMMsg msg)

announceActionToDeckOrUnderdeck

protected void announceActionToDeckOrUnderdeck(MOB mob,
                                               CMMsg msg,
                                               int INDOORS)

announceActionToDeck

protected void announceActionToDeck(MOB mob,
                                    java.lang.String msgStr)

announceActionToDeck

protected void announceActionToDeck(MOB mob,
                                    Environmental target,
                                    Environmental tool,
                                    java.lang.String msgStr)

announceActionToUnderDeck

protected void announceActionToUnderDeck(MOB mob,
                                         java.lang.String msgStr)

getTargetedShipInfo

protected java.lang.String getTargetedShipInfo()

getOtherShipInfo

protected java.lang.String getOtherShipInfo(PhysicalAgent targetedShip)

getDirectionToTarget

protected int getDirectionToTarget(PhysicalAgent targetedShip)

getDirectionStrToTarget

protected java.lang.String getDirectionStrToTarget(PhysicalAgent targetedShip)

getRandomDeckRoom

protected Room getRandomDeckRoom()

okMessage

public boolean okMessage(Environmental myHost,
                         CMMsg msg)
Description copied from interface: MsgListener
The general message event previewer for the object. Messages passed herein are in a pending state, and may be safely modified or rejected without fear that they might be in the middle of being executed. Messages passed herein may not necessarily be FOR or FROM this object, but will almost always represent events which want to happen in the same rom. This method should always always return true UNLESS this message needs to be canceled, in which case it is necessary to tell the mob initiating the event (CMMsg.source()) why it is being cancelled. Every game event goes through these methods.

Specified by:
okMessage in interface MsgListener
Overrides:
okMessage in class StdBoardable
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that wants to be executed
Returns:
whether this message is allowed to execute
See Also:
CMMsg, CMMsg.source()

startAttack

protected java.lang.Boolean startAttack(MOB sourceM,
                                        Room thisRoom,
                                        java.lang.String rest)

getMagicCoords

protected int[] getMagicCoords()

clearTacticalModeHelper

protected void clearTacticalModeHelper()

clearTacticalMode

protected void clearTacticalMode()

isAnyoneAtCoords

protected boolean isAnyoneAtCoords(int[] xy)

getMyCoords

protected int[] getMyCoords()

amInTacticalMode

protected boolean amInTacticalMode()

tick

public boolean tick(Tickable ticking,
                    int tickID)
Description copied from interface: Tickable
this is the method which is called periodically by the threading engine. How often it is called depends on the parameters passed to the threadding engine when it is submitted for thread access. Typically the period is once per TIME_TICK period, but that is determined when the object is submitted to the thread engine.

Specified by:
tick in interface Tickable
Overrides:
tick in class StdBoardable
Parameters:
ticking - a reference to this Tickable object
tickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Returns:
true always, unless this object no longer wishes to ever tick again, in which case false
See Also:
Tickable, ServiceEngine, TickableGroup

isAShipSiegeWeaponReadyToFire

protected final boolean isAShipSiegeWeaponReadyToFire(Item I)

getBestRider

protected static MOB getBestRider(Room R,
                                  Rideable rI)

staticL

protected static java.lang.String staticL(java.lang.String str,
                                          java.lang.String... xs)

appendCondition

public static void appendCondition(java.lang.StringBuilder visualCondition,
                                   double pct,
                                   java.lang.String name)

cleanMsgForRepeat

protected void cleanMsgForRepeat(CMMsg msg)

executeMsg

public void executeMsg(Environmental myHost,
                       CMMsg msg)
Description copied from interface: MsgListener
The general message event handler for the object. Messages passed herein may not necessarily be FOR this object, or from it, but will almost always represent events happening in the same room. The messages have already been through an approval process, so this method is called only to affect the final execution of the meaning of the message. Every game event goes through these methods.

Specified by:
executeMsg in interface MsgListener
Overrides:
executeMsg in class StdBoardable
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that needs to be executed
See Also:
CMMsg

expirationDate

public long expirationDate()
Description copied from interface: Environmental
If this object expires, it should have a timestamp saying when it expires, in real time. When it expires, a MSG_EXPIRE message will be sent to it.

Specified by:
expirationDate in interface Environmental
Overrides:
expirationDate in class StdBoardable
Returns:
the time stamp when this thing expires
See Also:
Environmental.setExpirationDate(long)

findNearestDocks

protected Room findNearestDocks(Room R)
Overrides:
findNearestDocks in class StdBoardable

getCoordAdjustments

protected int[] getCoordAdjustments(int[] newOnes)

getTacticalDistance

protected int getTacticalDistance(PhysicalAgent targetShip)

getLowestTacticalDistanceFromThis

protected int getLowestTacticalDistanceFromThis()

getDirectionFacing

protected int getDirectionFacing(int direction)

setDirectionFacing

public void setDirectionFacing(int direction)
Description copied from interface: SailingShip
Sets which direction the ship is currently facing.

Specified by:
setDirectionFacing in interface SailingShip
Parameters:
direction - the direction the ship is facing.

sail

protected com.planet_ink.coffee_mud.Items.Basic.GenSailingShip.SailResult sail(int direction)

haveEveryoneLookOverBow

protected void haveEveryoneLookOverBow()

steer

protected boolean steer(MOB mob,
                        Room R,
                        int dir)

beginSail

protected boolean beginSail(MOB mob,
                            Room R,
                            int dir)

getAnyExitDir

protected int getAnyExitDir(Room R)

findOceanRoom

protected Room findOceanRoom(Area A)

safetyMove

protected boolean safetyMove()

isInCombat

public boolean isInCombat()
Description copied from interface: Combatant
Returns whether this combatant is in an active combat state

Specified by:
isInCombat in interface Combatant
Returns:
true if this combatant is in combat, false otherwise
See Also:
MOB.getVictim(), MOB.setVictim(MOB), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.makePeace(boolean), Combatant.setRangeToTarget(int), Combatant.mayIFight(PhysicalAgent)

setRangeToTarget

public void setRangeToTarget(int newRange)
Description copied from interface: Combatant
Sets the distance between this combatant and the current combat victim. This method only matters if the combatant is in combat and getCombatant() returns a non-null value. This method does not reciprocate by setting the range to target of the combat target.

Specified by:
setRangeToTarget in interface Combatant
Parameters:
newRange - the range from this combatant to their target
See Also:
MOB.getVictim(), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.rangeToTarget(), Combatant.mayIFight(PhysicalAgent)

rangeToTarget

public int rangeToTarget()
Description copied from interface: Combatant
Gets the distance between this combatant and the current combat victim. This method only matters if the combatant is in combat and getCombatant() returns a non-null value.

Specified by:
rangeToTarget in interface Combatant
Returns:
newRange the range from this combatant to their target
See Also:
MOB.getVictim(), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.setRangeToTarget(int), Combatant.mayIFight(PhysicalAgent)

mayPhysicallyAttack

public boolean mayPhysicallyAttack(PhysicalAgent victim)
Description copied from interface: Combatant
Returns whether this combatant is permitted to attack the given combatant, both this combatant and the potential target are alive, both the combatant and the target are confirmed to be the same place.

Specified by:
mayPhysicallyAttack in interface Combatant
Parameters:
victim - the potential combat target
Returns:
true if this combatant can attack the given combatant, false otherwise
See Also:
MOB.getVictim(), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.setRangeToTarget(int), Combatant.mayPhysicallyAttack(PhysicalAgent)

ownerSecurityCheck

protected static boolean ownerSecurityCheck(java.lang.String ownerName,
                                            MOB mob)

mayIFight

public boolean mayIFight(PhysicalAgent victim)
Description copied from interface: Combatant
Returns whether this combatant is both permitted to attack the given combatant, and that both this combatant and the potential target are alive. Being in the same place is not necessary.

Specified by:
mayIFight in interface Combatant
Parameters:
victim - the potential combat target
Returns:
true if this combatant can fight the given combatant, false otherwise
See Also:
MOB.getVictim(), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.setRangeToTarget(int), Combatant.mayPhysicallyAttack(PhysicalAgent)

makePeace

public void makePeace(boolean includePlayerFollowers)
Description copied from interface: Combatant
Clears the combat state between this combatant and their target, clears the targets combat state, as well as that of any followers of this combatant. It is at best an approximation of a universal combat ender.

Specified by:
makePeace in interface Combatant
Parameters:
includePlayerFollowers - false to apply only to npc followers, true for npc and player
See Also:
Combatant.isInCombat(), MOB.getVictim(), MOB.setVictim(MOB), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.setRangeToTarget(int), Combatant.mayIFight(PhysicalAgent)

getCombatant

public PhysicalAgent getCombatant()
Description copied from interface: Combatant
If this mob is in combat, this returns the mob that this mob is targeting. If this method returns null, the mob is not in combat.

Specified by:
getCombatant in interface Combatant
Returns:
the combat target, or null for a peace state
See Also:
Combatant.isInCombat(), Combatant.setCombatant(PhysicalAgent), Combatant.makePeace(boolean), Combatant.setRangeToTarget(int), Combatant.mayIFight(PhysicalAgent)

setCombatant

public void setCombatant(PhysicalAgent other)
Description copied from interface: Combatant
Sets the mob that this mob is targeting for combat, which either puts them into, or clears their combat state. If a null value, the mob is no longer fighting.

Specified by:
setCombatant in interface Combatant
Parameters:
other - the combat target, or null for a peace state
See Also:
Combatant.isInCombat(), Combatant.getCombatant(), Combatant.makePeace(boolean), Combatant.setRangeToTarget(int), Combatant.mayIFight(PhysicalAgent)

getDirectionToTarget

public int getDirectionToTarget()
Description copied from interface: Combatant
Gets the compass direction between this combatant and the current combat victim. This method only matters if the combatant is in combat and getCombatant() returns a non-null value.

Specified by:
getDirectionToTarget in interface Combatant
Returns:
cardinal direction from this combatant to their target
See Also:
MOB.getVictim(), Combatant.setCombatant(PhysicalAgent), Combatant.getCombatant(), Combatant.setRangeToTarget(int), Combatant.mayIFight(PhysicalAgent)

getDirectionFacing

public int getDirectionFacing()
Description copied from interface: SailingShip
Returns which direction the ship is currently facing.

Specified by:
getDirectionFacing in interface SailingShip
Returns:
the direction the ship is facing.

isAnchorDown

public boolean isAnchorDown()
Description copied from interface: SailingShip
Returns whether the anchor is down, thus holding the ship in place.

Specified by:
isAnchorDown in interface SailingShip
Returns:
true if the anchor is down, holding the ship in place.

setAnchorDown

public void setAnchorDown(boolean truefalse)
Description copied from interface: SailingShip
Sets whether the anchor is down, thus holding the ship in place.

Specified by:
setAnchorDown in interface SailingShip
Parameters:
truefalse - true if the anchor is down, false if the anchor is up

getSiegeWeaponAimings

public PairList<Weapon,int[]> getSiegeWeaponAimings()
Description copied from interface: SailingShip
Returns the mapping of this ships siege weapons to the coordinates they are presently aimed at. Each coordinate is int[x,y]

Specified by:
getSiegeWeaponAimings in interface SailingShip
Returns:
the pairings of weapons to coordinates aimed at

getCurrentCourse

public java.util.List<java.lang.Integer> getCurrentCourse()
Description copied from interface: SailingShip
Returns the future course of this ship. A stop-course direction is always -1, so it is typically the last entry. Otherwise, each entry is a compass direction, possibly masked by COURSE_STEER_MASK in order to specify that it is a TURN ONLY. Directions not marked as turns are automatic movements in that direction.

Specified by:
getCurrentCourse in interface SailingShip
Returns:
the future course of this ship.
See Also:
SailingShip.setCurrentCourse(List)

setCurrentCourse

public void setCurrentCourse(java.util.List<java.lang.Integer> course)
Description copied from interface: SailingShip
Sets the future course of this ship. A stop-course direction is always -1, so it is typically the last entry. Otherwise, each entry is a compass direction, possibly masked by COURSE_STEER_MASK in order to specify that it is a TURN ONLY. Directions not marked as turns are automatic movements in that direction.

Specified by:
setCurrentCourse in interface SailingShip
Parameters:
course - the new course to set.
See Also:
SailingShip.getCurrentCourse()

getStat

public java.lang.String getStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
getStat in interface Modifiable
Overrides:
getStat in class StdItem
Parameters:
code - the name of the field to read.
Returns:
the value of the field read
See Also:
Modifiable.getStatCodes()

setStat

public void setStat(java.lang.String code,
                    java.lang.String val)
Description copied from interface: Modifiable
An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. The value passed in is always a string, even if the field itself is numeric or a list.

Specified by:
setStat in interface Modifiable
Overrides:
setStat in class StdItem
Parameters:
code - the name of the field to set
val - the value to set the field to
See Also:
Modifiable.getStatCodes()

getCodeNum

protected int getCodeNum(java.lang.String code)
Overrides:
getCodeNum in class StdItem

getStatCodes

public java.lang.String[] getStatCodes()
Description copied from interface: Modifiable
Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.

Specified by:
getStatCodes in interface Modifiable
Overrides:
getStatCodes in class StdItem
Returns:
list of the fields which may be set.
See Also:
Modifiable.getStat(String), Modifiable.setStat(String, String)

sameAs

public boolean sameAs(Environmental E)
Description copied from interface: Environmental
Whether this object instance is functionally identical to the object passed in. Works by repeatedly calling getStat on both objects and comparing the values.

Specified by:
sameAs in interface Environmental
Overrides:
sameAs in class StdItem
Parameters:
E - the object to compare this one to
Returns:
whether this object is the same as the one passed in
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String)