怪物组内添加灵兽提交

back_recharge
lvxinran 2020-10-27 17:23:04 +08:00
parent 09d9d1d536
commit 89122562b5
8 changed files with 65 additions and 34 deletions

View File

@ -173,10 +173,10 @@ public class BehaviorUtil {
fightData.setHeroFightInfos(fightTeamInfo);
//monster
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(groupId,monsterByGroup, Global.MONSTER_1);
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(groupId,monsterByGroup, Global.MONSTER_2);
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(groupId,monsterByGroup, Global.MONSTER_3);
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(groupId);
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_1);
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_2);
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_3);
for(Map.Entry<Integer,Map<Integer,Integer>> entry :mapManager.getMonsterTempSkill().entrySet()){
if(groupId!=entry.getKey()){
continue;
@ -344,9 +344,10 @@ public class BehaviorUtil {
fightData.setHeroFightInfos(fightTeamInfo);
//monster
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(groupId,monsterByGroup,0);
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(groupId,monsterByGroup,1);
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(groupId,monsterByGroup,2);
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(groupId);
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup,0);
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup,1);
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup,2);
fightData.addAllMonsterList(monsterGroupList).addAllMonsterList(monsterGroupList1).addAllMonsterList(monsterGroupList2);
//设置战斗随机种子
@ -377,15 +378,15 @@ public class BehaviorUtil {
* @param groupId
* @return
*/
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(int groupId,Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup,int mosterNum) {
String monsterTeamSkill = MonsterUtil.getMonsterTeamSkillByGroup(groupId);
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup,List<CommonProto.FightUnitInfo> monsterPokemonByGroup,int mosterNum) {
List<CommonProto.FightTeamInfo> monsterGroupList = new ArrayList<>();
if (monsterByGroup.size() > mosterNum){
CommonProto.FightTeamInfo monsterTeamInfo = CommonProto.FightTeamInfo.newBuilder()
.addAllFightUnitList(monsterByGroup.get(mosterNum))
// .setTeamSkillList(monsterTeamSkill)
.build();
monsterGroupList.add(monsterTeamInfo);
CommonProto.FightTeamInfo.Builder monsterTeamInfo = CommonProto.FightTeamInfo.newBuilder();
monsterTeamInfo.addAllFightUnitList(monsterByGroup.get(mosterNum));
if(monsterPokemonByGroup!=null){
monsterTeamInfo .addAllPokemonUnitList(monsterPokemonByGroup);
}
monsterGroupList.add(monsterTeamInfo.build());
}
return monsterGroupList;
}

View File

@ -966,11 +966,13 @@ public class ExpeditionLogic {
public static List<CommonProto.FightTeamInfo> getGropFightTeamInfoWithDouble(int gropid, Map<String, Double> attackBloodMap) {
public static List<CommonProto.FightTeamInfo> getGropFightTeamInfoWithDouble(int groupId, Map<String, Double> attackBloodMap) {
Map<Integer,List<Double>> hps = new HashMap<>();
hps.put(0,new LinkedList<>(attackBloodMap.values()));
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroupWithDouble = MonsterUtil.getMonsterByGroupWithDouble(gropid, hps);
List<CommonProto.FightTeamInfo> fightTeamInfos = BehaviorUtil.getFightTeamInfos(gropid, monsterByGroupWithDouble, Global.MONSTER_1);
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroupWithDouble = MonsterUtil.getMonsterByGroupWithDouble(groupId, hps);
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(groupId);
List<CommonProto.FightTeamInfo> fightTeamInfos = BehaviorUtil.getFightTeamInfos(monsterByGroupWithDouble,monsterPokemonByGroup, Global.MONSTER_1);
return fightTeamInfos;
}

View File

@ -536,7 +536,9 @@ public class CombatLogic {
hps.put(0,adventureBoss.getRemainHps());
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, teamId,true);
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(bossGroupId);
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_1);
//设置战斗随机种子
int seed = (int)(System.currentTimeMillis()/1000);
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
@ -582,7 +584,7 @@ public class CombatLogic {
}
hps.put(0,adventureBoss.getRemainHps());
monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
// monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId,monsterByGroup, Global.MONSTER_1);
//设置战斗随机种子
seed = (int)(System.currentTimeMillis()/1000);
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);

View File

@ -82,9 +82,10 @@ public class FightUtil {
//防守方是怪物
public static List<CommonProto.FightTeamInfo> makeMonsterFightData(int bossGroupId,int nums,Map<Integer,List<Integer>> monsterHp){
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = makeMonsterGroup(bossGroupId,monsterHp);
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(bossGroupId);
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
for(int i=0;i<nums;i++){
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId, monsterByGroup, i);
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, i);
monsterTeamList.addAll(monsterGroupList);
}
return monsterTeamList;
@ -258,8 +259,7 @@ public class FightUtil {
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
// .setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(user,teamId))
// .setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user,teamId))
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
.build();
}

View File

@ -2314,10 +2314,13 @@ public class HeroLogic{
* @return
*/
private Map<Integer,Integer> calOnePokemonAttribute(PokemonManager pokemonManager,String pokemonId){
Map<Integer,Integer> pokemonAttributeMap = new HashMap<>();
Pokemon pokemon = pokemonManager.getPokemonMap().get(pokemonId);
return calOnePokemonAttribute(pokemon.getTmpId(),pokemon.getStar(),pokemon.getLevel());
}
public Map<Integer,Integer> calOnePokemonAttribute(int tmpId,int star,int level){
Map<Integer,Integer> pokemonAttributeMap = new HashMap<>();
Map<Integer,Integer> oneAttrMap = new HashMap<>();
SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(pokemon.getTmpId());
SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(tmpId);
oneAttrMap.put(GlobalsDef.HP_TYPE,(int)animal.getHp());
oneAttrMap.put(GlobalsDef.ATTACK_TYPE,(int)animal.getAttack());
@ -2325,13 +2328,13 @@ public class HeroLogic{
oneAttrMap.put(GlobalsDef.MAGIC_DEFENCE_TYPE,(int)animal.getMagicDefence());
//等级增量
SSpiritAnimalLevel levelConfig = SSpiritAnimalLevel.configByQualityAndLevel.get(animal.getQuality()).get(pokemon.getLevel());
SSpiritAnimalLevel levelConfig = SSpiritAnimalLevel.configByQualityAndLevel.get(animal.getQuality()).get(level);
int[][] characterLevelPara = levelConfig.getCharacterLevelPara();
for(int[] para:characterLevelPara){
oneAttrMap.put(para[0],oneAttrMap.getOrDefault(para[0],0)+para[1]);
}
//星级增量
SSpiritAnimalStar starConfig = SSpiritAnimalStar.configByQualityAndStar.get(animal.getQuality()).get(pokemon.getStar());
SSpiritAnimalStar starConfig = SSpiritAnimalStar.configByQualityAndStar.get(animal.getQuality()).get(star);
int starPara = starConfig.getStarPara();
for(int key:oneAttrMap.keySet()){
pokemonAttributeMap.put(key,pokemonAttributeMap.getOrDefault(key,0)+(int)(oneAttrMap.getOrDefault(key,0)*(1+starPara/10000d)));
@ -2345,7 +2348,7 @@ public class HeroLogic{
* @param level
* @return
*/
private StringBuilder getOnePokemonProperty(Map<Integer,Integer> propertyMap,int level){
public StringBuilder getOnePokemonProperty(Map<Integer,Integer> propertyMap,int level){
StringBuilder builder = new StringBuilder();
builder.append(level);
for(int propId:pokemonTemplate){

View File

@ -194,7 +194,7 @@ public class FightDataUtil {
playerData.set("teamSkill","");
playerData.set("teamPassive", getTeamPassive(heroTeam.getTeamPassiveList()));
playerData.set("outData",heroTeam.getSpecialPassive());
//todo 灵兽技能
// 灵兽技能
playerData.set("monsterList", getPokemonSkill(heroTeam.getPokemonUnitListList(),0));
playerData.set("firstCamp",first?1:0);
return playerData;

View File

@ -4,9 +4,11 @@ import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.protocols.CommonProto;
import config.SMonsterConfig;
import config.SMonsterGroup;
import config.SSpiritAnimalSkill;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -171,10 +173,26 @@ public class MonsterUtil {
return (int)(maxForce*(0.8+groupIds.length*0.2));
}
public static String getMonsterTeamSkillByGroup(int groupId) {
if (SMonsterGroup.getsMonsterGroupMap().get(groupId).getSkill()!=null){
return SMonsterGroup.getsMonsterGroupMap().get(groupId).getSkill();
public static List<CommonProto.FightUnitInfo> getMonsterPokemonByGroup(int groupId) {
int[][] animal = SMonsterGroup.getsMonsterGroupMap().get(groupId).getAnimal();
if (animal==null||animal.length<1||animal[0].length<1){
return null;
}
return "";
List<CommonProto.FightUnitInfo> pokemonInfo = new ArrayList<>();
for(int i = 0 ; i <animal.length;i++){
CommonProto.FightUnitInfo.Builder info = CommonProto.FightUnitInfo.newBuilder();
info.setUnitId(String.valueOf(animal[i][0]));
info.setStar(animal[i][1]);
info.setPosition(i+1);
SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(animal[i][0]).get(animal[i][1]);
info.setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId()));
Map<Integer, Integer> map = HeroLogic.getInstance().calOnePokemonAttribute(animal[i][0], animal[i][1], animal[i][2]);
info.setProperty(HeroLogic.getInstance().getOnePokemonProperty(map,animal[i][2]).toString());
pokemonInfo.add(info.build());
}
return pokemonInfo;
}
}

View File

@ -16,8 +16,9 @@ public class SMonsterGroup implements BaseConfig {
private String skill;
@Override
private int[][] animal;
@Override
public void init() throws Exception {
sMonsterGroupMap = STableManager.getConfig(SMonsterGroup.class);
}
@ -41,4 +42,8 @@ public class SMonsterGroup implements BaseConfig {
public String getSkill() {
return skill;
}
public int[][] getAnimal() {
return animal;
}
}