SPlayer Class Reference
[Server Rules]

Player implementation for the server.It symbolizes player and valids and applies action requests. More...

#include <SPlayer.hh>

Inheritance diagram for SPlayer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 SPlayer (SRules *r, const MsgPlayerCreate *msg, SMatch *m, STeam *t, SPlayerMsg *pm)
bool acceptPlayerCreation ()
 Checks some things, if this player could be valid.
bool checkAndDeclareTouchdooown ()
 Checks if the player scores a touchdooown, and eventually declares the touchdooown.
void setCoordinates (const Coordinates &coord, bool advertise_client=true)
 Sets player coordinates.
void setMaRemain (int new_ma_remain)
 Sets player movement allowance remaining and alerts clients.
void setStatus (enum eStatus new_status)
 Sets player status and sends a MSG_STATUS to clients.
void setProne ()
 Sets status to prone if he has to.
void prepareKickoff ()
 Goes in the reserve if he can.
void setUsableSkill (enum eSkill skill)
 Sets the given skill as the only usable skill.
void checkArmour (int av_mod, int inj_mod)
 Checks for armour value and eventually injury.
void bePushedInTheCrowd ()
 Rolls for injury and sets player status.
void considerBlockDices (bool reroll)
 Rerolls the block dices if needed, otherwise gives the choice (if any) to a coach for which block dice to apply.
void resolveBlockDice (int chosen_dice)
 Applies block dice roll result.
void resolveBlockBothDownDefender (bool block)
 Applies BBOTH_DOWN block dice roll result.
void resolveBlockBothDownAttacker (bool block)
 Applies BBOTH_DOWN block dice roll result.
void resolveBlockDefenderStumble (bool dodge)
 Applies BDEFENDER_STUMBLE block dice roll result.
void setPusher (SPlayer *p)
 Sets pusher of this player.
void tryBlockPush (SPlayer *target)
 Tries to push the targetted player to a square.
void resolveBlockPush (int chosen_square)
 Selects chosen square to push the targetted player.
void considerBlockFollow ()
 Eventually gives the coach his choice to follow or not after a block push.
void finishBlockFollow (bool follow)
 Registers follow decision and moves to pushes application.
void finishBlockPush ()
 Applies pushes decisions, beginning by the last pushed player.
void finishBlockAction ()
 Applies follow decision, eventually knocks down the defender.
void tryCatchBall (bool accurate_pass)
 Tries to catch the ball.
void finishCatchBall (bool reroll, bool success)
void tryDodge ()
 Tries to dodge.
void finishDodge (bool reroll, bool success)
void tryMove (Coordinates &aim)
 Tries to move to an adjacent square.
void tryPickUp ()
 Tries to pick up the ball.
void finishPickUp (bool reroll, bool success)
void tryStandUp ()
 Tries to stand up.
void finishStandUp (bool reroll, bool success)
void tryTame ()
 Tries to tame wildnesss.
void finishTame (bool reroll, bool success)
void tryThrow ()
 Tries to throw the ball.
void finishThrow (bool reroll, int success)
void msgPlayerCoord (const MsgPlayerCoord *m)
void msgAction (const MsgAction *m)
void msgMove (const MsgMove *m)
void msgStandUp (const MsgStandUp *m)
void msgBlock (const MsgBlock *m)
void msgFoul (const MsgFoul *m)
void msgHandOff (const MsgHandOff *m)
void msgPass (const MsgPass *m)
void msgSkill (const MsgSkill *m)

Detailed Description

Player implementation for the server.

It symbolizes player and valids and applies action requests.

You will have up to 32 instances of this class at runtime, handled by the STeam and SPlayerMsg class.


Member Function Documentation

bool SPlayer::checkAndDeclareTouchdooown (  ) 

Checks if the player scores a touchdooown, and eventually declares the touchdooown.

References Player::coord_, SMatch::getBall(), Ball< T >::getOwner(), Player::id_, Coordinates::row, ROWS, Player::team_id_, and SMatch::touchdooown().

Referenced by finishBlockAction(), and tryMove().

void SPlayer::considerBlockDices ( bool  reroll  ) 

Rerolls the block dices if needed, otherwise gives the choice (if any) to a coach for which block dice to apply.

References SMatch::getTeam(), GS_BLOCK, resolveBlockDice(), STeam::state_, and Player::team_id_.

void SPlayer::setCoordinates ( const Coordinates coord,
bool  advertise_client = true 
)

Sets player coordinates.

Note:
Use this function instead of setting coord_ directly, so the field can be updated too.
Parameters:
coord Where to move.
advertise_client Whether or not send a MSG_PLAYERCOORD to clients.

References Player::coord_, Field< T >::intoField(), and Field< T >::setPlayer().

Referenced by finishBlockAction(), finishBlockPush(), and tryMove().

void SPlayer::setMaRemain ( int  new_ma_remain  ) 

Sets player movement allowance remaining and alerts clients.

Parameters:
new_ma_remain New movement allowance remaining.

Referenced by tryMove(), tryStandUp(), and tryThrow().

void SPlayer::setProne (  ) 

Sets status to prone if he has to.

Note:
Call this function at the end of his team turn.

References setStatus().

void SPlayer::setStatus ( enum eStatus  new_status  ) 

Sets player status and sends a MSG_STATUS to clients.

Note:
Use this function instead of setting coord_ directly, so the field can be updated too.
Parameters:
new_status New status, it has to be different from the current one.

References Player::coord_, Player::id_, Field< T >::setPlayer(), Player::status_, and Player::team_id_.

Referenced by bePushedInTheCrowd(), finishBlockAction(), prepareKickoff(), resolveBlockBothDownAttacker(), resolveBlockDice(), setProne(), and tryStandUp().

void SPlayer::tryBlockPush ( SPlayer target  ) 

Tries to push the targetted player to a square.

Eventually gives a coach his choice of which square to push the player to.

References Player::coord_, SMatch::getCurrentTeam(), Field< T >::getPlayer(), GS_PUSH, Player::id_, Field< T >::intoField(), resolveBlockPush(), STeam::setPusher(), setPusher(), STeam::state_, and Player::team_id_.

Referenced by resolveBlockDefenderStumble(), resolveBlockDice(), and resolveBlockPush().


The documentation for this class was generated from the following files:
Generated on Mon Apr 5 21:17:45 2010 for Stechec/TBT by  doxygen 1.6.3