|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.FreeColGameObject
net.sf.freecol.common.model.Monarch
public final class Monarch
This class implements the player's monarch, whose functions prior to the revolution include raising taxes, declaring war on other European countries, and occasionally providing military support.
Nested Class Summary | |
---|---|
static class |
Monarch.MonarchAction
Constants describing monarch actions. |
Field Summary | |
---|---|
static int |
MAXIMUM_TAX_RATE
The maximum possible tax rate (given in percentage). |
static int |
MINIMUM_PRICE
The minimum price for mercenaries. |
static int |
MINIMUM_TAX_RATE
The minimum tax rate (given in percentage) from where it can be lowered |
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
Monarch(Game game,
org.w3c.dom.Element e)
Initiates a new Monarch from an Element
and registers this Monarch at the specified game. |
|
Monarch(Game game,
Player player,
java.lang.String name)
Constructor. |
|
Monarch(Game game,
java.lang.String id)
Initiates a new Monarch
with the given ID. |
|
Monarch(Game game,
javax.xml.stream.XMLStreamReader in)
Initiates a new Monarch from an Element
and registers this Monarch at the specified game. |
Method Summary | |
---|---|
void |
addToREF(java.util.List<AbstractUnit> units)
Adds units to the Royal Expeditionary Force. |
java.util.List<AbstractUnit> |
addToREF(java.util.Random random)
Returns units to be added to the Royal Expeditionary Force. |
Player |
declareWar(java.util.Random random)
Returns the nation of another player to declare war on. |
Monarch.MonarchAction |
getAction(java.util.Random random)
Returns a monarch action. |
java.util.List<RandomChoice<Monarch.MonarchAction>> |
getActionChoices()
|
java.util.List<AbstractUnit> |
getLandUnits()
Returns only the land units. |
java.util.List<AbstractUnit> |
getMercenaries(java.util.Random random)
Returns units available as mercenaries. |
java.lang.String |
getName()
|
java.util.List<AbstractUnit> |
getNavalUnits()
Returns only the naval units. |
int |
getNewTax(Monarch.MonarchAction taxChange,
java.util.Random random)
Returns the new increased tax. |
int |
getPrice(java.util.List<AbstractUnit> units,
boolean rebate)
Returns the price for the given units. |
java.util.List<AbstractUnit> |
getREF()
Returns a List of all REF units. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
---|
addToRemoveElement, dispose, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toString, toXML, updateFreeColGameObject, updateID |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MINIMUM_PRICE
public static final int MAXIMUM_TAX_RATE
public static final int MINIMUM_TAX_RATE
Constructor Detail |
---|
public Monarch(Game game, Player player, java.lang.String name)
game
- The Game
this Monarch
should be created in.player
- The Player
to create the
Monarch
for.name
- The name of the Monarch
.public Monarch(Game game, javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
Monarch
from an Element
and registers this Monarch
at the specified game.
game
- The Game
this object belongs to.in
- The input stream containing the XML.
javax.xml.stream.XMLStreamException
- if a problem was encountered
during parsing.public Monarch(Game game, org.w3c.dom.Element e)
Monarch
from an Element
and registers this Monarch
at the specified game.
game
- The Game
this object belongs to.e
- An XML-element that will be used to initialize
this object.public Monarch(Game game, java.lang.String id)
Monarch
with the given ID. The object should later be
initialized by calling either
FreeColGameObject.readFromXML(XMLStreamReader)
or
FreeColObject.readFromXMLElement(Element)
.
game
- The Game
in which this object belong.id
- The unique identifier for this object.Method Detail |
---|
public java.lang.String getName()
public Monarch.MonarchAction getAction(java.util.Random random)
public java.util.List<RandomChoice<Monarch.MonarchAction>> getActionChoices()
public java.util.List<AbstractUnit> getREF()
public java.util.List<AbstractUnit> getNavalUnits()
public java.util.List<AbstractUnit> getLandUnits()
public int getNewTax(Monarch.MonarchAction taxChange, java.util.Random random)
public java.util.List<AbstractUnit> getMercenaries(java.util.Random random)
public java.util.List<AbstractUnit> addToREF(java.util.Random random)
random
- The Random
number source to use.
public void addToREF(java.util.List<AbstractUnit> units)
units
- The addition to the Royal Expeditionary Force.public int getPrice(java.util.List<AbstractUnit> units, boolean rebate)
units
- The units to get a price for.rebate
- Whether to grant a rebate.
public Player declareWar(java.util.Random random)
random
- The Random
number source to use.
public static java.lang.String getXMLElementTagName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |