From f90c9101d2e8afbe48f1e8bd0b39508046473886 Mon Sep 17 00:00:00 2001 From: LapisBerry Date: Wed, 29 May 2024 22:25:40 +0700 Subject: [PATCH] feat: CharacterEnum, Player, Role class --- .../entities/characters/CharacterEnum.java | 20 ++++++++++ .../game/entities/players/Player.java | 39 +++++++++++++++++++ .../game/entities/players/Role.java | 8 ++++ 3 files changed, 67 insertions(+) create mode 100644 src/main/java/com/lapisberry/game/entities/characters/CharacterEnum.java create mode 100644 src/main/java/com/lapisberry/game/entities/players/Player.java create mode 100644 src/main/java/com/lapisberry/game/entities/players/Role.java diff --git a/src/main/java/com/lapisberry/game/entities/characters/CharacterEnum.java b/src/main/java/com/lapisberry/game/entities/characters/CharacterEnum.java new file mode 100644 index 0000000..85d4290 --- /dev/null +++ b/src/main/java/com/lapisberry/game/entities/characters/CharacterEnum.java @@ -0,0 +1,20 @@ +package com.lapisberry.game.entities.characters; + +public enum CharacterEnum { + Bart_Cassidy, // *modified // need special turn state when losing a life point Bart can choose take arrow or not take arrow + Black_Jack, + Calamity_Janet, + El_Gringo, + Jesse_Jones, + Jourdonnais, + Kit_Carlson, // *modified // need more turn state to choose player + Lucky_Duke, + Paul_Regret, + Pedro_Ramirez, // *modified // need special turn state when losing a life point Pedro can choose discard arrow or not discard arrow + Rose_Doolan, + Sid_KetChum, // *modified // need more turn state to implement full skill + Slab_The_Killer, // *modified // need special dice state or damage to dice or new dice + Suzy_Lafayette, + Vulture_Sam, + Willy_The_Kid +} diff --git a/src/main/java/com/lapisberry/game/entities/players/Player.java b/src/main/java/com/lapisberry/game/entities/players/Player.java new file mode 100644 index 0000000..a61e292 --- /dev/null +++ b/src/main/java/com/lapisberry/game/entities/players/Player.java @@ -0,0 +1,39 @@ +package com.lapisberry.game.entities.players; + +import java.io.Serial; +import java.io.Serializable; + +/** + * The {@code Player} class is used for user to know a role and position of other players decide which character to pick. + */ +public class Player implements Serializable { + @Serial + private static final long serialVersionUID = -6540863475427867425L; + // Fields + private final int clientId; + private final String playerName; + private Role role; + + // Constructors + public Player(int clientId, String playerName) { + this.clientId = clientId; + this.playerName = playerName; + } + + // Getter Setters + public int getClientId() { + return clientId; + } + + public String getPlayerName() { + return playerName; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } +} diff --git a/src/main/java/com/lapisberry/game/entities/players/Role.java b/src/main/java/com/lapisberry/game/entities/players/Role.java new file mode 100644 index 0000000..6a1de02 --- /dev/null +++ b/src/main/java/com/lapisberry/game/entities/players/Role.java @@ -0,0 +1,8 @@ +package com.lapisberry.game.entities.players; + +public enum Role { + EMPEROR, + ROYALIST, + REBEL, + SPY +}