pokemon skill

back_recharge
wangyuan 2019-10-21 14:20:56 +08:00
parent d3158986b2
commit b9b8eaba39
2 changed files with 21 additions and 9 deletions

View File

@ -1003,16 +1003,22 @@ public class HeroLogic {
public String getPokenmonSkills(User user,int teamId){
StringBuilder pokenSkillResult = new StringBuilder();
List<TeamPosForPokenInfo> teamPosForPokenInfos = user.getTeamPosManager().getTeamPosForPoken().get(teamId);
if (teamPosForPokenInfos==null){
if (teamPosForPokenInfos==null || teamPosForPokenInfos.isEmpty()){
return "";
}
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
Collections.sort(teamPosForPokenInfos);
for(TeamPosForPokenInfo teamPosForPokenInfo:teamPosForPokenInfos){
int size = teamPosForPokenInfos.size();
for(int i=0;i<size;i++){
TeamPosForPokenInfo teamPosForPokenInfo = teamPosForPokenInfos.get(i);
int pokemonId = teamPosForPokenInfo.getPokenId();
int position = teamPosForPokenInfo.getPosition();
Pokemon pokemon = pokemonMap.get(pokemonId);
SDifferDemonsStageConfig sDifferDemonsStageConfig = SDifferDemonsStageConfig.getsDifferDemonsStageConfigMap(pokemonId*100 + pokemon.getAllStage());
pokenSkillResult.append(sDifferDemonsStageConfig.getSkillId()).append("#");
pokenSkillResult.append(position).append("#").append(sDifferDemonsStageConfig.getSkillId());
if(i!=size-1){
pokenSkillResult.append("|");
}
}
return pokenSkillResult.toString();
}

View File

@ -217,13 +217,15 @@ public class FightDataUtil {
private static LuaValue getTeamSkill(String pokemonSkill) {
LuaValue teamSkill = new LuaTable();
if (pokemonSkill.equals("") || pokemonSkill==null){
if (StringUtil.isEmpty(pokemonSkill)){
return teamSkill;
}
String[] skills = pokemonSkill.trim().split("#");
String[] skills = pokemonSkill.trim().split("\\|");
for (int i = 0; i < skills.length; i++) {
if (Integer.parseInt(skills[i])>0){
teamSkill.rawset(i + 1, getSkill(skills[i]));
String skillAndPos = skills[i];
String[] skillAndPosItem = skillAndPos.split("#");
if (Integer.parseInt(skillAndPosItem[1])>0){
teamSkill.rawset(i + 1, getSkill(skillAndPosItem[1],skillAndPosItem[0]));
}
}
return teamSkill;
@ -269,14 +271,18 @@ public class FightDataUtil {
return property;
}
private static LuaValue getSkill(String skillId) {
private static LuaValue getSkill(String skillId,String...args) {
LuaValue skill = new LuaTable();
if (skillId==null || skillId.equals("") ){
return skill;
}
SSkillLogicVo sSkillLogicVo = SSkillLogicConfig.getsSkillLogicVo(Integer.valueOf(skillId));
if (sSkillLogicVo != null && sSkillLogicVo.getSkillTargetVoList().size()>0) {
skill.rawset(1, LuaValue.valueOf(sSkillLogicVo.getCd()));
float cd = sSkillLogicVo.getCd();
if(args!=null&&args.length>0){
cd+=Integer.parseInt(args[0]);
}
skill.rawset(1, LuaValue.valueOf(cd));
List<LuaValue> effectList = getEffect(sSkillLogicVo);
int size = effectList.size();
if (size > 0) {