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.51 by root, Thu May 17 20:27:02 2007 UTC vs.
Revision 1.52 by root, Fri May 18 01:01:02 2007 UTC

229 chosen_skill->flag [FLAG_APPLIED] = true; 229 chosen_skill->flag [FLAG_APPLIED] = true;
230 change_abil (this, chosen_skill); 230 change_abil (this, chosen_skill);
231 chosen_skill->inv_splay (); 231 chosen_skill->inv_splay ();
232 } 232 }
233 233
234 // always clear current weapon, as the selected skill could
235 // conflict with the current weapon skill, which would go
236 // undetected and exp would be given to the wrong skill.
237 current_weapon = 0;
238
234 update_stats (); 239 update_stats ();
235 return 1; 240 return 1;
236}
237
238/* This function just clears the chosen_skill and range_skill values
239 * in the player.
240 */
241void
242clear_skill (object *who)
243{
244 if (who->chosen_skill)
245 {
246 who->chosen_skill->flag [FLAG_APPLIED] = false;
247 who->chosen_skill = 0;
248 CLEAR_FLAG (who, FLAG_READY_SKILL);
249 }
250
251 if (player *pl = who->contr)
252 if (pl->ranged_ob && pl->ranged_ob->type == SKILL)
253 pl->ranged_ob = 0;
254} 241}
255 242
256/* do_skill() - Main skills use function-similar in scope to cast_spell(). 243/* do_skill() - Main skills use function-similar in scope to cast_spell().
257 * We handle all requests for skill use outside of some combat here. 244 * We handle all requests for skill use outside of some combat here.
258 * We require a separate routine outside of fire() so as to allow monsters 245 * We require a separate routine outside of fire() so as to allow monsters
851 for (tmp = op->inv; tmp; tmp = tmp->below) 838 for (tmp = op->inv; tmp; tmp = tmp->below)
852 if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_APPLIED)) 839 if (tmp->type == WEAPON && QUERY_FLAG (tmp, FLAG_APPLIED))
853 break; 840 break;
854 841
855 if (!tmp) 842 if (!tmp)
856 {
857 LOG (llevError, "Could not find applied weapon on %s\n", &op->name); 843 LOG (llevError, "Could not find applied weapon on %s\n", &op->name);
858 return 0;
859 }
860 844
861 pl->combat_ob = tmp; 845 pl->combat_ob = tmp;
862 } 846 }
863 else 847
848 if (!pl->combat_ob)
864 { 849 {
865 if (!skill) 850 if (!skill)
866 { 851 {
867 /* See if the players chosen skill is a combat skill, and use 852 /* See if the players chosen skill is a combat skill, and use
868 * it if appropriate. 853 * it if appropriate.
872 else 857 else
873 { 858 {
874 skill = find_player_hth_skill (op); 859 skill = find_player_hth_skill (op);
875 860
876 if (!skill) 861 if (!skill)
877 {
878 new_draw_info (NDI_BLACK, 0, op, "You have no unarmed combat skills!"); 862 new_draw_info (NDI_BLACK, 0, op, "You have no unarmed combat skills!");
879 return 0;
880 }
881 } 863 }
882 } 864 }
883 865
884 pl->combat_ob = skill; 866 op->change_skill (0);
885 apply_special (op, skill, AP_APPLY); 867 apply_special (op, skill, AP_APPLY);
886 } 868 }
887 869
888 if (!pl->combat_ob) 870 if (!pl->combat_ob)
889 { 871 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines