--- deliantra/server/common/living.C 2007/04/30 04:25:29 1.45 +++ deliantra/server/common/living.C 2007/05/01 05:48:19 1.46 @@ -879,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 @@ -892,6 +892,7 @@ prot[i] = resist[i], vuln[i] = 0; else vuln[i] = -(resist[i]), prot[i] = 0; + potion_resist[i] = 0; } @@ -972,6 +973,10 @@ { if (type == PLAYER) { + 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)); @@ -996,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)) @@ -1037,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); @@ -1076,15 +1088,14 @@ switch (tmp->type) { +#if 0 case WAND: case ROD: case HORN: - if (type == PLAYER) - { - contr->ranged_skill = this; - contr->ranged_ob = tmp; - } + if (type != PLAYER || current_weapon == tmp) + chosen_skill = tmp; break; +#endif /* skills modifying the character -b.t. */ /* for all skills and skill granting objects */ @@ -1127,12 +1138,6 @@ if (settings.spell_encumbrance == TRUE && type == PLAYER) contr->encumbrance += (int) 3 *tmp->weight / 1000; - if (type == PLAYER) - { - contr->ranged_skill = this; - contr->ranged_ob = tmp; - } - break; case SKILL_TOOL: @@ -1140,12 +1145,6 @@ LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); chosen_skill = tmp; - - if (type == PLAYER) - { - contr->ranged_skill = this; - contr->ranged_ob = tmp; - } break; case SHIELD: @@ -1171,9 +1170,7 @@ case BOW: case WEAPON: - 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)) + if (type != PLAYER || current_weapon == tmp) { wc -= tmp->stats.wc + tmp->magic; @@ -1194,15 +1191,9 @@ * go. */ - current_weapon = tmp; - if (type == PLAYER) - { - contr->combat_ob = tmp; - - if (settings.spell_encumbrance) - contr->encumbrance += tmp->weight * 3 / 1000; - } + if (settings.spell_encumbrance) + contr->encumbrance += tmp->weight * 3 / 1000; } break; @@ -1838,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)