Giter VIP home page Giter VIP logo

Comments (3)

ddialer avatar ddialer commented on August 25, 2024

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
before BattleReport.php:

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);

from opbe.

jstar88 avatar jstar88 commented on August 25, 2024

actually this is not a bug: only debris generated from the current battle can generate the moon.
By the way, in the GenerateReport.php (2moons) all debris are shown(also old one).
Same for XGP in calculateattack

from opbe.

jonamix-ar avatar jonamix-ar commented on August 25, 2024

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

from opbe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.