~ubuntu-branches/ubuntu/precise/triplea/precise

« back to all changes in this revision

Viewing changes to src/games/strategy/triplea/player/ITripleaPlayer.java

  • Committer: Package Import Robot
  • Author(s): Scott Howard
  • Date: 2011-11-11 21:40:11 UTC
  • Revision ID: package-import@ubuntu.com-20111111214011-sehf2rwat36o2xqf
Tags: upstream-1.3.2.2
ImportĀ upstreamĀ versionĀ 1.3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This program is free software; you can redistribute it and/or modify
 
3
* it under the terms of the GNU General Public License as published by
 
4
* the Free Software Foundation; either version 2 of the License, or
 
5
* (at your option) any later version.
 
6
* This program is distributed in the hope that it will be useful,
 
7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
8
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
9
* GNU General Public License for more details.
 
10
* You should have received a copy of the GNU General Public License
 
11
* along with this program; if not, write to the Free Software
 
12
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
13
 */
 
14
 
 
15
package games.strategy.triplea.player;
 
16
 
 
17
import java.util.*;
 
18
 
 
19
import games.strategy.engine.data.*;
 
20
import games.strategy.engine.data.PlayerID;
 
21
import games.strategy.engine.message.IRemote;
 
22
import games.strategy.net.*;
 
23
import games.strategy.triplea.delegate.DiceRoll;
 
24
import games.strategy.triplea.delegate.dataObjects.CasualtyDetails;
 
25
 
 
26
/**
 
27
 * Interface the TriplePlayer presents to Delegates through IRemoteMessenger
 
28
 * 
 
29
 * @author Sean Bridges
 
30
 */
 
31
public interface ITripleaPlayer extends IRemote
 
32
{
 
33
 
 
34
    /**
 
35
     * Select casualties
 
36
     * 
 
37
     * @param selectFrom - the units to select casualties from
 
38
     * @param dependents - dependents of the units to select from
 
39
     * @param count - the number of casualties to select
 
40
     * @param message - ui message to display
 
41
     * @param hit - the player hit
 
42
     * @param dice - the dice rolled for the casualties 
 
43
     * @param defaultCasualties - default casualties as selected by the game
 
44
     * @param battleID - the battle we are fighting in, may be null if this is an aa casualty selection during a move
 
45
     * @return the selected casualties
 
46
     * 
 
47
     * Added new collection autoKilled to handle killing units prior to casualty selection
 
48
     */
 
49
 
 
50
    public CasualtyDetails selectCasualties(
 
51
            Collection<Unit> selectFrom, Map<Unit, Collection<Unit>> dependents,  int count, String message, DiceRoll dice, PlayerID hit, List<Unit> defaultCasualties, GUID battleID     
 
52
    );
 
53
    /**
 
54
     * Select a fixed dice roll
 
55
     * 
 
56
     * @param numDice - the number of dice rolls
 
57
     * @param hitAt - the lowest roll that constitutes a hit (0 for none)
 
58
     * @param hitOnlyIfEquals - whether to count rolls greater than hitAt as hits
 
59
     * @param title - the title for the DiceChooser
 
60
     * @param diceSides - the number of sides on the die, found by data.getDiceSides()
 
61
     * @return the resulting dice array
 
62
     */
 
63
    public int[] selectFixedDice(int numDice, int hitAt, boolean hitOnlyIfEquals, String title, int diceSides);
 
64
    
 
65
    /**
 
66
     * Select the territory to bombard with the bombarding capable unit (eg battleship)
 
67
     * 
 
68
     * @param unit - the bombarding unit
 
69
     * @param unitTerritory - where the bombarding unit is
 
70
     * @param territories - territories where the unit can bombard
 
71
     * @param noneAvailable 
 
72
     * @return the Territory to bombard in, null if the unit should not bombard
 
73
     */
 
74
    public Territory selectBombardingTerritory(
 
75
            Unit unit,
 
76
            Territory unitTerritory,
 
77
            Collection<Territory> territories,
 
78
            boolean noneAvailable       
 
79
    );
 
80
    
 
81
    /**
 
82
     * Ask if the player wants to attack lone subs
 
83
     * 
 
84
     * @param unitTerritory - where the potential battle is
 
85
     */
 
86
    public boolean selectAttackSubs(
 
87
            Territory unitTerritory    
 
88
    );
 
89
    
 
90
    /**
 
91
     * Ask if the player wants to attack lone transports
 
92
     * 
 
93
     * @param unitTerritory - where the potential battle is
 
94
     */
 
95
    public boolean selectAttackTransports(
 
96
            Territory unitTerritory    
 
97
    );
 
98
 
 
99
    /**
 
100
     * Ask if the player wants to attack units
 
101
     * 
 
102
     * @param unitTerritory - where the potential battle is
 
103
     */
 
104
    public boolean selectAttackUnits(
 
105
            Territory unitTerritory    
 
106
    );
 
107
 
 
108
    /**
 
109
     * Ask if the player wants to shore bombard
 
110
     * 
 
111
     * @param unitTerritory - where the potential battle is
 
112
     */
 
113
    public boolean selectShoreBombard(
 
114
            Territory unitTerritory    
 
115
    );
 
116
    
 
117
    /**
 
118
     * Report an error to the user. 
 
119
     * 
 
120
     * @param report that an error occurred
 
121
     */
 
122
    public void reportError(String error);
 
123
    
 
124
    /**
 
125
     * report a message to the user
 
126
     * @param message
 
127
     */
 
128
    public void reportMessage(String message);
 
129
    
 
130
    /**
 
131
     * One or more bombers have just moved into a territory where a strategic bombing
 
132
     * raid can be conducted, should the bomber bomb? 
 
133
     */
 
134
    public boolean shouldBomberBomb(Territory territory);
 
135
 
 
136
    /**
 
137
     * One or more bombers have just moved into a territory where a strategic bombing
 
138
     * raid can be conducted, what should the bomber bomb? 
 
139
     */
 
140
    public Unit whatShouldBomberBomb(Territory territory, Collection<Unit> units);
 
141
    /**
 
142
     * Choose where my rockets should fire
 
143
     * 
 
144
     * @param candidates  - a collection of Territories,  the possible territories to attack
 
145
     * @param from - where the rockets are launched from, null for WW2V1 rules
 
146
     * @return the territory to attack, null if no territory should be attacked
 
147
     */
 
148
    public Territory whereShouldRocketsAttack(Collection<Territory> candidates, Territory from);
 
149
    
 
150
    /**
 
151
     * get the fighters to move to a newly produced carrier
 
152
     * 
 
153
     * @param fightersThatCanBeMoved - the fighters that can be moved
 
154
     * @param from - the territory containing the factory
 
155
     * @return - the fighters to move
 
156
     */
 
157
    public Collection<Unit> getNumberOfFightersToMoveToNewCarrier(Collection<Unit> fightersThatCanBeMoved, Territory from);
 
158
 
 
159
    /**
 
160
     * Some carriers were lost while defending.  We must select where to land
 
161
     * some air units.
 
162
     * 
 
163
     * @param candidates -  a list of territories - these are the places where air units can land
 
164
     * @return - the territory to land the fighters in, must be non null
 
165
     */
 
166
    public Territory selectTerritoryForAirToLand(Collection<Territory> candidates);
 
167
 
 
168
    
 
169
    /**
 
170
     * The attempted move will incur aa fire, confirm that you still want to move
 
171
     * 
 
172
     * @param  aaFiringTerritories - the territories where aa will fire
 
173
     */
 
174
    public boolean confirmMoveInFaceOfAA(Collection<Territory> aaFiringTerritories);
 
175
 
 
176
    /**
 
177
     * The attempted move will kill some air units
 
178
     * 
 
179
     */
 
180
    public boolean confirmMoveKamikaze();
 
181
 
 
182
    /**
 
183
     * The attempted move will kill some units
 
184
     * 
 
185
     */
 
186
    public boolean confirmMoveHariKari();
 
187
 
 
188
    /**
 
189
     * 
 
190
     * Ask the player if he wishes to retreat.
 
191
     * 
 
192
     * @param battleID - the battle
 
193
     * @param submerge - is submerging possible
 
194
     * @param possibleTerritories - where the player can retreat to
 
195
     * @param message - user displayable message
 
196
     * @return the territory to retreat to, or null if the player doesnt wish to retreat
 
197
     */
 
198
    public Territory retreatQuery(GUID battleID, boolean submerge, Collection<Territory> possibleTerritories, String message);
 
199
 
 
200
 
 
201
    /**
 
202
     * 
 
203
     * Ask the player if he wishes to scramble units to the battle.
 
204
     * 
 
205
     * @param battleID - the battle
 
206
     * @param possibleTerritories - where the player can retreat to
 
207
     * @param message - user displayable message
 
208
     * @return the territory to retreat to, or null if the player doesn't wish to retreat
 
209
     */
 
210
    public Collection<Unit> scrambleQuery(GUID battleID, Collection<Territory> possibleTerritories, String message);
 
211
 
 
212
    /**
 
213
     * Allows the user to pause and confirm enemy casualties
 
214
     * 
 
215
     * @param battleId
 
216
     * @param message
 
217
     */
 
218
    public void confirmEnemyCasualties(GUID battleId, String message, PlayerID hitPlayer);
 
219
    
 
220
    public void confirmOwnCasualties(GUID battleId, String message);
 
221
 
 
222
    public PlayerID getID();
 
223
 
 
224
}