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.76 by root, Mon Apr 27 01:38:49 2009 UTC vs.
Revision 1.86 by root, Sat Apr 3 22:30:21 2010 UTC

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,2009 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 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* Created July 95 to separate skill utilities from actual skills -b.t. */ 25/* Created July 95 to separate skill utilities from actual skills -b.t. */
58/* init_skills basically just sets up the skill_names table 59/* init_skills basically just sets up the skill_names table
59 * above. The index into the array is set up by the 60 * above. The index into the array is set up by the
60 * subtypes. 61 * subtypes.
61 */ 62 */
62void 63void
63init_skills (void) 64init_skills ()
64{ 65{
65 for_all_archetypes (at) 66 for_all_archetypes (at)
66 if (at->type == SKILL) 67 if (at->type == SKILL)
67 { 68 {
68 if (skill_names[at->subtype]) 69 if (skill_names[at->subtype])
167 168
168 if (!skill) 169 if (!skill)
169 skill = give_skill_by_name (who, skill_tool->skill); 170 skill = give_skill_by_name (who, skill_tool->skill);
170 171
171 if (!skill_tool->flag [FLAG_APPLIED]) 172 if (!skill_tool->flag [FLAG_APPLIED])
172 if (apply_special (who, splay (skill_tool), AP_APPLY | AP_NO_READY)) 173 if (apply_special (who, splay (skill_tool), AP_APPLY))
173 return 0; 174 return 0;
174 175
175 return splay (skill); 176 return splay (skill);
176} 177}
177 178
461 case SK_EVOCATION: 462 case SK_EVOCATION:
462 case SK_PYROMANCY: 463 case SK_PYROMANCY:
463 case SK_SUMMONING: 464 case SK_SUMMONING:
464 case SK_CLIMBING: 465 case SK_CLIMBING:
465 new_draw_info (NDI_UNIQUE, 0, op, "This skill is already in effect."); 466 new_draw_info (NDI_UNIQUE, 0, op, "This skill is already in effect.");
467 break;
468
469 case SK_MINING:
470 success = skill_mining (op, part, skill, dir, string);
471 break;
472
473 case SK_FISHING:
474 success = skill_fishing (op, part, skill, dir, string);
466 break; 475 break;
467 476
468 default: 477 default:
469 LOG (llevDebug, "%s attempted to use unknown skill: %d\n", query_name (op), op->chosen_skill->stats.sp); 478 LOG (llevDebug, "%s attempted to use unknown skill: %d\n", query_name (op), op->chosen_skill->stats.sp);
470 break; 479 break;
715 * it so it doesn't crash the server - otherwise, one character may 724 * it so it doesn't crash the server - otherwise, one character may
716 * crash the server numerous times. 725 * crash the server numerous times.
717 */ 726 */
718 if (num_skills_found >= NUM_SKILLS) 727 if (num_skills_found >= NUM_SKILLS)
719 { 728 {
720 new_draw_info (NDI_RED, 0, op, "Your character has too many skills."); 729 new_draw_info (NDI_RED | NDI_REPLY, 0, op, "Your character has too many skills.");
721 new_draw_info (NDI_RED, 0, op, "Something isn't right - contact the server admin"); 730 new_draw_info (NDI_RED | NDI_REPLY, 0, op, "Something isn't right - contact the server admin");
722 break; 731 break;
723 } 732 }
724 } 733 }
725 } 734 }
726 735
762 771
763 for (skop = op->inv; skop; skop = skop->below) 772 for (skop = op->inv; skop; skop = skop->below)
764 { 773 {
765 if (skop->type == SKILL 774 if (skop->type == SKILL
766 && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL) 775 && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL)
767 && !strncasecmp (string, skop->skill, MIN (strlen (string), (size_t) strlen (skop->skill)))) 776 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill))))
768 break; 777 break;
769 else if (skop->type == SKILL_TOOL 778 else if (skop->type == SKILL_TOOL
770 && !strncasecmp (string, skop->skill, MIN (strlen (string), (size_t) strlen (skop->skill)))) 779 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill))))
771 break; 780 break;
772 } 781 }
773 782
774 if (!skop) 783 if (!skop)
775 { 784 {
807} 816}
808 817
809static bool 818static bool
810hth_skill_p (object *skill) 819hth_skill_p (object *skill)
811{ 820{
812 return (skill_flags [skill->subtype] & (SF_COMBAT | SF_NEED_WEAPON)) == SF_COMBAT; 821 return (skill_flags [skill->subtype] & (SF_COMBAT | SF_NEED_ITEM)) == SF_COMBAT;
813} 822}
814 823
815/* This finds the first unarmed skill the player has, and returns it. 824/* This finds the first unarmed skill the player has, and returns it.
816 */ 825 */
817static object * 826static object *
878 887
879 if (!skill) 888 if (!skill)
880 new_draw_info (NDI_BLACK, 0, op, "You have no unarmed combat skills!"); 889 new_draw_info (NDI_BLACK, 0, op, "You have no unarmed combat skills!");
881 } 890 }
882 891
883 if (skill) 892 op->apply (skill);
884 {
885 op->change_skill (0);
886 apply_special (op, skill, AP_APPLY);
887 }
888 } 893 }
889 894
890 if (!pl->combat_ob) 895 if (!pl->combat_ob)
891 { 896 {
892 LOG (llevError, "Could not find anything to attack on %s\n", &op->name); 897 LOG (llevError, "Could not find anything to attack on %s\n", &op->name);
893 return 0; 898 return 0;
894 } 899 }
895 } 900 }
896 901
897 if (!op->change_weapon (pl->combat_ob)) 902 if (!op->apply (pl->combat_ob))
898 return 0; 903 return 0;
899 } 904 }
900 905
901 /* lose invisiblity/hiding status for running attacks */ 906 /* lose invisiblity/hiding status for running attacks */
902 if (pl->tmp_invis) 907 if (pl->tmp_invis)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines