|
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 00030 #include <global.h> 00031 00036 void apply_scroll(object *op, object *tmp) 00037 { 00038 int scroll_spell = tmp->stats.sp, old_spell = 0; 00039 rangetype old_shoot = range_none; 00040 00041 if (QUERY_FLAG(op, FLAG_BLIND) && !QUERY_FLAG(op, FLAG_WIZ)) 00042 { 00043 new_draw_info(0, COLOR_WHITE, op, "You are unable to read while blind."); 00044 return; 00045 } 00046 00047 if (!QUERY_FLAG(tmp, FLAG_IDENTIFIED)) 00048 { 00049 identify(tmp); 00050 } 00051 00052 if (scroll_spell < 0 || scroll_spell >= NROFREALSPELLS) 00053 { 00054 new_draw_info(0, COLOR_WHITE, op, "The scroll just doesn't make sense!"); 00055 return; 00056 } 00057 00058 if (op->type == PLAYER) 00059 { 00060 /* players need a literacy skill to read stuff! */ 00061 if (!change_skill(op, SK_LITERACY)) 00062 { 00063 new_draw_info(0, COLOR_WHITE, op, "You are unable to decipher the strange symbols."); 00064 return; 00065 } 00066 00067 /* that's new: literacy for reading but a player need also the 00068 * right spellcasting spell. Reason: the exp goes then in that 00069 * skill. This makes scroll different from wands or potions. */ 00070 if (!change_skill(op, (spells[scroll_spell].type == SPELL_TYPE_PRIEST ? SK_PRAYING : SK_SPELL_CASTING))) 00071 { 00072 new_draw_info(0, COLOR_WHITE, op, "You can read the scroll but you don't understand it."); 00073 return; 00074 } 00075 00076 /* Now, call here so the right skill is readied -- literacy 00077 * isn't necessarily connected to the exp obj to which the xp 00078 * will go (for kills made by the magic of the scroll) */ 00079 old_shoot = CONTR(op)->shoottype; 00080 old_spell = CONTR(op)->chosen_spell; 00081 CONTR(op)->shoottype = range_scroll; 00082 CONTR(op)->chosen_spell = scroll_spell; 00083 CONTR(op)->stat_scrolls_used++; 00084 } 00085 00086 new_draw_info_format(0, COLOR_WHITE, op, "The scroll of %s turns to dust.", spells[tmp->stats.sp].name); 00087 00088 cast_spell(op, tmp, op->facing ? op->facing : 4, scroll_spell, 0, CAST_SCROLL, NULL); 00089 decrease_ob(tmp); 00090 00091 if (op->type == PLAYER) 00092 { 00093 CONTR(op)->shoottype = old_shoot; 00094 CONTR(op)->chosen_spell = old_spell; 00095 } 00096 }
1.7.4