Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add option all_ships_must_survive

  • Loading branch information...
commit baa69f410decf7541b296c78f68c03d42ffb8446 1 parent 2340f73
Benjamin C Meyer authored

Showing 2 changed files with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 0  README
  2. +5 1 index.js
2  README
@@ -32,6 +32,8 @@ max_ships - When battling battle this number of ships against the offense (de
32 32 max_tries - The number of battles to run to determine the % of win's
33 33 offense - The opposing team, by default it is [ancient], but it can be set to anything, such as [ancient, ancient] or [gcds]
34 34
  35 +all_ships_must_survive - True by default this says that you only 'win' a battle if you have no losses. Useful for comparing for example the different class sizes against each other. Set to false if you want to get the results for any outcome that would cause a win. This option only matters if max_ships is greater than 1.
  36 +
35 37 To disable a specific part (For example if it hasn't been drawn in your game yet or you just don't want it to be included) set the available flag to false in the parts listing.
36 38
37 39 $ parts['plasm missile'].available = false;
6 index.js
@@ -286,7 +286,10 @@ function execBattle(ships) {
286 286 countUp();
287 287 } while (ac > 0 && bc > 0);
288 288 //console.log((ac > 0 ? 'a' : 'b') + ' won');
289   - return bc > 0 && bc === initialbc;
  289 + if (all_ships_must_survive === true)
  290 + return bc > 0 && bc === initialbc;
  291 + else
  292 + return bc > 0;
290 293 }
291 294
292 295 function battle(playerA, playerB) {
@@ -476,3 +479,4 @@ var max_tries = 200;
476 479 var max_research = 1;
477 480 var max_cost = 10;
478 481 var max_ships = 1;
  482 +var all_ships_must_survive = true;

0 comments on commit baa69f4

Please sign in to comment.
Something went wrong with that request. Please try again.