-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrule.cpp
More file actions
54 lines (50 loc) ยท 1.83 KB
/
rule.cpp
File metadata and controls
54 lines (50 loc) ยท 1.83 KB
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
45
46
47
48
49
50
51
52
53
54
#include "rule.h"
void Rule::checkChongtong(Player* player) {
int check_month_;
int check_count_[13] = {
0,
};
// ์ ํจ์ ์๋ ์นด๋์ ์... ex) 1์์ด๋ฉด index 1์ ์ ๊ทผ
// check_count_์ index์ ํด๋นํ๋ ์์์ +1
if (!(*player).getHandList().empty()) {
for (int i = 0; i < (*player).getHandList().size(); i++) {
check_month_ = (*player).getHandList()[i].getMonth();
check_count_[check_month_]++;
}
for (int i = 1; i < 13; i++) {
if (check_count_[i] == 4) {
(*player).winner_ = true;
break;
}
}
}
}
void Rule::getCardsFromFloorWithBreak(Deck* deck, Player* now_p_,
Hwatoo* card) {
std::vector<Hwatoo> list = (deck->floor).sameCardList(*card);
// ๋ฐ๋ฅ์ ๊ฐ์ ์ ์นด๋ ์ฐพ๊ธฐ ์ํ ๋ฆฌ์คํธ ์์ฑ
for (itor = list.begin(); itor != list.end(); ++itor) {
now_p_->my_card_list_.eatCard(&(*itor));
deck->floor.removeCard(*itor);
break;
// ๊ฐ์ ์ ์นด๋ ๋จน์ํจ๋ก ์ด๋, ๋ฐ๋ฅ ํจ์์ ์ง์ฐ๊ธฐ
}
}
void Rule::getCardsFromFloor(Deck* deck, Player* now_p_, Hwatoo* card) {
std::vector<Hwatoo> list = (deck->floor).sameCardList(*card);
// ๋ฐ๋ฅ์ ๊ฐ์ ์ ์นด๋ ์ฐพ๊ธฐ ์ํ ๋ฆฌ์คํธ ์์ฑ
for (itor = list.begin(); itor != list.end(); ++itor) {
now_p_->my_card_list_.eatCard(&(*itor));
deck->floor.removeCard(*itor);
// ๊ฐ์ ์ ์นด๋ ๋จน์ํจ๋ก ์ด๋, ๋ฐ๋ฅ ํจ์์ ์ง์ฐ๊ธฐ
}
}
void Rule::getCardsFromOthers(Player* now_p_, Player* other1_p_,
Player* other2_p_) {
Hwatoo* card = other1_p_->my_card_list_.stealCard();
now_p_->my_card_list_.eatCard(card);
other1_p_->my_card_list_.removePCard();
card = other2_p_->my_card_list_.stealCard();
now_p_->my_card_list_.eatCard(card);
other2_p_->my_card_list_.removePCard();
}