Init
This commit is contained in:
29
Hero.java
Normal file
29
Hero.java
Normal file
@@ -0,0 +1,29 @@
|
||||
public class Hero {
|
||||
private String name;
|
||||
private int strength;
|
||||
private LinkedList weaponInventory;
|
||||
private Weapon currentWeapon;
|
||||
|
||||
public Hero(String name, int strength) {
|
||||
this.name = name;
|
||||
this.strength = strength;
|
||||
}
|
||||
|
||||
public LinkedList getWeaponInventory() {
|
||||
return weaponInventory;
|
||||
}
|
||||
|
||||
public void addWeapon(Weapon weapon) {
|
||||
weaponInventory.append(weapon);
|
||||
}
|
||||
|
||||
public void chooseWeapon(weapon) {
|
||||
weaponInventory.toFirst();
|
||||
while(weaponInventory.hasAccess() && weaponInventory.getCurrentContent() != weapon) {
|
||||
weaponInventory.toNext();
|
||||
}
|
||||
if (weaponInventory.hasAccess()) {
|
||||
currentWeapon = weaponInventory.getCurrentContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user