--- deliantra/server/common/living.C 2007/04/29 14:39:55 1.39 +++ deliantra/server/common/living.C 2007/04/29 18:11:21 1.40 @@ -937,7 +937,7 @@ glow_radius = tmp->glow_radius; /* This happens because apply_potion calls change_abil with the potion - * applied so we can tell the player what chagned. But change_abil + * applied so we can tell the player what changed. But change_abil * then calls this function. */ if (QUERY_FLAG (tmp, FLAG_APPLIED) && tmp->type == POTION) @@ -1019,7 +1019,7 @@ if (tmp->type == SYMPTOM) { - speed_reduce_from_disease = tmp->last_sp / 100.0; + speed_reduce_from_disease = tmp->last_sp / 100.f; if (speed_reduce_from_disease == 0) speed_reduce_from_disease = 1; @@ -1082,11 +1082,11 @@ { if (tmp->stats.exp > 0) { - added_speed += (float) tmp->stats.exp / 3.0; - bonus_speed += 1.0 + (float) tmp->stats.exp / 3.0; + added_speed += tmp->stats.exp / 3.f; + bonus_speed += 1.f + tmp->stats.exp / 3.f; } else - added_speed += (float) tmp->stats.exp; + added_speed += tmp->stats.exp; } switch (tmp->type) @@ -1108,7 +1108,7 @@ if (tmp->stats.dam > 0) { /* skill is a 'weapon' */ if (!QUERY_FLAG (this, FLAG_READY_WEAPON)) - weapon_speed = (int) WEAPON_SPEED (tmp); + weapon_speed = WEAPON_SPEED (tmp); if (weapon_speed < 0) weapon_speed = 0; @@ -1183,19 +1183,21 @@ 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 (settings.spell_encumbrance == TRUE && type == PLAYER) - contr->encumbrance += (int) 3 *tmp->weight / 1000; + if (type == PLAYER && settings.spell_encumbrance) + contr->encumbrance += tmp->weight * 3 / 1000; break; case ARMOUR: /* Only the best of these three are used: */ if (settings.spell_encumbrance == TRUE && type == PLAYER) - contr->encumbrance += (int) tmp->weight / 1000; + contr->encumbrance += tmp->weight / 1000; case BRACERS: case FORCE: @@ -1227,8 +1229,8 @@ if (tmp->stats.ac) ac -= (tmp->stats.ac + tmp->magic); - if (ARMOUR_SPEED (tmp) && ARMOUR_SPEED (tmp) / 10.0 < max) - max = ARMOUR_SPEED (tmp) / 10.0; + if (ARMOUR_SPEED (tmp) && ARMOUR_SPEED (tmp) / 10.f < max) + max = ARMOUR_SPEED (tmp) / 10.f; break; } /* switch tmp->type */ @@ -1306,7 +1308,7 @@ stats.maxsp = 1; else { - sp_tmp = 0.0; + sp_tmp = 0.f; for (i = 1; i <= mana_obj->level && i <= 10; i++) { @@ -1314,17 +1316,17 @@ /* Got some extra bonus at first level */ if (i < 2) - stmp = contr->levsp[i] + ((2.0 * (float) sp_bonus[stats.Pow] + (float) sp_bonus[stats.Int]) / 6.0); + stmp = contr->levsp[i] + (2.f * sp_bonus[stats.Pow] + sp_bonus[stats.Int]) / 6.f; else - stmp = (float) contr->levsp[i] + (2.0 * (float) sp_bonus[stats.Pow] + (float) sp_bonus[stats.Int]) / 12.0; + stmp = contr->levsp[i] + (2.f * sp_bonus[stats.Pow] + sp_bonus[stats.Int]) / 12.f; - if (stmp < 1.0) - stmp = 1.0; + if (stmp < 1.f) + stmp = 1.f; sp_tmp += stmp; } - stats.maxsp = (int) sp_tmp; + stats.maxsp = (sint16)sp_tmp; for (i = 11; i <= mana_obj->level; i++) stats.maxsp += 2; @@ -1346,26 +1348,24 @@ * becomes big jumps when the sums of the bonuses jump to the next * step of 8 - with floats, even fractional ones are useful. */ - sp_tmp = 0.0; + sp_tmp = 0.f; for (i = 1, stats.maxgrace = 0; i <= grace_obj->level && i <= 10; i++) { - float grace_tmp = 0.0; + float grace_tmp = 0.f; /* Got some extra bonus at first level */ if (i < 2) - grace_tmp = contr->levgrace[i] + (((float) grace_bonus[stats.Pow] + - 2.0 * (float) grace_bonus[stats.Wis]) / 6.0); + grace_tmp = contr->levgrace[i] + (grace_bonus[stats.Pow] + 2.f * grace_bonus[stats.Wis]) / 6.f; else - grace_tmp = (float) contr->levgrace[i] - + ((float) grace_bonus[stats.Pow] + 2.0 * (float) grace_bonus[stats.Wis]) / 12.0; + grace_tmp = contr->levgrace[i] + (grace_bonus[stats.Pow] + 2.f * grace_bonus[stats.Wis]) / 12.f; - if (grace_tmp < 1.0) - grace_tmp = 1.0; + if (grace_tmp < 1.f) + grace_tmp = 1.f; sp_tmp += grace_tmp; } - stats.maxgrace = (int) sp_tmp; + stats.maxgrace = (sint16)sp_tmp; /* two grace points per level after 11 */ for (i = 11; i <= grace_obj->level; i++) @@ -1416,7 +1416,7 @@ if (stats.dam < 1) stats.dam = 1; - speed = 1.0 + speed_bonus[stats.Dex]; + speed = 1.f + speed_bonus[stats.Dex]; if (settings.search_items && contr->search_str[0]) speed -= 1; @@ -1427,9 +1427,9 @@ } /* End if player */ if (added_speed >= 0) - speed += added_speed / 10.0; + speed += added_speed / 10.f; else /* Something wrong here...: */ - speed /= (float) (1.0 - added_speed); + speed /= 1.f - added_speed; /* Max is determined by armour */ if (speed > max) @@ -1444,43 +1444,45 @@ */ f = (carrying / 1000) - max_carry[stats.Str]; if (f > 0) - speed = speed / (1.0 + f / max_carry[stats.Str]); + speed = speed / (1.f + f / max_carry[stats.Str]); } - speed += bonus_speed / 10.0; /* Not affected by limits */ + speed += bonus_speed / 10.f; /* Not affected by limits */ /* Put a lower limit on speed. Note with this speed, you move once every * 100 ticks or so. This amounts to once every 12 seconds of realtime. */ speed = speed * speed_reduce_from_disease; - if (speed < 0.01 && type == PLAYER) - speed = 0.01; + if (speed < 0.01f && type == PLAYER) + speed = 0.01f; if (type == PLAYER) { - float M, W, s, D, K, S, M2; - /* (This formula was made by vidarl@ifi.uio.no) * Note that we never used these values again - basically * all of these could be subbed into one big equation, but * that would just be a real pain to read. */ - M = (max_carry[stats.Str] - 121) / 121.0; - M2 = max_carry[stats.Str] / 100.0; - W = weapon_weight / 20000.0; - s = 2 - weapon_speed / 10.0; - D = (stats.Dex - 14) / 14.0; - K = 1 + M / 3.0 - W / (3 * M2) + speed / 5.0 + D / 2.0; - K *= (4 + level) / (float) (6 + level) * 1.2; - if (K <= 0) - K = 0.01; - S = speed / (K * s); + 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 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); + + if (K <= 0.f) + K = 0.01f; + + float S = speed / (K * s); + contr->weapon_sp = S; } /* I want to limit the power of small monsters with big weapons: */ - if (type != PLAYER && arch != NULL && stats.dam > arch->clone.stats.dam * 3) + 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 @@ -1539,8 +1541,13 @@ int allowed_class (const object *op) { - return op->stats.Dex > 0 && op->stats.Str > 0 && op->stats.Con > 0 && - op->stats.Int > 0 && op->stats.Wis > 0 && op->stats.Pow > 0 && op->stats.Cha > 0; + return op->stats.Dex > 0 + && op->stats.Str > 0 + && op->stats.Con > 0 + && op->stats.Int > 0 + && op->stats.Wis > 0 + && op->stats.Pow > 0 + && op->stats.Cha > 0; } /* @@ -1772,6 +1779,7 @@ { if (level > settings.max_level) return (sint64) (expmul * levels[settings.max_level]); + return (sint64) (expmul * levels[level]); }