/** 每提升10级,需要的钻石数量+10颗,颜色每提升1个等级,则需要1.2倍钻石数量 1 1 2 10 3 45 4 80 5 125 6 180 7 245 8 320 9 405 */
  public static ScriptResult func(Object[] parameters) {
    ScriptResult result = ScriptManager.checkParameters(parameters, 2);
    if (result != null) {
      return result;
    }

    User user = (User) parameters[0];
    PropData propData = (PropData) parameters[1];
    int count = 0;
    WeaponPojo weapon = EquipManager.getInstance().getWeaponById(propData.getItemId());
    if (weapon != null) {
      int userLevel = weapon.getUserLevel();
      if (userLevel == 0) {
        count = 1;
      } else if (userLevel == 10) {
        count = 10;
      } else if (userLevel < 90) {
        count = (userLevel / 10 + 1) * (userLevel / 10 + 1) * 5;
        int colorIndex = propData.getWeaponColor().ordinal();
        if (colorIndex > 0) {
          count = Math.round(count * 1.2f * colorIndex);
        }
      }
    }

    List list = new ArrayList();
    list.add(count);
    result = new ScriptResult();
    result.setType(ScriptResult.Type.SUCCESS_RETURN);
    result.setResult(list);
    return result;
  }
  /**
   * 在每回合开始时,检查战斗用户的状态, 1. 如果用户处于冰冻状态,并且回合数尚未达到解冻条件,则自动蓄力 2. 如果用户处于隐身状态,并且回合数尚未达到显示条件,则继续隐身
   *
   * @param parameters
   * @return
   */
  public static ScriptResult func(Object[] parameters) {
    ScriptResult result = ScriptManager.checkParameters(parameters, 2);
    if (result != null) {
      return result;
    }
    Battle battle = (Battle) parameters[0];
    BattleUser battleUser = (BattleUser) parameters[1];

    checkBattle(battle, battleUser);

    result = new ScriptResult();
    result.setType(ScriptResult.Type.SUCCESS);
    result.setResult(null);
    return result;
  }
  public static ScriptResult func(Object[] parameters) {
    ScriptResult result = ScriptManager.checkParameters(parameters, 2);
    if (result != null) {
      return result;
    }

    User user = (User) parameters[0];
    int slot = (Integer) parameters[1];

    ArrayList rewards = new ArrayList(slot * 2);

    result = new ScriptResult();
    result.setType(ScriptResult.Type.SUCCESS_RETURN);
    result.setResult(rewards);
    return result;
  }
  public static ScriptResult func(Object[] parameters) {
    ScriptResult result = ScriptManager.checkParameters(parameters, 1);
    if (result != null) {
      return result;
    }
    try {
      BattleUser roundOwner = findRoundOwner(parameters);

      ArrayList list = new ArrayList();
      list.add(roundOwner);

      result = new ScriptResult();
      result.setResult(list);
      result.setType(Type.SUCCESS_RETURN);

      return result;
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return null;
  }
  public static ScriptResult func(Object[] parameters) {
    ScriptResult result = ScriptManager.checkParameters(parameters, 3);
    if (result != null) {
      return result;
    }
    User user = (User) parameters[0];
    TaskPojo task = (TaskPojo) parameters[1];
    TaskHook hook = (TaskHook) parameters[2];
    if (hook == TaskHook.WEIBO) {
      Object[] array = (Object[]) parameters[3];
      WeiboOpType weiboType = (WeiboOpType) array[0];

      if (weiboType == WeiboOpType.COMBAT) {
        TaskStep.step(task, user);
      }
    }

    result = new ScriptResult();
    result.setType(ScriptResult.Type.SUCCESS);
    result.setResult(null);
    return result;
  }