示例#1
0
  @Override
  public boolean complete(Building building) throws SignException {

    super.complete(building);

    if (stored == null) {
      SagaLogger.nullField(this, "stored");
      stored = 0.0;
    }

    if (maxStored == null) {
      SagaLogger.nullField(this, "maxStored");
      maxStored = 0.0;
    }

    initialiseFields();

    return true;
  }
  /**
   * Completes.
   *
   * @return integrity check
   */
  public boolean complete() {

    boolean integrity = true;

    // Set instance:
    instance = this;

    // Attributes and abilities:
    if (attributePointCost == null) {
      SagaLogger.nullField(getClass(), "attributePointCost");
      attributePointCost = 500.0;
    }

    if (abilityPointCost == null) {
      SagaLogger.nullField(getClass(), "abilityPointCost");
      abilityPointCost = 500.0;
    }

    // Experience gain:
    if (maxExp == null) {
      maxExp = 10000000000.0;
      SagaLogger.nullField(getClass(), "maxExp");
      integrity = false;
    }

    if (expGainMultiplier == null) {
      expGainMultiplier = new TwoPointFunction(1.0);
      SagaLogger.nullField(getClass(), "expGainMultiplier");
      integrity = false;
    }

    if (blockExp == null) {
      blockExp = new Hashtable<Material, Hashtable<Byte, Double>>();
      SagaLogger.nullField(getClass(), "blockExp");
      integrity = false;
    }

    if (playerExp == null) {
      playerExp = new TwoPointFunction(0.0);
      SagaLogger.nullField(getClass(), "playerExp");
      integrity = false;
    }

    if (creatureExp == null) {
      creatureExp = new Hashtable<String, Double>();
      SagaLogger.nullField(getClass(), "creatureExp");
      integrity = false;
    }

    if (abilityExp == null) {
      abilityExp = new Hashtable<String, TwoPointFunction>();
      SagaLogger.nullField(getClass(), "abilityExp");
      integrity = false;
    }
    Collection<TwoPointFunction> abExpVals = abilityExp.values();
    for (TwoPointFunction abExpVal : abExpVals) {
      abExpVal.complete();
    }

    if (spawnerEncPointMult == null) {
      spawnerEncPointMult = 1.0;
      SagaLogger.nullField(this, "spawnerEncPointMult");
      integrity = false;
    }

    if (spawnerExpMult == null) {
      spawnerExpMult = 1.0;
      SagaLogger.nullField(this, "spawnerExpMult");
      integrity = false;
    }

    return integrity;
  }