--- deliantra/server/common/living.C 2007/04/29 21:44:34 1.44 +++ deliantra/server/common/living.C 2007/05/01 05:48:19 1.46 @@ -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)); @@ -888,7 +879,7 @@ glow_radius = arch->clone.glow_radius; move_type = arch->clone.move_type; - chosen_skill = NULL; + chosen_skill = 0; /* initializing resistances from the values in player/monster's * archetype clone @@ -901,6 +892,7 @@ prot[i] = resist[i], vuln[i] = 0; else vuln[i] = -(resist[i]), prot[i] = 0; + potion_resist[i] = 0; } @@ -981,11 +973,9 @@ { 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; + if ((tmp->type == WEAPON || tmp->type == BOW) + && tmp != current_weapon) + continue; for (i = 0; i < NUM_STATS; i++) change_attr_value (&stats, i, get_attr_value (&tmp->stats, i)); @@ -1011,6 +1001,11 @@ contr->item_power += tmp->item_power; } } /* if this is a player */ + else + { + if (tmp->type == WEAPON) + current_weapon = tmp; + } /* Update slots used for items */ if (QUERY_FLAG (tmp, FLAG_APPLIED)) @@ -1052,14 +1047,16 @@ } /* There may be other things that should not adjust the attacktype */ - if (tmp->type != BOW && tmp->type != SYMPTOM) - attacktype |= tmp->attacktype; - - path_attuned |= tmp->path_attuned; - path_repelled |= tmp->path_repelled; - path_denied |= tmp->path_denied; - move_type |= tmp->move_type; - stats.luck += tmp->stats.luck; + if ((tmp->type != WEAPON && tmp->type != BOW && tmp->type != SYMPTOM) + || current_weapon == tmp) + { + attacktype |= tmp->attacktype; + path_attuned |= tmp->path_attuned; + path_repelled |= tmp->path_repelled; + path_denied |= tmp->path_denied; + move_type |= tmp->move_type; + stats.luck += tmp->stats.luck; + } if (QUERY_FLAG (tmp, FLAG_LIFESAVE )) SET_FLAG (this, FLAG_LIFESAVE); if (QUERY_FLAG (tmp, FLAG_REFL_SPELL )) SET_FLAG (this, FLAG_REFL_SPELL); @@ -1091,6 +1088,15 @@ switch (tmp->type) { +#if 0 + case WAND: + case ROD: + case HORN: + if (type != PLAYER || current_weapon == tmp) + chosen_skill = tmp; + break; +#endif + /* skills modifying the character -b.t. */ /* for all skills and skill granting objects */ case SKILL: @@ -1121,20 +1127,17 @@ } 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; - break; case SKILL_TOOL: @@ -1142,9 +1145,6 @@ LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); chosen_skill = tmp; - - if (type == PLAYER) - contr->ranges[range_skill] = this; break; case SHIELD: @@ -1168,29 +1168,33 @@ break; + case BOW: case WEAPON: - wc -= tmp->stats.wc + tmp->magic; + if (type != PLAYER || current_weapon == tmp) + { + 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; - - 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. - */ + stats.dam += tmp->stats.dam + tmp->magic; + weapon_weight = tmp->weight; + weapon_speed = (WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; - 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. + */ + + if (type == PLAYER) + if (settings.spell_encumbrance) + contr->encumbrance += tmp->weight * 3 / 1000; + } break; @@ -1825,11 +1829,11 @@ /* prevents some forms of abuse. */ if (op->contr->braced) - exp = exp / 5; + exp /= 5; /* Try to find the matching skill. * We do a shortcut/time saving mechanism first - see if it matches - * chosen_skill. This means we don't need to search through + * chosen_skill. This means we don't need to search through * the players inventory. */ if (skill_name)