add player roles

This commit is contained in:
2026-07-11 15:26:37 +03:30
parent 940b160a4e
commit 2e71767311
2 changed files with 33 additions and 0 deletions
@@ -0,0 +1,7 @@
package org.project.constants.gameConstant;
public enum PlayerRoles {
KNIGHT,
WIZARD,
ASSASSIN
}
@@ -0,0 +1,26 @@
package org.project.constants.gameConstant;
import org.project.entity.players.Assassin;
import org.project.entity.players.Knight;
import org.project.entity.players.Player;
import org.project.entity.players.Wizard;
public final class PlayerRolesExt {
private PlayerRolesExt() {}
public static Player CreatePlayer(PlayerRoles role, String name, int level) {
return switch (role) {
case KNIGHT -> new Knight(name, level);
case ASSASSIN -> new Assassin(name, level);
case WIZARD -> new Wizard(name, level);
};
}
public static Player CreatePlayer(PlayerRoles role, String name) {
return switch (role) {
case KNIGHT -> new Knight(name);
case ASSASSIN -> new Assassin(name);
case WIZARD -> new Wizard(name);
};
}
}