-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealer.cpp
243 lines (213 loc) · 7 KB
/
healer.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/**************************************************************************/
// healer.h - The heal code
/***************************************************************************
* The Dawn of Time v1.69r (c)1997-2004 Michael Garratt *
* >> A number of people have contributed to the Dawn codebase, with the *
* majority of code written by Michael Garratt - www.dawnoftime.org *
* >> To use this source code, you must fully comply with all the licenses *
* in licenses.txt... In particular, you may not remove this copyright *
* notice. *
***************************************************************************
* >> Original Diku Mud copyright (c)1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, & Katja Nyboe. *
* >> Merc Diku Mud improvements copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* >> ROM 2.4 is copyright 1993-1995 Russ Taylor and has been brought to *
* you by the ROM consortium: Russ Taylor([email protected]), *
* Gabrielle Taylor([email protected]) & Brian Moore([email protected]) *
* >> Oblivion 1.2 is copyright 1996 Wes Wagner *
**************************************************************************/
#include "include.h" // dawn standard includes
#include "magic.h"
/**************************************************************************/
void do_heal(char_data *ch, char *argument)
{
char_data *mob;
char arg[MIL];
char target[MIL];
int cost,sn;
SPELL_FUN *spell;
char *words;
char_data *victim=ch; // default 'victim' of heal
// exception in here so players can buy heals while badly hurt
// but can't while sleeping
if (ch->position == POS_SLEEPING)
{
ch->println("You can't do that while sleeping.");
return;
}
// check for healer
for ( mob = ch->in_room->people; mob; mob = mob->next_in_room )
{
if ( IS_NPC(mob) && IS_SET(mob->act, ACT_IS_HEALER) )
break;
}
if ( mob == NULL )
{
ch->println("You can't do that here.");
return;
}
if ( ch->fighting ) {
if ( ch->fighting == mob ){
ch->println("The healer doesn't seem to want to help you at the moment, you wonder why?");
}else{
ch->println("You seem to be too busy to exchange gold for services rendered.");
}
return;
}
argument=one_argument(argument,arg);
one_argument(argument,target);
if(!IS_NULLSTR(target)){
victim= get_char_room( ch,target);
if(!victim){
ch->printlnf("'%s' doesn't appear to be here.", target);
return;
}
}
if (arg[0] == '\0')
{
// display price list
act("$N says 'I offer the following spells:'",ch,NULL,mob,TO_CHAR);
ch->println(" light: cure light wounds 1 gold");
ch->println(" serious: cure serious wounds 2 gold");
ch->println(" critic: cure critical wounds 5 gold");
ch->println(" refresh: restore movement 5 gold");
ch->println(" disease: cure disease 8 gold");
ch->println(" heal: healing spell 10 gold");
ch->println(" blind: cure blindness 10 gold");
ch->println(" poison: cure poison 10 gold");
ch->println(" mana: restore mana 10 gold");
ch->println(" headache: cure headache 15 gold");
ch->println(" uncurse: remove curse 20 gold");
ch->println(" cancel: cancellation 30 gold");
ch->println(" chaos: chaotic poison 35 gold");
ch->println("");
ch->println(" Type heal <type> to be healed.");
ch->println(" You can pay the healer to heal someone else using:");
ch->println(" heal <type> <person>.");
return;
}
if (!str_prefix(arg,"light"))
{
spell = spell_cure_light;
sn = skill_lookup("cure light");
words = "judicandus dies";
cost = 100;
}
else if (!str_prefix(arg,"serious"))
{
spell = spell_cure_serious;
sn = skill_lookup("cure serious");
words = "judicandus gzfuajg";
cost = 200;
}
else if (!str_prefix(arg,"critical"))
{
spell = spell_cure_critical;
sn = skill_lookup("cure critical");
words = "judicandus qfuhuqar";
cost = 500;
}
else if (!str_prefix(arg,"heal"))
{
spell = spell_heal;
sn = skill_lookup("heal");
words = "pzar";
cost = 1000;
}
else if (!str_prefix(arg,"blindness"))
{
spell = spell_cure_blindness;
sn = skill_lookup("cure blindness");
words = "judicandus noselacri";
cost = 1000;
}
else if (!str_prefix(arg,"disease"))
{
spell = spell_cure_disease;
sn = skill_lookup("cure disease");
words = "judicandus eugzagz";
cost = 800;
}
else if (!str_prefix(arg,"poison"))
{
spell = spell_cure_poison;
sn = skill_lookup("cure poison");
words = "judicandus sausabru";
cost = 1000;
}
else if (!str_prefix(arg,"cancel"))
{
spell = spell_cancellation;
sn = gsn_cancellation;
words = "judicandus katesism";
cost = 3000;
}
else if (!str_prefix(arg,"chaos"))
{
spell = spell_cure_chaotic_poison;
sn = gsn_chaotic_poison;
words = "judicandus erdanata";
cost = 3500;
}
else if (!str_prefix(arg,"uncurse") || !str_prefix(arg,"curse"))
{
spell = spell_remove_curse;
sn = skill_lookup("remove curse");
words = "candussido judifgz";
cost = 2000;
}
else if (!str_prefix(arg,"mana") || !str_prefix(arg,"energize"))
{
spell = NULL;
sn = -1;
words = "energizer";
cost = 1000;
}
else if (!str_prefix(arg,"headache"))
{
spell = spell_cure_headache;
sn = skill_lookup("cure headache");
words = "treifher";
cost = 1500;
}
else if (!str_prefix(arg,"refresh") || !str_prefix(arg,"moves"))
{
spell = spell_refresh;
sn = skill_lookup("refresh");
words = "candusima";
cost = 500;
}
else
{
act("$N says 'Type 'heal' for a list of spells.'",
ch,NULL,mob,TO_CHAR);
return;
}
if (cost > (ch->gold * 100 + ch->silver))
{
act("$N says 'You do not have enough gold for my services.'",
ch,NULL,mob,TO_CHAR);
return;
}
WAIT_STATE(ch,PULSE_VIOLENCE);
deduct_cost(ch,cost);
mob->gold += cost;
limit_mobile_wealth(mob);
if(victim!=ch){ // do a nod to show who payed for the heal
act( "$N nods at you.", ch, NULL, mob, TO_CHAR );
act( "$N nods at $n.", ch, NULL, mob, TO_ROOM );
}
act("$n utters the words '$T'.",mob,NULL,words,TO_ROOM);
if (spell == NULL) // restore mana trap...kinda hackish
{
victim->mana += dice(4,8) + mob->level / 2;
victim->mana = UMIN(victim->mana,victim->max_mana);
victim->println("A warm glow passes through you.");
return;
}
if (sn == -1)
return;
spell(sn,mob->level,mob,victim,TARGET_CHAR);
}
/**************************************************************************/