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.38 by root, Thu Jan 1 16:05:13 2009 UTC vs.
Revision 1.39 by root, Sun Jan 4 22:39:59 2009 UTC

33 * write_rune: 33 * write_rune:
34 * op: rune writer 34 * op: rune writer
35 * skop: skill object used for casting this rune 35 * skop: skill object used for casting this rune
36 * dir: orientation of rune, direction rune's contained spell will 36 * dir: orientation of rune, direction rune's contained spell will
37 * be cast in, if applicable 37 * be cast in, if applicable
38 * inspell: spell object to put into the rune, can be null if doing 38 * spell: spell object to put into the rune
39 * a marking rune.
40 * level: level of casting of the rune 39 * level: level of casting of the rune
41 * 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
42 * a rune of marking 41 * a rune of marking
43 */ 42 */
44
45int 43int
46write_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)
47{ 45{
48 object *tmp, *rune_spell, *rune; 46 object *tmp, *rune_spell, *rune;
49 char buf[MAX_BUF];
50 maptile *m; 47 maptile *m;
51 sint16 nx, ny; 48 sint16 nx, ny;
52 49
53 if (!dir) 50 if (!dir)
54 dir = 1; 51 dir = 1;
136 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.");
137 return 0; 134 return 0;
138 } 135 }
139 136
140 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);
141 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);
142 } 139 }
143 140
144 /* 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 */
145 if (rune_spell->type == RUNE) 142 if (rune_spell->type == RUNE)
146 rune = rune_spell; 143 rune = rune_spell;
147 else 144 else
148 { 145 {
149 rune = get_archetype (GENERIC_RUNE); 146 rune = get_archetype (GENERIC_RUNE);
150 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);
151 rune->msg = buf;
152 rune->insert (rune_spell->clone ()); 148 rune->insert (rune_spell->clone ());
153 149
154 if (spell->face != blank_face) 150 if (spell->face != blank_face)
155 rune->face = spell->face; 151 rune->face = spell->face;
156 } 152 }
344 { 340 {
345 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!"); 341 new_draw_info (NDI_UNIQUE, 0, op, "There's nothing there!");
346 return 0; 342 return 0;
347 } 343 }
348 344
349 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)
350 { 346 {
351 if (tmp->type == RUNE || tmp->type == TRAP) 347 if (tmp->type == RUNE || tmp->type == TRAP)
352 break; 348 break;
353 349
354 /* we could put a probability chance here, but since nothing happens 350 /* we could put a probability chance here, but since nothing happens
363 } 359 }
364 360
365 /* now search tmp's inventory for traps 361 /* now search tmp's inventory for traps
366 * 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.
367 */ 363 */
368 for (tmp2 = tmp->inv; tmp2 != NULL; tmp2 = tmp2->below) 364 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below)
369 { 365 {
370 if (tmp2->type == RUNE || tmp2->type == TRAP) 366 if (tmp2->type == RUNE || tmp2->type == TRAP)
371 { 367 {
372 tmp = tmp2; 368 tmp = tmp2;
373 searchflag = 0; 369 searchflag = 0;
374 break; 370 break;
375 } 371 }
376 } 372 }
373
377 if (!searchflag) 374 if (!searchflag)
378 break; 375 break;
379 } 376 }
380 377
381 /* no rune there. */ 378 /* no rune there. */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines