山河社稷
parent
8ab1fafc40
commit
885e0112ad
|
@ -0,0 +1,84 @@
|
|||
local HardStage = {
|
||||
__count = 38,
|
||||
__indexs = {1.83},
|
||||
__values = {-420,10,31,13,2,5,3,31,12,19,2,20,2,25,4,16,13,21,30,1,8,6,78,67,1.83,112,110,89,85,29567,-5000.4,1001,1.73,3962,-5000.61,70000,1.73},
|
||||
__exVals = {49,nil,'x_xiaoyaoyou_ditu_longzi','x_xiaoyaoyou_ditu_huangzi','x_xiaoyaoyou_ditu_luzi','x_xiaoyaoyou_ditu_hezi','x_xiaoyaoyou_ditu_shengzi','x_xiaoyaoyou_ditu_buzi','x_xiaoyaoyou_ditu_dizi','x_xiaoyaoyou_ditu_xuezi','x_xiaoyaoyou_ditu_jingzi','x_xiaoyaoyou_ditu_xianzi','地图名称1','地图名称2','地图名称3','地图名称4','地图名称5','地图名称6','地图名称7','地图名称8','地图名称9','地图名称10','地图名称11','地图名称12','地图名称13','地图名称14','地图名称15','地图名称16','地图名称17','地图名称18','地图名称19','地图名称2-1','地图名称2-2','地图名称2-3','地图名称2-4','地图名称2-5','地图名称2-6','地图名称2-7','地图名称2-8','地图名称2-9','地图名称2-10','地图名称2-11','地图名称2-12','地图名称2-13','地图名称2-14','地图名称2-15','地图名称2-16','地图名称2-17','地图名称2-18','地图名称2-19'},
|
||||
__fields = {
|
||||
'Id',
|
||||
'Chapter',
|
||||
'Section',
|
||||
'Picture ',
|
||||
'Name',
|
||||
'LevelPointPosition',
|
||||
'Repeat ',
|
||||
'NextLevel',
|
||||
'LevelLimit',
|
||||
'Star ',
|
||||
'MonsterGroup',
|
||||
'HardStageBuff',
|
||||
'RecommendFightAbility',
|
||||
'PassReward',
|
||||
'StageType',
|
||||
'HighestStar',
|
||||
'ConditionValue',
|
||||
'Reward1'
|
||||
},
|
||||
__defaults = {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
25,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil
|
||||
},
|
||||
__refs = {
|
||||
{26,.81,1,.81},
|
||||
{26,1.81,-18,1.81},
|
||||
{166,1.9,-9,2.1,2.1,1.7},
|
||||
{176,1.73},
|
||||
{{{1},{66,-1,-1,-1,-3,-37,-3,-6,2,-5,-7,6,8,1,47,14.31,-8,5.1,5.4}},{{2},{13,-4,-2,-1,-1,-2,-2,1,6,4,5,4,1,-7,-2,14.31,-3,5.1,5.4}}},
|
||||
{26,-1,1,2.1,4.1,8.1,2.1,0,19.81},
|
||||
{25,1.73},
|
||||
{50,.3,2,2.1,4.1,.2,-34,.81},
|
||||
nil,
|
||||
{72,1.73},
|
||||
{26,1.01,-10,2.1,2.1,1.4},
|
||||
{69,-2,3,2.1,-2,41,-40,2.1,41,10.5,4.3,1,9.8,8.1,2.1},
|
||||
{{{1},{127,1.73}}},
|
||||
{26,1,-1,2,-2,4.1,8.1,4.2,0,19.81},
|
||||
{28,-3,3,2.1,4.1,8.1,2.1,0,19.81},
|
||||
{{{1},{26,.91},{-2.9,3,-2.8}},{{2},{27,.91},{-2.9,3,-2.8}},{{3},{28,.91},{-2.9,3,-2.8}}},
|
||||
{{{1},{129,-2.9,-18,-2.9},{-2.9,3,-2.8}},{{2},{131,-2.9,-18,-2.9},{-2.9,3,-2.8}},{{3},{133,-2.9,-18,-2.9},{-2.9,3,-2.8}}}
|
||||
},
|
||||
__refPoss = {
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil
|
||||
},
|
||||
}
|
||||
return HardStage
|
|
@ -0,0 +1,28 @@
|
|||
local HardStageCondition = {
|
||||
__count = 11,
|
||||
__indexs = {1.11},
|
||||
__values = {0,1.11,49989,950003},
|
||||
__exVals = {11,'通过关卡','2回合内通过关卡','上阵N个神将通过关卡','5回合内造成50000伤害','使用指定佛系神将5个','存活5个人','不上阵输出神将通过关卡','不上阵佛系神将通过关卡','佩戴普贤菩萨魂印通过关卡','不使用灵兽通过关卡','全部上阵输出职业神将通过关卡'},
|
||||
__fields = {
|
||||
'Id',
|
||||
'ConditionType',
|
||||
'ConditionValue',
|
||||
'Describe'
|
||||
},
|
||||
__defaults = {
|
||||
nil,
|
||||
nil,
|
||||
nil
|
||||
},
|
||||
__refs = {
|
||||
{2,1.01},
|
||||
{{{1},{2,1.2,2,-3,3,-4,1,11,-13,1}},{{2},{13,-7},{4,1}}},
|
||||
{15,1.01}
|
||||
},
|
||||
__refPoss = {
|
||||
nil,
|
||||
nil,
|
||||
nil
|
||||
},
|
||||
}
|
||||
return HardStageCondition
|
File diff suppressed because one or more lines are too long
|
@ -190,6 +190,8 @@ ConfigName = {
|
|||
ArroGantFly = "ArroGantFly",
|
||||
ComposeActivity = "ComposeActivity",
|
||||
ComposeBook = "ComposeBook",
|
||||
HardStage ="HardStage",
|
||||
HardStageCondition="HardStageCondition",
|
||||
}
|
||||
|
||||
require "Modules/Battle/Framework/GameDataBase"
|
||||
|
|
|
@ -6761,6 +6761,7 @@ local passivityList = {
|
|||
role:AddBuff(Buff.Create(role, BuffName.PropertyChange,round, BattlePropList[p1],v1, ct))
|
||||
end
|
||||
end,nil,nil,role)
|
||||
|
||||
end,
|
||||
-- 敌方单位被击杀自身释放[a]技能,释放的技能类型为[b]。
|
||||
-- a[int] b[int]
|
||||
|
@ -6781,7 +6782,7 @@ local passivityList = {
|
|||
end,
|
||||
--英雄[a],附加的[b]种类[c]类型buff,持续时间改变[d][e]回合
|
||||
--a[int],b[int buff类型],c[int type类型],d[int 改变类型],e[int]
|
||||
[306] = function(role, args)
|
||||
[306] = function(role, args,id,judge)
|
||||
local id = args[1]
|
||||
local tp1 = args[2]
|
||||
local tp2 = args[3]
|
||||
|
@ -6835,7 +6836,7 @@ local passivityList = {
|
|||
end,
|
||||
-- 根据生命百分比添加被动 血量百分比[a],被动id[b],...(后面没有的不配)
|
||||
-- a[float],b[int],c[float],d[int],e[float],f[int],g[float],h[int]
|
||||
[313] = function(role, args)
|
||||
[313] = function(role, args,id,judge)
|
||||
local passTable={}
|
||||
for i = 1, #args do
|
||||
if i%2==0 then
|
||||
|
@ -6860,5 +6861,15 @@ local passivityList = {
|
|||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged,nil,nil,role)
|
||||
end,
|
||||
-- 普通攻击不会回复怒气
|
||||
-- a[float]
|
||||
[314] = function(role, args,id,judge)
|
||||
role.isNormalAttackAddRage=false
|
||||
end,
|
||||
-- 禁止治疗
|
||||
-- a[float]
|
||||
[315] = function(role, args,id,judge)
|
||||
role.ctrl_noheal=true
|
||||
end,
|
||||
}
|
||||
return passivityList
|
||||
|
|
|
@ -3,11 +3,11 @@ local this = BattleLogManager
|
|||
local isEditor = AppConst and AppConst.Platform == "EDITOR"
|
||||
local isMobile = AppConst and (AppConst.Platform == "ANDROID" or AppConst.Platform == "IOS")
|
||||
|
||||
local isDebug = false
|
||||
local isDebug = true
|
||||
function LogBattle(str)
|
||||
if isDebug then
|
||||
if isEditor then
|
||||
LogGreen(str)
|
||||
--LogGreen(str)
|
||||
else
|
||||
print(str)
|
||||
end
|
||||
|
@ -114,6 +114,7 @@ function this.Log(...)
|
|||
if #this.logList > 100 then
|
||||
this.WriteLogToFile()
|
||||
end
|
||||
LogBattle(log)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require("Modules.Battle.Logic.HardStageCondition")
|
||||
require("Modules.Battle.Logic.HardStageEventManager")
|
||||
BattleLogic = {}
|
||||
local floor = math.floor
|
||||
local min = math.min
|
||||
|
@ -22,6 +24,9 @@ local userData
|
|||
local allHeroDamage=0
|
||||
--所有怪的伤害和治疗
|
||||
local allEnemyDamage=0
|
||||
--关卡星级记录
|
||||
local levelStarRecord
|
||||
local hardStageId =0
|
||||
--是否开启战斗日志
|
||||
BattleLogic.IsOpenBattleRecord = false
|
||||
--逻辑帧频
|
||||
|
@ -44,23 +49,19 @@ function BattleLogic.Init(data, _userData, maxRound)
|
|||
if BattleLogic.IsOpenBattleRecord then
|
||||
record = {}
|
||||
end
|
||||
|
||||
levelStarRecord={}
|
||||
fightData = data
|
||||
userData = _userData
|
||||
|
||||
hardStageId=data.nodeId
|
||||
BattleLogic.CurOrder = 0
|
||||
BattleLogic.TotalOrder = #data.enemyData
|
||||
|
||||
BattleLogic.Clear()
|
||||
|
||||
curFrame = 0
|
||||
|
||||
CurRound = 0
|
||||
MaxRound = maxRound or 20
|
||||
allHeroDamage= 0
|
||||
allEnemyDamage= 0
|
||||
_IsDebug = false
|
||||
|
||||
BattleLogic.Event:ClearEvent()
|
||||
BattleLogic.BuffMgr:Init()
|
||||
BattleLogic.IsEnd = false
|
||||
|
@ -73,7 +74,7 @@ function BattleLogic.Init(data, _userData, maxRound)
|
|||
SkillManager.Init()
|
||||
OutDataManager.Init(fightData)
|
||||
PassiveManager.Init()
|
||||
|
||||
HardStageEventManager.Init()
|
||||
-- 监听英雄受到治疗
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat)
|
||||
--巅峰争霸赛和切磋超时改为只判断总伤害,不再判断总治疗
|
||||
|
@ -93,6 +94,7 @@ function BattleLogic.Init(data, _userData, maxRound)
|
|||
allEnemyDamage=allEnemyDamage+damage
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
@ -101,6 +103,15 @@ function BattleLogic.GetAllDamage()
|
|||
return allHeroDamage, allEnemyDamage
|
||||
end
|
||||
|
||||
--获取我方灵兽数据
|
||||
function BattleLogic.GetPlayerMonsterData()
|
||||
return fightData.playerData.monsterList
|
||||
end
|
||||
|
||||
--获取精英副本星级记录
|
||||
function BattleLogic.GetHardLevelStarRecord()
|
||||
return levelStarRecord
|
||||
end
|
||||
|
||||
-- 检测先手阵营
|
||||
function BattleLogic.CheckFirstCamp()
|
||||
|
@ -439,13 +450,28 @@ function BattleLogic.BattleEnd(result)
|
|||
BattleLogic.IsEnd = true
|
||||
BattleLogic.Result = result
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleEnd, result)
|
||||
|
||||
if hardStageId and hardStageId~=0 then
|
||||
--获取精英副本 星级信息
|
||||
local hardStageConfig=ConfigManager.GetConfigData(ConfigName.HardStage,hardStageId)
|
||||
if hardStageConfig then
|
||||
if hardStageConfig.ConditionValue then
|
||||
for i = 1, #hardStageConfig.ConditionValue do
|
||||
local harConfig = ConfigManager.GetConfigData(ConfigName.HardStageCondition,hardStageConfig.ConditionValue[i])
|
||||
local v1=HardStageCondition.CheckCondition(harConfig.ConditionType,harConfig.ConditionValue)
|
||||
table.insert(levelStarRecord,hardStageConfig.ConditionValue[i])
|
||||
table.insert(levelStarRecord,v1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 打印结果
|
||||
BattleLogic.LogResult(result)
|
||||
-- 战斗日志写入
|
||||
if not BattleLogic.GetIsDebug() then
|
||||
BattleLogManager.WriteLogToFile()
|
||||
end
|
||||
HardStageEventManager.ClearEvent()
|
||||
end
|
||||
|
||||
-- 打印战斗结果
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
HardStageCondition = {}
|
||||
local this = HardStageCondition
|
||||
|
||||
local _ConditionConfig = {
|
||||
--通过关卡
|
||||
[1]=function(condition)
|
||||
if BattleLogic.Result==1 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--[a]回合内通过关卡
|
||||
[2]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local round,maxRound=BattleLogic.GetCurRound()
|
||||
if round<=v1 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--上阵[a]个神将通过关卡
|
||||
[3]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 end)
|
||||
if BattleUtil.LengthOfTable(list)<=v1 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--[a]回合内造成[b]伤害
|
||||
[4]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local v2 = condition[2]
|
||||
local record=HardStageEventManager.GetRoundDamageRecord()
|
||||
if record then
|
||||
for key, value in pairs(record) do
|
||||
if key<=v1 and value[2]>=v2 then
|
||||
return 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--使用指定[a]系神将[b]名
|
||||
[5]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local v2 = condition[2]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end)
|
||||
if BattleUtil.LengthOfTable(list)>=v2 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--存活[a]名
|
||||
[6]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 and not v:IsDead() end)
|
||||
if BattleUtil.LengthOfTable(list)>=v1 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--不上阵[a]职能神将通过关卡
|
||||
[7]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId==v1 end)
|
||||
if BattleUtil.LengthOfTable(list)==0 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--不上阵[a]阵营神将通过关卡
|
||||
[8]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end)
|
||||
if BattleUtil.LengthOfTable(list)==0 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--佩戴xxxid被动通过关卡
|
||||
[9]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 end)
|
||||
if not list or #list==0 then
|
||||
return 0
|
||||
end
|
||||
for i = 1, #list do
|
||||
local isHave=list[i]:CheckHavePassive(v1)
|
||||
if isHave then
|
||||
return 1
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
--不使用灵兽通过关卡
|
||||
[10]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local data=BattleLogic.GetPlayerMonsterData()
|
||||
if data and BattleUtil.LengthOfTable(data)>v1 then
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
--全部上阵[a]职业神将通过关卡
|
||||
[11]=function(condition)
|
||||
local v1 = condition[1]
|
||||
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId~=v1 end)
|
||||
if BattleUtil.LengthOfTable(list)==0 then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- 条件检测
|
||||
function HardStageCondition.CheckCondition(type,condition)
|
||||
--LogError("*************".. type.." "..condition)
|
||||
if not condition then
|
||||
return true
|
||||
end
|
||||
-- local v1 = condition[1]
|
||||
-- local v2 = condition[2]
|
||||
-- local v3 = condition[3]
|
||||
return _ConditionConfig[type](condition)
|
||||
end
|
||||
|
||||
return HardStageCondition
|
|
@ -0,0 +1,43 @@
|
|||
HardStageEventManager = {}
|
||||
local this = HardStageEventManager
|
||||
local CurRound
|
||||
--记录的回合数
|
||||
local recordRound=1
|
||||
local roundDamage=0
|
||||
--记录的回合伤害
|
||||
local recordRoundDamage
|
||||
function this.Init()
|
||||
recordRound=1
|
||||
roundDamage=0
|
||||
recordRoundDamage={}
|
||||
BattleLogic.Event:AddEvent(BattleEventName.RecordDamage,this.OnRecordDamage)
|
||||
end
|
||||
|
||||
function this.ClearEvent()
|
||||
BattleLogic.Event:RemoveEvent(BattleEventName.RecordDamage,this.OnRecordDamage)
|
||||
end
|
||||
--记录伤害
|
||||
function this.OnRecordDamage(atkRole,defRole,damage)
|
||||
if not atkRole or atkRole.camp==1 then
|
||||
return
|
||||
end
|
||||
local curRound,maxRound=BattleLogic.GetCurRound()
|
||||
CurRound=curRound
|
||||
--如果进入下一回合,记录上一回合的伤害
|
||||
if CurRound==recordRound+1 then
|
||||
table.insert(recordRoundDamage,{recordRound,roundDamage})
|
||||
recordRound=CurRound
|
||||
end
|
||||
roundDamage=roundDamage+damage
|
||||
end
|
||||
|
||||
--获取回合伤害记录
|
||||
function this.GetRoundDamageRecord()
|
||||
--如果一回合就结束战斗了,就直接把记录的回合数伤害加进去
|
||||
if CurRound==1 then
|
||||
table.insert(recordRoundDamage,{recordRound,roundDamage})
|
||||
end
|
||||
return recordRoundDamage
|
||||
end
|
||||
|
||||
return HardStageEventManager
|
|
@ -1,3 +1,16 @@
|
|||
v1.0.31
|
||||
1. 添加精英副本相关战斗逻辑
|
||||
v1.0.30
|
||||
1. 同步客户端被动表lua文件
|
||||
v1.0.29
|
||||
1、新增客户端数据文件,客户端数据解析文件
|
||||
1、被动新增 313,用于动态从表数据里面抓取被动数据
|
||||
v1.0.28
|
||||
1、BattleMain添加测试接口
|
||||
v1.0.27
|
||||
1、清除轮转方法,防止收到上一局战斗的影响
|
||||
v1.0.26
|
||||
1、合并海外战斗内容
|
||||
v1.0.25
|
||||
1、选择单个对位目标修改
|
||||
v1.0.24
|
||||
|
|
|
@ -23,6 +23,6 @@ public class HardStageInfoRequestHandler extends BaseHandler<PlayerInfoProto.Har
|
|||
CommonProto.HardStageInfo.Builder info = HardStageLogic.getInfo(user);
|
||||
PlayerInfoProto.HardStageResponse.Builder response = PlayerInfoProto.HardStageResponse.newBuilder();
|
||||
response.setInfo(info);
|
||||
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,14 @@ import com.ljsd.jieling.logic.fight.FightUtil;
|
|||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageChapter;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageNode;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.FightDataUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
import config.SHardStage;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.luaj.vm2.lib.jse.JseMathLib;
|
||||
import rpc.protocols.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -44,60 +46,70 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
List<CommonProto.Drop.Builder> dropList = new ArrayList<>();
|
||||
SHardStage nodeConfig = SHardStage.getConfigMap().get(nodeId);
|
||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap(user);
|
||||
if(!chapterMap.containsKey(nodeConfig.getChapter()) || chapterMap.get(nodeConfig.getChapter()).getNode(nodeId) == null){
|
||||
if (!chapterMap.containsKey(nodeConfig.getChapter()) || chapterMap.get(nodeConfig.getChapter()).getNode(nodeId) == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("节点信息错误 节点不存在或未开启"));
|
||||
}
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
PlayerInfoProto.HardStageFightResponse.Builder fightStartResponse = PlayerInfoProto.HardStageFightResponse.newBuilder();
|
||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("阵容有误!!"));
|
||||
}
|
||||
if(nodeConfig.getStageType() == 2){//直接发奖励
|
||||
HardStageLogic.passNode(iSession,nodeConfig,0,dropList);
|
||||
return;
|
||||
}
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = HardStageLogic.getFightTeamInfo(user,teamId,nodeConfig);
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterfightTeamInfos = MonsterUtil.getHardStageMonsterByGroup(nodeConfig);
|
||||
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(nodeConfig.getMonsterGroup());
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(monsterfightTeamInfos,monsterPokemonByGroup, Global.MONSTER_1);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = HardStageLogic.getFightTeamInfo(user, teamId, nodeConfig);
|
||||
//直接发奖励
|
||||
if (nodeConfig.getStageType() == 2) {
|
||||
Map<Integer, HardStageChapter> chapt = user.getHardStageManager().getChapterMap(user);
|
||||
HardStageNode node = chapt.get(nodeConfig.getChapter()).getNode(nodeConfig.getId());
|
||||
node.setHasPass(true);
|
||||
dropList.addAll(HardStageLogic.getFirstRewards(user, nodeConfig));
|
||||
} else if (nodeConfig.getStageType() == 1 || nodeConfig.getStageType() == 3) {
|
||||
//战斗后发奖励
|
||||
int seed = (int) (System.currentTimeMillis() / 1000);
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterfightTeamInfos = MonsterUtil.getHardStageMonsterByGroup(nodeConfig);
|
||||
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(nodeConfig.getMonsterGroup());
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(monsterfightTeamInfos, monsterPokemonByGroup, Global.MONSTER_1);
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
getFightData.set("nodeId", nodeId);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(user.getId() + "");
|
||||
long[][] fight = CheckFight.getInstance().checkHardStageFight(seed, 20, getFightData, getOptionData, FightType.HardStage);
|
||||
int[] resultNum = new int[3];
|
||||
resultNum[0] = (int) fight[1][1];
|
||||
resultNum[1] = (int) fight[1][3];
|
||||
resultNum[2] = (int) fight[1][5];
|
||||
System.err.print("0:" + resultNum[0] + "1:" + resultNum[1] + "2:" + resultNum[2]);
|
||||
int resultCode = (int) fight[0][0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
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);
|
||||
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||
getFightData.set("nodeId",nodeId);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(user.getId()+"");
|
||||
long[][] fightResult = CheckFight.getInstance().checkHardStageFight(seed, 20, getFightData, getOptionData, FightType.HardStage);
|
||||
|
||||
int resultCode = (int) fightResult[0][0];
|
||||
if (resultCode == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
int resultNum = (int)fightResult[1][1]+(int)fightResult[1][3]+(int)fightResult[1][5];
|
||||
if(resultCode == 1){//通过
|
||||
HardStageLogic.passNode(iSession,nodeConfig,resultNum,dropList);
|
||||
}else{
|
||||
HardStageLogic.passNode(iSession,nodeConfig,0,dropList);
|
||||
String fightId = FightUtil.getFightId(user.getId(), FightType.HardStage.getType());
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightType(FightType.HardStage.getType())
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addAllMonsterList(monsterGroupList)
|
||||
.setFightSeed(seed)
|
||||
.setFightMaxTime(20)
|
||||
.setFightId(fightId)
|
||||
.build();
|
||||
fightStartResponse.setFightData(fightData);
|
||||
FightRecordLogic.getInstance().addRecordMap(user, fightData);
|
||||
}
|
||||
|
||||
|
||||
String fightInfo = nodeId + "#" +seed+ "#" + teamId;
|
||||
String key = RedisKey.getKey(RedisKey.HARD_STAGE_BATTLE, String.valueOf(iSession.getUid()), false);
|
||||
RedisUtil.getInstence().set(key, fightInfo, -1);
|
||||
|
||||
PlayerInfoProto.HardStageFightResponse.Builder fightStartResponse = PlayerInfoProto.HardStageFightResponse.newBuilder();
|
||||
String fightId = FightUtil.getFightId(user.getId(),FightType.HardStage.getType());
|
||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||
.setFightType(FightType.HardStage.getType())
|
||||
.setHeroFightInfos(fightTeamInfo)
|
||||
.addAllMonsterList(monsterGroupList)
|
||||
.setFightSeed(seed)
|
||||
.setFightMaxTime(20)
|
||||
.setFightId(fightId)
|
||||
.build();
|
||||
fightStartResponse.setFightData(fightData);
|
||||
for(CommonProto.Drop.Builder drop : dropList){
|
||||
for (CommonProto.Drop.Builder drop : dropList) {
|
||||
fightStartResponse.addDrop(drop);
|
||||
}
|
||||
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
||||
|
||||
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.HARD_STAGE_FIGHT_START_RESPONSE.getNumber(), fightStartResponse.build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_FIGHT_START_RESPONSE.getNumber(), fightStartResponse.build(), true);
|
||||
//更新消息
|
||||
CommonProto.HardStageInfo.Builder info = HardStageLogic.getInfo(user);
|
||||
PlayerInfoProto.HardStageResponse.Builder response = PlayerInfoProto.HardStageResponse.newBuilder();
|
||||
response.setInfo(info);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,69 +15,80 @@ public class HardStageManager extends MongoBase {
|
|||
private int curChapter;
|
||||
private int curNode;
|
||||
|
||||
private Map<Integer, HardStageChapter> chapterMap ;//山河玩家信息
|
||||
private Map<Integer, HardStageChapter> chapterMap;//山河玩家信息
|
||||
|
||||
|
||||
public HardStageManager(){
|
||||
public HardStageManager() {
|
||||
}
|
||||
public Map<Integer, HardStageChapter> getChapterMap(User user) throws Exception{
|
||||
if(null == chapterMap ||chapterMap.size()<1){
|
||||
|
||||
public Map<Integer, HardStageChapter> getChapterMap(User user) throws Exception {
|
||||
if (null == chapterMap || chapterMap.size() < 1) {
|
||||
Map<Integer, HardStageChapter> map = initChapterMap(user);
|
||||
chapterMap = map;
|
||||
}
|
||||
return chapterMap;
|
||||
}
|
||||
|
||||
private Map<Integer, HardStageChapter> initChapterMap(User user) throws Exception{
|
||||
private Map<Integer, HardStageChapter> initChapterMap(User user) throws Exception {
|
||||
Map<Integer, HardStageChapter> map = new HashMap<>();
|
||||
SHardStage nodeOne = SHardStage.getConfigMap().get(1);//第一个节点
|
||||
if(user.getPlayerInfoManager().getLevel()<nodeOne.getLevelLimit()){
|
||||
if (user.getPlayerInfoManager().getLevel() < nodeOne.getLevelLimit()) {
|
||||
return map;
|
||||
}
|
||||
HardStageNode node = initNode(nodeOne);
|
||||
//初始化第一章第一节
|
||||
|
||||
HardStageChapter chapter = initChapter(nodeOne.getChapter());
|
||||
chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
HardStageNode node = initNode(nodeOne, chapter.getChapterId());
|
||||
//chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
||||
chapter.addNodeList(node);
|
||||
setCurNode(node.getId());
|
||||
map.put(chapter.getChapterId(),chapter);
|
||||
map.put(chapter.getChapterId(), chapter);
|
||||
setCurChapter(chapter.getChapterId());
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapter);
|
||||
return map;
|
||||
}
|
||||
|
||||
private HardStageNode initNode(SHardStage config){
|
||||
private HardStageNode initNode(SHardStage config, int chapterId) {
|
||||
HardStageNode node = new HardStageNode();
|
||||
//node.init(this.getRootId(),getMongoKey()+".chapterMap."+chapterId+".nodeList");
|
||||
node.setId(config.getId());
|
||||
node.setType(config.getStageType());
|
||||
if(node.getType() == 1){
|
||||
node.getRewardMap().put(config.getReward1()[0],Boolean.FALSE);
|
||||
node.getRewardMap().put(config.getReward1()[1],Boolean.FALSE);
|
||||
node.getRewardMap().put(config.getReward1()[2],Boolean.FALSE);
|
||||
if (node.getType() == 1) {
|
||||
node.getRewardMap().put(config.getReward1()[0], Boolean.FALSE);
|
||||
node.getRewardMap().put(config.getReward1()[1], Boolean.FALSE);
|
||||
node.getRewardMap().put(config.getReward1()[2], Boolean.FALSE);
|
||||
}
|
||||
setCurNode(config.getId());
|
||||
return node;
|
||||
}
|
||||
|
||||
private HardStageChapter initChapter(int chapterId){
|
||||
private HardStageChapter initChapter(int chapterId) {
|
||||
HardStageChapter chapter = new HardStageChapter();
|
||||
chapter.setChapterId(chapterId);
|
||||
chapter.init(this.getRootId(), getMongoKey() + ".chapterMap." + chapter.getChapterId());
|
||||
List<SHardStageReward> reward = SHardStageReward.getChapterConfigMap().get(chapterId);
|
||||
for(SHardStageReward config : reward){
|
||||
chapter.getRewardMap().put(config.getStarReward(),Boolean.FALSE);
|
||||
for (SHardStageReward config : reward) {
|
||||
chapter.getRewardMap().put(config.getStarReward(), Boolean.FALSE);
|
||||
chapter.updateRewardMap();
|
||||
}
|
||||
setCurChapter(chapterId);
|
||||
return chapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 满足条件开启新节点
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
public void openNewNode(User user,SHardStage config){
|
||||
if(user.getPlayerInfoManager().getLevel()<config.getLevelLimit()){
|
||||
public void openNewNode(User user, SHardStage config) {
|
||||
if (user.getPlayerInfoManager().getLevel() < config.getLevelLimit()) {
|
||||
return;
|
||||
}
|
||||
HardStageChapter chapter ;
|
||||
if(chapterMap.containsKey(config.getChapter())){
|
||||
HardStageChapter chapter;
|
||||
chapter = chapterMap.computeIfAbsent(config.getChapter(), k -> initChapter(config.getChapter()));
|
||||
HardStageNode node = initNode(config, chapter.getChapterId());
|
||||
chapter.addNodeList(node);
|
||||
/*if(chapterMap.containsKey(config.getChapter())){
|
||||
chapter = chapterMap.get(config.getChapter());
|
||||
HardStageNode node = initNode(config);
|
||||
chapter.addNodeList(node);
|
||||
|
@ -91,8 +102,8 @@ public class HardStageManager extends MongoBase {
|
|||
setCurNode(node.getId());
|
||||
chapterMap.put(config.getChapter(),chapter);
|
||||
setCurChapter(chapter.getChapterId());
|
||||
}
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapterMap);
|
||||
}*/
|
||||
updateString("chapterMap." + chapter.getChapterId(), chapterMap.get(chapter.getChapterId()));
|
||||
}
|
||||
|
||||
public int getCurChapter() {
|
||||
|
@ -101,7 +112,7 @@ public class HardStageManager extends MongoBase {
|
|||
|
||||
public void setCurChapter(int curChapter) {
|
||||
this.curChapter = curChapter;
|
||||
updateString("curChapter" ,curChapter);
|
||||
updateString("curChapter", curChapter);
|
||||
}
|
||||
|
||||
public int getCurNode() {
|
||||
|
@ -110,6 +121,6 @@ public class HardStageManager extends MongoBase {
|
|||
|
||||
public void setCurNode(int curNode) {
|
||||
this.curNode = curNode;
|
||||
updateString("curNode" ,curNode);
|
||||
updateString("curNode", curNode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class HardStageChapter extends MongoBase {
|
|||
|
||||
private int stars;
|
||||
|
||||
private Map<Integer,Boolean> rewardMap = new HashMap<>();
|
||||
private Map<Integer, Boolean> rewardMap = new HashMap<>();
|
||||
|
||||
public int getChapterId() {
|
||||
return chapterId;
|
||||
|
@ -31,8 +31,8 @@ public class HardStageChapter extends MongoBase {
|
|||
|
||||
public void addNodeList(HardStageNode node) {
|
||||
this.nodeList.add(node);
|
||||
node.init(this.getRootId(), getMongoKey() + ".nodeList." + node.getId());
|
||||
updateString("nodeList" ,nodeList);
|
||||
//node.init(this.getRootId(), getMongoKey() + ".nodeList." + node.getId());
|
||||
updateString("nodeList", nodeList);
|
||||
}
|
||||
|
||||
public int getStars() {
|
||||
|
@ -41,7 +41,7 @@ public class HardStageChapter extends MongoBase {
|
|||
|
||||
public void addStars(int stars) {
|
||||
this.stars += stars;
|
||||
updateString("stars" , this.stars);
|
||||
updateString("stars", this.stars);
|
||||
}
|
||||
|
||||
public Map<Integer, Boolean> getRewardMap() {
|
||||
|
@ -49,12 +49,12 @@ public class HardStageChapter extends MongoBase {
|
|||
}
|
||||
|
||||
public void updateRewardMap() {
|
||||
updateString("rewardMap" , this.rewardMap);
|
||||
updateString("rewardMap", this.rewardMap);
|
||||
}
|
||||
|
||||
public HardStageNode getNode(int id){
|
||||
for(HardStageNode node : nodeList){
|
||||
if(node.getId() == id){
|
||||
public HardStageNode getNode(int id) {
|
||||
for (HardStageNode node : nodeList) {
|
||||
if (node.getId() == id) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,24 +33,25 @@ public class HardStageLogic {
|
|||
/**
|
||||
* 获取山河社稷图信息
|
||||
*/
|
||||
public static CommonProto.HardStageInfo.Builder getInfo(User user) throws Exception{
|
||||
public static CommonProto.HardStageInfo.Builder getInfo(User user) throws Exception {
|
||||
Map<Integer, HardStageChapter> map = user.getHardStageManager().getChapterMap(user);
|
||||
CommonProto.HardStageInfo.Builder builder = CommonProto.HardStageInfo.newBuilder();
|
||||
for(Map.Entry<Integer,HardStageChapter> entry : map.entrySet()){
|
||||
for (Map.Entry<Integer, HardStageChapter> entry : map.entrySet()) {
|
||||
CommonProto.HardStageChapter.Builder chapterBuilder = CommonProto.HardStageChapter.newBuilder();
|
||||
for(HardStageNode node : entry.getValue().getNodeList()){
|
||||
for (HardStageNode node : entry.getValue().getNodeList()) {
|
||||
CommonProto.HardStageNode.Builder nodeBuilder = CommonProto.HardStageNode.newBuilder();
|
||||
nodeBuilder.setNodeId(node.getId());
|
||||
nodeBuilder.setType(node.getType());
|
||||
nodeBuilder.setState(node.getState());
|
||||
nodeBuilder.setIsFirst(node.isHasPass());
|
||||
chapterBuilder.addNode(nodeBuilder);
|
||||
}
|
||||
chapterBuilder.setChapterId(entry.getKey());
|
||||
chapterBuilder.setStars(entry.getValue().getStars());
|
||||
for(Map.Entry<Integer,Boolean> entry1 : entry.getValue().getRewardMap().entrySet()){
|
||||
for (Map.Entry<Integer, Boolean> entry1 : entry.getValue().getRewardMap().entrySet()) {
|
||||
CommonProto.HardStageChapterReward.Builder rewardBuilder = CommonProto.HardStageChapterReward.newBuilder();
|
||||
rewardBuilder.setId(entry1.getKey());
|
||||
rewardBuilder.setState(entry1.getValue()?1:0);
|
||||
rewardBuilder.setState(entry1.getValue() ? 1 : 0);
|
||||
}
|
||||
builder.addChapter(chapterBuilder);
|
||||
}
|
||||
|
@ -60,57 +61,57 @@ public class HardStageLogic {
|
|||
/**
|
||||
* 添加战斗规则
|
||||
*/
|
||||
public static void fight(ISession session, int teamId, int nodeId){
|
||||
public static void fight(ISession session, int teamId, int nodeId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取章节奖励
|
||||
*/
|
||||
public static void getChapterReward(User user,SHardStageReward rewardStage,List<CommonProto.Drop.Builder> list) throws Exception{
|
||||
public static void getChapterReward(User user, SHardStageReward rewardStage, List<CommonProto.Drop.Builder> list) throws Exception {
|
||||
HardStageChapter chapter = user.getHardStageManager().getChapterMap(user).get(rewardStage.getChapter());
|
||||
if(chapter.getStars() < rewardStage.getStar()){
|
||||
if (chapter.getStars() < rewardStage.getStar()) {
|
||||
LOGGER.error("章节星星数量不足");
|
||||
return;
|
||||
}
|
||||
if(!chapter.getRewardMap().get(rewardStage.getStarReward())){
|
||||
chapter.getRewardMap().put(rewardStage.getStarReward(),true);
|
||||
if (!chapter.getRewardMap().get(rewardStage.getStarReward())) {
|
||||
chapter.getRewardMap().put(rewardStage.getStarReward(), true);
|
||||
chapter.updateRewardMap();
|
||||
list.add(getReward(user,rewardStage.getStarReward()));
|
||||
list.add(getReward(user, rewardStage.getStarReward()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 回放
|
||||
*/
|
||||
public static void getHSReport(){
|
||||
public static void getHSReport() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断奖励
|
||||
*/
|
||||
public static int passReward(User user,HardStageNode node,int num,List<CommonProto.Drop.Builder> dropList) throws Exception{
|
||||
public static int passReward(User user, HardStageNode node, int[] num, List<CommonProto.Drop.Builder> dropList) throws Exception {
|
||||
int addStar = 0;
|
||||
SHardStage config = SHardStage.getConfigMap().get(node.getId());
|
||||
if(num>>2 == 1){//第一星
|
||||
if (num[0] == 1) {//第一星
|
||||
int rewardId = config.getReward1()[0];
|
||||
if(addDropAndStar(node,dropList,rewardId,user)){
|
||||
node.setState(node.getState()+4);
|
||||
addStar++;
|
||||
if (addDropAndStar(node, dropList, rewardId, user)) {
|
||||
node.setState(node.getState() + 4);
|
||||
addStar += 4;
|
||||
}
|
||||
}
|
||||
if((num&2) == 2){//第二星
|
||||
if (num[1] == 1) {//第二星
|
||||
int rewardId = config.getReward1()[1];
|
||||
if(addDropAndStar(node,dropList,rewardId,user)){
|
||||
node.setState(node.getState()+2);
|
||||
addStar++;
|
||||
if (addDropAndStar(node, dropList, rewardId, user)) {
|
||||
node.setState(node.getState() + 2);
|
||||
addStar += 2;
|
||||
}
|
||||
}
|
||||
if(num<<2 == 1){//第三星
|
||||
if (num[2] == 1) {//第三星
|
||||
int rewardId = config.getReward1()[2];
|
||||
if(addDropAndStar(node,dropList,rewardId,user)){
|
||||
node.setState(node.getState()+1);
|
||||
if (addDropAndStar(node, dropList, rewardId, user)) {
|
||||
node.setState(node.getState() + 1);
|
||||
addStar++;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +122,7 @@ public class HardStageLogic {
|
|||
/**
|
||||
* 获取己方teamfight
|
||||
*/
|
||||
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId,SHardStage nodeConfig) {
|
||||
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId, SHardStage nodeConfig) {
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
|
@ -135,21 +136,21 @@ public class HardStageLogic {
|
|||
Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||
StringBuilder skillSb = new StringBuilder();
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
HeroLogic.getInstance().getHeroSkills(user,hero,skillSb);
|
||||
HeroLogic.getInstance().getHeroSkills(user, hero, skillSb);
|
||||
|
||||
if(nodeConfig.getHardStageBuff() != 0){
|
||||
if (nodeConfig.getHardStageBuff() != 0) {
|
||||
SHardStageBuff buff = SHardStageBuff.getConfigMap().get(nodeConfig.getHardStageBuff());
|
||||
if(buff.getType()==2 || buff.getType()==3){
|
||||
if (buff.getType() == 2 || buff.getType() == 3) {
|
||||
skillSb.append(buff.getPassiveSkillLogic()).append("#");
|
||||
}
|
||||
}
|
||||
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getTemplateId(),hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
|
||||
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getTemplateId(), hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
.setUnitSkillIds(skillSb.substring(0,skillSb.length()-1))
|
||||
.setProperty(property.substring(0, property.length()-1))
|
||||
.setUnitSkillIds(skillSb.substring(0, skillSb.length() - 1))
|
||||
.setProperty(property.substring(0, property.length() - 1))
|
||||
.setPosition(teamPosHeroInfo.getPosition())
|
||||
.setStar(hero.getStar())
|
||||
.setSkinId(hero.getSkin())
|
||||
|
@ -165,46 +166,55 @@ public class HardStageLogic {
|
|||
.addAllFightUnitList(heroFightInfos)
|
||||
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
|
||||
.setTeamPassiveList(pokenmonPassiveSkills)
|
||||
.setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId,user))
|
||||
.setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId, user))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过节点
|
||||
*/
|
||||
public static void passNode(ISession iSession, SHardStage nodeConfig, int resultNum,List<CommonProto.Drop.Builder> dropList) throws Exception{
|
||||
public static void passNode(ISession iSession, SHardStage nodeConfig, int[] resultNum, List<CommonProto.Drop.Builder> dropList) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if(user == null){
|
||||
return;
|
||||
}
|
||||
Map<Integer, HardStageChapter> chapterMap = user.getHardStageManager().getChapterMap(user);
|
||||
HardStageNode node = chapterMap.get(nodeConfig.getChapter()).getNode(nodeConfig.getId());
|
||||
if(node.getType() == 1){//大节点
|
||||
int star = passReward(user,node,resultNum,dropList);
|
||||
if (node.getType() == 1) {//大节点
|
||||
int star = passReward(user, node, resultNum, dropList);//星级通关奖励
|
||||
chapterMap.get(nodeConfig.getChapter()).addStars(star);
|
||||
if(!node.isHasPass()){
|
||||
if (!node.isHasPass()) {
|
||||
node.setHasPass(true);
|
||||
dropList.addAll(getFirstRewards(user,nodeConfig));
|
||||
dropList.addAll(getFirstRewards(user, nodeConfig));//关卡通过奖励
|
||||
//SHardStage nextNodeConfig = SHardStage.getConfigMap().get(nodeConfig.getNextLevel());
|
||||
SHardStage.getPreList(nodeConfig.getId()).stream().forEach(n -> {
|
||||
if (n != null) {
|
||||
user.getHardStageManager().openNewNode(user, n);
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if(node.isHasPass()){
|
||||
} else {
|
||||
if (node.isHasPass()) {
|
||||
return;
|
||||
}
|
||||
node.setHasPass(true);
|
||||
dropList.addAll(getFirstRewards(user,nodeConfig));
|
||||
//node.setHasPass(true);
|
||||
//dropList.addAll(getFirstRewards(user,nodeConfig));
|
||||
}
|
||||
|
||||
List<SHardStage> openList = SHardStage.getPreList(nodeConfig.getId());
|
||||
/* List<SHardStage> openList = SHardStage.getPreList(nodeConfig.getId());
|
||||
for(SHardStage stage : openList){
|
||||
user.getHardStageManager().openNewNode(user,stage);
|
||||
}
|
||||
}*/
|
||||
sendHardStageIndication(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首通奖励
|
||||
*/
|
||||
public static List<CommonProto.Drop.Builder> getFirstRewards(User user,SHardStage nodeConfig) throws Exception{
|
||||
public static List<CommonProto.Drop.Builder> getFirstRewards(User user, SHardStage nodeConfig) throws Exception {
|
||||
List<CommonProto.Drop.Builder> dropList = new ArrayList<>();
|
||||
for(int rewardId : nodeConfig.getPassReward()){
|
||||
dropList.add(getReward(user,rewardId));
|
||||
for (int rewardId : nodeConfig.getPassReward()) {
|
||||
dropList.add(getReward(user, rewardId));
|
||||
}
|
||||
return dropList;
|
||||
}
|
||||
|
@ -212,18 +222,18 @@ public class HardStageLogic {
|
|||
/**
|
||||
* 获取奖励
|
||||
*/
|
||||
public static CommonProto.Drop.Builder getReward(User user,int rewardId) throws Exception{
|
||||
public static CommonProto.Drop.Builder getReward(User user, int rewardId) throws Exception {
|
||||
SRewardGroup rewardGroup = SRewardGroup.getsRewardItemMap().get(rewardId);
|
||||
ItemMap itemObj = new ItemMap();
|
||||
//ItemMap itemObj = new ItemMap();
|
||||
int[] dropList = rewardGroup.getRewardItem();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.HARD_STAGE_GET);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList, 1, 0, BIReason.HARD_STAGE_GET);
|
||||
return drop;
|
||||
}
|
||||
|
||||
private static boolean addDropAndStar(HardStageNode node,List<CommonProto.Drop.Builder> dropList,int rewardId,User user) throws Exception{
|
||||
if(!node.getRewardMap().get(rewardId)){
|
||||
dropList.add(getReward(user,rewardId));
|
||||
node.getRewardMap().put(rewardId,true);
|
||||
private static boolean addDropAndStar(HardStageNode node, List<CommonProto.Drop.Builder> dropList, int rewardId, User user) throws Exception {
|
||||
if (node.getRewardMap().get(rewardId)) {
|
||||
dropList.add(getReward(user, rewardId));
|
||||
node.getRewardMap().put(rewardId, true);
|
||||
node.updateRewardMap();
|
||||
return true;
|
||||
}
|
||||
|
@ -235,22 +245,22 @@ public class HardStageLogic {
|
|||
PlayerInfoProto.HardStageResponse.Builder response = PlayerInfoProto.HardStageResponse.newBuilder();
|
||||
response.setInfo(info);
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(),response.build(),true);
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 升级刷新
|
||||
*/
|
||||
public static void refreshInfoByLevel(User user) throws Exception{
|
||||
public static void refreshInfoByLevel(User user) throws Exception {
|
||||
int curNodeId = user.getHardStageManager().getCurNode();
|
||||
if(curNodeId == 0){
|
||||
if (curNodeId == 0) {
|
||||
user.getHardStageManager().getChapterMap(user);
|
||||
}else{
|
||||
SHardStage nodeConfig = SHardStage.getConfigMap().get(curNodeId);
|
||||
} else {
|
||||
/*SHardStage nodeConfig = SHardStage.getConfigMap().get(curNodeId);
|
||||
List<SHardStage> openList = SHardStage.getPreList(nodeConfig.getId());
|
||||
for(SHardStage stage : openList){
|
||||
user.getHardStageManager().openNewNode(user,stage);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
sendHardStageIndication(user);
|
||||
}
|
||||
|
|
|
@ -8,122 +8,123 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HardStage")
|
||||
@Table(name = "HardStage")
|
||||
public class SHardStage implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int id;
|
||||
|
||||
private int chapter;
|
||||
private int chapter;
|
||||
|
||||
private int section;
|
||||
private int section;
|
||||
|
||||
private String picture ;
|
||||
private String picture;
|
||||
|
||||
private int repeat ;
|
||||
private int repeat;
|
||||
|
||||
private int nextLevel;
|
||||
private int nextLevel;
|
||||
|
||||
private int levelLimit;
|
||||
private int levelLimit;
|
||||
|
||||
private int star ;
|
||||
private int star;
|
||||
|
||||
private int monsterGroup;
|
||||
private int monsterGroup;
|
||||
|
||||
private int hardStageBuff;
|
||||
private int hardStageBuff;
|
||||
|
||||
private int recommendFightAbility;
|
||||
private int recommendFightAbility;
|
||||
|
||||
private int[] passReward;
|
||||
private int[] passReward;
|
||||
|
||||
private int stageType;
|
||||
private int stageType;
|
||||
|
||||
private int[] conditionValue;
|
||||
private int[] conditionValue;
|
||||
|
||||
private int[] reward1;
|
||||
private int[] reward1;
|
||||
|
||||
private static Map<Integer,SHardStage> configMap ;
|
||||
private static Map<Integer, List<SHardStage>> preConfigMap;
|
||||
private static Map<Integer, SHardStage> configMap;
|
||||
private static Map<Integer, List<SHardStage>> preConfigMap;
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SHardStage> tempConfig = STableManager.getConfig(SHardStage.class);
|
||||
Map<Integer, List<SHardStage>> tempPreConfigMap = new HashMap<>();
|
||||
for(SHardStage stage : tempConfig.values()){
|
||||
if(stage.getNextLevel() > 0){
|
||||
if(tempPreConfigMap.containsKey(stage.getNextLevel())){
|
||||
for (SHardStage stage : tempConfig.values()) {
|
||||
if (stage.getNextLevel() > 0) {
|
||||
if (tempPreConfigMap.containsKey(stage.getNextLevel())) {
|
||||
tempPreConfigMap.get(stage.getNextLevel()).add(stage);
|
||||
}else{
|
||||
} else {
|
||||
List<SHardStage> list = new ArrayList<>();
|
||||
list.add(stage);
|
||||
tempPreConfigMap.put(stage.getNextLevel(),list);
|
||||
tempPreConfigMap.put(stage.getNextLevel(), list);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(null == configMap){
|
||||
if (null == configMap) {
|
||||
configMap = tempConfig;
|
||||
preConfigMap = tempPreConfigMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getChapter() {
|
||||
public int getChapter() {
|
||||
return chapter;
|
||||
}
|
||||
|
||||
public int getSection() {
|
||||
public int getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public String getPicture () {
|
||||
return picture ;
|
||||
public String getPicture() {
|
||||
return picture;
|
||||
}
|
||||
|
||||
public int getRepeat () {
|
||||
return repeat ;
|
||||
public int getRepeat() {
|
||||
return repeat;
|
||||
}
|
||||
|
||||
public int getNextLevel() {
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public int getNextLevel() {
|
||||
return nextLevel;
|
||||
}
|
||||
|
||||
public int getLevelLimit() {
|
||||
public int getLevelLimit() {
|
||||
return levelLimit;
|
||||
}
|
||||
|
||||
public int getStar () {
|
||||
return star ;
|
||||
}
|
||||
|
||||
public int getMonsterGroup() {
|
||||
public int getMonsterGroup() {
|
||||
return monsterGroup;
|
||||
}
|
||||
|
||||
public int getHardStageBuff() {
|
||||
public int getHardStageBuff() {
|
||||
return hardStageBuff;
|
||||
}
|
||||
|
||||
public int getRecommendFightAbility() {
|
||||
public int getRecommendFightAbility() {
|
||||
return recommendFightAbility;
|
||||
}
|
||||
|
||||
public int[] getPassReward() {
|
||||
public int[] getPassReward() {
|
||||
return passReward;
|
||||
}
|
||||
|
||||
public int getStageType() {
|
||||
public int getStageType() {
|
||||
return stageType;
|
||||
}
|
||||
|
||||
public int[] getConditionValue() {
|
||||
public int[] getConditionValue() {
|
||||
return conditionValue;
|
||||
}
|
||||
|
||||
public int[] getReward1() {
|
||||
public int[] getReward1() {
|
||||
return reward1;
|
||||
}
|
||||
|
||||
|
@ -135,7 +136,7 @@ public class SHardStage implements BaseConfig {
|
|||
return preConfigMap;
|
||||
}
|
||||
|
||||
public static List<SHardStage> getPreList(int id){
|
||||
return preConfigMap.get(id);
|
||||
public static List<SHardStage> getPreList(int id) {
|
||||
return preConfigMap.get(id);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue