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.28 by root, Sun Jul 1 05:00:20 2007 UTC vs.
Revision 1.32 by root, Wed Apr 23 07:13:23 2008 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software: you can redistribute it and/or modify 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 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 10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 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/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * 20 *
21 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24#include <global.h> 24#include <global.h>
25#include <sproto.h> 25#include <sproto.h>
26#include <spells.h> 26#include <spells.h>
258 new_draw_info (NDI_UNIQUE, 0, victim, trap->msg); 258 new_draw_info (NDI_UNIQUE, 0, victim, trap->msg);
259 259
260 /* Flash an image of the trap on the map so the poor sod 260 /* Flash an image of the trap on the map so the poor sod
261 * knows what hit him. 261 * knows what hit him.
262 */ 262 */
263 env = object_get_env_recursive (trap); 263 env = trap->outer_env ();
264 264
265 /* If the victim is not next to this trap, don't set it off. 265 /* If the victim is not next to this trap, don't set it off.
266 * players shouldn't get hit by firing arrows at a door for example. 266 * players shouldn't get hit by firing arrows at a door for example.
267 * At the same time, the trap will stick around until detonated 267 * At the same time, the trap will stick around until detonated
268 */ 268 */
269 get_rangevector (env, victim, &rv, 0); 269 get_rangevector (env, victim, &rv, 0);
270 if (rv.distance > 1) 270 if (rv.distance > 1)
271 return; 271 return;
272 272
273 env->play_sound (trap->sound ? trap->sound : sound_find ("trap_spring"));
274
273 trap_show (trap, env); 275 trap_show (trap, env);
274 276
275 if (victim->type == PLAYER) // only count players as enemies 277 if (victim->type == PLAYER) // only count players as enemies
276 trap->enemy = victim; // set the victim as the traps enemy, so that summoned 278 trap->enemy = victim; // set the victim as the traps enemy, so that summoned
277 // creatures know who to attack. 279 // creatures know who to attack.
381 if (tmp == NULL) 383 if (tmp == NULL)
382 { 384 {
383 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!"); 385 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!");
384 return 0; 386 return 0;
385 } 387 }
388
386 trap_disarm (op, tmp, 0, skill); 389 trap_disarm (op, tmp, 0, skill);
387 return 1; 390 return 1;
388
389} 391}
390 392
391int 393int
392trap_see (object *op, object *trap) 394trap_see (object *op, object *trap)
393{ 395{
400 + trap->level + trap->stats.Cha - op->level) / 10.0 * 50.0)))))) 402 + trap->level + trap->stats.Cha - op->level) / 10.0 * 50.0))))))
401 { 403 {
402 new_draw_info_format (NDI_UNIQUE, 0, op, "You spot a %s!", &trap->name); 404 new_draw_info_format (NDI_UNIQUE, 0, op, "You spot a %s!", &trap->name);
403 return 1; 405 return 1;
404 } 406 }
407
405 return 0; 408 return 0;
406} 409}
407 410
408int 411int
409trap_show (object *trap, object *where) 412trap_show (object *trap, object *where)
419} 422}
420 423
421int 424int
422trap_disarm (object *disarmer, object *trap, int risk, object *skill) 425trap_disarm (object *disarmer, object *trap, int risk, object *skill)
423{ 426{
424 int trapworth; /* need to compute the experience worth of the trap 427 int trapworth; /* need to compute the experience worth of the trap before we kill it */
425 before we kill it */
426 428
427 /* this formula awards a more reasonable amount of exp */ 429 /* this formula awards a more reasonable amount of exp */
428 trapworth = MAX (1, trap->level) * disarmer->map->difficulty * 430 trapworth = MAX (1, trap->level)
431 * disarmer->map->difficulty
429 sqr (MAX (trap->stats.dam, trap->inv ? trap->inv->level : 1)) / skill->level; 432 * sqr (MAX (trap->stats.dam, trap->inv ? trap->inv->level : 1))
433 / skill->level;
430 434
431 if (!(random_roll (0, (MAX (2, MIN (20, trap->level - skill->level + 5 - disarmer->stats.Dex / 2)) - 1), disarmer, PREFER_LOW))) 435 if (!(random_roll (0, (MAX (2, MIN (20, trap->level - skill->level + 5 - disarmer->stats.Dex / 2)) - 1), disarmer, PREFER_LOW)))
432 { 436 {
433 new_draw_info_format (NDI_UNIQUE, 0, disarmer, "You successfully disarm the %s!", &trap->name); 437 new_draw_info_format (NDI_UNIQUE, 0, disarmer, "You successfully disarm the %s!", &trap->name);
434 trap->destroy (1); 438 trap->destroy (1);
451 } 455 }
452 return 0; 456 return 0;
453 } 457 }
454} 458}
455 459
456
457/* traps need to be adjusted for the difficulty of the map. The 460/* traps need to be adjusted for the difficulty of the map. The
458 * default traps are too strong for wimpy level 1 players, and 461 * default traps are too strong for wimpy level 1 players, and
459 * unthreatening to anyone of high level 462 * unthreatening to anyone of high level
460 */ 463 */
461
462void 464void
463trap_adjust (object *trap, int difficulty) 465trap_adjust (object *trap, int difficulty)
464{ 466{
465 int i; 467 int i;
466 468

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines