Permalink
Browse files

Add option all_ships_must_survive

  • Loading branch information...
1 parent 2340f73 commit baa69f410decf7541b296c78f68c03d42ffb8446 @icefox committed Aug 19, 2012
Showing with 7 additions and 1 deletion.
  1. +2 −0 README
  2. +5 −1 index.js
View
2 README
@@ -32,6 +32,8 @@ max_ships - When battling battle this number of ships against the offense (de
max_tries - The number of battles to run to determine the % of win's
offense - The opposing team, by default it is [ancient], but it can be set to anything, such as [ancient, ancient] or [gcds]
+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.
+
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.
$ parts['plasm missile'].available = false;
View
6 index.js
@@ -286,7 +286,10 @@ function execBattle(ships) {
countUp();
} while (ac > 0 && bc > 0);
//console.log((ac > 0 ? 'a' : 'b') + ' won');
- return bc > 0 && bc === initialbc;
+ if (all_ships_must_survive === true)
+ return bc > 0 && bc === initialbc;
+ else
+ return bc > 0;
}
function battle(playerA, playerB) {
@@ -476,3 +479,4 @@ var max_tries = 200;
var max_research = 1;
var max_cost = 10;
var max_ships = 1;
+var all_ships_must_survive = true;

0 comments on commit baa69f4

Please sign in to comment.