Interface IShip
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddPassenger(IPerson passanger)Move a passenger to the ship.intgetCargoValue()Retrieve the value of the cargo.intgetDistanceInKmForOneHealthPointReduction()Retrieve the distance in km the ship has to travel under normal conditions, for it's health to be reduced by one.intgetMaxNumberOfSailors()Retrieve the maximum of sailors that can be put on the ship.intgetOccupiedSpace()Retrieve the occupied spaceintgetOccupiedSpaceByWeapons()Retrieve the amount of space used for the weapons.java.util.Optional<IPerson>getPassenger()Retrieve the passenger on the ship.EShipTypegetShipType()Retrieve the type of the ship.EShipUpgradegetShipUpgradeLevel()Retrieve the upgrade level of the ship.intgetUpgradeSpaceReduction()Retrieve the reduction of the load capacity based on the upgrade level.intgetValue()Retrieve the current value of the ship without its cargojava.util.List<IWeaponSlot>getWeaponSlots()Retrieve the weaponslots and in the order from back to front.booleanisAvailable()Indicate if the ship is available.booleanisUpgradable()Check if the ship can be upgradedvoidleavePassenger()Passenger leave ship.javafx.beans.property.IntegerPropertynumberOfSailorsProperty()Retrieve the number of sailors as IntegerProperty.javafx.beans.property.ObjectProperty<IShip>parentShipProperty()Property holding the parent ship in case of a grouping (convoy or group).javafx.beans.binding.BooleanBindingpassengerPresentProperty()Binding indicating if a passenger is present.voidrepair()Repair the damagevoidsetAvailable(boolean available)Set the available flag on the ship.voidsetCaptain(ICaptain captain)Set the captain on the shipvoidsetName(java.lang.String name)Set the ships namevoidsetNumberOfSailors(int nbSailors)Set the number of sailors.voidsetOccupiedSpace(int space)Set the occupied spacevoidsetOwner(IShipOwner player)Define the owner of the shipvoidsetTravelState(EShipTravelState state)Set the ships travel state.voidsetWeaponSlots(java.util.List<IWeaponSlot> shipWeaponsLocation)Set the ships weapons location.javafx.beans.property.ObjectProperty<EShipTravelState>travelState()Traveling state of the ship.voidupdateHandweapon(int delta)Update the amount of handweapons on board.voidupgrade()Upgrade the ship if it is upgradable-
Methods inherited from interface ch.sahits.game.openpatrician.model.ship.INavigableVessel
damage, getAutotrading, getCapacity, getCaptian, getCurrentSpeed, getDamage, getLoadableSpace, getLoadBinding, getLoadedWares, getLocation, getMinNumberOfSailors, getName, getNumberOfSailors, getOwner, getPirateFlag, getSize, getTopSpeed, getUuid, getWare, getWeaponAmount, load, pirateFlagProperty, setAutoTrading, setLocation, togglePirateFlag, unload
-
-
-
-
Method Detail
-
isUpgradable
boolean isUpgradable()
Check if the ship can be upgraded- Returns:
- true if the ship is upgradable
-
upgrade
void upgrade()
Upgrade the ship if it is upgradable
-
setName
void setName(java.lang.String name)
Set the ships name- Parameters:
name- of the ship
-
repair
void repair()
Repair the damage
-
getUpgradeSpaceReduction
int getUpgradeSpaceReduction()
Retrieve the reduction of the load capacity based on the upgrade level. The reduction is in barrel that reduces the initial size- Returns:
- reduction in barrels
-
getValue
int getValue()
Retrieve the current value of the ship without its cargo- Returns:
- value of the ship
-
getCargoValue
int getCargoValue()
Retrieve the value of the cargo.- Returns:
- summed up cargo value.
-
setNumberOfSailors
void setNumberOfSailors(int nbSailors)
Set the number of sailors.- Parameters:
nbSailors- number of sailors.
-
numberOfSailorsProperty
javafx.beans.property.IntegerProperty numberOfSailorsProperty()
Retrieve the number of sailors as IntegerProperty.- Returns:
- integer property of the number of sailors.
-
getMaxNumberOfSailors
int getMaxNumberOfSailors()
Retrieve the maximum of sailors that can be put on the ship. This amount depends on the ship type as well as the amount of load.- Returns:
- maximum number of sailors for the ship.
-
setCaptain
void setCaptain(ICaptain captain)
Set the captain on the ship- Parameters:
captain- to be assigned to the ship
-
addPassenger
void addPassenger(IPerson passanger)
Move a passenger to the ship. The ship may only contain one passanger.- Parameters:
passanger- going oon board.
-
leavePassenger
void leavePassenger()
Passenger leave ship.
-
getPassenger
java.util.Optional<IPerson> getPassenger()
Retrieve the passenger on the ship.- Returns:
- optional wrapped around the passenger.
-
getShipType
EShipType getShipType()
Retrieve the type of the ship.- Returns:
- type of the ship
-
setOwner
void setOwner(IShipOwner player)
Define the owner of the ship- Parameters:
player- owner of the ship.
-
getShipUpgradeLevel
EShipUpgrade getShipUpgradeLevel()
Retrieve the upgrade level of the ship.- Returns:
- current upgrade level
-
getWeaponSlots
java.util.List<IWeaponSlot> getWeaponSlots()
Retrieve the weaponslots and in the order from back to front.- Returns:
- list of weapon slots.
-
isAvailable
boolean isAvailable()
Indicate if the ship is available. A ship may be unavailable during repair or upgrade.- Returns:
- flag indicating if the ship is available.
-
setAvailable
void setAvailable(boolean available)
Set the available flag on the ship.- Parameters:
available- true if the ship is avalable
-
getOccupiedSpace
int getOccupiedSpace()
Retrieve the occupied space- Returns:
- occupied space in barrels.
-
setOccupiedSpace
void setOccupiedSpace(int space)
Set the occupied space- Parameters:
space- in barrels.
-
passengerPresentProperty
javafx.beans.binding.BooleanBinding passengerPresentProperty()
Binding indicating if a passenger is present.- Returns:
- boolean binding for the passenger presence.
-
setWeaponSlots
void setWeaponSlots(java.util.List<IWeaponSlot> shipWeaponsLocation)
Set the ships weapons location.- Parameters:
shipWeaponsLocation- list ofIWeaponSlots.
-
getDistanceInKmForOneHealthPointReduction
int getDistanceInKmForOneHealthPointReduction()
Retrieve the distance in km the ship has to travel under normal conditions, for it's health to be reduced by one.- Returns:
- number of km to be traveled.
-
parentShipProperty
javafx.beans.property.ObjectProperty<IShip> parentShipProperty()
Property holding the parent ship in case of a grouping (convoy or group). The property value can be null.- Returns:
- parent ship property.
-
updateHandweapon
void updateHandweapon(int delta)
Update the amount of handweapons on board.- Parameters:
delta- difference to be changed.
-
getOccupiedSpaceByWeapons
int getOccupiedSpaceByWeapons()
Retrieve the amount of space used for the weapons.- Returns:
- occupied space in barrels by weapons.
-
travelState
javafx.beans.property.ObjectProperty<EShipTravelState> travelState()
Traveling state of the ship.- Returns:
-
setTravelState
void setTravelState(EShipTravelState state)
Set the ships travel state.- Parameters:
state- new travel state.
-
-