Example #1
0
 private void initMatch() {
   int campNum = CampType.getRealCampNum();
   this.match = new byte[campNum];
   this.endFlag = new byte[campNum]; // 标识为都未结束
   for (int c = 0; c < 3; c++) {
     List<Byte> list = Lists.newArrayList();
     for (byte i = 0; i < campNum; i++) {
       list.add(i);
     }
     for (int r = 0; r < campNum / 2 * (campNum - 1); r++) {
       Collections.sort(
           list,
           new Comparator<Byte>() {
             @Override
             public int compare(Byte o1, Byte o2) {
               return RandomUtil.absRandomInt(3) - 1;
             }
           });
     }
     for (int i = 0; i < list.size(); i = i + 2) {
       byte a = list.get(i);
       byte b = list.get(i + 1);
       this.match[a] = b;
       this.match[b] = a;
     }
   }
 }
Example #2
0
 private void initMaxHp() {
   int campNum = CampType.getRealCampNum();
   int configMaxHp = GameContext.getCampWarApp().getLeaderConfigMaxHp();
   maxHp = new AtomicInteger[campNum];
   for (int i = 0; i < campNum; i++) {
     maxHp[i].set(configMaxHp);
   }
   this.maxConfigHp = configMaxHp;
 }