Player implementation for the server.It symbolizes player and valids and applies action requests. More...
#include <SPlayer.hh>

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) |
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.
| 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.
| 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.
| new_ma_remain | New movement allowance remaining. |
Referenced by tryMove(), tryStandUp(), and tryThrow().
| void SPlayer::setProne | ( | ) |
Sets status to prone if he has to.
References setStatus().
| void SPlayer::setStatus | ( | enum eStatus | new_status | ) |
Sets player status and sends a MSG_STATUS to clients.
| 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().
1.6.3