1 Star 0 Fork 89

李贺军/Landlords

forked from ibc-dabing/Landlords 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
player.h 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2021-12-16 00:16 . 代码优化, 提高程序的健壮性
#ifndef PLAYER_H
#define PLAYER_H
#include <QObject>
#include "cards.h"
class Player : public QObject
{
Q_OBJECT
public:
enum Role{Lord, Farmer}; // 角色
enum Sex{Man, Woman}; // 性别
enum Direction{Left, Right}; // 头像的显示方位
enum Type{Robot, User, UnKnow}; // 玩家的类型
explicit Player(QObject *parent = nullptr);
explicit Player(QString name, QObject *parent = nullptr);
void setName(QString name);
QString getName();
void setRole(Role role);
Role getRole();
void setSex(Sex sex);
Sex getSex();
void setDirection(Direction direction);
Direction getDirection();
void setType(Type type);
Type getType();
void setScore(int score);
int getScore();
void setWin(bool flag);
bool isWin();
void setPrevPlayer(Player* player);
void setNextPlayer(Player* player);
Player* getPrevPlayer();
Player* getNextPlayer();
void grabLordBet(int point);
void storeDispatchCard(const Card& card);
void storeDispatchCard(const Cards& cards);
Cards getCards();
void clearCards();
void playHand(const Cards& cards);
Player* getPendPlayer();
Cards getPendCards();
void storePendingInfo(Player* player, const Cards& cards);
virtual void prepareCallLord();
virtual void preparePlayHand();
virtual void thinkCallLord();
virtual void thinkPlayHand();
signals:
void notifyGrabLordBet(Player* player, int bet);
void notifyPlayHand(Player* player, const Cards& card);
void notifyPickCards(Player* player, const Cards& cards);
protected:
int m_score = 0;
QString m_name;
Role m_role;
Sex m_sex;
Direction m_direction;
Type m_type;
bool m_isWin = false;
Player* m_prev = nullptr;
Player* m_next = nullptr;
Cards m_cards;
Cards m_pendCards;
Player* m_pendPlayer = nullptr;
};
#endif // PLAYER_H
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/li-hejun/landlords.git
git@gitee.com:li-hejun/landlords.git
li-hejun
landlords
Landlords
master

搜索帮助