Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.04 KB | None | 0 0
  1. public float getMountSpeedPercent(boolean mounting)
  2. {
  3. float factor = 0.5F;
  4. if (getStatus().getHunger() < 45000) {
  5. factor += 0.2F;
  6. }
  7. if (getStatus().getHunger() < 10000) {
  8. factor += 0.1F;
  9. }
  10. if (getStatus().damage < 10000) {
  11. factor += 0.1F;
  12. } else if (getStatus().damage > 20000) {
  13. factor -= 0.5F;
  14. } else if (getStatus().damage > 45000) {
  15. factor -= 0.7F;
  16. }
  17. if (isHorse())
  18. {
  19. float hbonus = calcHorseShoeBonus(mounting);
  20. sendToLoggers("Horse shoe bonus " + hbonus + " so factor from " + factor + " to " + (factor + hbonus));
  21. factor += hbonus;
  22. }
  23. float tperc = getTraitMovePercent(mounting);
  24.  
  25. sendToLoggers("Trait move percent= " + tperc + " so factor from " + factor + " to " + (factor + tperc));
  26. factor += tperc;
  27. if (isRidden())
  28. {
  29. Item torsoItem = getWornItem((byte)2);
  30. if (torsoItem != null) {
  31. if ((torsoItem.isSaddleLarge()) || (torsoItem.isSaddleNormal()))
  32. {
  33. factor += Math.max(10.0F, torsoItem.getCurrentQualityLevel()) / 1000.0F;
  34. factor += torsoItem.getRarity() * 0.03F;
  35. factor += torsoItem.getSpellSpeedBonus() / 2000.0F;
  36. if (!mounting) {
  37. torsoItem.setDamage(torsoItem.getDamage() + 0.001F);
  38. }
  39. }
  40. }
  41. sendToLoggers("After saddle move percent= " + factor);
  42. factor *= getMovementScheme().getSpeedModifier();
  43. sendToLoggers("After speedModifier " + getMovementScheme().getSpeedModifier() + " move percent= " + factor);
  44. }
  45. return factor;
  46. }
  47.  
  48.  
  49. private float calcHorseShoeBonus(boolean mounting)
  50. {
  51. float bonus = 0.0F;
  52. float leftFootB = 0.0F;
  53. float rightFootB = 0.0F;
  54. float leftHandB = 0.0F;
  55. float rightHandB = 0.0F;
  56. try
  57. {
  58. Item leftFoot = getEquippedItem((byte)15);
  59. leftFootB += Math.max(10.0F, leftFoot.getCurrentQualityLevel()) / 2000.0F;
  60. leftFootB += leftFoot.getSpellSpeedBonus() / 2000.0F;
  61. leftFootB += leftFoot.getRarity() * 0.03F;
  62. if (!mounting) {
  63. leftFoot.setDamage(leftFoot.getDamage() + 0.001F);
  64. }
  65. }
  66. catch (NoSpaceException nsp)
  67. {
  68. logger.log(Level.WARNING, getName() + " No left foot.");
  69. }
  70. catch (NoSuchItemException localNoSuchItemException) {}
  71. try
  72. {
  73. Item rightFoot = getEquippedItem((byte)16);
  74. rightFootB += Math.max(10.0F, rightFoot.getCurrentQualityLevel()) / 2000.0F;
  75. rightFootB += rightFoot.getSpellSpeedBonus() / 2000.0F;
  76. rightFootB += rightFoot.getRarity() * 0.03F;
  77. if (!mounting) {
  78. rightFoot.setDamage(rightFoot.getDamage() + 0.001F);
  79. }
  80. }
  81. catch (NoSpaceException nsp)
  82. {
  83. logger.log(Level.WARNING, getName() + " No left foot.");
  84. }
  85. catch (NoSuchItemException localNoSuchItemException1) {}
  86. try
  87. {
  88. Item rightHand = getEquippedItem((byte)14);
  89. rightHandB += Math.max(10.0F, rightHand.getCurrentQualityLevel()) / 2000.0F;
  90. rightHandB += rightHand.getSpellSpeedBonus() / 2000.0F;
  91. rightHandB += rightHand.getRarity() * 0.03F;
  92. if (!mounting) {
  93. rightHand.setDamage(rightHand.getDamage() + 0.001F);
  94. }
  95. }
  96. catch (NoSpaceException nsp)
  97. {
  98. logger.log(Level.WARNING, getName() + " No left foot.");
  99. }
  100. catch (NoSuchItemException localNoSuchItemException2) {}
  101. try
  102. {
  103. Item leftHand = getEquippedItem((byte)13);
  104. leftHandB += Math.max(10.0F, leftHand.getCurrentQualityLevel()) / 2000.0F;
  105. leftHandB += leftHand.getSpellSpeedBonus() / 2000.0F;
  106. leftHandB += leftHand.getRarity() * 0.03F;
  107. if (!mounting) {
  108. leftHand.setDamage(leftHand.getDamage() + 0.001F);
  109. }
  110. }
  111. catch (NoSpaceException nsp)
  112. {
  113. logger.log(Level.WARNING, getName() + " No left foot.");
  114. }
  115. catch (NoSuchItemException localNoSuchItemException3) {}
  116. bonus += leftHandB;
  117. bonus += rightHandB;
  118. bonus += leftFootB;
  119. bonus += rightFootB;
  120.  
  121. return bonus;
  122. }
  123.  
  124. private float getTraitMovePercent(boolean mounting)
  125. {
  126. float traitMod = 0.0F;
  127. Creature r = null;
  128. boolean moving = false;
  129. if ((isRidden()) && (getMountVehicle() != null)) {
  130. try
  131. {
  132. r = Server.getInstance().getCreature(getMountVehicle().pilotId);
  133. moving = r.isMoving();
  134. }
  135. catch (NoSuchCreatureException localNoSuchCreatureException) {}catch (NoSuchPlayerException localNoSuchPlayerException) {}
  136. }
  137. int cweight = getCarriedMountWeight();
  138. if ((!mounting) && (this.status.traits != 0L))
  139. {
  140. Skill sstrength = getSoulStrength();
  141. if (this.status.isTraitBitSet(1)) {
  142. if (isHorse())
  143. {
  144. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
  145. }
  146. else {
  147. traitMod += 0.1F;
  148. }
  149. }
  150. if (this.status.isTraitBitSet(4)) {
  151. if (isHorse())
  152. {
  153. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
  154. }
  155. else {
  156. traitMod += 0.2F;
  157. }
  158. }
  159. if (this.status.isTraitBitSet(8)) {
  160. if (isHorse())
  161. {
  162. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) >= 0.0D) {}
  163. }
  164. else {
  165. traitMod -= 0.1F;
  166. }
  167. }
  168. if (this.status.isTraitBitSet(9)) {
  169. if (isHorse())
  170. {
  171. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) >= 0.0D) {}
  172. }
  173. else {
  174. traitMod -= 0.3F;
  175. }
  176. }
  177. if (this.status.isTraitBitSet(6)) {
  178. if (isHorse())
  179. {
  180. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
  181. }
  182. else {
  183. traitMod += 0.1F;
  184. }
  185. }
  186. float wmod = 0.0F;
  187. if (this.status.isTraitBitSet(3)) {
  188. if (isHorse())
  189. {
  190. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
  191. }
  192. else {
  193. wmod += 10000.0F;
  194. }
  195. }
  196. if (this.status.isTraitBitSet(5)) {
  197. if (isHorse())
  198. {
  199. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
  200. }
  201. else {
  202. wmod += 20000.0F;
  203. }
  204. }
  205. if (this.status.isTraitBitSet(11)) {
  206. if (isHorse())
  207. {
  208. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) >= 0.0D) {}
  209. }
  210. else {
  211. wmod -= 30000.0F;
  212. }
  213. }
  214. if (this.status.isTraitBitSet(6)) {
  215. if (isHorse())
  216. {
  217. if (sstrength.skillCheck(20.0D, 0.0D, !moving, 1.0F) <= 0.0D) {}
  218. }
  219. else {
  220. wmod += 10000.0F;
  221. }
  222. }
  223. if (cweight > getStrengthSkill() * 5000.0D + wmod) {
  224. traitMod = (float)(traitMod - 0.15D * (cweight - getStrengthSkill() * 5000.0D - wmod) / 50000.0D);
  225. }
  226. }
  227. else if (cweight > getStrengthSkill() * 5000.0D)
  228. {
  229. traitMod = (float)(traitMod - 0.15D * (cweight - getStrengthSkill() * 5000.0D) / 50000.0D);
  230. }
  231. return traitMod;
  232. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement