Eternal Power Calculator is a tool to assist the deckbuilding process for Dire Wolf Digital's Eternal CCG.
See https://www.direwolfdigital.com/eternal/ for more about Eternal.
Given a decklist, the power calculator will compute the probability of drawing the power and influence necessary to play cards from the deck in a particular number of cards drawn. It will generate an HTML table of the odds of drawing those cards for each of set of influence required by cards in the deck.
Eternal Power Calculator uses jQuery and Semantic-UI as a foundation. See the following for more information:
- jQuery -- https://jquery.com/
- Semantic-UI -- https://semantic-ui.com/
To use Eternal Power Calculator, see https://www.shiftstoned.com/epc/
Eternal Power Calculator contains the following Javascript code:
epc-deck.js
- Data structures relating to eternal cards and decksepc-graph.js
- Graph drawing routinesepc-polyfill.js
- Polyfill from external sources, for older web browsersepc-table.js
- Table generation routinesepc-test.js
- Tests for odds calculationepc-ui.js
- Top level user interface logic
Additional content:
index.html
- HTML shell for the power calculatorepc.css
- CSS style sheet forindex.html
jquery-1.12.4.min.js
- Standard jQuerysemantic.min.css
- Generated Semantic-UI CSSsemantic.min.js
- Generated Semantic-UI Javascript
To build epc for production, run dist.sh
. This script will minify the scripts and bundle everything needed for shipment into the /dist folder. To deploy to shiftstoned.com, see the instructions on the shiftstoned github page.
The build requires a few tools:
- perl
- bash
- uglify-js (if using npm,
npm install -g uglify-js@3.4
)
To find style mistakes and inconsistencies, we use eslint. For convenience, you can use lint.sh
to lint all files automatically. You will need eslint-plugin-jest
to lint the tests.
npm install -g eslint eslint-plugin-jest
./lint.sh
Tests use jest and puppeteer as well as jquery. Tests are not required for pull requests, but if you feel comfortable writing them, we appreciate it. To run the tests, you will need a basic http server to serve the static files (I use this one). Puppeteer will expect to find the site at http://localhost:8081. You will also need npm to install the other dependencies. Tests can take a while to run, around 30 seconds on this developer's machine.
Steps install http-server, jest, and puppeteer with npm:
npm install -g http-server
npm install
To start the http-server (in the epc directory). Test by opening localhost:8081 in your browser.
http-server -p 8081
To run the tests once:
npm test
To start a test server which automatically re-runs the tests when it detects changes:
npm run test:watch
build-semantic.sh
- You will problably not need to run this ever. It generates semantic.min.css and semantic.min.js.generate.sh
builds epc.min.js. Is used by dist.sh automatically.semantic.json
- Configuration for Semantic-UIsemantic-site.variables
- Build variables for Semantic-UI
Eternal Power Calculator is licensed under the GNU General Public License 2.0.