-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tryMoon #17
Comments
Here how I solve it for now, but will be better if you create player with HomeWorld to specify debris that already floats around and then using it to calculate moon chance public function tryMoon()
{
$prob = $this->getMoonProb();
return Math::tryEvent($prob, 'Events::event_moon', $prob);
}
public function getMoonProb()
{
return min(round(array_sum($this->getDebris()) / MOON_UNIT_PROB), MAX_MOON_PROB);
}
public function getDebris()
{
$aDebris = $this->getAttackerDebris();
$dDebris = $this->getDefenderDebris();
return array($aDebris[0] + $dDebris[0], $aDebris[1] + $dDebris[1]);
} after: public function tryMoon($metal = 0, $crystal = 0)
{
$prob = $this->getMoonProb($metal, $crystal);
return Math::tryEvent($prob, 'Events::event_moon', $prob);
}
public function getMoonProb($metal = 0, $crystal = 0)
{
return min(round(array_sum($this->getDebris($metal, $crystal)) / MOON_UNIT_PROB), MAX_MOON_PROB);
}
public function getDebris($metal = 0, $crystal = 0)
{
$aDebris = $this->getAttackerDebris();
$dDebris = $this->getDefenderDebris();
return array($aDebris[0] + $dDebris[0] + $metal, $aDebris[1] + $dDebris[1] + $crystal);
} usage: $report->tryMoon($metalFloatingArroundPlanet, $crystalFloatingArroundPlanet); |
actually this is not a bug: only debris generated from the current battle can generate the moon. |
Jstar Hi sorry would spend the core of the new version 1.0.1 of OGP ye tried to implement yours battle engine this version and let me know if PODES test to see if the install well the file that touch is the missions / attack.php From already thank you very much I leave the link of the core https://mega.co.nz/#!vNJ2DayQ!H168OMQ9k4zAAjcEbdN1oH_kBqEkhAYxtd-BmrSP708 |
looks like tryMoon event doesn't count resources that already floating around the planet and trying to use resources that was left only from current battle
The text was updated successfully, but these errors were encountered: