@@ -10,7 +10,7 @@ |
||
| 10 | 10 | <th width="100">HP</th> |
| 11 | 11 | <th width="100">Cool</th> |
| 12 | 12 | </tr> |
| 13 | - <?php $count = count($units);?> |
|
| 13 | + <?php $count = count($units); ?> |
|
| 14 | 14 | @for($i = 0; $i < $count; $i++) |
| 15 | 15 | <tr style="color: {{array_search($units[$i]['All']['Color'], ['black' => 0, 'red' => 1, 'blue' => 2])}};"> |
| 16 | 16 | <td>{{Lang::get('battle-calc::units.'.$units[$i]['Base']['ID'])}}</td> |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::group(Config::get('battle-calc::routes.routing'), function () { |
|
| 4 | - Route::get('/', ['uses' => 'Xaoc303\BattleCalc\BattleCalcController@getIndex', 'as' => 'bc.index']); |
|
| 3 | +Route::group(Config::get('battle-calc::routes.routing'), function() { |
|
| 4 | + Route::get('/', ['uses' => 'Xaoc303\BattleCalc\BattleCalcController@getIndex', 'as' => 'bc.index']); |
|
| 5 | 5 | Route::get('getArmyBase/{id_army?}/{race?}', ['uses' => 'Xaoc303\BattleCalc\BattleCalcController@getArmyBase', 'as' => 'bc.army_base']); |
| 6 | - Route::get('calculation', ['uses' => 'Xaoc303\BattleCalc\BattleCalcController@getCalculation', 'as' => 'bc.calc']); |
|
| 6 | + Route::get('calculation', ['uses' => 'Xaoc303\BattleCalc\BattleCalcController@getCalculation', 'as' => 'bc.calc']); |
|
| 7 | 7 | }); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | private function findByField($field_key, $field_value) |
| 140 | 140 | { |
| 141 | 141 | $units = $this->getUnits(); |
| 142 | - return array_where($units, function ($key, $value) use ($field_key, $field_value) { |
|
| 142 | + return array_where($units, function($key, $value) use ($field_key, $field_value) { |
|
| 143 | 143 | return $value[$field_key] == $field_value; |
| 144 | 144 | }); |
| 145 | 145 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $unit = new Unit(); |
| 168 | 168 | foreach ($unit_params as $key => $value) { |
| 169 | - if (! array_key_exists($key, $vars)) { |
|
| 169 | + if (!array_key_exists($key, $vars)) { |
|
| 170 | 170 | return null; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param Army $armyAtt |
| 38 | 38 | * @param Army $armyDef |
| 39 | 39 | */ |
| 40 | - public static function run(Army &$armyAtt, Army &$armyDef) |
|
| 40 | + public static function run(Army&$armyAtt, Army&$armyDef) |
|
| 41 | 41 | { |
| 42 | 42 | $class = new ArmyDamage(); |
| 43 | 43 | |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | $ManDamageHP = 0; |
| 142 | 142 | if ($unitsDef[$i]['All']['ManCountVisible'] > 0) { |
| 143 | 143 | if ($unitsDef[$i]['All']['UT'] == 0) { |
| 144 | - $ManDamageAll = ($this->ManDamageT-(($this->ManDamageT* $unitsDef[$i]['Base']['Armor'])/100))* $unitsDef[$i]['All']['ManCount']; |
|
| 144 | + $ManDamageAll = ($this->ManDamageT - (($this->ManDamageT * $unitsDef[$i]['Base']['Armor']) / 100)) * $unitsDef[$i]['All']['ManCount']; |
|
| 145 | 145 | } else { |
| 146 | - $ManDamageAll = ($this->ManDamageA-(($this->ManDamageA* $unitsDef[$i]['Base']['Armor'])/100))* $unitsDef[$i]['All']['ManCount']; |
|
| 146 | + $ManDamageAll = ($this->ManDamageA - (($this->ManDamageA * $unitsDef[$i]['Base']['Armor']) / 100)) * $unitsDef[$i]['All']['ManCount']; |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | if ($this->DamageMagicAll > 0) { |
| 150 | - $ManDamageAll += $this->DamageMagicAll -(($this->DamageMagicAll * $unitsDef[$i]['Base']['Armor'])/100); |
|
| 150 | + $ManDamageAll += $this->DamageMagicAll - (($this->DamageMagicAll * $unitsDef[$i]['Base']['Armor']) / 100); |
|
| 151 | 151 | } |
| 152 | 152 | if ($this->DamageMagicShield > 0) { |
| 153 | - $ManDamageShield += $this->DamageMagicShield -(($this->DamageMagicShield* $unitsDef[$i]['Base']['Armor'])/100); |
|
| 153 | + $ManDamageShield += $this->DamageMagicShield - (($this->DamageMagicShield * $unitsDef[$i]['Base']['Armor']) / 100); |
|
| 154 | 154 | } |
| 155 | 155 | if ($this->DamageMagicHP > 0) { |
| 156 | - $ManDamageHP += $this->DamageMagicHP -(($this->DamageMagicHP * $unitsDef[$i]['Base']['Armor'])/100); |
|
| 156 | + $ManDamageHP += $this->DamageMagicHP - (($this->DamageMagicHP * $unitsDef[$i]['Base']['Armor']) / 100); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $unitsDef[$i]['All']['Shield'] -= $ManDamageShield; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $pathToDirConfigs = self::getPathToDirConfigs(); |
| 15 | 15 | $fullPathToFileConfig = self::getPathToFileConfig($pathToDirConfigs, $keys); |
| 16 | 16 | |
| 17 | - if (!file_exists( $fullPathToFileConfig )) { |
|
| 17 | + if (!file_exists($fullPathToFileConfig)) { |
|
| 18 | 18 | return $default; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private static function getPathToDirConfigs() |
| 25 | 25 | { |
| 26 | - return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR; |
|
| 26 | + return __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | private static function getPathToFileConfig($pathToDirConfigs, $keys) |
| 30 | 30 | { |
| 31 | - return $pathToDirConfigs. $keys[0]. '.php'; |
|
| 31 | + return $pathToDirConfigs.$keys[0].'.php'; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | private static function getArrayFromFile($file, $keys) |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param Army $armyDef |
| 24 | 24 | * @param int $Inic |
| 25 | 25 | */ |
| 26 | - public static function run(Army &$armyAtt, Army &$armyDef, $Inic) |
|
| 26 | + public static function run(Army&$armyAtt, Army&$armyDef, $Inic) |
|
| 27 | 27 | { |
| 28 | 28 | $class = new ArmyAttack(); |
| 29 | 29 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | $count = count($this->unitsAtt); |
| 47 | 47 | for ($i = 0; $i < $count; $i++) { |
| 48 | 48 | if ($this->unitsAtt[$i]['All']['Iniciative'] >= $Inic && $this->unitsAtt[$i]['All']['ManCount'] > 0) { |
| 49 | - $Cool = 24.0 / $this->unitsAtt[$i]['Base']['AttackCool']; // Атак в секунду |
|
| 50 | - $Cool = round($Cool, 2); // Округление до сотых |
|
| 51 | - $Cool += $this->unitsAtt[$i]['All']['AttackCoolDouble']; // + предыдущий остаток |
|
| 52 | - $this->unitsAtt[$i]['All']['AttackCoolInt'] = (int) $Cool; // int атак в секунду |
|
| 53 | - $this->unitsAtt[$i]['All']['AttackCoolDouble'] = $Cool - $this->unitsAtt[$i]['All']['AttackCoolInt']; // double остаток атак в секунду |
|
| 49 | + $Cool = 24.0 / $this->unitsAtt[$i]['Base']['AttackCool']; // Атак в секунду |
|
| 50 | + $Cool = round($Cool, 2); // Округление до сотых |
|
| 51 | + $Cool += $this->unitsAtt[$i]['All']['AttackCoolDouble']; // + предыдущий остаток |
|
| 52 | + $this->unitsAtt[$i]['All']['AttackCoolInt'] = (int) $Cool; // int атак в секунду |
|
| 53 | + $this->unitsAtt[$i]['All']['AttackCoolDouble'] = $Cool - $this->unitsAtt[$i]['All']['AttackCoolInt']; // double остаток атак в секунду |
|
| 54 | 54 | if ($this->unitsAtt[$i]['All']['AttackCoolInt'] > 0) { |
| 55 | 55 | $this->attackAirOn($i); |
| 56 | 56 | $this->attackTerOn($i); |
@@ -38,47 +38,47 @@ |
||
| 38 | 38 | $masUnitTownDistruct = array(104, 204, 308); |
| 39 | 39 | |
| 40 | 40 | $base = array(); |
| 41 | - $base['ID'] = $unit->id; // id |
|
| 42 | - $base['ManCount'] = $units_count; // Количество |
|
| 43 | - $base['Iniciative'] = 0; // Инициатива |
|
| 44 | - $base['ShieldUp'] = 1; // Щит |
|
| 45 | - $base['ArmorUp'] = 1; // Броня |
|
| 46 | - $base['AttackTerUp'] = 1; // атака земля |
|
| 47 | - $base['AttackAirUp'] = 1; // атака воздух |
|
| 48 | - $base['AttackMagicUp'] = 1; // Магия |
|
| 49 | - $base['Magic'][0] = $unit->magic1; // Магия |
|
| 50 | - $base['Magic'][1] = $unit->magic2; // Магия |
|
| 51 | - $base['Magic'][2] = $unit->magic3; // Магия |
|
| 41 | + $base['ID'] = $unit->id; // id |
|
| 42 | + $base['ManCount'] = $units_count; // Количество |
|
| 43 | + $base['Iniciative'] = 0; // Инициатива |
|
| 44 | + $base['ShieldUp'] = 1; // Щит |
|
| 45 | + $base['ArmorUp'] = 1; // Броня |
|
| 46 | + $base['AttackTerUp'] = 1; // атака земля |
|
| 47 | + $base['AttackAirUp'] = 1; // атака воздух |
|
| 48 | + $base['AttackMagicUp'] = 1; // Магия |
|
| 49 | + $base['Magic'][0] = $unit->magic1; // Магия |
|
| 50 | + $base['Magic'][1] = $unit->magic2; // Магия |
|
| 51 | + $base['Magic'][2] = $unit->magic3; // Магия |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | $battle = array(); |
| 55 | 55 | $base['TownDistruct'] = in_array($base['ID'], $masUnitTownDistruct); |
| 56 | 56 | $battle['TownDistruct'] = $base['TownDistruct']; |
| 57 | 57 | |
| 58 | - $battle['Iniciative'] = $unit->init; // Инициатива |
|
| 59 | - $battle['UT'] = $unit->type; // Тип |
|
| 58 | + $battle['Iniciative'] = $unit->init; // Инициатива |
|
| 59 | + $battle['UT'] = $unit->type; // Тип |
|
| 60 | 60 | |
| 61 | - $battle['Bio'] = $unit->bio; // био-тип |
|
| 61 | + $battle['Bio'] = $unit->bio; // био-тип |
|
| 62 | 62 | |
| 63 | - $base['Shield'] = $unit->shield; // Щит |
|
| 63 | + $base['Shield'] = $unit->shield; // Щит |
|
| 64 | 64 | $battle['Shield'] = $base['Shield'] * $base['ManCount']; |
| 65 | 65 | |
| 66 | - $base['Armor'] = $unit->armor; // Броня |
|
| 66 | + $base['Armor'] = $unit->armor; // Броня |
|
| 67 | 67 | $battle['Armor'] = $base['Armor'] * $base['ManCount']; |
| 68 | 68 | |
| 69 | - $base['HP'] = $unit->hp; // Здоровье |
|
| 69 | + $base['HP'] = $unit->hp; // Здоровье |
|
| 70 | 70 | $battle['HP'] = $base['HP'] * $base['ManCount']; |
| 71 | 71 | |
| 72 | 72 | $battle['Magic'][0] = null; |
| 73 | 73 | $battle['Magic'][1] = null; |
| 74 | 74 | $battle['Magic'][2] = null; |
| 75 | 75 | |
| 76 | - $battle['MagicRound'] = $unit->mround; // Магическая атака |
|
| 76 | + $battle['MagicRound'] = $unit->mround; // Магическая атака |
|
| 77 | 77 | $battle['AttackMagicAll'] = 0; |
| 78 | 78 | $battle['AttackMagicShield'] = 0; |
| 79 | 79 | $battle['AttackMagicHP'] = 0; |
| 80 | 80 | |
| 81 | - $base['AttackCool'] = $unit->cool; // атака задержка |
|
| 81 | + $base['AttackCool'] = $unit->cool; // атака задержка |
|
| 82 | 82 | $battle['AttackCoolInt'] = 0; |
| 83 | 83 | $battle['AttackCoolDouble'] = 0; |
| 84 | 84 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param Army $ArmyDet |
| 71 | 71 | * @param integer $Round |
| 72 | 72 | */ |
| 73 | - public function shadow(Army &$ArmyDet, $Round) |
|
| 73 | + public function shadow(Army&$ArmyDet, $Round) |
|
| 74 | 74 | { |
| 75 | 75 | $unitsSh = $this->getUnits(); |
| 76 | 76 | $unitsDet = $ArmyDet->getUnits(); |
@@ -309,18 +309,18 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if ($units[$i]['All']['ManLock'] > 0) { |
| 312 | - $units[$i]['All']['AttackAir'] = $units[$i]['All']['AttackAir'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 313 | - $units[$i]['All']['AttackTer'] = $units[$i]['All']['AttackTer'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 314 | - $units[$i]['All']['AttackMagicAll'] = $units[$i]['All']['AttackMagicAll'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 315 | - $units[$i]['All']['AttackMagicShield'] = $units[$i]['All']['AttackMagicShield'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 316 | - $units[$i]['All']['AttackMagicHP'] = $units[$i]['All']['AttackMagicHP'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 312 | + $units[$i]['All']['AttackAir'] = $units[$i]['All']['AttackAir'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 313 | + $units[$i]['All']['AttackTer'] = $units[$i]['All']['AttackTer'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 314 | + $units[$i]['All']['AttackMagicAll'] = $units[$i]['All']['AttackMagicAll'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 315 | + $units[$i]['All']['AttackMagicShield'] = $units[$i]['All']['AttackMagicShield'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 316 | + $units[$i]['All']['AttackMagicHP'] = $units[$i]['All']['AttackMagicHP'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManLock']); |
|
| 317 | 317 | } |
| 318 | 318 | if ($units[$i]['All']['ManPhantom'] > 0) { |
| 319 | - $units[$i]['All']['AttackAir'] = $units[$i]['All']['AttackAir'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 320 | - $units[$i]['All']['AttackTer'] = $units[$i]['All']['AttackTer'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 321 | - $units[$i]['All']['AttackMagicAll'] = $units[$i]['All']['AttackMagicAll'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 322 | - $units[$i]['All']['AttackMagicShield'] = $units[$i]['All']['AttackMagicShield'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 323 | - $units[$i]['All']['AttackMagicHP'] = $units[$i]['All']['AttackMagicHP'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 319 | + $units[$i]['All']['AttackAir'] = $units[$i]['All']['AttackAir'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 320 | + $units[$i]['All']['AttackTer'] = $units[$i]['All']['AttackTer'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 321 | + $units[$i]['All']['AttackMagicAll'] = $units[$i]['All']['AttackMagicAll'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 322 | + $units[$i]['All']['AttackMagicShield'] = $units[$i]['All']['AttackMagicShield'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 323 | + $units[$i]['All']['AttackMagicHP'] = $units[$i]['All']['AttackMagicHP'] / $units[$i]['All']['ManCount'] * ($units[$i]['All']['ManCount'] - $units[$i]['All']['ManPhantom']); |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | } |