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

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.86 by root, Sat Apr 3 22:30:21 2010 UTC vs.
Revision 1.89 by root, Mon Apr 5 17:28:12 2010 UTC

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
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 {
774 if (skop->type == SKILL 774 if (skop->type == SKILL
775 && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL) 775 && skop->flag [FLAG_CAN_USE_SKILL]
776 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill)))) 776 && skop->skill.starts_with (string))
777 break; 777 break;
778 else if (skop->type == SKILL_TOOL 778 else if (skop->type == SKILL_TOOL
779 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill)))) 779 && skop->skill.starts_with (string)
780 && op->apply (skop))
780 break; 781 break;
781 } 782 }
782 783
783 if (!skop) 784 if (!skop)
784 { 785 {
785 new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find skill %s", string); 786 op->failmsg (format ("Unable to find skill %s.", string));
787 return 0;
788 }
789
790 if (!(skill_flags [skop->subtype] & SF_USE))
791 {
792 op->failmsg (format (
793 "You feel as if you wanted to do something funny, but you can't remember what. "
794 "H<The %s skill cannot be used - maybe you need to ready it, use it with some item, or it's always active.>",
795 &skop->skill
796 ));
786 return 0; 797 return 0;
787 } 798 }
788 799
789 len = strlen (skop->skill); 800 len = strlen (skop->skill);
790 801
855 * through that code if skill is set to change to the skill. 866 * through that code if skill is set to change to the skill.
856 */ 867 */
857 if (player *pl = op->contr) 868 if (player *pl = op->contr)
858 { 869 {
859 if (skill) 870 if (skill)
860 op->change_skill (skill); 871 {
872 if (!op->apply (skill))
873 return 0;
874 }
861 else 875 else
862 { 876 {
863 if (!pl->combat_ob) 877 if (!pl->combat_ob)
864 { 878 {
865 if (QUERY_FLAG (op, FLAG_READY_WEAPON)) 879 if (QUERY_FLAG (op, FLAG_READY_WEAPON))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines