助战英雄克隆修改

master_otnew
grimm 2024-01-05 14:38:29 +08:00
parent 27bf841cb6
commit f66cd81f54
3 changed files with 37 additions and 2 deletions

View File

@ -42,7 +42,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
private Set<String> jewelInfo = new HashSet<>();
private Set<String> faxiangList = new HashSet<>();
private int skin;
private Map<Integer,List<String>>godSoulBindMap=new HashMap<>();//神魂绑定英雄 神魂等级:<hero动态id>
private Map<Integer,List<String>> godSoulBindMap = new HashMap<>();//神魂绑定英雄 神魂等级:<hero动态id>
private int godSoulLv;
private int propertyId; // 阵营id人 佛 妖 道)
private Map<String,Integer> godSoulBeBindMap = new HashMap<>();//被神魂绑定英雄 英雄动态id:英雄神魂等级(反绑)
@ -155,6 +155,32 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
equipByPositionMap = new HashMap<>();
}
// 克隆
public Hero(User user, Hero hero) {
this.id = hero.getId();
this.templateId = hero.getTemplateId();
this.level = hero.getLevel(user);
this.star = hero.getStar();
this.bauBlesId = hero.getBauBlesId();
this.equipByPositionMap = new HashMap<>(hero.getEquipByPositionMap());
this.equipStrongMap = new HashMap<>(hero.getEquipStrongMap());
this.equipAdvanceLv = hero.getEquipAdvanceLv();
this.soulEquipByPositionMap = new HashMap<>(hero.getSoulEquipByPositionMap());
this.godSealByPositionMap = new HashMap<>(hero.getGodSealByPositionMap());
this.breakId = hero.getBreakId();
this.starBreakId = hero.getStarBreakId();
this.jewelInfo = new HashSet<>(hero.getJewelInfo());
this.faxiangList = new HashSet<>(hero.getFaxiangList());
this.skin = hero.getSkin();
this.godSoulBindMap = new HashMap<>(hero.getGodSoulBindMap());
this.godSoulLv = hero.getGodSoulLv();
this.propertyId = hero.getPropertyId();
this.godSoulBeBindMap = new HashMap<>(hero.getGodSoulBeBindMap());
this.heroGiftEquipList = new HashSet<>(hero.getHeroGiftEquipList());
this.potentialUpLvMap = new HashMap<>(hero.getPotentialUpLvMap());
this.training = new Training(hero.getTraining());
}
public void upStar(int upStar) {
this.star += upStar;
updateString("star", star);

View File

@ -23,6 +23,15 @@ public class Training extends MongoBase {
this.lv = 1;
}
public Training(Training training) {
this.isTraining = training.getIsTraining();
this.lv = training.getLv();
this.attackExp = training.getAttackExp();
this.defenseExp = training.getDefenseExp();
this.hpExp = training.getHpExp();
this.skillUnlockIds = new HashSet<>(training.getSkillUnlockIds());
}
public int getIsTraining() {
return isTraining;
}

View File

@ -286,7 +286,7 @@ public class CBean2Proto {
HelpTypeEnum type = HelpTypeEnum.getType(hero.getPropertyId());
// 英雄镜像
EquipManager equipManager = user.getEquipManager();
Hero clone = hero.clone();
Hero clone = new Hero(user, hero);
// 魂宝灵宝镜像
List<PropertyItem> jewels = buildPropertyItemList(equipManager, clone.getJewelInfo());
// 法相