Пример #1
0
 @Override
 public void generateItem() {
   if (specificChestMap == null)
     specificChestMap =
         new HashMap<ItemDegree, Map<ItemDegreeQualifier, Map<Integer, WondrousChestItem>>>();
   Map<ItemDegreeQualifier, Map<Integer, WondrousChestItem>> specificChestMapByDegree =
       specificChestMap.get(itemDegree);
   if (specificChestMapByDegree == null) {
     specificChestMapByDegree =
         new HashMap<ItemDegreeQualifier, Map<Integer, WondrousChestItem>>();
     specificChestMap.put(itemDegree, specificChestMapByDegree);
   }
   Map<Integer, WondrousChestItem> specificChestMapByDegreeAndQualifier =
       specificChestMapByDegree.get(itemDegreeQualifier);
   if (specificChestMapByDegreeAndQualifier == null) {
     specificChestMapByDegreeAndQualifier = new LinkedHashMap<Integer, WondrousChestItem>();
     populateSpecificchestMap(
         specificChestMapByDegreeAndQualifier, itemDegree, itemDegreeQualifier);
     specificChestMapByDegree.put(itemDegreeQualifier, specificChestMapByDegreeAndQualifier);
   }
   WondrousChestItem chestItem = ItemsForSale.getRandomThing(specificChestMapByDegreeAndQualifier);
   this.itemName = chestItem.itemName();
   this.itemPrice = chestItem.itemPrice();
   this.leafItem = true;
 }
Пример #2
0
 @Override
 public Item copyItem() {
   WondrousChestItem itemCopy = new WondrousChestItem(itemDegree, itemDegreeQualifier);
   itemCopy.leafItem = leafItem;
   return itemCopy;
 }