--- deliantra/server/common/living.C 2007/01/04 16:19:31 1.24 +++ deliantra/server/common/living.C 2007/01/20 22:09:50 1.32 @@ -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,36 +194,36 @@ "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] = { @@ -756,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; @@ -1610,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; @@ -1680,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; } @@ -2023,8 +2027,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); } }