Class BaseBuyTradeStep

  • All Implemented Interfaces:
    ch.sahits.game.openpatrician.model.product.ITradeStep
    Direct Known Subclasses:
    BuyTradeStep, CheckedBuyTradeStep

    public abstract class BaseBuyTradeStep
    extends java.lang.Object
    implements ch.sahits.game.openpatrician.model.product.ITradeStep
    Base class providing common functionality.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 17, 2017
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected long transferFromOfficeOrBuyFromCity​(ch.sahits.game.openpatrician.model.IPlayer player, int maxAmount)
      Try transferring the required amount from storage if there is a store manager and the transfer is allowed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ch.sahits.game.openpatrician.model.product.ITradeStep

        execute
    • Constructor Detail

      • BaseBuyTradeStep

        public BaseBuyTradeStep()
    • Method Detail

      • transferFromOfficeOrBuyFromCity

        protected long transferFromOfficeOrBuyFromCity​(ch.sahits.game.openpatrician.model.IPlayer player,
                                                       int maxAmount)
        Try transferring the required amount from storage if there is a store manager and the transfer is allowed. The rest is then bought from the city.
        Parameters:
        player - for which the transfer happens
        maxAmount - maximum amount of wares that should be loaded onto the vessel.
        Returns:
        cost of the wares.