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.17 by pippijn, Mon Jan 15 21:06:20 2007 UTC vs.
Revision 1.20 by root, Sun Feb 18 18:30:28 2007 UTC

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)) 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
67 for (tmp = GET_MAP_OB (m, nx, ny); tmp != NULL; tmp = tmp->above) 67 for (tmp = m->at (nx, ny).bot; tmp; tmp = tmp->above)
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
181 rune->maxhp : number of spells the rune casts 179 rune->maxhp : number of spells the rune casts
182*/ 180*/
183void 181void
184move_rune (object *op) 182move_rune (object *op)
185{ 183{
186 int det = 0; 184 /* runes of level zero cannot detonate. */
187
188 if (!op->level) 185 if (!op->level)
189 {
190 return; 186 return;
191 } /* runes of level zero cannot detonate. */ 187
192 det = op->invisible; 188 int det = op->invisible;
189
193 if (!(rndm (0, MAX (1, (op->stats.Cha)) - 1))) 190 if (!(rndm (0, MAX (1, (op->stats.Cha)) - 1)))
194 { 191 {
195 op->invisible = 0; 192 op->invisible = 0;
196 op->speed_left -= 1; 193 op->speed_left -= 1;
197 } 194 }
198 else 195 else
199 op->invisible = 1; 196 op->invisible = 1;
197
200 if (op->invisible != det) 198 if (op->invisible != det)
201 update_object (op, UP_OBJ_FACE); 199 update_object (op, UP_OBJ_FACE);
202} 200}
203 201
204 202

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines