Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public float getMountSpeedPercent(boolean mounting)
- {
- float factor = 0.5F;
- if (getStatus().getHunger() < 45000) {
- factor += 0.2F;
- }
- if (getStatus().getHunger() < 10000) {
- factor += 0.1F;
- }
- if (getStatus().damage < 10000) {
- factor += 0.1F;
- } else if (getStatus().damage > 20000) {
- factor -= 0.5F;
- } else if (getStatus().damage > 45000) {
- factor -= 0.7F;
- }
- if (isHorse())
- {
- float hbonus = calcHorseShoeBonus(mounting);
- sendToLoggers("Horse shoe bonus " + hbonus + " so factor from " + factor + " to " + (factor + hbonus));
- factor += hbonus;
- }
- float tperc = getTraitMovePercent(mounting);
- sendToLoggers("Trait move percent= " + tperc + " so factor from " + factor + " to " + (factor + tperc));
- factor += tperc;
- if (isRidden())
- {
- Item torsoItem = getWornItem((byte)2);
- if (torsoItem != null) {
- if ((torsoItem.isSaddleLarge()) || (torsoItem.isSaddleNormal()))
- {
- factor += Math.max(10.0F, torsoItem.getCurrentQualityLevel()) / 1000.0F;
- factor += torsoItem.getRarity() * 0.03F;
- factor += torsoItem.getSpellSpeedBonus() / 2000.0F;
- if (!mounting) {
- torsoItem.setDamage(torsoItem.getDamage() + 0.001F);
- }
- }
- }
- sendToLoggers("After saddle move percent= " + factor);
- factor *= getMovementScheme().getSpeedModifier();
- sendToLoggers("After speedModifier " + getMovementScheme().getSpeedModifier() + " move percent= " + factor);
- }
- return factor;
- }
- private float calcHorseShoeBonus(boolean mounting)
- {
- float bonus = 0.0F;
- float leftFootB = 0.0F;
- float rightFootB = 0.0F;
- float leftHandB = 0.0F;
- float rightHandB = 0.0F;
- try
- {
- Item leftFoot = getEquippedItem((byte)15);
- leftFootB += Math.max(10.0F, leftFoot.getCurrentQualityLevel()) / 2000.0F;
- leftFootB += leftFoot.getSpellSpeedBonus() / 2000.0F;
- leftFootB += leftFoot.getRarity() * 0.03F;
- if (!mounting) {
- leftFoot.setDamage(leftFoot.getDamage() + 0.001F);
- }
- }
- catch (NoSpaceException nsp)
- {
- logger.log(Level.WARNING, getName() + " No left foot.");
- }
- catch (NoSuchItemException localNoSuchItemException) {}
- try
- {
- Item rightFoot = getEquippedItem((byte)16);
- rightFootB += Math.max(10.0F, rightFoot.getCurrentQualityLevel()) / 2000.0F;
- rightFootB += rightFoot.getSpellSpeedBonus() / 2000.0F;
- rightFootB += rightFoot.getRarity() * 0.03F;
- if (!mounting) {
- rightFoot.setDamage(rightFoot.getDamage() + 0.001F);
- }
- }
- catch (NoSpaceException nsp)
- {
- logger.log(Level.WARNING, getName() + " No left foot.");
- }
- catch (NoSuchItemException localNoSuchItemException1) {}
- try
- {
- Item rightHand = getEquippedItem((byte)14);
- rightHandB += Math.max(10.0F, rightHand.getCurrentQualityLevel()) / 2000.0F;
- rightHandB += rightHand.getSpellSpeedBonus() / 2000.0F;
- rightHandB += rightHand.getRarity() * 0.03F;
- if (!mounting) {
- rightHand.setDamage(rightHand.getDamage() + 0.001F);
- }
- }
- catch (NoSpaceException nsp)
- {
- logger.log(Level.WARNING, getName() + " No left foot.");
- }
- catch (NoSuchItemException localNoSuchItemException2) {}
- try
- {
- Item leftHand = getEquippedItem((byte)13);
- leftHandB += Math.max(10.0F, leftHand.getCurrentQualityLevel()) / 2000.0F;
- leftHandB += leftHand.getSpellSpeedBonus() / 2000.0F;
- leftHandB += leftHand.getRarity() * 0.03F;
- if (!mounting) {
- leftHand.setDamage(leftHand.getDamage() + 0.001F);
- }
- }
- catch (NoSpaceException nsp)
- {
- logger.log(Level.WARNING, getName() + " No left foot.");
- }
- catch (NoSuchItemException localNoSuchItemException3) {}
- bonus += leftHandB;
- bonus += rightHandB;
- bonus += leftFootB;
- bonus += rightFootB;
- return bonus;
- }
- private float getTraitMovePercent(boolean mounting)
- {
- float traitMod = 0.0F;
- Creature r = null;
- boolean moving = false;
- if ((isRidden()) && (getMountVehicle() != null)) {
- try
- {
- r = Server.getInstance().getCreature(getMountVehicle().pilotId);
- moving = r.isMoving();
- }
- catch (NoSuchCreatureException localNoSuchCreatureException) {}catch (NoSuchPlayerException localNoSuchPlayerException) {}
- }
- int cweight = getCarriedMountWeight();
- if ((!mounting) && (this.status.traits != 0L))
- {
- Skill sstrength = getSoulStrength();
- if (this.status.isTraitBitSet(1)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
- }
- else {
- traitMod += 0.1F;
- }
- }
- if (this.status.isTraitBitSet(4)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
- }
- else {
- traitMod += 0.2F;
- }
- }
- if (this.status.isTraitBitSet(8)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) >= 0.0D) {}
- }
- else {
- traitMod -= 0.1F;
- }
- }
- if (this.status.isTraitBitSet(9)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) >= 0.0D) {}
- }
- else {
- traitMod -= 0.3F;
- }
- }
- if (this.status.isTraitBitSet(6)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
- }
- else {
- traitMod += 0.1F;
- }
- }
- float wmod = 0.0F;
- if (this.status.isTraitBitSet(3)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
- }
- else {
- wmod += 10000.0F;
- }
- }
- if (this.status.isTraitBitSet(5)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
- }
- else {
- wmod += 20000.0F;
- }
- }
- if (this.status.isTraitBitSet(11)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) >= 0.0D) {}
- }
- else {
- wmod -= 30000.0F;
- }
- }
- if (this.status.isTraitBitSet(6)) {
- if (isHorse())
- {
- if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
- }
- else {
- wmod += 10000.0F;
- }
- }
- if (cweight > getStrengthSkill() * 5000.0D + wmod) {
- traitMod = (float)(traitMod - 0.15D * (cweight - getStrengthSkill() * 5000.0D - wmod) / 50000.0D);
- }
- }
- else if (cweight > getStrengthSkill() * 5000.0D)
- {
- traitMod = (float)(traitMod - 0.15D * (cweight - getStrengthSkill() * 5000.0D) / 50000.0D);
- }
- return traitMod;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement