--- deliantra/server/common/living.C 2006/12/22 16:34:00 1.19 +++ deliantra/server/common/living.C 2007/01/18 19:42:09 1.31 @@ -1,25 +1,26 @@ /* - CrossFire, A Multiplayer game for X-windows - - Copyright (C) 2002 Mark Wedel & Crossfire Development Team - Copyright (C) 1992 Frank Tore Johansen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - The authors can be reached via e-mail at -*/ + * CrossFire, A Multiplayer game for X-windows + * + * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team + * Copyright (C) 2002 Mark Wedel & Crossfire Development Team + * Copyright (C) 1992 Frank Tore Johansen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * The authors can be reached via e-mail at + */ #include #include @@ -193,44 +194,44 @@ "You're feeling clumsy!", "You feel less healthy", "You suddenly begin to lose your memory!", - "Your face gets distorted!", "Watch out, your mind is going!", - "Your spirit feels drained!" + "Your spirit feels drained!", + "Your face gets distorted!", }; const char *const restore_msg[NUM_STATS] = { "You feel your strength return.", "You feel your agility return.", "You feel your health return.", + "You feel your memory return.", "You feel your wisdom return.", + "You feel your spirits return.", "You feel your charisma return.", - "You feel your memory return.", - "You feel your spirits return." }; const char *const gain_msg[NUM_STATS] = { "You feel stronger.", "You feel more agile.", "You feel healthy.", + "You feel smarter.", "You feel wiser.", + "You feel more potent.", "You seem to look better.", - "You feel smarter.", - "You feel more potent." }; const char *const lose_msg[NUM_STATS] = { "You feel weaker!", "You feel clumsy!", "You feel less healthy!", + "You feel stupid!", "You lose some of your memory!", + "You feel less potent!", "You look ugly!", - "You feel stupid!", - "You feel less potent!" }; const char *const statname[NUM_STATS] = { - "strength", "dexterity", "constitution", "wisdom", "charisma", "intelligence", "power" + "strength", "dexterity", "constitution", "intelligence", "wisdom", "power", "charisma" }; const char *const short_stat_name[NUM_STATS] = { - "Str", "Dex", "Con", "Wis", "Cha", "Int", "Pow" + "Str", "Dex", "Con", "Int", "Wis", "Pow", "Cha" }; /* @@ -373,9 +374,9 @@ /* remember what object was like before it was changed. note that * refop is a local copy of op only to be used for detecting changes - * found by fix_player. refop is not a real object + * found by update_stats. refop is not a real object */ - object_pod refop = *op; + object_copy refop = *op; if (op->type == PLAYER) { @@ -403,6 +404,7 @@ { nstat = 20 + get_attr_value (&(op->arch->clone.stats), j); } + if (nstat != ostat) { set_attr_value (&(op->contr->orig_stats), j, nstat); @@ -414,12 +416,14 @@ potion_max = 1; } } + /* This section of code ups the characters normal stats also. I am not * sure if this is strictly necessary, being that fix_player probably * recalculates this anyway. */ for (j = 0; j < NUM_STATS; j++) change_attr_value (&(op->stats), j, flag * get_attr_value (&(tmp->stats), j)); + check_stat_bounds (&(op->stats)); } /* end of potion handling code */ } @@ -453,21 +457,25 @@ success = 1; DIFF_MSG (flag, "Your hands begin to glow red.", "Your hands stop glowing red."); } + if (QUERY_FLAG (op, FLAG_LIFESAVE) != QUERY_FLAG (&refop, FLAG_LIFESAVE)) { success = 1; DIFF_MSG (flag, "You feel very protected.", "You don't feel protected anymore."); } + if (QUERY_FLAG (op, FLAG_REFL_MISSILE) != QUERY_FLAG (&refop, FLAG_REFL_MISSILE)) { success = 1; DIFF_MSG (flag, "A magic force shimmers around you.", "The magic force fades away."); } + if (QUERY_FLAG (op, FLAG_REFL_SPELL) != QUERY_FLAG (&refop, FLAG_REFL_SPELL)) { success = 1; DIFF_MSG (flag, "You feel more safe now, somehow.", "Suddenly you feel less safe, somehow."); } + /* movement type has changed. We don't care about cases where * user has multiple items giving the same type appled like we * used to - that is more work than what we gain, plus messages @@ -525,11 +533,13 @@ success = 1; DIFF_MSG (flag, "You walk more quietly.", "You walk more noisily."); } + if (QUERY_FLAG (op, FLAG_MAKE_INVIS) != QUERY_FLAG (&refop, FLAG_MAKE_INVIS)) { success = 1; DIFF_MSG (flag, "You become transparent.", "You can see yourself."); } + /* blinded you can tell if more blinded since blinded player has minimal * vision */ @@ -657,6 +667,7 @@ } } } + return success; } @@ -746,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 (RANDOM () % (FABS (tmp->stats.luck)) >= rndm (30)) { int diff = tmp->stats.luck > 0 ? -1 : 1; @@ -824,6 +835,7 @@ int best_wc = 0, best_ac = 0, wc = 0, ac = 0; int prot[NROFATTACKS], vuln[NROFATTACKS], potion_resist[NROFATTACKS]; object *grace_obj = NULL, *mana_obj = NULL, *wc_obj = NULL, *tmp; + float old_speed = speed; /* First task is to clear all the values back to their original values */ if (type == PLAYER) @@ -1020,7 +1032,7 @@ for (i = 0; i < NROFATTACKS; i++) { /* Potential for cursed potions, in which case we just can use - * a straight MAX, as potion_resist is initialized to zero. + * a straight MAX, as potion_resist is initialised to zero. */ if (tmp->type == POTION_EFFECT) { @@ -1494,7 +1506,8 @@ else if (move_type & (MOVE_FLY_LOW | MOVE_FLY_HIGH)) move_type &= ~MOVE_WALK; - update_ob_speed (this); + if (speed != old_speed) + set_speed (speed); /* It is quite possible that a player's spell costing might have changed, * so we will check that now. @@ -1598,16 +1611,16 @@ char buf[MAX_BUF]; /* tmp. string buffer */ /* now grab the 'dragon_ability'-forces from the player's inventory */ - for (tmp = who->inv; tmp != NULL; tmp = tmp->below) - { - if (tmp->type == FORCE) - { - if (strcmp (tmp->arch->name, "dragon_ability_force") == 0) - abil = tmp; - if (strcmp (tmp->arch->name, "dragon_skin_force") == 0) - skin = tmp; - } - } + shstr_cmp dragon_ability_force ("dragon_ability_force"); + shstr_cmp dragon_skin_force ("dragon_skin_force"); + + for (tmp = who->inv; tmp; tmp = tmp->below) + if (tmp->type == FORCE) + if (tmp->arch->name == dragon_ability_force) + abil = tmp; + else if (tmp->arch->name == dragon_skin_force) + skin = tmp; + /* if the force is missing -> bail out */ if (abil == NULL) return; @@ -1668,11 +1681,14 @@ skill_obj->stats.exp = 0; skill_obj->level = 1; insert_ob_in_ob (skill_obj, op); + if (op->contr) { - op->contr->last_skill_ob[skill_obj->subtype] = skill_obj; - op->contr->last_skill_exp[skill_obj->subtype] = -1; + 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 } + return skill_obj; }