Ejemplo n.º 1
0
  @Override
  public void handleReceived(LlpMessage msg) {
    // ======数据重置======
    result = 0;
    reason = "挑战成功";

    if (online.getLevel() < 40) {
      result = 1;
      reason = "等级不足40级,不能挑战";
      return;
    }
    if (!online.getMapInfo().getBaseMap().getType().equals(EMapType.common)) {
      result = 1;
      reason = "此地图不能挑战";
      return;
    }
    int currentFloorId = msg.readInt("currentFloorId");

    if (online.isBattle()) {
      result = 1;
      reason = "已战斗";
      return;
    }

    if (online.isPrBattle()) {
      result = 1;
      reason = "已申请战斗";
      return;
    }
    online.setPrBattle(true);

    if (online.getTeam() != null) {
      result = 1;
      reason = "组队状态时不能挑战千层塔";
      return;
    }

    if (currentFloorId > QiancengtaJson.instance().getQiancengtas().size()) {
      result = 1;
      reason = "已经全部挑战完成";
      return;
    }

    if (online.getCurrentFloorId() != currentFloorId) {
      result = 1;
      reason = "不能挑战";
      return;
    }

    QiancengtaInfo qiancengtaInfo =
        QiancengtaJson.instance().getQiancengtaMap().get(currentFloorId);
    MonsterGroup monsterGroup = MonsterJson.instance().getMonsterGroup(qiancengtaInfo.getGroupId());
    battleInfo =
        BattleServer.preBattle(online, monsterGroup, 5, online.getMapInfo().getBaseMap(), false);
    battleInfo.setCurrentFloorId(currentFloorId);
  }
Ejemplo n.º 2
0
  @Override
  public void handleReceived(LlpMessage msg) {

    // ======重置数据======
    result = 0;
    reason = "遇怪成功";

    if (online.isBattle()) {
      result = 1;
      reason = "已战斗";
      return;
    }

    if (online.isPrBattle()) {
      result = 1;
      reason = "已申请战斗";
      return;
    }
    online.setPrBattle(true);
    // ======获取参数======
    int trialsId = msg.readInt("trialsId");
    int position = msg.readInt("position");

    if (online.getTeam() != null) {
      result = 1;
      reason = "组队状态时不能试炼";
      return;
    }

    if (!online.getMapInfo().getBaseMap().getType().equals(EMapType.common)) {
      result = 1;
      reason = "此地图不能试炼";
      return;
    }

    TrialsInfo trialsInfo = RaidsJson.instance().getTrialsMap().get(trialsId);
    if (trialsInfo == null) {
      result = 1;
      reason = "本层试练已经全部击杀完毕!";
      return;
    }
    if (!trialsInfo.getMonsterMap().containsKey(position)) {
      result = 1;
      reason = "本层试练已经全部击杀!";
      return;
    }
    int monsterGroupId = trialsInfo.getMonsterMap().get(position);
    MonsterGroup monsterGroup = MonsterJson.instance().getMonsterGroup(monsterGroupId);
    battleInfo =
        BattleServer.preBattle(online, monsterGroup, 3, online.getMapInfo().getBaseMap(), false);

    battleInfo.setTrialsId(trialsId);

    LogManager.trials(online, trialsId, position); // 试炼日志
  }
Ejemplo n.º 3
0
 @Override
 public boolean defend(
     BattleInfo battleInfo,
     BattleCharacter defender,
     BattleCharacter attacker,
     BattleAmin defenderAmin,
     BattleAmin attackerAmin,
     int finalHarm,
     int turn,
     int harmType,
     BaseSkill baseSkill,
     ParamTemp paramTemp) {
   return BattleServer.hpChange(battleInfo, defender, defenderAmin, finalHarm, paramTemp);
 }