-
Notifications
You must be signed in to change notification settings - Fork 0
/
Archer.cpp
53 lines (43 loc) · 1.24 KB
/
Archer.cpp
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
#include "Character.h"
#include "GameData.h"
#include "PrintFunctions.h"
void Archer::AI() {
Character* target = FindEnemy();
}
int Archer::Attack(Character* target, float multiplier) {
int attackAmount = RandomRange(0.0f, 1.0f) < 0.7f ? 1 : 2;
int result = 0;
for (int i = 0; i < attackAmount; i++) {
result += Character::Attack(target, multiplier);
}
}
int Archer::Skill(class Character* target) {
int result = 0;
if (cooldownCurrent > 0 || manaCurrent < 30) {
PrintLine("아처의 스킬 사용에 실패했습니다.");
} else if (RandomRange(0.0f, 1.0f) > 0.7f) {
result = target->TakeDamage(this, damageMax * RandomRange(1, 3));
Print(target->name);
PrintLine("에게 속공을 사용했다!");
Print(target->name);
Print("에게");
Print(ToString(result));
PrintLine("의 데미지를 입었다.");
} else {
PrintLine("아처의 스킬 사용에 실패했습니다.");
}
return result;
}
int Archer::TakeDamage(class Character* attacker, int damage) {
if (RandomRange(0.0f, 1.0f) < 0.3f) {
PrintLine("아처는 공격을 회피하고 반격 했다!");
return 0;
}
else {
return Character::TakeDamage(attacker, damage);
}
}
int Archer::Defence(class Character* target) {}
int Archer::Potion(class Character* target) {}
void Archer::TurnEnd() {}
void Archer::OnMonsterSpawn() {}