conception.adoc 37 KB
Newer Older
Gerson Sunyé's avatar
Gerson Sunyé committed
1
= Conception détaillée
2

3
4
5
6
7
8
== Proposition :

- Transformer l'actuel objet Game en objet Room et l'objet GameController en Game
- Ajouter des méthodes dans Thrift pour ce faire
- Transformer les void de l'interface Game en Response

9
10
== Game

11
12
13
[plantuml]
....
class Room{
14
15
16
17
18
    - requests : BlockingQueue<GameRequest>
    - numberPlayers : AtomicInteger
    - roomId : String
    - roomCreatorId : String
    - players : Map<String, Integer>
19
    - room : Game
20
21
    - isStart : Boolean
    - isClose : Boolean
Killian LUCAS's avatar
Killian LUCAS committed
22
23
24
25
    - play : Thread
    - game : Game
    - static(MAX_PLAYER : int)
    - static(MIN_PLAYER : int)
26
    + getRoomId() : String
Killian LUCAS's avatar
Killian LUCAS committed
27
    + getNumberPlayers() : AtomicInteger
28
29
30
31
32
    + isCreator(playerId : String) : Boolean
    + join(playerId : String) : Response
    + start(playerId : String, planet : Planet, board : Board, creatureNumber : Integer) : Response
    - requestManagement()
    - handleRequest(request : GameRequest)
33
34
35
}


Killian LUCAS's avatar
Killian LUCAS committed
36
37

    interface GameInterface{
38
39
40
    + isFinish() : Boolean
    + playerHasFinished(playerId : Integer, phase : Phase)
    + phaseIsFinish() : Boolean
Killian LUCAS's avatar
Killian LUCAS committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    + playerPlayCard(playerId : Integer, card : Card) :  Response
    + playerPlayCard(playerId : Integer, cards : Card[*]) :  Response

    + playerPlaceJeton(playerId : Integer, jeton : PlacedJeton) : Response
    + playerPlaceJeton(playerId : Integer, jetons : PlacedJeton[*])  : Response

    + playerResist(playerId : Integer, number : Integer) : Response
    + playerGiveUp(playerId : Integer): Response
    + playerChooseAction(playerId : Integer, action : Action): Response
    + askAction(inGameIdPlayer : Integer, askedAction : TAskAction): Action
    - sendActionWithoutExpectedResponse(inGameIdPlayer : Integer, askedAction : TAskAction)
    - sendFirstRoundStart()
    - sendStartPhase()
    - sendDescription()
    - sendGameIsEnd()
56
57
58
    }

    class Game{
59
60
61
62
63
        - planet : Planet
        - reserve : Reserve
        - survivalCardPioche : Pioche<SurvivalCard>
        - trackingCardPioche : Pioche<TrackingCard>
        - board : Board
Killian LUCAS's avatar
Killian LUCAS committed
64
        - database : NotAloneDatabase
65
66
67
68
        - creature : Creature
        - traques : Traque[*]
        - playersMap : Map<Integer, Player>
        - state : Phase
Killian LUCAS's avatar
Killian LUCAS committed
69
        - room : Room
70
71
        - currentActivatePowers : PowerContainer[*]
        - nextRoundPowers : PowerContainer[*]
Killian LUCAS's avatar
Killian LUCAS committed
72
        - gameRoundVariables : GameRoundVariables
73
        - playerServiceHandler : GameClientHandler
Killian LUCAS's avatar
Killian LUCAS committed
74
75

        - initializePlayer(creatureId : Integer, playerNumber : Integer)
76
77
78
        - initializeReserve(playerNumber : Integer)
        - initializeSurvivalCardPioche()
        - initializeTrackingCardPioche()
Killian LUCAS's avatar
Killian LUCAS committed
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
        - initializeCardsOfPlayers()
        - sendFirstRoundStart()

        + getCurrentActivatePowers() : Power[*]
        + getNextRoundPowers() : Power[*]
        + getPlanet() : Planet
        + getReserve() : Reserve
        + getSurvivalCardPioche() : Pioche<SurvivalCard>
        + getTrackingCardPioche() : Pioche<TrackingCard>
        + getBoard() : Board
        + getCreature() : Creature
        + getTraques() : Traque[*]
        + getPlayersMap() : Map<Integer, Player>
        + getPlayer(idPlayer : Integer) : Player
        + getGameRoundVariables() : GameRoundVariables
        + getState() : Phase
        + getRoom() : Room
        + isJetonArtemiaIsActive() : boolean
        + getNumberWillingnessDecrementByJetonCreature() : Integer
        + traqueCanResist() : boolean
        + getIdPlayerTargetByTrackingCardAnticipation() : Integer
        + traqueCanPickSurvivalCards() :  boolean
        - addPowerForNextRound(power : Power)
        - disableJetonArtemia()
        - enableJetonArtemia()
        - setNumberWillingnessDecrementByJetonCreature( number : Integer)
        - addNumberWillingnessByJetonCreature()
        - setTraqueCanResist()
        - setIdPlayerTargetByTrackingCardAnticipation(idPlayerTargetByJetonCreature : Integer)
        - setTraqueCanPickSurvivalCards(traqueCanPickSurvivalCards : Boolean)
109
110

        + isFinish() : Boolean
Killian LUCAS's avatar
Killian LUCAS committed
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

        + playerHasFinished(playerId : Integer, phase : Phase) : Response
        + creatureHasFinished(creature : Creature, phase : Phase) : Response
        + boolean traqueHasFinished(traque : Traque, phase : Phase )
        + Response phaseIsFinish(phase : Phase)
        + playerPlayCard(playerId : Integer, card : Card) : Response
        + playerPlayCard(playerId : Integer, cards : Card[*]) : Response

        + playerPlaceJeton(playerId : Integer, jeton : PlacedJeton) : Response
        + playerPlaceJeton(playerId : Integer, jetons : PlacedJeton[*]) : Response

        + playerResist(playerId : Integer) : Response
        + playerGiveUp(playerId : Integer) : Response
        + playerChooseAction(playerId : Integer, action : Action) : Response
        + askAction(inGameIdPlayer : Integer, action : TAskAction) : Action
        - sendActionWithoutExpectedResponse(inGameIdPlayer : Integer, askedAction : TAskAction)
        - sendStartPhase()
        - sendDescription()
        - sendGameIsEnd()
        + playerPlayPlayerCard(player : Player, card : Card ) : Response
        + playerPlayPlayerCard(player : Player, cards : Card[*] ) : Response
        + creaturePlayTrackingCard(creature : Creature, trackingCard : TrackingCard ) : Response
        + creaturePlayTrackingCard(creature : Creature, trackingCards : TrackingCard[*] ) : Response
        - applyCreaturePlayTrackingCard(creature : Creature, trackingCard : TrackingCard )
        + creatureCanPlayThisTrackingCards(creature : Creature, trackingCard : TrackingCard ) : boolean
        + creatureCanPlayThisTrackingCards(creature : Creature, trackingCard : TrackingCard[*] ) : boolean
        + traquePlaySurvivalCard(traque : Traque, survivalCard : SurvivalCard) : Response
        + traquePlaySurvivalCard(traque : Traque, survivalCard : SurvivalCard[*]) : Response
        - applyTraquePlaySurvivalCard( traque : Traque, survivalCard : SurvivalCard)
        + traqueCanPlayThisSurvivalCards( traque : Traque, survivalCard : SurvivalCard) : boolean
        + traqueCanPlayThisSurvivalCards( traque : Traque, survivalCards : SurvivalCard[*]) : boolean
        + traquePlayPlaceCard( traque : Traque, placeCard PlaceCard) : Response
        + traquePlayPlaceCard( traque : Traque, placeCard PlaceCard[*]) : Response
        + playerCardsPlayedPhaseAndAppliedPhaseDifferent( playerCard : PlayerCard) : boolean
        + creaturePlaceAJeton( creature : Creature, placedJeton : PlacedJeton) : Response
        + nextPhase(phase : Phase) : Phase
        + allPlayersHasFinishedCurrentPhase() : boolean
        - startNextPhase()
        - managePhase3()
        + choosePlaceCardsToReveal(traque : Traque) : PlaceCard[*]
        - managePhase4()
        - nextRound()
        - applyNextRoundPowers()
        - applyModificatorPower(power : PowerModificator)
        - useWillingnessOnBoard()
        + choosePlaceCardsAction(idPlayer : Integer, max : Integer, placesCards : PlaceCard[*]) : PlaceCard[*]
        + chooseSurvivalCardsAction(idPlayer : Integer, max : Integer, survivalCards : SurvivalCard[*]) : SurvivalCard[*]
        + chooseTrackingCardsAction(idPlayer : Integer, max : Integer, trackingCards : TrackingCard[*]) : TrackingCard[*]
        + chooseCardsAction(idPlayer : Integer, max : Integer, cardsToChoose : Card[*]) : Card[*]
        + createTActionForChooseCardsAction( max : Integer, cardsToChoose : Card[*]) : TAskAction
        - sendPlaceCardsAction( idPlayer : Integer, cardsToShow : PlaceCard[*])
        - sendCardsAction( idPlayer : Integer, cardsToShow : Card[*])
        + createTActionForSendCardsAction(cardsToShow : Card[*]) : TAskAction
        + computeCardListFromCardNames( cardNames : CardName[*], cardsToChoose : Card[*]) : Card[*]
        + choosePower(idPlayer : Integer, powersDescription : String[*]) : Integer
        + targetPlayer(idPlayer : Integer) : Integer
        + choosePlace(idPlayer : Integer, number : Integer) : Place[*]
        + choosePlace(idPlayer : Integer, number : Integer, message : String) : Place[*]
        + movePlayer(idPlayer : Integer) : Pair<Integer, Place>
        + swapJetons(idPlayer : Integer) : Pair<JetonSymbol, JetonSymbol>
        + associateCardNamesToPlaces(idPlayer : Integer, cardsToAssociate : Card[*]) : Map<Card, Place>
        + createTActionForAssociateCardNamesToPlaces( cardsToAssociate : Card[*]) : TAskAction
        + computeMapCardToPlaceFromMapCardNamesToPlace( cardNamePlaceMap : Map<CardName, Place>, cards : Card[*]) : Map<Card, Place>


176
    }
Killian LUCAS's avatar
Killian LUCAS committed
177

178
179

class RoomFactory{
180
    - {static} idCounter : AtomicInteger
181
    - {static} createRoom(playerId : String) : Room
182
183
184
}
....

185

186
187
188
189
=== Item

==== Action

190
191
192
193
194
.Package action
[plantuml]
....
package action{
    abstract class Action{
195
        {abstract} getActionType() : ActionType
196
197
    }

198
199
    class ActionAssociateCardNamesToPlaces{
        - cardNamePlaceMap : Map<CardName, Place>
200
        + getActionType() : ActionType
201
        + getCardNamePlaceMap : Map<CardName, Place>
202
203
204
    }

    class ActionChooseCard{
205
206
207
        - cards : Card[*]
        + getCards : Card[*]
        + getActionType() : ActionType
208
209
210
    }

    class ActionChoosePlace{
211
212
        - places : Place[*]
        + getPlaces() : Place[*]
213
        + getActionType() : ActionType
214
215
216
    }

    class ActionChoosePower{
217
218
219
        - idPowerChosen : Integer
        + getIdPowerChosen() : Integer
        + getActionType() : ActionType
220
221
    }

222
223
224
225
226
227
228
229
230
    class ActionContainer{
        - actions : Action[*]
        + add(action : Action) : Boolean
        + add(actions : Action[*]) : Boolean
        + doAction(action : Action) : Boolean
        + doAction(actions : Action[*]) : Boolean
        + isEmpty() : Boolean
    }

231
    class ActionMoveJeton{
232
        - jeton : JetonSymbol
233
        - place : Place
234
        + getJeton() : JetonSymbol
235
236
        + getPlace : Place
        + getActionType() : ActionType
237
238
239
    }

    class ActionMovePlayer{
240
241
242
243
244
        - idPlayer : Integer
        - place : Place
        + getIdPlayer() : Integer
        + getPlace() : Place
        + getActionType() : ActionType
245
246
247
    }

    class ActionSwapJeton{
248
249
250
251
        - jeton1 : JetonSymbol
        - jeton2 : JetonSymbol
        + getJeton1() : JetonSymbol
        + getJeton2() : JetonSymbol
252
        + getActionType() : ActionType
253
254
255
    }

    class ActionTargetPlayer{
256
257
258
        - idPlayer : Integer
        + getIdPlayer() : Integer
        + getActionType() : ActionType
259
260
261
262
263
264
265
266
267
268
269
    }

    enum ActionType{
        CHOOSE_POWER
        TARGET_PLAYER
        MOVE_PLAYER
        CHOOSE_CARD
        CHOOSE_PLACE
        SWAP_JETONS
        MOVE_JETON
        ASSOCIATE_SURVIVAL_CARDS_TO_PLACES
270
        SHOW_CARD
271
    }
272
273
274
275
276
277
     enum TPairType{
        NUMBER
        CARD
        PLACE
        JETON
        PLAYER
278
279
    }

280

281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
    Action <|-- ActionAssociateSurvivalCardsToPlaces
    Action <|-- ActionChooseCard
    Action <|-- ActionChoosePlace
    Action <|-- ActionChoosePower
    Action <|-- ActionMoveJeton
    Action <|-- ActionMovePlayer
    Action <|-- ActionSwapJeton
    Action <|-- ActionTargetPlayer
    ActionContainer "1" -- "*" Action
}
....


=== Board
.Package board
[plantuml]
....
package board{

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
    class Board{
        - boardDistribution : BoardDistribution
        - boardColor : BoardColor
        - score : Score
        + getScore() : Score
        + getBoardDistribution() : BoardDistribution
        + getBoardColor() : BoardColor
        + isArtemiaSquare() : Boolean
        + toString() : String
        - initializeScore(playerNumber : Integer)
        + isFinish() : boolean
        + getScoreTraque() : Integer
        + getScoreCreature() : Integer
        + actualBestTeam() : PlayerTeam
        + winner() : PlayerTeam
        - moveForwardTraque(delta : Integer)
        - moveForwardTraque()
        - moveBackTraque(delta : Integer)
        - moveBackTraque()
        - moveForwardCreature(delta : Integer)
        - moveForwardCreature()
        - moveBackCreature(delta : Integer)
        - moveBackCreature()

    }
325
326
327
328
329
330
    enum BoardColor{
        BLUE
        RED
        GREEN
        YELLOW
    }
331
332
333
334
    enum BoardDistribution{
        FRONT
        BACK
    }
335
336

    class Score{
337
338
        - scoreTraque : Integer
        - scoreCreature : Integer
339
        - winner : PlayerTeam
340
341
342
343
        + getScoreTraque() : Integer
        + getScoreCreature() : Integer
        + isFinish() : Boolean
        + actualBestTeam() : PlayerTeam
344
        + winner() : PlayerTeam
345
346
347
348
349
350
351
352
        + scoreCreatureGreaterThanBase() : Boolean
        + scoreTraqueGreaterThanBase() : Boolean
        + moveForwardTraque(delta : Integer)
        + moveBackTraque(delta : Integer)
        + moveForwardCreature(delta : Integer)
        + moveBackCreature(delta : Integer)
        + equals(o : Object) : Boolean
        + toString() : String
353
354
355
    }


356
    Board "1" o-- "1 score" Score
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
}
....

=== Card
.Package card
[plantuml]
....
package card{
    enum CardType{
        SURVIVAL
        TRACKING
        PLACE
    }

    abstract class Card{
372
        # name : String
Killian LUCAS's avatar
Killian LUCAS committed
373
        # CardName : String
374
375
        # description : String
        + getName() : String
Killian LUCAS's avatar
Killian LUCAS committed
376
        + getCardName() : String
377
        + getDescription() : String
Killian LUCAS's avatar
Killian LUCAS committed
378
        + getType() : String
379
380
        + equals(o : Object) : Boolean
        + {abstract} getType() : CardType
Killian LUCAS's avatar
Killian LUCAS committed
381
        + toString() : String
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
        + hashCode() : Integer
    }
    enum BoardDistribution{
        ANTRE, JUNGLE, RIVIERE, PLAGE, ROVER, MARAIS, ABRI, EPAVE, SOURCE, ARTEFACT,
    NEXUS, OASIS, FJORD, DOME, LABYRINTHE, MANGROVE, ARCHIPEL, POLE, FUNGI, PORTAIL,

    ACHARNEMENT, ANGOISSE, ANTICIPATION, CATACLYSME, CHAMP_DE_FORCE, CLONE, DEPLOIEMENT, DESESPOIR, DETOUR, DOMINATION, EFFROI,
    EMPRISE, EPIDEMIE, FAILLE_TEMPORELLE, FLASHBACK, GARGANTUA, HARCELEMENT, HURLEMENTS, INERTIE, INTERFERENCES, INTUITION,
    MAGNETISME, MIRAGE, MUTATION, PSYCHOSE, REMINISCENCE, REPERAGE, SABLES_MOUVANTS, SOIF_DE_SANG, STASE, TELEPATHIE,
    TORNADE, TOXINE, UBIQUITE, VIRUS, ZONE_INTERDITE,

    ADRENALINE, ALERTE, AMPLIFICATEUR, BROUILLAGE, CAVALE, DETECTEUR, DRONE, ENTRAVE, EQUIPEMENT, ESQUIVE,
    FAUSSE_PISTE, HOLOGRAMME, LEURRE, MIMETISME, NAVETTE, PLANQUES, PORTAIL_SURVIVAL, RALLIEMENT, REFUGE, REGENERATION,
    RESISTANCE, RETRAITE, RIPOSTE, SACRIFICE, SECOND_SOUFFLE, SIXIEME_SENS, SYSTEME_D, TENACITE, VACCIN, VOLTE_FACE,
    VORTEX
397
398
399
    }

    class PlaceCard {
400
401
402
403
404
405
406
        - number : Integer
        - imageUrl : String
        - color : String
        + getNumber() : Integer
        + getImageUrl() : String
        + getColor() : String
        + getType() : CardType
407
408
409
    }

    abstract class PlayerCard {
410
        # phase : Phase
411
        # phaseToApply : Phase
412
        + getPhase() : Phase
413
        + getPhaseToApply() : Phase
414
415
416
    }

    class SurvivalCard {
417
        + getType() : CardType
418
419
420
    }

    class TrackingCard {
Killian LUCAS's avatar
Killian LUCAS committed
421
        - symbols : List<JetonSymbol>
422
        + getType() : CardType
Killian LUCAS's avatar
Killian LUCAS committed
423
        + getJetons() : List<JetonSymbol>
424
        + containsSymbol(type : JetonSymbol) : boolean
Killian LUCAS's avatar
Killian LUCAS committed
425

426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
    }

    Card <|-- PlaceCard
    Card <|-- PlayerCard
    PlayerCard <|-- SurvivalCard
    PlayerCard <|-- TrackingCard
}
....



=== Jeton
.Package jeton
[plantuml]
....
package jeton{

443

444
445

    abstract class Jeton{
446
447
448
        # powers : PowerType
        + getPowers() : PowerType
        + {abstract} getType() : JetonSymbol
449
450
451
    }

    class JetonArtemia{
452
        + getType() : JetonSymbol
453
454
455
    }

    class JetonCreature{
456
        + getType() : JetonSymbol
457
458
459
    }

    class JetonCible{
460
461
462
463
464
465
        + getType() : JetonSymbol
    }
    enum JetonSymbol{
        CIBLE
        ARTEMIA
        CREATURE
466
467
468
    }

    class PlacedJeton{
469
470
471
472
        - jeton : Jeton
        - places : Place[*]
        + getJeton() : Jeton
        + getPlaces() : Place[*]
473
474
475
476
477
    }

    Jeton <|-- JetonArtemia
    Jeton <|-- JetonCreature
    Jeton <|-- JetonCible
478
    PlacedJeton "1" -- "1 jeton" Jeton
479
480
481
482
483
484
485
486
487
488

}
....

=== Pioche
.Package pioche
[plantuml]
....
package pioche{
    class Pioche <T extends PlayerCard>{
489
490
491
        - cards : T[*]
        - trash : T[*]
        - random : Random
492
        - mix()
493
        + draw() : T
494
        + draw(number : Integer) : T[*]
495
496
497
498
499
        - throwAway(cards : T[*])
        - throwAway(card : T)
        + getLastTrashCards(number : Integer) : T[*]
        + getTrash() : T[*]
        + getCards() : T[*]
500
501
502
503
504
505
506
507
508
    }
}
....

=== Planet
.Package planet
[plantuml]
....
package planet{
509
510
511
512
513
514
515
516
517
518
519
    class BeaconPawn{
        - state : Integer
        - nextState()
        + isActive() : Boolean
        + getType() : PawnType
        + maxMovesInOneRound() : Integer
    }
    enum PawnType{
        SHIELD
        BEACON
    }
520
521
522
523
524
525
526
527
528
529
530
531
532
    enum Place{
        PLACE_ONE
        PLACE_TWO
        PLACE_THREE
        PLACE_FOUR
        PLACE_FIVE
        PLACE_SIX
        PLACE_SEVEN
        PLACE_EIGHT
        PLACE_NINE
        PLACE_TEN
    }
    class PlaceDistribution{
533
534
535
        - mapCardNumberToPlaceCard : Map<Integer, PlaceCard>
        - mapPlaceCardToPlace : Map<PlaceCard, Place>
        - placeIsHidden : Map<Place, Boolean>
536
        - initialization(placeCards : PlaceCard[*])
537
        - initializePlaceCardsVisibility()
538
        - initializePlaces()
539
        + createPawn() : PlanetPawn
540
        + isValidPlacesForJeton(adjacentPlaces Place[*]) : boolean
541
542
543
544
545
546
        + placeToNumber(place : Place) : Integer
        + numberToPlace(number : Integer) : Place
        + isAdjacentPlaces(place1 : Integer, place2 : Integer) : Boolean
        + isAdjacentPlaces(place1 : Place, place2 : Place) : Boolean
        + isValidPlacesForJeton(adjacentPlacesCard : PlaceCard[*]) : Boolean
        + placeCardToPlace(card : PlaceCard) : Place
547
        + placeToPlaceCard(card : PlaceCard) : PlaceCard
548
549
550
551
        + useCardLabyrinthe() : Boolean
        + useCardDome() : Boolean
        + useCardPole() : Boolean
        + getPlaceCardsInInterval(a : Integer, b : Integer) : PlaceCard[*]
552
553
554
555
556
557
558
559
        + getPlaceCards() : PlaceCard[*]
        + isHiddenCards() : boolean
        + getHiddenCards() : PlaceCard[*]
        + getHiddenPlaces() : Place[*]
        - revealPlace(place : Place)
        - revealPlace(placeCard : PlaceCard)
        + isRevealedPlace(place : Place)
        + isRevealedPlace(placeCard : PlaceCard)
560
561
    }
    class Planet{
562
        - mapPlaceToJetons : Map<Place, JetonSymbol[*]>
563
        - blockedPlaces : Map<Place, Boolean>
Killian LUCAS's avatar
Killian LUCAS committed
564
        - placeSurvivalCardMap : Map<Place, SurvivalCard[*]>
565
        - numberMovesAllowInRound : Integer
566
567
        - placeDistribution : PlaceDistribution
        - planetPawn : PlanetPawn
568
        - epaveUsedInTheRound : Boolean
569
        + getPlaceDistribution() : PlaceDistribution
570
571
        + reset()
        + placeJeton(placedJeton : PlacedJeton)
Killian LUCAS's avatar
Killian LUCAS committed
572
573
        + findPlacesWhereJetonIs(symbol : JetonSymbol) : Place[*]
        + findPlaceCardsWhereJetonIs(symbol : JetonSymbol) : PlaceCard[*]
574
575
576
577
        - removeJeton(symbol : JetonSymbol)
        - blockPlaces(places : Place[*])
        - blockPlaces(place : Place)
        - blockPlaces(placeCard : PlaceCard)
578
579
        + isBlockedPlace(card : PlaceCard) : Boolean
        + isJetonOnPlace(place : Place) : Boolean
580
        + isJetonOnPlace(placeCard : PlaceCard) : Boolean
581
582
583
        + findJetonsSymbolsOnCard(placeCard : PlaceCard) : JetonSymbol[*]
        + isJetonSymbolOnPlaceCard(symbol : JetonSymbol,placeCard : PlaceCard) : boolean
        + getPlanetPawn() : PlanetPawn
584
        + canMovePlanetPawn() : Boolean
585
586
587
588
589
590
        + movePlanetPawn() : Boolean
        - forceMovePlanetPawn()
        - moveBackPlanetPawn()
        - resetPawn()
        - placesWhereJetonCreatureIs() : PlaceCard[*]
        - getPlaceCardsInInterval(a : Integer, b : Integer) : PlaceCard[*]
591
        + planetPawnIsActive() : Boolean
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
        + getPlanetPawnType() : PawnType
        + canUseEpavePower() : boolean
        - setEpavePowerToUsed()
        + placeToPlaceCard(place : Place) : PlaceCard
        + isASurvivalCardOnPlace(place : Place) : boolean
        + isASurvivalCardOnPlace(placeCard : PlaceCard) : boolean
        + takeSurvivalCardOnPlace(place : Place) : SurvivalCard
        + takeSurvivalCardOnPlace(placeCard : PlaceCard) : SurvivalCard
        - putSurvivalCardOnPlace(pair : Pair<Place, SurvivalCard>)
        - putSurvivalCardOnPlace(pair : (Pair<Place, SurvivalCard>)[*])
        + placeToNumber(place : Place) : Integer
        + numberToPlace(number : Integer) : Place
        + isAdjacentPlaces(place1 : Integer, place2 : Integer) : boolean
        + isAdjacentPlaces(placeCard : PlaceCard, place : Place) : boolean
        + isAdjacentPlaces(placeCard1 : PlaceCard, placeCard1 : PlaceCard) : boolean
        + isAdjacentPlaces(place1 : Place, place2 : Place) : boolean
        + isHiddenCards() : boolean
        + getHiddenCards() : PlaceCard[*]
        + getHiddenPlaces() : Place[*]
        - revealPlace(place : Place)
        - revealPlace(placeCard : PlaceCard)
        + isRevealedPlace(place : Place): boolean
        + isRevealedPlace(placeCard : PlaceCard): boolean
        - swapJeton(symbol1 : JetonSymbol, symbol2 : JetonSymbol)
616
617
    }

618
    abstract class PlanetPawn{
619
620
621
        + {abstract} getType() : PawnType
        - {abstract} nextState()
        - previousState()
622
        + {abstract} isActive() : Boolean
623
624
        + {abstract} maxMovesInOneRound() : Integer
        - reset()
625
626
627
628
629
630
    }



    class ShieldPawn{
        - location : Integer
631
632
633
634
        - hasReachDome : boolean
        + getLocation() : Integer
        - nextState()
        - previousState()
635
        + isActive() : Boolean
636
637
638
        + getType() : PawnType
        + maxMovesInOneRound() : Integer
        - reset()
639
640
641
    }


642
643
    Planet "1" -- "1 placeDistribution" PlaceDistribution
    Planet "1" -- "1 planetPawn" PlanetPawn
644
645
646
647
648
649
650
651
652
653
654
    PlanetPawn <|-- ShieldPawn
    PlanetPawn <|-- BeaconPawn
}
....


=== Player
.Package player
[plantuml]
....
package player{
655
656
657
658
    enum PlayerTeam{
        CREATURE
        TRAQUE
    }
659
    abstract class Player{
660
661
        # name : String
        # inGameId : Integer
662
        # Phase : currentPhase
663
664
        + getName() : String
        + getInGameId() : Integer
665
666
667
668
        + getCurrentPhase() : Phase
        + {abstract} getTeam() : PlayerTeam
        - setCurrentPhase(currentPhase : Phase)
        + teamEqualsTo(team : PlayerTeam) : boolean
669
670
671
    }

    class Traque{
672
        - numberWillingness : Integer
673
674
675
676
        - hand : HandTraque
        - rights : TraqueRight
        - placeCardsPlayedAfterMoving : PlaceCard[*]
        - placeCardsPlayedAndVisible : PlaceCard[*]
677
        + getNumberWillingness() : Integer
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
        + getMaxWillingness() : Integer
        + getHand() : HandTraque
        + getRights() : TraqueRight
        - addWillingness(delta : Integer)
        - subWillingness(delta : Integer)
        - incrementWillingness()
        - decrementWillingness()
        - fillWillingness()
        - addPlaceCardsAfterMoving(placeCard : PlaceCard)
        - addPlaceCardsAfterMoving(placeCards : PlaceCard[*])
        + getPlaceCardsPlayedAndVisible() : PlaceCard[*]
        - addPlaceCardsPlayedAndVisible(placeCard : PlaceCard)
        - addPlaceCardsPlayedAndVisible(placeCards : PlaceCard[*])
        - reset()
        + getTeam() : PlayerTeam
        + getPlaceCards() : PlaceCard[*]
        + getPlaceCardsPlayed() : PlaceCard[*]
        + getDefausse() : PlaceCard[*]
        - setPlaceCards(placeCards : PlaceCard[*])
        - setDefausse(placeCards : PlaceCard[*])
        + placeCardHandSize() : Integer
        + placeCardIsEmpty() : boolean
        + defausseSize() : Integer
        + defausseIsEmpty() : boolean
        + placeCardPlayedSize() : Integer
        + placeCardPlayedIsEmpty() : boolean
        + throwAwayPlaceCard() : boolean
        + throwAwayPlaceCard(placeCard : PlaceCard) : boolean
        + throwAwayPlaceCard(placeCards : PlaceCard[*]) : boolean
        + takeBackPlaceCard(placeCard : PlaceCard) : boolean
        + takeBackPlaceCard(placeCards : PlaceCard[*]) : boolean
        - takeBackAllPlaceCardFromDefausse()
        + addPlaceCard(placeCard : PlaceCard) : boolean
        + addPlaceCard(placeCards : PlaceCard[*]) : boolean
        + addPlaceCardInDefausse(placeCard : PlaceCard) : boolean
        + addPlaceCardInDefausse(placeCards : PlaceCard[*]) : boolean
        + playPlaceCard(placeCard : PlaceCard) : boolean
        + playPlaceCard(placeCards : PlaceCard[*]) : boolean
        + getSurvivalCardsHand() : SurvivalCard[*]
        + getSurvivalCardsPlayed() : SurvivalCard[*]
        + survivalCardHandSize() : Integer
        + survivalCardPlayedSize() : Integer
        + survivalCardIsEmpty() : boolean
        + survivalCardPlayedIsEmpty() : boolean
        - clearSurvivalCardPlayed()
        + addSurvivalCard(survivalCard : SurvivalCard) : boolean
        + addSurvivalCard(survivalCards : SurvivalCard[*]) : boolean
        + removeSurvivalCard(survivalCard : SurvivalCard) : boolean
        + removeSurvivalCard(survivalCards : SurvivalCard[*]) : boolean
        + playSurvivalCard(survivalCard : SurvivalCard) : boolean
        + playSurvivalCard(survivalCards : SurvivalCard[*]) : boolean
        - addSurvivalCardToApplied(survivalCard : SurvivalCard)
        - removeSurvivalCardToApplied(survivalCard : SurvivalCard)
        - removeSurvivalCardToApplied(survivalCards : SurvivalCard[*])
        + getSurvivalCardsToApplied() : SurvivalCard[*]
        - resetRight()
        + getMaxPlacesCardChoosable() : Integer
        - setMaxPlacesCardChoosable(maxPlacesCardChoosable : Integer)
        + getMaxPlacesCardPlayable() : Integer
        - setMaxPlacesCardPlayable(maxPlacesCardPlayable : Integer)
        + getMaxSurvivalCardPlayable() : Integer
        - setMaxSurvivalCardPlayable(maxSurvivalCardPlayable : Integer)
        + canResist() : boolean
        - setCanResist(canResist : boolean)
        + canGiveUp() : boolean
        - setCanGiveUp(canGiveUp : boolean)
        + getPlaceCardsVisible() : Integer
        - setPlaceCardsVisible(placeCardsVisible : Integer)
        + canResist() : Integer
        - setCanResist(number : Integer)

749
750
751
    }

    class Creature{
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
        - hand : HandCreature
        - rights : CreatureRight
        + getHand() : HandCreature
        + getRights() : CreatureRight
        + getTeam() : PlayerTeam
        - reset()
        - initializationJeton()
        + jetonsSize() : Integer
        + jetonsPlayedSize() : Integer
        + jetonsIsEmpty() : boolean
        + getJetons() : JetonSymbol[*]
        + playJeton(jeton : JetonSymbol) : boolean
        + playJeton(jetons : JetonSymbol[*]) : boolean
        + jetonsPlayedIsEmpty() : boolean
        + getMaxTrackingCards() : Integer
        + getTrackingCardHand() : TrackingCard[*]
        + getTrackingCardsPlayed() : TrackingCard[*]
        + trackingCardHandSize() : Integer
        + trackingCardPlayedSize() : Integer
        + trackingCardIsEmpty() : Boolean
        + trackingCardPlayedIsEmpty() : Boolean
        - clearTrackingCardPlayed()
        + addTrackingCard(trackingCard : TrackingCard) : Boolean
        + addTrackingCard(trackingCards : TrackingCard[*]) : Boolean
        + removeTrackingCard(trackingCard : TrackingCard) : Boolean
        + removeTrackingCard(trackingCards : TrackingCard[*]) : Boolean
        + playTrackingCard(trackingCard : TrackingCard) : Boolean
        + playTrackingCard(trackingCards : TrackingCard[*]) : Boolean
        - addTrackingCardToApplied(trackingCard : TrackingCard)
        - addTrackingCardToApplied(trackingCards : TrackingCard[*])
        - removeTrackingCardToApplied(trackingCard : TrackingCard)
        - removeTrackingCardToApplied(trackingCards : TrackingCard[*])
        - setMaxTrackingCardPlayable(maxTrackingCardPlayable : Integer)
        + getTrackingCardToApplied() : TrackingCard[*]
        + getMaxTrackingCardPlayable() : Integer



    }

    package rights{
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
        class TraqueRight{
            - maxPlacesCardChoosable : Integer
            - placeCardsVisible : Integer
            - maxPlacesCardPlayable : Integer
            - maxSurvivalCardPlayable : Integer
            - canResist : boolean
            - canGiveUp : boolean
            - numberOfAdditionalCardsTakeBackPerPawnWillingnessLostWithResist : Integer
            - reset()
            + getMaxPlacesCardChoosable() : Integer
            - setMaxPlacesCardChoosable(maxPlacesCardChoosable : Integer)
            + getMaxPlacesCardPlayable() : Integer
            - setMaxPlacesCardPlayable(maxPlacesCardPlayable : Integer)
            + getMaxSurvivalCardPlayable() : Integer
            - setMaxSurvivalCardPlayable(maxSurvivalCardPlayable : Integer)
            + getPlaceCardsVisible() : Integer
            - setPlaceCardsVisible(placeCardsVisible : Integer)
            + getNumberOfAdditionalCardsTakeBackPerPawnWillingnessLostWithResist() : Integer
            - setNumberOfAdditionalCardsTakeBackPerPawnWillingnessLostWithResist(number : Integer)
            + canResist() : boolean
            - setCanResist(canResist : boolean)
            + canGiveUp() : boolean
            - setCanGiveUp(canGiveUp : boolean)

817
818
        }

819
820
821
822
823
        class CreatureRight{
            - maxTrackingCardPlayable : Integer
            + getMaxTrackingCardPlayable() : Integer
            - setMaxTrackingCardPlayable(maxTrackingCardPlayable : Integer)
            - reset()
824
825
826
        }
    }

827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
    package hand{
        class Deck <T extends PlayerCard>{
            - cards : T[*]
            - playedCards : T[*]
            - maxCards : Integer
            + getMaxCards(): Integer
            + getCards(): T[*]
            + getPlayedCards(): T[*]
            - clear()
            + add(card : T) : Boolean
            + add(cardList : T[*]) : Boolean
            + remove(card : T) : Boolean
            + remove(cardList : T[*]) : Boolean
            + playCard(card : T) : T
            + playCard(cardList : T[*]): T[*]
            + handSize(): Integer
            + playedCardSize(): Integer
            + handIsEmpty(): boolean
            + playedCardIsEmpty(): boolean

        }

        class PlaceCardDeck{
            - placeCards : PlaceCard[*]
            - defausse : PlaceCard[*]
            + throwAway(placeCard : PlaceCard) : Boolean
            + throwAway(placeCards : PlaceCard[*]) : Boolean
            + takeBack(placeCard : PlaceCard) : Boolean
            + takeBack(placeCards : PlaceCard[*]) : Boolean
            + add(card : PlaceCard) : Boolean
            + add(cards : PlaceCard[*]) : Boolean
            + addInDefausse(card : PlaceCard) : Boolean
            + addInDefausse(cards : PlaceCard[*]) : Boolean
            + play(card : PlaceCard) : Boolean
            + play(cards : PlaceCard) : Boolean
        }

        abstract class Hand{}

        class HandCreature{
            - trackingCards : Deck<TrackingCard>
            - jetons : JetonSymbol[*]
            - jetonSymbolsPlayed : JetonSymbol[*]
            - trackingCardsToApplied : TrackingCard[*]
            - initializationJeton()
            - addTrackingCardToApplied(trackingCard : TrackingCard)
            - addTrackingCardToApplied(trackingCards : TrackingCard[*])
            - removeTrackingCardToApplied(trackingCard : TrackingCard)
            - removeTrackingCardToApplied(trackingCards : TrackingCard[*])
            + getTrackingCardToApplied() : TrackingCard[*]
            + getJetonSymbolsPlayed() : JetonSymbol[*]
            + getJetonSymbols() : JetonSymbol[*]
            + playJeton(jeton : Jeton) : Boolean
            + playJeton(jetons : Jeton[*]) : Boolean
            + jetonsSize() : Integer
            + jetonsPlayedSize() : Integer
            + jetonsIsEmpty() : boolean
            + jetonsPlayedIsEmpty() : boolean
            + getMaxTrackingCards() : Integer
            + getTrackingCardsDeck() : Deck<TrackingCard>
            + getTrackingCardHand() : TrackingCard[*]
            + getTrackingCardsPlayed() : TrackingCard[*]
            + trackingCardHandSize() : Integer
            + trackingCardPlayedSize() : Integer
            + trackingCardIsEmpty() : boolean
            + trackingCardPlayedIsEmpty() : boolean
            - clearTrackingCardPlayed()
            + addTrackingCard(trackingCard : TrackingCard) : boolean
            + addTrackingCard(cardList : TrackingCard[*]) : boolean
            + removeTrackingCard(trackingCard : TrackingCard) : boolean
            + removeTrackingCard(cardList : TrackingCard[*]) : boolean
            + playTrackingCard(trackingCard : TrackingCard) : boolean
            + playTrackingCard(cardList : TrackingCard[*]) : boolean

        }

        class HandTraque{
            - survivalCards : Deck<SurvivalCard>
            - placeCards PlaceCardDeck
            + getSurvivalCards() : Deck<SurvivalCard>
            + getPlaceCards() : PlaceCardDeck
        }

        Hand <|-- HandCreature
        Hand <|-- HandTraque

        HandTraque "1" -- "1" PlaceCardDeck
        HandCreature "1" -- "1" Deck
        HandTraque "1" -- "1" Deck
    }
917
918
919
920

    Player <|-- Creature
    Player <|-- Traque

921
922
    PlayerStatus <|-- CreatureRight
    PlayerStatus <|-- TraqueRight
923

924
925
    Creature "1" - "1" CreatureRight
    Traque "1" - "1" TraqueRight
926
927
}

928
929
930
....


931
932


933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
=== Power
.Package power
[plantuml]
....
package power{
    class Power{

    }

    class PowerContainer{

    }

    PowerContainer "1" -- "*" Power
}
....


=== Utilitary
.Package utilitary
[plantuml]
....
package utilitary{
    package request{
        enum GameRequestType{
            JOIN
        }

        abstract class GameRequest{
962
            + {abstract} getType() : GameRequestType
963
964
965
        }

        class GameJoinRequest{
966
967
968
969
970
            - playerId : String
            - id : Integer
            + getPlayerID() : Integer
            + getId() : Integer
            + getType() : GameRequestType
971
972
973
974
        }
    }

    class RequestConversion{
975
976
977
978
979
980
981
982
983
984
        - {static} DATABASE : NotAloneDatabase
        + {static} toPhase(s : String) : Phase
        + {static} toPhase(tphase : TPhaseId) : Phase
        + {static} toBoardColor(s : String) : BoardColor
        + {static} toBoardColor(color : TColor) : BoardColor
        + {static} toBoardDistribution(s : String) : BoardDistribution
        + {static} toBoardDistribution(tBoard : TBoard) : BoardDistribution
        + {static} toCardType(s : String) : CardType
        + {static} toCard(tCard : TCard) : Card
        + {static} toPlaceCardList(cards : TCards[*]) : PlaceCard[*]
985
986
987
988
989
990
991
992
993
994
995
    }
}
GameRequest <|-- GameJoinRequest
....

=== GameController
.Package gamecontroller
[plantuml]
....
package gamecontroller{
    interface GameControllerInteface{
996
997
998
999
1000
1001
1002
        + isFinish() : Boolean
        + apply(power : Power)
        + apply(powers : PowerContainer)
        + playerHasFinished(playerId : Integer, phase : Phase)
        + phaseIsFinish() : Boolean
        + playerPlayCard(playerId : Integer, card : Card)
        + playerPlayCard(playerId : Integer, cards : Card[*])
1003

1004
1005
        + playerPlaceJeton(playerId : Integer, jeton : PlacedJeton)
        + playerPlaceJeton(playerId : Integer, jetons : PlacedJeton[*])
1006

1007
1008
1009
        + playerResist(playerId : Integer)
        + playerGiveUp(playerId : Integer)
        + playerChooseAction(playerID : Integer, action : Action)
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
    }
}
....


=== Game
.Game
[plantuml]
....
class Game{
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
    -  requests : BlockingQueue<GameRequest>
    - numberPlayers : AtomicInteger
    - gameId : String
    - gameCreatorId : String
    - planet : Planet
    - board : Board
    - players : Map<String, Pair<Integer, PlayerTeam>>
    - isStart : Boolean
    - isClose : Boolean
    - play : Thread
    + getGameId() : String
    + getPlayers() : Map<String, Pair<Integer, PlayerTeam>>
    + getPlanet() : Planet
    + isCreator(playerId : String) : Boolean
    + join(playerId : String) : Response
    + start(playerId :String) : Response
    - requestManagement()
    - handleRequest(request : GameRequest)
1038
1039
1040
}

class GameFactory{
1041
1042
    - {static} idCounter : AtomicInteger
    - {static} createGame(playerId : String, board : Board, planet : Planet) : Game
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
}

....


=== Divers

=== Player
.Divers
[plantuml]
....
enum Phase{
    PREPHASE_1
    PHASE_1
    POSTPHASE_1
    PREPHASE_2
    PHASE_2
    POSTPHASE_2
    PREPHASE_3
    PHASE_3
    POSTPHASE_3
    PREPHASE_4
    PHASE_4
    POSTPHASE_4
}

class Reserve{
1070
1071
1072
1073
    - placeCards : Map<Integer, Pair<PlaceCard, Integer>>
    - copiesNumber(playerNumber : Integer) : Integer
    + notEmpty(cardNumber : Integer) : Boolean
    + pick(cardNumber : Integer) : PlaceCard
1074
1075
1076
1077
1078
1079
}

....


== Game Server (example)
1080
1081
1082
1083
1084
1085
1086
1087
1088

.GameSever
[plantuml]
....
interface GameServer {
    createGame(numberOfPlayers : Integer): Integer
    join(gameId : Integer): Integer
}

1089
package room {
1090
1091
1092
1093
    class "GameServerController" as controller {
        createGame(numberOfPlayers : Integer): Integer
        join(gameId : Integer): Integer
    }
1094
    class "Game \n[Thread]" as room {
1095
1096
1097
1098
1099
1100
1101
        id : Integer {id}
        numberOfPlayers : Integer
    }
    class "Player" as player {
        id : Integer {id}
    }
    GameServer <|-- controller
1102
1103
    controller *- "[*] games" room : \t\t\t
    room *-- "[0..7] players" player
1104
}
1105
note right of room: Uncompleted!
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
....

[plantuml]
....
state Game {
    [*] --> Created
    Created -> Started : start()
    Started -> Phase1 : \t
    Phase1 --> [*]
}
note right of Game : Uncompleted!
....

=== Opérations du GameServerController

.Create Game
[source,OCL]
----
GameServerController::createGame(numberOfPlayers : Integer): Integer
pre:
    numberOfPlayers > 1 and numberOfPlayers <= 7

post:
    self.games -> exists(each | each.isOclNew())and
1130
    room.oclinState(Created)
1131
1132
1133
1134
1135
1136
1137
1138
1139
----

.Join Game
[source,OCL]
----
GameServerController::join(gameId : Integer): Integer
pre:
    self.games -> exists(each | each.id = gameId)
post:
1140
1141
    let room = self.games->select(id = gameId)->first() in
    room.players->exists(each| each.isOclNew())
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
----

.Start Game
[plantuml]
----
partition Game::run() {
    start
    while (enough players?)
        :JoinRequest<
        :handleRequest();
    endwhile
    :Game Start>
    stop
}
1156
----