conception.adoc 29.3 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
    }

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


436
=== Hand TODO
437
438
439
440
441
.Package hand
[plantuml]
....
package hand{
    class Deck <T extends PlayerCard>{
442
443
444
445
446
447
        - cards : T[*]
        - maxCards : Integer
        + add(card : T) : Boolean
        + add(cards : T[*]) : Boolean
        + playCard(card : T) : T
        + playCard(cards : T[*]): T[*]
448
449
450
    }

    class PlaceCardDeck{
451
452
453
454
455
456
457
458
459
460
461
462
        - 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
463
464
465
466
467
    }

    abstract class Hand{}

    class HandCreature{
468
469
470
471
472
473
        - trackingCards : Deck<TrackingCard>
        - jetons : Set<Jeton>
        + initializationJeton()
        + getTrackingCards() : Deck<TrackingCard>
        + playJeton(jeton : Jeton) : Jeton
        + playJeton(jetons : Set<Jeton>) : Set<Jeton>
474
475
476
    }

    class HandTraque{
477
478
479
480
        - survivalCards : Deck<SurvivalCard>
        - placeCards PlaceCardDeck
        + getSurvivalCards() : Deck<SurvivalCard>
        + getPlaceCards() : PlaceCardDeck
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
    }

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

    HandTraque "1" -- "1" PlaceCardDeck
    HandCreature "1" -- "1" Deck
    HandTraque "1" -- "1" Deck
}
....

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

498

499
500

    abstract class Jeton{
501
502
503
        # powers : PowerType
        + getPowers() : PowerType
        + {abstract} getType() : JetonSymbol
504
505
506
    }

    class JetonArtemia{
507
        + getType() : JetonSymbol
508
509
510
    }

    class JetonCreature{
511
        + getType() : JetonSymbol
512
513
514
    }

    class JetonCible{
515
516
517
518
519
520
        + getType() : JetonSymbol
    }
    enum JetonSymbol{
        CIBLE
        ARTEMIA
        CREATURE
521
522
523
    }

    class PlacedJeton{
524
525
526
527
        - jeton : Jeton
        - places : Place[*]
        + getJeton() : Jeton
        + getPlaces() : Place[*]
528
529
530
531
532
    }

    Jeton <|-- JetonArtemia
    Jeton <|-- JetonCreature
    Jeton <|-- JetonCible
533
    PlacedJeton "1" -- "1 jeton" Jeton
534
535
536
537
538
539
540
541
542
543

}
....

=== Pioche
.Package pioche
[plantuml]
....
package pioche{
    class Pioche <T extends PlayerCard>{
544
545
546
        - cards : T[*]
        - trash : T[*]
        - random : Random
547
        - mix()
548
        + draw() : T
549
        + draw(number : Integer) : T[*]
550
551
552
553
554
        - throwAway(cards : T[*])
        - throwAway(card : T)
        + getLastTrashCards(number : Integer) : T[*]
        + getTrash() : T[*]
        + getCards() : T[*]
555
556
557
558
559
560
561
562
563
    }
}
....

=== Planet
.Package planet
[plantuml]
....
package planet{
564
565
566
567
568
569
570
571
572
573
574
    class BeaconPawn{
        - state : Integer
        - nextState()
        + isActive() : Boolean
        + getType() : PawnType
        + maxMovesInOneRound() : Integer
    }
    enum PawnType{
        SHIELD
        BEACON
    }
575
576
577
578
579
580
581
582
583
584
585
586
587
    enum Place{
        PLACE_ONE
        PLACE_TWO
        PLACE_THREE
        PLACE_FOUR
        PLACE_FIVE
        PLACE_SIX
        PLACE_SEVEN
        PLACE_EIGHT
        PLACE_NINE
        PLACE_TEN
    }
    class PlaceDistribution{
588
589
590
        - mapCardNumberToPlaceCard : Map<Integer, PlaceCard>
        - mapPlaceCardToPlace : Map<PlaceCard, Place>
        - placeIsHidden : Map<Place, Boolean>
591
        - initialization(placeCards : PlaceCard[*])
592
        - initializePlaceCardsVisibility()
593
        - initializePlaces()
594
        + createPawn() : PlanetPawn
595
        + isValidPlacesForJeton(adjacentPlaces Place[*]) : boolean
596
597
598
599
600
601
        + 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
602
        + placeToPlaceCard(card : PlaceCard) : PlaceCard
603
604
605
606
        + useCardLabyrinthe() : Boolean
        + useCardDome() : Boolean
        + useCardPole() : Boolean
        + getPlaceCardsInInterval(a : Integer, b : Integer) : PlaceCard[*]
607
608
609
610
611
612
613
614
        + getPlaceCards() : PlaceCard[*]
        + isHiddenCards() : boolean
        + getHiddenCards() : PlaceCard[*]
        + getHiddenPlaces() : Place[*]
        - revealPlace(place : Place)
        - revealPlace(placeCard : PlaceCard)
        + isRevealedPlace(place : Place)
        + isRevealedPlace(placeCard : PlaceCard)
615
616
    }
    class Planet{
617
618
        - mapPlaceToJetons : Map<Place, Jeton[*]>
        - blockedPlaces : Map<Place, Boolean>
Killian LUCAS's avatar
Killian LUCAS committed
619
        - placeSurvivalCardMap : Map<Place, SurvivalCard[*]>
620
        - numberMovesAllowInRound : Integer
621
622
        - placeDistribution : PlaceDistribution
        - planetPawn : PlanetPawn
623
        - epaveUsedInTheRound : Boolean
624
        + getPlaceDistribution() : PlaceDistribution
625
626
        + reset()
        + placeJeton(placedJeton : PlacedJeton)
Killian LUCAS's avatar
Killian LUCAS committed
627
628
        + findPlacesWhereJetonIs(symbol : JetonSymbol) : Place[*]
        + findPlaceCardsWhereJetonIs(symbol : JetonSymbol) : PlaceCard[*]
629
630
631
632
        - removeJeton(symbol : JetonSymbol)
        - blockPlaces(places : Place[*])
        - blockPlaces(place : Place)
        - blockPlaces(placeCard : PlaceCard)
633
634
635
636
        + isBlockedPlace(card : PlaceCard) : Boolean
        + isJetonOnPlace(place : Place) : Boolean
        + isJetonOnPlace(card : PlaceCard) : Boolean
        + findJetonsOnCard(card : PlaceCard) : Jeton[*]
637
638
639
        + findJetonsSymbolsOnCard(placeCard : PlaceCard) : JetonSymbol[*]
        + isJetonSymbolOnPlaceCard(symbol : JetonSymbol,placeCard : PlaceCard) : boolean
        + getPlanetPawn() : PlanetPawn
640
        + canMovePlanetPawn() : Boolean
641
642
643
644
645
646
        + movePlanetPawn() : Boolean
        - forceMovePlanetPawn()
        - moveBackPlanetPawn()
        - resetPawn()
        - placesWhereJetonCreatureIs() : PlaceCard[*]
        - getPlaceCardsInInterval(a : Integer, b : Integer) : PlaceCard[*]
647
        + planetPawnIsActive() : Boolean
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
        + 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)
        + createJeton(symbol : JetonSymbol) : Jeton
673
674
    }

675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
    abstract class PlanetPawn{
        # powers : PowerContainer
        + getPowers() : PowerContainer
        + {abstract} nextState()
        + {abstract} isActive() : Boolean
    }



    class ShieldPawn{
        - location : Integer
        + nextState()
        + isActive() : Boolean
    }


691
692
    Planet "1" -- "1 placeDistribution" PlaceDistribution
    Planet "1" -- "1 planetPawn" PlanetPawn
693
694
695
696
697
698
699
700
701
702
703
704
705
    PlanetPawn <|-- ShieldPawn
    PlanetPawn <|-- BeaconPawn
}
....


=== Player
.Package player
[plantuml]
....
package player{

    abstract class Player{
706
707
708
709
710
711
712
713
        # name : String
        # inGameId : Integer
        # status : PlayerStatus
        # hand : Hand
        + getName() : String
        + getInGameId() : Integer
        + getStatus() : PlayerStatus
        + getHand() : Hand
714
715
716
    }

    class Traque{
717
718
719
720
721
722
        - numberWillingness : Integer
        + getNumberWillingness() : Integer
        + addWillingness(delta : Integer)
        + subWillingness(delta : Integer)
        + incrementWillingness()
        + decrementWillingness()
723
724
725
726
727
728
729
730
    }

    class Creature{

    }

    package playerstatus{
        abstract class PlayerStatus{
731
732
733
734
735
            # currentPhase : Phase
            # expectedAction : ActionContainer
            + getCurrentPhase() : Phase
            + setCurrentPhase(phase : Phase)
            + getExpectedAction() : ActionContainer
736
737
738
        }

        class TraqueStatus{
739
740
741
742
743
744
745
746
747
            - survivalCardsPlayed : SurvivalCard[*]
            - placeCardsPlayed : PlaceCard[*]
            + getSurvivalCardsPlayed() :  SurvivalCard[*]
            + getPlaceCardsPlayed() : PlaceCard[*]
            + playSurvivalCard(survivalCard : SurvivalCard)
            + playSurvivalCard(survivalCards : SurvivalCard[*])
            + playPlaceCard(placeCard : PlaceCard)
            + playPlaceCard(placeCards : PlaceCard[*])
            + clear()
748
749
750
        }

        class CreatureStatus{
751
752
753
754
755
756
757
758
759
            - trackingCardsPlayed : TrackingCard[*]
            - jetonsPlayed : Jeton[*]
            + getTrackingCardsPlayed() : TrackingCard[*]
            + getJetonsPlayed() : Jeton[*]
            + playTrackingCard(trackingCard : TrackingCard)
            + playTrackingCard(trackingCards : TrackingCard[*])
            + playJeton(placeCard : Jeton)
            + playJeton(placeCards : Jeton[*])
            + clear()
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
793
794
795
796
797
798
799
800
801
802
803
        }
    }

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

    PlayerStatus <|-- CreatureStatus
    PlayerStatus <|-- TraqueStatus

    Creature "1" - "1" CreatureStatus
    Traque "1" - "1" TraqueStatus
}

....

=== 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{
804
            + {abstract} getType() : GameRequestType
805
806
807
        }

        class GameJoinRequest{
808
809
810
811
812
            - playerId : String
            - id : Integer
            + getPlayerID() : Integer
            + getId() : Integer
            + getType() : GameRequestType
813
814
815
816
        }
    }

    class RequestConversion{
817
818
819
820
821
822
823
824
825
826
        - {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[*]
827
828
829
830
831
832
833
834
835
836
837
    }
}
GameRequest <|-- GameJoinRequest
....

=== GameController
.Package gamecontroller
[plantuml]
....
package gamecontroller{
    interface GameControllerInteface{
838
839
840
841
842
843
844
        + 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[*])
845

846
847
        + playerPlaceJeton(playerId : Integer, jeton : PlacedJeton)
        + playerPlaceJeton(playerId : Integer, jetons : PlacedJeton[*])
848

849
850
851
        + playerResist(playerId : Integer)
        + playerGiveUp(playerId : Integer)
        + playerChooseAction(playerID : Integer, action : Action)
852
853
854
855
856
857
858
859
860
861
    }
}
....


=== Game
.Game
[plantuml]
....
class Game{
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
    -  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)
880
881
882
}

class GameFactory{
883
884
    - {static} idCounter : AtomicInteger
    - {static} createGame(playerId : String, board : Board, planet : Planet) : Game
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
}

....


=== 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{
912
913
914
915
    - placeCards : Map<Integer, Pair<PlaceCard, Integer>>
    - copiesNumber(playerNumber : Integer) : Integer
    + notEmpty(cardNumber : Integer) : Boolean
    + pick(cardNumber : Integer) : PlaceCard
916
917
918
919
920
921
}

....


== Game Server (example)
922
923
924
925
926
927
928
929
930

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

931
package room {
932
933
934
935
    class "GameServerController" as controller {
        createGame(numberOfPlayers : Integer): Integer
        join(gameId : Integer): Integer
    }
936
    class "Game \n[Thread]" as room {
937
938
939
940
941
942
943
        id : Integer {id}
        numberOfPlayers : Integer
    }
    class "Player" as player {
        id : Integer {id}
    }
    GameServer <|-- controller
944
945
    controller *- "[*] games" room : \t\t\t
    room *-- "[0..7] players" player
946
}
947
note right of room: Uncompleted!
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
....

[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
972
    room.oclinState(Created)
973
974
975
976
977
978
979
980
981
----

.Join Game
[source,OCL]
----
GameServerController::join(gameId : Integer): Integer
pre:
    self.games -> exists(each | each.id = gameId)
post:
982
983
    let room = self.games->select(id = gameId)->first() in
    room.players->exists(each| each.isOclNew())
984
985
986
987
988
989
990
991
992
993
994
995
996
997
----

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