Esempio n. 1
0
  /**
   * get EquipementClass object from ID
   *
   * @param myID
   * @param eList
   * @return
   */
  public static EquipmentClass getEquipmentByID(String myID, EquipmentList eList) {
    EquipmentClass oFound = null;

    for (EquipmentClass o : eList.getContent())
      if (o.getMyID().equalsIgnoreCase(myID)) {
        oFound = o;
        break;
      }

    return (oFound);
  }
Esempio n. 2
0
  /**
   * returns a brand new copy of itself
   *
   * @return
   */
  public EquipmentClass clone() {
    EquipmentClass oNew = new EquipmentClass();
    // TODO

    oNew.name = name;
    oNew.description = description;
    oNew.count = count;
    oNew.type = type;
    oNew.magic = magic;
    oNew.charges = charges;
    oNew.chargesMax = chargesMax;
    oNew.equipped = equipped;
    oNew.contains = contains;
    oNew.weight = weight;
    oNew.weaponType = weaponType;
    oNew.weaponGroupType = weaponGroupType;
    oNew.weaponTightGroupType = weaponTightGroupType;
    oNew.weaponProfType = weaponProfType;
    oNew.damageSmall = damageSmall;
    oNew.damageMedium = damageMedium;
    oNew.damageLarge = damageLarge;
    oNew.armorType = armorType;
    oNew.armorBulkType = armorBulkType;
    oNew.ac = ac;
    oNew.acBase = acBase;
    oNew.magicAdjustmentPrimary = magicAdjustmentPrimary;
    oNew.magicAdjustmentSecondary = magicAdjustmentSecondary;
    oNew.experience = experience;
    oNew.speedFactor = speedFactor;

    for (int i = 0; i < MAX_COIN; i++) oNew.getValue()[i] = getValue()[i];

    if (range == null) range = new int[MAX_RANGES];
    for (int i = 0; i < MAX_RANGES; i++) oNew.getRange()[i] = getRange()[i];

    for (String sType : getFeatures()) oNew.getFeatures().add(sType);

    // oNew.setContains(new ArrayList<EquipmentClass>());
    if (getContains() != null)
      for (EquipmentClass oS : getContains()) oNew.getContains().add(oS.clone());

    if (attacksPerRound == null) attacksPerRound = new int[2];
    oNew.attacksPerRound[0] = getAttacksPerRound()[0];
    oNew.attacksPerRound[1] = getAttacksPerRound()[1];

    oNew.source = source;

    oNew.setMyID(getMyID());
    return (oNew);
  }