-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
44 lines (33 loc) · 1.42 KB
/
Player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef PLAYER_H
#define PLAYER_H
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "Board.h"
#include <iostream>
class ChessBoard;
class Player : public std::enable_shared_from_this<Player> {
public:
static const std::map<std::string, int> DLC_pieceCount;
static const std::map<std::string, int> noDLC_pieceCount;
Player(const std::string& name, const std::map<std::string, int>& pieceCount);
Player(const std::string& name);
std::string getName() const;
void placePiece(int pieceType, int x, int y, ChessBoard& board);
void movePiece(int fromX, int fromY, int toX, int toY, const std::string& pieceType, ChessBoard& board);
// 统一的特殊能力函数入口
void useSpecialAbility(const std::string& abilityName, int x, int y, ChessBoard& board, int targetX = -1, int targetY = -1);
void displayPieceCount() const;
std::pair<int, int> getQueenBeePosition() const;
std::map<std::string, int> pieceCount;
bool isQueenBeePlaced;
private:
std::string name;
std::pair<int, int> queenBeePosition;
void validatePiecePlacement(const std::string& pieceName) const;
void useMosquitoAbility(int mosquitoX, int mosquitoY, ChessBoard& board);
void useTidewormAbility(int tidewormX, int tidewormY, int targetX, int targetY, ChessBoard& board);
void moveLadybug(int fromX, int fromY, int toX, int toY, ChessBoard& board);
};
#endif // PLAYER_H