山河社稷
parent
0d7d05b70c
commit
972b6dde78
|
@ -1,12 +1,11 @@
|
|||
package com.ljsd.fight;
|
||||
|
||||
|
||||
|
||||
public class ArenaRecord {
|
||||
public class ArenaRecord {
|
||||
|
||||
private String id;
|
||||
|
||||
private int type; // 1 : 人机对战 2 : 真人对战 3:机机对战
|
||||
private int type; // 1 : 人机对战 2 : 真人对战 3:机机对战
|
||||
|
||||
private int attackId; //进攻者
|
||||
|
||||
|
@ -22,13 +21,22 @@ public class ArenaRecord {
|
|||
|
||||
private int roundTims; //决赛阶段赋值 十位表示队伍id 个位表示第几轮
|
||||
|
||||
private int nums =1;
|
||||
private int nums = 1;
|
||||
|
||||
private int turn =1;
|
||||
private int turn = 1;
|
||||
|
||||
private byte[] fightData;
|
||||
|
||||
public ArenaRecord(){}
|
||||
private int level;
|
||||
|
||||
private int head;
|
||||
|
||||
private String userName;
|
||||
|
||||
private int headFrame;//头像框
|
||||
|
||||
public ArenaRecord() {
|
||||
}
|
||||
|
||||
public int getAttackId() {
|
||||
return attackId;
|
||||
|
@ -125,4 +133,36 @@ public class ArenaRecord {
|
|||
public void setTurn(int turn) {
|
||||
this.turn = turn;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public void setHead(int head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public void setHeadFrame(int headFrame) {
|
||||
this.headFrame = headFrame;
|
||||
}
|
||||
|
||||
public int getHeadFrame() {
|
||||
return headFrame;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ function RoleLogic:Init(uid, data, position)
|
|||
self.isImmuneAllReduceShield = false --免疫敌方无敌盾(敌方无敌盾对自己无效)
|
||||
self.ignoreShara = false --忽略敌方分摊
|
||||
self.type = BattleUnitType.Role
|
||||
self.isNormalAttackAddRage=true --普攻是否回复怒气
|
||||
self.passiveList = {}
|
||||
if data.passivity and #data.passivity > 0 then
|
||||
table.sort(data.passivity,function(a,b)return a[1] < b[1] end)
|
||||
|
@ -137,6 +138,7 @@ function RoleLogic:AddPassive(id, args, isRepeat)
|
|||
-- 加入被动列表
|
||||
table.insert(self.passiveList, {id, args})
|
||||
end
|
||||
|
||||
--
|
||||
function RoleLogic:CanCastSkill()
|
||||
return self.sp >= self.spPass and not self.IsDebug
|
||||
|
@ -327,8 +329,8 @@ function RoleLogic:SkillCast(skill, func)
|
|||
if (skill.type == BattleSkillType.Normal or skill.type ==BattleSkillType.ChaosNormal) and not self.ctrl_palsy then
|
||||
|
||||
local function _CheckRage()
|
||||
-- 后成长怒气
|
||||
if skill.isRage then
|
||||
-- 后成长怒气 判断普攻是否会回复怒气
|
||||
if skill.isRage and self.isNormalAttackAddRage then
|
||||
-- 检测被动技能对怒气成长的影响
|
||||
local grow = self.RageGrow
|
||||
local _RageGrowPassivity = function(finalGrow)
|
||||
|
|
|
@ -248,6 +248,8 @@ public class RedisKey {
|
|||
//山河社稷图
|
||||
public static final String SHAN_HE_SHE_JI_CHAPTER_RANK = "SHAN_HE_SHE_JI_CHAPTER_RANK";
|
||||
public static final String SHAN_HE_SHE_JI_STAR_RANK = "SHAN_HE_SHE_JI_STAR_RANK";
|
||||
public static final String HARD_STAGE_FIST_PASS = "HARD_STAGE_FIST_PASS";
|
||||
public static final String HARD_STAGE_PASS_MIN_FORCE = "HARD_STAGE_PASS_MIN_FORCE";
|
||||
|
||||
|
||||
public static final String DEATH_PATH_TOTAL_CHALLENGE_COUNT = "DEATH_PATH_TOTAL_CHALLENGE_COUNT";
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.handler.hardStage;
|
||||
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import java.util.*;
|
||||
|
||||
public class HardStageReportRequsetHandler extends BaseHandler<PlayerInfoProto.HardStageReportRequset> {
|
||||
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.HARD_STAGE_REPORT_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.HardStageReportRequset proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
int id = proto.getHardStageId();
|
||||
PlayerInfoProto.HardStageReportResponse.Builder response = PlayerInfoProto.HardStageReportResponse.newBuilder();
|
||||
//首次通关记录
|
||||
ArenaRecord firstPassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(id),ArenaRecord.class);
|
||||
if(firstPassRecord != null){
|
||||
CommonProto.HardStagePlayerInfo first = CBean2Proto.getHardStagePlayerInfo(firstPassRecord,1);
|
||||
response.addPlayer(first);
|
||||
}
|
||||
// 最低战力通关记录记录
|
||||
ArenaRecord minForcePassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(id),ArenaRecord.class);
|
||||
if(minForcePassRecord!=null){
|
||||
CommonProto.HardStagePlayerInfo min = CBean2Proto.getHardStagePlayerInfo(firstPassRecord,2);
|
||||
response.addPlayer(min);
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_REPORT_RESPONSE.getNumber(), response.build(), true);
|
||||
}
|
||||
}
|
|
@ -26,6 +26,10 @@ import config.SHardStage;
|
|||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.jse.JseMathLib;
|
||||
import rpc.protocols.*;
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import util.TimeUtils;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -83,12 +87,6 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
if (resultCode == 1) {//通过
|
||||
HardStageLogic.passNode(iSession, nodeConfig, resultNum, dropList);
|
||||
}
|
||||
//战斗回放
|
||||
String fightInfo = nodeId + "#" + seed + "#" + teamId;
|
||||
String key = RedisKey.getKey(RedisKey.HARD_STAGE_BATTLE, String.valueOf(iSession.getUid()), false);
|
||||
RedisUtil.getInstence().set(key, fightInfo, -1);
|
||||
|
||||
|
||||
String fightId = FightUtil.getFightId(user.getId(), FightType.HardStage.getType());
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightType(FightType.HardStage.getType())
|
||||
|
@ -100,8 +98,47 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
.build();
|
||||
fightStartResponse.setFightData(fightData);
|
||||
FightRecordLogic.getInstance().addRecordMap(user, fightData);
|
||||
}
|
||||
|
||||
//战斗回放
|
||||
//String fightInfo = nodeId + "#" + seed + "#" + teamId;
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
// 首次通关记录
|
||||
ArenaRecord firstPassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(nodeId),ArenaRecord.class);
|
||||
if(firstPassRecord == null){
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
arenaRecord.setCreateTime(TimeUtils.nowInt());
|
||||
arenaRecord.setAttackId(user.getId());
|
||||
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel());
|
||||
arenaRecord.setHead(user.getPlayerInfoManager().getHead());
|
||||
arenaRecord.setUserName(user.getPlayerInfoManager().getNickName());
|
||||
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());
|
||||
arenaRecord.setFightData(fightData.toByteArray());
|
||||
arenaRecord.getFightData().toString();
|
||||
arenaRecord.setAttackForce(force);
|
||||
|
||||
RedisUtil.getInstence().set(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(nodeId),arenaRecord);
|
||||
}
|
||||
// 最低战力通关记录记录
|
||||
ArenaRecord minForcePassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(nodeId),ArenaRecord.class);
|
||||
if(minForcePassRecord == null || force < minForcePassRecord.getAttackForce()){
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
arenaRecord.setCreateTime(TimeUtils.nowInt());
|
||||
arenaRecord.setAttackId(user.getId());
|
||||
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel());
|
||||
arenaRecord.setHead(user.getPlayerInfoManager().getHead());
|
||||
arenaRecord.setUserName(user.getPlayerInfoManager().getNickName());
|
||||
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());
|
||||
arenaRecord.setFightData(fightData.toByteArray());
|
||||
arenaRecord.getFightData().toString();
|
||||
arenaRecord.setAttackForce(force);
|
||||
|
||||
RedisUtil.getInstence().set(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(nodeId),arenaRecord);
|
||||
}
|
||||
// 首次通关记录
|
||||
//Map<String, ArenaRecord> first = RedisUtil.getInstence().getMapValues(RedisKey.HARD_STAGE_FIST_PASS, "", String.class, ArenaRecord.class);
|
||||
//String key = RedisKey.getKey(RedisKey.HARD_STAGE_BATTLE, String.valueOf(iSession.getUid()), false);
|
||||
//RedisUtil.getInstence().set(key, fightInfo, -1);
|
||||
}
|
||||
for (CommonProto.Drop.Builder drop : dropList) {
|
||||
fightStartResponse.addDrop(drop);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import manager.STableManager;
|
|||
import rpc.protocols.*;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import rpc.protocols.CommonProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -767,4 +769,14 @@ public class CBean2Proto {
|
|||
public static CommonProto.TeamSimpleInfo getSimpleTeamInfoByPokeMon(Pokemon pokemon,int position){
|
||||
return CommonProto.TeamSimpleInfo.newBuilder().setHeroid(pokemon.getId()).setHeroTid(pokemon.getTmpId()).setLevel(pokemon.getLevel()).setStar(pokemon.getStar()).setPosition(position).build();
|
||||
}
|
||||
public static CommonProto.HardStagePlayerInfo getHardStagePlayerInfo(ArenaRecord arenaRecord,int type)throws Exception{
|
||||
CommonProto.FightData fightDataProto = CommonProto.FightData.parseFrom(arenaRecord.getFightData());
|
||||
return CommonProto.HardStagePlayerInfo.newBuilder()
|
||||
.setUid(arenaRecord.getAttackId())
|
||||
.setLevel(arenaRecord.getAttackId())
|
||||
.setHead(arenaRecord.getHead())
|
||||
.setUserName(arenaRecord.getUserName())
|
||||
.setHeadFrame(arenaRecord.getHeadFrame())
|
||||
.setFightData(fightDataProto).setPower(arenaRecord.getAttackForce()).setType(type).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ public class MonsterUtil {
|
|||
int[] monsterIds = groupIds[i];
|
||||
List<CommonProto.FightUnitInfo> monsterList = new ArrayList<>();
|
||||
int position=1;
|
||||
for (int monsterId : monsterIds) {
|
||||
/* for (int monsterId : monsterIds) {
|
||||
if(monsterId!=0){
|
||||
SMonsterConfig sMonsterConfig = STableManager.getConfig(SMonsterConfig.class).get(monsterId);
|
||||
monsterList.add( CBean2Proto.getMonster(sMonsterConfig, nodeConfig).setPosition(position++).build());
|
||||
|
@ -136,7 +136,7 @@ public class MonsterUtil {
|
|||
position++;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
for (int monsterId : monsterIds) {
|
||||
if(monsterId!=0){
|
||||
monsterList.add(monsterMap.get(monsterId).setPosition(position++).build());
|
||||
|
|
|
@ -14,6 +14,7 @@ public enum UUIDEnum {
|
|||
JEWEL(10),
|
||||
SpecialMonster(11),
|
||||
ROBOT_UUID(12),
|
||||
HardStage(15),
|
||||
;
|
||||
|
||||
private int value;
|
||||
|
|
Loading…
Reference in New Issue