package mug10; import java.util.Random; public class Maniac extends Person { Person victim; /* Person mook1 = new Person("Male", "Computer Science"); Person mook2 = new Person("Female", "English"); Person mook3 = new Person("Female", "Economics"); */ //In order for Maniac to function it will need to be passed an array from the world group telling the maniac //what people are in a room. public Maniac(String _sex, String _major) { super(_sex, _major); //this.sex = _sex; //this.major = _major; } public void doSomething() { if (this.victim != null) attack(this.victim); if (Math.random() < 0.1) { // Pick a person to attack this.victim = ... world.actionPerformed(new Action("shout", "I'm going to bash " + this.victim)); } } // public String attackrandomly(Object[] people) { Random num = new Random(); String assault = "attack"; Maniac crazy = new Maniac("Male", "None"); int index = num.nextInt(people.length) - 1; // assuming there is an index of people this will pick one of them at random Object target = people[index]; if (people == null) { return "maniac sits quietly in the corner"; } else { return crazy.combat(assault, target); } //"attack" will be another verb decided on by the world group once we find out what kind of //combat can be initiated }//attackrandomly }//class Maniac