Beispiel #1
0
 /**
  * Gets the Assets this Card would yield the given Player, if played, before optional choices
  *
  * @param player the player that would play this card
  * @return the Assets
  */
 public AssetMap getAssets(Player player) {
   AssetMap result = new AssetMap();
   if (!isChoice) {
     int multiplier = 1;
     if (!multiplierAssets.isEmpty()) {
       multiplier = 0;
       if (multiplierTargets.isEmpty()) {
         multiplierTargets.add(PLAYER_SELF);
       }
       for (String target : multiplierTargets) {
         Player targetPlayer;
         if (target.equals(PLAYER_LEFT)) {
           targetPlayer = player.getPlayerLeft();
         } else if (target.equals(PLAYER_RIGHT)) {
           targetPlayer = player.getPlayerRight();
         } else { // self
           targetPlayer = player;
         }
         Map<String, Integer> targetPlayerAssets = targetPlayer.getConcreteAssets();
         for (String multiplierAsset : multiplierAssets) {
           multiplier += targetPlayerAssets.get(multiplierAsset);
         }
       }
     }
     for (String asset : baseAssets.keySet()) {
       result.put(asset, baseAssets.get(asset) * multiplier);
     }
   }
   return result;
 }
Beispiel #2
0
 /**
  * Gets the optional Assets this Card would yield the given Player, if played
  *
  * @param player the player that would play this card
  * @return the Assets
  */
 public AssetSet getAssetsOptional(Player player) {
   AssetSet result = new AssetSet();
   if (isChoice) {
     for (String asset : baseAssets.keySet()) {
       result.add(asset);
     }
   }
   return result;
 }