var weapons = {
	"Fist" : { atk : 0, image : null },
	"Large Stick" : { atk : 3, image : "largeStick", cost: 8 },
	"Wood Sword" : { atk : 7, image : null, cost : 10},
	"Iron Sword" : { atk : 10, image : null, cost : 90},
	"Pistol" : { atk : 2, image : "pistol", cost : 8 },
	"Shotgun" : { atk : 10, image : "shotgun", cost : 150 },
	"Cannon" : { atk : 18, image : "cannon", cost : 250 }
};

var armor = {
	"Cloth Shirt" : { grd : 0 },
	"Guard Armor" : { grd : 5, cost : 20 },
	"Soldier Armor" : { grd : 10, cost : 100 },
	"Elite Armor" : { grd : 20, cost : 200}
}

var items = {
	"Key Card" : {
		description : "Unlocks the main door",
		onUse : function() {
			alert("You can't use that");
		},
		cost : 0
	},
	"Battery" : {
		description : "Place in sockets",
		onUse : function() {
			alert("You can't use that");
		},
		cost : 0
	},
	"Small Medkit" : {
		description : "Heals 15 HP",
		onUse : function() {
			if(vars.hp == vars.maxHP) {
				alert("You're already at full health");
			} else {
				setPlayerHealth(vars.hp + 15);
				alert("Healed 15 HP");
				vars.items["Small Medkit"]--;
			}
		},
		cost : 10
	},
	"Large Medkit" : {
		description : "Heals 30 HP",
		onUse : function() {
			if(vars.hp == vars.maxHP) {
				alert("You're already at full health");
			} else {
				setPlayerHealth(vars.hp + 30);
				alert("Restored 30 HP");
				vars.items["Large Medkit"]--;
			}
		},
		cost : 15
	},
	"Herb" : {
		description : "Cures Poison",
		onUse : function() {
			if(!vars.poisoned) {
				alert("You're not poisoned");
			} else {
				vars.poisoned = false;
				alert("Poison cured");
				vars.items.Herb--;
			}
		},
		cost : 2
	},
	"Potion" : {
		description : "Restores 20 HP",
		onUse : function() {
			setPlayerHealth(vars.hp + 20);
			alert("Restored 20 HP");
			vars.items.Potion--;
		},
		cost : 2
	},
	"Rat Dropping" : {
		description : "Very smelly",
		onUse : function() {
			alert("You grip Rat Dropping tightly!");
			alert("You deeply regret what you just did ...");
		},
		cost : 2
	}
}

function giveWeapon(name) {
	if(!vars.equipment[name]) {
		vars.equipment[name] = 0;
	}
	vars.equipment[name]++;
}

function giveArmor(name) {
	if(!vars.armorList[name]) {
		vars.armorList[name] = 0;
	}
	vars.armorList[name]++;
}

function giveItem(name) {
	if(!vars.items[name]) {
		vars.items[name] = 0;
	}
	vars.items[name]++;
}
