|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdd.sim.SimObject
dd.sim.Proposal
A policy change in the DLUG game. The core structure of DLUG game play involves choosing between proposals, determining which proposals should be enacted, voting on the proposals, and (if they pass) enacting the proposals, causing an effect on the rest of the game. A proposal is a generic thing that will effect the city, such as building new bridges, changing zoning laws, and modifying taxes.
Subclasses wishing to extend the generic proposal may want to implement the following methods, but should always call the superclass methods here:
enact()
- Enact the proposal. This
method is called immediately after the players vote on the
proposal and it passes. Any immediate effects should happen
here.
Field Summary | |
static CostTable |
costTable
|
static java.lang.String |
MAYBE_PHRASE
|
static java.lang.String |
OPPOSE
Indicates a player opposes (is against) this proposal. |
static java.lang.String |
OPPOSE_PHRASE
|
static java.lang.String |
STATUS_AUTOFAIL
|
static java.lang.String |
STATUS_FAILED
|
static java.lang.String |
STATUS_INFORMATIONAL
|
static java.lang.String |
STATUS_KEY
|
static java.lang.String |
STATUS_NEW
|
static java.lang.String |
STATUS_PASSED
|
static java.lang.String |
STATUS_PLAYED
|
static java.lang.String |
STATUS_UNPICKED
|
static java.lang.String |
STATUS_WITHDRAWN
|
static java.lang.String |
SUPPORT
Indicates a player supports (is for) this proposal. |
static java.lang.String |
SUPPORT_PHRASE
|
Fields inherited from class dd.sim.SimObject |
attributes |
Constructor Summary | |
Proposal()
Configures the proposal. |
|
Proposal(java.lang.String title)
|
Method Summary | |
void |
addConfigParameter(ConfigParameter parameter)
|
void |
calculateCosts()
|
void |
castVote(java.lang.String playerID,
int newVote)
Casts a vote for (or against) this proposal. |
int |
compareTo(java.lang.Object o)
|
void |
configure(ConfigParameter c,
boolean val)
|
void |
configure(ConfigParameter c,
int index)
|
void |
configure(ConfigParameter c,
java.lang.String val)
|
void |
configureFromSum(java.lang.String configSum)
|
SimObject |
duplicate()
Duplicates the Proposal by calling SimObject.duplicate(), then iterating over the properties and removing all the instances of "proposalSupportFor" (that is, opinions). |
void |
enact(GameRoot root)
Enable the proposal. |
void |
enact(GameRoot root,
java.util.Random rng)
This is stub method to be overridden by subclasses; in Proposal, it just calls enact(root). |
java.util.List |
enumerateConfigurations()
|
java.lang.String |
getAbbrev()
Returns an string containing an abbreviated description of the proposal's configuration details. |
java.util.ArrayList |
getConfigParameters()
|
java.lang.String |
getConfigSum()
|
java.lang.String |
getDebriefingText()
Get text for the debriefing turn. |
java.lang.String |
getDescription()
|
float |
getEconCost()
|
java.lang.String |
getFamily()
|
java.util.Set |
getLegendIcons()
|
java.util.Set |
getMapIcons()
|
java.lang.String |
getOwnerID()
|
java.lang.String |
getPlayerOpinion(Player player)
Gets a player's opinion about the this proposal. |
java.lang.String |
getPlayerOpinion(Player player,
java.lang.String defaultValue)
|
int |
getPlayerVotesAgainst(Player player)
|
int |
getPlayerVotesFor(Player player)
Returns the player's vote on this proposal. |
java.lang.String |
getProposalID()
|
float |
getSocialCost()
|
java.lang.String |
getStatus()
|
java.lang.String |
getTitle()
|
int |
getTurn()
|
int |
getVotesAgainst()
|
int |
getVotesFor()
|
int |
getVoteTally()
Returns the "global" vote tally for this proposal. |
boolean |
isActive()
|
boolean |
isDuplicate(Proposal p)
Determines whether this proposal is a duplicate of the proposal given as an argument. |
static void |
main(java.lang.String[] args)
|
boolean |
ownedBy(Player p)
|
void |
resetVoteTally()
Resets the vote tally for this proposal to zero. |
void |
setDescription(java.lang.String description)
|
void |
setFamily(java.lang.String family)
|
void |
setOwnerID(java.lang.String ownerID)
|
void |
setPlayerOpinion(Player player,
java.lang.String pref)
Sets a player's opinion about the this proposal. |
void |
setProposalID(java.lang.String id)
|
void |
setStatus(java.lang.String status)
|
void |
setTitle(java.lang.String title)
|
void |
setTurn(int t)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String STATUS_KEY
public static final java.lang.String STATUS_NEW
public static final java.lang.String STATUS_PLAYED
public static final java.lang.String STATUS_PASSED
public static final java.lang.String STATUS_FAILED
public static final java.lang.String STATUS_WITHDRAWN
public static final java.lang.String STATUS_UNPICKED
public static final java.lang.String STATUS_AUTOFAIL
public static final java.lang.String STATUS_INFORMATIONAL
public static final java.lang.String SUPPORT_PHRASE
public static final java.lang.String OPPOSE_PHRASE
public static final java.lang.String MAYBE_PHRASE
public static CostTable costTable
public static final java.lang.String SUPPORT
public static final java.lang.String OPPOSE
Constructor Detail |
public Proposal()
public Proposal(java.lang.String title)
Method Detail |
public boolean isActive()
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
public int getTurn()
public void setTurn(int t)
public java.util.ArrayList getConfigParameters()
public void addConfigParameter(ConfigParameter parameter)
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
public boolean ownedBy(Player p)
public java.lang.String getOwnerID()
public void setOwnerID(java.lang.String ownerID)
public java.lang.String getProposalID()
public void setProposalID(java.lang.String id)
public float getEconCost()
public float getSocialCost()
public java.lang.String getDebriefingText()
debriefingText
then only that string is returned (this overrides the
conditions below.)debriefingStart
.getDebriefingText()
method. Note that this is not
called on a boolean attribute that is false.debriefingEnd
.The value of these attributes are assumed to be HTML fragments, which means that there may be escaped HTML in them.
public java.util.Set getLegendIcons()
public java.util.Set getMapIcons()
public void calculateCosts()
public void configure(ConfigParameter c, boolean val)
public void configure(ConfigParameter c, int index)
public void configure(ConfigParameter c, java.lang.String val)
public java.lang.String getConfigSum()
public void configureFromSum(java.lang.String configSum)
public java.util.List enumerateConfigurations()
public java.lang.String getFamily()
public void setFamily(java.lang.String family)
public java.lang.String getAbbrev()
public boolean isDuplicate(Proposal p)
public void enact(GameRoot root)
public void enact(GameRoot root, java.util.Random rng)
public java.lang.String getPlayerOpinion(Player player)
SUPPORT
(in favor),
or OPPOSE
(against). If the vote is any other string,
that string implies a "depends" opinion about the proposal, and the
string should contain some descriptive text which describes what it
depends upon.
player
- Player whose opinion should be queried
SUPPORT
, OPPOSE
, or some other
descriptive textpublic java.lang.String getPlayerOpinion(Player player, java.lang.String defaultValue)
public void setPlayerOpinion(Player player, java.lang.String pref)
SUPPORT
(in favor),
or OPPOSE
(against). If the vote is any other string,
that string implies a "depends" opinion about the proposal, and the
string should contain some descriptive text which describes what it
depends upon.
player
- Player whose opinion should be queriedpref
- SUPPORT
, OPPOSE
, or some other
descriptive textpublic SimObject duplicate()
duplicate
in class SimObject
public int getPlayerVotesFor(Player player)
player
- Player whose support should be queried
public int getPlayerVotesAgainst(Player player)
public void castVote(java.lang.String playerID, int newVote)
playerID
- Player casting a votenewVote
- vote to be added to the tallypublic int getVotesFor()
public int getVotesAgainst()
public void resetVoteTally()
public int getVoteTally()
public java.lang.String getStatus()
public void setStatus(java.lang.String status)
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |