back_recharge
mashiyu 2019-03-22 11:00:12 +08:00
parent 60f1dd0aff
commit e227cefbad
2 changed files with 43 additions and 21 deletions

View File

@ -165,7 +165,6 @@ end
function BattleLogic.AddRole(roleData)
curUid = curUid + 1
local data = rolePool:Get()
--rolePool:Get(curUid, roleData)
data:Init(curUid, roleData)
objList:Add(curUid, data)
BattleLogic.Event:DispatchEvent(BattleEventName.AddRole, data)
@ -310,24 +309,20 @@ function BattleLogic.BattleEnd(result)
end
function BattleLogic.Clear()
local index = 1
while index <= objList.size do
BattleLogic.RemoveObj(objList.vList[index].uid)
while objList.size > 0 do
BattleLogic.RemoveObj(objList.vList[objList.size].uid)
end
index = 1
while index <= tbActionList.size do
actionPool:Put(tbActionList.buffer[index])
tbActionList:Remove(index)
while tbActionList.size > 0 do
actionPool:Put(tbActionList.buffer[tbActionList.size])
tbActionList:Remove(tbActionList.size)
end
end
function BattleLogic.ClearOrder()
local index = 1
local count = objList.size
while index <= count do
while index <= objList.size do
if objList.vList[index].camp == 1 then
BattleLogic.RemoveObj(objList.vList[index].uid)
count = count - 1
else
index = index + 1
end

View File

@ -14,18 +14,18 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class SSkillLogicConfig implements BaseConfig {
public static Map<Integer, SSkillLogicConfig> sSkillLogicConfigMap;
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 {
sSkillLogicConfigMap = STableManager.getConfig(SSkillLogicConfig.class);
Map<Integer,SSkillLogicVo> skillLogicVoMap = new ConcurrentHashMap<>();
@ -57,6 +57,32 @@ 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;
}
@ -76,7 +102,7 @@ public class SSkillLogicConfig implements BaseConfig {
SkillTargetVo skillTargetVo = new SkillTargetVo();
skillTargetVo.setTargetId((int) targets[i][0]);
skillTargetVo.setContinuedTime(targets[i][1]);
skillTargetVo.setEffectVale(getEffectVal(effect[i],effectValue,i));
skillTargetVo.setEffectVale(getEffectVal(effect[i],effectValue,effect));
skillTargetVos.add(skillTargetVo);
}
SSkillLogicVo sSkillLogicVo = new SSkillLogicVo();
@ -86,7 +112,7 @@ public class SSkillLogicConfig implements BaseConfig {
return sSkillLogicVo;
}
private float[][] getEffectVal(int[] effects, float[][] effectValues,int index) {
private float[][] getEffectVal(int[] effects, float[][] effectValues,int[][] effect) {
StringBuilder effectInfo = new StringBuilder();
for (int i = 0; i < effects.length; i++) {
if (effectInfo.length() == 0){
@ -94,7 +120,8 @@ public class SSkillLogicConfig implements BaseConfig {
}else {
effectInfo.append("|").append(effects[i]);
}
float[] effectValue = effectValues[i +index];
int index = getEffectValueIndex(effect, effects[i]);
float[] effectValue = effectValues[index];
for (float effectVal : effectValue) {
effectInfo.append("#").append(effectVal);
}