Develop #1
@@ -15,6 +15,8 @@ import java.util.Hashtable;
|
||||
public class DisplayItem {
|
||||
public static void DisplayItems(ArrayList<Item> items) {
|
||||
for (Item item : items) {
|
||||
if (item == null) continue;
|
||||
|
||||
String result = item.getName();
|
||||
|
||||
if (item instanceof SellableItem) {
|
||||
@@ -30,7 +32,7 @@ public class DisplayItem {
|
||||
}
|
||||
|
||||
if (item instanceof IDefender) {
|
||||
result += "\n Damage = " + ((IDefender) item).GetDefense();
|
||||
result += "\n Defence = " + ((IDefender) item).GetDefense();
|
||||
}
|
||||
|
||||
System.out.println(result);
|
||||
@@ -42,6 +44,8 @@ public class DisplayItem {
|
||||
Dictionary<Integer, Item> dictionary = new Hashtable<>();
|
||||
|
||||
for (Item item : items) {
|
||||
if (item == null) continue;
|
||||
|
||||
String result = index + " > " + item.getName();
|
||||
|
||||
if (item instanceof KeyItem) {
|
||||
@@ -61,7 +65,7 @@ public class DisplayItem {
|
||||
}
|
||||
|
||||
if (item instanceof IDefender) {
|
||||
result += "\n Damage = " + ((IDefender) item).GetDefense();
|
||||
result += "\n Defence = " + ((IDefender) item).GetDefense();
|
||||
}
|
||||
|
||||
dictionary.put(index, item);
|
||||
|
||||
Reference in New Issue
Block a user