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.19 by root, Fri Feb 2 22:49:11 2007 UTC vs.
Revision 1.26 by root, Mon Jun 4 12:19:09 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (C) 2003 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * Crossfire TRT is free software; you can redistribute it and/or modify it
9 * it under the terms of the GNU General Public License as published by 9 * under the terms of the GNU General Public License as published by the Free
10 * the Free Software Foundation; either version 2 of the License, or 10 * Software Foundation; either version 2 of the License, or (at your option)
11 * (at your option) any later version. 11 * 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, but
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * GNU General Public License for more details. 16 * 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 along
19 * along with this program; if not, write to the Free Software 19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 21 *
22 * The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */ 23 */
24 24
25#include <global.h> 25#include <global.h>
26#include <sproto.h> 26#include <sproto.h>
27#include <spells.h> 27#include <spells.h>
56 56
57 nx = op->x + freearr_x[dir]; 57 nx = op->x + freearr_x[dir];
58 ny = op->y + freearr_y[dir]; 58 ny = op->y + freearr_y[dir];
59 m = op->map; 59 m = op->map;
60 60
61 if (get_map_flags (m, &m, nx, ny, &nx, &ny) && (P_OUT_OF_MAP | P_SAFE | P_NO_MAGIC | P_NO_CLERIC)) 61 if (get_map_flags (m, &m, nx, ny, &nx, &ny) & (P_OUT_OF_MAP | P_SAFE | P_NO_MAGIC | P_NO_CLERIC))
62 { 62 {
63 new_draw_info (NDI_UNIQUE, 0, op, "Can't make a rune there!"); 63 new_draw_info (NDI_UNIQUE, 0, op, "Can't make a rune there!");
64 return 0; 64 return 0;
65 } 65 }
66 66
68 if (tmp->type == RUNE) 68 if (tmp->type == RUNE)
69 break; 69 break;
70 70
71 if (tmp) 71 if (tmp)
72 { 72 {
73 new_draw_info (NDI_UNIQUE, 0, op, "You can't write a rune there."); 73 new_draw_info (NDI_UNIQUE, 0, op, "You can't write a rune on top of another rune.");
74 return 0; 74 return 0;
75 } 75 }
76 76
77 if (spell->other_arch) 77 if (spell->other_arch)
78 rune_spell = arch_to_object (spell->other_arch); 78 rune_spell = arch_to_object (spell->other_arch);
90 return 0; 90 return 0;
91 } 91 }
92 92
93 rune_spell = NULL; 93 rune_spell = NULL;
94 for (tmp = op->inv; tmp; tmp = tmp->below) 94 for (tmp = op->inv; tmp; tmp = tmp->below)
95 {
96 if (tmp->type == SPELL) 95 if (tmp->type == SPELL)
97 { 96 {
98 ms = item_matched_string (op, tmp, runename); 97 ms = item_matched_string (op, tmp, runename);
99 if (ms > bestmatch) 98 if (ms > bestmatch)
100 { 99 {
101 bestmatch = ms; 100 bestmatch = ms;
102 rune_spell = tmp; 101 rune_spell = tmp;
103 } 102 }
104 } 103 }
105 }
106 104
107 if (!rune_spell) 105 if (!rune_spell)
108 { 106 {
109 new_draw_info_format (NDI_UNIQUE, 0, op, "You don't know any spell named %s", runename); 107 new_draw_info_format (NDI_UNIQUE, 0, op, "You don't know any spell named %s", runename);
110 return 0; 108 return 0;
114 { 112 {
115 new_draw_info_format (NDI_UNIQUE, 0, op, "You can't cast %s with %s", &rune_spell->name, &spell->name); 113 new_draw_info_format (NDI_UNIQUE, 0, op, "You can't cast %s with %s", &rune_spell->name, &spell->name);
116 return 0; 114 return 0;
117 } 115 }
118 116
119 if (caster->path_denied & spell->path_attuned) 117 if (caster->path_denied & spell->path_attuned && !caster->flag [FLAG_WIZCAST])
120 { 118 {
121 new_draw_info_format (NDI_UNIQUE, 0, op, "%s belongs to a spell path denied to you.", &rune_spell->name); 119 new_draw_info_format (NDI_UNIQUE, 0, op, "%s belongs to a spell path denied to you.", &rune_spell->name);
122 return 0; 120 return 0;
123 } 121 }
124 122
125 if (caster_level (caster, rune_spell) < rune_spell->level) 123 if (caster_level (caster, rune_spell) < rune_spell->level && !caster->flag [FLAG_WIZCAST])
126 { 124 {
127 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is beyond your ability to cast!", &rune_spell->name); 125 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is beyond your ability to cast!", &rune_spell->name);
128 return 0; 126 return 0;
129 } 127 }
130 128
196 } 194 }
197 else 195 else
198 op->invisible = 1; 196 op->invisible = 1;
199 197
200 if (op->invisible != det) 198 if (op->invisible != det)
201 update_object (op, UP_OBJ_FACE); 199 update_object (op, UP_OBJ_CHANGE);
202} 200}
203
204 201
205/* peterm: rune_attack 202/* peterm: rune_attack
206 * function handles those runes which detonate but do not cast spells. 203 * function handles those runes which detonate but do not cast spells.
207 */ 204 */
208
209
210void 205void
211rune_attack (object *op, object *victim) 206rune_attack (object *op, object *victim)
212{ 207{
213 if (victim) 208 if (victim)
214 { 209 {
276 if (rv.distance > 1) 271 if (rv.distance > 1)
277 return; 272 return;
278 273
279 trap_show (trap, env); 274 trap_show (trap, env);
280 275
276 if (victim->type == PLAYER) // only count players as enemies
277 trap->enemy = victim; // set the victim as the traps enemy, so that summoned
278 // creatures know who to attack.
279
281 /* Only if it is a spell do we proceed here */ 280 /* Only if it is a spell do we proceed here */
282 if ((trap->inv && trap->inv->type == SPELL) || (trap->other_arch && trap->other_arch->clone.type == SPELL)) 281 if ((trap->inv && trap->inv->type == SPELL) || (trap->other_arch && trap->other_arch->clone.type == SPELL))
283 { 282 {
284 283
285 if (trap->destroyed ()) 284 if (trap->destroyed ())
354 353
355 /* we could put a probability chance here, but since nothing happens 354 /* we could put a probability chance here, but since nothing happens
356 * if you fail, no point on that. I suppose we could do a level 355 * if you fail, no point on that. I suppose we could do a level
357 * comparison so low level players can't erase high level players runes. 356 * comparison so low level players can't erase high level players runes.
358 */ 357 */
359 if (tmp->type == SIGN && !strcmp (tmp->arch->name, "rune_mark")) 358 if (tmp->type == SIGN && !strcmp (tmp->arch->archname, "rune_mark"))
360 { 359 {
361 tmp->destroy (); 360 tmp->destroy ();
362 new_draw_info (NDI_UNIQUE, 0, op, "You wipe out the rune of marking!"); 361 new_draw_info (NDI_UNIQUE, 0, op, "You wipe out the rune of marking!");
363 return 1; 362 return 1;
364 } 363 }
412{ 411{
413 if (where == NULL) 412 if (where == NULL)
414 return 0; 413 return 0;
415 414
416 object *tmp = get_archetype ("runedet"); 415 object *tmp = get_archetype ("runedet");
417 tmp->face = &new_faces[GET_ANIMATION (trap, 0)]; 416 tmp->face = GET_ANIMATION (trap, 0);
418 tmp->insert_at (where, 0); 417 tmp->insert_at (where, 0);
419 418
420 return 1; 419 return 1;
421} 420}
422 421

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines