… | |
… | |
450 | owner = owner->owner; |
450 | owner = owner->owner; |
451 | |
451 | |
452 | this->owner = owner; |
452 | this->owner = owner; |
453 | } |
453 | } |
454 | |
454 | |
|
|
455 | int |
|
|
456 | object::slottype () const |
|
|
457 | { |
|
|
458 | if (type == SKILL) |
|
|
459 | { |
|
|
460 | if (IS_COMBAT_SKILL (subtype)) return slot_combat; |
|
|
461 | if (IS_RANGED_SKILL (subtype)) return slot_ranged; |
|
|
462 | } |
|
|
463 | else |
|
|
464 | { |
|
|
465 | if (slot [body_combat].info) return slot_combat; |
|
|
466 | if (slot [body_range ].info) return slot_ranged; |
|
|
467 | } |
|
|
468 | |
|
|
469 | return slot_none; |
|
|
470 | } |
|
|
471 | |
455 | bool |
472 | bool |
456 | object::change_weapon (object *ob) |
473 | object::change_weapon (object *ob) |
457 | { |
474 | { |
458 | if (current_weapon == ob) |
475 | if (current_weapon == ob) |
459 | return true; |
476 | return true; |
… | |
… | |
464 | current_weapon = ob; |
481 | current_weapon = ob; |
465 | chosen_skill = !ob || ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); |
482 | chosen_skill = !ob || ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); |
466 | |
483 | |
467 | if (chosen_skill) |
484 | if (chosen_skill) |
468 | chosen_skill->flag [FLAG_APPLIED] = true; |
485 | chosen_skill->flag [FLAG_APPLIED] = true; |
|
|
486 | |
|
|
487 | if (ob && !ob->flag [FLAG_APPLIED]) |
|
|
488 | { |
|
|
489 | LOG (llevError | logBacktrace, "%s changed to unapplied weapon %s", |
|
|
490 | &name, ob->debug_desc ()); |
|
|
491 | return false; |
|
|
492 | } |
469 | |
493 | |
470 | update_stats (); |
494 | update_stats (); |
471 | |
495 | |
472 | if (ob) |
496 | if (ob) |
473 | { |
497 | { |
… | |
… | |
483 | "You try to balance your applied items all at once, but the %s is too much. " |
507 | "You try to balance your applied items all at once, but the %s is too much. " |
484 | "You need to unapply some items first.", &ob->name); |
508 | "You need to unapply some items first.", &ob->name); |
485 | return false; |
509 | return false; |
486 | } |
510 | } |
487 | |
511 | |
488 | new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
512 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
489 | } |
513 | } |
490 | else |
514 | else |
491 | new_draw_info_format (NDI_UNIQUE, 0, this, "You unwield your weapons."); |
515 | ;//new_draw_info_format (NDI_UNIQUE, 0, this, "You unwield your weapons."); |
492 | |
516 | |
493 | return true; |
517 | return true; |
494 | } |
518 | } |
495 | |
519 | |
496 | /* Zero the key_values on op, decrementing the shared-string |
520 | /* Zero the key_values on op, decrementing the shared-string |