示例#1
0
  public int getIntegrity() {
    ServerArmorTemplate base = null;

    if (baseData instanceof ServerArmorTemplate) base = (ServerArmorTemplate) baseData;

    if (!integrity.isLoaded()) {
      if (base == null) {
        return 0;
      } else {
        return base.getIntegrity();
      }
    }

    int value = this.integrity.getValue();
    final byte delta = this.integrity.getDeltaType();

    if (delta == '+' || delta == '-' || delta == '_' || delta == '=') {
      int baseValue = 0;

      if (baseData != null) {
        if (base != null) baseValue = base.getIntegrity();
      }

      if (delta == '+') value = baseValue + value;
      if (delta == '-') value = baseValue - value;
      if (delta == '=') value = baseValue + (int) (baseValue * (value / 100.0f));
      if (delta == '_') value = baseValue - (int) (baseValue * (value / 100.0f));
    }
    return value;
  }
示例#2
0
  public int getEncumbranceMax(int index) {
    ServerArmorTemplate base = null;

    if (baseData instanceof ServerArmorTemplate) base = (ServerArmorTemplate) baseData;

    if (!encumbrance[index].isLoaded()) {
      if (base == null) {
        return 0;
      } else {
        return base.getEncumbranceMax(index);
      }
    }

    int value = this.encumbrance[index].getMaxValue();
    final byte delta = this.encumbrance[index].getDeltaType();

    if (delta == '+' || delta == '-' || delta == '_' || delta == '=') {
      int baseValue = 0;

      if (baseData != null) {
        if (base != null) baseValue = base.getEncumbranceMax(index);
      }

      if (delta == '+') value = baseValue + value;
      if (delta == '-') value = baseValue - value;
      if (delta == '=') value = baseValue + (int) (baseValue * (value / 100.0f));
      if (delta == '_') value = baseValue - (int) (baseValue * (value / 100.0f));
    }
    return value;
  }
示例#3
0
  public SpecialProtection getSpecialProtectionMax(int index) {
    ServerArmorTemplate base = null;

    if (baseData instanceof ServerArmorTemplate) base = (ServerArmorTemplate) baseData;

    if (!specialProtectionLoaded) {
      if (base == null) {
        return null;
      } else {
        return base.getSpecialProtectionMax(index);
      }
    }

    if (specialProtectionAppend && base != null) {
      int baseCount = base.getSpecialProtectionCount();

      if (index < baseCount) {
        return base.getSpecialProtectionMax(index);
      }
      index -= baseCount;
    }
    final ObjectTemplate structTemplate = specialProtection.get(index).getValue();
    Preconditions.checkNotNull(structTemplate);
    final SpecialProtectionObjectTemplate param = (SpecialProtectionObjectTemplate) structTemplate;

    final SpecialProtection data = new SpecialProtection();
    data.type = param.getType();
    data.effectiveness = param.getEffectivenessMax();

    return data;
  }
示例#4
0
  public ArmorRating getRating() {
    ServerArmorTemplate base = null;

    if (baseData instanceof ServerArmorTemplate) base = (ServerArmorTemplate) baseData;

    if (!rating.isLoaded()) {
      if (base == null) {
        return ArmorRating.from(0);
      } else {
        return base.getRating();
      }
    }

    return ArmorRating.from(rating.getValue());
  }
示例#5
0
  public int getSpecialProtectionCount() {
    if (!specialProtectionLoaded) {
      if (baseData == null) return 0;

      final ServerArmorTemplate base = (ServerArmorTemplate) baseData;
      return base.getSpecialProtectionCount();
    }

    int count = specialProtection.size();

    if (specialProtectionAppend && baseData != null) {
      final ServerArmorTemplate base = (ServerArmorTemplate) baseData;
      count += base.getSpecialProtectionCount();
    }

    return count;
  }