back_recharge
parent
1655043499
commit
82c1fc4dd8
|
|
@ -172,11 +172,11 @@ public class CombatLogic {
|
|||
int nextFlushTime = sAdventureConfig.getInvasionBossRefresh();
|
||||
int findBossTime = adventureStateInfo.getFindBossTime();
|
||||
int remainTime =sAdventureConfig.getInvasionBossHolding()-(now - findBossTime);
|
||||
boolean needRandom = false;
|
||||
boolean need = false;
|
||||
int randomTimes =0;
|
||||
if(StringUtil.isEmpty(adventureStateInfo.getBossId())){
|
||||
if(now-adventureStateInfo.getStartTime()>nextFlushTime){
|
||||
needRandom = true;
|
||||
randomTimes = (now-adventureStateInfo.getStartTime())/nextFlushTime;
|
||||
}else{
|
||||
nextFlushTime = nextFlushTime -(now-adventureStateInfo.getStartTime());
|
||||
}
|
||||
|
|
@ -185,23 +185,25 @@ public class CombatLogic {
|
|||
AdventureBoss adventureBoss = RedisUtil.getInstence().getMapEntry(RedisKey.ADVENTRUEN_BOSS_INFO, "", adventureStateInfo.getBossId(), AdventureBoss.class);
|
||||
need= true;
|
||||
if(adventureBoss == null){
|
||||
needRandom = true;
|
||||
randomTimes = 1;
|
||||
remainTime=0;
|
||||
need=false;
|
||||
}
|
||||
|
||||
}else{
|
||||
if(remainTime+nextFlushTime<0){
|
||||
needRandom = true;
|
||||
randomTimes = (now-findBossTime-sAdventureConfig.getInvasionBossHolding())/nextFlushTime;
|
||||
remainTime=0;
|
||||
}else{
|
||||
nextFlushTime = remainTime+nextFlushTime;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(needRandom){
|
||||
int bossGroupId = randomInvasionBoss(uid, adventureStateInfo.getPosition());
|
||||
if(randomTimes>0){
|
||||
int bossGroupId = randomInvasionBoss(uid, adventureStateInfo.getPosition(),randomTimes);
|
||||
if(bossGroupId>0){
|
||||
remainTime =sAdventureConfig.getInvasionBossHolding();
|
||||
nextFlushTime+=remainTime+nextFlushTime;
|
||||
need=true;
|
||||
}
|
||||
|
|
@ -213,7 +215,6 @@ public class CombatLogic {
|
|||
.build();
|
||||
if(flushBuilder!=null){
|
||||
flushBuilder.setAdventureBossSimpleInfo(build);
|
||||
break;
|
||||
}else{
|
||||
builder1.setAdventureBossSimpleInfo(build);
|
||||
}
|
||||
|
|
@ -514,7 +515,8 @@ public class CombatLogic {
|
|||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
public int randomInvasionBoss(int uid,int arenaID) throws Exception {
|
||||
public int randomInvasionBoss(int uid,int arenaID,int randomTimes) throws Exception {
|
||||
LOGGER.info("the uid={},the arenaId={},the times={}",uid,arenaID,randomTimes);
|
||||
User user = UserManager.getUser(uid);
|
||||
AdventureManager adventureManager = user.getAdventureManager();
|
||||
Map<Integer, AdventureStateInfo> adventureStateInfoMap = adventureManager.getAdventureStateInfoMap();
|
||||
|
|
@ -527,15 +529,17 @@ public class CombatLogic {
|
|||
for(int[] item :invasionBossWeightInfo){
|
||||
totalWeight+=item[1];
|
||||
}
|
||||
int randomInt = MathUtils.randomInt(totalWeight);
|
||||
int bossGroupID =0;
|
||||
for(int[] item :invasionBossWeightInfo){
|
||||
randomInt-=item[1];
|
||||
if(randomInt<0){
|
||||
bossGroupID = item[0];
|
||||
break;
|
||||
while (randomTimes-->0 && bossGroupID==0){
|
||||
int randomInt = MathUtils.randomInt(totalWeight);
|
||||
for(int[] item :invasionBossWeightInfo){
|
||||
randomInt-=item[1];
|
||||
if(randomInt<0){
|
||||
bossGroupID = item[0];
|
||||
break;
|
||||
}
|
||||
totalWeight+=item[1];
|
||||
}
|
||||
totalWeight+=item[1];
|
||||
}
|
||||
int now = (int)(System.currentTimeMillis()/1000);
|
||||
String bossId="";
|
||||
|
|
|
|||
Loading…
Reference in New Issue