forked from scarsty/kys-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomRole.cpp
More file actions
56 lines (52 loc) · 1.38 KB
/
RandomRole.cpp
File metadata and controls
56 lines (52 loc) · 1.38 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
#include "RandomRole.h"
#include "Random.h"
#include "GameUtil.h"
RandomRole::RandomRole()
{
setShowButton(false);
button_ok_ = addChild<Button>(350, 55);
button_ok_->setText("確定");
head_ = addChild<Head>(-290, 100);
}
RandomRole::~RandomRole()
{
}
void RandomRole::onPressedOK()
{
if (button_ok_->getState() == NodePress)
{
result_ = 0;
setExit(true);
return;
}
RandomDouble r;
role_->MaxHP = 25 + r.rand_int(26);
role_->HP = role_->MaxHP;
role_->MaxMP = 25 + r.rand_int(26);
role_->MP = role_->MaxMP;
role_->MPType = r.rand_int(2);
role_->IncLife = 1 + r.rand_int(10);
role_->Attack = 25 + r.rand_int(6);
role_->Speed = 25 + r.rand_int(6);
role_->Defence = 25 + r.rand_int(6);
role_->Medicine = 25 + r.rand_int(6);
role_->UsePoison = 25 + r.rand_int(6);
role_->Detoxification = 25 + r.rand_int(6);
role_->Fist = 25 + r.rand_int(6);
role_->Sword = 25 + r.rand_int(6);
role_->Knife = 25 + r.rand_int(6);
role_->Unusual = 25 + r.rand_int(6);
role_->HiddenWeapon = 25 + r.rand_int(6);
role_->IQ = 1 + r.rand_int(100);
for (auto& e:role_->EquipMagic)
{
e = role_->MagicID[0];
}
LOG("IQ is {}\n", role_->IQ);
}
void RandomRole::draw()
{
Engine::getInstance()->fillColor({ 0, 0, 0, 192 }, 0, 0, -1, -1);
head_->setRole(role_);
UIStatus::draw();
}