SPlayer.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef SPLAYER_HH_
00018 # define SPLAYER_HH_
00019
00020 # include "Dice.hh"
00021 # include "Player.hh"
00022 # include "SField.hh"
00023
00024 class OpStack;
00025 class SMatch;
00026 class SPlayerMsg;
00027 class SRules;
00028 class STeam;
00029
00039 class SPlayer : public Player
00040 {
00041 public:
00042 SPlayer(SRules* r, const MsgPlayerCreate* msg, SMatch* m, STeam* t, SPlayerMsg* pm);
00043
00045 bool acceptPlayerCreation();
00046
00049 bool checkAndDeclareTouchdooown();
00050
00056 void setCoordinates(const Coordinates& coord, bool advertise_client = true);
00059 void setMaRemain(int new_ma_remain);
00064 void setStatus(enum eStatus new_status);
00067 void setProne();
00069 void prepareKickoff();
00070
00072 void setUsableSkill(enum eSkill skill);
00073
00075 void checkArmour(int av_mod, int inj_mod);
00077 void bePushedInTheCrowd();
00078
00081 void considerBlockDices(bool reroll);
00083 void resolveBlockDice(int chosen_dice);
00085 void resolveBlockBothDownDefender(bool block);
00087 void resolveBlockBothDownAttacker(bool block);
00089 void resolveBlockDefenderStumble(bool dodge);
00091 void setPusher(SPlayer* p);
00094 void tryBlockPush(SPlayer* target);
00096 void resolveBlockPush(int chosen_square);
00098 void considerBlockFollow();
00100 void finishBlockFollow(bool follow);
00102 void finishBlockPush();
00104 void finishBlockAction();
00105
00107 void tryCatchBall(bool accurate_pass);
00108 void finishCatchBall(bool reroll, bool success);
00110 void tryDodge();
00111 void finishDodge(bool reroll, bool success);
00113 void tryMove(Coordinates& aim);
00115 void tryPickUp();
00116 void finishPickUp(bool reroll, bool success);
00118 void tryStandUp();
00119 void finishStandUp(bool reroll, bool success);
00121 void tryTame();
00122 void finishTame(bool reroll, bool success);
00124 void tryThrow();
00125 void finishThrow(bool reroll, int success);
00126
00127
00128 void msgPlayerCoord(const MsgPlayerCoord* m);
00129 void msgAction(const MsgAction* m);
00130 void msgMove(const MsgMove* m);
00131 void msgStandUp(const MsgStandUp* m);
00132 void msgBlock(const MsgBlock* m);
00133 void msgFoul(const MsgFoul* m);
00134 void msgHandOff(const MsgHandOff* m);
00135 void msgPass(const MsgPass* m);
00136 void msgSkill(const MsgSkill* m);
00137
00138 private:
00141 void setRerollAvailability();
00144 void setUsableSkills();
00145 void setSkillAvailability(enum eSkill skill);
00147 bool canUseSkill(enum eSkill skill) const;
00149
00150
00151 enum eSkill getUsableSkill() const;
00152
00155 bool rollAgility(enum eRoll roll_type, int modifier);
00156 bool rollAgility();
00157
00159 void rollInjury(int modifier);
00161 enum eStatus rollCasualty();
00162
00164 void tryBlock();
00166 void rollBlock();
00167
00169 void tryFoul();
00170
00172 void tryHandOff();
00173
00174 void rollCatchBall();
00175 void rollDodge();
00176 void rollPickUp();
00177 void rollStandUp();
00178 void rollTame();
00179 void rollThrow();
00180
00181 int nb_block_dices_;
00182 Coordinates push_choices_[3];
00183 int nb_push_choices_;
00184 int dice_chooser_id_;
00185 enum eBlockDiceFace block_results_[3];
00186 bool target_knocked_;
00187 bool follow_;
00188
00189 Coordinates move_aim_;
00190 Coordinates move_from_;
00191 enum eRoll roll_attempted_;
00192 SkillList usable_skills_;
00193 bool reroll_enabled_;
00194 int modifier_;
00195 Coordinates throw_aim_;
00196 float distance_;
00197 bool fumble_;
00198
00199 SRules* r_;
00200 SMatch* m_;
00201 STeam* t_;
00202 SField* f_;
00203 Dice* d_;
00204 SPlayerMsg* pm_;
00205 OpStack* ops_;
00206
00207 SPlayer* pusher_;
00208 SPlayer* target_;
00209 };
00210
00211 #endif