back_recharge
mashiyu 2019-03-25 10:58:38 +08:00
parent 0805e3c16e
commit cc9b412f63
5 changed files with 30 additions and 7 deletions

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

@ -102,6 +102,12 @@ local function chooseTarget(role, chooseId, exceptList)
end
return arr
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 = {}
@ -127,11 +133,11 @@ function Skill:Init(role, effectData)
local v
for i=2, #effectData do
v = effectData[i]
local effectGroup = { 0, 0, {}} -- chooseId, duration, {effect1, effect2, ...}
local effectGroup = effectGroupPool:Get() -- chooseId, duration, {effect1, effect2, ...}
effectGroup[1] = v[1] --chooseId
effectGroup[2] = v[2] --duration
for j=3, #v do --effectList
local effect = {0, {}} -- type, {args, ...}
local effect = effectPool:Get() -- type, {args, ...}
effect[1] = v[j][1]
for k=2, #v[j] do
effect[2][k-1] = v[j][k]
@ -142,6 +148,19 @@ function Skill:Init(role, effectData)
end
end
function Skill:Dispose()
local effectGroup
while self.effectList.size > 0 do
effectGroup = self.effectList.buffer[self.effectList.size]
for k=1, #effectGroup[3] do
effectPool:Put(effectGroup[3][k])
effectGroup[3][k] = nil
end
effectGroupPool:Put(effectGroup)
self.effectList:Remove(self.effectList.size)
end
end
function Skill:ResetCD()
if not self.isTeamSkill then
if self.owner.superSkill == self then

View File

@ -72,10 +72,12 @@ end
function RoleLogic:Dispose()
if self.skill then
self.skill:Dispose()
skillPool:Put(self.skill)
self.skill = nil
end
if self.superSkill then
self.superSkill:Dispose()
skillPool:Put(self.superSkill)
self.superSkill = nil
end

View File

@ -111,7 +111,7 @@ public class SSkillLogicConfig implements BaseConfig {
// System.out.println("SSSSSS");
// }
skillTargetVo.setContinuedTime(targets[i][1]);
skillTargetVo.setEffectVale(getEffectVal(effect[i],effectValue,effect));
skillTargetVo.setEffectVale(getEffectVal(effect[i],effectValue, effect, i));
skillTargetVos.add(skillTargetVo);
}
SSkillLogicVo sSkillLogicVo = new SSkillLogicVo();
@ -121,7 +121,7 @@ public class SSkillLogicConfig implements BaseConfig {
return sSkillLogicVo;
}
private float[][] getEffectVal(int[] effects, float[][] effectValues,int[][] effect) {
private float[][] getEffectVal(int[] effects, float[][] effectValues,int[][] effect,int arrIndex) {
StringBuilder effectInfo = new StringBuilder();
for (int i = 0; i < effects.length; i++) {
if (effectInfo.length() == 0){
@ -129,7 +129,8 @@ public class SSkillLogicConfig implements BaseConfig {
}else {
effectInfo.append("|").append(effects[i]);
}
int index = getEffectValueIndex(effect, effects[i], i );
// int index = getEffectValueIndex(effect, effects[i], i );
int index = i + arrIndex;
float[] effectValue = effectValues[index];
for (float effectVal : effectValue) {
effectInfo.append("#").append(effectVal);

View File

@ -78,7 +78,7 @@ public class CheckFight {
LuaValue func = transCoderObj.get(LuaValue.valueOf("Execute"));
LuaValue result = func.call(LuaValue.valueOf(seed),fightData,optionData);
int status = result.get("result").toint();
int[] resultCache = new int[]{};
int[] resultCache = new int[result.length()+1];
resultCache[0]=status;
LOGGER.info(" lua check test fight result : "+ status);
if (status==1){