Merge branch 'master' of 60.1.1.230:backend/jieling_server

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/handler/map/MapLogic.java
back_recharge
wangyuan 2019-03-26 11:21:47 +08:00
commit 0bd0d709ea
17 changed files with 383 additions and 183 deletions

View File

@ -15,3 +15,117 @@ int int mut,int#int,2
13 4 3#1 13 4 3#1
14 4 6#1 14 4 6#1
15 4 9#1 15 4 9#1
10101 6 0#2#5
10102 6 1#2#5
10103 0 null
10104 0 null
10105 0 null
10106 0 null
10107 0 null
10108 0 null
10109 0 null
10201 6 0#3#6
10202 6 1#3#6
10301 6 0#4#3
10302 6 1#4#3
10401 6 1#5#4
10402 6 0#5#4
10501 6 1#6#4
10502 6 0#6#4
10601 6 1#7#3
10602 6 0#7#3
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null
0 0 null

View File

@ -36,7 +36,7 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2
100034 0 26 101 null 4 null 100034 0 26 101 null 4 null
101001 1 2 1503#1 1001#1101#1201#1301 4 null 101001 1 2 1503#1 1001#1101#1201#1301 4 null
101002 0 0 null null 4 null 101002 0 0 null null 4 null
101003 0 0 null null 5 102111 101003 0 0 null null 5 101143
101004 0 0 null null 4 null 101004 0 0 null null 4 null
101005 0 27 101 null 5 101007 101005 0 27 101 null 5 101007
101006 0 0 null null 4 null 101006 0 0 null null 4 null
@ -230,14 +230,14 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2
101194 0 0 null null 1 101142 101194 0 0 null null 1 101142
101195 0 9 2 null 4 null 101195 0 9 2 null 4 null
101196 0 0 null null 5 101144 101196 0 0 null null 5 101144
101197 0 0 null null 5 101146 101197 0 0 null null 5 101145
101198 0 0 null null 1 101147 101198 0 0 null null 1 101146
101199 0 0 null null 1 101148 101199 0 27 3 null 1 101147
101200 0 0 null null 4 null 101200 0 19 2#0 null 4 null
101201 0 0 null null 4 null 101201 0 0 null null 4 null
101202 10 0 null null 1 101067 101202 10 0 null null 1 101067
101203 0 0 null null 4 null 101203 0 0 null null 4 null
101204 0 19 2#102#2#5 null 4 null 101204 0 0 null null 4 null
101205 0 0 null null 4 null 101205 0 0 null null 4 null
101206 14 0 null null 1 101155 101206 14 0 null null 1 101155
101207 0 0 null null 4 null 101207 0 0 null null 4 null
@ -361,7 +361,7 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2
102017 0 0 null 10102 4 null 102017 0 0 null 10102 4 null
102018 0 0 null 10102 4 null 102018 0 0 null 10102 4 null
102019 0 0 null 10102 4 null 102019 0 0 null 10102 4 null
102020 0 19 3#0 null 5 null 102020 0 0 null null 5 102123
102021 0 0 null null 4 null 102021 0 0 null null 4 null
102022 0 5 103#19#2 null 4 null 102022 0 5 103#19#2 null 4 null
102023 0 0 null null 4 null 102023 0 0 null null 4 null
@ -496,7 +496,7 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2
102152 0 0 null null 1 102102 102152 0 0 null null 1 102102
102153 0 0 null null 1 102103 102153 0 0 null null 1 102103
102154 0 0 null null 1 102104 102154 0 0 null null 1 102104
102155 0 27 4 null 1 102105 102155 0 0 null null 1 102105
102156 0 9 3 null 4 null 102156 0 9 3 null 4 null
102157 0 0 null null 4 null 102157 0 0 null null 4 null
102158 0 0 null null 4 null 102158 0 0 null null 4 null
@ -518,8 +518,8 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2
102174 0 15 102030 null 4 null 102174 0 15 102030 null 4 null
102175 0 0 null null 1 102124 102175 0 0 null null 1 102124
102176 0 0 null null 1 102125 102176 0 0 null null 1 102125
102177 0 0 null null 1 102126 102177 0 27 4 null 1 102126
102178 0 0 null null 4 null 102178 0 19 3#0 null 4 null
102179 0 0 null null 1 102128 102179 0 0 null null 1 102128
102180 0 0 null null 4 null 102180 0 0 null null 4 null
102181 0 0 null null 1 102129 102181 0 0 null null 1 102129
@ -612,7 +612,7 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2
103021 0 0 null null 4 null 103021 0 0 null null 4 null
103022 0 0 null null 4 null 103022 0 0 null null 4 null
103023 0 0 null null 4 null 103023 0 0 null null 4 null
103024 0 0 null null 3 103020 103024 0 0 null null 5 103020
103025 0 0 null null 4 null 103025 0 0 null null 4 null
103026 0 0 null null 1 103021 103026 0 0 null null 1 103021
103027 0 0 null null 1 103022 103027 0 0 null null 1 103022

View File

@ -125,7 +125,7 @@ function BattleMain.Execute(seed, fightData, optionData)
print(PrintTable(fightData)) print(PrintTable(fightData))
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步 --该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
BattleLogic.IsOpenBattleRecord = false BattleLogic.IsOpenBattleRecord = true
if xpcall(function () if xpcall(function ()
Random.SetSeed(seed) Random.SetSeed(seed)
@ -155,17 +155,17 @@ function BattleMain.Execute(seed, fightData, optionData)
end end
-- print ----------------------------------------- -- print -----------------------------------------
for i=1, #resultList do --for i=1, #resultList do
print("hp:"..resultList[i]) -- print("hp:"..resultList[i])
end --end
print("最终运行帧数:"..BattleLogic.CurFrame()) --print("最终运行帧数:"..BattleLogic.CurFrame())
print("result:"..BattleLogic.Result) --print("result:"..BattleLogic.Result)
return resultList return resultList
end end
return { result = -1 } return { result = -1 }
end end
--BattleMain.Execute(1553167956, {enemyData={{{passivity={},skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},roleId=5,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},type=2,professionId=0,quality=1,camp=1,},{passivity={},skill={0,{20011,0.7,{1,0.8,1,},{13,1,0.1,2,5,},},},roleId=3,property={0,772,772,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},type=2,professionId=0,quality=1,camp=1,},{passivity={},skill={0,{20011,0.7,{1,0.8,1,},{13,1,0.1,2,5,},},},roleId=3,property={0,772,772,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},type=2,professionId=0,quality=1,camp=1,},teamSkill={},},},playerData={{passivity={},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},camp=0,roleId=10022,type=1,professionId=3,quality=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},camp=0,roleId=10008,type=1,professionId=5,quality=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},camp=0,roleId=10023,type=1,professionId=4,quality=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,10,0.1,5,1,},},},camp=0,roleId=10013,type=1,professionId=1,quality=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},camp=0,roleId=10022,type=1,professionId=3,quality=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},}) --BattleMain.Execute(1553167956, {playerData={{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,10,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={17,2732,2734,401,272,326,308,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=2,camp=1,property={0,483,483,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
BattleMain.Execute(1553167956, {playerData={{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,9,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=2,passivity={},type=1,skill={0,{40001,0.7,{1,1.05,2,},{4,4,5,5,3,},},},superSkill={2.3,{20000,0.7,{2,1.89,2,},},{20012,0.7,{3,1,5,5,},},},roleId=10021,camp=0,property={1,1920,1922,209,170,204,178,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,9,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},superSkill={},roleId=14,camp=1,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},}) --BattleMain.Execute(1553167956, {playerData={{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,9,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=2,passivity={},type=1,skill={0,{40001,0.7,{1,1.05,2,},{4,4,5,5,3,},},},superSkill={2.3,{20000,0.7,{2,1.89,2,},},{20012,0.7,{3,1,5,5,},},},roleId=10021,camp=0,property={1,1920,1922,209,170,204,178,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,9,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},superSkill={},roleId=14,camp=1,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
return BattleMain return BattleMain

View File

@ -217,10 +217,10 @@ local effectList = {
local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge))) local f2 = args[3] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
local rid = args[4] local rid = args[4]
local f3 = args[5] local f3 = args[5]
--caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval) caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
--if caster.camp == 0 and target.camp == 1 then if caster.camp == 0 and target.camp == 1 then
-- BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
--end end
BattleLogic.WaitForTrigger(interval, function () BattleLogic.WaitForTrigger(interval, function ()
local layer local layer
if target.BuffMgr:HasBuff(BuffName.Brand, function (buff) if target.BuffMgr:HasBuff(BuffName.Brand, function (buff)
@ -245,12 +245,13 @@ local effectList = {
local f1 = args[1] local f1 = args[1]
local dt = args[2] local dt = args[2]
local f2 = args[3] local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval) caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
if caster.camp == 0 and target.camp == 1 then if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval) BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end end
BattleLogic.WaitForTrigger(interval, function () BattleLogic.WaitForTrigger(interval, function ()
local dmg = BattleUtil.CalDamage(caster, target, dt, f1) local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
if target.isDead then if target.isDead then
local arr = BattleLogic.Query(function (r) return r.camp ~= caster.camp and r.uid ~= target.uid end) local arr = BattleLogic.Query(function (r) return r.camp ~= caster.camp and r.uid ~= target.uid end)
for i=1, #arr do for i=1, #arr do
@ -314,25 +315,6 @@ local effectList = {
end end
end) end)
end, end,
--造成[a]%的[b]伤害若暴击则减少下次发动技能CD[c]秒。
--a[float],b[伤害类型],c[float]
[18] = function(caster, target, args, interval)
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
BattleLogic.WaitForTrigger(interval, function ()
local d, crit = BattleUtil.CalDamage(caster, target, dt, f1)
if crit then
if target.skill then
target.skill.sp = target.skill.sp + floor(f2 * BattleLogic.GameFrameRate)
end
end
end)
end,
--造成[a]%的[b]伤害,有[c]%的概率追加伤害,最多可追加[d]次。(0无限追加) --造成[a]%的[b]伤害,有[c]%的概率追加伤害,最多可追加[d]次。(0无限追加)
--a[float],b[伤害类型],c[float],d[int] --a[float],b[伤害类型],c[float],d[int]
[19] = function(caster, target, args, interval) [19] = function(caster, target, args, interval)
@ -504,6 +486,33 @@ local effectList = {
BattleUtil.CalDamage(caster, target, dt, f1) BattleUtil.CalDamage(caster, target, dt, f1)
end) end)
end, end,
--造成[a]到[b]次[c]%的[d]伤害,对[e]造成额外[f]%伤害
--a[int],b[int],c[float],d[伤害类型],e[职业],f[float]
[29] = function(caster, target, args, interval)
local i1 = args[1]
local i2 = args[2]
local f1 = args[3]
local dt = args[4]
local pt = args[5]
local f2 = args[6]
local count = Random.RangeInt(i1, i2)
local d = interval / count
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
end
for i=1, count do
BattleLogic.WaitForTrigger(d * (i-1), function ()
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d)
BattleLogic.WaitForTrigger(d, function ()
if target.professionId == pt then
f1 = f1 + f2
end
BattleUtil.CalDamage(caster, target, dt, f1)
end)
end)
end
end,
} }
return effectList return effectList

View File

@ -1,6 +1,7 @@
RoleData = {} RoleData = {}
RoleData.__index = RoleData RoleData.__index = RoleData
local max = math.max local max = math.max
local floor = math.floor
function RoleData.New() function RoleData.New()
local instance = {role=0, data={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} local instance = {role=0, data={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}
setmetatable(instance, RoleData) setmetatable(instance, RoleData)
@ -10,7 +11,7 @@ end
function RoleData:Init(role, data) function RoleData:Init(role, data)
self.role = role self.role = role
for i=1, #data do for i=1, #data do
self.data[i] = data[i] self.data[i] = floor(data[i] * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
end end
end end

View File

@ -6,15 +6,14 @@ local min = math.min
--local RoleDataName = RoleDataName --local RoleDataName = RoleDataName
--local BattleEventName = BattleEventName --local BattleEventName = BattleEventName
local chooseList = {}
local function chooseTarget(role, chooseId, exceptList) local function chooseTarget(role, chooseId, exceptList)
local chooseType = floor(chooseId / 10000) % 10 local chooseType = floor(chooseId / 10000) % 10
local chooseWeight = floor(chooseId / 100) % 10 local chooseWeight = floor(chooseId / 100) % 10
local sort = floor(chooseId / 10) % 10 local sort = floor(chooseId / 10) % 10
local exceptNum = #exceptList local exceptNum = exceptList.size
local num = chooseId % 10 local num = chooseId % 10
local arr = BattleLogic.Query() local arr
if chooseType == 1 then if chooseType == 1 then
arr = BattleLogic.Query(function (r) arr = BattleLogic.Query(function (r)
for i=1, exceptList.size do for i=1, exceptList.size do
@ -26,8 +25,7 @@ local function chooseTarget(role, chooseId, exceptList)
end) end)
elseif chooseType == 2 then elseif chooseType == 2 then
if role.lockTarget and num == 1 then if role.lockTarget and num == 1 then
arr[1] = role.lockTarget return {role.lockTarget}
return arr
end end
arr = BattleLogic.Query(function (r) arr = BattleLogic.Query(function (r)
for i=1, exceptList.size do for i=1, exceptList.size do
@ -38,69 +36,69 @@ local function chooseTarget(role, chooseId, exceptList)
return r.camp ~= role.camp return r.camp ~= role.camp
end) end)
elseif chooseType == 3 then elseif chooseType == 3 then
arr[1] = role return {role}
return arr
elseif chooseType == 4 then elseif chooseType == 4 then
return {BattleLogic.GetAggro(role.camp)} return {BattleLogic.GetAggro(role.camp)}
else
arr = BattleLogic.Query()
end end
BattleUtil.RandomList(arr)
if chooseWeight == 0 then if chooseWeight == 0 then
BattleUtil.RandomList(arr) BattleUtil.RandomList(arr)
elseif chooseWeight == 1 then elseif chooseWeight == 1 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Hp) local r1 = a:GetRoleData(RoleDataName.Hp)
local r2 = b:GetRoleData(RoleDataName.Hp) local r2 = b:GetRoleData(RoleDataName.Hp)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
elseif chooseWeight == 2 then elseif chooseWeight == 2 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp) local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp)
local r2 = b:GetRoleData(RoleDataName.Hp) / b:GetRoleData(RoleDataName.MaxHp) local r2 = b:GetRoleData(RoleDataName.Hp) / b:GetRoleData(RoleDataName.MaxHp)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
elseif chooseWeight == 3 then elseif chooseWeight == 3 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.Attack) local r1 = a:GetRoleData(RoleDataName.Attack)
local r2 = b:GetRoleData(RoleDataName.Attack) local r2 = b:GetRoleData(RoleDataName.Attack)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
elseif chooseWeight == 4 then elseif chooseWeight == 4 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence) local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence) local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
elseif chooseWeight == 5 then elseif chooseWeight == 5 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence) local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence) local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
elseif chooseWeight == 6 then elseif chooseWeight == 6 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.MagicDefence) local r1 = a:GetRoleData(RoleDataName.MagicDefence)
local r2 = b:GetRoleData(RoleDataName.MagicDefence) local r2 = b:GetRoleData(RoleDataName.MagicDefence)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
elseif chooseWeight == 7 then elseif chooseWeight == 7 then
table.sort(arr, function(a, b) BattleUtil.Sort(arr, function(a, b)
local r1 = a:GetRoleData(RoleDataName.MagicDefence) local r1 = a:GetRoleData(RoleDataName.MagicDefence)
local r2 = b:GetRoleData(RoleDataName.MagicDefence) local r2 = b:GetRoleData(RoleDataName.MagicDefence)
return sort == 1 and r1 < r2 or r1 > r2 return sort == 1 and r1 < r2 or r1 > r2
end) end)
end end
for i=1, #chooseList do if exceptNum > 0 then
chooseList[i] = nil local count = #arr
for i=1, min(exceptNum, count) do
for j=count, i+1, -1 do
arr[j] = arr[j-1]
end
arr[i] = exceptList.buffer[i]
end
end end
--local chooseList = {}
for i=1, exceptNum do
chooseList[i] = exceptList[i]
end
for i=1+exceptNum, num == 0 and #arr or min(#arr, num) do
chooseList[i] = arr[i]
end
arr = chooseList
return arr return arr
end end
local effectPool = BattleObjectPool.New(function () local effectPool = BattleObjectPool.New(function ()
@ -151,13 +149,19 @@ end
function Skill:Dispose() function Skill:Dispose()
local effectGroup local effectGroup
for i=1, self.effectList.size do local effect
effectGroup = self.effectList.buffer[i] while self.effectList.size > 0 do
effectGroup = self.effectList.buffer[self.effectList.size]
for k=1, #effectGroup[3] do for k=1, #effectGroup[3] do
effectPool:Put(effectGroup[3][k]) effect = effectGroup[3][k]
for j=1, #effect[2] do
effect[2][j] = nil
end
effectPool:Put(effect)
effectGroup[3][k] = nil effectGroup[3][k] = nil
end end
effectGroupPool:Put(effectGroup) effectGroupPool:Put(effectGroup)
self.effectList:Remove(self.effectList.size)
end end
end end
@ -196,6 +200,12 @@ function Skill:ResetCD()
BattleLogic.SetAggro(self.owner, 0) BattleLogic.SetAggro(self.owner, 0)
end end
local function takeEffect(type, caster, target, args, interval)
effect[type](caster, target, args, interval)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordEffect(caster, target, type, args, interval)
end
end
function Skill:Cast() function Skill:Cast()
for i=1, self.effectList.size do for i=1, self.effectList.size do
local effectGroup = self.effectList.buffer[i] local effectGroup = self.effectList.buffer[i]
@ -217,7 +227,7 @@ function Skill:Cast()
for j=1, #arr do for j=1, #arr do
for k=1, #effectGroup[3] do for k=1, #effectGroup[3] do
local v = effectGroup[3][k] local v = effectGroup[3][k]
effect[v[1]](self.owner, arr[j], v[2], duration) takeEffect(v[1], self.owner, arr[j], v[2], duration)
end end
end end
elseif chooseId == 20000 then --敌方aoe elseif chooseId == 20000 then --敌方aoe
@ -225,14 +235,14 @@ function Skill:Cast()
for j=1, #arr do for j=1, #arr do
for k=1, #effectGroup[3] do for k=1, #effectGroup[3] do
local v = effectGroup[3][k] local v = effectGroup[3][k]
effect[v[1]](self.owner, arr[j], v[2], duration) takeEffect(v[1], self.owner, arr[j], v[2], duration)
end end
end end
elseif nn == 1 or nn == 3 then elseif nn == 1 or nn == 3 then
for j=1, #arr do for j=1, #arr do
for k=1, #effectGroup[3] do for k=1, #effectGroup[3] do
local v = effectGroup[3][k] local v = effectGroup[3][k]
effect[v[1]](self.owner, arr[j], v[2], duration) takeEffect(v[1], self.owner, arr[j], v[2], duration)
end end
end end
else else
@ -252,7 +262,7 @@ function Skill:Cast()
r = arr[i] r = arr[i]
for k=1, #effectGroup[3] do for k=1, #effectGroup[3] do
local v = effectGroup[3][k] local v = effectGroup[3][k]
effect[v[1]](self.owner, r, v[2], cd) takeEffect(v[1], self.owner, r, v[2], cd)
end end
return return
end end
@ -265,7 +275,7 @@ function Skill:Cast()
self.choosedList:Add(r) self.choosedList:Add(r)
for k=1, #effectGroup[3] do for k=1, #effectGroup[3] do
local v = effectGroup[3][k] local v = effectGroup[3][k]
effect[v[1]](self.owner, r, v[2], cd) takeEffect(v[1], self.owner, r, v[2], cd)
end end
end) end)
end end

View File

@ -14,8 +14,6 @@ local enemyMP
local playerAggro local playerAggro
local enemyAggro local enemyAggro
local playerAggroChangable
local enemyAggroChangable
local playerSkillUsable local playerSkillUsable
local enemySkillUsable local enemySkillUsable
@ -84,9 +82,6 @@ function BattleLogic.Init(data, optionData)
playerTeamSkillIndex = 1 playerTeamSkillIndex = 1
enemyTeamSkillIndex = 1 enemyTeamSkillIndex = 1
playerAggroChangable = true
enemyAggroChangable = true
playerSkillUsable = true playerSkillUsable = true
enemySkillUsable = true enemySkillUsable = true
@ -185,24 +180,12 @@ end
function BattleLogic.SetAggro(role, duration) function BattleLogic.SetAggro(role, duration)
if role.camp == 1 then if role.camp == 1 then
if playerAggroChangable then playerAggro = role
playerAggro = role if enemySkillUsable then
if enemySkillUsable then BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, max(duration/2, 0.3))
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, max(duration/2, 0.3))
end
playerAggroChangable = false
BattleLogic.WaitForTrigger(duration-BattleLogic.GameDeltaTime, function () --减去一帧避免卡点
playerAggroChangable = true
end)
end end
else else
if enemyAggroChangable then enemyAggro = role
enemyAggro = role
enemyAggroChangable = false
BattleLogic.WaitForTrigger(duration-BattleLogic.GameDeltaTime, function () --减去一帧避免卡点
enemyAggroChangable = true
end)
end
end end
end end
@ -249,10 +232,15 @@ function BattleLogic.GetSkillUsable(camp)
end end
function BattleLogic.WaitForTrigger(delayTime, action) function BattleLogic.WaitForTrigger(delayTime, action)
delayTime = floor(delayTime * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5)
local item = actionPool:Get() local item = actionPool:Get()
item[1] = curFrame + floor(delayTime * BattleLogic.GameFrameRate + 0.5) item[1] = curFrame + delayFrame
item[2] = action item[2] = action
tbActionList:Add(item) tbActionList:Add(item)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordDelayTrigger(delayTime, curFrame + delayFrame)
end
end end
function BattleLogic.AddOption(opType, opArg) function BattleLogic.AddOption(opType, opArg)
@ -281,12 +269,8 @@ function BattleLogic.CurFrame()
return curFrame return curFrame
end end
local list = {}
function BattleLogic.Query(func, inCludeDeadRole) function BattleLogic.Query(func, inCludeDeadRole)
for i=1, #list do local list = {}
list[i] = nil
end
--local list = {}
local index = 1 local index = 1
if func then if func then
for i=1, objList.size do for i=1, objList.size do
@ -360,9 +344,7 @@ function BattleLogic.Update()
index = 1 index = 1
while index <= tbActionList.size do while index <= tbActionList.size do
if tbActionList.buffer[index][1] <= curFrame then if tbActionList.buffer[index][1] <= curFrame then
if tbActionList.buffer[index][2] then tbActionList.buffer[index][2]()
tbActionList.buffer[index][2]()
end
actionPool:Put(tbActionList.buffer[index]) actionPool:Put(tbActionList.buffer[index])
tbActionList:Remove(index) tbActionList:Remove(index)
else else
@ -458,6 +440,22 @@ function BattleLogic.RecordRoleProperty(uid, camp, name, value, delta)
table.insert(record, string.format("frame:%d, uid:%d, camp:%d, name:%s, value:%d, delta:%d", curFrame, uid, camp, name, value, delta)) table.insert(record, string.format("frame:%d, uid:%d, camp:%d, name:%s, value:%d, delta:%d", curFrame, uid, camp, name, value, delta))
end end
--Record专用
function BattleLogic.RecordEffect(caster, target, type, args, interval)
local cUid = tostring(caster.uid) or "cTeam"
local tUid = tostring(target.uid) or "tTeam"
local str = ""
for i=1, #args do
str = str..tostring(args[i]) .. (i == #args and "" or "#")
end
table.insert(record, string.format("frame:%d, caster:%s, target:%s, effectType:%d, args:%s, interval:%d", curFrame, cUid, tUid, type, str, interval))
end
--Record专用
function BattleLogic.RecordDelayTrigger(delayFrame, triggerFrame)
table.insert(record, string.format("frame:%d, delayTime:%f, triggerFrame:%d", curFrame, delayFrame, triggerFrame))
end
--Record专用 --Record专用
function BattleLogic.GenerateRecordFile() function BattleLogic.GenerateRecordFile()
local time = string.format("%d-%d-%d-%d-%d-%d", local time = string.format("%d-%d-%d-%d-%d-%d",

View File

@ -175,6 +175,18 @@ function BattleUtil.RandomList(arr)
end end
end end
function BattleUtil.Sort(arr, comp)
if #arr <= 1 then return arr end
for i=1, #arr do
for j = #arr, i+1, -1 do
if comp(arr[j-1], arr[j]) then
arr[j-1], arr[j] = arr[j], arr[j-1]
end
end
end
return arr
end
function BattleUtil.GetPropertyName(type) function BattleUtil.GetPropertyName(type)
if type == 1 then if type == 1 then
return RoleDataName.Strength return RoleDataName.Strength

View File

@ -14,18 +14,18 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class SSkillLogicConfig implements BaseConfig { public class SSkillLogicConfig implements BaseConfig {
public static Map<Integer, SSkillLogicConfig> sSkillLogicConfigMap; public static Map<Integer, SSkillLogicConfig> sSkillLogicConfigMap;
public static Map<Integer,SSkillLogicVo> sSkillLogicVoMap; public static Map<Integer,SSkillLogicVo> sSkillLogicVoMap;
private int id; private int id;
private float[][] target; private float[][] target;
private int[][] effect; private int[][] effect;
private float[][] effectValue; private float[][] effectValue;
private float cd; private float cd;
@Override @Override
public void init() throws Exception { public void init() throws Exception {
sSkillLogicConfigMap = STableManager.getConfig(SSkillLogicConfig.class); sSkillLogicConfigMap = STableManager.getConfig(SSkillLogicConfig.class);
Map<Integer,SSkillLogicVo> skillLogicVoMap = new ConcurrentHashMap<>(); Map<Integer,SSkillLogicVo> skillLogicVoMap = new ConcurrentHashMap<>();
@ -57,32 +57,6 @@ public class SSkillLogicConfig implements BaseConfig {
return effect; return effect;
} }
public int getEffectValueIndex (int[][] effectArr,int value){
StringBuilder effectStr = new StringBuilder();
for (int[] effects :effectArr){
for (int eff :effects){
if (effectStr.length() == 0){
effectStr = new StringBuilder(String.valueOf(eff));
}else{
effectStr.append("#").append(eff);
}
}
}
int[] ints = StringUtil.parseFiledInt(effectStr.toString());
Map<Integer,Integer> map = new ConcurrentHashMap<>();
for (int i =0 ; i < ints.length; i++){
map.put(i,ints[i]);
}
int index = 0;
for (Map.Entry<Integer,Integer> entry : map.entrySet()){
if (entry.getValue() == value){
index = entry.getKey();
break;
}
}
return index;
}
public float[][] getEffectValue() { public float[][] getEffectValue() {
return effectValue; return effectValue;
} }
@ -98,11 +72,13 @@ public class SSkillLogicConfig implements BaseConfig {
float[][] effectValue = sSkillLogicConfig.getEffectValue(); float[][] effectValue = sSkillLogicConfig.getEffectValue();
// System.out.println(sSkillLogicConfig.getId() +":"+targets.length + ":" +effect.length +":" + effectValue.length); // System.out.println(sSkillLogicConfig.getId() +":"+targets.length + ":" +effect.length +":" + effectValue.length);
List<SkillTargetVo> skillTargetVos = new CopyOnWriteArrayList<>(); List<SkillTargetVo> skillTargetVos = new CopyOnWriteArrayList<>();
int index = 0;
for (int i = 0; i < targets.length ; i++){ for (int i = 0; i < targets.length ; i++){
SkillTargetVo skillTargetVo = new SkillTargetVo(); SkillTargetVo skillTargetVo = new SkillTargetVo();
skillTargetVo.setTargetId((int) targets[i][0]); skillTargetVo.setTargetId((int) targets[i][0]);
skillTargetVo.setContinuedTime(targets[i][1]); skillTargetVo.setContinuedTime(targets[i][1]);
skillTargetVo.setEffectVale(getEffectVal(effect[i],effectValue,effect)); skillTargetVo.setEffectVale(getEffectVal(effect[i],effectValue,index));
index = index + effect[i].length;
skillTargetVos.add(skillTargetVo); skillTargetVos.add(skillTargetVo);
} }
SSkillLogicVo sSkillLogicVo = new SSkillLogicVo(); SSkillLogicVo sSkillLogicVo = new SSkillLogicVo();
@ -112,16 +88,21 @@ public class SSkillLogicConfig implements BaseConfig {
return sSkillLogicVo; return sSkillLogicVo;
} }
private float[][] getEffectVal(int[] effects, float[][] effectValues,int[][] effect) { private float[][] getEffectVal(int[] effects, float[][] effectValues,int index) {
int effectIndex;
StringBuilder effectInfo = new StringBuilder(); StringBuilder effectInfo = new StringBuilder();
for (int i = 0; i < effects.length; i++) { for (int i = 0; i < effects.length; i++) {
if (index ==0){
effectIndex = i;
}else{
effectIndex =index + i;
}
if (effectInfo.length() == 0){ if (effectInfo.length() == 0){
effectInfo = new StringBuilder(String.valueOf(effects[i])); effectInfo = new StringBuilder(String.valueOf(effects[i]));
}else { }else {
effectInfo.append("|").append(effects[i]); effectInfo.append("|").append(effects[i]);
} }
int index = getEffectValueIndex(effect, effects[i]); float[] effectValue = effectValues[effectIndex];
float[] effectValue = effectValues[index];
for (float effectVal : effectValue) { for (float effectVal : effectValue) {
effectInfo.append("#").append(effectVal); effectInfo.append("#").append(effectVal);
} }
@ -129,5 +110,4 @@ public class SSkillLogicConfig implements BaseConfig {
return StringUtil.parseFiledFloat2(effectInfo.toString()); return StringUtil.parseFiledFloat2(effectInfo.toString());
} }
} }

View File

@ -53,6 +53,7 @@ public class EventType {
* id#id#id0 * id#id#id0
* 20 * 20
* *
* 25 , id#id#id
* 26 * 26
* 27 * 27
*/ */
@ -75,6 +76,8 @@ public class EventType {
public static final int monitorMissionAndMove = 19; public static final int monitorMissionAndMove = 19;
public static final int destroyPointAnd = 20; public static final int destroyPointAnd = 20;
public static final int twentyFour = 24;
public static final int twentyFive = 25;
public static final int openAppointMission = 26; public static final int openAppointMission = 26;
public static final int openNotDoMission = 27; public static final int openNotDoMission = 27;

View File

@ -234,6 +234,7 @@ public class MapLogic {
public void updateMap(ISession session, int curXY, int triggerXY, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception { public void updateMap(ISession session, int curXY, int triggerXY, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
// LOGGER.info("updateMap() curXY=>{},triggerXY=>{}", curXY, triggerXY);
if (triggerXY != curXY) { if (triggerXY != curXY) {
boolean isConnect = CellUtil.checkIsNextCell(curXY, triggerXY); boolean isConnect = CellUtil.checkIsNextCell(curXY, triggerXY);
if (!isConnect) { if (!isConnect) {
@ -274,14 +275,11 @@ public class MapLogic {
} }
mapManager.setTotalStep(leftStep); mapManager.setTotalStep(leftStep);
} }
Cell cell = mapManager.getMapInfo().get(curXY); Cell cell = mapManager.getMapInfo().get(triggerXY);
if (cell == null) { if (cell == null) {
cell = mapManager.getMapInfo().get(triggerXY); LOGGER.info("xy is wrong =>{} triggerXY=>{}", curXY, triggerXY);
if (cell == null) { MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
LOGGER.info("xy is wrong =>{} triggerXY=>{}", curXY, triggerXY); return;
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
} }
mapManager.setTriggerXY(triggerXY); mapManager.setTriggerXY(triggerXY);
mapManager.addWalkCells(new HashSet<>(cells)); mapManager.addWalkCells(new HashSet<>(cells));
@ -309,14 +307,11 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), ""); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return; return;
} }
Cell cell = mapManager.getMapInfo().get(mapManager.getCurXY()); Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
if (cell == null) { if (cell == null) {
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY()); LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
if (cell == null) { MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY()); return;
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
} }
int bigEventId = cell.getEventId(); int bigEventId = cell.getEventId();
if (eventId != bigEventId) { if (eventId != bigEventId) {
@ -731,12 +726,30 @@ public class MapLogic {
LuaValue getOptionData = FightDataUtil.getOptionData(frames); LuaValue getOptionData = FightDataUtil.getOptionData(frames);
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData); int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
List<Integer> remainHp = new ArrayList<>(5);
for (int i = 1; i < checkResult.length; i++) {
remainHp.add(checkResult[i]);
}
//校验结果码 1胜利 //校验结果码 1胜利
int resultCode = checkResult[0]; int resultCode = checkResult[0];
/* if (resultCode !=1){ if (resultCode == -1){
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗失败"); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗异常!");
return; return;
}*/ }else if(resultCode == 0){
// 失败处理
resetMapInfo(user,true);
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
.newBuilder()
.setResult(resultCode)
.setDrop(dropBuilder)
.addAllRemainHpList(remainHp)
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
return;
}
int teamId = user.getMapManager().getTeamId(); int teamId = user.getMapManager().getTeamId();
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId); List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
@ -745,15 +758,11 @@ public class MapLogic {
hero.setCurHp(checkResult[teamPosHeroInfo.getPosition()]); hero.setCurHp(checkResult[teamPosHeroInfo.getPosition()]);
} }
List<Integer> remainHp = new ArrayList<>(5);
for (int i = 1; i < checkResult.length; i++) {
remainHp.add(checkResult[i]);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1); CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1);
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
.newBuilder() .newBuilder()
.setDrop(drop) .setDrop(drop)
.setResult(resultCode)
.addAllRemainHpList(remainHp) .addAllRemainHpList(remainHp)
.build(); .build();
updateMapMission(user.getMapManager(),EventType.fightEvent,0,monsterGroupId); updateMapMission(user.getMapManager(),EventType.fightEvent,0,monsterGroupId);

View File

@ -132,8 +132,8 @@ public class BehaviorUtil {
fightData.addAllMonsterList(monsterGroupList); fightData.addAllMonsterList(monsterGroupList);
//设置战斗随机种子 //设置战斗随机种子
// int seed = (int)(System.currentTimeMillis()/1000); int seed = (int)(System.currentTimeMillis()/1000);
int seed = 1553167956; // int seed = 1553167956;
fightData.setFightSeed(seed); fightData.setFightSeed(seed);
fightStartRespons.setFightData(fightData); fightStartRespons.setFightData(fightData);
@ -168,4 +168,28 @@ public class BehaviorUtil {
} }
return true; return true;
} }
/**
*
* @param user
*/
public static void destoryCurPoint(User user) {
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
mapInfo.remove(user.getMapManager().getCurXY());
}
/**
* eventId
* @param user
* @throws Exception
*/
public static void changeOtherPoint(User user, int pointId, int eventId) throws Exception {
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
for (Cell cell : mapInfo.values()) {
if (cell.getPointId() == pointId) {
cell.setEventId(eventId);
}
}
}
} }

View File

@ -1,13 +1,10 @@
package com.ljsd.jieling.handler.map.behavior; package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.handler.map.EventType; import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.protocols.MapInfoProto; import com.ljsd.jieling.protocols.MapInfoProto;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map;
@Component @Component
public class DestroyPointBehavior extends BaseBehavior { public class DestroyPointBehavior extends BaseBehavior {
@Override @Override

View File

@ -21,16 +21,6 @@ public class MonitorMissionBehavior extends BaseBehavior {
@Override @Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions(); return BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
Mission mission = doingMissions.get(behaviorTypeValues[0][0]);
if (mission == null || !mission.isOpen()) {
return false;
}
CheckMissionReturn checkMissionReturn = MissionLogic.getInstance().checkMission(mission, user);
for (Mission cmission : checkMissionReturn.missions){
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(cmission);
eventUpdateResponse.addMission(missionProto);
}
return true;
} }
} }

View File

@ -0,0 +1,25 @@
package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.protocols.MapInfoProto;
import org.springframework.stereotype.Component;
@Component
public class TwentyFiveBehavior extends BaseBehavior {
@Override
public int getBehaviorType() {
return EventType.twentyFive;
}
@Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
boolean flag = BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
if (!flag) {
return flag;
}
BehaviorUtil.destoryCurPoint(user);
BehaviorUtil.changeOtherPoint(user, behaviorTypeValues[0][1], behaviorTypeValues[0][2]);
return true;
}
}

View File

@ -0,0 +1,28 @@
package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.protocols.MapInfoProto;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class TwentyFourBehavior extends BaseBehavior {
@Override
public int getBehaviorType() {
return EventType.twentyFour;
}
@Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
Map<Integer, Cell> mapInfos = user.getMapManager().getMapInfo();
for (Cell cell : mapInfos.values()) {
if (cell.getPointId() == behaviorTypeValues[0][0]) {
cell.setEventId(behaviorTypeValues[0][1]);
}
}
return true;
}
}

View File

@ -84,7 +84,7 @@ public class CheckFight {
if (status==1){ if (status==1){
for (int i = 1; i <= result.length(); i++) { for (int i = 1; i <= result.length(); i++) {
resultCache[i] = result.rawget(i).toint(); resultCache[i] = result.rawget(i).toint();
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]); // LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
} }
} }
return resultCache; return resultCache;