back_recharge
duhui 2023-02-17 13:24:02 +08:00
parent c7812f4c4b
commit 639a6e92f6
2 changed files with 30 additions and 32 deletions

View File

@ -54,13 +54,14 @@ public class EquipLogic {
throw new ErrorCodeException(ErrorCode.CFG_NULL,"法相配置表不存在,或未进入版本:"+faxiang.getItemId()); throw new ErrorCodeException(ErrorCode.CFG_NULL,"法相配置表不存在,或未进入版本:"+faxiang.getItemId());
} }
// 穿戴 // 穿戴
if (action == 1){ if (action == 1 || action == 3){
Set<String> faxiangList = hero.getFaxiangList(); Set<String> faxiangList = hero.getFaxiangList();
if (faxiangList.contains(faxiangID)){ if (faxiangList.contains(faxiangID)){
LOGGER.error("法相已装备hero:{}, faxiang:{}",heroID,faxiangID); LOGGER.error("法相已装备hero:{}, faxiang:{}",heroID,faxiangID);
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"法相已装备"); throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"法相已装备");
} }
// 检测是否装备同类型的法相 // 检测是否装备同类型的法相
String removeId = null;
for (String faxiangId : faxiangList) { for (String faxiangId : faxiangList) {
Faxiang faxiang1 = equipManager.getFaxiang(faxiangId); Faxiang faxiang1 = equipManager.getFaxiang(faxiangId);
if (faxiang1 == null){ if (faxiang1 == null){
@ -71,11 +72,15 @@ public class EquipLogic {
SFaxiangConfig faxiangConfig1 = faxiangMap.get(faxiang1.getItemId()); SFaxiangConfig faxiangConfig1 = faxiangMap.get(faxiang1.getItemId());
if (faxiangConfig1 == null){ if (faxiangConfig1 == null){
hero.uninstallFaxiang(faxiangId); hero.uninstallFaxiang(faxiangId);
LOGGER.error("法相不存在装备库已卸载uid:{}, hero:{}, faxiang:{}",user.getId(),heroID,faxiangID); LOGGER.error("法相不存在配置表已卸载uid:{}, hero:{}, faxiang:{}",user.getId(),heroID,faxiangID);
continue; continue;
} }
if (faxiangConfig.getType() == faxiangConfig1.getType()){ if (faxiangConfig.getType() == faxiangConfig1.getType()){
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"法相已装备同类型的法相"); if (action == 3 && removeId == null){
removeId = faxiang1.getId();
}else {
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"法相已装备同类型的法相");
}
} }
} }
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId()); SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
@ -91,6 +96,9 @@ public class EquipLogic {
} }
hero.addFaxiang(faxiangID); hero.addFaxiang(faxiangID);
if (removeId != null){
hero.uninstallFaxiang(removeId);
}
} }
// 脱下 // 脱下
if (action == 2){ if (action == 2){

View File

@ -80,9 +80,9 @@ public class HeroLogic {
public static List<Integer> transTemplate = new ArrayList<>(); public static List<Integer> transTemplate = new ArrayList<>();
public static List<Integer> equipSkillPositionTemaplge = new ArrayList<>(6); public static List<Integer> equipSkillPositionTemaplge = new ArrayList<>(6);
private static Map<Integer, List<Integer>> transTemplateByHeroPropertyName = new HashMap<>(); private static final Map<Integer, List<Integer>> transTemplateByHeroPropertyName = new HashMap<>();
private static List<Integer> pokemonTemplate = new ArrayList<>(); private static final List<Integer> pokemonTemplate = new ArrayList<>();
static { static {
transTemplate.add(HeroAttributeEnum.CurHP.getPropertyId()); // 生命 transTemplate.add(HeroAttributeEnum.CurHP.getPropertyId()); // 生命
@ -294,9 +294,7 @@ public class HeroLogic {
boolean enoughCost = false; boolean enoughCost = false;
for (int[] cost : sLotterySetting.getCostItem()) { for (int[] cost : sLotterySetting.getCostItem()) {
int[] costItem = new int[cost.length]; int[] costItem = new int[cost.length];
for (int i = 0; i < cost.length; i++) { System.arraycopy(cost, 0, costItem, 0, cost.length);
costItem[i] = cost[i];
}
int[][] costItems = new int[][]{costItem}; int[][] costItems = new int[][]{costItem};
if (costItems[0][0] == Global.GEM) { if (costItems[0][0] == Global.GEM) {
//每日妖精抽取次数 //每日妖精抽取次数
@ -444,9 +442,7 @@ public class HeroLogic {
//记录卡池抽奖次数 //记录卡池抽奖次数
heroManager.putRandomType(type, num + result[1]); heroManager.putRandomType(type, num + result[1]);
int[]rewardArr=new int[result.length]; int[]rewardArr=new int[result.length];
for (int i = 0; i < result.length; i++) { System.arraycopy(result, 0, rewardArr, 0, result.length);
rewardArr[i]=result[i];
}
return rewardArr; return rewardArr;
} }
@ -463,7 +459,7 @@ public class HeroLogic {
return sLotteryRewardConfig.getReward(); return sLotteryRewardConfig.getReward();
} }
if (user.getHeroManager().getBeautyBagCardInfoMap().containsKey(index + 1) == false) { if (!user.getHeroManager().getBeautyBagCardInfoMap().containsKey(index + 1)) {
return sLotteryRewardConfig.getReward(); return sLotteryRewardConfig.getReward();
} }
int[] result = new int[2]; int[] result = new int[2];
@ -588,7 +584,7 @@ public class HeroLogic {
return item; return item;
} }
int randomInt = MathUtils.randomInt(weight); int randomInt = MathUtils.randomInt(weight);
LOGGER.error("*************************************心愿抽奖权重,总权重:{},随机值:{},map:{}", weight, randomInt, map.toString()); LOGGER.error("*************************************心愿抽奖权重,总权重:{},随机值:{},map:{}", weight, randomInt, map);
// 遍历权重 // 遍历权重
for (Map.Entry<Integer, Integer> entry : map.entrySet()) { for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
if (randomInt <= entry.getValue()) { if (randomInt <= entry.getValue()) {
@ -1708,10 +1704,7 @@ public class HeroLogic {
hongmengLevel = heroList.get(heroList.size()-1).getOriginalLevel(); hongmengLevel = heroList.get(heroList.size()-1).getOriginalLevel();
} }
// 验证等级 // 验证等级
if (hongmengLevel >= rankUp.getLimitHongmengLevel()){ return hongmengLevel >= rankUp.getLimitHongmengLevel();
return true;
}
return false;
} }
/** /**
@ -3118,7 +3111,7 @@ public class HeroLogic {
SFaxiangLevelConfig levelConfig = SFaxiangLevelConfig.poolMap.get(config.getLevelUpPool()).get(faxiang.getStrongLv()); SFaxiangLevelConfig levelConfig = SFaxiangLevelConfig.poolMap.get(config.getLevelUpPool()).get(faxiang.getStrongLv());
SFaxiangStarConfig starConfig = SFaxiangStarConfig.poolMap.get(config.getStar()).get(faxiang.getStar()); SFaxiangStarConfig starConfig = SFaxiangStarConfig.poolMap.get(config.getStar()).get(faxiang.getStar());
int[][] levelPara = levelConfig.getLevelPara(); int[][] levelPara = levelConfig.getLevelPara();
int[][] property = new int[levelPara.length][]; int[][] property = new int[levelPara.length][2];
for (int i = 0; i < levelPara.length; i++) { for (int i = 0; i < levelPara.length; i++) {
int[] alone = levelPara[i]; int[] alone = levelPara[i];
property[i][0] = alone[0]; property[i][0] = alone[0];
@ -3973,7 +3966,6 @@ public class HeroLogic {
it.remove(); it.remove();
needUpdate = true; needUpdate = true;
} }
;
if (needUpdate) { if (needUpdate) {
user.getTeamPosManager().updateTeamPosByTeamId(entry.getKey(), value); user.getTeamPosManager().updateTeamPosByTeamId(entry.getKey(), value);
} }
@ -5064,7 +5056,7 @@ public class HeroLogic {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
} }
int[][] consume = sSpiritAnimalLevel.getConsume(); int[][] consume = sSpiritAnimalLevel.getConsume();
if (consume != null && consume.length > 0) { if (consume != null) {
for (int[] consumeOne : consume) { for (int[] consumeOne : consume) {
costMap.put(consumeOne[0], costMap.getOrDefault(consumeOne[0], 0) + consumeOne[1]); costMap.put(consumeOne[0], costMap.getOrDefault(consumeOne[0], 0) + consumeOne[1]);
} }
@ -5072,7 +5064,7 @@ public class HeroLogic {
boolean b = ItemUtil.checkCost(user, costMap); boolean b = ItemUtil.checkCost(user, costMap);
if (!b) { if (!b) {
//把多的这一次减下去 //把多的这一次减下去
if (consume != null && consume.length > 0) { if (consume != null) {
for (int[] consumeOne : consume) { for (int[] consumeOne : consume) {
costMap.put(consumeOne[0], costMap.getOrDefault(consumeOne[0], 0) - consumeOne[1]); costMap.put(consumeOne[0], costMap.getOrDefault(consumeOne[0], 0) - consumeOne[1]);
} }
@ -5936,11 +5928,11 @@ public class HeroLogic {
LOGGER.info("addHongmengTableHero uid=>{} no the heroId=>{}", user.getId(), heroId); LOGGER.info("addHongmengTableHero uid=>{} no the heroId=>{}", user.getId(), heroId);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
} }
if (heroManager.getHongmengGuards().values().contains(heroId)) { if (heroManager.getHongmengGuards().containsValue(heroId)) {
LOGGER.info("addHongmengTableHero uid=>{} the heroId=>{} is HongmengGuard", user.getId(), heroId); LOGGER.info("addHongmengTableHero uid=>{} the heroId=>{} is HongmengGuard", user.getId(), heroId);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
} }
if (heroManager.getResonances().values().contains(heroId)) { if (heroManager.getResonances().containsValue(heroId)) {
LOGGER.info("addHongmengTableHero uid=>{} the heroId=>{} is Resonances", user.getId(), heroId); LOGGER.info("addHongmengTableHero uid=>{} the heroId=>{} is Resonances", user.getId(), heroId);
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
} }
@ -6035,15 +6027,15 @@ public class HeroLogic {
continue; continue;
} }
// 鸿蒙守卫 // 鸿蒙守卫
if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().values().contains(heroId[i])) { if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().containsValue(heroId[i])) {
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_GUARD_LIMIT); value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_GUARD_LIMIT);
} }
// 鸿蒙使者 // 鸿蒙使者
if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().values().contains(heroId[i])) { if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().containsValue(heroId[i])) {
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_MESSENGER_LIMIT); value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_MESSENGER_LIMIT);
} }
// 共鸣神将 // 共鸣神将
if (heroManager.getResonances().values().contains(heroId[i])) { if (heroManager.getResonances().containsValue(heroId[i])) {
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_TAKE_LIMIT); value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_TAKE_LIMIT);
} }
if (value == null) { if (value == null) {
@ -6058,7 +6050,7 @@ public class HeroLogic {
} }
} }
} }
boolean contains = heroMap.values().contains(false); boolean contains = heroMap.containsValue(false);
return !contains; return !contains;
} }
@ -6523,7 +6515,7 @@ public class HeroLogic {
// 角色初始被动 // 角色初始被动
int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig(); int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
if (skillLogicConfig != null && skillLogicConfig.length > 0){ if (skillLogicConfig != null){
for (int skill : skillLogicConfig) { for (int skill : skillLogicConfig) {
skillList.add(skill); skillList.add(skill);
} }
@ -6585,7 +6577,7 @@ public class HeroLogic {
// 角色初始被动 // 角色初始被动
int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig(); int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
if (skillLogicConfig != null && skillLogicConfig.length > 0){ if (skillLogicConfig != null){
for (int skill : skillLogicConfig) { for (int skill : skillLogicConfig) {
skillList.add(skill); skillList.add(skill);
} }
@ -6829,9 +6821,7 @@ public class HeroLogic {
int[][] result = new int[tier][2]; int[][] result = new int[tier][2];
// 两层循环,根据解锁的条数重新赋值到新的二维数组 // 两层循环,根据解锁的条数重新赋值到新的二维数组
for (int i = 0; i < tier; i++) { for (int i = 0; i < tier; i++) {
for (int j = 0; j < property[i].length; j++) { System.arraycopy(property[i], 0, result[i], 0, property[i].length);
result[i][j] = property[i][j];
}
} }
// 返回 // 返回
return result; return result;