walk
parent
c4a7952075
commit
e8b835207b
|
@ -216,20 +216,18 @@ public class BattleManager {
|
|||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(HeroAttributeEnum.CurHpSpecialExtra.getPropertyId());
|
||||
int style = sPropertyConfig.getStyle();
|
||||
if(style == GlobalsDef.PERCENT_TYPE){
|
||||
curHp =(int)( maxHp/10000F*specailValue);
|
||||
curHp =curHp+(int)( maxHp/10000F*specailValue);
|
||||
}else{
|
||||
curHp +=specailValue;
|
||||
}
|
||||
}
|
||||
boolean needResetHp=false;
|
||||
if(curHp<minCurHp){
|
||||
needResetHp = true;
|
||||
curHp = minCurHp;
|
||||
}
|
||||
HeroLogic.getInstance().combinedAttribute(foddAddResult,familyHeroInfo.getAttribute());
|
||||
if(needResetHp){
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(),minCurHp);
|
||||
}
|
||||
resultValue+=attribute.get(HeroAttributeEnum.CurHP.getPropertyId());
|
||||
HeroLogic.getInstance().combinedAttribute(foddAddResult,attribute);
|
||||
HeroLogic.getInstance().calInteractAdd(attribute);
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(),curHp);
|
||||
resultValue+=curHp;
|
||||
}
|
||||
result.put(1,resultValue);
|
||||
}else{
|
||||
|
@ -244,10 +242,10 @@ public class BattleManager {
|
|||
}
|
||||
int playerMaxSpeed = sBloodyBattleSetting.getPlayerMaxSpeed();
|
||||
int playerMinSpeed = sBloodyBattleSetting.getPlayerMinSpeed();
|
||||
if(temp>playerMaxSpeed){
|
||||
temp=playerMaxSpeed;
|
||||
}else if(temp<playerMinSpeed){
|
||||
if(temp>playerMinSpeed){
|
||||
temp=playerMinSpeed;
|
||||
}else if(temp<playerMaxSpeed){
|
||||
temp=playerMaxSpeed;
|
||||
}
|
||||
result.put(2,temp);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.battle.BattleManager;
|
|||
import com.ljsd.jieling.battle.BattleRequest;
|
||||
import com.ljsd.jieling.battle.room.SceneManager;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
import com.ljsd.jieling.config.SChallengeMapConfig;
|
||||
import com.ljsd.jieling.util.CellUtil;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -152,6 +153,7 @@ public abstract class Creature extends SceneActor{
|
|||
if(pathMieral!=null){
|
||||
this.addMineral(pathMieral);
|
||||
getScene().processEventUpdate(EventType.SCENEACTORE_UPDATE,getId());
|
||||
getScene().processEventUpdate(EventType.POSMINERAL_REMOVE,getPos());
|
||||
}
|
||||
}
|
||||
if(checkEventTrigger(timestamp)){
|
||||
|
@ -204,7 +206,11 @@ public abstract class Creature extends SceneActor{
|
|||
}
|
||||
Scene scene = getScene();
|
||||
int curPos = getPos();
|
||||
Set<Integer> xySet = CellUtil.getSurroundPos(15,20,curPos);
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(SceneManager.bloodyMap.getMapId());
|
||||
int[] size = sChallengeMapConfig.getSize();
|
||||
int maxX = size[0];
|
||||
int maxY = size[1];
|
||||
Set<Integer> xySet = CellUtil.getSurroundPos(maxX,maxY,curPos);
|
||||
Map<Integer, SceneActor> sceneActorMap = scene.getSceneActorMap();
|
||||
for(SceneActor sceneActor : sceneActorMap.values()){
|
||||
if(sceneActor == this) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.SceneFight;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -104,8 +103,31 @@ public class Scene implements Runnable{
|
|||
|
||||
private boolean isEnd;
|
||||
|
||||
private Map<Integer,Integer> monsterRecoryMap = new HashMap<>();
|
||||
|
||||
|
||||
public void monsterReflush(){
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = monsterRecoryMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<Integer, Integer> next = iterator.next();
|
||||
Integer value = next.getValue();
|
||||
if(tick>value){
|
||||
Integer monsterIndex = next.getKey();
|
||||
System.out.println("the actor siz=" + sceneActorMap.size());
|
||||
SceneManager.createMonster(this,monsterIndex);
|
||||
processEventUpdate(EventType.SCENEACTORE_UPDATE,monsterIndex);
|
||||
iterator.remove();
|
||||
System.out.println("the actor after siz=" + sceneActorMap.size());
|
||||
System.out.println("the monsterid={}" + monsterIndex + "recovery");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void whenMonsterDead(int deadId){
|
||||
System.out.println("the monster deadID="+deadId);
|
||||
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
int[] monsterItem = sBloodyBattleSetting.getMonsterIndexMap().get(deadId);
|
||||
monsterRecoryMap.put(deadId,monsterItem[1]*20 + tick);
|
||||
|
||||
}
|
||||
|
||||
|
@ -210,6 +232,7 @@ public class Scene implements Runnable{
|
|||
}
|
||||
|
||||
public void sysTick(){
|
||||
monsterReflush();
|
||||
int round = SceneManager.bloodyMap.getRound();
|
||||
if( tick % round != 0){
|
||||
return;
|
||||
|
@ -293,14 +316,12 @@ public class Scene implements Runnable{
|
|||
defActor = attackActor;
|
||||
attackActor = temp;
|
||||
}
|
||||
/* if(defActor.getType() == ActorType.Monster || attackActor.getType() == ActorType.Monster){
|
||||
if(defActor.getType() == ActorType.Monster || attackActor.getType() == ActorType.Monster){
|
||||
checkResult = BattleManager.battleOfP2M((Creature) attackActor, (SceneMonster) defActor);
|
||||
}else{
|
||||
checkResult = BattleManager.battleOfP2P((Creature) attackActor, (Creature) defActor);
|
||||
}*/
|
||||
}
|
||||
int[] fightTime = SBloodyBattleSetting.sBloodyBattleSetting.getFightTime();
|
||||
//todo
|
||||
checkResult = new int[]{0,1000,200,0,0,0,0};
|
||||
int displayTime = checkResult[1] / fightTime[0];
|
||||
if(displayTime>fightTime[2]){
|
||||
displayTime = fightTime[2];
|
||||
|
@ -308,7 +329,6 @@ public class Scene implements Runnable{
|
|||
if(displayTime<fightTime[1]){
|
||||
displayTime = fightTime[1];
|
||||
}
|
||||
displayTime = 10;
|
||||
Map<Integer, EffectBuffer> bufferMap = attackActor.getBufferMap();
|
||||
for(EffectBuffer effectBuffer : bufferMap.values()){
|
||||
if(effectBuffer.getType() == 3 && effectBuffer.getTarget() == attackActor.getId() && effectBuffer.getCaster() == defActor.getId()){
|
||||
|
|
|
@ -42,6 +42,10 @@ public abstract class SceneActor{
|
|||
}
|
||||
if(effectBuffer.getType() == BufferType.DIGGER.getType()){
|
||||
effectBuffer.updateEffectValue(0,0);
|
||||
int[][] debuff = SBloodyBattleSetting.sBloodyBattleSetting.getDebuff();
|
||||
for(int i=0;i<debuff.length;i++){
|
||||
effectBuffer.addEffectValue(0);
|
||||
}
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
}
|
||||
bufferMap.put(effectBuffer.getId(),effectBuffer);
|
||||
|
@ -80,14 +84,16 @@ public abstract class SceneActor{
|
|||
int[] debufferItem = debuffs[i];
|
||||
int bufferId = debufferItem[0];
|
||||
int duration = debufferItem[2];
|
||||
boolean willEat = ((now - value.getStartTime()) / duration)>value.getValues().get(i+1);
|
||||
boolean willEat = ((now - value.getStartTime()) / duration/1000)>value.getValues().get(i+1);
|
||||
if(willEat){
|
||||
Map<Integer, Integer> resultMap = BattleManager.eatBuffer(id, bufferId, creature.getSpeed());
|
||||
if(resultMap.containsKey(1)){
|
||||
//更新血量
|
||||
Integer totalCurHp = resultMap.get(1);
|
||||
creature.getLife().setCurHp(totalCurHp);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,value.getId());
|
||||
if(totalCurHp!=creature.getLife().getCurHp()){
|
||||
creature.getLife().setCurHp(totalCurHp);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,value.getId());
|
||||
}
|
||||
}else{
|
||||
Integer speedTemp = resultMap.get(2);
|
||||
if(creature.getSpeed()!=speedTemp){
|
||||
|
@ -95,7 +101,8 @@ public abstract class SceneActor{
|
|||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,value.getId());
|
||||
}
|
||||
}
|
||||
value.updateEffectValue(0,value.getValues().get(i+1) +1);
|
||||
value.updateEffectValue(i+1,value.getValues().get(i+1) +1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -136,6 +143,7 @@ public abstract class SceneActor{
|
|||
int effectValue = value.getValues().get(0);
|
||||
if(effectValue == 0){ //战斗失败
|
||||
if(getType() == ActorType.Monster){
|
||||
scene.whenMonsterDead(id);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_REMOVE,this.getId());
|
||||
return;
|
||||
}
|
||||
|
@ -147,7 +155,7 @@ public abstract class SceneActor{
|
|||
}else{
|
||||
Creature creature = (Creature) scene.getSceneActorMap().get(value.getCaster());
|
||||
if(creature.getType() == ActorType.Monster){
|
||||
((Creature)this).addMineral(SBloodyBattleSetting.sBloodyBattleSetting.getMonster()[creature.getId()][2]);
|
||||
((Creature)this).addMineral(SBloodyBattleSetting.sBloodyBattleSetting.getMonster()[creature.getId()-1][2]);
|
||||
}else{
|
||||
int mineral = creature.getMineral();
|
||||
if(mineral>1){
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.battle.actor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SceneNpc extends Creature{
|
||||
@Override
|
||||
|
|
|
@ -95,13 +95,28 @@ public class SceneManager {
|
|||
}
|
||||
//创建矿点
|
||||
createMinear(scene,-1,1);
|
||||
|
||||
//创建怪物
|
||||
createMonster(scene,-1);
|
||||
|
||||
sceneMap.put(room.getId(),scene);
|
||||
|
||||
//todo 发送到redis,房间服务器去这里拿数据
|
||||
|
||||
MessageUtil.sendRoomMatchSuccessIndication(scene);
|
||||
}
|
||||
|
||||
public static void createMonster(Scene scene, int target) {
|
||||
//创建怪物
|
||||
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
int[][] monster = sBloodyBattleSetting.getMonster();
|
||||
int[][][] monsterPatrol = sBloodyBattleSetting.getMonsterPatrol();
|
||||
Map<Integer, List<Integer>> monsterPotrolPaths = sBloodyBattleSetting.getMonsterPotrolPaths();
|
||||
int monsterIndex = 0;
|
||||
for(int[] monsterSingle : monster){
|
||||
if(target!=-1 && target != monsterIndex +1){
|
||||
monsterIndex++;
|
||||
continue;
|
||||
}
|
||||
SceneMonster sceneMonster = new SceneMonster();
|
||||
sceneMonster.setScene(scene);
|
||||
sceneMonster.setId(monsterIndex+1);
|
||||
|
@ -129,17 +144,15 @@ public class SceneManager {
|
|||
scene.addCommand(commandC);
|
||||
scene.addScenActor(sceneMonster);
|
||||
monsterIndex++;
|
||||
if(target!=-1){
|
||||
System.out.println("find and break... " + monsterIndex);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
sceneMap.put(room.getId(),scene);
|
||||
|
||||
//todo 发送到redis,房间服务器去这里拿数据
|
||||
|
||||
MessageUtil.sendRoomMatchSuccessIndication(scene);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void createMinear(Scene scene,int target,int nums){
|
||||
//创建矿点
|
||||
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
|
@ -337,7 +350,6 @@ public class SceneManager {
|
|||
int maxX = size[0];
|
||||
int maxY = size[1];
|
||||
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
int selectNums = sBloodyBattleSetting.getMonsterDrop()[1];
|
||||
int[] xy = CellUtil.pos2XY(deathPos);
|
||||
Set<Integer> cache = new HashSet<>();
|
||||
CellUtil.calSurPos(xy[0],xy[1],sBloodyBattleSetting.getMonsterDrop()[0],maxX,maxY,cache);
|
||||
|
|
|
@ -73,7 +73,10 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
|
||||
private int playerMinSpeed;
|
||||
|
||||
private int[][] mineralId;
|
||||
|
||||
private Map<Integer,int[]> debuffMap;
|
||||
private Map<Integer,int[]> monsterIndexMap;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -106,6 +109,13 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
for(int[] debuffItem : sBloodyBattleSettingTmp.getDebuff()){
|
||||
debuffMapTmp.put(debuffItem[0],debuffItem);
|
||||
}
|
||||
|
||||
Map<Integer,int[]> monsterIndexMapTmp = new HashMap<>();
|
||||
int i=1;
|
||||
for(int[] monsterItem : sBloodyBattleSettingTmp.getMonster()){
|
||||
monsterIndexMapTmp.put(i++,monsterItem);
|
||||
}
|
||||
sBloodyBattleSettingTmp.setMonsterIndexMap(monsterIndexMapTmp);
|
||||
sBloodyBattleSettingTmp.setDebuffMap(debuffMapTmp);
|
||||
sBloodyBattleSettingTmp.setMonsterPotrolPaths(monsterPotrolPaths);
|
||||
sBloodyBattleSettingTmp.setInitializeMineMap(initializeMineMapTmp);
|
||||
|
@ -258,4 +268,13 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
public int getPlayerMinSpeed() {
|
||||
return playerMinSpeed;
|
||||
}
|
||||
|
||||
|
||||
public Map<Integer, int[]> getMonsterIndexMap() {
|
||||
return monsterIndexMap;
|
||||
}
|
||||
|
||||
public void setMonsterIndexMap(Map<Integer, int[]> monsterIndexMap) {
|
||||
this.monsterIndexMap = monsterIndexMap;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue