ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_range.C
(Generate patch)

Comparing deliantra/server/server/c_range.C (file contents):
Revision 1.43 by root, Fri Mar 26 01:04:44 2010 UTC vs.
Revision 1.45 by root, Sat Apr 3 02:27:24 2010 UTC

166 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is a weird spell, please report it to the dungeon master!", &spob->name); 166 new_draw_info_format (NDI_UNIQUE, 0, op, "%s is a weird spell, please report it to the dungeon master!", &spob->name);
167 LOG (llevError, "spell without skill found: %s", spob->debug_desc ()); 167 LOG (llevError, "spell without skill found: %s", spob->debug_desc ());
168 return 1; 168 return 1;
169 } 169 }
170 170
171 object *skill = find_skill_by_name (op, spob->skill);
172
173 if (!skill)
174 {
175 op->failmsg (format ("You need the skill %s to cast %s!", &spob->skill, &spob->name));
176 return 1;
177 }
178
179 splay (spob);
180
181 if (castnow) 171 if (castnow)
182 cast_spell (op, op, op->facing, spob, cp); 172 cast_spell (op, op, op->facing, spob, cp);
183 else 173 else if (op->apply (spob))
184 {
185 if (op->contr->ranged_ob)
186 if (op->contr->ranged_ob->flag [FLAG_APPLIED])
187 apply_special (op, op->contr->ranged_ob, AP_UNAPPLY);
188 else
189 op->contr->ranged_ob = 0;
190
191 if (op->contr->ranged_ob)
192 op->failmsg (format ("You have to unapply the %s first to ready a spell.", &op->contr->ranged_ob->name));
193 else
194 { 174 {
195 op->change_weapon (op->contr->ranged_ob = spob); 175 splay (spob);
196
197 assign (op->contr->spellparam, cp ? cp : ""); 176 assign (op->contr->spellparam, cp ? cp : "");
198 op->statusmsg (format ("You ready the spell %s", &spob->name));
199 }
200 } 177 }
201 178
202 return 0; 179 return 0;
203 } /* else fall through to below and print spells */ 180 } /* else fall through to below and print spells */
204 } /* params supplied */ 181 } /* params supplied */
230 return command_cast_spell (op, params, 'p'); 207 return command_cast_spell (op, params, 'p');
231} 208}
232 209
233/**************************************************************************/ 210/**************************************************************************/
234 211
235static void 212int
236change_spell (object *op, char k) 213command_rotateshoottype (object *op, char *params)
237{ 214{
238 if (op->contr->combat_ob == op->current_weapon) 215 if (op->contr->combat_ob && op->contr->ranged_ob)
239 { 216 op->apply (
217 op->current_weapon == op->contr->combat_ob
240 if (op->contr->ranged_ob) 218 ? op->contr->ranged_ob
241 op->change_weapon (op->contr->ranged_ob);
242 }
243 else if (op->contr->ranged_ob == op->current_weapon)
244 {
245 if (op->contr->combat_ob) 219 : op->contr->combat_ob
246 op->change_weapon (op->contr->combat_ob); 220 );
247 }
248 221
249 //TODO: maybe switch to golem, if any? 222 //TODO: maybe switch to golem, if any?
250}
251
252int
253command_rotateshoottype (object *op, char *params)
254{
255 if (!params)
256 change_spell (op, '+');
257 else
258 change_spell (op, params[0]);
259 223
260 return 0; 224 return 0;
261} 225}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines