This repository was archived by the owner on Mar 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoop.cpp
More file actions
112 lines (98 loc) · 3.25 KB
/
Copy pathLoop.cpp
File metadata and controls
112 lines (98 loc) · 3.25 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
//
// Created by ezrozpi on 2017-11-28.
//
#include "Loop.h"
void Loop::mainLoop()
{
std::shared_ptr<Data> data = std::make_shared <Data>();
std::shared_ptr<Menu> menu = std::make_shared <Menu>();
std::shared_ptr<Create> create = std::make_shared <Create>();
std::shared_ptr<Select> select = std::make_shared <Select>();
std::shared_ptr<Stats> stats = std::make_shared <Stats>();
std::shared_ptr<Shop> shop = std::make_shared <Shop>();
std::shared_ptr<Training> training = std::make_shared <Training>();
std::shared_ptr<Item> items = std::make_shared <Item>();
Skill::createSkills (data->skills);
do
{
status = e_loop_cancel;
menu->print();
status = menu->choice();
switch(status)
{
case e_loop_create:
{
create->print();
set = create->choice();
create->createPlayer(data->players,set);
data->activeplayer = data->players.size ()-1;
}
break;
case e_loop_select:
{
if(data->players.empty() == 0)
{
select->print(data->players);
set = select->choice();
if(set !=0 && set < data->players.size ())
data->activeplayer = select->selectPlayer(set);
}
}
break;
case e_loop_stats:
{
if(data->players.empty() == 0)
{
stats->print(data->players[data->activeplayer]);
stats->printMoves (data->players[data->activeplayer],data->skills);
}
}
break;
case e_loop_battle:
{
if(data->players.empty() == 0)
{
data->enemies = Battle::createEnemy(data->enemies);
Battle::doBattle(data->players[data->activeplayer],
data->enemies[data->enemies.size()-1],
data->skills);
}
}
break;
case e_loop_shop:
{
if(data->players.empty() == 0)
{
shop->openShop(data->players[data->activeplayer]);
}
}
break;
case e_loop_training:
{
if(data->players.empty() == 0)
{
training->openTraining(data->players[data->activeplayer]);
}
}
break;
case e_loop_skills:
{
if(data->players.empty() == 0)
{
Skill::printSkills(data->skills);
}
}
break;
case e_loop_items:
{
if(data->players.empty() == 0)
{
items->openItem(data->players[data->activeplayer]);
}
}
break;
default:
return;
}
}while(status != e_loop_cancel);
}