-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stage.cpp
56 lines (41 loc) · 1.1 KB
/
Stage.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
54
55
56
#include "Stage.h"
#include "Player.h"
#include "Monster.h"
CStage::CStage()
{
}
CStage::~CStage()
{
}
int CStage::OutputMenu()
{
cout << "1. 공격" << endl;
cout << "2. 뒤로가기" << endl;
cout << "메뉴를 선택하세요 : ";
int iMenu = Input<int>();
if (iMenu <= MENU_NONE || iMenu > MENU_BACK)
return MENU_NONE;
return iMenu;
}
CStage::BATTLE_FLAG CStage::BattleAttack(CPlayer * pPlayer, CMonster * pMonster)
{
int iDamage = pPlayer->GetDamage() - pMonster->GetArmor();
iDamage = iDamage < 1 ? 1 : iDamage;
cout << pPlayer->GetName() << "가 " << pMonster->GetName() << "에게 " <<
iDamage << "피해를 주었습니다." << endl;
if (pMonster->Damage(iDamage))
{
return BF_MONSTER_DIE;
}
iDamage = pMonster->GetDamage() - pPlayer->GetArmor();
iDamage = iDamage < 1 ? 1 : iDamage;
cout << pMonster->GetName() << "가 " << pPlayer->GetName() << "에게 " <<
iDamage << "피해를 주었습니다." << endl;
if (pPlayer->Damage(iDamage))
return BF_PLAYER_DIE;
return BF_NONE;
}
void CStage::OutputStageName(const string& strName)
{
cout << "===================" << strName << "===================" << endl;
}