RecoBonus.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Copyright (C) 2004-2014 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.model.entity;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. /**
  22. * @author Gnacik
  23. */
  24. public final class RecoBonus
  25. {
  26. private static final int[][] _recoBonus =
  27. {
  28. {
  29. 25,
  30. 50,
  31. 50,
  32. 50,
  33. 50,
  34. 50,
  35. 50,
  36. 50,
  37. 50,
  38. 50
  39. },
  40. {
  41. 16,
  42. 33,
  43. 50,
  44. 50,
  45. 50,
  46. 50,
  47. 50,
  48. 50,
  49. 50,
  50. 50
  51. },
  52. {
  53. 12,
  54. 25,
  55. 37,
  56. 50,
  57. 50,
  58. 50,
  59. 50,
  60. 50,
  61. 50,
  62. 50
  63. },
  64. {
  65. 10,
  66. 20,
  67. 30,
  68. 40,
  69. 50,
  70. 50,
  71. 50,
  72. 50,
  73. 50,
  74. 50
  75. },
  76. {
  77. 8,
  78. 16,
  79. 25,
  80. 33,
  81. 41,
  82. 50,
  83. 50,
  84. 50,
  85. 50,
  86. 50
  87. },
  88. {
  89. 7,
  90. 14,
  91. 21,
  92. 28,
  93. 35,
  94. 42,
  95. 50,
  96. 50,
  97. 50,
  98. 50
  99. },
  100. {
  101. 6,
  102. 12,
  103. 18,
  104. 25,
  105. 31,
  106. 37,
  107. 43,
  108. 50,
  109. 50,
  110. 50
  111. },
  112. {
  113. 5,
  114. 11,
  115. 16,
  116. 22,
  117. 27,
  118. 33,
  119. 38,
  120. 44,
  121. 50,
  122. 50
  123. },
  124. {
  125. 5,
  126. 10,
  127. 15,
  128. 20,
  129. 25,
  130. 30,
  131. 35,
  132. 40,
  133. 45,
  134. 50
  135. }
  136. };
  137. public static int getRecoBonus(L2PcInstance activeChar)
  138. {
  139. if ((activeChar != null) && activeChar.isOnline() && (activeChar.getRecomHave() != 0))
  140. {
  141. final int lvl = activeChar.getLevel() / 10;
  142. final int exp = (Math.min(100, activeChar.getRecomHave()) - 1) / 10;
  143. return _recoBonus[lvl][exp];
  144. }
  145. return 0;
  146. }
  147. public static double getRecoMultiplier(L2PcInstance activeChar)
  148. {
  149. double multiplier = 1.0;
  150. final double bonus = getRecoBonus(activeChar);
  151. if (bonus > 0)
  152. {
  153. multiplier += (bonus / 100);
  154. }
  155. return multiplier;
  156. }
  157. }