--- deliantra/server/common/living.C 2007/01/15 21:06:18 1.30 +++ deliantra/server/common/living.C 2007/04/29 04:14:57 1.38 @@ -1,5 +1,5 @@ /* - * CrossFire, A Multiplayer game for X-windows + * CrossFire, A Multiplayer game * * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team * Copyright (C) 2002 Mark Wedel & Crossfire Development Team @@ -679,7 +679,7 @@ void object::drain_stat () { - drain_specific_stat (RANDOM () % NUM_STATS); + drain_specific_stat (rndm (NUM_STATS)); } void @@ -757,7 +757,7 @@ /* Randomly change the players luck. Basically, we move it * back neutral (if greater>0, subtract, otherwise add) */ - if (RANDOM () % (FABS (tmp->stats.luck)) >= RANDOM () % 30) + if (rndm (abs (tmp->stats.luck)) >= rndm (30)) { int diff = tmp->stats.luck > 0 ? -1 : 1; @@ -820,12 +820,10 @@ * and players; the "player" in the name is purely an archaic inheritance. * This functions starts from base values (archetype or player object) * and then adjusts them according to what the player has equipped. + * + * July 95 - inserted stuff to handle new skills/exp system - b.t. + * spell system split, grace points now added to system --peterm */ - -/* July 95 - inserted stuff to handle new skills/exp system - b.t. - spell system split, grace points now added to system --peterm - */ - void object::update_stats () { @@ -859,9 +857,9 @@ * range_magic (what spell is readied). These three below * well get filled in based on what the player has equipped. */ - contr->ranges[range_bow] = NULL; - contr->ranges[range_misc] = NULL; - contr->ranges[range_skill] = NULL; + contr->ranges[range_bow] = 0; + contr->ranges[range_misc] = 0; + contr->ranges[range_skill] = 0; } memcpy (body_used, body_info, sizeof (body_info)); @@ -928,7 +926,6 @@ /* OK - we've reset most all the objects attributes to sane values. * now go through and make adjustments for what the player has equipped. */ - for (tmp = inv; tmp; tmp = tmp->below) { /* See note in map.c:update_position about making this additive @@ -992,7 +989,7 @@ * 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) || + if ((tmp->type == WEAPON) || (tmp->type == BOW) || (tmp->type == ARMOUR) || (tmp->type == HELMET) || (tmp->type == SHIELD) || (tmp->type == RING) || (tmp->type == BOOTS) || (tmp->type == GLOVES) || @@ -1023,7 +1020,7 @@ } /* Pos. and neg. protections are counted seperate (-> pro/vuln). - * (Negative protections are calculated extactly like positive.) + * (Negative protections are calculated exactly like positive.) * Resistance from potions are treated special as well. If there's * more than one potion-effect, the bigger prot.-value is taken. */ @@ -1042,9 +1039,9 @@ potion_resist[i] = tmp->resist[i]; } else if (tmp->resist[i] > 0) - prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; + prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; else if (tmp->resist[i] < 0) - vuln[i] += ((100 - vuln[i]) * (-tmp->resist[i])) / 100; + vuln[i] += ((100 - vuln[i]) * -tmp->resist[i]) / 100; } } @@ -1155,23 +1152,24 @@ case GLOVES: case CLOAK: if (tmp->stats.wc) - wc -= (tmp->stats.wc + tmp->magic); + wc -= tmp->stats.wc + tmp->magic; if (tmp->stats.dam) - stats.dam += (tmp->stats.dam + tmp->magic); + stats.dam += tmp->stats.dam + tmp->magic; if (tmp->stats.ac) - ac -= (tmp->stats.ac + tmp->magic); + ac -= tmp->stats.ac + tmp->magic; break; + case BOW: case WEAPON: - wc -= (tmp->stats.wc + tmp->magic); + wc -= tmp->stats.wc + 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); + stats.dam += tmp->stats.dam + tmp->magic; weapon_weight = tmp->weight; weapon_speed = ((int) WEAPON_SPEED (tmp) * 2 - tmp->magic) / 2; @@ -1391,19 +1389,21 @@ if (type == PLAYER && wc_obj && wc_obj->level > 1) { - wc -= (wc_obj->level + thaco_bonus[stats.Str]); + wc -= wc_obj->level + thaco_bonus[stats.Str]; + for (i = 1; i < wc_obj->level; i++) { /* addtional wc every 6 levels */ if (!(i % 6)) wc--; + /* addtional dam every 4 levels. */ - if (!(i % 4) && (dam_bonus[stats.Str] >= 0)) - stats.dam += (1 + (dam_bonus[stats.Str] / 5)); + if (!(i % 4) && dam_bonus[stats.Str] >= 0) + stats.dam += 1 + dam_bonus[stats.Str] / 5; } } else - wc -= (level + thaco_bonus[stats.Str]); + wc -= level + thaco_bonus[stats.Str]; stats.dam += dam_bonus[stats.Str]; @@ -1517,6 +1517,10 @@ esrv_update_stats (contr); esrv_update_spells (contr); } + + // update the mapspace, if we are on a map + if (!flag [FLAG_REMOVED] && map) + map->at (x, y).flags_ = 0; } /* @@ -1953,6 +1957,7 @@ player_lvl_adj (op, tmp); } } + if (flag != SK_SUBTRACT_SKILL_EXP) { del_exp = check_exp_loss (op, exp); @@ -1961,8 +1966,6 @@ } } - - /* change_exp() - changes experience to a player/monster. This * does bounds checking to make sure we don't overflow the max exp. * @@ -1972,11 +1975,9 @@ * flag is what to do if player doesn't have the skill. * these last two values are only used for players. */ - void change_exp (object *op, sint64 exp, const char *skill_name, int flag) { - #ifdef EXP_DEBUG LOG (llevDebug, "change_exp() called for %s, exp = %" PRId64 "\n", query_name (op), exp); #endif @@ -2027,8 +2028,7 @@ * a particular skill, so we don't need to pass that * along. */ - subtract_player_exp (op, FABS (exp), skill_name, flag); - + subtract_player_exp (op, abs (exp), skill_name, flag); } } @@ -2036,7 +2036,6 @@ * settings death_penalty_percentage and death_penalty_levels, and by the * amount of permenent experience, whichever gives the lowest loss. */ - void apply_death_exp_penalty (object *op) {