public SoldierAttribute(StaticSoldier staticSoldier) { soldierMobility = staticSoldier.getMobility(); this.soldierAttack = staticSoldier.getSoldierAttack(); this.soldierDefence = staticSoldier.getSoldierDefence(); this.soldierCriticalStrike = (double) staticSoldier.getSoldierCritical() / Const.CHANGE_PERCENT_TO_VALUE; this.soldierHit = (double) staticSoldier.getSoldierHit() / Const.CHANGE_PERCENT_TO_VALUE; this.soldierDodge = (double) staticSoldier.getSoldierDodge() / Const.CHANGE_PERCENT_TO_VALUE; this.soldierHp = staticSoldier.getSoldierHp(); }
public SoldierAttribute( StaticSoldier staticSoldier, List<String> soldierSkillStrings, int soldierType) { soldierMobility = staticSoldier.getMobility(); this.soldierAttack = staticSoldier.getSoldierAttack(); this.soldierDefence = staticSoldier.getSoldierDefence(); this.soldierCriticalStrike = (double) staticSoldier.getSoldierCritical() / Const.CHANGE_PERCENT_TO_VALUE; this.soldierHit = (double) staticSoldier.getSoldierHit() / Const.CHANGE_PERCENT_TO_VALUE; this.soldierDodge = (double) staticSoldier.getSoldierDodge() / Const.CHANGE_PERCENT_TO_VALUE; this.soldierHp = staticSoldier.getSoldierHp(); // 添加科技影响 for (String j : soldierSkillStrings) { StaticSoldierTech staticSoldierTech = SoldierTechCache.getTech(j); if (staticSoldierTech.getSoldierType() == soldierType) { // 添加科技影响 if (staticSoldierTech.getAddSkill() != null && !staticSoldierTech.getAddSkill().equals("")) { // 如果是被动技能,添加 staticSoldierSkill = SoldierSkillCache.getStaticSoldierSkill(staticSoldierTech.getAddSkill()); } else if (staticSoldierTech.getValueMode() == 2) { // 不是被动技能,添加属性影响 soldierAttack *= (1 + staticSoldierTech.getAddAtk() / Const.CHANGE_PERCENT_TO_VALUE); soldierDefence *= (1 + staticSoldierTech.getAddDef() / Const.CHANGE_PERCENT_TO_VALUE); soldierCriticalStrike *= (1 + staticSoldierTech.getAddCrt() / Const.CHANGE_PERCENT_TO_VALUE); soldierDodge *= (1 + staticSoldierTech.getAddDodge() / Const.CHANGE_PERCENT_TO_VALUE); soldierHit *= (1 + staticSoldierTech.getAddHit() / Const.CHANGE_PERCENT_TO_VALUE); soldierHp *= (1 + staticSoldierTech.getAddHealth() / Const.CHANGE_PERCENT_TO_VALUE); } else if (staticSoldierTech.getValueMode() == 1) { soldierAttack += staticSoldierTech.getAddAtk(); soldierDefence += staticSoldierTech.getAddDef(); soldierCriticalStrike += staticSoldierTech.getAddCrt() / Const.CHANGE_PERCENT_TO_VALUE; soldierDodge += staticSoldierTech.getAddDodge() / Const.CHANGE_PERCENT_TO_VALUE; soldierHit += staticSoldierTech.getAddHit() / Const.CHANGE_PERCENT_TO_VALUE; soldierHp += staticSoldierTech.getAddHealth(); } } } }