package net.cobem.grizzly.habbohotel.games.battleball;

import net.cobem.grizzly.habbohotel.rooms.items.FloorItem;
import net.cobem.grizzly.habbohotel.sessions.Session;

import java.util.List;

public class BattleBall_TeamLogic {
    private BattleBall_TeamType Color;

    private List<Session> Players;

    private int Score;

    private FloorItem Scoreboard;

    public BattleBall_TeamLogic(BattleBall_TeamType Color) {
        this.Color = Color;
    }

    public BattleBall_TeamType getColor() {
        return Color;
    }

    public List<Session> getPlayers() {
        return Players;
    }

    public Integer getScore() {
        return Score;
    }

    public FloorItem getScoreboard() {
        return Scoreboard;
    }

    public boolean addPlayer(Session Player) {
        if (getPlayers().size() == 4) {
            return false;
        }

        getPlayers().add(Player);
        return true;
    }

    public boolean setScoreboard(FloorItem Item) {
        Scoreboard = Item;
        return true;
    }

    public boolean setScore(int Score, boolean ReturnIfWon) {
        this.Score = Score;


        if (ReturnIfWon) {
            return (this.Score >= 400);
        }

        return true;
    }

    public boolean updateScore() {
        getScoreboard().ExtraData = Integer.toString(this.Score);

        return true;
    }

    public boolean hasPlayer(Session Player) {
        return getPlayers().contains(Player);
    }
}
