enhance display method

This commit is contained in:
2026-07-16 16:59:56 +03:30
parent 76baf0f2cf
commit dc963742aa
@@ -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);