-
Notifications
You must be signed in to change notification settings - Fork 1
/
RandomMonster.cpp
160 lines (117 loc) · 3.73 KB
/
RandomMonster.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// --------------------------------------------------------------------------------------------------------------------------------
// DEMISERL
// Copyright 2014 Corremn
//
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
// $HeadURL: $
// --------------------------------------------------------------------------------------------------------------------------------
#include "RandomMonster.h"
#include "numbergenerator.h"
using namespace Random;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
RandomMonster::RandomMonster() :Monster()
{
}
int RandomMonster::Create(int level, int sub_type)
{
if (level > 9)
level /= level + 1;
if (sub_type == random)
sub_type = getInt(troll, goblin);
if (sub_type == troll && level < 2)
sub_type = goblin;
mLevel = level;
mLevelVariation = sub_type;
type = 8;//mRandom; *hack*
switch (sub_type)
{
case goblin: return createGoblin(level); break;
case dwarf: return createDwarf(level); break;
case spider: return createSpider(level); break;
case troll: return createTroll(level); break;
case rat: return createRat(level); break;
default: return createRat(level); break;
}
return 0;
}
int RandomMonster::createGoblin(int level)
{
symbol = 'g';
name = ("goblin");
setColor(0, 0, 200 - level * 5);
stamina = 6 + getInt(3, 1) + (level / 3);
skill = 6 + getInt(3, 1) + (level / 3);;
luck = 6 + getInt(7, 1) + (level / 3);;
sight_range = 6;
max_stamina = stamina;
humanoid = true;
setDescription("A nasty smelly goblin. ");
experience = 5 + level / 2;
return 1;
}
int RandomMonster::createRat(int level)
{
symbol = 'r';
name = ("rat");
setColor(128, 64, 32);
stamina = 6 + getInt(3, 1) + (level / 3);
skill = 6 + getInt(3, 1) + (level / 3);
luck = 6 + getInt(7, 1) + (level / 3);
sight_range = 6;
max_stamina = stamina;
setDescription("A large dog-sized rat with razor sharp teeth. ");
experience = 1;
return 1;
}
int RandomMonster::createTroll(int level)
{
symbol = 'T';
name = ("troll");
setDescription("A strong beast with teeth and claws. ");
setColor(128, 128, 0);
stamina = 15 + getInt(3, 1) + (level / 3);
skill = 8 + getInt(3, 1) + (level / 3);
luck = 6 + getInt(7, 1) + (level / 3);
sight_range = 6;
max_stamina = stamina;
humanoid = true;
experience = 5 + level / 2;
SetResistance(bFire, -10);
return 1;
}
int RandomMonster::createDwarf(int level)
{
symbol = 'd';
name = ("dwarf");
setDescription("This dwarf eyes you with suspicion. 'Do ya ave ma gold?' ");
setColor(150, 75, 0);
stamina = 9 + getInt(3, 1) + (level / 3);
skill = 7 + getInt(3, 1) + (level / 3);;
luck = 6 + getInt(7, 1) + (level / 3);;
sight_range = 6;
max_stamina = stamina;
humanoid = true;
experience = 5 + level / 2;
return 1;
}
int RandomMonster::createSpider(int level)
{
symbol = 'S';
name = ("spider");
setDescription("A large arachnid with an alien gleam in its eyes. ");
setColor(120, 150, 0);
stamina = 5 + getInt(3, 1) + (level / 3);
skill = 6 + getInt(3, 1) + (level / 3);;
luck = 6 + getInt(7, 1) + (level / 3);;
sight_range = 6;
max_stamina = stamina;
humanoid = 0;
experience = 5 + level / 2;
SetBrand(bPoison, 3);
SetResistance(bPoison, 10);
return 1;
}