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 00028 #include <global.h> 00029 #include <ob_methods.h> 00030 #include <ob_types.h> 00031 #include <sounds.h> 00032 #include <sproto.h> 00033 00034 static method_ret peacemaker_type_process(ob_methods *context, object *op); 00035 00039 void init_type_peacemaker(void) { 00040 register_process(PEACEMAKER, peacemaker_type_process); 00041 } 00042 00050 static method_ret peacemaker_type_process(ob_methods *context, object *op) { 00051 object *tmp; 00052 00053 for (tmp = GET_MAP_OB(op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) { 00054 int atk_lev, def_lev; 00055 object *victim = tmp; 00056 00057 if (tmp->head) 00058 victim = tmp->head; 00059 if (!QUERY_FLAG(victim, FLAG_MONSTER)) 00060 continue; 00061 if (QUERY_FLAG(victim, FLAG_UNAGGRESSIVE)) 00062 continue; 00063 if (victim->stats.exp == 0) 00064 continue; 00065 00066 def_lev = MAX(1, victim->level); 00067 atk_lev = MAX(1, op->level); 00068 00069 if (rndm(0, atk_lev-1) > def_lev) { 00070 /* make this sucker peaceful. */ 00071 00072 change_exp(get_owner(op), victim->stats.exp, op->skill, 0); 00073 victim->stats.exp = 0; 00074 victim->attack_movement = RANDO2; 00075 SET_FLAG(victim, FLAG_UNAGGRESSIVE); 00076 SET_FLAG(victim, FLAG_RUN_AWAY); 00077 SET_FLAG(victim, FLAG_RANDOM_MOVE); 00078 CLEAR_FLAG(victim, FLAG_MONSTER); 00079 if (victim->name) { 00080 draw_ext_info_format(NDI_UNIQUE, 0, op->owner, MSG_TYPE_SPELL, MSG_TYPE_SPELL_SUCCESS, 00081 "%s no longer feels like fighting.", 00082 "%s no longer feels like fighting.", 00083 victim->name); 00084 } 00085 } 00086 } 00087 return METHOD_OK; 00088 }