From f078d184f0e8f5e5d42b1a4c495d91986ae7f72a Mon Sep 17 00:00:00 2001 From: lvxinran Date: Fri, 28 Aug 2020 04:10:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=AF=E6=9C=AC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/map/mapType/AbstractMap.java | 26 +++++++++++++++++- .../handler/map/mapType/EndlessMap.java | 27 +++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/AbstractMap.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/AbstractMap.java index fad92986a..0824b7451 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/AbstractMap.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/AbstractMap.java @@ -6,6 +6,7 @@ import com.ljsd.fight.CheckFight; import com.ljsd.fight.FightType; import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig; import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig; +import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.exception.ErrorCode; @@ -300,7 +301,7 @@ public abstract class AbstractMap implements IMap { int[] checkResult = new int[0]; int monsterGroupId=0; - List remainHp = new ArrayList<>(5); + List remainHp = new ArrayList<>(6); int seed = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_SEED)); monsterGroupId = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_GROUPID)); CommonProto.FightTeamInfo.Builder fightTeamBuilder = CommonProto.FightTeamInfo.newBuilder(); @@ -352,6 +353,29 @@ public abstract class AbstractMap implements IMap { } return; } + + //无尽本更新血量 + if(mapManager.getCurMapType()==MapEnum.ENDLESS_MAP.getType()){ + List team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM); + if(resultCode==0) { + user.getTeamPosManager().updateTeamPosByTeamId(GlobalsDef.ENDLESS_TEAM, new ArrayList<>()); + for (int i = 0 ; i heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,GlobalsDef.ENDLESS_TEAM); + int per = (int)(checkResult[position+1] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000); + if(checkResult[i+1]>0&&per<=0){ + per = 1; + } + mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per); + } + } + } + for (int i = 2; i < checkResult.length; i++) { if (checkResult[i] <= 0) { remainHp.add(0); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/EndlessMap.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/EndlessMap.java index 2d109650a..222dd2625 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/EndlessMap.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/map/mapType/EndlessMap.java @@ -215,6 +215,19 @@ public class EndlessMap extends AbstractMap{ int groupId = option[0]; PVEFightEvent pveFightEvent = new PVEFightEvent(uid, GlobalsDef.ENDLESS_TEAM, 10, "", GameFightType.MapFastFight, groupId, 3); +// List endteam = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM); +// Map bloodMap = new HashMap<>(); +// Map endlessHeroInfo = mapManager.getEndlessMapInfo().getEndlessHeroInfo(); +// for (int i = 0 ; i heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,GlobalsDef.ENDLESS_TEAM); +//// int blood = (int)((heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())/10000d)* endlessHeroInfo.get(heroId)); +// +// bloodMap.put(heroId,(10000-endlessHeroInfo.get(heroId))/100); +// } +// pveFightEvent.setAttackBloodMap(bloodMap); //怪物剩余血量 FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent); int[] checkResult = fightResult.getCheckResult(); @@ -233,19 +246,29 @@ public class EndlessMap extends AbstractMap{ } }else{ for (int i = 0 ; i heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,GlobalsDef.ENDLESS_TEAM); - int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000); - if(checkResult[i+2]>0&&per<=0){ + int per = (int)(checkResult[position+1] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000); + if(checkResult[i+1]>0&&per<=0){ per = 1; } mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per); } endlessRefreshMonster(uid,mapManager.getTriggerXY()); + List updateTeam = new ArrayList<>(); + Map endlessHeroInfo = mapManager.getEndlessMapInfo().getEndlessHeroInfo(); + for(TeamPosHeroInfo info:team){ + if(endlessHeroInfo.containsKey(info.getHeroId())&&endlessHeroInfo.get(info.getHeroId())!=0){ + updateTeam.add(info); + } + } + user.getTeamPosManager().updateTeamPosByTeamId(GlobalsDef.ENDLESS_TEAM, updateTeam); } + mapManager.setLastFightResult(resultCode);