- Timestamp:
- 01/30/20 16:52:38 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/main/java/geniusweb/protocol/session/shaop/SHAOPState.java
r10 r11 41 41 @JsonProperty("settings") SHAOPSettings settings, 42 42 @JsonProperty("error") ProtocolException e, 43 @JsonProperty(" actorNr") int actorNr,43 @JsonProperty("teamNr") int teamNr, 44 44 @JsonProperty("partyNumbers") Map<PartyId, Integer> partytNumbers, 45 45 @JsonProperty("totalSpent") Map<PartyId, Double> spent) { 46 super(actions, conns, progress, settings, e, actorNr, partytNumbers,46 super(actions, conns, progress, settings, e, teamNr, partytNumbers, 47 47 spent); 48 48 } … … 73 73 */ 74 74 public boolean isShaopParty(PartyId party) { 75 return settings.isShaopParty(partyNumbers.get(party));75 return (partyNumbers.get(party) & 1) == 0; 76 76 } 77 77 … … 79 79 * 80 80 * @param party a Party Id 81 * @return the PartyId of the party 81 * @return the PartyId of the party (COB and SHAOP are partners) 82 82 */ 83 83 public PartyId getPartner(PartyId party) { … … 132 132 newNumbers.put(connection.getParty(), connections.size()); 133 133 return new SHAOPState(actions, newconns, progress, settings, null, 134 actorNr, newNumbers, totalSpent);134 teamNr, newNumbers, totalSpent); 135 135 } 136 136 … … 144 144 public SHAOPState with(ProtocolException e) { 145 145 return new SHAOPState(actions, connections, progress, settings, e, 146 actorNr, partyNumbers, totalSpent);146 teamNr, partyNumbers, totalSpent); 147 147 } 148 148 … … 162 162 } 163 163 return new SHAOPState(actions, connections, newprogress, settings, 164 error, actorNr, partyNumbers, totalSpent);164 error, teamNr, partyNumbers, totalSpent); 165 165 } 166 166 … … 259 259 List<Action> newactions = new LinkedList<>(getActions()); 260 260 newactions.add(action); 261 int new Actor = actorNr;261 int newTeam = teamNr; 262 262 if (action instanceof ElicitComparison) { 263 263 Object cost = getPartyProfile(partyid).getParty().getParameters() … … 276 276 } else { 277 277 // shaop party does real action, move to next SHAOP party. 278 new Actor = (actorNr + 2) % settings.getTeams().size();278 newTeam = (teamNr + 1) % settings.getTeams().size(); 279 279 if (newprogress instanceof ProgressRounds) { 280 280 newprogress = ((ProgressRounds) newprogress).advance(); … … 282 282 } 283 283 return new SHAOPState(newactions, connections, newprogress, settings, 284 null, new Actor, partyNumbers, newSpent);284 null, newTeam, partyNumbers, newSpent); 285 285 286 286 } … … 298 298 if (!isShaopParty(actor)) 299 299 throw new IllegalArgumentException( 300 " Illegal action for COB party" + action);300 "Only SHAOP party can execute " + action); 301 301 // real action only allowed if party has the turn. 302 if (!actor.equals(connections.get( actorNr).getParty())) {302 if (!actor.equals(connections.get(2 * teamNr).getParty())) { 303 303 throw new IllegalArgumentException("Party does not have the turn "); 304 304 }
Note:
See TracChangeset
for help on using the changeset viewer.