1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
29 | #include <global.h> |
29 | #include <global.h> |
30 | #include <sproto.h> |
30 | #include <sproto.h> |
31 | #include <spells.h> |
31 | #include <spells.h> |
32 | #include <skills.h> |
32 | #include <skills.h> |
33 | #include <commands.h> |
33 | #include <commands.h> |
34 | |
|
|
35 | int |
|
|
36 | command_invoke (object *op, char *params) |
|
|
37 | { |
|
|
38 | return command_cast_spell (op, params, 'i'); |
|
|
39 | } |
|
|
40 | |
|
|
41 | int |
|
|
42 | command_cast (object *op, char *params) |
|
|
43 | { |
|
|
44 | return command_cast_spell (op, params, 'c'); |
|
|
45 | } |
|
|
46 | |
|
|
47 | int |
|
|
48 | command_prepare (object *op, char *params) |
|
|
49 | { |
|
|
50 | return command_cast_spell (op, params, 'p'); |
|
|
51 | } |
|
|
52 | |
34 | |
53 | /* Shows all spells that op knows. If params is supplied, the must match |
35 | /* Shows all spells that op knows. If params is supplied, the must match |
54 | * that. Given there is more than one skill, we can't supply break |
36 | * that. Given there is more than one skill, we can't supply break |
55 | * them down to cleric/wizardry. |
37 | * them down to cleric/wizardry. |
56 | */ |
38 | */ |
… | |
… | |
126 | /* sets up to cast a spell. op is the caster, params is the spell name, |
108 | /* sets up to cast a spell. op is the caster, params is the spell name, |
127 | * and command is the first letter of the spell type (c=cast, i=invoke, |
109 | * and command is the first letter of the spell type (c=cast, i=invoke, |
128 | * p=prepare). Invoke casts a spell immediately, where as cast (and I believe |
110 | * p=prepare). Invoke casts a spell immediately, where as cast (and I believe |
129 | * prepare) just set up the range type. |
111 | * prepare) just set up the range type. |
130 | */ |
112 | */ |
131 | int |
113 | static int |
132 | command_cast_spell (object *op, char *params, char command) |
114 | command_cast_spell (object *op, char *params, char command) |
133 | { |
115 | { |
134 | int castnow = 0; |
116 | int castnow = 0; |
135 | char *cp; |
117 | char *cp; |
136 | object *spob; |
118 | object *spob; |
… | |
… | |
228 | show_matching_spells (op, params); |
210 | show_matching_spells (op, params); |
229 | |
211 | |
230 | return 1; |
212 | return 1; |
231 | } |
213 | } |
232 | |
214 | |
|
|
215 | int |
|
|
216 | command_invoke (object *op, char *params) |
|
|
217 | { |
|
|
218 | return command_cast_spell (op, params, 'i'); |
|
|
219 | } |
|
|
220 | |
|
|
221 | int |
|
|
222 | command_cast (object *op, char *params) |
|
|
223 | { |
|
|
224 | return command_cast_spell (op, params, 'c'); |
|
|
225 | } |
|
|
226 | |
|
|
227 | int |
|
|
228 | command_prepare (object *op, char *params) |
|
|
229 | { |
|
|
230 | return command_cast_spell (op, params, 'p'); |
|
|
231 | } |
|
|
232 | |
233 | /**************************************************************************/ |
233 | /**************************************************************************/ |
234 | |
234 | |
235 | void |
235 | static void |
236 | change_spell (object *op, char k) |
236 | change_spell (object *op, char k) |
237 | { |
237 | { |
238 | if (op->contr->combat_ob == op->current_weapon) |
238 | if (op->contr->combat_ob == op->current_weapon) |
239 | { |
239 | { |
240 | if (op->contr->ranged_ob) |
240 | if (op->contr->ranged_ob) |