数据bug
parent
c1a542867a
commit
347ec0a577
|
@ -2,6 +2,7 @@ local effect = require("Modules/Battle/Logic/Base/Effect")
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local max = math.max
|
local max = math.max
|
||||||
local min = math.min
|
local min = math.min
|
||||||
|
local gameFrameRate = BattleLogic.GameFrameRate
|
||||||
--local BattleConst = BattleConst
|
--local BattleConst = BattleConst
|
||||||
--local RoleDataName = RoleDataName
|
--local RoleDataName = RoleDataName
|
||||||
--local BattleEventName = BattleEventName
|
--local BattleEventName = BattleEventName
|
||||||
|
@ -91,8 +92,9 @@ local function chooseTarget(role, chooseId, exceptList)
|
||||||
end
|
end
|
||||||
|
|
||||||
if exceptNum > 0 then
|
if exceptNum > 0 then
|
||||||
for i=1, exceptNum do
|
local count = #arr
|
||||||
for j=#arr, i+1, -1 do
|
for i=1, min(exceptNum, count) do
|
||||||
|
for j=count, i+1, -1 do
|
||||||
arr[j] = arr[j-1]
|
arr[j] = arr[j-1]
|
||||||
end
|
end
|
||||||
arr[i] = exceptList.buffer[i]
|
arr[i] = exceptList.buffer[i]
|
||||||
|
@ -100,12 +102,6 @@ local function chooseTarget(role, chooseId, exceptList)
|
||||||
end
|
end
|
||||||
return arr
|
return arr
|
||||||
end
|
end
|
||||||
local effectPool = BattleObjectPool.New(function ()
|
|
||||||
return {0, {}} -- type, {args, ...}
|
|
||||||
end)
|
|
||||||
local effectGroupPool = BattleObjectPool.New(function ()
|
|
||||||
return { 0, 0, {}} -- chooseId, duration, {effect1, effect2, ...}
|
|
||||||
end)
|
|
||||||
|
|
||||||
Skill = {}
|
Skill = {}
|
||||||
|
|
||||||
|
@ -131,11 +127,11 @@ function Skill:Init(role, effectData)
|
||||||
local v
|
local v
|
||||||
for i=2, #effectData do
|
for i=2, #effectData do
|
||||||
v = effectData[i]
|
v = effectData[i]
|
||||||
local effectGroup = effectGroupPool:Get() -- chooseId, duration, {effect1, effect2, ...}
|
local effectGroup = { 0, 0, {}} -- chooseId, duration, {effect1, effect2, ...}
|
||||||
effectGroup[1] = v[1] --chooseId
|
effectGroup[1] = v[1] --chooseId
|
||||||
effectGroup[2] = v[2] --duration
|
effectGroup[2] = v[2] --duration
|
||||||
for j=3, #v do --effectList
|
for j=3, #v do --effectList
|
||||||
local effect = effectPool:Get() -- type, {args, ...}
|
local effect = {0, {}} -- type, {args, ...}
|
||||||
effect[1] = v[j][1]
|
effect[1] = v[j][1]
|
||||||
for k=2, #v[j] do
|
for k=2, #v[j] do
|
||||||
effect[2][k-1] = v[j][k]
|
effect[2][k-1] = v[j][k]
|
||||||
|
@ -146,18 +142,6 @@ function Skill:Init(role, effectData)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Skill:Dispose()
|
|
||||||
local effectGroup
|
|
||||||
for i=1, self.effectList.size do
|
|
||||||
effectGroup = self.effectList.buffer[i]
|
|
||||||
for k=1, #effectGroup[3] do
|
|
||||||
effectPool:Put(effectGroup[3][k])
|
|
||||||
effectGroup[3][k] = nil
|
|
||||||
end
|
|
||||||
effectGroupPool:Put(effectGroup)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Skill:ResetCD()
|
function Skill:ResetCD()
|
||||||
if not self.isTeamSkill then
|
if not self.isTeamSkill then
|
||||||
if self.owner.superSkill == self then
|
if self.owner.superSkill == self then
|
||||||
|
|
|
@ -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,12 +232,14 @@ 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
|
if BattleLogic.IsOpenBattleRecord then
|
||||||
BattleLogic.RecordDelayTrigger(delayTime, curFrame + floor(delayTime * BattleLogic.GameFrameRate + 0.5))
|
BattleLogic.RecordDelayTrigger(delayTime, curFrame + delayFrame)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -284,19 +269,13 @@ 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
|
|
||||||
-- list[i] = nil
|
|
||||||
--end
|
|
||||||
local list = {}
|
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
|
||||||
local v = objList.vList[i]
|
local v = objList.vList[i]
|
||||||
if func(v) and (inCludeDeadRole or not v.isDead) then
|
if func(v) and (inCludeDeadRole or not v.isDead) then
|
||||||
--if memoize(func, v) and (inCludeDeadRole or not v.isDead) then
|
|
||||||
list[index] = v
|
list[index] = v
|
||||||
index = index + 1
|
index = index + 1
|
||||||
end
|
end
|
||||||
|
@ -474,7 +453,7 @@ end
|
||||||
|
|
||||||
--Record专用
|
--Record专用
|
||||||
function BattleLogic.RecordDelayTrigger(delayFrame, triggerFrame)
|
function BattleLogic.RecordDelayTrigger(delayFrame, triggerFrame)
|
||||||
table.insert(record, string.format("frame:%d, delayFrame:%d, triggerFrame:%d", curFrame, delayFrame, triggerFrame))
|
table.insert(record, string.format("frame:%d, delayTime:%f, triggerFrame:%d", curFrame, delayFrame, triggerFrame))
|
||||||
end
|
end
|
||||||
|
|
||||||
--Record专用
|
--Record专用
|
||||||
|
|
|
@ -72,12 +72,10 @@ end
|
||||||
|
|
||||||
function RoleLogic:Dispose()
|
function RoleLogic:Dispose()
|
||||||
if self.skill then
|
if self.skill then
|
||||||
self.skill:Dispose()
|
|
||||||
skillPool:Put(self.skill)
|
skillPool:Put(self.skill)
|
||||||
self.skill = nil
|
self.skill = nil
|
||||||
end
|
end
|
||||||
if self.superSkill then
|
if self.superSkill then
|
||||||
self.superSkill:Dispose()
|
|
||||||
skillPool:Put(self.superSkill)
|
skillPool:Put(self.superSkill)
|
||||||
self.superSkill = nil
|
self.superSkill = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class SSkillLogicConfig implements BaseConfig {
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEffectValueIndex (int[][] effectArr,int value){
|
public int getEffectValueIndex (int[][] effectArr,int value, int index){
|
||||||
StringBuilder effectStr = new StringBuilder();
|
StringBuilder effectStr = new StringBuilder();
|
||||||
for (int[] effects :effectArr){
|
for (int[] effects :effectArr){
|
||||||
for (int eff :effects){
|
for (int eff :effects){
|
||||||
|
@ -73,14 +73,18 @@ public class SSkillLogicConfig implements BaseConfig {
|
||||||
for (int i =0 ; i < ints.length; i++){
|
for (int i =0 ; i < ints.length; i++){
|
||||||
map.put(i,ints[i]);
|
map.put(i,ints[i]);
|
||||||
}
|
}
|
||||||
int index = 0;
|
int backIndex = 0;
|
||||||
|
int flag = 0;
|
||||||
for (Map.Entry<Integer,Integer> entry : map.entrySet()){
|
for (Map.Entry<Integer,Integer> entry : map.entrySet()){
|
||||||
if (entry.getValue() == value){
|
if (entry.getValue() == value){
|
||||||
index = entry.getKey();
|
backIndex = entry.getKey();
|
||||||
break;
|
if (flag == index){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
flag++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return index;
|
return backIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[][] getEffectValue() {
|
public float[][] getEffectValue() {
|
||||||
|
@ -120,7 +124,7 @@ public class SSkillLogicConfig implements BaseConfig {
|
||||||
}else {
|
}else {
|
||||||
effectInfo.append("|").append(effects[i]);
|
effectInfo.append("|").append(effects[i]);
|
||||||
}
|
}
|
||||||
int index = getEffectValueIndex(effect, effects[i]);
|
int index = getEffectValueIndex(effect, effects[i], i );
|
||||||
float[] effectValue = effectValues[index];
|
float[] effectValue = effectValues[index];
|
||||||
for (float effectVal : effectValue) {
|
for (float effectVal : effectValue) {
|
||||||
effectInfo.append("#").append(effectVal);
|
effectInfo.append("#").append(effectVal);
|
||||||
|
|
Loading…
Reference in New Issue