… | |
… | |
168 | |
168 | |
169 | if (!skill) |
169 | if (!skill) |
170 | skill = give_skill_by_name (who, skill_tool->skill); |
170 | skill = give_skill_by_name (who, skill_tool->skill); |
171 | |
171 | |
172 | if (!skill_tool->flag [FLAG_APPLIED]) |
172 | if (!skill_tool->flag [FLAG_APPLIED]) |
173 | if (apply_special (who, splay (skill_tool), AP_APPLY)) |
173 | if (!who->apply (splay (skill_tool))) |
174 | return 0; |
174 | return 0; |
175 | |
175 | |
176 | return splay (skill); |
176 | return splay (skill); |
177 | } |
177 | } |
178 | |
178 | |
… | |
… | |
768 | |
768 | |
769 | if (!string) |
769 | if (!string) |
770 | return 0; |
770 | return 0; |
771 | |
771 | |
772 | for (skop = op->inv; skop; skop = skop->below) |
772 | for (skop = op->inv; skop; skop = skop->below) |
773 | { |
773 | if ((skop->type == SKILL || skop->type == SKILL_TOOL) |
774 | if (skop->type == SKILL |
|
|
775 | && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL) |
|
|
776 | && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill)))) |
774 | && !strncmp (string, skop->skill, min (strlen (string), strlen (skop->skill)))) |
|
|
775 | { |
|
|
776 | skop = find_skill_by_name (op, skop->skill); |
777 | break; |
777 | break; |
778 | else if (skop->type == SKILL_TOOL |
|
|
779 | && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill)))) |
|
|
780 | break; |
|
|
781 | } |
778 | } |
782 | |
779 | |
783 | if (!skop) |
780 | if (!skop) |
784 | { |
781 | { |
785 | new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find skill %s", string); |
782 | op->failmsg (format ("Unable to find skill %s.", string)); |
|
|
783 | return 0; |
|
|
784 | } |
|
|
785 | |
|
|
786 | if (!(skill_flags [skop->subtype] & SF_USE)) |
|
|
787 | { |
|
|
788 | op->failmsg (format ( |
|
|
789 | "You feel as if you wanted to do something funny, but you can't remember what. " |
|
|
790 | "H<The %s skill cannot be C<use_skill>'ed - maybe you need to C<ready_skill> it, " |
|
|
791 | "use it with some item, or it's always active.>", |
|
|
792 | &skop->skill |
|
|
793 | )); |
786 | return 0; |
794 | return 0; |
787 | } |
795 | } |
788 | |
796 | |
789 | len = strlen (skop->skill); |
797 | len = strlen (skop->skill); |
790 | |
798 | |
… | |
… | |
855 | * through that code if skill is set to change to the skill. |
863 | * through that code if skill is set to change to the skill. |
856 | */ |
864 | */ |
857 | if (player *pl = op->contr) |
865 | if (player *pl = op->contr) |
858 | { |
866 | { |
859 | if (skill) |
867 | if (skill) |
860 | op->change_skill (skill); |
868 | { |
|
|
869 | if (!op->apply (skill)) |
|
|
870 | return 0; |
|
|
871 | } |
861 | else |
872 | else |
862 | { |
873 | { |
863 | if (!pl->combat_ob) |
874 | if (!pl->combat_ob) |
864 | { |
875 | { |
865 | if (QUERY_FLAG (op, FLAG_READY_WEAPON)) |
876 | if (QUERY_FLAG (op, FLAG_READY_WEAPON)) |