-
Notifications
You must be signed in to change notification settings - Fork 0
Sophie's Character #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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; | ||
|
|
||
| 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()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)){ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have |
||
| index = i; | ||
| } | ||
| } | ||
| return index; | ||
|
|
||
| } | ||
|
|
||
|
|
||
| } | ||
There was a problem hiding this comment.
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