… | |
… | |
151 | * if not successful, return null. If they do have the skill tool |
151 | * if not successful, return null. If they do have the skill tool |
152 | * but not the skill itself, give it to them. |
152 | * but not the skill itself, give it to them. |
153 | */ |
153 | */ |
154 | if (skill_tool) |
154 | if (skill_tool) |
155 | { |
155 | { |
156 | if (!QUERY_FLAG (skill_tool, FLAG_APPLIED)) |
|
|
157 | if (apply_special (who, skill_tool, 0)) |
|
|
158 | return 0; |
|
|
159 | |
|
|
160 | if (!skill) |
156 | if (!skill) |
161 | { |
157 | { |
162 | skill = give_skill_by_name (who, skill_tool->skill); |
158 | skill = give_skill_by_name (who, skill_tool->skill); |
163 | link_player_skills (who); |
159 | link_player_skills (who); |
164 | } |
160 | } |
|
|
161 | |
|
|
162 | if (!QUERY_FLAG (skill_tool, FLAG_APPLIED)) |
|
|
163 | if (apply_special (who, skill_tool, 0)) |
|
|
164 | return 0; |
165 | |
165 | |
166 | return skill; |
166 | return skill; |
167 | } |
167 | } |
168 | |
168 | |
169 | return 0; |
169 | return 0; |
… | |
… | |
194 | skill = tmp; |
194 | skill = tmp; |
195 | |
195 | |
196 | /* Try to find appropriate skilltool. If the player has one already |
196 | /* Try to find appropriate skilltool. If the player has one already |
197 | * applied, we try to keep using that one. |
197 | * applied, we try to keep using that one. |
198 | */ |
198 | */ |
|
|
199 | //TODO: afaics, skill tools have subtype 0 always |
199 | else if (tmp->type == SKILL_TOOL && tmp->subtype == skillno) |
200 | else if (tmp->type == SKILL_TOOL && tmp->subtype == skillno) |
200 | { |
201 | { |
201 | if (QUERY_FLAG (tmp, FLAG_APPLIED)) |
202 | if (QUERY_FLAG (tmp, FLAG_APPLIED)) |
202 | skill_tool = tmp; |
203 | skill_tool = tmp; |
203 | else if (!skill_tool || !QUERY_FLAG (skill_tool, FLAG_APPLIED)) |
204 | else if (!skill_tool || !QUERY_FLAG (skill_tool, FLAG_APPLIED)) |
… | |
… | |
276 | clear_skill (object *who) |
277 | clear_skill (object *who) |
277 | { |
278 | { |
278 | who->chosen_skill = 0; |
279 | who->chosen_skill = 0; |
279 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
280 | CLEAR_FLAG (who, FLAG_READY_SKILL); |
280 | |
281 | |
281 | if (who->type == PLAYER) |
282 | if (player *pl = who->contr) |
282 | if (who->contr->ranged_ob && who->contr->ranged_ob->type == SKILL) |
283 | if (pl->ranged_ob && pl->ranged_ob->type == SKILL) |
283 | who->contr->ranged_ob = 0; |
284 | pl->ranged_ob = 0; |
284 | } |
285 | } |
285 | |
286 | |
286 | /* do_skill() - Main skills use function-similar in scope to cast_spell(). |
287 | /* do_skill() - Main skills use function-similar in scope to cast_spell(). |
287 | * We handle all requests for skill use outside of some combat here. |
288 | * We handle all requests for skill use outside of some combat here. |
288 | * We require a separate routine outside of fire() so as to allow monsters |
289 | * We require a separate routine outside of fire() so as to allow monsters |