拼接英雄属性

back_recharge
wangyuan 2019-03-18 13:57:07 +08:00
parent b2e560c8bc
commit 0507cb91de
4 changed files with 100 additions and 2 deletions

View File

@ -1,6 +1,6 @@
package com.ljsd.jieling.logic.dao;
public class TeamPosForPokenInfo {
public class TeamPosForPokenInfo implements Comparable<TeamPosForPokenInfo>{
private int position;
private int pokenId;
@ -29,4 +29,9 @@ public class TeamPosForPokenInfo {
public void setPosition(int position) {
this.position = position;
}
@Override
public int compareTo(TeamPosForPokenInfo o) {
return this.getPosition() - o.getPosition();
}
}

View File

@ -1,6 +1,8 @@
package com.ljsd.jieling.logic.dao;
public class TeamPosHeroInfo {
import java.util.Comparator;
public class TeamPosHeroInfo implements Comparable<TeamPosHeroInfo> {
private String heroId;
private int position;
@ -28,4 +30,10 @@ public class TeamPosHeroInfo {
public void setPosition(int position) {
this.position = position;
}
@Override
public int compareTo(TeamPosHeroInfo o) {
return this.getPosition()-o.getPosition();
}
}

View File

@ -0,0 +1,39 @@
package com.ljsd.jieling.logic.hero;
public enum HeroAttributeEnum {
Hp(1),
Attack(2),
PhysicalDefence(3),
MagicDefence(4),
Speed(5),
DamageBocusFactor(51),
DamageReduceFactor(52),
Hit(53),
Dodge(54),
CritFactor(55),
CritDamageFactor(56),
TreatFacter(57),
FireDamageBonusFactor(101),
WindDamageBonusFactor(102),
WaterDamageBonusFactor(103),
LandDamageBonusFactor(104),
LightDamageBonusFactor(105),
DarkDamageBonusFactor(106),
FireDamageReduceFactor(107),
WindDamageReduceFactor(108),
WaterDamageReduceFactor(109),
LandDamageReduceFactor(110),
LightDamageReduceFactor(111),
DarkDamageReduceFactor(112),
;
private int propertyId;
HeroAttributeEnum(int propertyId) {
this.propertyId = propertyId;
}
public int getPropertyId() {
return propertyId;
}
}

View File

@ -24,6 +24,14 @@ public class HeroLogic {
private HeroLogic(){}
public static List<Integer> transTemplate = new ArrayList<>();
static {
transTemplate.add(HeroAttributeEnum.Hp.getPropertyId());
transTemplate.add(HeroAttributeEnum.Attack.getPropertyId());
}
private static final String DIVISION = "#";
public void getAllEquipInfo(ISession iSession,int index) throws Exception {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
@ -610,6 +618,44 @@ public class HeroLogic {
return result;
}
public List<String> getHeroFightInfo(User user,int teamId){
List<String> result = new ArrayList<>(5);
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
Collections.sort(teamPosHeroInfoList);
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
for(TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList){
String heroId = teamPosHeroInfo.getHeroId();
Hero hero = heroMap.get(heroId);
Map<Integer, Integer> heroAttributeMap = calHeroFinalAttribute(user, hero);
StringBuilder sb = new StringBuilder(hero.getTemplateId()).append(DIVISION);
for(Integer templatePropetyId:transTemplate){
Integer propertyValue = heroAttributeMap.get(templatePropetyId);
if(propertyValue == null){
propertyValue =0;
}
sb.append(propertyValue).append(DIVISION);
}
result.add(sb.toString());
}
return result;
}
public List<Integer> getPokenmonSkills(User user,int teamId){
List<Integer> pokenSkillResult = new ArrayList<>(3);
List<TeamPosForPokenInfo> teamPosForPokenInfos = user.getTeamPosManager().getTeamPosForPoken().get(teamId);
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
Collections.sort(teamPosForPokenInfos);
for(TeamPosForPokenInfo teamPosForPokenInfo:teamPosForPokenInfos){
int pokemonId = teamPosForPokenInfo.getPokenId();
Pokemon pokemon = pokemonMap.get(pokemonId);
SDifferDemonsStageConfig sDifferDemonsStageConfig = SDifferDemonsStageConfig.getsDifferDemonsStageConfigMap(pokemonId*100 + pokemon.getAllStage());
pokenSkillResult.add(sDifferDemonsStageConfig.getSkillId());
}
return pokenSkillResult;
}
//获取英雄所有属性
public Map<Integer,Integer> calHeroFinalAttribute(User user, Hero hero){
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero);