arena fight result

back_recharge
wangyuan 2019-11-06 16:17:01 +08:00
parent cdf7a2ba30
commit 3e338096d5
3 changed files with 26 additions and 3 deletions

View File

@ -170,6 +170,14 @@ public class ArenaLogic {
if(arenaManager.getCount() != 0){
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason), Integer.toString(uid)).intValue();
}else{
if(curSeason>1){
int lastScore = RedisUtil.getInstence().getZSetScore(RedisKey.ARENA_RANK, Integer.toString(curSeason - 1), Integer.toString(uid)).intValue();
if(lastScore!=-1){
myscore = lastScore;
}
}
}
user.getTeamPosManager().setCurTeamPosId(teamId);
@ -189,6 +197,7 @@ public class ArenaLogic {
arenaRecord.setAttackForce( HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE,false));
arenaRecord.setCreateTime((int)(System.currentTimeMillis()/1000));
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,uid));
arenaRecord.setFightResult(fightResult);
RedisUtil.getInstence().putMapEntry(RedisKey.ARENA_RRECORD,Integer.toString(challengeUid),arenaRecord.getId(),arenaRecord);
RedisUtil.getInstence().incrementZsetScore(RedisKey.ARENA_RANK,Integer.toString(curSeason),Integer.toString(challengeUid),defScoreChange);
MessageUtil.sendRedIndication(challengeUid,GlobalsDef.ARENA_CHALLENGE_TYPE);
@ -211,7 +220,11 @@ public class ArenaLogic {
setMyArenaEnemys(uid,user);
arenaManager.updateChallenge(fightResult);
//组战斗数据
ArenaInfoProto.ArenaChallengeResponse build = builder.setMyScoreChange(myscoreChange).setDefScoreChange(defScoreChange).addAllArenaEnemys(getArenaEnemyList(arenaManager.getArenaEnemies())).build();
ArenaInfoProto.ArenaChallengeResponse build = builder
.setMyScoreChange(myscoreChange).setDefScoreChange(defScoreChange)
.addAllArenaEnemys(getArenaEnemyList(arenaManager.getArenaEnemies()))
.setFightResult(fightResult)
.build();
user.getUserMissionManager().onGameEvent(user, GameEvent.ARENA_CHALLENGE,fightResult,myscoreChange + myscore);
Poster.getPoster().dispatchEvent(new ArenaChallengeEvent(user.getId()));
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ARENA_CHALLENGE_RESPONSE_VALUE,build,true);
@ -535,6 +548,7 @@ public class ArenaLogic {
.setAttackInfo(arenaPersonInfo)
.setMyScoreChange(arenaRecord.getDefScore())
.setAttackTime(arenaRecord.getCreateTime())
.setFightResult(arenaRecord.getFightResult())
.build());
}

View File

@ -16,6 +16,8 @@ public class ArenaRecord {
private int createTime;
private int fightResult;
public ArenaRecord(){}
public int getAttackId() {
@ -66,5 +68,11 @@ public class ArenaRecord {
this.id = id;
}
public int getFightResult() {
return fightResult;
}
public void setFightResult(int fightResult) {
this.fightResult = fightResult;
}
}

View File

@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import util.MathUtils;
import util.StringUtil;
import java.math.BigDecimal;
import java.rmi.server.ExportException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -1291,7 +1292,7 @@ public class HeroLogic {
effectValue += targetValue;
heroAllAttribute.put(targetPropertyId,effectValue);
}else{
propertyPercentMap.put(targetPropertyId,10000+effectValue);
propertyPercentMap.put(targetPropertyId,effectValue);
}
iterator.remove();
}
@ -1299,7 +1300,7 @@ public class HeroLogic {
for(Map.Entry<Integer,Integer> item : propertyPercentMap.entrySet()){
Integer propertyId = item.getKey();
Integer propertyValue = heroAllAttribute.get(propertyId);
heroAllAttribute.put(propertyId,(int)(propertyValue/10000f*item.getValue()));
heroAllAttribute.put(propertyId,propertyValue+BigDecimal.valueOf(propertyValue/10000f).multiply(BigDecimal.valueOf(item.getValue())).intValue());
}
Integer maxHp = heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId());
Integer curHp = heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId());