コード例 #1
0
 public function getNeedExpForNextLevel(Player $player)
 {
     $cl = $player->getCharParameters()->getLevel();
     if ($cl < 11) {
         $needExp = 40 * pow($cl, 2) + 360 * $cl;
     } elseif ($cl >= 11 and $cl < 30) {
         $needExp = -0.4 * pow($cl, 3) + 40.4 * pow($cl, 2) + 396 * $cl;
     } elseif ($cl >= 30 and $cl < 60) {
         //(65x 2 - 165x - 6750) × 0,82
         $needExp = (65 * pow($cl, 2) - 165 * $cl - 6750) * 0.82;
     } elseif ($cl >= 61 and $cl < 69) {
         //580 + (5 × CL)
         //155 + MXP (CL) х (1344 - ((69-CL) * (3 + (69-CL) * 4)))
         $needExp = 155 + 580 + 5 * $cl * (1344 - (69 - $cl) * (3 + (69 - $cl) * 4));
     } elseif ($cl >= 70 and $cl < 80) {
         //580 + (5 × CL)
         //155 + MXP (CL) х (1344 - ((69-CL) * (3 + (69-CL) * 4)))
         $needExp = 155 + 1878 + 5 * $cl * (1990 - (89 - $cl) * (3 + (89 - $cl) * 5));
     } elseif ($cl >= 80 and $cl < 100) {
         //155 + 3517 + (5*83)*(3820-((99-83)*(3+(99-83)*5)))
         $needExp = 155 + 3517 + 5 * $cl * (3829 - (100 - $cl) * (3 + (100 - $cl) * 5));
     } else {
         $needExp = 155 + 3517 + 5 * $cl * (3829 - (100 - $cl) * (3 + (100 - $cl) * 5));
     }
     return $needExp;
 }
コード例 #2
0
 /**
  * @param Player $object
  * @return mixed
  */
 public function calculate($object)
 {
     $stats = $object->getStats();
     $charParameters = $object->getCharParameters();
     $warParameters = $object->getWar();
     $maxLife = ($stats->getEndurance() + $stats->getStrenge()) * 10 + 10 * $charParameters->getLevel();
     $maxMana = $stats->getIntelligence() * 10 + 10 * $charParameters->getLevel();
     $charParameters->setMaxLife($maxLife);
     $charParameters->setMaxMana($maxMana);
     if ($charParameters->getLife() === null) {
         $charParameters->setLife($charParameters->getMaxLife());
     }
     if ($charParameters->getMana() === null) {
         $charParameters->setMana($charParameters->getMaxMana());
     }
     $object->setCharParameters($charParameters);
 }