|
Atrinik Server 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00032 #include <global.h> 00033 00034 static void improve_armour(object *op, object *improver, object *armour); 00035 00040 void apply_armour_improver(object *op, object *tmp) 00041 { 00042 object *armor; 00043 00044 if (blocks_magic(op->map, op->x, op->y)) 00045 { 00046 new_draw_info(0, COLOR_WHITE, op, "Something blocks the magic of the scroll."); 00047 return; 00048 } 00049 00050 armor = find_marked_object(op); 00051 if (!armor) 00052 { 00053 new_draw_info(0, COLOR_WHITE, op, "You need to mark an armor object."); 00054 return; 00055 } 00056 00057 if (armor->type != ARMOUR && armor->type != CLOAK && armor->type != BOOTS && armor->type != GLOVES && armor->type != BRACERS && armor->type != SHIELD && armor->type != HELMET) 00058 { 00059 new_draw_info(0, COLOR_WHITE, op, "Your marked item is not armour!\n"); 00060 return; 00061 } 00062 00063 new_draw_info(0, COLOR_WHITE, op, "Applying armour enchantment."); 00064 improve_armour(op, tmp, armor); 00065 } 00066 00072 static void improve_armour(object *op, object *improver, object *armour) 00073 { 00074 int new_armour = armour->protection[ATNR_IMPACT] + armour->protection[ATNR_IMPACT] / 25 + op->level / 20 + 1; 00075 00076 if (new_armour > 90) 00077 { 00078 new_armour = 90; 00079 } 00080 00081 if (armour->magic >= (op->level / 10 + 1) || new_armour > op->level) 00082 { 00083 new_draw_info(0, COLOR_WHITE, op, "You are not yet powerful enough to improve this armour."); 00084 return; 00085 } 00086 00087 if (new_armour > armour->protection[ATNR_IMPACT]) 00088 { 00089 armour->protection[ATNR_IMPACT] = new_armour; 00090 armour->weight += (unsigned long) ((double) armour->weight * (double) 0.05); 00091 } 00092 else 00093 { 00094 new_draw_info(0, COLOR_WHITE, op, "The armour value of this equipment cannot be further improved."); 00095 } 00096 00097 armour->magic++; 00098 00099 if (op->type == PLAYER) 00100 { 00101 esrv_send_item(op, armour); 00102 00103 if (QUERY_FLAG(armour, FLAG_APPLIED)) 00104 { 00105 fix_player(op); 00106 } 00107 } 00108 00109 decrease_ob(improver); 00110 }
1.7.4