import java.awt.*;
import java.applet.*;
import Texas.*;

public class GunFight extends Applet {
	
  Font font = new Font("Modern",1,14);
  Color color = new Color(10,100,100);
	
  WesternTown Kiriat4;
  Evil moris;
  Humans maryloo;
  Horse horse;	
  Horse horse1;
	
  public void init() {
  Kiriat4 = new WesternTown() ;
    Kiriat4.setSaloons(2);
    Kiriat4.setTroubleMakers(5);
    Kiriat4.setSheriffs(1);
  Humans rabbi = new Humans() ;
    moris = new Evil() ;
    moris.setHatColor("black");
    moris.setSex("Male");
    moris.setWhiskeyPreference("Jack Daniel with milk");
    moris.setMustachColor("red");
    moris.setHorseName("Eliyaho");
  maryloo = new Humans() ;
    maryloo.setSex("Female");
    maryloo.setWhiskeyPreference("Cocktail");
    maryloo.setHorseName("Brave");
    maryloo.setName("Mary");
  horse = new Horse() ;
    horse.setAge(4);
    horse.setName("Hoysa");
    try {
      horse.setLegs(4);
    }
  catch(Exception e) {}
  horse1 = new Horse();
    horse1.setName("notHoysa");
    try {
      horse1.setLegs(4);
    }
    catch(Exception e) {}
  }

  public void paint(Graphics g) {
    g.setFont(font);
    g.setColor(color);
	
    try {
      g.drawString("moris tries to drink whiskey...",10,15);
      moris.drinkWhiskey();
      g.drawString("moris drunkness level is now "+moris.howDrunkAmI(),10,30);
    }
    catch(Exception e1) {
      g.drawString("Exception!  "+e1.getMessage(),10,30);
    }
		
    g.drawString(moris.tieUpDamsel(maryloo),10,60);

    try {
      g.drawString("moris tries to drink whiskey...",10,90);
      moris.drinkWhiskey();
      g.drawString("moris drunkness level is now "+moris.howDrunkAmI(),10,105);
    }
    catch(Exception e1) {
      g.drawString("Exception!  "+e1.getMessage(),10,105);
    }		
		
    try {
      g.drawString("moris tries to shoot a horse...",10,135);
//trying to execute the function with Hoysa
      g.drawString(moris.shootHorse(horse),10,150);
    }
    catch(Exception e2) {
      g.drawString("Exception!  "+e2.getMessage(),10,150);
    }
		
    g.drawString(horse.whatIsYourName()+" :",10,180);
    
    if(horse.howManyLegs()>0) {
      g.drawString("has "+horse.howManyLegs()+" legs left",20,195);
    }
    else {
      g.drawString("is DEAD  :-(",20,195);
    }
  }
}
