竞技场重写四版,gm工具修改,格式优化

master_dev
grimm 2024-02-19 11:12:49 +08:00
parent 9fbfae861a
commit 9c4b9673bc
2 changed files with 14 additions and 34 deletions

View File

@ -42,8 +42,6 @@ public class BehaviorUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(BehaviorUtil.class);
/**
*
* @param user
* @throws Exception
*/
public static void destoryPoint(User user, int needDistoryPointId) throws Exception {
MapManager mapManager = user.getMapManager();
@ -63,13 +61,11 @@ public class BehaviorUtil {
/**
*
* @param user
* @throws Exception
*/
public static void destoryPoints(User user, int[] needDistoryPointIds) throws Exception {
Set<Integer> set = new HashSet<>(needDistoryPointIds.length);
for (int i = 0; i < needDistoryPointIds.length; i++) {
set.add(needDistoryPointIds[i]);
for (int needDistoryPointId : needDistoryPointIds) {
set.add(needDistoryPointId);
}
MapManager mapManager = user.getMapManager();
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
@ -88,12 +84,6 @@ public class BehaviorUtil {
/**
*
* @param needDistoryPointId
* @param mapManager
* @param mapId
* @param x
* @param y
* @throws Exception
*/
public static Cell addBehaviorInfo(User user,int needDistoryPointId, MapManager mapManager, int mapId, int x, int y,boolean isIndication) throws Exception {
int xy = CellUtil.xy2Pos(x, y);
@ -119,8 +109,6 @@ public class BehaviorUtil {
/**
*
* @param user
* @throws Exception
*/
public static void destoryApointXY(User user, int destoryXY) throws Exception {
MapManager mapManager = user.getMapManager();
@ -135,8 +123,6 @@ public class BehaviorUtil {
/**
* groupId#pointId
* @param uid
* @param readyInfo
*/
public static void fightReady(int uid, String readyInfo) {
String key = RedisKey.getKey(RedisKey.FIGHT_READY, Integer.toString(uid));
@ -160,12 +146,8 @@ public class BehaviorUtil {
/**
*
* @param user
* @param groupId
* @param fightStartRespons
* @throws Exception
*/
public static void getEndlessFightInfo(User user, int teamId,int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId,int maxTime,boolean isMyself,Map<String,Integer> bloodMap,List<Long> monsterHp) throws Exception {
public static void getEndlessFightInfo(User user, int teamId,int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId,int maxTime,boolean isMyself,Map<String,Integer> bloodMap,List<Long> monsterHp) {
MapManager mapManager = user.getMapManager();
CommonProto.FightData.Builder fightData = CommonProto.FightData.newBuilder();
@ -178,7 +160,7 @@ public class BehaviorUtil {
fightData.setHeroFightInfos(fightTeamInfo);
//monsterHp带入
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup;
if(monsterHp!=null&&monsterHp.size()>0){
if(monsterHp!=null&& !monsterHp.isEmpty()){
Map<Integer,List<Long>> monsterHpMap = new HashMap<>();
monsterHpMap.put(0,monsterHp);
monsterByGroup = MonsterUtil.getMonsterByGroup(groupId,monsterHpMap);
@ -216,10 +198,10 @@ public class BehaviorUtil {
fightInfo.put(RedisKey.FIGHT_HEROES, JsonFormat.printToString(fightTeamInfo));
fightInfo.put(RedisKey.FIGHT_MONSTERS_1, JsonFormat.printToString(monsterGroupList.get(0)));
if (monsterGroupList1.size() != 0){
if (!monsterGroupList1.isEmpty()){
fightInfo.put(RedisKey.FIGHT_MONSTERS_2, JsonFormat.printToString(monsterGroupList1.get(0)));
}
if (monsterGroupList2.size() != 0){
if (!monsterGroupList2.isEmpty()){
fightInfo.put(RedisKey.FIGHT_MONSTERS_3, JsonFormat.printToString(monsterGroupList2.get(0)));
}
fightInfo.put(RedisKey.FIGHT_SEED,Integer.toString(seed));
@ -230,9 +212,6 @@ public class BehaviorUtil {
/**
* FightUnitInfo
* @param user
* @param teamId
* @return
*/
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId,boolean isMySelf) {
if(teamId==TeamEnum.TRIAL_TEAM.getTeamId()){
@ -408,7 +387,6 @@ public class BehaviorUtil {
/**
* hfightTeamInfo
* @return
*/
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(Map<Integer, List<CommonProto.FightUnitInfo>> monster,List<CommonProto.FightUnitInfo> pokemon,int num) {
List<CommonProto.FightTeamInfo> monsterGroupList = new ArrayList<>();

View File

@ -72,7 +72,7 @@ public class Cmd_arenafalsedata extends GmAbstract {
NewArenaRank rank = (NewArenaRank) RankEnum.toRank(RankEnum.NEW_ARENA_RANK.getType());
for (User user : users) {
int uid = user.getId();
int randomArenaLv = getRandomArenaLv();
int randomArenaLv = getRandomArenaLv(roomId);
int randomScore = getRandomScore();
// 竞技场缓存
ArenaInfo info = new ArenaInfo();
@ -139,14 +139,16 @@ public class Cmd_arenafalsedata extends GmAbstract {
Random random = new Random();
// 生成0到450之间的随机数包括0和450
int randomNumberInRange = random.nextInt(451);
// 将随机数加上1050使其落在1050到1500的范围内
return 1050 + randomNumberInRange;
// 将随机数加上1010使其落在1010到1460的范围内
return 1010 + randomNumberInRange;
}
public static int getRandomArenaLv() {
public static int getRandomArenaLv(int roomId) {
SArenaRoom room = SArenaRoom.getMap().get(roomId);
int[] arenaLevel = room.getArenaLevel();
Random random = new Random();
int size = SArenaLevel.getMap().size();
return 1+random.nextInt(size);
int index = random.nextInt(arenaLevel.length);
return arenaLevel[index];
}
public static int getRandomRanking() {