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

function gArmour() {
  this.image='harp.jpg';
  this.object_type="gArmour";

  //have to initialize objects
  this.state=new Object();
  this.state.mod=0;

  this.wear=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 >= 25) this.state.cursed=1;
  }
}

gArmour.prototype=new gItem;
gArmour_protos = {
  cloak: { image: 'm1096.jpg', place: "body", title: "cloak", ac: 1},
  robes: { image: 'm1017.jpg', place: "body", ac : 1},
  tunic: { image: 'm1024.jpg', place: "body", ac : 1},

  gloves: { image: 'm847.jpg', place: "hands", title: 'pair of gloves', ac: 1},
  boots: { image: 'm937.jpg', title: "pair of boots", place: "feet", ac: 1},
  shoes: { image: 'm938.jpg', title: "pair of shoes", place: "feet", ac: 1},

  buckler: { image: 'm980.jpg', place: "left_hand", ac: 1},
  shield: { image: 'm978.jpg', place: "left_hand", ac: 1},
  helmet: { image: 'm770.jpg', place: "head", ac: 2},
  iron_skullcap: { image: 'm787.jpg', place: "head", ac: 1,title:"iron skullcap"},

  leather_armour: { image: 'm803.jpg', place: "body", title: 'leather armour', armour_type: "mail", ac : 2},
  ring_mail: { image: 'm797.jpg', place: "body", title: 'ring mail', armour_type: "mail", ac : 3},
  plate_mail: { image: 'm792.jpg', place: "body", title: 'plate mail', armour_type: "mail", ac : 8},

  speed_pendant: { image: 'm1036.jpg', place: "neck", title: 'pendent of speed', 
		   onequip: function(who) { who.speed >> 1; }, 
		   onunequip: function(who) { who.speed*=2; } },

  regeneration_ring: { image: 'm1041.jpg', place: "finger", title: 'regeneration ring', 
		      onequip: function(who) { who.hp_regen_rate += 10; },
		      onunequip: function(who) { who.hp_regen_rate -= 10; } }
};
