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. |