--- deliantra/server/common/living.C 2007/04/29 21:44:34 1.44 +++ deliantra/server/common/living.C 2007/04/30 04:25:29 1.45 @@ -852,15 +852,6 @@ contr->gen_grace = 0; contr->gen_sp_armour = 10; contr->item_power = 0; - - /* Don't clobber all the range_ values. range_golem otherwise - * gets reset for no good reason, and we don't want to reset - * range_magic (what spell is readied). These three below - * well get filled in based on what the player has equipped. - */ - contr->ranges[range_bow] = 0; - contr->ranges[range_misc] = 0; - contr->ranges[range_skill] = 0; } memcpy (body_used, body_info, sizeof (body_info)); @@ -981,12 +972,6 @@ { if (type == PLAYER) { - if (tmp->type == BOW) - contr->ranges[range_bow] = tmp; - - if (tmp->type == WAND || tmp->type == ROD || tmp->type == HORN) - contr->ranges[range_misc] = tmp; - for (i = 0; i < NUM_STATS; i++) change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); @@ -1091,6 +1076,16 @@ switch (tmp->type) { + case WAND: + case ROD: + case HORN: + if (type == PLAYER) + { + contr->ranged_skill = this; + contr->ranged_ob = tmp; + } + break; + /* skills modifying the character -b.t. */ /* for all skills and skill granting objects */ case SKILL: @@ -1121,19 +1116,22 @@ } if (tmp->stats.wc) - wc -= (tmp->stats.wc + tmp->magic); + wc -= tmp->stats.wc + tmp->magic; if (tmp->slaying) slaying = tmp->slaying; if (tmp->stats.ac) - ac -= (tmp->stats.ac + tmp->magic); + ac -= tmp->stats.ac + tmp->magic; if (settings.spell_encumbrance == TRUE && type == PLAYER) contr->encumbrance += (int) 3 *tmp->weight / 1000; if (type == PLAYER) - contr->ranges[range_skill] = this; + { + contr->ranged_skill = this; + contr->ranged_ob = tmp; + } break; @@ -1144,7 +1142,10 @@ chosen_skill = tmp; if (type == PLAYER) - contr->ranges[range_skill] = this; + { + contr->ranged_skill = this; + contr->ranged_ob = tmp; + } break; case SHIELD: @@ -1168,29 +1169,41 @@ break; + case BOW: case WEAPON: - wc -= tmp->stats.wc + tmp->magic; + if (type != PLAYER + || (contr->combat_skill && contr->combat_skill->type == SKILL && (skill_flags [contr->combat_skill->subtype] & SF_NEED_BOW ) && tmp->type == BOW ) + || (contr->combat_skill && contr->combat_skill->type == SKILL && (skill_flags [contr->combat_skill->subtype] & SF_NEED_WEAPON) && tmp->type == WEAPON)) + { + wc -= tmp->stats.wc + tmp->magic; - if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) - ac -= tmp->stats.ac + tmp->magic; + if (tmp->stats.ac && tmp->stats.ac + tmp->magic > 0) + ac -= tmp->stats.ac + tmp->magic; + + stats.dam += tmp->stats.dam + tmp->magic; + weapon_weight = tmp->weight; + weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; - stats.dam += tmp->stats.dam + tmp->magic; - weapon_weight = tmp->weight; - weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; - - if (weapon_speed < 0) - weapon_speed = 0; - - slaying = tmp->slaying; - - /* If there is desire that two handed weapons should do - * extra strength damage, this is where the code should - * go. - */ - - current_weapon = tmp; - if (type == PLAYER && settings.spell_encumbrance) - contr->encumbrance += tmp->weight * 3 / 1000; + if (weapon_speed < 0) + weapon_speed = 0; + + slaying = tmp->slaying; + + /* If there is desire that two handed weapons should do + * extra strength damage, this is where the code should + * go. + */ + + current_weapon = tmp; + + if (type == PLAYER) + { + contr->combat_ob = tmp; + + if (settings.spell_encumbrance) + contr->encumbrance += tmp->weight * 3 / 1000; + } + } break;