コード例 #1
0
  /**
   * Used when socketing of equipped item
   *
   * @param item
   * @param stone
   * @param cgs
   */
  public static void addStoneStats(Item item, ManaStone stone, CreatureGameStats<?> cgs) {
    List<StatFunction> modifiers = stone.getModifiers();
    if (modifiers == null) {
      return;
    }

    cgs.addEffect(stone, modifiers);
  }
コード例 #2
0
  /**
   * All modifiers of stones will be removed
   *
   * @param itemStones
   * @param cgs
   */
  public static void removeStoneStats(
      Set<? extends ManaStone> itemStones, CreatureGameStats<?> cgs) {
    if (itemStones == null || itemStones.size() == 0) return;

    for (ManaStone stone : itemStones) {
      List<StatFunction> modifiers = stone.getModifiers();
      if (modifiers != null) {
        cgs.endEffect(stone);
      }
    }
  }
コード例 #3
0
  /**
   * @param itemTemplate
   * @param slot
   * @param cgs
   */
  private static void onItemEquipment(Item item, CreatureGameStats<?> cgs) {
    ItemTemplate itemTemplate = item.getItemTemplate();
    long slot = item.getEquipmentSlot();
    List<StatFunction> modifiers = itemTemplate.getModifiers();
    if (modifiers == null) {
      return;
    }

    List<StatFunction> allModifiers = null;

    if ((slot & ItemSlot.MAIN_OR_SUB.getSlotIdMask()) != 0) {
      allModifiers = wrapModifiers(item, modifiers);
      if (item.hasFusionedItem()) {
        // add all bonus modifiers according to rules
        ItemTemplate fusionedItemTemplate = item.getFusionedItemTemplate();
        WeaponType weaponType = fusionedItemTemplate.getWeaponType();
        List<StatFunction> fusionedItemModifiers = fusionedItemTemplate.getModifiers();
        if (fusionedItemModifiers != null) {
          allModifiers.addAll(wrapModifiers(item, fusionedItemModifiers));
        }
        // add 10% of Magic Boost and Attack
        WeaponStats weaponStats = fusionedItemTemplate.getWeaponStats();
        if (weaponStats != null) {
          int boostMagicalSkill = Math.round(0.1f * weaponStats.getBoostMagicalSkill());
          int attack = Math.round(0.1f * weaponStats.getMeanDamage());
          if (weaponType == WeaponType.ORB_2H
              || weaponType == WeaponType.BOOK_2H
              || weaponType == WeaponType.GUN_1H
              || weaponType == WeaponType.KEYBLADE_2H
              || weaponType == WeaponType.CANNON_2H
              || weaponType == WeaponType.HARP_2H) {
            allModifiers.add(new StatAddFunction(StatEnum.MAGICAL_ATTACK, attack, false));
            allModifiers.add(
                new StatAddFunction(StatEnum.BOOST_MAGICAL_SKILL, boostMagicalSkill, false));
          } else allModifiers.add(new StatAddFunction(StatEnum.PHYSICAL_ATTACK, attack, false));
        }
      }
    } else {
      WeaponStats weaponStat = itemTemplate.getWeaponStats();
      if (weaponStat != null) {
        allModifiers = wrapModifiersW(item, modifiers);
      } else allModifiers = modifiers;
    }

    item.setCurrentModifiers(allModifiers);
    cgs.addEffect(item, allModifiers);
  }