Class BaseBuyTradeStep
- java.lang.Object
-
- ch.sahits.game.openpatrician.engine.player.tradesteps.BaseBuyTradeStep
-
- All Implemented Interfaces:
ITradeStep
- Direct Known Subclasses:
BuyTradeStep
,CheckedBuyTradeStep
public abstract class BaseBuyTradeStep extends java.lang.Object implements ITradeStep
Base class providing common functionality.- Author:
- Andi Hotz, (c) Sahits GmbH, 2017 Created on Oct 17, 2017
-
-
Field Summary
Fields Modifier and Type Field Description private ICity
city
private int
maxBuyPrice
private long
retainCash
private TradeService
tradeService
private INavigableVessel
vessel
private IWare
ware
-
Constructor Summary
Constructors Constructor Description BaseBuyTradeStep()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
transferFromOfficeOrBuyFromCity(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
-
-
-
-
Field Detail
-
tradeService
@Autowired private TradeService tradeService
-
city
private ICity city
-
ware
private IWare ware
-
vessel
private INavigableVessel vessel
-
maxBuyPrice
private int maxBuyPrice
-
retainCash
private long retainCash
-
-
Method Detail
-
transferFromOfficeOrBuyFromCity
protected long transferFromOfficeOrBuyFromCity(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 happensmaxAmount
- maximum amount of wares that should be loaded onto the vessel.- Returns:
- cost of the wares.
-
-