Crossfire Server, Branch 1.12
R12190
|
00001 /* 00002 CrossFire, A Multiplayer game for X-windows 00003 00004 Copyright (C) 2007 Mark Wedel & Crossfire Development Team 00005 Copyright (C) 1992 Frank Tore Johansen 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 00021 The authors can be reached via e-mail at crossfire-devel@real-time.com 00022 */ 00023 00027 #include <global.h> 00028 #include <ob_methods.h> 00029 #include <ob_types.h> 00030 #include <sounds.h> 00031 #include <sproto.h> 00032 00033 static method_ret poisoning_type_process(ob_methods *context, object *op); 00034 00038 void init_type_poisoning(void) { 00039 register_process(POISONING, poisoning_type_process); 00040 } 00041 00048 static method_ret poisoning_type_process(ob_methods *context, object *op) { 00049 if (op->env == NULL 00050 || !QUERY_FLAG(op->env, FLAG_ALIVE) 00051 || op->env->stats.hp < 0) { 00052 remove_ob(op); 00053 free_object(op); 00054 LOG(llevDebug, "Found POISONING with invalid env. Removing...\n"); 00055 return METHOD_ERROR; 00056 } 00057 00058 if (op->stats.food == 1) { 00059 /* need to remove the object before fix_player is called, else fix_object 00060 * will not do anything. 00061 */ 00062 if (op->env->type == PLAYER) { 00063 CLEAR_FLAG(op, FLAG_APPLIED); 00064 fix_object(op->env); 00065 draw_ext_info(NDI_UNIQUE, 0, op->env, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, 00066 "You feel much better now.", NULL); 00067 } 00068 remove_ob(op); 00069 free_object(op); 00070 return METHOD_OK; 00071 } 00072 00073 if (op->env->type == PLAYER) { 00074 op->env->stats.food--; 00075 /* Not really the start of a bad effect, more the continuing effect */ 00076 draw_ext_info(NDI_UNIQUE, 0, op->env, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, 00077 "You feel very sick...", NULL); 00078 } 00079 (void)hit_player(op->env, op->stats.dam, op, AT_INTERNAL, 1); 00080 return METHOD_OK; 00081 }