/**
 * Humanoid Class.
 * This is a super class of the player and monster classes
 * This class has the health variable, and a MAX_HEALTH static variable.
 * The health represents the remaining health of the player or monster.
 * The MAX_HEALTH is a default health, if there is no other input.
 * The inventory is a list of the items that the player/monster have.
 * Items can be added or removed from the inventory.
 * 
 */

import java.util.ArrayList;


public class Humanoid {

	private int health;
	private String name;
	private static int MAX_HEALTH = 100;
	private static String NO_NAME_GIVEN = "NO_NAME";
	private ArrayList<Item> inventory;

	
	public Humanoid(int maxHealth, String name){
		health = maxHealth;
		inventory = new ArrayList<Item>();
		this.name = name;
	}
	
	
	public Humanoid(){
		this(MAX_HEALTH, NO_NAME_GIVEN);
	}
	
	public int getHealth(){
		return health;
	}
	
	public void addItem(Item i){
		inventory.add(i);
	}
	
	public ArrayList<Item> getInventory(){
		return inventory;
	}
	
	public boolean removeItem(Item i){
		return inventory.remove(i);
	}
	
	public Item getBestItem(){
		Item tempItem;
		tempItem = inventory.get(0);
		//TODO if inventory is empty
		for(Item i: inventory){
			if(i.getValue()>tempItem.getValue()){
				tempItem = i;
			}
		}
		return tempItem;
	}
	
	public void updateHealth(int h){
		health = health - h;
	}
	
	public boolean equals(Object o){
		if(o instanceof Humanoid){
			return (this.health == ((Humanoid) o).health) && (this.inventory.equals(((Humanoid) o).inventory));
		}
		return false;
	}
}

@@ -1550,10 +1550,57 @@
 lse;%0A%09%7D%0A
+%09%0A%09public String toString()%7B%0A%09%09return name;%0A%09%7D%0A
 %7D%0A

Add toString method to Humanoid.