battle
parent
72bbe0d046
commit
8ec551cfc4
|
@ -214,12 +214,7 @@ function BattleUtil.CalDamage(atkRole, defRole, damageType, baseFactor, ignoreDe
|
|||
else
|
||||
defence = defRole:GetRoleData(RoleDataName.MagicDefence)
|
||||
end
|
||||
local attack = 0
|
||||
if atkRole.GetAttackFunc then
|
||||
attack = atkRole.GetAttackFunc(bCrit)
|
||||
else
|
||||
attack = atkRole:GetRoleData(RoleDataName.Attack)
|
||||
end
|
||||
local attack = atkRole:GetRoleData(RoleDataName.Attack)
|
||||
--计算暴击
|
||||
if bCrit or defRole.isFlagCrit then
|
||||
local critDamageFactor = atkRole:GetRoleData(RoleDataName.CritDamageFactor)
|
||||
|
|
|
@ -249,6 +249,13 @@ function RoleLogic:Dispose()
|
|||
skillPool:Put(self.superSkill)
|
||||
self.superSkill = nil
|
||||
end
|
||||
|
||||
--清除异常状态
|
||||
self.enable = true
|
||||
self.ctrl_slient = false
|
||||
self.lockTarget = nil
|
||||
self.ctrl_noheal = false
|
||||
self.ctrl_blind = false
|
||||
end
|
||||
|
||||
function RoleLogic:Update()
|
||||
|
|
|
@ -67,6 +67,8 @@ public class SGameSetting implements BaseConfig {
|
|||
|
||||
private int heroTimes;
|
||||
|
||||
private int[][] returnMaterials;
|
||||
|
||||
|
||||
|
||||
private static SGameSetting gameSetting;
|
||||
|
@ -183,4 +185,8 @@ public class SGameSetting implements BaseConfig {
|
|||
public int getHeroTimes() {
|
||||
return heroTimes;
|
||||
}
|
||||
|
||||
public int[][] getReturnMaterials() {
|
||||
return returnMaterials;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
|
|||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -25,13 +26,17 @@ public class SWorkShopTechnology implements BaseConfig {
|
|||
|
||||
private int[][] consume;
|
||||
|
||||
private static Map<Integer,Map<Integer,SWorkShopTechnology>> sWorkTechMapByTechIdAndLevel;
|
||||
private Map<Integer,Integer> willReturn;
|
||||
|
||||
public static Map<Integer,Map<Integer,SWorkShopTechnology>> sWorkTechMapByTechIdAndLevel;
|
||||
public static Map<Integer,Integer> professByTechIdMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SWorkShopTechnology> config = STableManager.getConfig(SWorkShopTechnology.class);
|
||||
Map<Integer,Map<Integer,SWorkShopTechnology>> sWorkTechMapByTechIdAndLevelTmp = new HashMap<>();
|
||||
Map<Integer,Integer> professByTechIdMapTmp = new HashMap<>();
|
||||
for(SWorkShopTechnology sWorkShopTechnology : config.values()){
|
||||
int techId = sWorkShopTechnology.getTechId();
|
||||
int level = sWorkShopTechnology.getLevel();
|
||||
|
@ -39,8 +44,22 @@ public class SWorkShopTechnology implements BaseConfig {
|
|||
sWorkTechMapByTechIdAndLevelTmp.put(techId,new HashMap<>());
|
||||
}
|
||||
sWorkTechMapByTechIdAndLevelTmp.get(techId).put(level,sWorkShopTechnology);
|
||||
professByTechIdMapTmp.put(sWorkShopTechnology.getTechId(),sWorkShopTechnology.getProfession());
|
||||
|
||||
SWorkShopTechnology sWorkShopTechnologyTmp = sWorkTechMapByTechIdAndLevelTmp.get(techId).get(level - 1);
|
||||
if(sWorkShopTechnologyTmp!=null){
|
||||
Map<Integer,Integer> mineWillReturn = new HashMap<>();
|
||||
Map<Integer,Integer> willReturn = sWorkShopTechnologyTmp.getWillReturn();
|
||||
if(willReturn != null){
|
||||
mineWillReturn.putAll(willReturn);
|
||||
}
|
||||
int[][] consume = sWorkShopTechnologyTmp.getConsume();
|
||||
HeroLogic.getInstance().combinedAttribute(consume,mineWillReturn);
|
||||
sWorkShopTechnology.setWillReturn(mineWillReturn);
|
||||
}
|
||||
}
|
||||
sWorkTechMapByTechIdAndLevel =sWorkTechMapByTechIdAndLevelTmp;
|
||||
professByTechIdMap =professByTechIdMapTmp;
|
||||
}
|
||||
|
||||
public static SWorkShopTechnology getsWorkTechMapByTechIdAndLevel(int techId,int level) {
|
||||
|
@ -82,5 +101,11 @@ public class SWorkShopTechnology implements BaseConfig {
|
|||
return consume;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getWillReturn() {
|
||||
return willReturn;
|
||||
}
|
||||
|
||||
public void setWillReturn(Map<Integer, Integer> willReturn) {
|
||||
this.willReturn = willReturn;
|
||||
}
|
||||
}
|
|
@ -198,6 +198,7 @@ public class HandlerLogicThread extends Thread{
|
|||
|
||||
private boolean checkOpen(User user, SGlobalSystemConfig sGlobalSystemConfig) {
|
||||
int level = user.getPlayerInfoManager().getLevel();
|
||||
int workShopLevel = user.getWorkShopController().getWorkShopLevel();
|
||||
Map<Integer, LevelDifficulty> levelDifficultyInfosMap = user.getLevelDifficultyManager().getLevelDifficultyInfosMap();
|
||||
int type = sGlobalSystemConfig.getOpenRules()[0];
|
||||
int condition = sGlobalSystemConfig.getOpenRules()[1];
|
||||
|
@ -205,10 +206,14 @@ public class HandlerLogicThread extends Thread{
|
|||
if (!levelDifficultyInfosMap.containsKey(condition) || levelDifficultyInfosMap.containsKey(condition) && levelDifficultyInfosMap.get(condition).getState() != Global.FIGHT_CLEARANCE) {
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
}else if(type == 2){
|
||||
if (level < condition){
|
||||
return true;
|
||||
}
|
||||
}else if(type == 3){ //工坊
|
||||
if (workShopLevel < condition){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,17 +2,20 @@ package com.ljsd.jieling.logic.dao;
|
|||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SWorkShopSetting;
|
||||
import com.ljsd.jieling.config.SWorkShopTechnology;
|
||||
import com.ljsd.jieling.db.mongo.MongoKey;
|
||||
import com.ljsd.jieling.logic.dao.root.MailingSystem;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class WorkShopController extends MongoBase {
|
||||
private Map<Integer, List<Integer>> openBlueStateMap;
|
||||
private Map<Integer,Integer> technologyMap = new HashMap<>();
|
||||
private Map<Integer,Map<Integer,Integer>> technologyMap = new HashMap<>();
|
||||
|
||||
private int workShopLevel;
|
||||
|
||||
private int workShopExp;
|
||||
|
@ -21,9 +24,10 @@ public class WorkShopController extends MongoBase {
|
|||
|
||||
private int cookExp;
|
||||
|
||||
|
||||
|
||||
public WorkShopController(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
|
||||
this.openBlueStateMap = new HashMap<>();
|
||||
|
||||
}
|
||||
|
@ -36,9 +40,12 @@ public class WorkShopController extends MongoBase {
|
|||
updateString("openBlueStateMap." + type, openBlueStateMap.get(type));
|
||||
}
|
||||
|
||||
public void updateTechLevel(int techId,int level){
|
||||
this.technologyMap.put(techId,level);
|
||||
updateString("technologyMap." + techId,level);
|
||||
public void updateTechLevel(int propession,int techId,int level){
|
||||
if(this.technologyMap.containsKey(propession)){
|
||||
this.technologyMap.put(propession,new HashMap<>());
|
||||
}
|
||||
this.technologyMap.get(propession).put(techId,level);
|
||||
updateString("technologyMap." + propession + "." + techId,level);
|
||||
}
|
||||
|
||||
public int getWorkShopLevel() {
|
||||
|
@ -81,7 +88,7 @@ public class WorkShopController extends MongoBase {
|
|||
return cookExp;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getTechnologyMap() {
|
||||
public Map<Integer, Map<Integer, Integer>> getTechnologyMap() {
|
||||
return technologyMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1025,7 +1025,7 @@ public class HeroLogic {
|
|||
heroAttributeMap.put(propertyId,propertyValue);
|
||||
}
|
||||
}
|
||||
private void combinedAttribute(int[][] otherAttriMap,Map<Integer,Integer> heroAttributeMap){
|
||||
public void combinedAttribute(int[][] otherAttriMap,Map<Integer,Integer> heroAttributeMap){
|
||||
for(int[] item : otherAttriMap){
|
||||
int propertyId = item[0];
|
||||
int propertyValue = item[1];
|
||||
|
@ -1367,7 +1367,36 @@ public class HeroLogic {
|
|||
}
|
||||
sArenaRobotConfig.setTotalForce(calRobotTotalForce(sArenaRobotConfig));
|
||||
}
|
||||
|
||||
int[][] returnMaterials = SGameSetting.getGameSetting().getReturnMaterials();
|
||||
Map<Integer, Map<Integer, SWorkShopTechnology>> sWorkTechMapByTechIdAndLevel = SWorkShopTechnology.sWorkTechMapByTechIdAndLevel;
|
||||
for(Map<Integer, SWorkShopTechnology> item : sWorkTechMapByTechIdAndLevel.values()){
|
||||
for(SWorkShopTechnology sWorkShopTechnology:item.values()){
|
||||
if(sWorkShopTechnology.getWillReturn() == null){
|
||||
continue;
|
||||
}
|
||||
calPercent(returnMaterials,sWorkShopTechnology.getWillReturn());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void calPercent(int[][] otherAttriMap,Map<Integer,Integer> heroAttributeMap){
|
||||
for(int[] item : otherAttriMap){
|
||||
int propertyId = item[0];
|
||||
int propertyValue = item[1];
|
||||
if(!heroAttributeMap.containsKey(propertyId)){
|
||||
continue;
|
||||
}
|
||||
int nums = propertyValue * heroAttributeMap.get(propertyId) / 100;
|
||||
if(nums<=0){
|
||||
return;
|
||||
}
|
||||
heroAttributeMap.put(propertyId,nums);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//妖灵师是否在阵容中
|
||||
public boolean isBattleArray (User user,String heroId){
|
||||
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
|
||||
|
|
|
@ -33,17 +33,21 @@ public class WorkShopLogic {
|
|||
int msgId = MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_RESPONSE_VALUE;
|
||||
User user = UserManager.getUser(uid);
|
||||
WorkShopController workShopController = user.getWorkShopController();
|
||||
Map<Integer, Integer> technologyMap = workShopController.getTechnologyMap();
|
||||
int oldLevl = 0;
|
||||
if(technologyMap.containsKey(techId)){
|
||||
oldLevl = technologyMap.get(techId);
|
||||
Integer profession = SWorkShopTechnology.professByTechIdMap.get(techId);
|
||||
if(profession == null){
|
||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"parm is wrong");
|
||||
return;
|
||||
}
|
||||
SWorkShopTechnology sWorkShopTechnology = SWorkShopTechnology.getsWorkTechMapByTechIdAndLevel(techId, oldLevl + 1);
|
||||
int oldLevl = 0;
|
||||
if( workShopController.getTechnologyMap().containsKey(profession) && workShopController.getTechnologyMap().get(profession).containsKey(techId)){
|
||||
oldLevl = workShopController.getTechnologyMap().get(profession).get(techId);
|
||||
}
|
||||
SWorkShopTechnology sWorkShopTechnology = SWorkShopTechnology.getsWorkTechMapByTechIdAndLevel(techId, oldLevl);
|
||||
if(sWorkShopTechnology == null){
|
||||
MessageUtil.sendErrorResponse(iSession,0,msgId,"maxLevel");
|
||||
return;
|
||||
}
|
||||
workShopController.updateTechLevel(techId,oldLevl + 1);
|
||||
workShopController.updateTechLevel(profession,techId,oldLevl + 1);
|
||||
int[][] consume = sWorkShopTechnology.getConsume();
|
||||
boolean enough = ItemUtil.itemCost(user, consume, BIReason.WORKSHOP_TECHNOLOGY_CONSUME, sWorkShopTechnology.getId());
|
||||
if(!enough){
|
||||
|
@ -51,8 +55,23 @@ public class WorkShopLogic {
|
|||
return;
|
||||
}
|
||||
MessageUtil.sendMessage(iSession,1, msgId,null,true);
|
||||
}
|
||||
|
||||
|
||||
public void workShopTechnogyRefrsh(ISession session,int profession) throws Exception {
|
||||
int uid = session.getUid();
|
||||
int msgId = MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_RESPONSE_VALUE;
|
||||
User user = UserManager.getUser(uid);
|
||||
WorkShopController workShopController = user.getWorkShopController();
|
||||
Map<Integer, Map<Integer, Integer>> technologyMap = workShopController.getTechnologyMap();
|
||||
Map<Integer, Integer> technologyByProfessionMap = technologyMap.get(profession);
|
||||
if(technologyByProfessionMap == null || technologyByProfessionMap.isEmpty()){
|
||||
return;
|
||||
}
|
||||
Map<Integer,Integer> returnMap = new HashMap<>();
|
||||
for(Map.Entry<Integer,Integer> item : technologyByProfessionMap.entrySet()){
|
||||
SWorkShopTechnology sWorkShopTechnology = SWorkShopTechnology.getsWorkTechMapByTechIdAndLevel(item.getKey(), item.getValue());
|
||||
}
|
||||
CommonProto.Drop.Builder builder = ItemUtil.dropMap(user, returnMap, 1);
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
|
@ -243,7 +262,7 @@ public class WorkShopLogic {
|
|||
CommonProto.Equip equipProto = CBean2Proto.getEquipProto(unDetermined);
|
||||
builder.setUnDetermined(equipProto);
|
||||
}
|
||||
builder.addAllTechnologyInfo(CBean2Proto.getTechInfo(workShopController.getTechnologyMap()));
|
||||
builder.addAllTechnologyInfo(CBean2Proto.getTechInfo(workShopController.getTechnologyMap().values()));
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_WORKSHOP_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.protocols.ChatProto;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class CBean2Proto {
|
||||
|
||||
|
@ -288,10 +286,14 @@ public class CBean2Proto {
|
|||
return CommonProto.RingFireInfo.newBuilder().addAllComonpentId(pokemon.getComonpentsLevelMap().keySet()).setStage(pokemon.getAllStage()).setId(pokemon.getId()).build();
|
||||
}
|
||||
|
||||
public static List<CommonProto.TechnologyInfo> getTechInfo(Map<Integer,Integer> techInfoMap){
|
||||
public static List<CommonProto.TechnologyInfo> getTechInfo(Collection<Map<Integer, Integer>> techInfoMap){
|
||||
List<CommonProto.TechnologyInfo> result = new ArrayList<>(techInfoMap.size());
|
||||
for(Map.Entry<Integer,Integer> item : techInfoMap.entrySet()){
|
||||
result.add(CommonProto.TechnologyInfo.newBuilder().setTechId(item.getKey()).setLevle(item.getValue()).build());
|
||||
Iterator<Map<Integer, Integer>> iterator = techInfoMap.iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map<Integer, Integer> items = iterator.next();
|
||||
for(Map.Entry<Integer,Integer> item: items.entrySet()){
|
||||
result.add(CommonProto.TechnologyInfo.newBuilder().setTechId(item.getKey()).setLevle(item.getValue()).build());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -52,6 +52,22 @@ public class ItemUtil {
|
|||
return dropBuilder;
|
||||
}
|
||||
|
||||
//指定道具掉落(如:邮件,初始化物品)
|
||||
public static CommonProto.Drop.Builder dropMap(User user, Map<Integer,Integer> itemArr,int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
Map<Integer, Integer> cardMap = new HashMap<>();
|
||||
Map<Integer,Integer> equipMap = new HashMap<>();
|
||||
Map<Integer,Integer> randomMap = new HashMap<>();
|
||||
selectItemArr(itemArr,cardMap,itemMap,equipMap,randomMap);
|
||||
|
||||
useRandomItem(user,randomMap,reason);
|
||||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
public static CommonProto.Drop.Builder dropPer(User user, int[][] itemArr,int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
for(int [] item : itemArr){
|
||||
|
@ -221,6 +237,13 @@ public class ItemUtil {
|
|||
getMap(items[0],items[1], itemMap, cardMap,equipMap,randomMap,1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void selectItemArr(Map<Integer,Integer>itemArr, Map<Integer, Integer> cardMap, Map<Integer, Integer>
|
||||
itemMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap) {
|
||||
for (Map.Entry<Integer,Integer> items : itemArr.entrySet()){
|
||||
getMap(items.getKey(), items.getValue(), itemMap, cardMap,equipMap,randomMap,1);
|
||||
}
|
||||
}
|
||||
private static void selectDrop(SRewardGroup sRewardGroup,Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap,Map<Integer,Integer> randomMap , float dropRatio) {
|
||||
String dropInfo = dropRewardMap.get(sRewardGroup.getId());
|
||||
String rewardStr = dropInfo.split("\\|")[0];
|
||||
|
|
Loading…
Reference in New Issue