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
14 4 6#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
101001 1 2 1503#1 1001#1101#1201#1301 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
101005 0 27 101 null 5 101007
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
101195 0 9 2 null 4 null
101196 0 0 null null 5 101144
101197 0 0 null null 5 101146
101198 0 0 null null 1 101147
101199 0 0 null null 1 101148
101200 0 0 null null 4 null
101197 0 0 null null 5 101145
101198 0 0 null null 1 101146
101199 0 27 3 null 1 101147
101200 0 19 2#0 null 4 null
101201 0 0 null null 4 null
101202 10 0 null null 1 101067
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
101206 14 0 null null 1 101155
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
102018 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
102022 0 5 103#19#2 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
102153 0 0 null null 1 102103
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
102157 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
102175 0 0 null null 1 102124
102176 0 0 null null 1 102125
102177 0 0 null null 1 102126
102178 0 0 null null 4 null
102177 0 27 4 null 1 102126
102178 0 19 3#0 null 4 null
102179 0 0 null null 1 102128
102180 0 0 null null 4 null
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
103022 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
103026 0 0 null null 1 103021
103027 0 0 null null 1 103022

View File

@ -125,7 +125,7 @@ function BattleMain.Execute(seed, fightData, optionData)
print(PrintTable(fightData))
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
BattleLogic.IsOpenBattleRecord = false
BattleLogic.IsOpenBattleRecord = true
if xpcall(function ()
Random.SetSeed(seed)
@ -155,17 +155,17 @@ function BattleMain.Execute(seed, fightData, optionData)
end
-- print -----------------------------------------
for i=1, #resultList do
print("hp:"..resultList[i])
end
print("最终运行帧数:"..BattleLogic.CurFrame())
print("result:"..BattleLogic.Result)
--for i=1, #resultList do
-- print("hp:"..resultList[i])
--end
--print("最终运行帧数:"..BattleLogic.CurFrame())
--print("result:"..BattleLogic.Result)
return resultList
end
return { result = -1 }
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=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=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={},},},})
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 rid = args[4]
local f3 = args[5]
--caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
--if caster.camp == 0 and target.camp == 1 then
-- BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
--end
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 layer
if target.BuffMgr:HasBuff(BuffName.Brand, function (buff)
@ -245,12 +245,13 @@ local effectList = {
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 dmg = BattleUtil.CalDamage(caster, target, dt, f1)
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
if target.isDead then
local arr = BattleLogic.Query(function (r) return r.camp ~= caster.camp and r.uid ~= target.uid end)
for i=1, #arr do
@ -314,25 +315,6 @@ local effectList = {
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[float],b[伤害类型],c[float],d[int]
[19] = function(caster, target, args, interval)
@ -504,6 +486,33 @@ local effectList = {
BattleUtil.CalDamage(caster, target, dt, f1)
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

View File

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

View File

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

View File

@ -14,8 +14,6 @@ local enemyMP
local playerAggro
local enemyAggro
local playerAggroChangable
local enemyAggroChangable
local playerSkillUsable
local enemySkillUsable
@ -84,9 +82,6 @@ function BattleLogic.Init(data, optionData)
playerTeamSkillIndex = 1
enemyTeamSkillIndex = 1
playerAggroChangable = true
enemyAggroChangable = true
playerSkillUsable = true
enemySkillUsable = true
@ -185,24 +180,12 @@ end
function BattleLogic.SetAggro(role, duration)
if role.camp == 1 then
if playerAggroChangable then
playerAggro = role
if enemySkillUsable then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, max(duration/2, 0.3))
end
playerAggroChangable = false
BattleLogic.WaitForTrigger(duration-BattleLogic.GameDeltaTime, function () --减去一帧避免卡点
playerAggroChangable = true
end)
end
else
if enemyAggroChangable then
enemyAggro = role
enemyAggroChangable = false
BattleLogic.WaitForTrigger(duration-BattleLogic.GameDeltaTime, function () --减去一帧避免卡点
enemyAggroChangable = true
end)
end
end
end
@ -249,10 +232,15 @@ function BattleLogic.GetSkillUsable(camp)
end
function BattleLogic.WaitForTrigger(delayTime, action)
delayTime = floor(delayTime * 100000 + 0.5) / 100000 --进行精度处理,避免前后端计算不一致
local delayFrame = floor(delayTime * BattleLogic.GameFrameRate + 0.5)
local item = actionPool:Get()
item[1] = curFrame + floor(delayTime * BattleLogic.GameFrameRate + 0.5)
item[1] = curFrame + delayFrame
item[2] = action
tbActionList:Add(item)
if BattleLogic.IsOpenBattleRecord then
BattleLogic.RecordDelayTrigger(delayTime, curFrame + delayFrame)
end
end
function BattleLogic.AddOption(opType, opArg)
@ -281,12 +269,8 @@ function BattleLogic.CurFrame()
return curFrame
end
local list = {}
function BattleLogic.Query(func, inCludeDeadRole)
for i=1, #list do
list[i] = nil
end
--local list = {}
local list = {}
local index = 1
if func then
for i=1, objList.size do
@ -360,9 +344,7 @@ function BattleLogic.Update()
index = 1
while index <= tbActionList.size do
if tbActionList.buffer[index][1] <= curFrame then
if tbActionList.buffer[index][2] then
tbActionList.buffer[index][2]()
end
actionPool:Put(tbActionList.buffer[index])
tbActionList:Remove(index)
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))
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专用
function BattleLogic.GenerateRecordFile()
local time = string.format("%d-%d-%d-%d-%d-%d",

View File

@ -175,6 +175,18 @@ function BattleUtil.RandomList(arr)
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)
if type == 1 then
return RoleDataName.Strength

View File

@ -57,32 +57,6 @@ public class SSkillLogicConfig implements BaseConfig {
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() {
return effectValue;
}
@ -98,11 +72,13 @@ public class SSkillLogicConfig implements BaseConfig {
float[][] effectValue = sSkillLogicConfig.getEffectValue();
// System.out.println(sSkillLogicConfig.getId() +":"+targets.length + ":" +effect.length +":" + effectValue.length);
List<SkillTargetVo> skillTargetVos = new CopyOnWriteArrayList<>();
int index = 0;
for (int i = 0; i < targets.length ; i++){
SkillTargetVo skillTargetVo = new SkillTargetVo();
skillTargetVo.setTargetId((int) targets[i][0]);
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);
}
SSkillLogicVo sSkillLogicVo = new SSkillLogicVo();
@ -112,16 +88,21 @@ public class SSkillLogicConfig implements BaseConfig {
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();
for (int i = 0; i < effects.length; i++) {
if (index ==0){
effectIndex = i;
}else{
effectIndex =index + i;
}
if (effectInfo.length() == 0){
effectInfo = new StringBuilder(String.valueOf(effects[i]));
}else {
effectInfo.append("|").append(effects[i]);
}
int index = getEffectValueIndex(effect, effects[i]);
float[] effectValue = effectValues[index];
float[] effectValue = effectValues[effectIndex];
for (float effectVal : effectValue) {
effectInfo.append("#").append(effectVal);
}
@ -129,5 +110,4 @@ public class SSkillLogicConfig implements BaseConfig {
return StringUtil.parseFiledFloat2(effectInfo.toString());
}
}

View File

@ -53,6 +53,7 @@ public class EventType {
* id#id#id0
* 20
*
* 25 , id#id#id
* 26
* 27
*/
@ -75,6 +76,8 @@ public class EventType {
public static final int monitorMissionAndMove = 19;
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 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 {
// LOGGER.info("updateMap() curXY=>{},triggerXY=>{}", curXY, triggerXY);
if (triggerXY != curXY) {
boolean isConnect = CellUtil.checkIsNextCell(curXY, triggerXY);
if (!isConnect) {
@ -274,15 +275,12 @@ public class MapLogic {
}
mapManager.setTotalStep(leftStep);
}
Cell cell = mapManager.getMapInfo().get(curXY);
if (cell == null) {
cell = mapManager.getMapInfo().get(triggerXY);
Cell cell = mapManager.getMapInfo().get(triggerXY);
if (cell == null) {
LOGGER.info("xy is wrong =>{} triggerXY=>{}", curXY, triggerXY);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
return;
}
}
mapManager.setTriggerXY(triggerXY);
mapManager.addWalkCells(new HashSet<>(cells));
mapManager.setCurXY(curXY);
@ -309,15 +307,12 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
Cell cell = mapManager.getMapInfo().get(mapManager.getCurXY());
if (cell == null) {
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
if (cell == null) {
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
MessageUtil.sendErrorResponse(session, 0, messageType.getNumber(), "");
return;
}
}
int bigEventId = cell.getEventId();
if (eventId != bigEventId) {
LOGGER.info("eventId != bigEventId =>{} {}, xy=>{}", eventId, bigEventId, mapManager.getCurXY());
@ -731,12 +726,30 @@ public class MapLogic {
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
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胜利
int resultCode = checkResult[0];
/* if (resultCode !=1){
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗失败");
if (resultCode == -1){
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗异常!");
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();
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
@ -745,15 +758,11 @@ public class MapLogic {
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);
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
.newBuilder()
.setDrop(drop)
.setResult(resultCode)
.addAllRemainHpList(remainHp)
.build();
updateMapMission(user.getMapManager(),EventType.fightEvent,0,monsterGroupId);

View File

@ -132,8 +132,8 @@ public class BehaviorUtil {
fightData.addAllMonsterList(monsterGroupList);
//设置战斗随机种子
// int seed = (int)(System.currentTimeMillis()/1000);
int seed = 1553167956;
int seed = (int)(System.currentTimeMillis()/1000);
// int seed = 1553167956;
fightData.setFightSeed(seed);
fightStartRespons.setFightData(fightData);
@ -168,4 +168,28 @@ public class BehaviorUtil {
}
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;
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 DestroyPointBehavior extends BaseBehavior {
@Override

View File

@ -21,16 +21,6 @@ public class MonitorMissionBehavior extends BaseBehavior {
@Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
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;
return BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
}
}

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){
for (int i = 1; i <= result.length(); i++) {
resultCache[i] = result.rawget(i).toint();
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
// LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
}
}
return resultCache;