add bloody
parent
31bbc0a27c
commit
3ee89d5862
|
@ -8,6 +8,9 @@ import com.ljsd.jieling.battle.actor.Life;
|
|||
import com.ljsd.jieling.battle.actor.SceneMonster;
|
||||
import com.ljsd.jieling.config.SArenaSetting;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
import com.ljsd.jieling.config.SFoodsConfig;
|
||||
import com.ljsd.jieling.config.SPropertyConfig;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||
|
@ -16,6 +19,7 @@ import com.ljsd.jieling.logic.dao.Hero;
|
|||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.fight.FightType;
|
||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
@ -175,4 +179,80 @@ public class BattleManager {
|
|||
.build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* result :1 血量变化
|
||||
* @param uid
|
||||
* @param foodId
|
||||
*/
|
||||
public static Map<Integer,Integer> eatBuffer(int uid,int foodId,int optionalParm){
|
||||
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
Map<Integer, int[]> debuffMap = sBloodyBattleSetting.getDebuffMap();
|
||||
SFoodsConfig sFoodsConfig = SFoodsConfig.getsFoodsConfigByFoodId(foodId);
|
||||
int target = sFoodsConfig.getTarget();
|
||||
Map<Integer,Integer> result = new HashMap<>(1);
|
||||
if(target == 1){
|
||||
UserBloodySnpInfo redUserBloodySnpInfo = bloodMyHeroInfoMap.get(uid);
|
||||
int limmitValue = debuffMap.get(foodId)[1];
|
||||
int resultValue = 0;
|
||||
Map<Integer,Integer> foddAddResult = new HashMap<>();
|
||||
CombatLogic.getInstance().getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON,foddAddResult,sFoodsConfig);
|
||||
Map<String, FamilyHeroInfo> heroAllAttributes = redUserBloodySnpInfo.getHeroAllAttributes();
|
||||
for(FamilyHeroInfo familyHeroInfo : heroAllAttributes.values()){
|
||||
Map<Integer, Integer> attribute = familyHeroInfo.getAttribute();
|
||||
int maxHp = attribute.get(HeroAttributeEnum.Hp.getPropertyId()); // 我的最大生命值
|
||||
int curHp = attribute.get(HeroAttributeEnum.CurHP.getPropertyId()); // 我的生命值
|
||||
int minCurHp =(int)( maxHp*(limmitValue/10000F));
|
||||
if(curHp<=0){
|
||||
continue;
|
||||
}
|
||||
if(curHp<=minCurHp){
|
||||
resultValue+=curHp;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(foddAddResult.containsKey(HeroAttributeEnum.CurHpSpecialExtra.getPropertyId())){
|
||||
Integer specailValue = foddAddResult.get(HeroAttributeEnum.CurHpSpecialExtra.getPropertyId());
|
||||
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(HeroAttributeEnum.CurHpSpecialExtra.getPropertyId());
|
||||
int style = sPropertyConfig.getStyle();
|
||||
if(style == GlobalsDef.PERCENT_TYPE){
|
||||
curHp =(int)( maxHp/10000F*specailValue);
|
||||
}else{
|
||||
curHp +=specailValue;
|
||||
}
|
||||
}
|
||||
boolean needResetHp=false;
|
||||
if(curHp<minCurHp){
|
||||
needResetHp = true;
|
||||
}
|
||||
HeroLogic.getInstance().combinedAttribute(foddAddResult,familyHeroInfo.getAttribute());
|
||||
if(needResetHp){
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(),minCurHp);
|
||||
}
|
||||
resultValue+=attribute.get(HeroAttributeEnum.CurHP.getPropertyId());
|
||||
}
|
||||
result.put(1,resultValue);
|
||||
}else{
|
||||
int temp = optionalParm;
|
||||
for(int[] effectItem : sFoodsConfig.getEffectPara()){
|
||||
int bufferId = effectItem[0];
|
||||
if(bufferId!=1){
|
||||
continue;
|
||||
}
|
||||
int bufferValue = effectItem[1];
|
||||
temp+=bufferValue;
|
||||
}
|
||||
int playerMaxSpeed = sBloodyBattleSetting.getPlayerMaxSpeed();
|
||||
int playerMinSpeed = sBloodyBattleSetting.getPlayerMinSpeed();
|
||||
if(temp>playerMaxSpeed){
|
||||
temp=playerMaxSpeed;
|
||||
}else if(temp<playerMinSpeed){
|
||||
temp=playerMinSpeed;
|
||||
}
|
||||
result.put(2,temp);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.ljsd.jieling.battle.actor;
|
||||
|
||||
public enum BufferType {
|
||||
DIGGER(2), //挖矿中
|
||||
BATTLE(3),// 战斗中
|
||||
REBIRTH(4),// 复活
|
||||
INVINCIBLE(5),// 无敌
|
||||
REMOVEBUFFER(6),// 挖矿移除临时buffer
|
||||
;
|
||||
private int type;
|
||||
|
||||
BufferType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
|
@ -34,13 +34,19 @@ public abstract class Creature extends SceneActor{
|
|||
|
||||
private int mineral; // 矿石
|
||||
|
||||
private static Set<StateType> excludeAttackState = new HashSet<>(2);
|
||||
static {
|
||||
excludeAttackState.add(StateType.FROZEN);
|
||||
excludeAttackState.add(StateType.INVINCIBLE);
|
||||
}
|
||||
|
||||
public Creature(){
|
||||
setStateType(StateType.MOVEABLE);
|
||||
}
|
||||
|
||||
|
||||
public void setMineral(int mineral) {
|
||||
this.mineral = mineral;
|
||||
public void costMineral(int mineral) {
|
||||
this.mineral -= mineral;
|
||||
}
|
||||
|
||||
public void tick(){
|
||||
|
@ -141,6 +147,12 @@ public abstract class Creature extends SceneActor{
|
|||
setPos(path.remove(0));
|
||||
if(getType() == ActorType.Monster){
|
||||
cachePath.push(getPos());
|
||||
}else{
|
||||
Integer pathMieral = getScene().getPathMieral(getPos());
|
||||
if(pathMieral!=null){
|
||||
this.addMineral(pathMieral);
|
||||
getScene().processEventUpdate(EventType.SCENEACTORE_UPDATE,getId());
|
||||
}
|
||||
}
|
||||
if(checkEventTrigger(timestamp)){
|
||||
break;
|
||||
|
@ -156,7 +168,10 @@ public abstract class Creature extends SceneActor{
|
|||
|
||||
public boolean canMoveNext(int nextPath,boolean update){
|
||||
for(SceneActor sceneActor : getScene().getSceneActorMap().values()){
|
||||
if(sceneActor == this) {
|
||||
if(sceneActor == this ) {
|
||||
continue;
|
||||
}
|
||||
if(sceneActor.getType() == ActorType.Player && sceneActor.getStateType() == StateType.INVINCIBLE){
|
||||
continue;
|
||||
}
|
||||
if(sceneActor.getType()!=ActorType.Mineral && sceneActor.getPos() == nextPath){
|
||||
|
@ -177,8 +192,6 @@ public abstract class Creature extends SceneActor{
|
|||
//打断自己行使路线 广播自己状态 位置信息
|
||||
this.preMoveTimestamp = timestamp;
|
||||
if(this.getType() != ActorType.Monster){
|
||||
/*Collections.reverse(path);
|
||||
cachePath.addAll(path);*/
|
||||
this.path.clear();
|
||||
}
|
||||
|
||||
|
@ -208,35 +221,36 @@ public abstract class Creature extends SceneActor{
|
|||
int curPos = getPos();
|
||||
boolean result= false;
|
||||
ActorType type = sceneActor.getType();
|
||||
int triggerEvent = 0;
|
||||
//int triggerEvent = 0;
|
||||
int triggerBuffer = 0;
|
||||
if(type == ActorType.Npc){
|
||||
if(curPos == sceneActor.getPos()){
|
||||
triggerEvent=1;
|
||||
triggerBuffer=1;
|
||||
}
|
||||
}
|
||||
if(type == ActorType.Mineral && this.getType() == ActorType.Player){
|
||||
if(curPos == sceneActor.getPos()){
|
||||
triggerEvent=2;
|
||||
triggerBuffer=BufferType.DIGGER.getType();
|
||||
setStateType(StateType.DIGGER);
|
||||
}
|
||||
}
|
||||
if(type == ActorType.Monster || type == ActorType.Player){
|
||||
if(getStateType()!=StateType.FROZEN &&sceneActor.getStateType()!= StateType.FROZEN&& xySet.contains(sceneActor.getPos())){
|
||||
triggerEvent=3;
|
||||
if(!excludeAttackState.contains(getStateType()) && !excludeAttackState.contains(sceneActor.getStateType()) && xySet.contains(sceneActor.getPos()) ){
|
||||
triggerBuffer=BufferType.BATTLE.getType();
|
||||
setStateType(StateType.FROZEN);
|
||||
//异步计算战斗结果
|
||||
getScene().execASync(new BattleRequest(timestamp,this,sceneActor,sceneActor.getType()));
|
||||
LOGGER.info("the attackUid={},the battleId={}",this.getId(),sceneActor.getId());
|
||||
}
|
||||
}
|
||||
if(triggerEvent!=0){
|
||||
if(triggerEvent == 3 || this.getType() == ActorType.Player){
|
||||
EffectBuffer effectBuffer = new EffectBuffer(getScene().getBufferId(),triggerEvent, timestamp, -1,getId(), sceneActor.getId(), -1);
|
||||
if(triggerBuffer!=0){
|
||||
if(triggerBuffer == 3 || this.getType() == ActorType.Player){
|
||||
EffectBuffer effectBuffer = new EffectBuffer(getScene().getBufferId(),triggerBuffer, timestamp, -1,getId(), sceneActor.getId(), -1);
|
||||
whenTriggerEvent(effectBuffer,timestamp);
|
||||
result = true;
|
||||
}
|
||||
if(triggerEvent == 3 ){
|
||||
EffectBuffer othereffectBuffer = new EffectBuffer(getScene().getBufferId(),triggerEvent, timestamp, -1,sceneActor.getId(),getId(), -1);
|
||||
if(triggerBuffer == 3 ){
|
||||
EffectBuffer othereffectBuffer = new EffectBuffer(getScene().getBufferId(),triggerBuffer, timestamp, -1,sceneActor.getId(),getId(), -1);
|
||||
sceneActor.whenTriggerEvent(othereffectBuffer,timestamp);
|
||||
result = true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ public class EffectBuffer {
|
|||
this.values.add(value);
|
||||
}
|
||||
|
||||
public void updateEffectValue(int index,int value){
|
||||
this.values.set(index,value);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -5,5 +5,7 @@ public enum EventType {
|
|||
BUFFER_UPDATE,
|
||||
BUFFER_REMOVE,
|
||||
SCENEACTORE_REMOVE,
|
||||
POSMINERAL_UPDATE,
|
||||
POSMINERAL_REMOVE,
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@ public class Life {
|
|||
return changeValue;
|
||||
}
|
||||
|
||||
public void setCurHp(int curHp) {
|
||||
this.curHp = curHp;
|
||||
}
|
||||
|
||||
public int getCurHp() {
|
||||
return curHp;
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
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;
|
||||
|
@ -40,9 +41,51 @@ public class Scene implements Runnable{
|
|||
private BlockingUniqueQueue<Command> commandBlockingUniqueQueue = new BlockingUniqueQueue<>();
|
||||
private Map<Integer,Integer> minealForPosMap = new HashMap<>();
|
||||
|
||||
public Map<Integer, Integer> getMinealForPosMap() {
|
||||
return minealForPosMap;
|
||||
}
|
||||
|
||||
public Integer getPathMieral(int pos){
|
||||
return minealForPosMap.remove(pos);
|
||||
}
|
||||
|
||||
|
||||
public void randomMineralOfUserDeath(Creature creature,int totalMineal){
|
||||
if(totalMineal <=0){
|
||||
return;
|
||||
}
|
||||
int maxPoss = SBloodyBattleSetting.sBloodyBattleSetting.getMonsterDrop()[1];
|
||||
Set<Integer> possiblePosSet = SceneManager.selectForPlayerMineal(this, creature.getPos());
|
||||
int size = possiblePosSet.size();
|
||||
int reallyPos = maxPoss>size?size:maxPoss;
|
||||
reallyPos = reallyPos>totalMineal?totalMineal:reallyPos;
|
||||
int a = totalMineal/reallyPos;
|
||||
int b = totalMineal%reallyPos;
|
||||
Iterator<Integer> iterator = possiblePosSet.iterator();
|
||||
int nums = 0;
|
||||
while (iterator.hasNext()){
|
||||
int extra = nums<b?1:0;
|
||||
Integer pos = iterator.next();
|
||||
Integer alreayNums = minealForPosMap.get(pos);
|
||||
if(alreayNums!=null){
|
||||
extra+=alreayNums;
|
||||
}
|
||||
minealForPosMap.put(pos,a + extra);
|
||||
processEventUpdate(EventType.POSMINERAL_UPDATE,CommonProto.PosMineral.newBuilder().setPos(pos).setNums(minealForPosMap.get(pos)).build());
|
||||
reallyPos--;
|
||||
nums++;
|
||||
if(reallyPos<=0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addScenActor(SceneActor sceneActor){
|
||||
sceneActorMap.put(sceneActor.getId(),sceneActor);
|
||||
if(startTime>0){
|
||||
processEventUpdate(EventType.SCENEACTORE_UPDATE,sceneActor.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public void addCommand(Command command){
|
||||
|
@ -124,6 +167,12 @@ public class Scene implements Runnable{
|
|||
int deadId = (int) parm;
|
||||
builder.addRemoveActorId(deadId);
|
||||
break;
|
||||
case POSMINERAL_REMOVE:
|
||||
builder.addRemovePosMineralId( (int) parm);
|
||||
break;
|
||||
case POSMINERAL_UPDATE:
|
||||
builder.addPosMineral((CommonProto.PosMineral)parm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,6 +188,7 @@ public class Scene implements Runnable{
|
|||
break;
|
||||
}
|
||||
tick++;
|
||||
sysTick();
|
||||
tick();
|
||||
if(tick/20 == 1 && tick%20==0){
|
||||
startAllRunning();
|
||||
|
@ -174,7 +224,7 @@ public class Scene implements Runnable{
|
|||
if(nums == null){
|
||||
nums = 0;
|
||||
}
|
||||
mineralNums.put(size,nums);
|
||||
mineralNums.put(size,nums+1);
|
||||
}
|
||||
}
|
||||
for(int[] mineralCeilingSingle :mineralCeiling){
|
||||
|
@ -189,8 +239,13 @@ public class Scene implements Runnable{
|
|||
existNums = 0;
|
||||
}
|
||||
//新增矿点
|
||||
if(maxNums > existNums){
|
||||
|
||||
int needAdd = maxNums -existNums;
|
||||
if(needAdd>0){
|
||||
if(needAdd>flushNums){
|
||||
needAdd = flushNums;
|
||||
}
|
||||
SceneManager.createMinear(this,size,needAdd);
|
||||
System.out.println("创建矿....");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.battle.actor;
|
|||
|
||||
|
||||
|
||||
import com.ljsd.jieling.battle.BattleManager;
|
||||
import com.ljsd.jieling.battle.room.SceneManager;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
|
||||
|
@ -30,16 +31,20 @@ public abstract class SceneActor{
|
|||
}
|
||||
|
||||
public void addOrUpdateBuffer(EffectBuffer effectBuffer){
|
||||
bufferMap.put(effectBuffer.getId(),effectBuffer);
|
||||
|
||||
System.out.println(effectBuffer);
|
||||
if(effectBuffer.getType() == 3){
|
||||
if(effectBuffer.getType() == BufferType.BATTLE.getType()){
|
||||
stateType = StateType.FROZEN;
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
//停止挖矿
|
||||
checkUpdateBuffer(effectBuffer.getStartTime(),true);
|
||||
System.out.println("the actor" + id + "is frozen");
|
||||
}
|
||||
if(effectBuffer.getType() == 2){
|
||||
if(effectBuffer.getType() == BufferType.DIGGER.getType()){
|
||||
effectBuffer.updateEffectValue(0,0);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
}
|
||||
bufferMap.put(effectBuffer.getId(),effectBuffer);
|
||||
scene.processEventUpdate(EventType.BUFFER_UPDATE,effectBuffer);
|
||||
}
|
||||
|
||||
|
@ -53,12 +58,12 @@ public abstract class SceneActor{
|
|||
while (iterator.hasNext()){
|
||||
Map.Entry<Integer, EffectBuffer> next = iterator.next();
|
||||
EffectBuffer value = next.getValue();
|
||||
if(value.getType() ==3 && value.getEndTime() == -1){
|
||||
if(value.getType() == BufferType.BATTLE.getType() && value.getEndTime() == -1){
|
||||
continue;
|
||||
}
|
||||
if(value.getType() == 2){ //挖矿
|
||||
if(value.getType() == BufferType.DIGGER.getType()){ //挖矿
|
||||
int intervalMs = SBloodyBattleSetting.sBloodyBattleSetting.getCollectingInterval() * 1000;
|
||||
int willDgger = (int)((now - value.getStartTime()) / intervalMs);
|
||||
int willDgger = (int)((now - value.getStartTime()) / intervalMs)-value.getValues().get(0);
|
||||
Creature creature = (Creature) this;
|
||||
Creature mineral =(Creature) scene.getSceneActorMap().get(value.getCaster());
|
||||
if(willDgger>0&&mineral.getLife().getCurHp()>0) {
|
||||
|
@ -68,14 +73,46 @@ public abstract class SceneActor{
|
|||
if(mineral.getLife().getCurHp()>0){
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,mineral.getId());
|
||||
}
|
||||
value.setStartTime(value.getStartTime() + reallyDigger*intervalMs);
|
||||
value.updateEffectValue(0,reallyDigger + value.getValues().get(0));
|
||||
}
|
||||
int[][] debuffs = SBloodyBattleSetting.sBloodyBattleSetting.getDebuff();
|
||||
for(int i=0;i<debuffs.length;i++){
|
||||
int[] debufferItem = debuffs[i];
|
||||
int bufferId = debufferItem[0];
|
||||
int duration = debufferItem[2];
|
||||
boolean willEat = ((now - value.getStartTime()) / duration)>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());
|
||||
}else{
|
||||
Integer speedTemp = resultMap.get(2);
|
||||
if(creature.getSpeed()!=speedTemp){
|
||||
creature.setSpeed(speedTemp);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,value.getId());
|
||||
}
|
||||
}
|
||||
value.updateEffectValue(0,value.getValues().get(i+1) +1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(needRemoveDigger || mineral.getLife().getCurHp()<=0 ){
|
||||
iterator.remove();
|
||||
if(mineral.getLife().getCurHp()<=0){
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_REMOVE,value.getCaster());
|
||||
}
|
||||
System.out.println("remove the digger buffer" + getId());
|
||||
int[][] debuff = SBloodyBattleSetting.sBloodyBattleSetting.getDebuff();
|
||||
for(int[] debuffItem : debuff){
|
||||
int duration = debuffItem[3];
|
||||
if(duration>0){
|
||||
addOrUpdateBuffer(new EffectBuffer(scene.getBufferId(),BufferType.REMOVEBUFFER.getType(),now,now + duration*1000,id,id,0));
|
||||
}
|
||||
}
|
||||
scene.processEventUpdate(EventType.BUFFER_REMOVE,value.getId());
|
||||
}
|
||||
continue;
|
||||
|
@ -95,7 +132,7 @@ public abstract class SceneActor{
|
|||
|
||||
public void whenBufferRemove(EffectBuffer value,long now){
|
||||
int type = value.getType();
|
||||
if(type == 3){
|
||||
if(type == BufferType.BATTLE.getType()){
|
||||
int effectValue = value.getValues().get(0);
|
||||
if(effectValue == 0){ //战斗失败
|
||||
if(getType() == ActorType.Monster){
|
||||
|
@ -115,25 +152,37 @@ public abstract class SceneActor{
|
|||
int mineral = creature.getMineral();
|
||||
if(mineral>1){
|
||||
int gainMineral=mineral/2 + mineral%2;
|
||||
creature.setMineral(mineral -gainMineral);
|
||||
creature.costMineral(mineral -gainMineral);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,creature.getId());
|
||||
if(this.getType() == ActorType.Player){
|
||||
((Creature)this).addMineral(gainMineral);
|
||||
}else{
|
||||
//todo 随机散落
|
||||
scene.randomMineralOfUserDeath(creature,gainMineral);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stateType = StateType.MOVEABLE;
|
||||
((Creature)this).setPreMoveTimestamp(now);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
}
|
||||
}else if(type == 4){
|
||||
}else if(type == BufferType.REBIRTH.getType()){
|
||||
if(getType() == ActorType.Monster){
|
||||
Creature creature = (Creature) this;
|
||||
creature.setPreMoveTimestamp(now);
|
||||
}
|
||||
stateType = StateType.MOVEABLE;
|
||||
if(getType() == ActorType.Player){
|
||||
//如果是玩家获得无敌buffer
|
||||
addOrUpdateBuffer(new EffectBuffer(scene.getBufferId(),BufferType.INVINCIBLE.getType(),now,now+SBloodyBattleSetting.sBloodyBattleSetting.getInvincible(),id,id,-1));
|
||||
stateType=StateType.INVINCIBLE;
|
||||
}
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
}else if(type == BufferType.INVINCIBLE.getType() ){
|
||||
stateType=StateType.MOVEABLE;
|
||||
} else if(type == BufferType.REMOVEBUFFER.getType() ){
|
||||
Creature creature = (Creature) this;
|
||||
creature.setSpeed(SBloodyBattleSetting.sBloodyBattleSetting.getPlayerSpeed());
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ public enum StateType {
|
|||
FROZEN(4), //不可移动
|
||||
MOVEABLE(5), //可移动
|
||||
DIGGER(5), //可移动
|
||||
INVINCIBLE(5), //无敌
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -80,6 +80,12 @@ public class BeanToProto {
|
|||
builder.addActorEffectBufferInfo(getActorEffectBufferInfo(next.getValue()));
|
||||
}
|
||||
}
|
||||
Map<Integer, Integer> minealForPosMap = scene.getMinealForPosMap();
|
||||
for(Map.Entry<Integer,Integer> item : minealForPosMap.entrySet()){
|
||||
Integer key = item.getKey();
|
||||
Integer value = item.getValue();
|
||||
builder.addPosMineral(CommonProto.PosMineral.newBuilder().setPos(key).setNums(value).build());
|
||||
}
|
||||
builder.addAllBarrierPoint(SceneManager.bloodyMap.getBarrierPoints());
|
||||
return builder.build();
|
||||
}
|
||||
|
|
|
@ -49,14 +49,16 @@ public class SceneManager {
|
|||
}
|
||||
}
|
||||
int[][] mineralCeiling = SBloodyBattleSetting.sBloodyBattleSetting.getMineralCeiling();
|
||||
int min =999999999;
|
||||
for(int[] mineralCeilingSingle : mineralCeiling){
|
||||
int minRound = mineralCeilingSingle[1];
|
||||
if(min < minRound){
|
||||
min = minRound;
|
||||
int max =mineralCeiling[0][1];
|
||||
for(int i=1;i<mineralCeiling.length;i++){
|
||||
if(max == 1){
|
||||
break;
|
||||
}
|
||||
int rightMaxRound = mineralCeiling[i][1];
|
||||
max = MathUtils.getGCD(max,rightMaxRound);
|
||||
}
|
||||
bloodyMapTmp.setRound(min);
|
||||
|
||||
bloodyMapTmp.setRound(max*20);
|
||||
bloodyMap = bloodyMapTmp;
|
||||
calPossiblePoss();
|
||||
|
||||
|
@ -272,6 +274,7 @@ public class SceneManager {
|
|||
MessageUtil.sendErrorResponse(session,0,msgId,"not in room");
|
||||
return;
|
||||
}
|
||||
System.out.println(parm);
|
||||
Scene scene = getSceneMap(user.getRoomInfo().getRoomId());
|
||||
SceneFight.SceneCommandResponse.Builder builder = SceneFight.SceneCommandResponse.newBuilder().setType(type).setResult(1);
|
||||
if(type == 1){
|
||||
|
@ -327,6 +330,33 @@ public class SceneManager {
|
|||
|
||||
}
|
||||
|
||||
//玩家死亡选择可以随机放矿点位置
|
||||
public static Set<Integer> selectForPlayerMineal(Scene scene,int deathPos){
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(bloodyMap.getMapId());
|
||||
int[] size = sChallengeMapConfig.getSize();
|
||||
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);
|
||||
List<Integer> excludePosList = new ArrayList<>();
|
||||
Map<Integer, SceneActor> sceneActorMap = scene.getSceneActorMap();
|
||||
for(SceneActor sceneActor : sceneActorMap.values()){
|
||||
int pos = sceneActor.getPos();
|
||||
excludePosList.add(pos);
|
||||
}
|
||||
cache.removeAll(excludePosList);
|
||||
cache.removeAll(bloodyMap.getBarrierPoints());
|
||||
if(cache.isEmpty()){
|
||||
cache.add(deathPos);
|
||||
}
|
||||
return cache;
|
||||
|
||||
}
|
||||
|
||||
//玩家阵亡选择出生点
|
||||
public static int selectForPlayerRebirth(Scene scene){
|
||||
List<Integer> excludePosList = new ArrayList<>();
|
||||
Map<Integer, SceneActor> sceneActorMap = scene.getSceneActorMap();
|
||||
|
@ -347,6 +377,9 @@ public class SceneManager {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
createScene();
|
||||
}
|
||||
|
|
|
@ -67,6 +67,14 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
|
||||
private int[] fightTime;
|
||||
|
||||
private int[] monsterDrop;
|
||||
|
||||
private int playerMaxSpeed;
|
||||
|
||||
private int playerMinSpeed;
|
||||
|
||||
private Map<Integer,int[]> debuffMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -94,6 +102,11 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
for(int[] mineralCeilingSingle : sBloodyBattleSettingTmp.getMineralCeiling()){
|
||||
mineralCeilingMapTmp.put(mineralCeilingSingle[0],mineralCeilingSingle);
|
||||
}
|
||||
Map<Integer,int[]> debuffMapTmp = new HashMap<>();
|
||||
for(int[] debuffItem : sBloodyBattleSettingTmp.getDebuff()){
|
||||
debuffMapTmp.put(debuffItem[0],debuffItem);
|
||||
}
|
||||
sBloodyBattleSettingTmp.setDebuffMap(debuffMapTmp);
|
||||
sBloodyBattleSettingTmp.setMonsterPotrolPaths(monsterPotrolPaths);
|
||||
sBloodyBattleSettingTmp.setInitializeMineMap(initializeMineMapTmp);
|
||||
sBloodyBattleSettingTmp.setMineralCeilingMap(mineralCeilingMapTmp);
|
||||
|
@ -224,4 +237,25 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
public int[] getFightTime() {
|
||||
return fightTime;
|
||||
}
|
||||
|
||||
public int[] getMonsterDrop() {
|
||||
return monsterDrop;
|
||||
}
|
||||
|
||||
|
||||
public Map<Integer, int[]> getDebuffMap() {
|
||||
return debuffMap;
|
||||
}
|
||||
|
||||
public void setDebuffMap(Map<Integer, int[]> debuffMap) {
|
||||
this.debuffMap = debuffMap;
|
||||
}
|
||||
|
||||
public int getPlayerMaxSpeed() {
|
||||
return playerMaxSpeed;
|
||||
}
|
||||
|
||||
public int getPlayerMinSpeed() {
|
||||
return playerMinSpeed;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="EquipTalismana")
|
||||
public class SEquipTalismana implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int talismanaId;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[][] rankupBasicMaterial;
|
||||
|
||||
private int[][] rankupConsumeMaterial;
|
||||
|
||||
private int[][] property;
|
||||
|
||||
private int[][] specialProperty;
|
||||
|
||||
private int openSkillRules;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getTalismanaId() {
|
||||
return talismanaId;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[][] getRankupBasicMaterial() {
|
||||
return rankupBasicMaterial;
|
||||
}
|
||||
|
||||
public int[][] getRankupConsumeMaterial() {
|
||||
return rankupConsumeMaterial;
|
||||
}
|
||||
|
||||
public int[][] getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
public int[][] getSpecialProperty() {
|
||||
return specialProperty;
|
||||
}
|
||||
|
||||
public int getOpenSkillRules() {
|
||||
return openSkillRules;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="EquipTalismanaRankup")
|
||||
public class SEquipTalismanaRankup implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int issame;
|
||||
|
||||
private int starLimit;
|
||||
|
||||
private int isId;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getIssame() {
|
||||
return issame;
|
||||
}
|
||||
|
||||
public int getStarLimit() {
|
||||
return starLimit;
|
||||
}
|
||||
|
||||
public int getIsId() {
|
||||
return isId;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -163,7 +163,7 @@ public class CombatLogic {
|
|||
return foddAddResult;
|
||||
}
|
||||
|
||||
private void getFoodAttributeAdd(int type, int target, Map<Integer, Integer> foddAddResult, SFoodsConfig sFoodsConfig) {
|
||||
public void getFoodAttributeAdd(int type, int target, Map<Integer, Integer> foddAddResult, SFoodsConfig sFoodsConfig) {
|
||||
int typeTmp = sFoodsConfig.getType();
|
||||
int targetTmp = sFoodsConfig.getTarget();
|
||||
if( typeTmp==type && targetTmp==target ){
|
||||
|
|
|
@ -19,6 +19,7 @@ public enum HeroAttributeEnum {
|
|||
AntiCritDamageFactor(60),
|
||||
DifferDemonsBocusFactor(66),
|
||||
CurHpExtra(67),
|
||||
CurHpSpecialExtra(68),
|
||||
FireDamageBonusFactor(101),
|
||||
WindDamageBonusFactor(102),
|
||||
WaterDamageBonusFactor(103),
|
||||
|
|
|
@ -273,4 +273,20 @@ public class MathUtils {
|
|||
return randomIndex;
|
||||
}
|
||||
|
||||
//计算最大公约数
|
||||
public static int getGCD(int a,int b){
|
||||
if(a<0 || b<0){
|
||||
return -1;
|
||||
}
|
||||
if(b==0){
|
||||
return a;
|
||||
}
|
||||
while (a%b!=0){
|
||||
int temp = a % b;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue