Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
naomod
Object-Oriented Software Analysis and Design (OOAD)
Projet 2020 - Not Alone
Commits
f66cdd5c
Commit
f66cdd5c
authored
Dec 05, 2020
by
Corentin Guillevic
Browse files
Remove Jeton, JetonCible, JetonCreature and JetonArtemia
parent
5c7c303c
Changes
20
Hide whitespace changes
Inline
Side-by-side
not-alone-server/src/main/java/fr/univnantes/alma/data/DatabaseStub.java
View file @
f66cdd5c
...
...
@@ -7,7 +7,6 @@ import fr.univnantes.alma.server.game.item.card.CardName;
import
fr.univnantes.alma.server.game.item.card.PlaceCard
;
import
fr.univnantes.alma.server.game.item.card.SurvivalCard
;
import
fr.univnantes.alma.server.game.item.card.TrackingCard
;
import
fr.univnantes.alma.server.game.item.jeton.JetonArtemia
;
import
fr.univnantes.alma.server.game.item.jeton.JetonSymbol
;
import
java.util.*
;
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/Game.java
View file @
f66cdd5c
...
...
@@ -494,7 +494,7 @@ public class Game implements GameInterface {
response
=
new
Response
(
false
,
"Only the Creature can played jeton"
);
}
else
if
(!
state
.
equals
(
Phase
.
PHASE_2
))
{
if
(
gameRoundVariables
.
isJetonCibleBlockPlace
()
&&
placedJeton
.
getJeton
().
getType
().
equals
(
CIBLE
))
{
if
(
gameRoundVariables
.
isJetonCibleBlockPlace
()
&&
placedJeton
.
getJeton
Symbol
().
equals
(
CIBLE
))
{
response
=
creaturePlaceAJeton
(
creature
,
placedJeton
);
}
else
{
...
...
@@ -960,10 +960,9 @@ public class Game implements GameInterface {
}
}
JetonSymbol
type
=
placedJeton
.
getJeton
().
getType
();
JetonSymbol
symbol
=
placedJeton
.
getJeton
Symbol
();
if
(
placedJeton
.
getPlaces
().
size
()
>
1
)
{
JetonSymbol
symbol
=
placedJeton
.
getJeton
().
getType
();
if
(
symbol
.
equals
(
JetonSymbol
.
CIBLE
)
&&
!
gameRoundVariables
.
jetonCibleCanBeOnTwoAdjacentPlaces
())
{
return
new
Response
(
false
,
"JetonCible can't be place on two adjacent places"
);
}
...
...
@@ -979,11 +978,11 @@ public class Game implements GameInterface {
placeBetween6To10
=
true
;
}
}
if
(
(
type
.
equals
(
CIBLE
)
&&
containsJetonCible
)
||
(
type
.
equals
(
ARTEMIA
)
&&
(
containsJetonArtemia
||
board
.
isArtemiaSquare
()))
||
type
.
equals
(
JetonSymbol
.
CREATURE
)
&&
(
canPlaceOn6To10
||
!
placeBetween6To10
))
{
if
(
(
symbol
.
equals
(
CIBLE
)
&&
containsJetonCible
)
||
(
symbol
.
equals
(
ARTEMIA
)
&&
(
containsJetonArtemia
||
board
.
isArtemiaSquare
()))
||
symbol
.
equals
(
JetonSymbol
.
CREATURE
)
&&
(
canPlaceOn6To10
||
!
placeBetween6To10
))
{
if
(
planet
.
placeJeton
(
placedJeton
))
{
creature
.
playJeton
(
placedJeton
.
getJeton
());
creature
.
playJeton
(
placedJeton
.
getJeton
Symbol
());
return
new
Response
(
true
,
""
);
}
else
{
...
...
@@ -1406,8 +1405,8 @@ public class Game implements GameInterface {
action
=
askAction
(
idPlayer
,
askAction
);
if
(
action
.
getActionType
().
equals
(
SWAP_JETONS
))
{
actionSwapJeton
=
(
ActionSwapJeton
)
action
;
symbol1
=
actionSwapJeton
.
getJeton1
();
symbol2
=
actionSwapJeton
.
getJeton2
();
symbol1
=
actionSwapJeton
.
getJeton
Symbol
1
();
symbol2
=
actionSwapJeton
.
getJeton
Symbol
2
();
}
}
while
(
symbol1
==
null
||
symbol2
==
null
||
symbol1
==
symbol2
);
return
new
Pair
<>(
symbol1
,
symbol2
);
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/PowerApplicator.java
View file @
f66cdd5c
...
...
@@ -132,7 +132,7 @@ public class PowerApplicator {
private
static
boolean
filterJetonBlockPlace
(
Game
game
,
int
idPlayer
,
PlaceCard
placeCard
)
{
Planet
planet
=
game
.
getPlanet
();
GameRoundVariables
variables
=
game
.
getGameRoundVariables
();
List
<
JetonSymbol
>
jetonSymbols
=
planet
.
findJetonsOnCard
(
placeCard
)
.
stream
().
map
(
Jeton:
:
getType
).
collect
(
Collectors
.
toList
())
;
List
<
JetonSymbol
>
jetonSymbols
=
planet
.
findJetons
Symbols
OnCard
(
placeCard
);
boolean
canApplyArtemiaOnThisPlace
=
jetonSymbols
.
contains
(
JetonSymbol
.
ARTEMIA
)
&&
game
.
isJetonArtemiaIsActive
();
boolean
canApplyCreatureOnThisPlace
=
jetonSymbols
.
contains
(
JetonSymbol
.
CREATURE
);
...
...
@@ -1368,7 +1368,7 @@ public class PowerApplicator {
Pair
<
Place
,
Place
>
pair
=
chooseTwoAdjacentPlace
(
game
,
idPlayer
);
PlacedJeton
jetonCible
=
new
PlacedJeton
(
JetonSymbol
.
CIBLE
,
Arrays
.
asList
(
pair
.
getKey
(),
pair
.
getValue
()));
game
.
getPlanet
().
placeJeton
(
jetonCible
);
game
.
getCreature
().
playJeton
(
new
Jeton
Cible
()
);
game
.
getCreature
().
playJeton
(
Jeton
Symbol
.
CIBLE
);
}
private
static
void
applySurvivalRegeneration
(
Game
game
,
int
idPlayer
)
{
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/action/ActionMoveJeton.java
View file @
f66cdd5c
...
...
@@ -9,12 +9,12 @@ import java.util.List;
import
static
fr
.
univnantes
.
alma
.
server
.
game
.
utilitary
.
Conversion
.*;
public
class
ActionMoveJeton
extends
Action
{
private
JetonSymbol
jeton
;
private
JetonSymbol
jeton
Symbol
;
private
Place
place
;
public
ActionMoveJeton
(
JetonSymbol
jeton
,
Place
place
)
{
public
ActionMoveJeton
(
JetonSymbol
jeton
Symbol
,
Place
place
)
{
this
.
place
=
place
;
this
.
jeton
=
jeton
;
this
.
jeton
Symbol
=
jeton
Symbol
;
}
public
ActionMoveJeton
(
List
<
TPair
>
params
)
{
...
...
@@ -27,12 +27,12 @@ public class ActionMoveJeton extends Action {
TPairType
type1
=
toTPairType
(
params
.
get
(
0
).
getKey
());
TPairType
type2
=
toTPairType
(
params
.
get
(
1
).
getKey
());
if
(
type1
.
equals
(
TPairType
.
JETON
)
&&
type2
.
equals
(
TPairType
.
PLACE
))
{
this
.
jeton
=
toJeton
Type
(
params
.
get
(
0
).
getValue
());
this
.
jeton
Symbol
=
toJeton
Symbol
(
params
.
get
(
0
).
getValue
());
this
.
place
=
toPlace
(
params
.
get
(
1
).
getValue
());
}
else
if
(
type1
.
equals
(
TPairType
.
PLACE
)
&&
type2
.
equals
(
TPairType
.
JETON
))
{
this
.
place
=
toPlace
(
params
.
get
(
0
).
getValue
());
this
.
jeton
=
toJeton
Type
(
params
.
get
(
0
).
getValue
());
this
.
jeton
Symbol
=
toJeton
Symbol
(
params
.
get
(
0
).
getValue
());
}
else
{
invalid
=
true
;
...
...
@@ -47,8 +47,8 @@ public class ActionMoveJeton extends Action {
}
}
public
JetonSymbol
getJeton
()
{
return
jeton
;
public
JetonSymbol
getJeton
Symbol
()
{
return
jeton
Symbol
;
}
public
Place
getPlace
()
{
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/action/ActionSwapJeton.java
View file @
f66cdd5c
...
...
@@ -8,12 +8,12 @@ import java.util.List;
import
static
fr
.
univnantes
.
alma
.
server
.
game
.
utilitary
.
Conversion
.*;
public
class
ActionSwapJeton
extends
Action
{
private
JetonSymbol
jeton1
;
private
JetonSymbol
jeton2
;
private
JetonSymbol
jeton
Symbol
1
;
private
JetonSymbol
jeton
Symbol
2
;
public
ActionSwapJeton
(
JetonSymbol
j1
,
JetonSymbol
j2
){
this
.
jeton1
=
j1
;
this
.
jeton2
=
j2
;
this
.
jeton
Symbol
1
=
j1
;
this
.
jeton
Symbol
2
=
j2
;
}
public
ActionSwapJeton
(
List
<
TPair
>
params
)
{
...
...
@@ -26,8 +26,8 @@ public class ActionSwapJeton extends Action {
TPairType
type1
=
toTPairType
(
params
.
get
(
0
).
getKey
());
TPairType
type2
=
toTPairType
(
params
.
get
(
1
).
getKey
());
if
(
type1
.
equals
(
TPairType
.
JETON
)
&&
type2
.
equals
(
TPairType
.
JETON
))
{
this
.
jeton1
=
toJeton
Type
(
params
.
get
(
0
).
getValue
());
this
.
jeton2
=
toJeton
Type
(
params
.
get
(
1
).
getValue
());
this
.
jeton
Symbol
1
=
toJeton
Symbol
(
params
.
get
(
0
).
getValue
());
this
.
jeton
Symbol
2
=
toJeton
Symbol
(
params
.
get
(
1
).
getValue
());
}
else
{
invalid
=
true
;
...
...
@@ -42,12 +42,12 @@ public class ActionSwapJeton extends Action {
}
}
public
JetonSymbol
getJeton1
()
{
return
jeton1
;
public
JetonSymbol
getJeton
Symbol
1
()
{
return
jeton
Symbol
1
;
}
public
JetonSymbol
getJeton2
()
{
return
jeton2
;
public
JetonSymbol
getJeton
Symbol
2
()
{
return
jeton
Symbol
2
;
}
@Override
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/card/TrackingCard.java
View file @
f66cdd5c
package
fr.univnantes.alma.server.game.item.card
;
import
fr.univnantes.alma.server.game.item.Phase
;
import
fr.univnantes.alma.server.game.item.jeton.Jeton
;
import
fr.univnantes.alma.server.game.item.jeton.JetonSymbol
;
import
java.util.ArrayList
;
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/jeton/Jeton.java
deleted
100644 → 0
View file @
5c7c303c
package
fr.univnantes.alma.server.game.item.jeton
;
import
fr.univnantes.alma.server.game.item.power.PowerType
;
public
abstract
class
Jeton
{
//TODO remove
protected
PowerType
power
;
//TODO Constructor
public
PowerType
getPowers
()
{
return
power
;
}
public
abstract
JetonSymbol
getType
();
}
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/jeton/JetonArtemia.java
deleted
100644 → 0
View file @
5c7c303c
package
fr.univnantes.alma.server.game.item.jeton
;
public
class
JetonArtemia
extends
Jeton
{
@Override
public
JetonSymbol
getType
()
{
return
JetonSymbol
.
ARTEMIA
;
}
}
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/jeton/JetonCible.java
deleted
100644 → 0
View file @
5c7c303c
package
fr.univnantes.alma.server.game.item.jeton
;
public
class
JetonCible
extends
Jeton
{
@Override
public
JetonSymbol
getType
()
{
return
JetonSymbol
.
CIBLE
;
}
}
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/jeton/JetonCreature.java
deleted
100644 → 0
View file @
5c7c303c
package
fr.univnantes.alma.server.game.item.jeton
;
public
class
JetonCreature
extends
Jeton
{
@Override
public
JetonSymbol
getType
()
{
return
JetonSymbol
.
CREATURE
;
}
}
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/jeton/PlacedJeton.java
View file @
f66cdd5c
...
...
@@ -6,53 +6,23 @@ import java.util.ArrayList;
import
java.util.List
;
public
class
PlacedJeton
{
private
Jeton
jeton
;
private
Jeton
Symbol
jetonSymbol
;
private
List
<
Place
>
places
;
public
PlacedJeton
(
Jeton
jeton
,
List
<
Place
>
places
)
{
this
.
jeton
=
jeton
;
this
.
places
=
places
;
}
public
PlacedJeton
(
Jeton
jeton
,
Place
place
)
{
this
.
jeton
=
jeton
;
public
PlacedJeton
(
JetonSymbol
symbol
,
Place
place
)
{
this
.
places
=
new
ArrayList
<>();
this
.
places
.
add
(
place
);
this
.
jetonSymbol
=
symbol
;
}
public
PlacedJeton
(
JetonSymbol
symbol
,
List
<
Place
>
places
)
{
this
.
places
=
places
;
switch
(
symbol
)
{
case
CIBLE:
this
.
jeton
=
new
JetonCible
();
break
;
case
ARTEMIA:
this
.
jeton
=
new
JetonArtemia
();
break
;
case
CREATURE:
this
.
jeton
=
new
JetonCreature
();
break
;
}
this
.
jetonSymbol
=
symbol
;
}
public
PlacedJeton
(
JetonSymbol
symbol
,
Place
place
)
{
this
.
places
=
new
ArrayList
<>();
this
.
places
.
add
(
place
);
switch
(
symbol
)
{
case
CIBLE:
this
.
jeton
=
new
JetonCible
();
break
;
case
ARTEMIA:
this
.
jeton
=
new
JetonArtemia
();
break
;
case
CREATURE:
this
.
jeton
=
new
JetonCreature
();
break
;
}
}
public
Jeton
getJeton
()
{
return
jeton
;
public
Jeton
Symbol
getJeton
Symbol
()
{
return
jeton
Symbol
;
}
public
List
<
Place
>
getPlaces
()
{
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/planet/Planet.java
View file @
f66cdd5c
...
...
@@ -18,7 +18,7 @@ public class Planet {
public
static
final
int
POLE_NUMBER
=
8
;
private
Map
<
Place
,
List
<
Jeton
>>
mapPlaceToJetons
;
private
Map
<
Place
,
List
<
Jeton
Symbol
>>
mapPlaceToJetons
;
private
Map
<
Place
,
Boolean
>
blockedPlaces
;
private
Map
<
Place
,
List
<
SurvivalCard
>>
placeSurvivalCardMap
;
private
int
numberMovesAllowInRound
;
...
...
@@ -55,7 +55,7 @@ public class Planet {
if
(!
mapPlaceToJetons
.
containsKey
(
place
)){
mapPlaceToJetons
.
put
(
place
,
new
ArrayList
<>());
}
mapPlaceToJetons
.
get
(
place
).
add
(
placedJeton
.
getJeton
());
mapPlaceToJetons
.
get
(
place
).
add
(
placedJeton
.
getJeton
Symbol
());
}
return
true
;
}
...
...
@@ -66,11 +66,11 @@ public class Planet {
public
List
<
Place
>
findPlacesWhereJetonIs
(
JetonSymbol
symbol
)
{
List
<
Place
>
places
=
new
ArrayList
<>();
List
<
Jeton
>
jetonsAux
;
List
<
Jeton
Symbol
>
jetonsAux
;
for
(
Place
place
:
mapPlaceToJetons
.
keySet
())
{
jetonsAux
=
mapPlaceToJetons
.
get
(
place
);
for
(
Jeton
j
:
jetonsAux
)
{
if
(
j
.
getType
()
.
equals
(
symbol
))
{
for
(
Jeton
Symbol
jetonSymbol
:
jetonsAux
)
{
if
(
j
etonSymbol
.
equals
(
symbol
))
{
places
.
add
(
place
);
}
}
...
...
@@ -79,26 +79,17 @@ public class Planet {
}
public
List
<
PlaceCard
>
findPlaceCardsWhereJetonIs
(
JetonSymbol
symbol
)
{
List
<
PlaceCard
>
placeCards
=
new
ArrayList
<>();
List
<
Jeton
>
jetonsAux
;
for
(
Place
place
:
mapPlaceToJetons
.
keySet
())
{
jetonsAux
=
mapPlaceToJetons
.
get
(
place
);
for
(
Jeton
j
:
jetonsAux
)
{
if
(
j
.
getType
().
equals
(
symbol
))
{
placeCards
.
add
(
placeToPlaceCard
(
place
));
}
}
}
return
placeCards
;
return
findPlacesWhereJetonIs
(
symbol
).
stream
()
.
map
(
this
::
placeToPlaceCard
).
collect
(
Collectors
.
toList
());
}
public
void
removeJeton
(
JetonSymbol
symbol
)
{
List
<
Place
>
places
=
new
ArrayList
<>();
List
<
Jeton
>
jetonsAux
;
List
<
Jeton
Symbol
>
jetonsAux
;
for
(
Place
place
:
mapPlaceToJetons
.
keySet
())
{
jetonsAux
=
mapPlaceToJetons
.
get
(
place
);
for
(
Jeton
j
:
jetonsAux
)
{
if
(
j
.
getType
()
.
equals
(
symbol
))
{
for
(
Jeton
Symbol
jetonSymbol
:
jetonsAux
)
{
if
(
j
etonSymbol
.
equals
(
symbol
))
{
places
.
add
(
place
);
}
}
...
...
@@ -142,7 +133,7 @@ public class Planet {
return
isJetonOnPlace
(
placeDistribution
.
placeCardToPlace
(
card
));
}
public
List
<
Jeton
>
findJetonsOnCard
(
PlaceCard
card
){
public
List
<
Jeton
Symbol
>
findJetons
Symbols
OnCard
(
PlaceCard
card
){
if
(
isJetonOnPlace
(
card
)){
return
mapPlaceToJetons
.
get
(
placeDistribution
.
placeCardToPlace
(
card
));
}
...
...
@@ -151,10 +142,6 @@ public class Planet {
}
}
public
List
<
JetonSymbol
>
findJetonsSymbolsOnCard
(
PlaceCard
card
){
return
findJetonsOnCard
(
card
).
stream
().
map
(
Jeton:
:
getType
).
collect
(
Collectors
.
toList
());
}
public
boolean
isJetonSymbolOnPlaceCard
(
JetonSymbol
symbol
,
PlaceCard
placeCard
)
{
return
findJetonsSymbolsOnCard
(
placeCard
).
contains
(
symbol
);
}
...
...
@@ -195,9 +182,9 @@ public class Planet {
public
List
<
PlaceCard
>
placesWhereJetonCreatureIs
()
{
List
<
PlaceCard
>
placeCards
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Place
,
List
<
Jeton
>>
entry
:
mapPlaceToJetons
.
entrySet
()){
for
(
Jeton
j
:
entry
.
getValue
())
{
if
(
j
.
getType
()
.
equals
(
JetonSymbol
.
CREATURE
))
{
for
(
Map
.
Entry
<
Place
,
List
<
Jeton
Symbol
>>
entry
:
mapPlaceToJetons
.
entrySet
()){
for
(
Jeton
Symbol
jetonSymbol
:
entry
.
getValue
())
{
if
(
j
etonSymbol
.
equals
(
JetonSymbol
.
CREATURE
))
{
placeCards
.
add
(
placeDistribution
.
placeToPlaceCard
(
entry
.
getKey
()));
}
}
...
...
@@ -440,15 +427,15 @@ public class Planet {
}
public
void
swapJeton
(
JetonSymbol
symbol1
,
JetonSymbol
symbol2
)
{
Map
<
Place
,
List
<
Jeton
>>
newMap
=
new
HashMap
<>();
Map
<
Place
,
List
<
Jeton
Symbol
>>
newMap
=
new
HashMap
<>();
for
(
Place
place
:
mapPlaceToJetons
.
keySet
())
{
for
(
Jeton
jeton
:
mapPlaceToJetons
.
get
(
place
))
{
for
(
Jeton
Symbol
jeton
:
mapPlaceToJetons
.
get
(
place
))
{
newMap
.
putIfAbsent
(
place
,
new
ArrayList
<>());
if
(
jeton
.
getType
().
equals
(
symbol1
)){
newMap
.
get
(
place
).
add
(
createJeton
(
symbol2
)
)
;
if
(
jeton
.
equals
(
symbol1
)){
newMap
.
get
(
place
).
add
(
symbol2
);
}
else
if
(
jeton
.
getType
().
equals
(
symbol2
))
{
newMap
.
get
(
place
).
add
(
createJeton
(
symbol1
)
)
;
else
if
(
jeton
.
equals
(
symbol2
))
{
newMap
.
get
(
place
).
add
(
symbol1
);
}
else
{
newMap
.
get
(
place
).
add
(
jeton
);
...
...
@@ -457,17 +444,4 @@ public class Planet {
}
mapPlaceToJetons
=
newMap
;
}
public
Jeton
createJeton
(
JetonSymbol
symbol
)
{
switch
(
symbol
)
{
case
CIBLE:
return
new
JetonCible
();
case
ARTEMIA:
return
new
JetonArtemia
();
case
CREATURE:
return
new
JetonCreature
();
default
:
throw
new
IllegalArgumentException
(
symbol
+
" is not a valid symbol"
);
}
}
}
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/player/Creature.java
View file @
f66cdd5c
package
fr.univnantes.alma.server.game.item.player
;
import
fr.univnantes.alma.server.game.item.card.TrackingCard
;
import
fr.univnantes.alma.server.game.item.jeton.Jeton
;
import
fr.univnantes.alma.server.game.item.jeton.Jeton
Symbol
;
import
fr.univnantes.alma.server.game.item.player.hand.HandCreature
;
import
fr.univnantes.alma.server.game.item.player.rights.CreatureRight
;
...
...
@@ -69,15 +69,15 @@ public class Creature extends Player {
return
hand
.
jetonsIsEmpty
();
}
public
List
<
Jeton
>
getJetons
(){
return
hand
.
getJetons
();
public
List
<
Jeton
Symbol
>
getJetons
(){
return
hand
.
getJeton
Symbol
s
();
}
public
boolean
playJeton
(
Jeton
jeton
){
public
boolean
playJeton
(
Jeton
Symbol
jeton
){
return
hand
.
playJeton
(
jeton
);
}
public
boolean
playJeton
(
List
<
Jeton
>
jetons
){
public
boolean
playJeton
(
List
<
Jeton
Symbol
>
jetons
){
return
hand
.
playJeton
(
jetons
);
}
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/item/player/hand/HandCreature.java
View file @
f66cdd5c
package
fr.univnantes.alma.server.game.item.player.hand
;
import
fr.univnantes.alma.server.game.item.card.TrackingCard
;
import
fr.univnantes.alma.server.game.item.jeton.Jeton
;
import
fr.univnantes.alma.server.game.item.jeton.JetonArtemia
;
import
fr.univnantes.alma.server.game.item.jeton.JetonCible
;
import
fr.univnantes.alma.server.game.item.jeton.JetonCreature
;
import
fr.univnantes.alma.server.game.item.jeton.JetonSymbol
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
HandCreature
{
private
Deck
<
TrackingCard
>
trackingCards
;
private
List
<
Jeton
>
jetons
;
private
List
<
Jeton
Symbol
>
jeton
Symbol
s
;
private
List
<
TrackingCard
>
trackingCardsToApplied
;
/**
* The jetons played by the player in the current round
*/
private
List
<
Jeton
>
jetonsPlayed
;
private
List
<
Jeton
Symbol
>
jeton
Symbol
sPlayed
;
public
HandCreature
(){
this
.
trackingCards
=
new
Deck
<>(
3
);
...
...
@@ -55,25 +53,22 @@ public class HandCreature {
* Jeton methods
*******************************/
public
void
initializationJeton
(){
jetons
=
new
ArrayList
<>();
jetons
.
add
(
new
JetonArtemia
());
jetons
.
add
(
new
JetonCreature
());
jetons
.
add
(
new
JetonCible
());
jetonsPlayed
=
new
ArrayList
<>();
jetonSymbols
=
new
ArrayList
<>(
Arrays
.
asList
(
JetonSymbol
.
CIBLE
,
JetonSymbol
.
CREATURE
,
JetonSymbol
.
ARTEMIA
));
jetonSymbolsPlayed
=
new
ArrayList
<>();
}
public
List
<
Jeton
>
getJetonsPlayed
()
{
return
jetonsPlayed
;
public
List
<
Jeton
Symbol
>
getJeton
Symbol
sPlayed
()
{
return
jeton
Symbol
sPlayed
;
}
public
List
<
Jeton
>
getJetons
(){
return
jetons
;
public
List
<
Jeton
Symbol
>
getJeton
Symbol
s
(){
return
jeton
Symbol
s
;
}
public
boolean
playJeton
(
Jeton
jeton
){
if
(
jetons
.
contains
(
jeton
)){
jetons
.
remove
(
jeton
);
jetonsPlayed
.
add
(
jeton
);
public
boolean
playJeton
(
Jeton
Symbol
jeton
){
if
(
jeton
Symbol
s
.
contains
(
jeton
)){
jeton
Symbol
s
.
remove
(
jeton
);
jeton
Symbol
sPlayed
.
add
(
jeton
);
return
true
;
}
else
{
...
...
@@ -81,10 +76,10 @@ public class HandCreature {
}
}
public
boolean
playJeton
(
List
<
Jeton
>
jetons
){
if
(
this
.
jetons
.
containsAll
(
jetons
)){
this
.
jetons
.
removeAll
(
jetons
);
jetonsPlayed
.
addAll
(
jetons
);
public
boolean
playJeton
(
List
<
Jeton
Symbol
>
jetons
){
if
(
this
.
jeton
Symbol
s
.
containsAll
(
jetons
)){
this
.
jeton
Symbol
s
.
removeAll
(
jetons
);
jeton
Symbol
sPlayed
.
addAll
(
jetons
);
return
true
;
}
else
{
...
...
@@ -93,19 +88,19 @@ public class HandCreature {
}
public
int
jetonsSize
(){
return
jetons
.
size
();
return
jeton
Symbol
s
.
size
();
}
public
int
jetonsPlayedSize
(){
return
jetonsPlayed
.
size
();
return
jeton
Symbol
sPlayed
.
size
();
}
public
boolean
jetonsIsEmpty
(){
return
jetons
.
isEmpty
();
return
jeton
Symbol
s
.
isEmpty
();
}
public
boolean
jetonsPlayedIsEmpty
(){
return
jetonsPlayed
.
isEmpty
();
return
jeton
Symbol
sPlayed
.
isEmpty
();
}
/********************************
...
...
not-alone-server/src/main/java/fr/univnantes/alma/server/game/utilitary/Conversion.java
View file @
f66cdd5c
...
...
@@ -202,40 +202,12 @@ public class Conversion {
* Jeton
***********************************/
/**
* Convert a TJeton in a Jeton
* @param tJeton
* @return
*/
public
static
Jeton
toJeton
(
TJeton
tJeton
){
return
toJeton
(
tJeton
.
jetonId
);
}
/**
* Convert a String in a Jeton