back_recharge
zhangshanxue 2019-09-24 10:21:36 +08:00
commit aa12e2ecd0
8 changed files with 85 additions and 26 deletions

View File

@ -17,6 +17,8 @@ public class SEndlessDifficulty implements BaseConfig{
private int[] rewardId;
private int[] mapPool;
public static Map<Integer,SEndlessDifficulty> difficultyMap;
public static Map<Integer,Integer> difficultyMonster;
@ -75,4 +77,8 @@ public class SEndlessDifficulty implements BaseConfig{
public int[] getRewardId() {
return rewardId;
}
public int[] getMapPool() {
return mapPool;
}
}

View File

@ -25,6 +25,8 @@ public class SEndlessMapConfig implements BaseConfig {
private int[][] initializeCount;
private int mapStoreId;
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
public static Map<Integer,Map<Integer,Integer>> initRandomPointMap;
@ -75,4 +77,8 @@ public class SEndlessMapConfig implements BaseConfig {
public int[][] getInitializeCount() {
return initializeCount;
}
public int getMapStoreId() {
return mapStoreId;
}
}

View File

@ -17,6 +17,7 @@ public class FamilyFightAttackHandler extends BaseHandler<Family.FamilyFightAtta
@Override
public void processWithProto(ISession iSession, Family.FamilyFightAttackRequest proto) throws Exception {
int attackUid = proto.getAttackUid();
GuildFightLogic.familyFightResult(iSession,attackUid, MessageTypeProto.MessageType.FAMILY_FIGHT_ATTACK_RESPONSE);
int gid = proto.getGid();
GuildFightLogic.familyFightResult(iSession,attackUid,gid, MessageTypeProto.MessageType.FAMILY_FIGHT_ATTACK_RESPONSE);
}
}

View File

@ -101,20 +101,15 @@ public class BloodLogic {
* @param heroInfo
* @return
*/
public CommonProto.FightTeamInfo fightDataMakeUp(User user ,Map<String, FamilyHeroInfo> heroInfo,int teamId){
public CommonProto.FightTeamInfo fightDataMakeUp(Map<String ,String> heroSkills ,Map<String, FamilyHeroInfo> heroInfo,String pokmanSkill){
List<CommonProto.FightUnitInfo> heroDefendFightInfos = new ArrayList<>();
for (Map.Entry<String, FamilyHeroInfo> entry : heroInfo.entrySet()) {
Hero hero = user.getHeroManager().getHero(entry.getKey());
if (hero == null) {
continue;
}
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero, skillSb).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero, entry.getValue().getAttribute()).toString();
String heroSkill = heroSkills.get(entry.getKey());
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, entry.getValue(), entry.getValue().getAttribute()).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitId(Integer.toString(entry.getValue().getTempleteId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.build();
@ -123,7 +118,7 @@ public class BloodLogic {
CommonProto.FightTeamInfo fightDefendTeamInfo = CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroDefendFightInfos)
.setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(user, teamId))
.setTeamSkillList(pokmanSkill)
.build();
return fightDefendTeamInfo;
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.dao;
import java.util.HashMap;
import java.util.Map;
public class FamilyFightInfo {
@ -9,6 +10,9 @@ public class FamilyFightInfo {
private int buildId;
private int starCount;
private int force;
private Map<String, String> heroSkills = new HashMap<>();
private String pokenmonSkills;
public Map<String, FamilyHeroInfo> getHeroAttribute() {
return heroAttribute;
@ -57,4 +61,23 @@ public class FamilyFightInfo {
public void setForce(int force) {
this.force = force;
}
public void updateHeroSkill(String heroId, String skills){
heroSkills.put(heroId,skills);
}
public Map<String, String> getHeroSkills() {
return heroSkills;
}
public void setHeroSkills(Map<String, String> heroSkills) {
this.heroSkills = heroSkills;
}
public String getPokenmonSkills() {
return pokenmonSkills;
}
public void setPokenmonSkills(String pokenmonSkills) {
this.pokenmonSkills = pokenmonSkills;
}
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.dao;
import java.util.HashMap;
import java.util.Map;
public class FamilyHeroInfo {

View File

@ -0,0 +1,12 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
public class MainLevelManager extends MongoBase {
private int fightId; // 当前关卡id
private int state; //状态
private int startTime;
}

View File

@ -286,14 +286,13 @@ public class GuildFightLogic {
}
int familyTotalStar = 0;
//血量记录处理,星级记录处理
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
User user = UserManager.getUser(entry.getKey());
int memberType = GuildLogic.getMemberType(entry.getKey(), guildInfo.getMembers());
int[] buffInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_BUFF, gid.toString(), entry.getValue().toString(), int[].class);
FamilyFightInfo fightInfo = new FamilyFightInfo();
//血量处理buff处理
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
if(force==0){
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
@ -303,6 +302,20 @@ public class GuildFightLogic {
fightInfo.setBuildId(entry.getValue());
fightInfo.setStarCount(guildSetting.getStarNum()[memberType-1]);
fightInfo.setForce(force);
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(501);
if(teamPosHeroInfoList==null||teamPosHeroInfoList.size()<1){
teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(1);
}
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
for(TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList){
String heroId = teamPosHeroInfo.getHeroId();
Hero hero = heroMap.get(heroId);
StringBuilder skillSb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero,skillSb ).toString();
fightInfo.updateHeroSkill(heroId,heroSkill.substring(0, heroSkill.length() - 1));
}
String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user, 501);
fightInfo.setPokenmonSkills(pokenmonSkills);
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildInfo.getId()), String.valueOf(entry.getKey()), fightInfo);
familyTotalStar+=fightInfo.getStarCount();
}
@ -366,7 +379,7 @@ public class GuildFightLogic {
/**
*
*/
public static void familyFightResult(ISession session, int defendUid, MessageTypeProto.MessageType messageType) throws Exception {
public static void familyFightResult(ISession session, int defendUid,int gid, MessageTypeProto.MessageType messageType) throws Exception {
User userAttack = UserManager.getUser(session.getUid());
RedisUtil redisUtil = RedisUtil.getInstence();
//战斗次数
@ -375,13 +388,10 @@ public class GuildFightLogic {
attackCount = 0;
}
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(userAttack.getId()),attackCount+1);
User userDefend = UserManager.getUser(defendUid);
int defendGuildId = userDefend.getPlayerInfoManager().getGuildId();
int defendBuildId = GuilidManager.guildInfoMap.get(defendGuildId).getDefendInfo().get(defendUid);
FamilyFightInfo defendInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(defendGuildId), String.valueOf(userDefend.getId()), FamilyFightInfo.class);
FamilyFightInfo defendInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(gid), String.valueOf(defendUid), FamilyFightInfo.class);
Map<String, FamilyHeroInfo> heroAttribute = defendInfo.getHeroAttribute();
//防守血量处理
CommonProto.FightTeamInfo fightDefendTeamInfo = BloodLogic.getInstance().fightDataMakeUp(userDefend,heroAttribute,501);
CommonProto.FightTeamInfo fightDefendTeamInfo = BloodLogic.getInstance().fightDataMakeUp(defendInfo.getHeroSkills(),heroAttribute,defendInfo.getPokenmonSkills());
//攻击者血量处理
CommonProto.FightTeamInfo fightAttackTeamInfo = null;
List<CommonProto.FightUnitInfo> heroAttackFightInfos = new ArrayList<>();
@ -395,7 +405,7 @@ public class GuildFightLogic {
}
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(userDefend, hero, skillSb).toString();
String heroSkill = HeroLogic.getInstance().getHeroSkills(userAttack, hero, skillSb).toString();
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(userAttack, hero, false, 502);
for(Map.Entry<String,String> blood:attackBloodMap.entrySet()){
if(teamHero.getHeroId().equals(blood.getKey())){
@ -461,7 +471,9 @@ public class GuildFightLogic {
indexAttack++;
}
}else{
int memberType = GuildLogic.getMemberType(defendUid, GuilidManager.guildInfoMap.get(defendGuildId).getMembers());
PlayerInfoCache player = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(defendUid), PlayerInfoCache.class);
int memberType =player.getGuildPosition();
int maxStar = sGuildSetting.getStarNum()[memberType-1];
int lessStar = maxStar - dieCount*maxStar/5;
//倍数k(maxStar/5)
@ -471,10 +483,10 @@ public class GuildFightLogic {
redisUtil.putMapEntry(RedisKey.FAMILY_ATTACK_BLOOD,String.valueOf(userAttack.getId()),attack.getHeroId(),100);
}
}
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(defendGuildId), String.valueOf(userDefend.getId()), defendInfo);
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(gid), String.valueOf(defendUid), defendInfo);
//发送indication
Family.DefeatResponse fightResponse = Family.DefeatResponse.newBuilder().setUid(defendUid).setTeamLostStar(getStar).build();
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(userDefend.getPlayerInfoManager().getGuildId()), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,fightResponse);
// GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(gid), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,fightResponse);
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(userAttack.getPlayerInfoManager().getGuildId()), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,fightResponse);
//获得星数处理
int attackGuildId = userAttack.getPlayerInfoManager().getGuildId();
@ -485,11 +497,11 @@ public class GuildFightLogic {
}
redisUtil.zsetAddOne(attackRankKey,String.valueOf(userAttack.getId()),starCount+getStar);
//建筑星数
Integer haveGotStar = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR, String.valueOf(attackGuildId), String.valueOf(defendBuildId), int.class);
Integer haveGotStar = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR, String.valueOf(attackGuildId), String.valueOf(defendInfo.getBuildId()), int.class);
if(haveGotStar==null){
haveGotStar = 0;
}
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(attackGuildId),String.valueOf(defendBuildId),haveGotStar+getStar);
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(attackGuildId),String.valueOf(defendInfo.getBuildId()),haveGotStar+getStar);
Family.FamilyFightAttackResponse response = Family.FamilyFightAttackResponse.newBuilder().setResult(fightResult[0]).setStarCount(getStar).setData(fightData).build();
userAttack.getUserMissionManager().onGameEvent(userAttack, GameEvent.FAMILY_FIGHT_ATTACK);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
@ -626,6 +638,9 @@ public class GuildFightLogic {
redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT_BUFF,index,String.valueOf(i));
}
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(index));
if(guildInfo==null){
continue;
}
//删除进攻血量信息
for(Map.Entry<Integer,Set<Integer>> entry:guildInfo.getMembers().entrySet()){
for(Integer attackId:entry.getValue()){
@ -661,7 +676,7 @@ public class GuildFightLogic {
}
LOGGER.info("{}公会结算",str);
// Map<Integer, Integer> enemyDefendInfo = GuilidManager.guildInfoMap.get(enemyFamily).getDefendInfo();
Map<Integer, FamilyFightInfo> fightInfo = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, "", Integer.class, FamilyFightInfo.class);
Map<Integer, FamilyFightInfo> fightInfo = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, String.valueOf(enemyFamily), Integer.class, FamilyFightInfo.class);
for(Map.Entry<Integer, FamilyFightInfo> defend:fightInfo.entrySet()){
if(defend!=null){
buildStar[defend.getValue().getBuildId()-1] = buildStar[defend.getValue().getBuildId()-1]+defend.getValue().getStarCount();