大闹天宫圣物重构
parent
fe9e0858e3
commit
98be53a50e
|
@ -120,7 +120,10 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
remainHp.add(checkResult[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//如果是第三层更新下圣物状态
|
||||
if(expeditionManager.getExpeditionLeve()>2){
|
||||
ExpeditionLogic.getInstance().thirdFight(user);
|
||||
}
|
||||
//更新节点状态 节点
|
||||
final int oldlay = nodeInfo.getLay();
|
||||
Set<String> ids = new HashSet<>();
|
||||
|
@ -182,14 +185,13 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
Expedition.EndExpeditionBattleResponse.Builder response = Expedition.EndExpeditionBattleResponse.newBuilder();
|
||||
response.setResult(resultCode);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.EXPEDITION_END_BATTLE_RESONSE_VALUE, response.build(), true);
|
||||
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.START_TIANGONG.getType(),user.getExpeditionManager().getExpeditionLeve(),oldlay-1,nodeInfo.getType(),"失败");
|
||||
|
||||
return;
|
||||
} else {
|
||||
|
||||
//胜利更新胜利圣物次数
|
||||
user.getExpeditionManager().victory();
|
||||
ExpeditionLogic.getInstance().victory(user);
|
||||
//节点血量更新
|
||||
nodeInfo.getSnapFightInfo().getHeroAttribute().forEach((s, familyHeroInfo) ->
|
||||
nodeInfo.getBossHP().put(s, 0d)
|
||||
|
|
|
@ -82,8 +82,8 @@ public class ReliveExpeditionHeroRequest extends BaseHandler<Expedition.ReliveEx
|
|||
// ids.add(hero.getId());
|
||||
// }
|
||||
//使用判官笔更新圣物次数
|
||||
expeditionManager.useJudgePen();
|
||||
|
||||
ExpeditionLogic.getInstance().useJudgePen(user);
|
||||
expeditionManager.getHeroHPWithChange().clear();
|
||||
expeditionManager.setReliveItemTime(expeditionManager.getReliveItemTime()+1);
|
||||
//更新节点
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.ljsd.jieling.handler.Expedition.expedtionItem;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionItem;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/4/12
|
||||
* @discribe
|
||||
*/
|
||||
public class DefaultExpedtionItemHandler implements ExpedtionItemHandler{
|
||||
|
||||
@Override
|
||||
public void victory(ExpeditionItem item){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void usejudgePen(ExpeditionItem item){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void thirdFight(ExpeditionItem item) {
|
||||
item.setThirdFloorFighted(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.ljsd.jieling.handler.Expedition.expedtionItem;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionItem;
|
||||
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/4/12
|
||||
* @discribe
|
||||
*/
|
||||
public interface ExpedtionItemHandler {
|
||||
|
||||
void victory(ExpeditionItem item);
|
||||
|
||||
void usejudgePen(ExpeditionItem item);
|
||||
|
||||
void thirdFight(ExpeditionItem item);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.ljsd.jieling.handler.Expedition.expedtionItem;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionItem;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/4/12
|
||||
* @discribe
|
||||
*/
|
||||
public class FiveCountVictoryHandler extends DefaultExpedtionItemHandler {
|
||||
|
||||
@Override
|
||||
public void victory(ExpeditionItem item) {
|
||||
if(item.getCountVictory()>=5){
|
||||
return;
|
||||
}
|
||||
item.setCountVictory(item.getCountVictory()+1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.handler.Expedition.expedtionItem;
|
||||
|
||||
import config.SExpeditionHolyConfig;
|
||||
import manager.STableManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/4/12
|
||||
* @discribe 需要特殊处理的圣物
|
||||
*/
|
||||
public enum HolyEnum {
|
||||
COMMON(0,new DefaultExpedtionItemHandler()),
|
||||
CHANG_SHENG_KAI(16,new SixCountVictoryHandler()),
|
||||
LI_ZHAN_JIAN(17,new FiveCountVictoryHandler()),
|
||||
FU_SU_YIN(43,new ThreeCountJudgePenHandler());
|
||||
|
||||
|
||||
private int effectType;
|
||||
private ExpedtionItemHandler handler;
|
||||
|
||||
private static Map<Integer,HolyEnum> holyEnumMapByEffect = new HashMap<>();
|
||||
private static Map<Integer,HolyEnum> holyEnumMapById = new HashMap<>();
|
||||
|
||||
static {
|
||||
//提前注册
|
||||
for (HolyEnum item:HolyEnum.values()) {
|
||||
holyEnumMapByEffect.put(item.getEffectType(),item);
|
||||
}
|
||||
Map<Integer, SExpeditionHolyConfig> config = STableManager.getConfig(SExpeditionHolyConfig.class);
|
||||
config.forEach((k,v)-> holyEnumMapById.put(k,holyEnumMapByEffect.getOrDefault(v.geteffect(),holyEnumMapByEffect.get(0))));
|
||||
|
||||
}
|
||||
|
||||
HolyEnum(int effectType,ExpedtionItemHandler handler){
|
||||
this.effectType = effectType;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public int getEffectType() {
|
||||
return effectType;
|
||||
}
|
||||
|
||||
public ExpedtionItemHandler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
public static ExpedtionItemHandler getOptionalHandler(int equipId){
|
||||
|
||||
return holyEnumMapById.get(equipId).getHandler();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ljsd.jieling.handler.Expedition.expedtionItem;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionItem;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/4/12
|
||||
* @discribe 长生铠,如果生效了5次之后要给前端传6过去,告诉其不能再出发回血
|
||||
*/
|
||||
public class SixCountVictoryHandler extends DefaultExpedtionItemHandler {
|
||||
@Override
|
||||
public void victory(ExpeditionItem item) {
|
||||
if(item.getCountVictory()>=6){
|
||||
return;
|
||||
}
|
||||
item.setCountVictory(item.getCountVictory()+1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ljsd.jieling.handler.Expedition.expedtionItem;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.ExpeditionItem;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2021/4/12
|
||||
* @discribe
|
||||
*/
|
||||
public class ThreeCountJudgePenHandler extends DefaultExpedtionItemHandler{
|
||||
@Override
|
||||
public void usejudgePen(ExpeditionItem item) {
|
||||
if(item.getJudgePen()>=3){
|
||||
return;
|
||||
}
|
||||
item.setJudgePen(item.getJudgePen()+1);
|
||||
}
|
||||
}
|
|
@ -36,6 +36,8 @@ public class ExpeditionItem extends MongoBase {
|
|||
|
||||
private int judgePen;
|
||||
|
||||
private boolean thirdFloorFighted;
|
||||
|
||||
public ExpeditionItem(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;
|
||||
|
@ -111,7 +113,6 @@ public class ExpeditionItem extends MongoBase {
|
|||
}
|
||||
|
||||
public void setSecondValueByIdMap(Map<Integer, Integer> secondValueByIdMap) {
|
||||
updateString("secondValueByIdMap",secondValueByIdMap);
|
||||
this.secondValueByIdMap = secondValueByIdMap;
|
||||
}
|
||||
|
||||
|
@ -120,7 +121,6 @@ public class ExpeditionItem extends MongoBase {
|
|||
}
|
||||
|
||||
public void setCreateTime(int createTime) {
|
||||
updateString("createTime", createTime);
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,6 @@ public class ExpeditionItem extends MongoBase {
|
|||
}
|
||||
|
||||
public void setSkill(int skill) {
|
||||
updateString("skill", skill);
|
||||
|
||||
this.skill = skill;
|
||||
}
|
||||
|
@ -155,24 +154,14 @@ public class ExpeditionItem extends MongoBase {
|
|||
}
|
||||
|
||||
public void updateIsLocked(int isLocked) {
|
||||
updateString("isLocked", isLocked);
|
||||
this.isLocked = isLocked;
|
||||
}
|
||||
|
||||
public void victory(){
|
||||
if(equipId == 16 || equipId == 17 || equipId == 53 || equipId == 54 ||
|
||||
equipId == 95 || equipId == 96){
|
||||
if(countVictory<5){
|
||||
countVictory++;
|
||||
}
|
||||
}
|
||||
public boolean isThirdFloorFighted() {
|
||||
return thirdFloorFighted;
|
||||
}
|
||||
|
||||
public void usejudgePen(){
|
||||
if(equipId == 79 || equipId == 120){
|
||||
if(judgePen<3){
|
||||
judgePen++;
|
||||
}
|
||||
}
|
||||
public void setThirdFloorFighted(boolean thirdFloorFighted) {
|
||||
this.thirdFloorFighted = thirdFloorFighted;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,6 +120,9 @@ public class ExpeditionManager extends MongoBase {
|
|||
updateString("propertyItems", this.propertyItems);
|
||||
|
||||
}
|
||||
public void updateAllPropertyItems() {
|
||||
updateString("propertyItems", this.propertyItems);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -279,18 +282,6 @@ public class ExpeditionManager extends MongoBase {
|
|||
this.getHolyTiem = getHolyTiem;
|
||||
}
|
||||
|
||||
public void victory(){
|
||||
for(ExpeditionItem propertyItem : propertyItems){
|
||||
propertyItem.victory();
|
||||
}
|
||||
}
|
||||
|
||||
public void useJudgePen(){
|
||||
for(ExpeditionItem propertyItem : propertyItems){
|
||||
propertyItem.usejudgePen();
|
||||
}
|
||||
}
|
||||
|
||||
public ExpeditionItem getExpeditionItem(int id){
|
||||
for(ExpeditionItem propertyItem : propertyItems){
|
||||
if(propertyItem.getEquipId() == id){
|
||||
|
|
|
@ -9,6 +9,8 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.Expedition.expedtionItem.ExpedtionItemHandler;
|
||||
import com.ljsd.jieling.handler.Expedition.expedtionItem.HolyEnum;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
@ -66,6 +68,11 @@ public class ExpeditionLogic {
|
|||
public static final int NODETYPE_GREED= 10;//贪婪节点
|
||||
public static final int NODETYPE_REWARD= 11;//奖励节点
|
||||
|
||||
|
||||
private static final int VICTORY = 1;
|
||||
private static final int USE_JUDGEPEN =2;
|
||||
private static final int THIRD_FIGHT = 3;
|
||||
|
||||
private ExpeditionLogic() {
|
||||
}
|
||||
|
||||
|
@ -858,10 +865,41 @@ public class ExpeditionLogic {
|
|||
}else if(oper == 3){
|
||||
int add = skillModify[i][3];
|
||||
skillSb.append(add).append("#");
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void victory(User user) {
|
||||
doOptional(user,VICTORY);
|
||||
}
|
||||
|
||||
public void useJudgePen(User user){
|
||||
doOptional(user,USE_JUDGEPEN);
|
||||
}
|
||||
|
||||
public void thirdFight(User user){
|
||||
doOptional(user,THIRD_FIGHT);
|
||||
}
|
||||
|
||||
private void doOptional(User user,int type){
|
||||
|
||||
for(ExpeditionItem propertyItem : user.getExpeditionManager().getPropertyItems()){
|
||||
int equipId = propertyItem.getEquipId();
|
||||
ExpedtionItemHandler optionalHandler = HolyEnum.getOptionalHandler(equipId);
|
||||
switch (type){
|
||||
case VICTORY:
|
||||
optionalHandler.victory(propertyItem);
|
||||
break;
|
||||
case USE_JUDGEPEN:
|
||||
optionalHandler.usejudgePen(propertyItem);
|
||||
break;
|
||||
case THIRD_FIGHT:
|
||||
optionalHandler.thirdFight(propertyItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
user.getExpeditionManager().updateAllPropertyItems();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,9 @@ public class ExpetionSpecialProcessor implements SpecialBuildProcessor{
|
|||
private final int HP_INCREASE = 16;
|
||||
private final int DAMAGE_INCREASE = 17;
|
||||
private final int HOLY_INCREASE = 35;
|
||||
private final int JUDGE_INCREASE = 43;
|
||||
private final int HOLY_UNKNOWN = 36;
|
||||
private final int HOLY_QUALITY = 37;
|
||||
private final int JUDGE_INCREASE = 43;
|
||||
@Override
|
||||
public String getSpecialParm(User user) {
|
||||
Map<Integer, SExpeditionHolyConfig> config = STableManager.getConfig(SExpeditionHolyConfig.class);
|
||||
|
@ -79,6 +80,15 @@ public class ExpetionSpecialProcessor implements SpecialBuildProcessor{
|
|||
ExpeditionItem item = expeditionManager.getExpeditionItem(con43.getId());
|
||||
result.append(item==null?0:item.getJudgePen());
|
||||
}
|
||||
SExpeditionHolyConfig con36 = expeditionManager.getEffectItems().get(HOLY_UNKNOWN);
|
||||
if(con36 != null&&user.getExpeditionManager().getExpeditionLeve()>2){
|
||||
if(result.length()>0){
|
||||
result.append("|");
|
||||
}
|
||||
result.append(con36.getPassiveSkillId()).append("#");
|
||||
ExpeditionItem item = expeditionManager.getExpeditionItem(con36.getId());
|
||||
result.append(item==null?0:(item.isThirdFloorFighted()?1:0));
|
||||
}
|
||||
SExpeditionHolyConfig con37 = expeditionManager.getEffectItems().get(HOLY_QUALITY);
|
||||
if(con37 != null){
|
||||
if(result.length()>0){
|
||||
|
|
Loading…
Reference in New Issue