Class MagellanShipImpl

    • Field Detail

      • shoreId

        protected int shoreId
        The shore the ship is lying.
      • size

        protected int size
        The size of this ship. While the ship is being built, size <= getType().getMaxSize() is true. After the ship is finished, size equals getType().getMaxSize().
      • damageRatio

        protected int damageRatio
        The ratio to which degree this ship is damaged. Values range from 0 to 100.
      • deprecatedLoad

        @Deprecated
        protected int deprecatedLoad
        Deprecated.
        replaced by cargo
        The weight of the units and items on this ship in GE.
      • deprecatedCapacity

        @Deprecated
        protected int deprecatedCapacity
        Deprecated.
        replaced by capacity
        The maximum payload of this ship in GE. 0 <= capacity <= getType().getCapacity() if the ship is damaged.
      • cargo

        protected int cargo
        the weight of the units and items on this ship in silver
      • capacity

        protected int capacity
        The maximum payload of this ship in silver. 0 <= capacity <= getType().getCapacity() if the ship is damaged.
      • maxPersons

        protected int maxPersons
        The maximum capacity for persons <=getType().getMaxPersons()
    • Constructor Detail

      • MagellanShipImpl

        public MagellanShipImpl​(EntityID id,
                                GameData data)
        Creates a new Ship object.
        Parameters:
        id -
        data -
    • Method Detail

      • setRegion

        public void setRegion​(Region region)
        Sets the region this ship is in and notifies region about it.
        Specified by:
        setRegion in interface HasRegion
        Specified by:
        setRegion in interface Ship
        Parameters:
        region -
      • getRegion

        public Region getRegion()
        Returns the region this ship is in.
        Specified by:
        getRegion in interface HasRegion
        Specified by:
        getRegion in interface Ship
        Returns:
        The region the ship is in, possibly null
      • getShipType

        public ShipType getShipType()
        The type of this ship.
        Specified by:
        getShipType in interface Ship
        Returns:
        The type of this ship
      • getMaxCapacity

        public int getMaxCapacity()
        Returns the maximum capacity with respect to damages of the ship in silver.
        Specified by:
        getMaxCapacity in interface Ship
        Returns:
        Returns the maximum capacity with respect to damages of the ship in silver
      • getCargo

        public int getCargo()
        Returns the cargo load of this ship.
        Specified by:
        getCargo in interface Ship
        Returns:
        Returns the cargo load of this ship
      • getLoad

        public int getLoad()
        Calculates the weight of all units of this ship. This is usually less precise than getCargo().
        Specified by:
        getLoad in interface Ship
        Returns:
        The load of the ship
      • getModifiedLoad

        public int getModifiedLoad()
        Returns the (modified) weight of all (modified) units of this ship . The method does some delta calculation to be more precise. The initial load is subtracted by the initial weight of the initial units and added by the modified weight of the modified units.
        Specified by:
        getModifiedLoad in interface Ship
        Returns:
        The modified load of the ship TODO: move to MovementEvaluator
      • toDebugString

        public java.lang.String toDebugString()
        This is a helper function for showing inner object state.
        Returns:
        A debug message
      • toString

        public java.lang.String toString​(boolean printExtended)
        Returns the string representation of this ship. If printExtended is true, type, damage and remaing capacity are shown, too.
        Specified by:
        toString in interface Ship
        Parameters:
        printExtended - Whether to return a more detailed description
        Returns:
        A strig representation of this ship
      • getCapacity

        public int getCapacity()
        Returns the value of capacity.
        Specified by:
        getCapacity in interface Ship
        Returns:
        Returns capacity.
      • setCapacity

        public void setCapacity​(int capacity)
        Sets the value of capacity.
        Specified by:
        setCapacity in interface Ship
        Parameters:
        capacity - The value for capacity.
      • getDamageRatio

        public int getDamageRatio()
        Returns the value of damageRatio.
        Specified by:
        getDamageRatio in interface Ship
        Returns:
        Returns damageRatio.
      • setDamageRatio

        public void setDamageRatio​(int damageRatio)
        Sets the value of damageRatio.
        Specified by:
        setDamageRatio in interface Ship
        Parameters:
        damageRatio - The value for damageRatio.
      • getDeprecatedCapacity

        public int getDeprecatedCapacity()
        Returns the value of deprecatedCapacity.
        Specified by:
        getDeprecatedCapacity in interface Ship
        Returns:
        Returns deprecatedCapacity.
      • setDeprecatedCapacity

        public void setDeprecatedCapacity​(int deprecatedCapacity)
        Sets the value of deprecatedCapacity.
        Specified by:
        setDeprecatedCapacity in interface Ship
        Parameters:
        deprecatedCapacity - The value for deprecatedCapacity.
      • getDeprecatedLoad

        public int getDeprecatedLoad()
        Returns the value of deprecatedLoad.
        Specified by:
        getDeprecatedLoad in interface Ship
        Returns:
        Returns deprecatedLoad.
      • setDeprecatedLoad

        public void setDeprecatedLoad​(int deprecatedLoad)
        Sets the value of deprecatedLoad.
        Specified by:
        setDeprecatedLoad in interface Ship
        Parameters:
        deprecatedLoad - The value for deprecatedLoad.
      • getShoreId

        public int getShoreId()
        Returns the value of shoreId.
        Specified by:
        getShoreId in interface Ship
        Returns:
        Returns shoreId.
      • setShoreId

        public void setShoreId​(int shoreId)
        Sets the value of shoreId.
        Specified by:
        setShoreId in interface Ship
        Parameters:
        shoreId - The value for shoreId.
      • getSize

        public int getSize()
        Returns the value of size.
        Specified by:
        getSize in interface Ship
        Returns:
        Returns size.
      • setSize

        public void setSize​(int size)
        Sets the value of size.
        Specified by:
        setSize in interface Ship
        Parameters:
        size - The value for size.
      • setCargo

        public void setCargo​(int cargo)
        Sets the value of cargo.
        Specified by:
        setCargo in interface Ship
        Parameters:
        cargo - The value for cargo.
      • setMaxPersons

        public void setMaxPersons​(int persons)
        Description copied from interface: Ship
        Sets the maximum number of persons (default: -1).
        Specified by:
        setMaxPersons in interface Ship
        See Also:
        Ship.setMaxPersons(int)
      • getMaxPersons

        public int getMaxPersons()
        Description copied from interface: Ship
        Returns the maximum number of persons allowed on board.
        Specified by:
        getMaxPersons in interface Ship
        See Also:
        Ship.getMaxPersons()
      • getModifiedPersonLoad

        public int getModifiedPersonLoad()
        Description copied from interface: Ship
        Returns the projected weight of the projected peresons on board.
        Specified by:
        getModifiedPersonLoad in interface Ship
        See Also:
        TODO: move to
      • getPersonLoad

        public int getPersonLoad()
        Description copied from interface: Ship
        Returns the current weight of the persons currently on board.
        Specified by:
        getPersonLoad in interface Ship
        See Also:
        Ship.getPersonLoad()
      • getSpeed

        public int getSpeed()
        Description copied from interface: Ship
        Returns the ship's current speed.
        Specified by:
        getSpeed in interface Ship
        Returns:
        The current speed, -1 if undefined.
        See Also:
        Ship.getSpeed()
      • setSpeed

        public void setSpeed​(int newSpeed)
        Description copied from interface: Ship
        Set the ship's current speed
        Specified by:
        setSpeed in interface Ship
        See Also:
        Ship.setSpeed(int)