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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.231 by root, Sat Mar 27 04:25:22 2010 UTC vs.
Revision 1.232 by root, Sun Mar 28 02:53:46 2010 UTC

2955 CLEAR_FLAG (op, FLAG_APPLIED); 2955 CLEAR_FLAG (op, FLAG_APPLIED);
2956 2956
2957 switch (op->type) 2957 switch (op->type)
2958 { 2958 {
2959 case SKILL_TOOL: 2959 case SKILL_TOOL:
2960 case WEAPON:
2960 // unapplying a skill tool should also unapply the skill it governs 2961 // unapplying a weapon or skill tool should also unapply the skill it governs
2961 // but this is hard, as it shouldn't do so when the skill can 2962 // but this is hard, as it shouldn't do so when the skill can
2962 // be used for other reasons 2963 // be used for other reasons
2963 for (object *tmp = who->inv; tmp; tmp = tmp->below) 2964 for (object *tmp = who->inv; tmp; tmp = tmp->below)
2964 if (tmp->skill == op->skill 2965 if (tmp->skill == op->skill
2965 && tmp->type == SKILL 2966 && tmp->type == SKILL
2966 && tmp->flag [FLAG_APPLIED] 2967 && tmp->flag [FLAG_APPLIED]
2967 && !tmp->flag [FLAG_CAN_USE_SKILL]) 2968 && !tmp->flag [FLAG_CAN_USE_SKILL])
2968 unapply_special (who, tmp, 0); 2969 unapply_special (who, tmp, 0);
2969 2970
2970 change_abil (who, op);
2971 break;
2972
2973 case WEAPON:
2974 if (player *pl = who->contr) 2971 if (player *pl = who->contr)
2975 if (op == pl->combat_ob) 2972 if (op == pl->combat_ob)
2976 { 2973 {
2977 pl->combat_ob = 0; 2974 pl->combat_ob = 0;
2978 who->change_weapon (pl->ranged_ob); 2975 who->change_weapon (pl->ranged_ob);
2979 } 2976 }
2980 2977
2981 who->statusmsg (format ("You unwield %s.", query_name (op)));
2982
2983 change_abil (who, op); 2978 change_abil (who, op);
2984 CLEAR_FLAG (who, FLAG_READY_WEAPON); 2979
2980 if (op->type == WEAPON)
2981 {
2982 who->flag [FLAG_READY_WEAPON] = false;
2983 who->statusmsg (format ("You unwield %s.", query_name (op)));
2984 }
2985 else
2986 who->flag [FLAG_READY_SKILL] = false;
2987
2985 break; 2988 break;
2986 2989
2987 case SKILL: 2990 case SKILL:
2988 if (who->contr) 2991 if (who->contr)
2989 { 2992 {
2990 if (IS_COMBAT_SKILL (op->subtype)) 2993 if (op == who->contr->combat_ob)
2994 {
2991 who->change_weapon (who->contr->combat_ob = 0); 2995 who->contr->combat_ob = 0;
2992 else if (IS_RANGED_SKILL (op->subtype))
2993 who->change_weapon (who->contr->ranged_ob = 0); 2996 who->change_weapon (who->contr->ranged_ob);
2997 }
2998
2999 if (op == who->contr->ranged_ob)
3000 {
3001 who->contr->ranged_ob = 0;
3002 who->change_weapon (who->contr->combat_ob);
3003 }
2994 3004
2995 if (op->invisible) 3005 if (op->invisible)
2996 who->statusmsg (format ("You can no longer use the skill: %s.", &op->skill)); 3006 who->statusmsg (format ("You can no longer use the skill: %s.", &op->skill));
2997 else 3007 else
2998 who->statusmsg (format ("You stop using the %s.", query_name (op))); 3008 who->statusmsg (format ("You stop using the %s.", query_name (op)));
3033 else 3043 else
3034 { 3044 {
3035 who->change_skill (0); 3045 who->change_skill (0);
3036 3046
3037 if (op->type == BOW) 3047 if (op->type == BOW)
3038 CLEAR_FLAG (who, FLAG_READY_BOW); 3048 op->flag [FLAG_READY_BOW ] = false;
3039 else 3049 else
3040 CLEAR_FLAG (who, FLAG_READY_RANGE); 3050 op->flag [FLAG_READY_RANGE] = false;
3041 } 3051 }
3042 3052
3043 break; 3053 break;
3044 3054
3045 case BUILDER: 3055 case BUILDER:
3468 { 3478 {
3469 who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO 3479 who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO
3470 return 1; 3480 return 1;
3471 } 3481 }
3472 3482
3473 SET_FLAG (op, FLAG_APPLIED); 3483 op->flag [FLAG_APPLIED] = true;
3474 who->change_skill (skop);
3475 3484
3476 if (who->contr) 3485 if (who->contr)
3477 who->change_weapon (who->contr->combat_ob = op); 3486 who->change_weapon (who->contr->combat_ob = op);
3487 else
3488 who->change_skill (skop);
3478 3489
3479 who->statusmsg (format ("You wield %s.", query_name (op))); 3490 who->statusmsg (format ("You wield %s.", query_name (op)));
3480 3491
3481 SET_FLAG (who, FLAG_READY_WEAPON); 3492 op->flag [FLAG_READY_WEAPON] = true;
3482 change_abil (who, op); 3493 change_abil (who, op);
3483 break; 3494 break;
3484 3495
3485 case ARMOUR: 3496 case ARMOUR:
3486 case HELMET: 3497 case HELMET:
3606 { 3617 {
3607 who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO 3618 who->failmsg (format ("The %s is broken, please report this to the dungeon master!", query_name (op)));//TODO
3608 return 1; 3619 return 1;
3609 } 3620 }
3610 3621
3611 SET_FLAG (op, FLAG_APPLIED); 3622 op->flag [FLAG_APPLIED] = true;
3612 who->change_skill (skop);
3613 3623
3614 if (who->contr) 3624 if (who->contr)
3615 { 3625 {
3616 who->contr->ranged_ob = op;
3617
3618 who->statusmsg (format ("You ready %s.", query_name (op))); 3626 who->statusmsg (format ("You ready %s.", query_name (op)));
3627 who->change_weapon (who->contr->ranged_ob = op);
3619 3628
3620 if (op->type == BOW) 3629 if (op->type == BOW)
3621 {
3622 who->current_weapon = op;
3623 change_abil (who, op);
3624 who->statusmsg (format ("You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op))); 3630 who->statusmsg (format ("You will now fire %s with %s.", op->race ? &op->race : "nothing", query_name (op)));
3625 }
3626 } 3631 }
3627 else 3632 else
3628 { 3633 {
3634 who->change_skill (skop);
3635
3629 if (op->type == BOW) 3636 if (op->type == BOW)
3630 SET_FLAG (who, FLAG_READY_BOW); 3637 op->flag [FLAG_READY_BOW ] = true;
3631 else 3638 else
3632 SET_FLAG (who, FLAG_READY_RANGE); 3639 op->flag [FLAG_READY_RANGE] = true;
3633 } 3640 }
3634 3641
3635 break; 3642 break;
3636 3643
3637 case BUILDER: 3644 case BUILDER:
3640 //TODO: wtf does this do? shouldn't this be managed automatically (slots?) 3647 //TODO: wtf does this do? shouldn't this be managed automatically (slots?)
3641 if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER) 3648 if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER)
3642 unapply_special (who, who->contr->ranged_ob, 0); 3649 unapply_special (who, who->contr->ranged_ob, 0);
3643 3650
3644 who->statusmsg (format ("You ready your %s.", query_name (op))); 3651 who->statusmsg (format ("You ready your %s.", query_name (op)));
3645
3646 who->contr->ranged_ob = op; 3652 who->change_weapon (who->contr->ranged_ob = op);
3647 } 3653 }
3648 break; 3654 break;
3649 3655
3650 default: 3656 default:
3651 who->statusmsg (format ("You apply %s.", query_name (op))); 3657 who->statusmsg (format ("You apply %s.", query_name (op)));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines