/**************************************************************
 * FFTacticsMUD : obj.h                                       *
 **************************************************************
 * (c) 2002 Damien Dailidenas (Trenton). All rights reserved. *
 **************************************************************/

#include "shop.h"

#define OBJ_WEAPON      0
#define OBJ_HEAD        1
#define OBJ_BODY        2
#define OBJ_ACC         3
#define OBJ_ITEM        4
#define OBJ_SHIELD      5

#define LOC_RHAND       0
#define LOC_LHAND       1
#define LOC_HEAD        2
#define LOC_BODY        3
#define LOC_ACC         4

#define TYPE_KNIFE              2 
#define TYPE_SWORD              3 
#define TYPE_KNIGHT_SWORD       4 
#define TYPE_NINJA_SWORD        5 
#define TYPE_KATANA             6 
#define TYPE_STAFF              7 
#define TYPE_ROD                8 
#define TYPE_CROSSBOW           9
#define TYPE_BOW                10
#define TYPE_GUN                11
#define TYPE_GUNM               12
#define TYPE_FLAIL              13
#define TYPE_AXE                14
#define TYPE_STICK              15
#define TYPE_SPEAR              16
#define TYPE_INSTRUMENT         17
#define TYPE_DICTIONARY         18
#define TYPE_CLOTH              19
#define TYPE_BAG                20
#define TYPE_POTION             21
#define TYPE_HELMET             22
#define TYPE_HAT                23
#define TYPE_WRIBBON            24
#define TYPE_ARMOR              25
#define TYPE_ROBE               26
#define TYPE_CLOTHES            27
#define TYPE_SHOES              28
#define TYPE_SHIELD             29
#define TYPE_RING               30
#define TYPE_ARMLET             31
#define TYPE_MANTLE             32
#define TYPE_RIBBON             33
#define TYPE_GAUNTLET           34
#define TYPE_PERFUME            35

#define ELEM_WIND       (A)
#define ELEM_LIGHTNING  (B)
#define ELEM_ICE        (C)
#define ELEM_FIRE       (D)
#define ELEM_WATER      (E)
#define ELEM_DARK       (F)
#define ELEM_HOLY       (G)
#define ELEM_EARTH      (H)

struct obj_type {
  char *name;
  short obj_type, type, cost, HP, MP, ATm, ATp, pEv, mEv, Sp, Mv, Ju;
  STATUSTYPE *add, *always[5], *cancel[20];
  DO_ACT *action;
  long elem, absorb, half, weakness, strengthen, imm;
  short range;
  bool drain;
};

struct obj_types {
  short type;
  char *name;
};

extern const struct obj_type obj_table[];
extern const struct obj_types obj_type_table[];

class OBJ {
public:
  OBJ *next;
  CH *ch;
  BATTLE_ROOM *room;
  short id, loc;
  bool equipped;

  OBJ(const short id);
  ~OBJ();

  void to(CH *ch);
  void from_ch();
  void to(BATTLE_ROOM *room);
  void from_battle_room();

  string name();
  string str_type();

  short type();
  short cost();
  short value();
};