コード例 #1
0
ファイル: Entity.java プロジェクト: infinity8/Roguelike
  // ----------------------------------------------------------------------
  protected void calculateVariableMap() {
    variableMap.clear();

    for (Statistic s : Statistic.values()) {
      variableMap.put(s.toString().toLowerCase(), statistics.get(s));
    }

    for (GameEventHandler handler : getAllHandlers()) {
      for (Statistic s : Statistic.values()) {
        String key = s.toString().toLowerCase();
        variableMap.put(key, variableMap.get(key) + handler.getStatistic(baseVariableMap, s));
      }
    }

    variableMap.put("hp", HP);

    for (EquipmentSlot slot : EquipmentSlot.values()) {
      Item equipped = inventory.getEquip(slot);
      if (equipped != null && equipped.type != null) {
        variableMap.put(equipped.type, 1);
      }
    }

    for (StatusEffectStack s : stacks) {
      variableMap.put(s.effect.name.toLowerCase(), s.count);
    }

    for (Statistic s : Statistic.values()) {
      variableMap.put(s.toString().toLowerCase(), getStatistic(s));
    }

    variableMap.put("maxhp", variableMap.get(Statistic.CONSTITUTION.toString().toLowerCase()) * 10);

    if (inventory.getEquip(EquipmentSlot.WEAPON) != null) {
      Item wep = inventory.getEquip(EquipmentSlot.WEAPON);

      int atk =
          Global.calculateScaledAttack(
              Statistic.statsBlockToVariableBlock(wep.getStatistics(variableMap)), variableMap);

      String key = Statistic.ATTACK.toString().toLowerCase();
      variableMap.put(key, variableMap.get(key) + atk);
    }
  }
コード例 #2
0
ファイル: Entity.java プロジェクト: infinity8/Roguelike
  // ----------------------------------------------------------------------
  protected void calculateBaseVariableMap() {
    baseVariableMap.clear();

    for (Statistic s : Statistic.values()) {
      baseVariableMap.put(
          s.toString().toLowerCase(),
          statistics.get(s) + inventory.getStatistic(Statistic.emptyMap, s));
    }

    baseVariableMap.put(
        "maxhp", baseVariableMap.get(Statistic.CONSTITUTION.toString().toLowerCase()) * 10);
    baseVariableMap.put("hp", HP);

    for (EquipmentSlot slot : EquipmentSlot.values()) {
      Item equipped = inventory.getEquip(slot);
      if (equipped != null && equipped.type != null) {
        baseVariableMap.put(equipped.type, 1);
      }
    }

    for (StatusEffectStack s : stacks) {
      baseVariableMap.put(s.effect.name.toLowerCase(), s.count);
    }
  }