GameLogic
 All Data Structures Files Functions Variables Friends
Public Member Functions | Data Fields | Friends
gameModel::Team Class Reference

#include <GameModel.h>

Public Member Functions

 Team (const communication::messages::request::TeamConfig &tConf, communication::messages::request::TeamFormation tForm, TeamSide side)
 
 Team (Seeker seeker, Keeper keeper, std::array< Beater, 2 > beaters, std::array< Chaser, 3 > chasers, int score, Fanblock fanblock, TeamSide side)
 
auto getAllPlayers () const -> std::array< std::shared_ptr< Player >, 7 >
 
bool hasMember (const std::shared_ptr< const Player > &player) const
 
int numberOfBannedMembers () const
 
auto getPlayerByID (communication::messages::types::EntityId id) const -> std::optional< std::shared_ptr< Player >>
 
auto clone () const -> std::shared_ptr< Team >
 
TeamSide getSide () const
 
bool operator== (const Team &other) const
 
bool operator!= (const Team &other) const
 

Data Fields

std::shared_ptr< Seekerseeker
 
std::shared_ptr< Keeperkeeper
 
std::array< std::shared_ptr
< Beater >, 2 > 
beaters
 
std::array< std::shared_ptr
< Chaser >, 3 > 
chasers
 
int score {}
 
Fanblock fanblock
 

Friends

void from_json (const nlohmann::json &, Team &)
 

Detailed Description

Represents a Team

Constructor & Destructor Documentation

gameModel::Team::Team ( const communication::messages::request::TeamConfig &  tConf,
communication::messages::request::TeamFormation  tForm,
TeamSide  side 
)

Constructs a Team from server config types with initial score of 0

Parameters
leftTeamselect if team si on left or right side
gameModel::Team::Team ( Seeker  seeker,
Keeper  keeper,
std::array< Beater, 2 >  beaters,
std::array< Chaser, 3 >  chasers,
int  score,
Fanblock  fanblock,
TeamSide  side 
)

Ctor where all members can be specified

Parameters
seekerSeeker Player
keeperKeeper Player
beatersArray of two Beater Players
chasersArray of three Chaser Players
scoreinitial score of the team
fanblockfans of the team

Member Function Documentation

auto gameModel::Team::clone ( ) const -> std::shared_ptr<Team>

returns a deep copy of the current Team

Returns
auto gameModel::Team::getAllPlayers ( ) const -> std::array<std::shared_ptr<Player>, 7>

gets all Players of the team

Returns
auto gameModel::Team::getPlayerByID ( communication::messages::types::EntityId  id) const -> std::optional<std::shared_ptr<Player>>

Get player by server entity ids

Parameters
id
Returns
TeamSide gameModel::Team::getSide ( ) const

Getter

Returns
side of the team
bool gameModel::Team::hasMember ( const std::shared_ptr< const Player > &  player) const

Determines whether a given player is a member of the team

Parameters
player
Returns
true if player is a member of the team. false otherwise
int gameModel::Team::numberOfBannedMembers ( ) const

gets the number of banned players in the team

Returns
number of banned players in the team

The documentation for this class was generated from the following files: