Class InformantState
- java.lang.Object
-
- ch.sahits.game.openpatrician.model.people.impl.BaseTavernPerson
-
- ch.sahits.game.openpatrician.model.people.impl.InformantState
-
- All Implemented Interfaces:
IInformant
,IPerson
,ITavernPerson
public class InformantState extends BaseTavernPerson implements IInformant
Implementation of a informant. Every city can have a informant and is referenced through it's TavernEngine.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 20, 2013
-
-
Field Summary
Fields Modifier and Type Field Description private static RandomNameLoader
firstNameLoader
private static RandomNameLoader
lastNameLoader
private java.lang.String
name
private java.util.Optional<ch.sahits.datastructure.GenericPair<java.lang.String,ICity>>
pirateLocation
private int
price
private java.util.Random
rnd
private boolean
showMapIfAvailable
private java.util.Optional<ch.sahits.datastructure.GenericPair<ICity,IWare>>
wareNeeded
private java.util.Optional<ch.sahits.datastructure.GenericPair<ICity,IWare>>
wareSurplus
-
Fields inherited from class ch.sahits.game.openpatrician.model.people.impl.BaseTavernPerson
date
-
-
Constructor Summary
Constructors Constructor Description InformantState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<MapSegmentedImage>
getMapSectionPart(IPlayer player)
The informant may also hold a map part for the player.int
getPrice(IPlayer player)
Get the price of the information.void
setNeededWare(ICity city, IWare ware)
Set the information about the needed ware in the city.void
setPirateLocation(ISeaPirate pirate, ICity city)
Set the location of the pirate.void
setWareSurplus(ICity city, IWare ware)
Set the information about the surplus ware in the city-
Methods inherited from class ch.sahits.game.openpatrician.model.people.impl.BaseTavernPerson
arrive, getMaxDaysAbsent, getMaxDaysPresent, getNumberOfDaysSinceArrival, isPresent, isPresentProperty, leave
-
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.people.IInformant
getName, getPirateLocation, getWareNeeded, getWareSurplus, isShowMapIfAvailable, setName, setPrice, setShowMapIfAvailable
-
Methods inherited from interface ch.sahits.game.openpatrician.model.people.ITavernPerson
arrive, getArrivalDate, getMaxDaysAbsent, getMaxDaysPresent, getNumberOfDaysSinceArrival, isPresent, isPresentProperty, leave, setCity
-
-
-
-
Field Detail
-
rnd
@Autowired private java.util.Random rnd
-
price
private int price
-
name
private java.lang.String name
-
wareSurplus
private java.util.Optional<ch.sahits.datastructure.GenericPair<ICity,IWare>> wareSurplus
-
pirateLocation
private java.util.Optional<ch.sahits.datastructure.GenericPair<java.lang.String,ICity>> pirateLocation
-
showMapIfAvailable
private boolean showMapIfAvailable
-
firstNameLoader
private static RandomNameLoader firstNameLoader
-
lastNameLoader
private static RandomNameLoader lastNameLoader
-
-
Method Detail
-
getPrice
public int getPrice(IPlayer player)
Description copied from interface:IInformant
Get the price of the information.- Specified by:
getPrice
in interfaceIInformant
- Parameters:
player
- requesting the price- Returns:
- price tag for the information
-
getMapSectionPart
public java.util.Optional<MapSegmentedImage> getMapSectionPart(IPlayer player)
Description copied from interface:IInformant
The informant may also hold a map part for the player.- Specified by:
getMapSectionPart
in interfaceIInformant
- Parameters:
player
- requesting player- Returns:
- Optional of the
MapSegmentedImage
. Empty if there is no map segment for hteplayer
-
setPirateLocation
public void setPirateLocation(ISeaPirate pirate, ICity city)
Description copied from interface:IInformant
Set the location of the pirate.- Specified by:
setPirateLocation
in interfaceIInformant
- Parameters:
pirate
- for whom there is information availablecity
- near which the pirate has been seen.
-
setNeededWare
public void setNeededWare(ICity city, IWare ware)
Description copied from interface:IInformant
Set the information about the needed ware in the city.- Specified by:
setNeededWare
in interfaceIInformant
- Parameters:
city
- which needs wareware
- that is needed
-
setWareSurplus
public void setWareSurplus(ICity city, IWare ware)
Description copied from interface:IInformant
Set the information about the surplus ware in the city- Specified by:
setWareSurplus
in interfaceIInformant
- Parameters:
city
- which has surplus on waresware
- that is available in abundance
-
-