public abstract class PolicyCard extends java.lang.Object implements Sendable
| Modifier and Type | Class and Description |
|---|---|
static class |
PolicyCard.EnumVariable |
static class |
PolicyCard.EnumVariableUnit |
JSON.Parser| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_MILLION_DOLLARS |
static int |
MAX_PERCENT |
static int |
MIN_MILLION_DOLLARS |
static int |
MIN_PERCENT |
| Constructor and Description |
|---|
PolicyCard() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEnactingRegion(EnumRegion region)
The Server is responsible for verifying and setting each
enacting region of
all policy cards requiring a vote (votesRequired() > 0).
Each policy sent to the simulator must be enacted by at least one US region. |
void |
clearVotes()
Clears all enacting regions.
|
static PolicyCard |
create(EnumRegion owner,
EnumPolicy type)
This is a convenience method used to construct any of the many policy cards
available in the game.
|
boolean |
didVoteYes(EnumRegion region) |
boolean |
equals(java.lang.Object o) |
void |
fromJSON(java.lang.Object doc)
Convert String into JSON
|
EnumPolicy |
getCardType() |
int |
getEnactingRegionCount() |
abstract java.lang.String |
getGameText() |
java.util.ArrayList<java.lang.Integer> |
getOptionsOfVariable()
The default is null (the given variable is not required).
|
EnumRegion |
getOwner() |
java.lang.String |
getPolicyName() |
PolicyCard.EnumVariableUnit |
getRequiredVariables(PolicyCard.EnumVariable variable)
The default is null (the given variable is not required).
|
EnumFood |
getTargetFood()
Some policy cards require a target food (crop or livestock).
|
EnumRegion |
getTargetRegion()
Some policy cards require a target region.
|
abstract java.lang.String |
getTitle() |
java.lang.String |
getType() |
EnumFood[] |
getValidTargetFoods()
The default is null (no target food required).
|
EnumRegion |
getValidTargetRegion()
The default is null (no target region required).
|
EnumRegion[] |
getValidTargetRegions()
The default is null (no target region required).
|
int |
getX() |
int |
getY() |
int |
getZ() |
int |
hashCode() |
boolean |
isEligibleToVote(EnumRegion playerRegion)
In the abstract Policy class, this method returns the default
behavior of a policy card (isEligibleToVote() = false if the policy is
automatic and true for any region if not automatic).
|
void |
setTargetFood(EnumFood targetFood)
Some policy cards require a target food (crop or livestock).
|
void |
setTargetRegion(EnumRegion region)
Some policy cards require a target region.
|
void |
setType(java.lang.String type) |
void |
setX(int x) |
void |
setY(int y) |
void |
setZ(int z) |
JSONDocument |
toJSON()
Convert class into json
|
java.lang.String |
toString() |
java.lang.String |
validate()
This method provides general validation checking of the policy card.
Between the time when a PolicyCard is instantiated and drafted, it must have various fields set. |
int |
votesRequired()
In the abstract Policy class, this method returns the default
behavior of a policy card (votesRequired() = 0).
|
boolean |
voteWaitForAll()
In the abstract Policy class, this method returns the default
behavior of a policy card (voteWaitForAll() = false).
|
public static final int MIN_PERCENT
public static final int MAX_PERCENT
public static final int MIN_MILLION_DOLLARS
public static final int MAX_MILLION_DOLLARS
public static PolicyCard create(EnumRegion owner, EnumPolicy type)
owner - US player region controlled by the player who drafts this policy.type - The policy card type to be constructed.public EnumRegion getOwner()
public abstract java.lang.String getTitle()
public abstract java.lang.String getGameText()
public int votesRequired()
public boolean voteWaitForAll()
public boolean isEligibleToVote(EnumRegion playerRegion)
playerRegion - being queried.public EnumPolicy getCardType()
public int getX()
public int getY()
public int getZ()
public void setX(int x)
x - value to be set to quantity X.public void setY(int y)
y - value to be set to quantity Y.public void setZ(int z)
z - value to be set to quantity Z.public void setTargetRegion(EnumRegion region)
region - Depending on the policy card, the given region will be
required to be either a US region or a world region or
perhaps some smaller subset of regions.public EnumRegion getTargetRegion()
public void setTargetFood(EnumFood targetFood)
targetFood - sets the targetFood. Ignored if this policy does not use a target food.public EnumFood getTargetFood()
public void clearVotes()
public void addEnactingRegion(EnumRegion region)
region - a United States region that will be enacting the policy.public boolean didVoteYes(EnumRegion region)
region - a United States region.public int getEnactingRegionCount()
public EnumRegion[] getValidTargetRegions()
public EnumRegion getValidTargetRegion()
public EnumFood[] getValidTargetFoods()
public PolicyCard.EnumVariableUnit getRequiredVariables(PolicyCard.EnumVariable variable)
variable - to be queried.public java.util.ArrayList<java.lang.Integer> getOptionsOfVariable()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getPolicyName()
public java.lang.String validate()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic JSONDocument toJSON()
JSON