soc.game
Class SOCMoveRobberResult

java.lang.Object
  extended by soc.game.SOCMoveRobberResult

public class SOCMoveRobberResult
extends java.lang.Object

This class holds the results of moving the robber or pirate. Specifically, the victim or possible victims, and what was stolen. Call SOCGame.getRobberyPirateFlag() to see which one was moved. Each game has 1 instance of this object, which is updated each time the robber or pirate is moved.


Field Summary
(package private)  int loot
          Resource type of loot stolen, as in SOCResourceConstants, or -1
 SOCResourceSet sc_piri_loot
          When the pirate fleet moves in game scenario _SC_PIRI, the resources stolen from victim.
(package private)  java.util.Vector<SOCPlayer> victims
          Victim, or possible victims, or empty or null; content type SOCPlayer
 
Constructor Summary
SOCMoveRobberResult()
          Creates a new SOCMoveRobberResult object.
 
Method Summary
 void clear()
          Clear common fields for reuse of this object.
 int getLoot()
          Get the type of resource stolen from the victim; undefined unless getVictims().size() == 1.
 java.util.Vector<SOCPlayer> getVictims()
          Get the victim (if any) or possible victims
 void setLoot(int l)
          Set the type of resource stolen from the victim
 void setVictims(java.util.Vector<SOCPlayer> v)
          Set the victim (if any) or possible victims
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

victims

java.util.Vector<SOCPlayer> victims
Victim, or possible victims, or empty or null; content type SOCPlayer


loot

int loot
Resource type of loot stolen, as in SOCResourceConstants, or -1


sc_piri_loot

public SOCResourceSet sc_piri_loot
When the pirate fleet moves in game scenario _SC_PIRI, the resources stolen from victim. Otherwise null and ignored. When sc_piri_loot is set, the other loot field is -1. When victims is empty, ignore this field.

Since:
2.0.00
See Also:
SOCGame.stealFromPlayerPirateFleet(int, int)
Constructor Detail

SOCMoveRobberResult

public SOCMoveRobberResult()
Creates a new SOCMoveRobberResult object.

Method Detail

clear

public void clear()
Clear common fields for reuse of this object. Does not clear the infrequently-used sc_piri_loot.

Since:
2.0.00

setVictims

public void setVictims(java.util.Vector<SOCPlayer> v)
Set the victim (if any) or possible victims

Parameters:
v - Victim or possible victims, may be empty or null; Vector of SOCPlayer

getVictims

public java.util.Vector<SOCPlayer> getVictims()
Get the victim (if any) or possible victims

Returns:
Victim or possible victims, may be empty or null; Vector of SOCPlayer

setLoot

public void setLoot(int l)
Set the type of resource stolen from the victim

Parameters:
l - type of resource stolen, as in SOCResourceConstants, or -1 if nothing stolen, or SOCResourceConstants.CLOTH_STOLEN_LOCAL for cloth.

getLoot

public int getLoot()
Get the type of resource stolen from the victim; undefined unless getVictims().size() == 1.

Returns:
type of resource stolen, as in SOCResourceConstants, or -1 if nothing stolen, or SOCResourceConstants.CLOTH_STOLEN_LOCAL for cloth.