怪物组内添加灵兽提交
parent
09d9d1d536
commit
89122562b5
|
@ -173,10 +173,10 @@ public class BehaviorUtil {
|
||||||
fightData.setHeroFightInfos(fightTeamInfo);
|
fightData.setHeroFightInfos(fightTeamInfo);
|
||||||
//monster
|
//monster
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
||||||
|
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(groupId);
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(groupId,monsterByGroup, Global.MONSTER_1);
|
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_1);
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(groupId,monsterByGroup, Global.MONSTER_2);
|
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_2);
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(groupId,monsterByGroup, Global.MONSTER_3);
|
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup, Global.MONSTER_3);
|
||||||
for(Map.Entry<Integer,Map<Integer,Integer>> entry :mapManager.getMonsterTempSkill().entrySet()){
|
for(Map.Entry<Integer,Map<Integer,Integer>> entry :mapManager.getMonsterTempSkill().entrySet()){
|
||||||
if(groupId!=entry.getKey()){
|
if(groupId!=entry.getKey()){
|
||||||
continue;
|
continue;
|
||||||
|
@ -344,9 +344,10 @@ public class BehaviorUtil {
|
||||||
fightData.setHeroFightInfos(fightTeamInfo);
|
fightData.setHeroFightInfos(fightTeamInfo);
|
||||||
//monster
|
//monster
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(groupId,monsterByGroup,0);
|
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(groupId);
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(groupId,monsterByGroup,1);
|
List<CommonProto.FightTeamInfo> monsterGroupList = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup,0);
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(groupId,monsterByGroup,2);
|
List<CommonProto.FightTeamInfo> monsterGroupList1 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup,1);
|
||||||
|
List<CommonProto.FightTeamInfo> monsterGroupList2 = getFightTeamInfos(monsterByGroup,monsterPokemonByGroup,2);
|
||||||
fightData.addAllMonsterList(monsterGroupList).addAllMonsterList(monsterGroupList1).addAllMonsterList(monsterGroupList2);
|
fightData.addAllMonsterList(monsterGroupList).addAllMonsterList(monsterGroupList1).addAllMonsterList(monsterGroupList2);
|
||||||
|
|
||||||
//设置战斗随机种子
|
//设置战斗随机种子
|
||||||
|
@ -377,15 +378,15 @@ public class BehaviorUtil {
|
||||||
* @param groupId
|
* @param groupId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(int groupId,Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup,int mosterNum) {
|
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup,List<CommonProto.FightUnitInfo> monsterPokemonByGroup,int mosterNum) {
|
||||||
String monsterTeamSkill = MonsterUtil.getMonsterTeamSkillByGroup(groupId);
|
|
||||||
List<CommonProto.FightTeamInfo> monsterGroupList = new ArrayList<>();
|
List<CommonProto.FightTeamInfo> monsterGroupList = new ArrayList<>();
|
||||||
if (monsterByGroup.size() > mosterNum){
|
if (monsterByGroup.size() > mosterNum){
|
||||||
CommonProto.FightTeamInfo monsterTeamInfo = CommonProto.FightTeamInfo.newBuilder()
|
CommonProto.FightTeamInfo.Builder monsterTeamInfo = CommonProto.FightTeamInfo.newBuilder();
|
||||||
.addAllFightUnitList(monsterByGroup.get(mosterNum))
|
monsterTeamInfo.addAllFightUnitList(monsterByGroup.get(mosterNum));
|
||||||
// .setTeamSkillList(monsterTeamSkill)
|
if(monsterPokemonByGroup!=null){
|
||||||
.build();
|
monsterTeamInfo .addAllPokemonUnitList(monsterPokemonByGroup);
|
||||||
monsterGroupList.add(monsterTeamInfo);
|
}
|
||||||
|
monsterGroupList.add(monsterTeamInfo.build());
|
||||||
}
|
}
|
||||||
return monsterGroupList;
|
return monsterGroupList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<>();
|
Map<Integer,List<Double>> hps = new HashMap<>();
|
||||||
hps.put(0,new LinkedList<>(attackBloodMap.values()));
|
hps.put(0,new LinkedList<>(attackBloodMap.values()));
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroupWithDouble = MonsterUtil.getMonsterByGroupWithDouble(gropid, hps);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroupWithDouble = MonsterUtil.getMonsterByGroupWithDouble(groupId, hps);
|
||||||
List<CommonProto.FightTeamInfo> fightTeamInfos = BehaviorUtil.getFightTeamInfos(gropid, monsterByGroupWithDouble, Global.MONSTER_1);
|
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(groupId);
|
||||||
|
|
||||||
|
List<CommonProto.FightTeamInfo> fightTeamInfos = BehaviorUtil.getFightTeamInfos(monsterByGroupWithDouble,monsterPokemonByGroup, Global.MONSTER_1);
|
||||||
return fightTeamInfos;
|
return fightTeamInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -536,7 +536,9 @@ public class CombatLogic {
|
||||||
hps.put(0,adventureBoss.getRemainHps());
|
hps.put(0,adventureBoss.getRemainHps());
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, teamId,true);
|
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, teamId,true);
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
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);
|
int seed = (int)(System.currentTimeMillis()/1000);
|
||||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||||
|
@ -582,7 +584,7 @@ public class CombatLogic {
|
||||||
}
|
}
|
||||||
hps.put(0,adventureBoss.getRemainHps());
|
hps.put(0,adventureBoss.getRemainHps());
|
||||||
monsterByGroup = MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
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);
|
seed = (int)(System.currentTimeMillis()/1000);
|
||||||
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterGroupList);
|
||||||
|
|
|
@ -82,9 +82,10 @@ public class FightUtil {
|
||||||
//防守方是怪物
|
//防守方是怪物
|
||||||
public static List<CommonProto.FightTeamInfo> makeMonsterFightData(int bossGroupId,int nums,Map<Integer,List<Integer>> monsterHp){
|
public static List<CommonProto.FightTeamInfo> makeMonsterFightData(int bossGroupId,int nums,Map<Integer,List<Integer>> monsterHp){
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = makeMonsterGroup(bossGroupId,monsterHp);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = makeMonsterGroup(bossGroupId,monsterHp);
|
||||||
|
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(bossGroupId);
|
||||||
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
|
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
|
||||||
for(int i=0;i<nums;i++){
|
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);
|
monsterTeamList.addAll(monsterGroupList);
|
||||||
}
|
}
|
||||||
return monsterTeamList;
|
return monsterTeamList;
|
||||||
|
@ -258,8 +259,7 @@ public class FightUtil {
|
||||||
return CommonProto.FightTeamInfo.
|
return CommonProto.FightTeamInfo.
|
||||||
newBuilder()
|
newBuilder()
|
||||||
.addAllFightUnitList(heroFightInfos)
|
.addAllFightUnitList(heroFightInfos)
|
||||||
// .setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(user,teamId))
|
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
|
||||||
// .setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user,teamId))
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2314,10 +2314,13 @@ public class HeroLogic{
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<Integer,Integer> calOnePokemonAttribute(PokemonManager pokemonManager,String pokemonId){
|
private Map<Integer,Integer> calOnePokemonAttribute(PokemonManager pokemonManager,String pokemonId){
|
||||||
Map<Integer,Integer> pokemonAttributeMap = new HashMap<>();
|
|
||||||
Pokemon pokemon = pokemonManager.getPokemonMap().get(pokemonId);
|
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<>();
|
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.HP_TYPE,(int)animal.getHp());
|
||||||
oneAttrMap.put(GlobalsDef.ATTACK_TYPE,(int)animal.getAttack());
|
oneAttrMap.put(GlobalsDef.ATTACK_TYPE,(int)animal.getAttack());
|
||||||
|
|
||||||
|
@ -2325,13 +2328,13 @@ public class HeroLogic{
|
||||||
|
|
||||||
oneAttrMap.put(GlobalsDef.MAGIC_DEFENCE_TYPE,(int)animal.getMagicDefence());
|
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();
|
int[][] characterLevelPara = levelConfig.getCharacterLevelPara();
|
||||||
for(int[] para:characterLevelPara){
|
for(int[] para:characterLevelPara){
|
||||||
oneAttrMap.put(para[0],oneAttrMap.getOrDefault(para[0],0)+para[1]);
|
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();
|
int starPara = starConfig.getStarPara();
|
||||||
for(int key:oneAttrMap.keySet()){
|
for(int key:oneAttrMap.keySet()){
|
||||||
pokemonAttributeMap.put(key,pokemonAttributeMap.getOrDefault(key,0)+(int)(oneAttrMap.getOrDefault(key,0)*(1+starPara/10000d)));
|
pokemonAttributeMap.put(key,pokemonAttributeMap.getOrDefault(key,0)+(int)(oneAttrMap.getOrDefault(key,0)*(1+starPara/10000d)));
|
||||||
|
@ -2345,7 +2348,7 @@ public class HeroLogic{
|
||||||
* @param level
|
* @param level
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private StringBuilder getOnePokemonProperty(Map<Integer,Integer> propertyMap,int level){
|
public StringBuilder getOnePokemonProperty(Map<Integer,Integer> propertyMap,int level){
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(level);
|
builder.append(level);
|
||||||
for(int propId:pokemonTemplate){
|
for(int propId:pokemonTemplate){
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class FightDataUtil {
|
||||||
playerData.set("teamSkill","");
|
playerData.set("teamSkill","");
|
||||||
playerData.set("teamPassive", getTeamPassive(heroTeam.getTeamPassiveList()));
|
playerData.set("teamPassive", getTeamPassive(heroTeam.getTeamPassiveList()));
|
||||||
playerData.set("outData",heroTeam.getSpecialPassive());
|
playerData.set("outData",heroTeam.getSpecialPassive());
|
||||||
//todo 灵兽技能
|
// 灵兽技能
|
||||||
playerData.set("monsterList", getPokemonSkill(heroTeam.getPokemonUnitListList(),0));
|
playerData.set("monsterList", getPokemonSkill(heroTeam.getPokemonUnitListList(),0));
|
||||||
playerData.set("firstCamp",first?1:0);
|
playerData.set("firstCamp",first?1:0);
|
||||||
return playerData;
|
return playerData;
|
||||||
|
|
|
@ -4,9 +4,11 @@ import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.handler.map.MapLogic;
|
import com.ljsd.jieling.handler.map.MapLogic;
|
||||||
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import config.SMonsterConfig;
|
import config.SMonsterConfig;
|
||||||
import config.SMonsterGroup;
|
import config.SMonsterGroup;
|
||||||
|
import config.SSpiritAnimalSkill;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -171,10 +173,26 @@ public class MonsterUtil {
|
||||||
return (int)(maxForce*(0.8+groupIds.length*0.2));
|
return (int)(maxForce*(0.8+groupIds.length*0.2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMonsterTeamSkillByGroup(int groupId) {
|
public static List<CommonProto.FightUnitInfo> getMonsterPokemonByGroup(int groupId) {
|
||||||
if (SMonsterGroup.getsMonsterGroupMap().get(groupId).getSkill()!=null){
|
int[][] animal = SMonsterGroup.getsMonsterGroupMap().get(groupId).getAnimal();
|
||||||
return SMonsterGroup.getsMonsterGroupMap().get(groupId).getSkill();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,9 @@ public class SMonsterGroup implements BaseConfig {
|
||||||
|
|
||||||
private String skill;
|
private String skill;
|
||||||
|
|
||||||
|
private int[][] animal;
|
||||||
@Override
|
|
||||||
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
sMonsterGroupMap = STableManager.getConfig(SMonsterGroup.class);
|
sMonsterGroupMap = STableManager.getConfig(SMonsterGroup.class);
|
||||||
}
|
}
|
||||||
|
@ -41,4 +42,8 @@ public class SMonsterGroup implements BaseConfig {
|
||||||
public String getSkill() {
|
public String getSkill() {
|
||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[][] getAnimal() {
|
||||||
|
return animal;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue