forked from dungeons-of-moria/icmoria
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sing.c
318 lines (271 loc) · 7.62 KB
/
sing.c
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* sing.c */
/**/
#include "imoria.h"
#include "dungeon.h"
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
void s__bard_effects(integer effect)
{
/*{ Songs.... }*/
integer i2,i3,dir;
integer dumy,y_dumy,x_dumy;
y_dumy = char_row;
x_dumy = char_col;
switch (effect+1) {
case 1 : /*{ Detect Monster }*/
detect_creatures(c_monster);
break;
case 2 : /*{ Battle Song }*/
bless(randint(12)+12);
break;
case 3 : /*{ Blink }*/
teleport(10);
break;
case 4 : /*{ Light }*/
light_area(char_row,char_col);
break;
case 5 : /*{ Detect Doors }*/
detect_sdoor();
detect_trap();
break;
case 6 : /*{ Magical Jig }*/
if (d__get_dir("Which direction?",&dir,&dumy,&y_dumy,&x_dumy)) {
zap_monster(dir,char_row,char_col,0,c_confuse);
}
break;
case 7 : /*{ Detect Magic }*/
detect_magic();
break;
case 8 : /*{ Minor Cure }*/
hp_player(damroll("5d3"),"a magic spell.");
break;
case 9 : /*{ Battle Dance }*/
py.flags.hero += (randint(10) +5);
bless(randint(20)+20);
break;
case 10 : /*{ Charm Monsters }*/
sleep_monsters1(char_row,char_col);
break;
case 11 : /*{ Detect Curse }*/
detect_curse();
break;
case 12 : /*{ Detect Invisible }*/
detect_creatures(c_invisible);
break;
case 13 : /*{ Cure Poison }*/
cure_me(&(py.flags.poisoned));
break;
case 14 : /*{ Invisibility }*/
py.flags.temp_stealth += randint(15)+10;
break;
case 15 : /*{ Teleport Self }*/
teleport(py.misc.lev*6);
break;
case 16 : /*{ Infravision }*/
py.flags.tim_infra += randint(50) + 50;
break;
case 17 : /*{ Physical Humor }*/
if (d__get_dir("Which diretion?",&dir,&dumy,&y_dumy,&x_dumy)) {
fire_bolt(c_joke,dir,char_row,char_col,damroll("3d8"),
"punch line");
}
break;
case 18 : /*{ Recharge Item }*/
recharge(20);
break;
case 19 : /*{ Remove Curse }*/
for (i2 = Equipment_min ; i2 <= EQUIP_MAX-1 ; i2++) {
//with equipment[i2] do;
equipment[i2].flags &= 0x7FFFFFFF;
}
break;
case 20 : /*{ Legend Lore }*/
ident_spell();
break;
case 21 : /*{ Mass Charm }*/
zap_area(0,0,c_sleep);
break;
case 22 : /*{ Detect Treasure }*/
detect_item(c_treasure);
break;
case 23 : /*{ Detect Object }*/
detect_item(c_object);
break;
case 24 : /*{ Resist Petrification }*/
py.flags.resist_petri += randint(15) + 10;
break;
case 25 : /*{ Create Food and Drink }*/
create_food(3,9,1,0,0);
break;
case 26 : /*{ Panic }*/
msg_print("You scare the creatures!");
zap_area(0,0,c_confuse);
break;
case 27 : /*{ Word of Recall }*/
py.flags.word_recall = randint(20) + 20;
break;
case 28 : /*{ Protection from Nature }*/
//with py.flags do;
PF.resist_heat += randint(15) +10;
PF.resist_cold += randint(15) +10;
PF.resist_lght += randint(15) +10;
break;
case 29 : /*{ See Invisible }*/
detect_inv2(randint(24)+24);
break;
case 30 : /*{ Magic Mapping }*/
map_area();
break;
case 31 : /*{ Joke of Death }*/
if (d__get_dir("Which direction?",&dir,&dumy,&y_dumy,&x_dumy)) {
fire_ball(c_joke,dir,char_row,char_col,30,"terrible joke");
}
break;
case 32 : /*{ Battle Frenzy }*/
bless(randint(30)+30);
py.flags.hero = randint(30)+30;
py.flags.shero = randint(30)+30;
break;
case 33 : /*{ Slow Creature }*/
if (d__get_dir("Which direction?",&dir,&dumy,&y_dumy,&x_dumy)) {
zap_monster(dir,char_row,char_col,-1,c_speed);
}
break;
case 34 : /*{ Resist Charm }*/
//with py.flags do;
PF.free_time += randint(10) + py.misc.lev;
PF.magic_prot += randint(10) + py.misc.lev;
break;
case 35 : /*{ Item Lore }*/
lore_spell();
break;
case 36 : /*{ Song of Protection }*/
py.flags.protmon = (randint(20)+py.misc.lev );
protect_evil();
bless(randint(24)+24);
break;
case 37 : /*{ Last Laugh }*/
zap_area(0,50,c_joke);
break;
case 38 : /*{ Teleport Level }*/
dun_level += 2*randint(2) - 3;
if (dun_level < 1) {
dun_level = 1;
}
moria_flag = true;
break;
case 39 : /*{ Clairvoyance }*/
redraw = true;
wizard_light();
for (i2 = (char_col + 1); i2 <= (char_col - 1); i2++) {
for (i3 = (char_row + 1); i3 <= (char_row - 1); i3++) {
if (test_light(i3,i2)) {
redraw = false;
}
}
}
if (redraw) {
wizard_light();
}
break;
case 40 : /*{ Song of Power }*/
zap_area(0x0006,4*py.misc.lev,c_hp);
cure_me(&(py.flags.poisoned));
hp_player(300, "a spell");
cure_me(&py.flags.blind);
break;
default:
break;
}
/*{ End of songs... }*/
};
//////////////////////////////////////////////////////////////////////
void sing()
{
/*{ Sing a Bard song -CAPN/DMF- }*/
integer i2;
treas_ptr i1,item_ptr;
integer choice,chance;
char trash_char;
boolean redraw;
obj_set song_books = {Song_Book, 0};
reset_flag = true;
if (py.flags.hoarse > 0) {
msg_print("You are too hoarse to sing!");
} else if (py.flags.afraid > 0) {
msg_print("You are too scared to play music!");
} else if (py.flags.confused > 0) {
msg_print("You are too confused...");
} else if (class[py.misc.pclass].bspell) {
if (inven_ctr > 0) {
if (find_range(song_books,false,&i1,&i2)) {
redraw = false;
if (get_item(&item_ptr,"Use which Instrument?",
&redraw,i2,&trash_char,false,false)) {
if (cast_spell("Play which song?",item_ptr,
&choice,&chance,&redraw)) {
//with magic_spell[py.misc.pclass][choice]. do;
reset_flag = false;
if (randint(100) < chance) {
switch (randint(5)) {
case 1 : msg_print("*Squak*"); break;
case 2 : msg_print("*Gag!*"); break;
case 3 : msg_print("*Aaugh!*"); break;
case 4 : msg_print("*Yargh!*"); break;
case 5 : msg_print("*Cough!*"); break;
} ; /*{ of the bad notes }*/
switch (randint(2)) {
case 1 : msg_print("You sing a sour note!");break;
case 2 : msg_print("You sing an awful note!");break;
}
} else {
s__bard_effects(choice);
if (!reset_flag) {
//with py.misc do;
PM.exp += magic_spell[py.misc.pclass][choice].sexp;
prt_experience();
magic_spell[py.misc.pclass][choice].sexp = 0;
}
}
//with py.misc do;
if (!reset_flag) {
if (magic_spell[py.misc.pclass][choice].smana > PM.cmana) {
msg_print("You lose your voice attempting the song!");
py.flags.hoarse =
randint(5*trunc(magic_spell[py.misc.pclass][choice].smana-PM.cmana));
PM.cmana = 0;
if (randint(3) == 1) {
lower_stat(CHR,"Your self-esteem is lowered!");
}
} else {
PM.cmana -= magic_spell[py.misc.pclass][choice].smana;
}
prt_mana();
}
}
} else {
if (redraw) {
draw_cave();
}
}
} else {
msg_print("But you are not carrying any Instruments!");
}
} else {
msg_print("But you are not carrying any Instruments!");
}
} else {
switch (bard_adj()+randint(4)) {
case 1: case 2 : msg_print("You utter a gutteral cry."); break;
case 3: case 4 : msg_print("You mumble a simple tune."); break;
case 5: case 6 : msg_print("You sing a fair song."); break;
case 7: case 8 : msg_print("You sing a very nice song."); break;
case 9: case 10: case 11 :msg_print("You sing quite beautifully.");break;
}
}
};
/* END FILE sing.c */
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////