-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharacter.h
55 lines (47 loc) · 1006 Bytes
/
character.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
#ifndef CHARACTER_H
#define CHARACTER_H
#include "LinkedList.h"
typedef struct MyCharacter {
int hp; //내 체력
int power; //힘을 얻었을 때
int shield; //내 방어도
ListNode* Mydeck;
}MyCharacter;
typedef struct EnemyPattern EnemyPattern;
struct EnemyPattern {
int is_damage;
int Enemy_damage;
int is_protect;
int Enemy_protect;
int is_buff;
int power_raise;
};
typedef struct EnemyCharacter {
int hp;
int power;
int shield;
EnemyPattern pattern[5];
} EnemyCharacter;
/* 대안
typedef struct Character {
int hp;
int power;
int shield;
int isPlayer; //0 or 1
}Character;
void do_damage(Character* attacker, Character* defender, int damage) {
if (defender->shield < damage) {
defender->hp -= damage - defender->shield;
defender->shield = 0;
}
else {
defender->shield -= damage;
}
}
int attack(Character* attacker, Character* defender, int damage, int hits) {
for (int i = hits; i--;) {
do_damage(attacker, defender, damage+attacker->power);
}
}
*/
#endif // !CHARACTER_H