-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.h
62 lines (49 loc) · 1.16 KB
/
card.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef CARD_H
#define CARD_H
#define CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include "game.h"
#include "LinkedList.h"
#include "draw.h"
#include "time.h"
ListNode* head = NULL;
ListNode* Init_Card() { //초기 카드 세팅
for (int i = 0; i < 5; i++) { //5장 타격설정
head = insert_first(head, 0); //타격
}
for (int i = 5; i < 9; i++) { //4장 수비설정
head = insert_first(head, 1); //수비
}
//마지막한장 강타 설정.
head = insert_first(head, 2); //강타
return head;
}
void AddCardToDeck(int num) { //선택한 카드를 덱에 추가하는 함수
head = insert_first(head, num);
return head;
}
void MixCard(int CardCount, ListNode* MyDeck) {// 덱에서 카드를 섞는다.
int a, b;
srand((unsigned)time(NULL));
a = rand() % CardCount;
b = rand() % CardCount;
if (a == b) {
b = rand() % CardCount;
}
clist* list = (clist *)malloc(sizeof(clist));
list->first = MyDeck;
list->count = 0;
change_data(list, a, b); //오류가능성
GotoXY(50, 20);
SET_GREEN
printf("카드를 섞는중입니다...");
SET_WHITE
Sleep(300);
Clear();
Deck_print(MyDeck);
free(list);
}
void PlayCard() { // 선택한 카드의 효과를 발동하는 함수, 카드의 효과를 게임 상태에 적용
}
#endif