-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
188 lines (177 loc) · 3.2 KB
/
main.c
File metadata and controls
188 lines (177 loc) · 3.2 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <conio.h>
#include <time.h>
#include <string.h>
#include <Windows.h>
#define VER "0.1.0"
typedef struct player {
int turn;
int max_turn;
bool is_playing;
}pl;
typedef struct chA {
int backstab;
int damage;
int range;
}assassin;
typedef struct chB {
int damage;
}builder;
typedef struct chC {
int range;
int debuff;
int penalty;
int count;
}conductor;
typedef struct chD {
int passiveHeal;
int range;
int activeHeal;
}doctor;
typedef struct chE {
int immune;
int range;
int damage;
}elephant;
typedef struct chF {
int selfHeal;
int japDamage;
int hookDamage;
int UpppercutDamage;
}fighter;
typedef struct chG {
int avoidChance;
int zero;
int one;
int three;
int five;
int ten;
int die;
}gambler;
typedef struct chH {
int killHeal;
int rangeThree;
int rangeTwo;
int rangeOne;
}hunter;
typedef struct chI {
int plusTurn;
}inventor;
typedef struct agents {
char type;
int health;
int maxHealth;
int activeCost;
int moveType;
int moveTime;
int x;
int y;
bool is_dead;
assassin a;
builder b;
conductor c;
}agent;
void CursorView();
void gotoxy(int x, int y);
void printBoard(int map[10][20], agent p1A, agent p1B, agent p2A, agent p2B);
int(*getMap(int mapType))[20];
int main() {
int (*map)[20] = getMap(2);
agent p1A;
p1A.x = 0;
p1A.y = 4;
p1A.type = 'A';
agent p2A;
p2A.x = 19;
p2A.y = 4;
p2A.type = 'C';
printBoard(map, p1A, p1A, p2A, p2A);
CursorView();
}
void gotoxy(int x, int y) { //커서 이동
COORD pos = { x,y };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void CursorView() {
CONSOLE_CURSOR_INFO cursorInfo = { 0, };
cursorInfo.dwSize = 1; //커서 굵기 (1 ~ 100)
cursorInfo.bVisible = FALSE; //커서 Visible TRUE(보임) FALSE(숨김)
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursorInfo);
}
void printBoard(int map[10][20], agent p1A, agent p1B, agent p2A, agent p2B) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 20; j++) {
if (map[i][j] == 0) {
if (p1A.x == j && p1A.y == i) {
printf("%c ", p1A.type);
}
else if (p1B.x == j && p1B.y == i) {
printf("%c ", p1B.type);
}
else if (p2A.x == j && p2A.y == i) {
printf("%c ", p2A.type);
}
else if (p2B.x == j && p2B.y == i) {
printf("%c ", p2B.type);
}
else {
printf("* ");
}
}
else if (map[i][j] == 1) {
printf("# ");
}
}
printf("\n");
}
}
int(*getMap(int mapType))[20]{
static int map[10][20];
int land = 0;
if (mapType == 1) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 20; j++) {
map[i][j] = 0;
}
}
}
if (mapType == 2) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 20; j++) {
if (i < 5 && j == 4) {
land = 1;
}
else if (i < 5 && j == 14) {
land = 1;
}
else if (i >= 5 && j == 9) {
land = 1;
}
else {
land = 0;
}
map[i][j] = land;
}
}
}
if (mapType == 3) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 20; j++) {
if (i < 3 && j > 4 && j < 15) {
land = 1;
}
else if (i > 6 && j > 4 && j < 15) {
land = 1;
}
else {
land = 0;
}
map[i][j] = land;
}
}
}
return map;
}