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.100 by root, Thu May 17 14:14:55 2007 UTC vs.
Revision 1.101 by root, Thu May 17 20:27:01 2007 UTC

3131 } 3131 }
3132 else 3132 else
3133 /* While experience will be credited properly, we want to change the 3133 /* While experience will be credited properly, we want to change the
3134 * skill so that the dam and wc get updated 3134 * skill so that the dam and wc get updated
3135 */ 3135 */
3136 change_skill (who, skop, 0); 3136 who->change_skill (skop);
3137 } 3137 }
3138 3138
3139 if (who->type == PLAYER 3139 if (who->type == PLAYER
3140 && op->item_power 3140 && op->item_power
3141 && op->item_power + who->contr->item_power > settings.item_power_factor * who->level) 3141 && op->item_power + who->contr->item_power > settings.item_power_factor * who->level)
3191 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s is broken, please report this to the dungeon master!", query_name (op));//TODO 3191 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s is broken, please report this to the dungeon master!", query_name (op));//TODO
3192 return 1; 3192 return 1;
3193 } 3193 }
3194 3194
3195 SET_FLAG (op, FLAG_APPLIED); 3195 SET_FLAG (op, FLAG_APPLIED);
3196 change_skill (who, skop, 1); 3196 who->change_skill (skop);
3197 3197
3198 if (who->contr) 3198 if (who->contr)
3199 who->change_weapon (who->contr->combat_ob = op); 3199 who->change_weapon (who->contr->combat_ob = op);
3200 3200
3201 if (!QUERY_FLAG (who, FLAG_READY_WEAPON)) 3201 if (!QUERY_FLAG (who, FLAG_READY_WEAPON))
3267 return 0; 3267 return 0;
3268 3268
3269 case SKILL_TOOL: 3269 case SKILL_TOOL:
3270 // applying a skill tool also readies the skill 3270 // applying a skill tool also readies the skill
3271 SET_FLAG (op, FLAG_APPLIED); 3271 SET_FLAG (op, FLAG_APPLIED);
3272
3273 if (!(aflags & AP_NO_READY))
3274 {
3272 skop = find_skill_by_name (who, op->skill); 3275 skop = find_skill_by_name (who, op->skill);
3273 if (!skop->flag [FLAG_APPLIED]) 3276 if (!skop->flag [FLAG_APPLIED])
3274 apply_special (who, skop, AP_APPLY); 3277 apply_special (who, skop, AP_APPLY);
3278 }
3275 break; 3279 break;
3276 3280
3277 case SKILL: 3281 case SKILL:
3278 if (who->chosen_skill)
3279 {
3280 LOG (llevError, "BUG: apply_special(): can't apply two skills\n");
3281 return 1;
3282 }
3283
3284 if (player *pl = who->contr) 3282 if (player *pl = who->contr)
3285 { 3283 {
3286 if (IS_COMBAT_SKILL (op->subtype)) 3284 if (IS_COMBAT_SKILL (op->subtype))
3287 { 3285 {
3288 if (skill_flags [op->subtype] & SF_NEED_WEAPON) 3286 if (skill_flags [op->subtype] & SF_NEED_WEAPON)
3289 { 3287 {
3290 for (object *item = who->inv; item; item = item->below) 3288 for (object *item = who->inv; item; item = item->below)
3291 if (item->type == WEAPON && item->flag [FLAG_APPLIED]) 3289 if (item->type == WEAPON && item->flag [FLAG_APPLIED])
3292 { 3290 {
3291 if (item->skill == op->skill)
3292 {
3293 who->change_weapon (pl->combat_ob = item); 3293 who->change_weapon (pl->combat_ob = item);
3294 goto found_weapon; 3294 goto found_weapon;
3295 }
3295 } 3296 }
3296 3297
3297 new_draw_info (NDI_UNIQUE, 0, who, "You need to apply a melee weapon before readying this skill"); 3298 new_draw_info_format (NDI_UNIQUE, 0, who, "You need to apply a '%s' melee weapon before readying this skill", &op->skill);
3298 return 1; 3299 return 1;
3299 3300
3300 found_weapon:; 3301 found_weapon:;
3301 } 3302 }
3302 else 3303 else
3307 if (skill_flags [op->subtype] & SF_NEED_BOW) 3308 if (skill_flags [op->subtype] & SF_NEED_BOW)
3308 { 3309 {
3309 for (object *item = who->inv; item; item = item->below) 3310 for (object *item = who->inv; item; item = item->below)
3310 if (item->type == BOW && item->flag [FLAG_APPLIED]) 3311 if (item->type == BOW && item->flag [FLAG_APPLIED])
3311 { 3312 {
3313 //TODO: bows should/must all have skill missile weapon right now
3312 who->change_weapon (pl->ranged_ob = item); 3314 who->change_weapon (pl->ranged_ob = item);
3313 goto found_bow; 3315 goto found_bow;
3314 } 3316 }
3315 3317
3316 new_draw_info (NDI_UNIQUE, 0, who, "You need to apply a missile weapon before readying this skill"); 3318 new_draw_info (NDI_UNIQUE, 0, who, "You need to apply a missile weapon before readying this skill");
3328 new_draw_info_format (NDI_UNIQUE, 0, who, "You can now use the skill: %s.", &op->skill); 3330 new_draw_info_format (NDI_UNIQUE, 0, who, "You can now use the skill: %s.", &op->skill);
3329 } 3331 }
3330 else 3332 else
3331 new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.", op->skill ? &op->skill : &op->name); 3333 new_draw_info_format (NDI_UNIQUE, 0, who, "Readied skill: %s.", op->skill ? &op->skill : &op->name);
3332 } 3334 }
3333 3335 else
3336 {
3334 SET_FLAG (op, FLAG_APPLIED); 3337 SET_FLAG (op, FLAG_APPLIED);
3335 change_abil (who, op); 3338 change_abil (who, op);
3336 who->chosen_skill = op; 3339 who->chosen_skill = op;
3337 SET_FLAG (who, FLAG_READY_SKILL); 3340 SET_FLAG (who, FLAG_READY_SKILL);
3341 }
3342
3338 break; 3343 break;
3339 3344
3340 case BOW: 3345 case BOW:
3341 if (!check_weapon_power (who, op->last_eat)) 3346 if (!check_weapon_power (who, op->last_eat))
3342 { 3347 {
3369 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s is broken, please report this to the dungeon master!", query_name (op));//TODO 3374 new_draw_info_format (NDI_UNIQUE, 0, who, "The %s is broken, please report this to the dungeon master!", query_name (op));//TODO
3370 return 1; 3375 return 1;
3371 } 3376 }
3372 3377
3373 SET_FLAG (op, FLAG_APPLIED); 3378 SET_FLAG (op, FLAG_APPLIED);
3374 change_skill (who, skop, 0); 3379 who->change_skill (skop);
3375 3380
3376 if (who->contr) 3381 if (who->contr)
3377 { 3382 {
3378 who->contr->ranged_ob = op; 3383 who->contr->ranged_ob = op;
3379 3384
3398 break; 3403 break;
3399 3404
3400 case BUILDER: 3405 case BUILDER:
3401 if (who->type == PLAYER) 3406 if (who->type == PLAYER)
3402 { 3407 {
3408 //TODO: wtf does this do? shouldn't this be managed automatically (slots?)
3403 if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER) 3409 if (who->contr->ranged_ob && who->contr->ranged_ob->type == BUILDER)
3404 unapply_special (who, who->contr->ranged_ob, 0); 3410 unapply_special (who, who->contr->ranged_ob, 0);
3405 3411
3406 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready your %s.", query_name (op)); 3412 new_draw_info_format (NDI_UNIQUE, 0, who, "You ready your %s.", query_name (op));
3407 3413

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines