Skip to content

Commit

Permalink
added config option
Browse files Browse the repository at this point in the history
  • Loading branch information
jstar88 committed Mar 18, 2015
1 parent bda56ae commit b988eba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions combatObject/ShipsCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ public function start()

/*** calculating the amount of exploded ships ***/

$teoricExploded = $this->fighters->getCount() * $probToExplode;
//$this->exploded = round($teoricExploded);
//$this->exploded = min(floor($teoricExploded), $this->lastShots);
$this->exploded = min(round($teoricExploded), $this->lastShots); //bounded by the total shots fired to simulate a real combat :)
$teoricExploded = round($this->fighters->getCount() * $probToExplode);
if (USE_EXPLODED_LIMITATION)
{
$teoricExploded = min($teoricExploded, $this->lastShots);
}
$this->exploded = $teoricExploded; //bounded by the total shots fired to simulate a real combat :)


/*** calculating the life of destroyed ships ***/
Expand Down
1 change: 1 addition & 0 deletions constants/battle_constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
define('DEFENSE_REPAIR_PROB', 0.7); //probability to repair defenses. From 0 to 1, 1 means that defenses are always rebuilt.
define('SHIP_REPAIR_PROB', 0); //same as below but for ships.
define('USE_HITSHIP_LIMITATION', true); //this option will limit the number of exploding ships to the number of total shots received by all defender's ships.
define('USE_EXPLODED_LIMITATION',true); //if true the number of exploded ships each round are limited to the damaged ships amount.
define('USE_RANDOMIC_RF', false); // enable below system values
define('MAX_RF_BUFF', 0); // how much the rapid fire can be randomically increased.
define('MAX_RF_NERF', 0); // how much the rapid fire can be randomically decreased.
Expand Down

0 comments on commit b988eba

Please sign in to comment.