1 /*
2 This file is part of "Avanor, the Land of Mystery" roguelike game
3 Home page: http://www.avanor.com/
4 Copyright (C) 2000-2003 Vadim Gaidukevich
5 
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 #include "xshield.h"
22 
23 REGISTER_CLASS(XShield);
24 
25 _MAIN_ITEM_STRUCT SHIELD_STRUCT[] =
26 {
27 
28 {IT_SMALLSHIELD,"small shield",	')',	"1d2",	"1d2-1",	"",		"1d2",	"",	"",		ISET_SHIELD, 	3,		3},
29 {IT_MEDIUMSHIELD,"medium shield",')',	"1d3",	"1d2-1",	"",		"1d3",	"",	"",		ISET_SHIELD, 	5,		5},
30 {IT_LARGESHIELD,"large shield",	')',	"1d4",	"1d2-1",	"",		"1d4",	"",	"",		ISET_SHIELD, 	10,		8},
31 {IT_TOWERSHIELD,"tower shield",	')',	"1d6",	"1d2-1",	"",		"1d4",	"",	"",		ISET_SHIELD, 	15,		15}
32 };
33 const int r_size = 4;
34 
35 
XShield(ITEM_TYPE _it)36 XShield::XShield(ITEM_TYPE _it)
37 {
38 	im = IM_SHIELD;
39 	BasicFill(_it, SHIELD_STRUCT, r_size);
40 	_PV = 0;
41 	bp = BP_HAND;
42 	RNG = 0;
43 	wt = WSK_SHIELD;
44 	dice.Z = 0;
45 	_HIT = 0;
46 }
47 
toString(char * buf)48 void XShield::toString(char * buf)
49 {
50 
51 /*  if (quantity == 1)
52 		sprintf(buf, "%s ", name);
53     else
54         sprintf(buf, "heap of (%d) %ss ", quantity, name);
55 */
56 	GetFullName(buf);
57     char tbuf[256];
58 
59 	sprintf(tbuf, "[%+d, %+d]", _DV, _PV);
60 	strcat(buf, tbuf);
61 
62     StatsToString(tbuf);
63     strcat(buf, tbuf);
64 }
65 
66