竞技场重写六版,修改对手匹配机制,尽量匹配真人

master_dev
grimm 2024-02-19 17:43:03 +08:00
parent 2bd413795e
commit 707fc9b22f
1 changed files with 7 additions and 3 deletions

View File

@ -1022,7 +1022,7 @@ public class ArenaLogic {
String key = rank.getKey(roomId);
int size = 4;
HashMap<Integer, CommonProto.ArenaPersonInfo> result = new HashMap<>(size);
Map<Integer, CommonProto.ArenaPersonInfo> result = new LimitedSizeMap<>(size);
SArenaSetting arenaSetting = SArenaSetting.getSArenaSetting();
int[][] interval = arenaSetting.getInterval();
@ -1035,7 +1035,9 @@ public class ArenaLogic {
if (range == null || range.isEmpty()){
continue;
}
for (String id : range) {
List<String> list = new ArrayList<>(range);
Collections.shuffle(list);
for (String id : list) {
int uid = Integer.parseInt(id);
if (uid == user.getId() || result.containsKey(uid)){
continue;
@ -1045,7 +1047,9 @@ public class ArenaLogic {
continue;
}
result.put(uid, personInfo);
break;
if (result.size() == size){
break;
}
}
}
// 长度不足,走顺位排名