ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/rune.C
(Generate patch)

Comparing deliantra/server/server/rune.C (file contents):
Revision 1.4 by root, Sun Sep 10 15:59:57 2006 UTC vs.
Revision 1.39 by root, Sun Jan 4 22:39:59 2009 UTC

1
2/* 1/*
3 * static char *rcsid_rune_c = 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
4 * "$Id: rune.C,v 1.4 2006/09/10 15:59:57 root Exp $"; 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 *
8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 * The authors can be reached via e-mail to <support@deliantra.net>
5 */ 22 */
6 23
7/*
8 CrossFire, A Multiplayer game for X-windows
9
10 Copyright (C) 2003 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
27 The authors can be reached via e-mail at crossfire-devel@real-time.com
28*/
29
30#include <global.h> 24#include <global.h>
31#ifndef __CEXTRACT__
32# include <sproto.h> 25#include <sproto.h>
33#endif
34#include <spells.h> 26#include <spells.h>
35
36 27
37#ifndef sqr 28#ifndef sqr
38# define sqr(x) ((x)*(x)) 29# define sqr(x) ((x)*(x))
39#endif 30#endif
40
41 31
42/* peterm: 32/* peterm:
43 * write_rune: 33 * write_rune:
44 * op: rune writer 34 * op: rune writer
45 * skop: skill object used for casting this rune 35 * skop: skill object used for casting this rune
46 * dir: orientation of rune, direction rune's contained spell will 36 * dir: orientation of rune, direction rune's contained spell will
47 * be cast in, if applicable 37 * be cast in, if applicable
48 * inspell: spell object to put into the rune, can be null if doing 38 * spell: spell object to put into the rune
49 * a marking rune.
50 * level: level of casting of the rune 39 * level: level of casting of the rune
51 * runename: name of the rune or message displayed by the rune for 40 * runename: name of the rune or message displayed by the rune for
52 * a rune of marking 41 * a rune of marking
53 */ 42 */
54
55int 43int
56write_rune (object *op, object *caster, object *spell, int dir, const char *runename) 44write_rune (object *op, object *caster, object *spell, int dir, const char *runename)
57{ 45{
58 object *tmp, *rune_spell, *rune; 46 object *tmp, *rune_spell, *rune;
59 char buf[MAX_BUF]; 47 maptile *m;
60 mapstruct *m;
61 sint16 nx, ny; 48 sint16 nx, ny;
62 49
63 if (!dir) 50 if (!dir)
64 {
65 dir = 1; 51 dir = 1;
66 }
67 52
68 nx = op->x + freearr_x[dir]; 53 nx = op->x + freearr_x[dir];
69 ny = op->y + freearr_y[dir]; 54 ny = op->y + freearr_y[dir];
70 m = op->map; 55 m = op->map;
71 56
72 if (get_map_flags (m, &m, nx, ny, &nx, &ny)) 57 if (get_map_flags (m, &m, nx, ny, &nx, &ny) & (P_OUT_OF_MAP | P_SAFE | P_NO_MAGIC | P_NO_CLERIC))
73 { 58 {
74 new_draw_info (NDI_UNIQUE, 0, op, "Can't make a rune there!"); 59 new_draw_info (NDI_UNIQUE, 0, op, "Can't make a rune there!");
75 return 0; 60 return 0;
76 } 61 }
62
77 for (tmp = get_map_ob (m, nx, ny); tmp != NULL; tmp = tmp->above) 63 for (tmp = m->at (nx, ny).bot; tmp; tmp = tmp->above)
78 if (tmp->type == RUNE) 64 if (tmp->type == RUNE)
79 break; 65 break;
80 66
81 if (tmp) 67 if (tmp)
82 { 68 {
83 new_draw_info (NDI_UNIQUE, 0, op, "You can't write a rune there."); 69 new_draw_info (NDI_UNIQUE, 0, op, "You can't write a rune on top of another rune.");
84 return 0; 70 return 0;
85 } 71 }
86 72
87 if (spell->other_arch) 73 if (spell->other_arch)
88 {
89 rune_spell = arch_to_object (spell->other_arch); 74 rune_spell = arch_to_object (spell->other_arch);
90 }
91 else 75 else
92 { 76 {
93 /* Player specified spell. The player has to know the spell, so 77 /* Player specified spell. The player has to know the spell, so
94 * lets just look through the players inventory see if they know it 78 * lets just look through the players inventory see if they know it
95 * use the item_matched_string for our typical matching method. 79 * use the item_matched_string for our typical matching method.
102 return 0; 86 return 0;
103 } 87 }
104 88
105 rune_spell = NULL; 89 rune_spell = NULL;
106 for (tmp = op->inv; tmp; tmp = tmp->below) 90 for (tmp = op->inv; tmp; tmp = tmp->below)
107 {
108 if (tmp->type == SPELL) 91 if (tmp->type == SPELL)
109 { 92 {
110 ms = item_matched_string (op, tmp, runename); 93 ms = item_matched_string (op, tmp, runename);
111 if (ms > bestmatch) 94 if (ms > bestmatch)
112 { 95 {
113 bestmatch = ms; 96 bestmatch = ms;
114 rune_spell = tmp; 97 rune_spell = tmp;
115 } 98 }
116 } 99 }
117 } 100
118 if (!rune_spell) 101 if (!rune_spell)
119 { 102 {
120 new_draw_info_format (NDI_UNIQUE, 0, op, "You don't know any spell named %s", runename); 103 new_draw_info_format (NDI_UNIQUE, 0, op, "You don't know any spell named %s.", runename);
121 return 0; 104 return 0;
122 } 105 }
106
123 if (rune_spell->skill != spell->skill) 107 if (rune_spell->skill != spell->skill)
124 { 108 {
125 new_draw_info_format (NDI_UNIQUE, 0, op, "You can't cast %s with %s", &rune_spell->name, &spell->name); 109 new_draw_info_format (NDI_UNIQUE, 0, op, "You can't cast %s with %s. H<The spell must be of the %s spell school.>", &rune_spell->name, &spell->name, &spell->skill);
126 return 0; 110 return 0;
127 } 111 }
112
128 if (caster->path_denied & spell->path_attuned) 113 if (caster->path_denied & spell->path_attuned && !caster->flag [FLAG_WIZCAST])
129 { 114 {
130 new_draw_info_format (NDI_UNIQUE, 0, op, "%s belongs to a spell path denied to you.", &rune_spell->name); 115 new_draw_info_format (NDI_UNIQUE, 0, op, "%s belongs to a spell path denied to you.", &rune_spell->name);
131 return 0; 116 return 0;
132 } 117 }
118
133 if (caster_level (caster, rune_spell) < rune_spell->level) 119 if (casting_level (caster, rune_spell) < rune_spell->level && !caster->flag [FLAG_WIZCAST])
134 {
135 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is beyond your ability to cast!", &rune_spell->name);
136 return 0;
137 } 120 {
121 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is beyond your ability to cast! H<Your effetcive casting level is too low.>", &rune_spell->name);
122 return 0;
123 }
124
138 if (SP_level_spellpoint_cost (caster, rune_spell, SPELL_MANA) > op->stats.sp) 125 if (SP_level_spellpoint_cost (caster, rune_spell, SPELL_MANA) > op->stats.sp)
139 { 126 {
140 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough mana."); 127 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough mana.");
141 return 0; 128 return 0;
142 } 129 }
130
143 if (SP_level_spellpoint_cost (caster, rune_spell, SPELL_GRACE) > op->stats.grace) 131 if (SP_level_spellpoint_cost (caster, rune_spell, SPELL_GRACE) > op->stats.grace)
144 { 132 {
145 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough grace."); 133 new_draw_info (NDI_UNIQUE, 0, op, "You don't have enough grace.");
146 return 0; 134 return 0;
147 } 135 }
136
148 op->stats.grace -= SP_level_spellpoint_cost (caster, rune_spell, SPELL_GRACE); 137 op->stats.grace -= SP_level_spellpoint_cost (caster, rune_spell, SPELL_GRACE);
149 op->stats.sp -= SP_level_spellpoint_cost (caster, rune_spell, SPELL_MANA); 138 op->stats.sp -= SP_level_spellpoint_cost (caster, rune_spell, SPELL_MANA);
150 } 139 }
140
151 /* already proper rune. Note this should only be the case if other_arch was set */ 141 /* already proper rune. Note this should only be the case if other_arch was set */
152 if (rune_spell->type == RUNE) 142 if (rune_spell->type == RUNE)
153 {
154 rune = rune_spell; 143 rune = rune_spell;
155 }
156 else 144 else
157 { 145 {
158 rune = get_archetype (GENERIC_RUNE); 146 rune = get_archetype (GENERIC_RUNE);
159 sprintf (buf, "You set off a rune of %s\n", &rune_spell->name); 147 rune->msg = format ("You set off a rune of %s\n", &rune_spell->name);
160 rune->msg = buf; 148 rune->insert (rune_spell->clone ());
161 tmp = get_object (); 149
162 copy_object (rune_spell, tmp);
163 insert_ob_in_ob (tmp, rune);
164 if (spell->face != blank_face) 150 if (spell->face != blank_face)
165 rune->face = spell->face; 151 rune->face = spell->face;
166 } 152 }
153
167 rune->level = caster_level (caster, spell); 154 rune->level = casting_level (caster, spell);
168 rune->stats.Cha = rune->level / 2; /* the invisibility parameter */ 155 rune->stats.Cha = rune->level / 2; /* the invisibility parameter */
169 rune->x = nx;
170 rune->y = ny;
171 rune->map = m;
172 rune->direction = dir; /* where any spell will go upon detonation */ 156 rune->direction = dir; /* where any spell will go upon detonation */
173 set_owner (rune, op); /* runes without need no owner */ 157 rune->set_owner (op); /* runes without need no owner */
174 set_spell_skill (op, caster, spell, rune); 158 set_spell_skill (op, caster, spell, rune);
175 insert_ob_in_map (rune, m, op, 0); 159
160 m->insert (rune, nx, ny, op);
176 return 1; 161 return 1;
177
178} 162}
179
180
181 163
182/* move_rune: peterm 164/* move_rune: peterm
183 comments on runes: 165 comments on runes:
184 rune->level : level at which rune will cast its spell. 166 rune->level : level at which rune will cast its spell.
185 rune->hp : number of detonations before rune goes away 167 rune->hp : number of detonations before rune goes away
189 rune->attacktype: type of damage it does, if not casting spells 171 rune->attacktype: type of damage it does, if not casting spells
190 rune->other_arch: spell in the rune 172 rune->other_arch: spell in the rune
191 rune->Cha : how hidden the rune is 173 rune->Cha : how hidden the rune is
192 rune->maxhp : number of spells the rune casts 174 rune->maxhp : number of spells the rune casts
193*/ 175*/
194
195void 176void
196move_rune (object *op) 177move_rune (object *op)
197{ 178{
198 int det = 0; 179 /* runes of level zero cannot detonate. */
199
200 if (!op->level) 180 if (!op->level)
201 {
202 return; 181 return;
203 } /* runes of level zero cannot detonate. */ 182
204 det = op->invisible; 183 int det = op->invisible;
184
205 if (!(rndm (0, MAX (1, (op->stats.Cha)) - 1))) 185 if (!(rndm (0, MAX (1, (op->stats.Cha)) - 1)))
206 { 186 {
207 op->invisible = 0; 187 op->invisible = 0;
208 op->speed_left -= 1; 188 op->speed_left -= 1;
209 } 189 }
210 else 190 else
211 op->invisible = 1; 191 op->invisible = 1;
192
212 if (op->invisible != det) 193 if (op->invisible != det)
213 update_object (op, UP_OBJ_FACE); 194 update_object (op, UP_OBJ_CHANGE);
214} 195}
215
216 196
217/* peterm: rune_attack 197/* peterm: rune_attack
218 * function handles those runes which detonate but do not cast spells. 198 * function handles those runes which detonate but do not cast spells.
219 */ 199 */
220
221
222void 200void
223rune_attack (object *op, object *victim) 201rune_attack (object *op, object *victim)
224{ 202{
225 if (victim) 203 if (victim)
226 { 204 {
227 tag_t tag = victim->count;
228
229 hit_player (victim, op->stats.dam, op, op->attacktype, 1); 205 hit_player (victim, op->stats.dam, op, op->attacktype, 1);
230 if (was_destroyed (victim, tag)) 206
207 if (victim->destroyed ())
231 return; 208 return;
209
232 /* if there's a disease in the needle, put it in the player */ 210 /* if there's a disease in the needle, put it in the player */
233 if (HAS_RANDOM_ITEMS (op)) 211 if (op->has_random_items ())
234 create_treasure (op->randomitems, op, 0, (victim->map ? victim->map->difficulty : 1), 0); 212 create_treasure (op->randomitems, op, 0, (victim->map ? victim->map->difficulty : 1), 0);
213
235 if (op->inv && op->inv->type == DISEASE) 214 if (op->inv && op->inv->type == DISEASE)
236 { 215 {
237 object *disease = op->inv; 216 object *disease = op->inv;
238 217
239 infect_object (victim, disease, 1); 218 infect_object (victim, disease, 1);
240 remove_ob (disease); 219 disease->destroy ();
241 free_object (disease);
242 } 220 }
243 } 221 }
244 else 222 else
245 hit_map (op, 0, op->attacktype, 1); 223 hit_map (op, 0, op->attacktype, 1);
246} 224}
251 */ 229 */
252void 230void
253spring_trap (object *trap, object *victim) 231spring_trap (object *trap, object *victim)
254{ 232{
255 object *env; 233 object *env;
256 tag_t trap_tag = trap->count;
257 rv_vector rv; 234 rv_vector rv;
258 int i; 235 int i;
259 236
260 /* Prevent recursion */ 237 /* Prevent recursion */
261 if (trap->stats.hp <= 0) 238 if (trap->stats.hp <= 0)
277 new_draw_info (NDI_UNIQUE, 0, victim, trap->msg); 254 new_draw_info (NDI_UNIQUE, 0, victim, trap->msg);
278 255
279 /* Flash an image of the trap on the map so the poor sod 256 /* Flash an image of the trap on the map so the poor sod
280 * knows what hit him. 257 * knows what hit him.
281 */ 258 */
282 env = object_get_env_recursive (trap); 259 env = trap->outer_env ();
283 260
284 /* If the victim is not next to this trap, don't set it off. 261 /* If the victim is not next to this trap, don't set it off.
285 * players shouldn't get hit by firing arrows at a door for example. 262 * players shouldn't get hit by firing arrows at a door for example.
286 * At the same time, the trap will stick around until detonated 263 * At the same time, the trap will stick around until detonated
287 */ 264 */
288 get_rangevector (env, victim, &rv, 0); 265 get_rangevector (env, victim, &rv, 0);
289 if (rv.distance > 1) 266 if (rv.distance > 1)
290 return; 267 return;
291 268
269 env->play_sound (trap->sound ? trap->sound : sound_find ("trap_spring"));
270
292 trap_show (trap, env); 271 trap_show (trap, env);
293 272
273 if (victim->type == PLAYER) // only count players as enemies
274 trap->enemy = victim; // set the victim as the traps enemy, so that summoned
275 // creatures know who to attack.
276
294 /* Only if it is a spell do we proceed here */ 277 /* Only if it is a spell do we proceed here */
295 if ((trap->inv && trap->inv->type == SPELL) || (trap->other_arch && trap->other_arch->clone.type == SPELL)) 278 if ((trap->inv && trap->inv->type == SPELL) || (trap->other_arch && trap->other_arch->type == SPELL))
296 { 279 {
297 280 if (trap->destroyed ())
298 if (was_destroyed (trap, trap_tag))
299 return; 281 return;
300 282
301 // breaks summon golem spells, which, for inexplicable reasons, 283 // breaks summon golem spells, which, for inexplicable reasons,
302 // do not work like summon golem spells at all but still require 284 // do not work like summon golem spells at all but still require
303 // direction "0" to work at all. 285 // direction "0" to work at all.
311 else 293 else
312 { 294 {
313 object *spell = arch_to_object (trap->other_arch); 295 object *spell = arch_to_object (trap->other_arch);
314 296
315 cast_spell (env, trap, trap->direction, spell, NULL); 297 cast_spell (env, trap, trap->direction, spell, NULL);
316 free_object (spell); 298 spell->destroy ();
317 } 299 }
318 } 300 }
319 } 301 }
320 else 302 else
321 { 303 {
322 rune_attack (trap, victim); 304 rune_attack (trap, victim);
323 if (was_destroyed (trap, trap_tag)) 305 if (trap->destroyed ())
324 return; 306 return;
325 } 307 }
326 308
327 if (trap->stats.hp <= 0) 309 if (trap->stats.hp <= 0)
328 { 310 {
341dispel_rune (object *op, object *caster, object *spell, object *skill, int dir) 323dispel_rune (object *op, object *caster, object *spell, object *skill, int dir)
342{ 324{
343 object *tmp, *tmp2; 325 object *tmp, *tmp2;
344 int searchflag = 1, mflags; 326 int searchflag = 1, mflags;
345 sint16 x, y; 327 sint16 x, y;
346 mapstruct *m; 328 maptile *m;
347 329
348 x = op->x + freearr_x[dir]; 330 x = op->x + freearr_x[dir];
349 y = op->y + freearr_y[dir]; 331 y = op->y + freearr_y[dir];
350 m = op->map; 332 m = op->map;
351 333
358 { 340 {
359 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!"); 341 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!");
360 return 0; 342 return 0;
361 } 343 }
362 344
363 for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = tmp->above) 345 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
364 { 346 {
365 if (tmp->type == RUNE || tmp->type == TRAP) 347 if (tmp->type == RUNE || tmp->type == TRAP)
366 break; 348 break;
367 349
368 /* we could put a probability chance here, but since nothing happens 350 /* we could put a probability chance here, but since nothing happens
369 * if you fail, no point on that. I suppose we could do a level 351 * if you fail, no point on that. I suppose we could do a level
370 * comparison so low level players can't erase high level players runes. 352 * comparison so low level players can't erase high level players runes.
371 */ 353 */
372 if (tmp->type == SIGN && !strcmp (tmp->arch->name, "rune_mark")) 354 if (tmp->type == SIGN && tmp->arch->archname == shstr_rune_mark)
373 { 355 {
374 remove_ob (tmp); 356 tmp->destroy ();
375 free_object (tmp);
376 new_draw_info (NDI_UNIQUE, 0, op, "You wipe out the rune of marking!"); 357 new_draw_info (NDI_UNIQUE, 0, op, "You wipe out the rune of marking!");
377 return 1; 358 return 1;
378 } 359 }
379 360
380 /* now search tmp's inventory for traps 361 /* now search tmp's inventory for traps
381 * This is for chests, where the rune is in the chests inventory. 362 * This is for chests, where the rune is in the chests inventory.
382 */ 363 */
383 for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below) 364 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
384 { 365 {
385 if (tmp2->type == RUNE || tmp2->type == TRAP) 366 if (tmp2->type == RUNE || tmp2->type == TRAP)
386 { 367 {
387 tmp = tmp2; 368 tmp = tmp2;
388 searchflag = 0; 369 searchflag = 0;
389 break; 370 break;
390 } 371 }
391 } 372 }
373
392 if (!searchflag) 374 if (!searchflag)
393 break; 375 break;
394 } 376 }
395 377
396 /* no rune there. */ 378 /* no rune there. */
397 if (tmp == NULL) 379 if (tmp == NULL)
398 { 380 {
399 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!"); 381 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!");
400 return 0; 382 return 0;
401 } 383 }
384
402 trap_disarm (op, tmp, 0, skill); 385 trap_disarm (op, tmp, 0, skill);
403 return 1; 386 return 1;
404
405} 387}
406 388
407int 389int
408trap_see (object *op, object *trap) 390trap_see (object *op, object *trap)
409{ 391{
416 + trap->level + trap->stats.Cha - op->level) / 10.0 * 50.0)))))) 398 + trap->level + trap->stats.Cha - op->level) / 10.0 * 50.0))))))
417 { 399 {
418 new_draw_info_format (NDI_UNIQUE, 0, op, "You spot a %s!", &trap->name); 400 new_draw_info_format (NDI_UNIQUE, 0, op, "You spot a %s!", &trap->name);
419 return 1; 401 return 1;
420 } 402 }
403
421 return 0; 404 return 0;
422} 405}
423 406
424int 407int
425trap_show (object *trap, object *where) 408trap_show (object *trap, object *where)
426{ 409{
427 object *tmp2;
428
429 if (where == NULL) 410 if (where == NULL)
430 return 0; 411 return 0;
412
431 tmp2 = get_archetype ("runedet"); 413 object *tmp = get_archetype ("runedet");
432 tmp2->face = &new_faces[GET_ANIMATION (trap, 0)]; 414 tmp->face = GET_ANIMATION (trap, 0);
433 tmp2->x = where->x; 415 tmp->insert_at (where, 0);
434 tmp2->y = where->y; 416
435 tmp2->map = where->map;
436 insert_ob_in_map (tmp2, where->map, NULL, 0);
437 return 1; 417 return 1;
438
439} 418}
440
441 419
442int 420int
443trap_disarm (object *disarmer, object *trap, int risk, object *skill) 421trap_disarm (object *disarmer, object *trap, int risk, object *skill)
444{ 422{
445 int trapworth; /* need to compute the experience worth of the trap 423 int trapworth; /* need to compute the experience worth of the trap before we kill it */
446 before we kill it */
447 424
448 /* this formula awards a more reasonable amount of exp */ 425 /* this formula awards a more reasonable amount of exp */
449 trapworth = MAX (1, trap->level) * disarmer->map->difficulty * 426 trapworth = MAX (1, trap->level)
427 * disarmer->map->difficulty
450 sqr (MAX (trap->stats.dam, trap->inv ? trap->inv->level : 1)) / skill->level; 428 * sqr (MAX (trap->stats.dam, trap->inv ? trap->inv->level : 1))
429 / skill->level;
451 430
452 if (!(random_roll (0, (MAX (2, MIN (20, trap->level - skill->level + 5 - disarmer->stats.Dex / 2)) - 1), disarmer, PREFER_LOW))) 431 if (!(random_roll (0, (MAX (2, MIN (20, trap->level - skill->level + 5 - disarmer->stats.Dex / 2)) - 1), disarmer, PREFER_LOW)))
453 { 432 {
454 new_draw_info_format (NDI_UNIQUE, 0, disarmer, "You successfully disarm the %s!", &trap->name); 433 new_draw_info_format (NDI_UNIQUE, 0, disarmer, "You successfully disarm the %s!", &trap->name);
455 destroy_object (trap); 434 trap->destroy ();
435
456 /* If it is your own trap, (or any players trap), don't you don't 436 /* If it is your own trap, (or any players trap), don't you don't
457 * get exp for it. 437 * get exp for it.
458 */ 438 */
459 if (trap->owner && trap->owner->type != PLAYER && risk) 439 if (trap->owner && trap->owner->type != PLAYER && risk)
460 return trapworth; 440 return trapworth;
471 } 451 }
472 return 0; 452 return 0;
473 } 453 }
474} 454}
475 455
476
477/* traps need to be adjusted for the difficulty of the map. The 456/* traps need to be adjusted for the difficulty of the map. The
478 * default traps are too strong for wimpy level 1 players, and 457 * default traps are too strong for wimpy level 1 players, and
479 * unthreatening to anyone of high level 458 * unthreatening to anyone of high level
480 */ 459 */
481
482void 460void
483trap_adjust (object *trap, int difficulty) 461trap_adjust (object *trap, int difficulty)
484{ 462{
485 int i; 463 int i;
486 464

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines