back_recharge
zhangshanxue 2019-09-03 10:39:21 +08:00
commit ea47d19a4d
55 changed files with 1246 additions and 261 deletions

View File

@ -887,5 +887,62 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
end,
--战斗中,每[a]秒增加[b]%的异妖能量
--a[int],b[float]
[50] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
BattleLogic.AddMP(role.camp, f2 * 100)
end)
auraBuff.interval = f1
BattleLogic.BuffMgr:AddBuff(role, auraBuff)
end,
--战斗中,初始拥有[a]%的异妖能量
--a[float]
[51] = function(role, args)
local f1 = args[1]
BattleLogic.AddMP(role.camp, f1 * 100)
end,
--战斗中,队伍每损失[a]%的生命值,增加[b]%的异妖能量
--a[float],b[float]
[52] = function(role, args)
local f1 = args[1]
local f2 = args[2]
local maxHp = 0
local curHp = 0
if f1 == 0 then
return
end
local curHpGears = 0
local arr = BattleUtil.ChooseTarget(role, 10000)
for i=1, #arr do
curHp = curHp + arr[i]:GetRoleData(RoleDataName.Hp)
maxHp = maxHp + arr[i]:GetRoleData(RoleDataName.MaxHp)
end
local auraBuff = Buff.Create(role, BuffName.Aura, 0, function (r)
local hp = 0
for i=1, #arr do
hp = hp + arr[i]:GetRoleData(RoleDataName.Hp)
end
if hp < curHp then
local gears = floor((maxHp - hp) / (f1 * maxHp))
if gears > curHpGears then
BattleLogic.AddMP(role.camp, f2 * (gears - curHpGears) * 100)
curHpGears = gears
end
curHp = hp
end
end)
auraBuff.interval = 0
BattleLogic.BuffMgr:AddBuff(role, auraBuff)
end,
}
return passivityList

View File

@ -146,7 +146,11 @@ function Skill:Cast()
if self.owner.superSkill == self then
self.sp = 0
self.spPass = floor(self.cd * BattleLogic.GameFrameRate)
BattleLogic.AddMP(self.owner.camp, 10)
if BattleLogic.Type == 4 then --秘境boss的能量特殊处理
BattleLogic.AddMP(self.owner.camp, 20)
else
BattleLogic.AddMP(self.owner.camp, 10)
end
if self.owner.skill then
local skill = self.owner.skill
skill.sp = 0
@ -155,7 +159,11 @@ function Skill:Cast()
else
self.sp = 0
self.spPass = floor(time * BattleLogic.GameFrameRate)
BattleLogic.AddMP(self.owner.camp, 5)
if BattleLogic.Type == 4 then --秘境boss的能量特殊处理
BattleLogic.AddMP(self.owner.camp, 20)
else
BattleLogic.AddMP(self.owner.camp, 5)
end
end
self.owner.Event:DispatchEvent(BattleEventName.SkillCast, self)
else

View File

@ -6,6 +6,7 @@ local min = math.min
--local Random = Random
--local RoleDataName = RoleDataName
--local BattleEventName = BattleEventName
BattleUtil.Passivity = require("Modules/Battle/Logic/Base/Passivity")
local function clamp(v, minValue, maxValue)
if v < minValue then

View File

@ -7,7 +7,6 @@ local Random = Random
local floor = math.floor
local max = math.max
local min = math.min
local Passivity = require("Modules/Battle/Logic/Base/Passivity")
local aiList = {
[0] = function(skill, superSkill) --默认75%释放点击技、25%释放上滑技
@ -85,7 +84,7 @@ function RoleLogic:Init(uid, data)
for j = 2, #v do
args[j-1] = v[j]
end
Passivity[id](self, args)
BattleUtil.Passivity[id](self, args)
end
end

View File

@ -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;
@ -112,18 +116,22 @@ public class BattleManager {
return checkResult;
}
rebirth(redUserBloodySnpInfo);
creature.setLife(new Life(creature.getLife().getMaxMp(),creature.getLife().getMaxMp()));
updateMonsterHp(checkResult,sceneMonster);
int resultCurHps = updateMonsterHp(checkResult, sceneMonster);
sceneMonster.getLife().setCurHp(resultCurHps);
return checkResult;
}
public static void updateMonsterHp(int[] checkResult,SceneMonster sceneMonster){
public static int updateMonsterHp(int[] checkResult,SceneMonster sceneMonster){
int resultCurHps = 0;
List<Integer> oldRemainHp = sceneMonster.getRemainHps();
List<Integer> result =new ArrayList<>(5);
for(int i=2;i<=oldRemainHp.size()+1;i++){
result.add(checkResult[i]);
resultCurHps+=checkResult[i];
}
sceneMonster.setRemainHps(result);
return resultCurHps;
}
@ -175,4 +183,78 @@ 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 =curHp+(int)( maxHp/10000F*specailValue);
}else{
curHp +=specailValue;
}
}
if(curHp<minCurHp){
curHp = minCurHp;
}
HeroLogic.getInstance().combinedAttribute(foddAddResult,attribute);
HeroLogic.getInstance().calInteractAdd(attribute);
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(),curHp);
resultValue+=curHp;
}
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>playerMinSpeed){
temp=playerMinSpeed;
}else if(temp<playerMaxSpeed){
temp=playerMaxSpeed;
}
result.put(2,temp);
}
return result;
}
}

View File

@ -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;
}
}

View File

@ -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;
@ -34,13 +35,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 +148,13 @@ 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());
getScene().processEventUpdate(EventType.POSMINERAL_REMOVE,getPos());
}
}
if(checkEventTrigger(timestamp)){
break;
@ -156,7 +170,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 +194,6 @@ public abstract class Creature extends SceneActor{
//打断自己行使路线 广播自己状态 位置信息
this.preMoveTimestamp = timestamp;
if(this.getType() != ActorType.Monster){
/*Collections.reverse(path);
cachePath.addAll(path);*/
this.path.clear();
}
@ -191,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) {
@ -208,35 +227,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;
}

View File

@ -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;
}

View File

@ -5,5 +5,7 @@ public enum EventType {
BUFFER_UPDATE,
BUFFER_REMOVE,
SCENEACTORE_REMOVE,
POSMINERAL_UPDATE,
POSMINERAL_REMOVE,
}

View File

@ -27,6 +27,9 @@ public class Life {
return changeValue;
}
public void setCurHp(int curHp) {
this.curHp = curHp;
}
public int getCurHp() {
return curHp;

View File

@ -9,15 +9,16 @@ import com.ljsd.jieling.battle.match.MatchServerice;
import com.ljsd.jieling.battle.room.BeanToProto;
import com.ljsd.jieling.battle.room.Command;
import com.ljsd.jieling.battle.room.SceneManager;
import com.ljsd.jieling.battle.statics.AnalysisData;
import com.ljsd.jieling.config.SBloodyBattleSetting;
import com.ljsd.jieling.db.mongo.MongoUtil;
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;
import com.ljsd.jieling.util.MessageUtil;
import java.util.*;
@ -40,9 +41,53 @@ 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);
}
private Map<Integer, AnalysisData> analysisDataMap = new HashMap<>();
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){
@ -61,8 +106,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);
}
@ -124,6 +192,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 +213,7 @@ public class Scene implements Runnable{
break;
}
tick++;
sysTick();
tick();
if(tick/20 == 1 && tick%20==0){
startAllRunning();
@ -160,6 +235,7 @@ public class Scene implements Runnable{
}
public void sysTick(){
monsterReflush();
int round = SceneManager.bloodyMap.getRound();
if( tick % round != 0){
return;
@ -174,7 +250,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 +265,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("创建矿....");
}
}
@ -238,14 +319,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];
@ -253,7 +332,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()){
@ -316,4 +394,8 @@ public class Scene implements Runnable{
public void setStartTime(long startTime) {
this.startTime = startTime;
}
public Map<Integer, AnalysisData> getAnalysisDataMap() {
return analysisDataMap;
}
}

View File

@ -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,24 @@ 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);
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);
scene.processEventUpdate(EventType.BUFFER_UPDATE,effectBuffer);
}
@ -53,12 +62,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 +77,49 @@ 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/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);
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){
creature.setSpeed(speedTemp);
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,value.getId());
}
}
value.updateEffectValue(i+1,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,10 +139,11 @@ 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){
scene.whenMonsterDead(id);
scene.processEventUpdate(EventType.SCENEACTORE_REMOVE,this.getId());
return;
}
@ -110,30 +155,42 @@ 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){
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());
}
}

View File

@ -1,6 +1,5 @@
package com.ljsd.jieling.battle.actor;
import java.util.List;
public class SceneNpc extends Creature{
@Override

View File

@ -7,6 +7,8 @@ public enum StateType {
FROZEN(4), //不可移动
MOVEABLE(5), //可移动
DIGGER(5), //可移动
INVINCIBLE(5), //无敌
;

View File

@ -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();
}

View File

@ -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();
@ -93,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);
@ -127,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;
@ -272,6 +287,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 +343,32 @@ 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[] 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 +389,9 @@ public class SceneManager {
}
}
public static void main(String[] args) throws InterruptedException {
createScene();
}

View File

@ -0,0 +1,30 @@
package com.ljsd.jieling.battle.statics;
public class AnalysisData {
private int id;
private int killNums; // 杀敌次数
private int deadNums; //死亡次数
private int diggerTimes; // 连续挖矿次数
private int continuousKillNums;//连续杀敌次数
private int continuousDeadNums;//连续死亡次数
public AnalysisData(int id) {
this.id = id;
}
public void win(){
killNums++;
continuousKillNums++;
continuousDeadNums=0;
}
public void fail(){
deadNums++;
continuousKillNums=0;
continuousDeadNums=0;
}
public void digger(){
diggerTimes++;
}
}

View File

@ -0,0 +1,8 @@
package com.ljsd.jieling.battle.statics;
public enum AnalysisEventType {
BATTLE,
DIGGER,
}

View File

@ -0,0 +1,8 @@
package com.ljsd.jieling.battle.statics;
import com.ljsd.jieling.battle.actor.Scene;
public interface AnalysisProcessor {
void process(Scene scene,AnalysisSourceData analysisSourceData);
}

View File

@ -0,0 +1,27 @@
package com.ljsd.jieling.battle.statics;
public class AnalysisSourceData {
private int targetId;
private int caster;
private int value; //参数
public AnalysisSourceData(int targetId, int caster, int value) {
this.targetId = targetId;
this.caster = caster;
this.value = value;
}
public int getTargetId() {
return targetId;
}
public int getCaster() {
return caster;
}
public int getValue() {
return value;
}
}

View File

@ -0,0 +1,16 @@
package com.ljsd.jieling.battle.statics;
import com.ljsd.jieling.battle.actor.Scene;
public class BattleAnalysisProcessor implements AnalysisProcessor{
@Override
public void process(Scene scene, AnalysisSourceData analysisSourceData){
AnalysisData analysisData = scene.getAnalysisDataMap().get(analysisSourceData.getTargetId());
if(analysisSourceData.getValue() == 1){
analysisData.win();
}else{
analysisData.fail();
}
}
}

View File

@ -0,0 +1,12 @@
package com.ljsd.jieling.battle.statics;
import com.ljsd.jieling.battle.actor.Scene;
public class DiggerAnalysisProcessor implements AnalysisProcessor{
@Override
public void process(Scene scene, AnalysisSourceData analysisSourceData) {
AnalysisData analysisData = scene.getAnalysisDataMap().get(analysisSourceData.getTargetId());
analysisData.digger();
}
}

View File

@ -0,0 +1,18 @@
package com.ljsd.jieling.battle.statics;
import java.util.HashMap;
import java.util.Map;
public class MessageBoxUtils {
private static Map<AnalysisEventType,AnalysisProcessor> analysisEventTypeIntegerMap = new HashMap<>();
static {
//更新统计数据 数据汇总聚合
analysisEventTypeIntegerMap.put(AnalysisEventType.BATTLE,new BattleAnalysisProcessor());
analysisEventTypeIntegerMap.put(AnalysisEventType.DIGGER,new DiggerAnalysisProcessor());
}
public static void onGameEvent(AnalysisEventType type){
AnalysisProcessor analysisProcessor = analysisEventTypeIntegerMap.get(type);
}
}

View File

@ -67,6 +67,17 @@ public class SBloodyBattleSetting implements BaseConfig {
private int[] fightTime;
private int[] monsterDrop;
private int playerMaxSpeed;
private int playerMinSpeed;
private int[][] mineralId;
private Map<Integer,int[]> debuffMap;
private Map<Integer,int[]> monsterIndexMap;
@Override
public void init() throws Exception {
@ -94,6 +105,18 @@ 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);
}
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);
sBloodyBattleSettingTmp.setMineralCeilingMap(mineralCeilingMapTmp);
@ -224,4 +247,34 @@ 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;
}
public Map<Integer, int[]> getMonsterIndexMap() {
return monsterIndexMap;
}
public void setMonsterIndexMap(Map<Integer, int[]> monsterIndexMap) {
this.monsterIndexMap = monsterIndexMap;
}
}

View File

@ -0,0 +1,49 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="BloodyMessagesConfig")
public class SBloodyMessagesConfig implements BaseConfig {
private int id;
private String name;
private int type;
private int count;
private String message;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public int getType() {
return type;
}
public int getCount() {
return count;
}
public String getMessage() {
return message;
}
}

View File

@ -53,4 +53,8 @@ public class SEndlessMapConfig implements BaseConfig {
public int[][] getEndlessPoint() {
return endlessPoint;
}
public int[] getMapItem() {
return mapItem;
}
}

View File

@ -0,0 +1,70 @@
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;
public static Map<Integer,SEquipTalismana> equipTalismanaMap ;
@Override
public void init() throws Exception {
equipTalismanaMap = STableManager.getConfig(SEquipTalismana.class);
}
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;
}
}

View File

@ -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;
public static Map<Integer,SEquipTalismanaRankup> equipTalismanaRankupMap ;
@Override
public void init() throws Exception {
equipTalismanaRankupMap = STableManager.getConfig(SEquipTalismanaRankup.class);
}
public int getId() {
return id;
}
public int getIssame() {
return issame;
}
public int getStarLimit() {
return starLimit;
}
public int getIsId() {
return isId;
}
}

View File

@ -79,6 +79,7 @@ public interface BIReason {
int GM_CHANGENAME = 48; // gm改名赠送
int BIND_PHONE = 49; // 修改手机号
int ENDLESS_REASON_CHANGE = 50;//无尽副本赛季更换
//道具消耗原因 1000开头
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
int SECRETBOX_CONSUME = 1001; //秘盒抽卡

View File

@ -21,6 +21,7 @@ public interface GlobalItemType {
int SecretBox=10; // 宝箱
int HEAD_FRAME = 11;//头像框
int CHANGE_NAME_CARD = 12;//改名道具卡
int ESPECIAL_EQUIP = 14;//法宝
//物品使用类型
int NO_USE = 0 ; //不使用
int RANDOM_USE = 1; // 随机使用

View File

@ -21,6 +21,7 @@ public class EquipUnLoadOptHandler extends BaseHandler {
HeroInfoProto.EquipUnLoadOptRequest equipUnLoadOptRequest = HeroInfoProto.EquipUnLoadOptRequest.parseFrom(netData.parseClientProtoNetData());
List<String> equipIdsList = equipUnLoadOptRequest.getEquipIdsList();
String heroId = equipUnLoadOptRequest.getHeroId();
HeroLogic.getInstance().unloadEquipOpt(iSession,heroId,equipIdsList);
int type = equipUnLoadOptRequest.getType();
HeroLogic.getInstance().unloadEquipOpt(iSession,heroId,equipIdsList,type);
}
}

View File

@ -17,7 +17,7 @@ public class EquipWearHandler extends BaseHandler{
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
HeroInfoProto.EquipWearRequest equipWearRequest = HeroInfoProto.EquipWearRequest.parseFrom(netData.parseClientProtoNetData());
HeroLogic.getInstance().wearEquipOpt(iSession,equipWearRequest.getHeroId(),equipWearRequest.getEquipIdList());
HeroLogic.getInstance().wearEquipOpt(iSession,equipWearRequest.getHeroId(),equipWearRequest.getEquipIdList(),equipWearRequest.getType());
}
}

View File

@ -20,6 +20,7 @@ public class GetAllEquipHandler extends BaseHandler{
HeroInfoProto.GetAllEquipRequest getAllEquipRequest
= HeroInfoProto.GetAllEquipRequest.parseFrom(message);
int index = getAllEquipRequest.getIndex();
HeroLogic.getInstance().getAllEquipInfo(iSession,index);
int type = getAllEquipRequest.getType();
HeroLogic.getInstance().getAllEquipInfo(iSession,index,type);
}
}

View File

@ -93,9 +93,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
.setVipLevel(playerInfoManager.getVipLevel()).build();
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder()
.setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder().build();
// .setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
// .setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
Map<Integer, Integer> totalCountMap = user.getHeroManager().getTotalCount();
int alreadyCount =0;

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.handler.map;
import com.googlecode.protobuf.format.JsonFormat;
import com.ljsd.jieling.battle.actor.Monster;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -212,21 +213,21 @@ public class MapLogic {
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
// if(endlessMapInfo.getSeason()!=endlessSeason){
// mapManager.updateEndlessSeason(endlessSeason);
// mapManager.updateEndlessMapId(0);
// mapManager.endlessWalkCellSave(new HashSet<>());
// mapManager.endlessMapInfoSave(new HashMap<>());
// }else{
// Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
// if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
// mapManager.setMapInfo(endlessMapCellInfo);
// }
// Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
// if(walkCell!=null&&walkCell.size()>0){
// mapManager.setWalkCells(walkCell);
// }
// }
if(endlessMapInfo.getSeason()!=endlessSeason){
mapManager.updateEndlessSeason(endlessSeason);
mapManager.updateEndlessMapId(0);
mapManager.endlessWalkCellSave(new HashSet<>());
mapManager.endlessMapInfoSave(new HashMap<>());
}else{
Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
mapManager.setMapInfo(endlessMapCellInfo);
}
Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
if(walkCell!=null&&walkCell.size()>0){
mapManager.setWalkCells(walkCell);
}
}
mapManager.updateEndlessMapId(mapId);
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
int curMapId = entry.getKey();
@ -420,12 +421,12 @@ public class MapLogic {
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
if(mapPointConfig.getIsShowFightAbility()!=null&&mapPointConfig.getIsShowFightAbility().length>0){
int force = 0;
for(int i = 0 ; i <mapPointConfig.getIsShowFightAbility().length;i++){
force+=mapPointConfig.getIsShowFightAbility()[i];
int[] isShowFightAbility = mapPointConfig.getIsShowFightAbility();
if(isShowFightAbility !=null&& isShowFightAbility.length>0){
if(isShowFightAbility[0]!=0){
int force = MonsterUtil.getMonsterForce(isShowFightAbility);
cellValue.setForce(force);
}
cellValue.setForce(force);
}
newMap.put(xy, cellValue);
}
@ -1510,6 +1511,13 @@ public class MapLogic {
fightEndResponse.addAllRemainHpList(remainHp);
fightEndResponse.build();
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
Cell cell = mapManager.getMapInfo().get(triggerXY);
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(cell.getPointId());
if(mapPointConfig.getStyle()==1){
BehaviorUtil.destoryApointXY(user, triggerXY);
}
}
if (sOptionConfig != null) {
int behaviorType = sOptionConfig.getBehaviorType();
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
@ -3218,7 +3226,8 @@ public class MapLogic {
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
int [] cost1 = new int[]{costId,costNum};
cost[0] = cost1;
if(!ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
boolean costResult = ItemUtil.itemCost(user, cost, BIReason.ENDLESS_CONSUME_EXECUTION, 1);
if(!costResult) {
costNum = user.getItemManager().getItem(costId).getItemNum();
cost1[1]= costNum;
cost[0] = cost1;
@ -3281,4 +3290,34 @@ public class MapLogic {
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
/**
*
* @throws Exception
*/
public void resetEndlessInfo() throws Exception {
Map<Integer, ISession> onlineUserMap = OnlineUserManager.sessionMap;
SEndlessMapConfig config = SEndlessMapConfig.sEndlessMapConfigMap.get(MapLogic.getEndlessMapId());
int[] mapItem = config.getMapItem();
for(Map.Entry<Integer, ISession> entry:onlineUserMap.entrySet()){
User user = UserManager.getUser(entry.getValue().getUid());
MapManager mapManager = user.getMapManager();
mapManager.setEndlessMapInfo(new EndlessMapInfo());
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
resetMapInfo(user,false);
MessageUtil.sendIndicationMessage(entry.getValue(),1,MessageTypeProto.MessageType.MAP_OUT_INDICATION_VALUE,null,true);
}
ItemManager itemManager = user.getItemManager();
int [][] costItem = new int[mapItem.length][2];
for(int i = 0 ; i <mapItem.length;i++){
Item item = itemManager.getItem(mapItem[i]);
int[] it = new int[2];
it[0] = mapItem[i];
it[1] = item.getItemNum();
costItem[i] = it;
}
ItemUtil.itemCost(user,costItem, BIReason.ENDLESS_REASON_CHANGE,1);
}
updateEndlessSeason(0);
}
}

View File

@ -116,6 +116,7 @@ public class BehaviorUtil {
Cell cell = mapInfo.get(destoryXY);
if (cell != null) {
cell.setEventId(-1);
cell.setPointId(0);
mapManager.addOrUpdateCell(destoryXY, cell);
}
}

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.battle.room.SceneManager;
import com.ljsd.jieling.config.SDailyTasksConfig;
import com.ljsd.jieling.config.SGlobalSystemConfig;
@ -10,11 +11,13 @@ import com.ljsd.jieling.config.json.ServerProperties;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.map.EndlessMapInfo;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.arena.ArenaLogic;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.friend.FriendLogic;
@ -33,6 +36,7 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.thread.task.RPCGmServerTask;
import com.ljsd.jieling.thread.task.RPCServerTask;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.TimeUtils;
import org.slf4j.Logger;
@ -183,7 +187,7 @@ public class GlobalDataManaager {
ArenaLogic.getInstance().updateArenaSeason(0);
break;
case Endless:
MapLogic.getInstance().updateEndlessSeason(0);
MapLogic.getInstance().resetEndlessInfo();
default:
break;
}

View File

@ -0,0 +1,5 @@
package com.ljsd.jieling.logic;
public interface UpStar {
}

View File

@ -1057,7 +1057,7 @@ public class ActivityLogic {
PlayerInfoProto.GetToBeStrongerResponse.Builder response = PlayerInfoProto.GetToBeStrongerResponse.newBuilder();
for(int i = 0 ; i <6;i++){
CommonProto.StrongerInfo.Builder info = CommonProto.StrongerInfo.newBuilder().setCurScore(1000).setMaxScore(6000);
response.addInfos(info);
response.addInfos(info.build());
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}

View File

@ -12,40 +12,21 @@ import org.slf4j.LoggerFactory;
import java.util.*;
public class Equip extends MongoBase implements Cloneable{
public class Equip extends PropertyItem implements Cloneable{
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);
private String id;
private int equipId;
private int level;
private int rebuildLevel;
private String heroId;
private Map<Integer, Integer> propertyValueByIdMap; //主属性 key 对应PropertyConfig id
private Map<Integer, Integer> secondValueByIdMap; //副属性
private int createTime;
private int skill;
private int isLocked;
public Equip() {
this.setRootCollection(User._COLLECTION_NAME);
}
public Equip(int uid, int equipTid) {
super();
this.setRootCollection(User._COLLECTION_NAME);
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP, uid);
this.equipId = equipTid;
this.propertyValueByIdMap = new HashMap<>();
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP, uid));
super.setEquipId(equipTid);
Map<Integer, Integer> propertyValueByIdMap = new HashMap<>();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipTid);
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(sEquipConfig.getInitialLevel());
Map<Integer, Integer> promoteMap = new HashMap<>();
@ -60,24 +41,25 @@ public class Equip extends MongoBase implements Cloneable{
propertyPromote = 0;
}
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId, finalProperValue);
propertyValueByIdMap.put(properTyId, finalProperValue);
super.setPropertyValueByIdMap(propertyValueByIdMap);
int secondNumMin = sEquipConfig.getSecondNumMin();
int secondNumMax = sEquipConfig.getSecondNumMax();
int secondValue = MathUtils.random(secondNumMin, secondNumMax);
this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue,promoteMap);
this.createTime = (int)(TimeUtils.now()/1000);
Map<Integer, Integer> secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue,promoteMap);
super.setSecondValueByIdMap(secondValueByIdMap);
super.setCreateTime((int)(TimeUtils.now()/1000));
//skill库随机
this.skill = getRandomSkill(sEquipConfig.getSkillPoolId());
super.setSkill(getRandomSkill(sEquipConfig.getSkillPoolId()));
}
//锻造
public Equip(int uid, int equipTid,int workShopLevle,List<Integer> runneIds) {
this.setRootCollection(User._COLLECTION_NAME);
this.id =KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP,uid);
this.equipId = equipTid;
this.propertyValueByIdMap = new HashMap<>();
this.secondValueByIdMap = new HashMap<>();
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP,uid));
super.setEquipId(equipTid);
Map<Integer,Integer> propertyValueByIdMap = new HashMap<>();
Map<Integer,Integer> secondValueByIdMap = new HashMap<>();
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
Map<Integer, Integer> promoteMap = new HashMap<>();
if( sWorkShopSetting != null && sWorkShopSetting.getPromoteMap()!=null){
@ -92,10 +74,12 @@ public class Equip extends MongoBase implements Cloneable{
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
propertyValueByIdMap.put(properTyId,finalProperValue);
super.setPropertyValueByIdMap(propertyValueByIdMap);
super.setSecondValueByIdMap(secondValueByIdMap);
setForRunnes(runneIds,promoteMap);
this.createTime = (int)(TimeUtils.now()/1000);
this.skill = getRandomSkill(sEquipConfig.getSkillPoolId());
super.setCreateTime((int)(TimeUtils.now()/1000));
super.setSkill(getRandomSkill(sEquipConfig.getSkillPoolId()));
}
@ -118,7 +102,7 @@ public class Equip extends MongoBase implements Cloneable{
}
}
secondValueByIdMap = result;
super.setSecondValueByIdMap(result);
}
private void randomForRunne(int poolId,int nums,Map<Integer,Integer> secondValueByIdMap,Map<Integer, Integer> promoteMap){
@ -162,7 +146,7 @@ public class Equip extends MongoBase implements Cloneable{
sEquipPropertyPoolList.addAll(SEquipPropertyPool.getSEquipPropertyPool(pid));
}
if(sEquipPropertyPoolList.size()<nums){
LOGGER.error("the equip config is wrong,the equipTid={},the poolId={},the poolNum={},the requireNum={}",equipId,poolId,sEquipPropertyPoolList.size(),nums);
LOGGER.error("the equip config is wrong,the equipTid={},the poolId={},the poolNum={},the requireNum={}",super.getEquipId(),poolId,sEquipPropertyPoolList.size(),nums);
return result;
}
int totalWeight = 0;
@ -223,7 +207,7 @@ public class Equip extends MongoBase implements Cloneable{
return MathUtils.randomFromWeight(skillWeight);
}
public void rebuildEquip(int workShopLevle){
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId);
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(super.getEquipId());
int properTyId = sEquipConfig.getPropertyMin()[0];
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
Map<Integer, Integer> promoteMap = null;
@ -242,7 +226,7 @@ public class Equip extends MongoBase implements Cloneable{
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
super.getPropertyValueByIdMap().put(properTyId,finalProperValue);
}
List<SEquipPropertyPool> sEquipPropertyPoolList = new ArrayList<>();
for(Integer equipPool:sEquipConfig.getPool()){
@ -250,7 +234,7 @@ public class Equip extends MongoBase implements Cloneable{
}
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
int secondPropertyId = sEquipPropertyPool.getPropertyId();
if(!secondValueByIdMap.containsKey(secondPropertyId)){
if(!super.getSecondValueByIdMap().containsKey(secondPropertyId)){
continue;
}
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(secondPropertyId);
@ -266,94 +250,26 @@ public class Equip extends MongoBase implements Cloneable{
}
int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100);
secondValueByIdMap.put(secondPropertyId,value);
super.getSecondValueByIdMap().put(secondPropertyId,value);
}
setRebuildLevel(workShopLevle);
setSecondValueByIdMap(secondValueByIdMap);
setPropertyValueByIdMap(propertyValueByIdMap);
}
public String getId() {
return id;
}
public int getEquipId() {
return equipId;
}
public void setEquipId(int equipId) throws Exception {
updateString("equipId",equipId);
this.equipId = equipId;
}
public int getLevel() {
return level;
}
public void setLevel(int level) throws Exception {
updateString("level",level);
this.level = level;
super.setSecondValueByIdMap(super.getSecondValueByIdMap());
super.setPropertyValueByIdMap(super.getSecondValueByIdMap());
}
public int getRebuildLevel() {
return rebuildLevel;
}
public String getHeroId() {
return heroId;
}
public void setHeroId(String heroId) throws Exception {
updateString("heroId",heroId);
this.heroId = heroId;
}
public Map<Integer, Integer> getPropertyValueByIdMap() {
return propertyValueByIdMap;
}
public Map<Integer, Integer> getSecondValueByIdMap() {
return secondValueByIdMap;
}
public void setRebuildLevel(int rebuildLevel) {
updateString("rebuildLevel",rebuildLevel);
this.rebuildLevel = rebuildLevel;
}
public void setPropertyValueByIdMap(Map<Integer, Integer> propertyValueByIdMap) {
updateString("propertyValueByIdMap",propertyValueByIdMap);
this.propertyValueByIdMap = propertyValueByIdMap;
}
public void setSecondValueByIdMap(Map<Integer, Integer> secondValueByIdMap) {
updateString("secondValueByIdMap",secondValueByIdMap);
this.secondValueByIdMap = secondValueByIdMap;
}
@Override
public Object clone() throws CloneNotSupportedException {
return (Equip) super.clone();
}
public int getCreateTime() {
return createTime;
}
public int getSkill() {
return skill;
}
public int getIsLocked() {
return isLocked;
}
public void updateIsLocked(int isLocked) {
updateString("isLocked",isLocked);
this.isLocked = isLocked;
}
}

View File

@ -15,6 +15,8 @@ public class EquipManager extends MongoBase {
private Map<String,Equip> equipMap;
private Map<String,EspecialEquip> especialEquipMap;
private Equip unDetermined;
private Map<Integer,Integer> equipHandBook;
@ -23,6 +25,7 @@ public class EquipManager extends MongoBase {
this.equipHandBook = new HashMap<>();
this.equipMap = new HashMap<>();
this.especialEquipMap = new HashMap<>();
this.setRootCollection(User._COLLECTION_NAME);
}
@ -34,6 +37,11 @@ public class EquipManager extends MongoBase {
Poster.getPoster().dispatchEvent(new EquipEvent(user.getId(),equip.getEquipId()));
}
public void addEspecialEquip(User user,EspecialEquip especialEquip){
updateString("especialEquipMap." + especialEquip.getId(), especialEquip);
especialEquipMap.put(especialEquip.getId(), especialEquip);
}
public void remove(String equipId){
if (equipMap.containsKey(equipId)){
removeString(getMongoKey()+".equipMap." + equipId);
@ -45,6 +53,10 @@ public class EquipManager extends MongoBase {
return equipMap;
}
public Map<String, EspecialEquip> getEspecialEquipMap() {
return especialEquipMap;
}
public Equip getUnDetermined() {
return unDetermined;
}

View File

@ -0,0 +1,30 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.UUIDEnum;
public class EspecialEquip extends PropertyItem {
private int star;
public EspecialEquip(int uid,int equipTid) {
super();
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ESPECIAL_EQUIP, uid));
super.setEquipId(equipTid);
this.star = 1;
}
public EspecialEquip() {
this.setRootCollection(User._COLLECTION_NAME);
}
public int getStar() {
return star;
}
public void setStar(int star) {
updateString("star",star);
this.star = star;
}
}

View File

@ -42,6 +42,8 @@ public class Hero extends MongoBase {
private int speed;
private String especialEquip;
public Hero(){
//绑定关系
this.setRootCollection(User._COLLECTION_NAME);
@ -57,6 +59,7 @@ public class Hero extends MongoBase {
this.star = initStar;
this.skillList = new ArrayList<>();
this.equipByPositionMap = new HashMap<>();
this.especialEquip = "";
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
if(skillIds!=null && !skillIds.isEmpty()){
this.skillList.addAll(skillIds);
@ -201,4 +204,16 @@ public class Hero extends MongoBase {
updateString("starBreakId",starBreakId);
this.starBreakId = starBreakId;
}
public void updateEspecial(String especialEquip){
this.especialEquip = especialEquip;
updateString("especialEquip",especialEquip);
}
public void removeEspecial() {
removeString(getMongoKey()+".especialEquip");
especialEquip="";
}
public String getEspecialEquip() {
return especialEquip;
}
}

View File

@ -0,0 +1,123 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import java.util.Map;
public class PropertyItem extends MongoBase {
private String id;
private int equipId;
private int level;
private String heroId;
private Map<Integer, Integer> propertyValueByIdMap; //主属性 key 对应PropertyConfig id
private Map<Integer, Integer> secondValueByIdMap; //副属性
private int createTime;
private int skill;
private int isLocked;
public PropertyItem(String id, int equipId, int level, String heroId, Map<Integer, Integer> propertyValueByIdMap, Map<Integer, Integer> secondValueByIdMap, int createTime, int skill, int isLocked) {
this.id = id;
this.equipId = equipId;
this.level = level;
this.heroId = heroId;
this.propertyValueByIdMap = propertyValueByIdMap;
this.secondValueByIdMap = secondValueByIdMap;
this.createTime = createTime;
this.skill = skill;
this.isLocked = isLocked;
}
public String getId() {
return id;
}
public void setId(String id) {
updateString("id",equipId);
this.id = id;
}
public int getEquipId() {
return equipId;
}
public void setEquipId(int equipId){
updateString("equipId",equipId);
this.equipId = equipId;
}
public int getLevel() {
return level;
}
public void setLevel(int level){
updateString("level",level);
this.level = level;
}
public PropertyItem() {
}
public String getHeroId() {
return heroId;
}
public void setHeroId(String heroId){
updateString("heroId",heroId);
this.heroId = heroId;
}
public Map<Integer, Integer> getPropertyValueByIdMap() {
return propertyValueByIdMap;
}
public Map<Integer, Integer> getSecondValueByIdMap() {
return secondValueByIdMap;
}
public void setPropertyValueByIdMap(Map<Integer, Integer> propertyValueByIdMap) {
updateString("propertyValueByIdMap",propertyValueByIdMap);
this.propertyValueByIdMap = propertyValueByIdMap;
}
public void setSecondValueByIdMap(Map<Integer, Integer> secondValueByIdMap) {
updateString("secondValueByIdMap",secondValueByIdMap);
this.secondValueByIdMap = secondValueByIdMap;
}
public int getCreateTime() {
return createTime;
}
public void setCreateTime(int createTime) {
updateString("createTime", createTime);
this.createTime = createTime;
}
public int getSkill() {
return skill;
}
public void setSkill(int skill) {
updateString("skill", skill);
this.skill = skill;
}
public int getIsLocked() {
return isLocked;
}
public void updateIsLocked(int isLocked) {
updateString("isLocked", isLocked);
this.isLocked = isLocked;
}
}

View File

@ -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 ){

View File

@ -19,6 +19,7 @@ public enum HeroAttributeEnum {
AntiCritDamageFactor(60),
DifferDemonsBocusFactor(66),
CurHpExtra(67),
CurHpSpecialExtra(68),
FireDamageBonusFactor(101),
WindDamageBonusFactor(102),
WaterDamageBonusFactor(103),

View File

@ -93,16 +93,30 @@ public class HeroLogic {
private static final String VERTICAL = "|";
private static final String DIVISION = "#";
public void getAllEquipInfo(ISession iSession,int index) throws Exception {
/**
*
* @param iSession
* @param index
* @param type
* @throws Exception
*/
public void getAllEquipInfo(ISession iSession,int index,int type) throws Exception {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
Map<String, Equip> equipMap = user.getEquipManager().getEquipMap();
List<CommonProto.Equip> equipList = new ArrayList<>();
for(Equip equipInfo: equipMap.values()){
equipList.add(CBean2Proto.getEquipProto(equipInfo));
if(type==1){
Map<String, Equip> equipMap = user.getEquipManager().getEquipMap();
for(Equip equipInfo: equipMap.values()){
equipList.add(CBean2Proto.getEquipProto(equipInfo));
}
}else{
Map<String, EspecialEquip> especialEquipMap = user.getEquipManager().getEspecialEquipMap();
for(EspecialEquip especialEquipInfo: especialEquipMap.values()){
equipList.add(CBean2Proto.getEquipProto(especialEquipInfo));
}
}
boolean isSendFinish = false;
int endIndex = index + Global.SEND_EQUIP_COUNT ;
int endIndex = index + Global.SEND_EQUIP_COUNT;
if (index < equipList.size()) {
if (endIndex >= equipList.size()) {
endIndex = equipList.size();
@ -531,6 +545,13 @@ public class HeroLogic {
}
/**
*
* @param session
* @param heroId
* @param consumeMaterialsList
* @throws Exception
*/
public void upHeroStar(ISession session, String heroId, List<HeroInfoProto.ConsumeMaterial> consumeMaterialsList) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
@ -943,9 +964,15 @@ public class HeroLogic {
int pokemonId = teamPosForPokenInfo.getPokenId();
Pokemon pokemon = pokemonMap.get(pokemonId);
SDifferDemonsStageConfig sDifferDemonsStageConfig = SDifferDemonsStageConfig.getsDifferDemonsStageConfigMap(pokemonId*100 + pokemon.getAllStage());
if(StringUtil.isEmpty(sDifferDemonsStageConfig.getPassiveSkillString())){
continue;
}
pokenSkillResult.append(sDifferDemonsStageConfig.getPassiveSkillString()).append("|");
}
String s = pokenSkillResult.toString();
if(StringUtil.isEmpty(s)){
return "";
}
return s.substring( 0,(s.length()-1));
}
@ -969,7 +996,6 @@ public class HeroLogic {
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
int profession = scHero.getProfession();
Map<Integer, Pokemon> pokemonMap = pokemonManager.getPokemonMap();
LOGGER.info("cal herotid = {},hero51value = {},end",hero.getTemplateId(),heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
for(Map.Entry<Integer,Pokemon> item : pokemonMap.entrySet()){
Pokemon pokemon = item.getValue();
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
@ -986,7 +1012,6 @@ public class HeroLogic {
combinedAttribute(sDifferDemonsComonpentsConfig.getBaseAttribute(),heroAllAttribute);
}
}
LOGGER.info("cal herotid = {},hero51value = {},end",hero.getTemplateId(),heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
//装备总战力评分
int equipForce=0;
boolean needRemove = false;
@ -1034,7 +1059,6 @@ public class HeroLogic {
HandlerLogicThread handlerThread = instance.handlerThreads[user.getId() % instance.HANDLER_THREAD_NUM];
handlerThread.addAyyncWorker(ayyncWorker);
}
LOGGER.info("cal herotid = {},hero51value = {},end",hero.getTemplateId(),heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
//天赋异妖加成
Map<Integer, Pokemon> ringFireMap = pokemonManager.getRingFireMap();
for(Map.Entry<Integer,Pokemon> item : ringFireMap.entrySet()){
@ -1063,12 +1087,10 @@ public class HeroLogic {
SRingFireMaterialConfig sRingFireMaterialConfig = SRingFireMaterialConfig.config.get(comonpentId);
int[][] comonpentIdProperty = sRingFireMaterialConfig.getProperty();
combinedAttribute(comonpentIdProperty,heroAllAttribute);
LOGGER.info("cal herotid = {},hero51value = {},end",hero.getTemplateId(),heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
}
}
LOGGER.info("cal herotid = {},hero51value = {},end",hero.getTemplateId(),heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
//工坊科技树加成
/* Map<Integer, Integer> techProfressionMap = user.getWorkShopController().getTechnologyMap().get(scHero.getProfession());
Map<Integer, Integer> techProfressionMap = user.getWorkShopController().getTechnologyMap().get(scHero.getProfession());
if(techProfressionMap!=null){
for(Map.Entry<Integer,Integer> item : techProfressionMap.entrySet()){
SWorkShopTechnology sWorkShopTechnology = SWorkShopTechnology.getsWorkTechMapByTechIdAndLevel(item.getKey(), item.getValue());
@ -1081,7 +1103,24 @@ public class HeroLogic {
}
}
}*/
}
//法宝加成
String especialEquip = hero.getEspecialEquip();
Map<String, EspecialEquip> especialEquipMap = user.getEquipManager().getEspecialEquipMap();
int equipTempId = especialEquipMap.get(especialEquip).getEquipId();
int tempStar = especialEquipMap.get(especialEquip).getStar();
Map<Integer, SEquipTalismana> equipTalismanaMap = SEquipTalismana.equipTalismanaMap;
for(Map.Entry<Integer, SEquipTalismana> entry:equipTalismanaMap.entrySet()){
if(entry.getValue().getTalismanaId()!=equipTempId){
continue;
}
if(entry.getValue().getLevel()!=tempStar){
continue;
}
}
//阵营光环加成
if(!isForce){
if(teamId!=0){
@ -1097,7 +1136,6 @@ public class HeroLogic {
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
//装备战力保存
heroAllAttribute.put(HeroAttributeEnum.EquipForce.getPropertyId(),equipForce);
LOGGER.info("cal herotid = {},hero51value = {},end",hero.getTemplateId(),heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
return heroAllAttribute;
}
@ -1273,18 +1311,25 @@ public class HeroLogic {
// equip TODO 装备会导致英雄属性发生变化
public void wearEquipOpt(ISession session,String heroId,List<String> equipIds) throws Exception {
public void wearEquipOpt(ISession session,String heroId,List<String> equipIds,int type) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
Hero hero = user.getHeroManager().getHeroMap().get(heroId);
Map<Integer,String> equipInfoTmp = new HashMap<>(6);
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,"equip.wrong");
return;
if(type==1){
Map<Integer,String> equipInfoTmp = new HashMap<>(6);
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,"equip.wrong");
return;
}
hero.updateMutliEquipPositionMap(equipInfoTmp);
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
}else if(type ==2){
if(equipIds.size()!=1){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE.getNumber(),"法宝智能穿戴一个");
}else{
hero.updateEspecial(equipIds.get(0));
}
}
hero.updateMutliEquipPositionMap(equipInfoTmp);
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
// Map<Integer, Integer> heroNotBufferAttribute = calHeroNotBufferAttribute(user, hero);
// int force = calForce(heroNotBufferAttribute) + heroNotBufferAttribute.get(HeroAttributeEnum.EquipForce.getPropertyId());
// LOGGER.info("the heroTid={},the force={}",hero.getTemplateId(),force);
@ -1295,29 +1340,33 @@ public class HeroLogic {
}
public void unloadEquipOpt(ISession session,String heroId,List<String> equipIds) throws Exception {
public void unloadEquipOpt(ISession session,String heroId,List<String> equipIds,int type) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
Hero hero = user.getHeroManager().getHero(heroId);
if( hero == null || equipIds.isEmpty()){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
return;
}
List<Integer> positions = new ArrayList<>();
for(String equipId : equipIds){
Equip equip = user.getEquipManager().getEquipMap().get(equipId);
if(null == equip || !StringUtil.isEmpty(equip.getHeroId())){
if(type==1){
if( hero == null || equipIds.isEmpty()){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
return;
}
int equipIdTid = equip.getEquipId();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipIdTid);
int position = sEquipConfig.getPosition();
positions.add(position);
}
List<Integer> positions = new ArrayList<>();
for(String equipId : equipIds){
Equip equip = user.getEquipManager().getEquipMap().get(equipId);
if(null == equip || !StringUtil.isEmpty(equip.getHeroId())){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
return;
}
int equipIdTid = equip.getEquipId();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipIdTid);
int position = sEquipConfig.getPosition();
positions.add(position);
}
for(Integer position : positions){
hero.removeEquip(position);
for(Integer position : positions){
hero.removeEquip(position);
}
}else if(type==2){
hero.removeEspecial();
}
//发送成功消息

View File

@ -306,8 +306,7 @@ public class WorkShopLogic {
CommonProto.Equip equipProto = CBean2Proto.getEquipProto(unDetermined);
builder.setUnDetermined(equipProto);
}
// builder.addAllTechnologyInfo(CBean2Proto.getTechInfo(workShopController.getTechnologyMap().values()));
builder.addAllTechnologyInfo(new ArrayList<>());
builder.addAllTechnologyInfo(CBean2Proto.getTechInfo(workShopController.getTechnologyMap().values()));
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_WORKSHOP_INFO_RESPONSE_VALUE,builder.build(),true);
}

View File

@ -87,9 +87,7 @@ public class StoreLogic {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
StoreManager storeManager = user.getStoreManager();
if (storeManager.getStoreInfoMap().size() == 0){
initStoreInfo(user,storeManager);
}
initStoreInfo(user,storeManager);
PlayerInfoProto.GetStoreInfosResponse.Builder builder = PlayerInfoProto.GetStoreInfosResponse.newBuilder();
Map<Integer, StoreInfo> storeInfoMap = storeManager.getStoreInfoMap();
checkStoreRefresh(user,storeInfoMap);
@ -223,6 +221,9 @@ public class StoreLogic {
Map<Integer, SStoreTypeConfig> sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap();
for ( Map.Entry<Integer, SStoreTypeConfig> entry :sstoreTypeConfigMap.entrySet()){
SStoreTypeConfig sStoreTypeConfig = entry.getValue();
if(storeManager.getStoreInfoMap().containsKey(sStoreTypeConfig.getId())){
continue;
}
if (sStoreTypeConfig.getStoreOpenRule() == 1 && sStoreTypeConfig.getId() !=8){ //固定商店
Map<Integer, Integer> itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user);
long startTime = 0;

View File

@ -83,6 +83,7 @@ public class CBean2Proto {
.setCreateTime(hero.getCreateTime())
.addAllSkillIdList(hero.getSkillList())
.addAllEquipIdList(equipList)
.addEspecialEquip(hero.getEspecialEquip())
.build();
}
@ -103,20 +104,26 @@ public class CBean2Proto {
}
public static CommonProto.Equip getEquipProto(Equip equip){
public static CommonProto.Equip getEquipProto(PropertyItem equip){
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
CommonProto.Equip equipProto =CommonProto.Equip.newBuilder()
CommonProto.Equip.Builder equipProto =CommonProto.Equip.newBuilder()
.setEquipId(equip.getEquipId())
.setId(equip.getId())
.setMainAttribute(parseFromMap(propertyValueByIdMap).get(0))
.addAllSecondAttribute(parseFromMap(secondValueByIdMap))
.setRebuildLevel(equip.getRebuildLevel())
.setCreateTime(equip.getCreateTime())
.setSkillId(equip.getSkill())
.setIsLocked(equip.getIsLocked())
.build();
return equipProto;
.setIsLocked(equip.getIsLocked());
if(equip instanceof Equip){
Equip tempEquip =(Equip)equip;
equipProto.setMainAttribute(parseFromMap(propertyValueByIdMap).get(0))
.addAllSecondAttribute(parseFromMap(secondValueByIdMap))
.setRebuildLevel(tempEquip.getRebuildLevel())
.setSkillId(tempEquip.getSkill());
}
if(equip instanceof EspecialEquip){
EspecialEquip tempEquip =(EspecialEquip)equip;
equipProto.setRebuildLevel(tempEquip.getStar());
}
return equipProto.build();
}

View File

@ -102,6 +102,7 @@ public class FightDataUtil {
enemyData.rawset(i+1, unitData);
}
enemyData.set("teamSkill", getTeamSkill(data.getTeamSkillList().trim()));
enemyData.set("teamPassive", new LuaTable());
return enemyData;
}
@ -184,9 +185,15 @@ public class FightDataUtil {
for (int j = 0; j < skills.length; j++) {
if (skills[j].length()>0){
String[] unitSkill = skills[j].split("#");
if(unitSkill.length==0){
continue;
}
LuaValue passivityDataPer= new LuaTable();
for(int i=0;i<unitSkill.length;i++){
LuaValue detail = new LuaTable();
if(StringUtil.isEmpty(unitSkill[i])){
continue;
}
int passivityId = Integer.parseInt(unitSkill[i]);
SPassiveSkillLogicConfig sPassiveSkillLogicConfig = SPassiveSkillLogicConfig.getConfig(passivityId);
detail.rawset(1, LuaValue.valueOf(sPassiveSkillLogicConfig.getType()));

View File

@ -385,6 +385,7 @@ public class ItemUtil {
putcountMap(itemId, itemNum, cardMap);
break;
case GlobalItemType.EQUIP:
case GlobalItemType.ESPECIAL_EQUIP:
putcountMap(itemId, itemNum, equipMap);
break;
case GlobalItemType.RANDOM_ITME:
@ -771,15 +772,22 @@ public class ItemUtil {
private static void addEquip(User user,int equipId ,List<CommonProto.Equip> equipList) throws Exception {
EquipManager equipManager = user.getEquipManager();
Equip equip = new Equip(user.getId(),equipId);
equipManager.addEquip(user,equip);
equipList.add(CBean2Proto.getEquipProto(equip));
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipId);
if (sEquipConfig.getQuality() >= 5) {
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{nickName, equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equipId).getName()});
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,equipId,0,0,0,0,0);
int itemType = SItem.getsItemMap().get(equipId).getItemType();
if(itemType==GlobalItemType.EQUIP){
Equip equip = new Equip(user.getId(),equipId);
equipManager.addEquip(user,equip);
equipList.add(CBean2Proto.getEquipProto(equip));
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipId);
if (sEquipConfig.getQuality() >= 5) {
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{nickName, equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equipId).getName()});
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,equipId,0,0,0,0,0);
}
}else if(itemType==GlobalItemType.ESPECIAL_EQUIP){
EspecialEquip especialEquip = new EspecialEquip(user.getId(),equipId);
equipManager.addEspecialEquip(user,especialEquip);
}
}
/**

View File

@ -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;
}
}

View File

@ -71,6 +71,29 @@ public class MonsterUtil {
return hps;
}
public static int getMonsterForce(int[] groupIds){
Map<Integer, SMonsterGroup> integerSMonsterGroupMap = SMonsterGroup.getsMonsterGroupMap();
Map<Integer, SMonsterConfig> integerSMonsterConfigMap = SMonsterConfig.getsMonsterConfigMap();
int maxForce = 0;
for(int i = 0 ; i < groupIds.length;i++){
SMonsterGroup sMonsterGroup = integerSMonsterGroupMap.get(groupIds[i]);
int[][] contents = sMonsterGroup.getContents();
int totalMonsterForce = 0;
for(int j = 0; j<contents.length;j++){
for(int k = 0;k<contents[j].length;k++){
SMonsterConfig monster = integerSMonsterConfigMap.get(contents[j][k]);
int monsterForce = (int)(monster.getAttack()*3+monster.getHp()*0.21+monster.getPhysicalDefence()*0.5+monster.getMagicDefence()*0.5);
totalMonsterForce+=monsterForce;
}
}
if(totalMonsterForce>maxForce){
maxForce = totalMonsterForce;
}
}
return (int)(maxForce*(0.8+groupIds.length*0.2));
}
public static String getMonsterSkillById(int monsterId){
CommonProto.FightUnitInfo monster = SMonsterConfig.getMonsterMap().get(monsterId);
return monster.getUnitSkillIds();

View File

@ -7,6 +7,7 @@ public enum UUIDEnum {
ARENARECORD(3),
ADVENTUREBOSS(4),
GUILDLOG(5),
ESPECIAL_EQUIP(6)
;
private int value;