/*
 * gWeapon.js
 *
 * Copyright (c) 2008 Tyler de Witt (tyler-dewitt.com)
 * Unauthorized reproduction or use of this code is not permitted.
 */

function gWeapon() {
  this.image='torch.jpg';
  this.place="right_hand";
  this.object_type="gWeapon";
  this.state=new Object();
  this.state.mod=0;

  this.wield=function(who) { return true; }

  this.construct=function() {
    this.state.mod=lim(Math.round(roll("3d5-8")/3.5),-2,2);
    var a=roll("1d15");
    if (a >= 14) this.state.cursed=1;
  }

}

gWeapon.prototype=new gItem;
gWeapon_protos = {
  spear: { image: 'm638.jpg', title: 'spear', weapon_type: "polearm", dc: "1d4+1"},
  scythe: { image: 'm471.jpg', title: 'scythe', weapon_type: "polearm", dc: "1d4+1"},

  broom_handle: { image: 'm593.jpg', title: 'broom handle', weapon_type: "staff", dc: "1d3+1"},
  wooden_staff: { image: 'm588.jpg', title: 'wooden staff', weapon_type: "staff", dc: "1d3+1"},

  knife: { image: 'm526.jpg', title: 'knife', weapon_type: "blade", dc: "1d4+1"},
  dagger: { image: 'm530.jpg', title: 'knife', weapon_type: "blade", dc: "1d4+1"},

  short_sword: { image: 'm493.jpg', title: 'short sword', weapon_type: "blade", dc: "1d5+1"},
  long_sword: { image: 'm490.jpg', title: 'long sword', weapon_type: "blade", dc: "1d5+2"},
  broad_sword: { image: 'm500.jpg', title: 'broad sword', weapon_type: "blade", dc: "1d6+2"},
  curved_sword: { image: 'm499.jpg', title: 'curved sword', weapon_type: "blade", dc: "1d5+1"},
  sabre: { image: 'm509.jpg', title: 'sabre', weapon_type: "blade", dc: "1d5+1"},

  club: { image: 'm481.jpg', title: 'club', weapon_type: "club", dc: "1d3+1"},
  stick: { image: 'm603.jpg', title: 'stick', weapon_type: "club", dc: "1d2"},
  mace: { image: 'm517.jpg', title: 'mace', weapon_type: "club", dc: "1d2"},
  hammer: { image: 'm657.jpg', title: 'hammer', weapon_type: "club", dc: "1d2"},
  rod: { image: 'm615.jpg', title: 'metal rod', weapon_type: "club", dc: "1d2"},
  battle_axe: { image: 'm568.jpg', title: 'battle axe', weapon_type: "club", dc: "1d6+2"},

  chain: { image: 'm628.jpg', title: 'chain', weapon_type: "whip", dc: "1d5+1"},
  whip: { image: 'm617.jpg', title: 'whip', weapon_type: "whip", dc: "1d5+1"},
  ball_and_chain: { image: 'm765.jpg', title: 'ball and chain', weapon_type: "whip", dc: "1d5+1"}

};


