Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/LumberJack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import java.util.List;

/**
* Created by Sophie on 12/6/2016.
*/
public class LumberJack extends Character{
private String flannelColor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want extra credit, you could add some more fields


public LumberJack(String name, String flannelColor ){
super(name);
this.flannelColor = flannelColor;
}

public void attack(Character other) {
double damage = other.getHealth()*Math.random();
other.health -= damage;
}

public void describeSelf(){
System.out.println("My name is" + this.getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of character are you? What color is your flannel?

System.out.println ("What did the lumberjack say about the mathematician who couldn’t dance?\n-Man, that guy needs to get some logarithm.”");
}

public String getPrimaryWeapon() {
return "axe";
}

public int pickTarget(List<Character> potentialTargets){
int mostHealth = 0;
int index= 0;


for(int i=0; i< potentialTargets.size(); i++){
if (potentialTargets.get(i).getHealth() > mostHealth && this != potentialTargets.get(i)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you format this file using Ctrl+Alt+L?

mostHealth = potentialTargets.get(i).getHealth();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have potentialTargets.get(i) 3 times. Can you put this in a variable and use it?

index = i;
}
}
return index;

}


}