--- deliantra/server/common/living.C 2007/05/12 19:41:02 1.55 +++ deliantra/server/common/living.C 2007/05/18 01:01:01 1.60 @@ -868,14 +868,17 @@ if (type == PLAYER) { if (tmp == contr->combat_ob || tmp == contr->ranged_ob) - if (tmp != current_weapon && (tmp->type != SKILL || tmp->subtype != SK_PRAYING)) + if (tmp != current_weapon + && (tmp->type != SKILL || tmp->subtype != SK_PRAYING) + && !tmp->flag [FLAG_CURSED] + && !tmp->flag [FLAG_DAMNED]) continue; for (i = 0; i < NUM_STATS; i++) change_attr_value (&stats, i, tmp->stats.stat (i)); - /* these are the items that currently can change digestion, regeneration, - * spell point recovery and mana point recovery. Seems sort of an arbitary + /* These are the items that currently can change digestion, regeneration, + * spell point recovery and mana point recovery. Seems sort of an arbitary * list, but other items store other info into stats array. */ if (tmp->type == WEAPON || tmp->type == BOW || @@ -997,7 +1000,8 @@ break; if (chosen_skill) - LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); + LOG (llevDebug, "fix_player, op %s has multiple skills applied (%s and %s)\n", + &name, &chosen_skill->name, &tmp->name); chosen_skill = tmp; @@ -1030,13 +1034,6 @@ break; - case SKILL_TOOL: - if (chosen_skill) - LOG (llevDebug, "fix_player, op %s has multiple skills applied\n", &name); - - chosen_skill = tmp; - break; - case SHIELD: if (settings.spell_encumbrance == TRUE && type == PLAYER) contr->encumbrance += (int) tmp->weight / 2000; @@ -1362,13 +1359,13 @@ float M = (max_carry[stats.Str] - 121) / 121.f; float M2 = max_carry[stats.Str] / 100.f; float W = weapon_weight / 20000.f; - float s = 2 - weapon_speed / 10.f; + float s = (20 - weapon_speed) / 10.f; float D = (stats.Dex - 14) / 14.f; float K = 1 + M / 3.f - W / (3 * M2) + speed / 5.f + D / 2.f; - K *= (4 + level) *1.2f / (6 + level); + K *= (4 + level) * 1.2f / (6 + level); - if (K <= 0.f) + if (K <= 0.01f) K = 0.01f; float S = speed / (K * s); @@ -1380,23 +1377,8 @@ if (type != PLAYER && arch && stats.dam > arch->clone.stats.dam * 3) stats.dam = arch->clone.stats.dam * 3; - /* Prevent overflows of wc - best you can get is ABS(120) - this - * should be more than enough - remember, AC is also in 8 bits, - * so its value is the same. - */ - if (wc > 120) - wc = 120; - else if (wc < -120) - wc = -120; - - stats.wc = wc; - - if (ac > 120) - ac = 120; - else if (ac < -120) - ac = -120; - - stats.ac = ac; + stats.wc = clamp (wc, MIN_WC, MAX_WC); + stats.ac = clamp (ac, MIN_AC, MAX_AC); /* if for some reason the creature doesn't have any move type, * give them walking as a default. @@ -1595,11 +1577,11 @@ skill_obj->level = 1; insert_ob_in_ob (skill_obj, op); - if (op->contr) + if (player *pl = op->contr) { - op->contr->last_skill_ob [skill_obj->subtype] = skill_obj; - if (op->contr->ns) - op->contr->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous + pl->last_skill_ob [skill_obj->subtype] = skill_obj; + if (pl->ns) + pl->ns->last_skill_exp[skill_obj->subtype] = -1;//TODO: should be made superfluous } return skill_obj;