예제 #1
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == AUSTRIAN_FORCE) {
             $this->victoryPoints[AUSTRIAN_FORCE] += 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>+10 Austrian vp</span>";
         }
         if ($forceId == PRUSSIAN_FORCE) {
             $this->victoryPoints[AUSTRIAN_FORCE] -= 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>-10 Prussian vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == PRUSSIAN_FORCE) {
             $this->victoryPoints[PRUSSIAN_FORCE] += 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>+20 Prussian vp</span>";
         }
         if ($forceId == AUSTRIAN_FORCE) {
             $this->victoryPoints[PRUSSIAN_FORCE] -= 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>-20 Austrian vp</span>";
         }
     }
 }
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == ANGLO_ALLIED_FORCE) {
             $this->victoryPoints[ANGLO_ALLIED_FORCE] += 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='angloallied'>+15 Anglo Allied vp</span>";
         }
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[ANGLO_ALLIED_FORCE] -= 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>-15 Anglo Allied vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] += 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+10 French vp</span>";
         }
         if ($forceId == ANGLO_ALLIED_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] -= 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='angloallied'>-10 French vp</span>";
         }
     }
 }
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] += 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>+20 Sikh vp</span>";
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] -= 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>-20 Sikh vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB) || in_array($mapHexName, $battle->specialHexC) || in_array($mapHexName, $battle->specialHexD)) {
         $vp = 20;
         if (in_array($mapHexName, $battle->specialHexC)) {
             $vp = 10;
         }
         if (in_array($mapHexName, $battle->specialHexD)) {
             $vp = 5;
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>+{$vp} British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>-{$vp} British vp</span>";
         }
     }
 }
예제 #4
0
 static function getPlayerData($scenario)
 {
     $forceName[0] = "Neutral Observer";
     $forceName[1] = "Eastern";
     $forceName[2] = "Western";
     $forceName[3] = "West German";
     $forceName[4] = "East German";
     $deployName = [0, 1, 2, 3, 4];
     return \Wargame\Battle::register($forceName, $deployName);
 }
예제 #5
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if ($forceId == PRUSSIAN_FORCE) {
         $this->victoryPoints[PRUSSIAN_FORCE] += 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>+5 Prussian vp</span>";
     }
     if ($forceId == RUSSIAN_FORCE) {
         $this->victoryPoints[PRUSSIAN_FORCE] -= 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='russian'>-5 Prussian vp</span>";
     }
 }
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == FRENCH_FORCE) {
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>French Control Vital Objective</span>";
         }
         if ($forceId == ALLIED_FORCE) {
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>French Lose Vital Objective</span>";
         }
     }
 }
예제 #7
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if ($forceId == BELUCHI_FORCE) {
         $this->victoryPoints[BELUCHI_FORCE] += 15;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>+15 Beluchis  vp</span>";
     }
     if ($forceId == BRITISH_FORCE) {
         $this->victoryPoints[BELUCHI_FORCE] -= 15;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-15 Beluchis  vp</span>";
     }
 }
예제 #8
0
 public function preStartMovingUnit($arg)
 {
     /* @var unit $unit */
     list($unit) = $arg;
     /* @var Dubba1843 $battle */
     $battle = Battle::getBattle();
     $zocBlocksRetreat = !empty($battle->scenario->zocBlocksRetreat);
     if ($unit->forceId !== BRITISH_FORCE || $zocBlocksRetreat) {
         $battle->moveRules->zocBlocksRetreat = true;
     } else {
         $battle->moveRules->zocBlocksRetreat = false;
     }
 }
예제 #9
0
 static function getPlayerData($scenario)
 {
     $forceName = ["Neutral Observer", "IJN", "USN"];
     if (!empty($scenario->one)) {
         $forceName[1] = "RN";
         $forceName[2] = "IJN";
     }
     if (!empty($scenario->eight)) {
         $forceNname[1] = "USN";
         $forceNname[2] = "IJN";
     }
     $deployName = $forceName;
     return \Wargame\Battle::register($forceName, $deployName);
 }
예제 #10
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>+10 British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-10 British vp</span>";
         }
     }
 }
예제 #11
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == ALLIED_FORCE) {
             $this->victoryPoints[ALLIED_FORCE] += 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>+5 Allied vp</span>";
         }
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[ALLIED_FORCE] -= 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>-5 Allied vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         $vp = 5;
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+{$vp} French vp</span>";
         }
         if ($forceId == ALLIED_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] -= $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>-{$vp} French vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexC)) {
         $vp = 5;
         $prevForceId = $battle->mapData->specialHexes->{$mapHexName};
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+{$vp} French vp</span>";
             if ($prevForceId !== 0) {
                 $this->victoryPoints[ALLIED_FORCE] -= $vp;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>-{$vp} Allied vp</span>";
             }
         }
         if ($forceId == ALLIED_FORCE) {
             $this->victoryPoints[ALLIED_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>+{$vp} Allied vp</span>";
             if ($prevForceId !== 0) {
                 $this->victoryPoints[FRENCH_FORCE] -= $vp;
                 $battle->mapData->specialHexesVictory->{$mapHexName} .= "<span class='french'>-{$vp} French vp</span>";
             }
         }
     }
 }
예제 #12
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if ($forceId == FRENCH_FORCE && in_array($mapHexName, $battle->angloSpecialHexes)) {
         $this->victoryPoints[FRENCH_FORCE] += 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+5 French vp</span>";
     }
     if ($forceId == ANGLO_FORCE && in_array($mapHexName, $battle->angloSpecialHexes)) {
         $this->victoryPoints[FRENCH_FORCE] -= 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>-5 French vp</span>";
     }
     if ($forceId == ANGLO_FORCE && in_array($mapHexName, $battle->frenchSpecialHexes)) {
         $this->victoryPoints[ANGLO_FORCE] += 10;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>+10 Anglo Allied vp</span>";
     }
     if ($forceId == FRENCH_FORCE && in_array($mapHexName, $battle->frenchSpecialHexes)) {
         $this->victoryPoints[ANGLO_FORCE] -= 10;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>-10 Anglo Allied vp</span>";
     }
 }
예제 #13
0
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     if (!empty($battle->scenario->dayTwo)) {
         list($mapHexName, $forceId) = $args;
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] += 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>+5 Sikh  vp</span>";
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] -= 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-5 Sikh  vp</span>";
         }
     } else {
         list($mapHexName, $forceId) = $args;
         if ($mapHexName == $battle->moodkee) {
             if ($forceId == SIKH_FORCE) {
                 $this->victoryPoints[SIKH_FORCE] += 20;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>+5 Sikh  vp</span>";
             }
             if ($forceId == BRITISH_FORCE) {
                 $this->victoryPoints[SIKH_FORCE] -= 20;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-5 Sikh  vp</span>";
             }
         } else {
             if ($forceId == BRITISH_FORCE) {
                 $this->victoryPoints[BRITISH_FORCE] += 5;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>+5 British  vp</span>";
             }
             if ($forceId == SIKH_FORCE) {
                 $this->victoryPoints[BRITISH_FORCE] -= 5;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>-5 British  vp</span>";
             }
         }
     }
 }
예제 #14
0
 protected function unitSupplyEffects($unit, $goal, $bias, $supplyLen)
 {
     $b = Battle::getBattle();
     $id = $unit->id;
     if ($b->gameRules->mode == REPLACING_MODE) {
         if ($unit->status == STATUS_CAN_UPGRADE) {
             $unit->supplied = $b->moveRules->calcSupply($unit->id, $goal, $bias, $supplyLen);
             if (!$unit->supplied) {
                 /* TODO: make this not cry  (call a method) */
                 $unit->status = STATUS_STOPPED;
             }
         }
         return;
     }
     if ($unit->status == STATUS_READY || $unit->status == STATUS_UNAVAIL_THIS_PHASE) {
         $unit->supplied = $b->moveRules->calcSupply($unit->id, $goal, $bias, $supplyLen);
     } else {
         return;
     }
     if (!$unit->supplied) {
         $unit->addAdjustment('movement', 'floorHalfMovement');
     }
     if ($unit->supplied) {
         $unit->removeAdjustment('movement');
     }
     if ($unit->status == STATUS_READY || $unit->status == STATUS_DEFENDING || $unit->status == STATUS_UNAVAIL_THIS_PHASE) {
         $unit->supplied = $b->moveRules->calcSupply($unit->id, $goal, $bias, $supplyLen);
     } else {
         return;
     }
     if ((!empty($this->unsuppliedDefenderHalved) || $unit->forceId == $b->gameRules->attackingForceId) && !$unit->supplied) {
         $unit->addAdjustment('supply', 'half');
     } else {
         $unit->removeAdjustment('supply');
     }
 }
 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     $scenario = $battle->scenario;
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] += 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>+20 Sikh vp</span>";
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] -= 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-20 Sikh vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>+15 British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>-15 British vp</span>";
         }
     }
     if (!empty($scenario->altScenario) && in_array($mapHexName, $battle->specialHexC)) {
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>+5 British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>-5 British vp</span>";
         }
     }
 }
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     parent::postRecoverUnit($args);
 }
예제 #17
0
 static function getPlayerData($scenario)
 {
     $forceName = ['Observer', "French", "Russian"];
     return \Wargame\Battle::register($forceName, [$forceName[0], $forceName[2], $forceName[1]]);
 }
예제 #18
0
 public function playerTurnChange($arg)
 {
     $attackingId = $arg[0];
     $battle = Battle::getBattle();
     $gameRules = $battle->gameRules;
     if ($gameRules->phase == BLUE_MECH_PHASE || $gameRules->phase == RED_MECH_PHASE) {
         $gameRules->flashMessages[] = "@hide crt";
     }
     if ($gameRules->turn <= $gameRules->maxTurn) {
         if ($attackingId == REBEL_FORCE) {
             $gameRules->flashMessages[] = "Rebel Player Turn";
         }
         if ($attackingId == LOYALIST_FORCE) {
             $gameRules->flashMessages[] = "Loyalist Player Turn";
         }
     }
     /*only get special VPs' at end of first Movement Phase */
 }
예제 #19
0
 static function getPlayerData($scenario)
 {
     $forceName = ["Observer", "British", "Sikh"];
     return \Wargame\Battle::register($forceName, [$forceName[0], $forceName[2], $forceName[1]]);
 }
예제 #20
0
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $id = $unit->id;
     parent::postRecoverUnit($args);
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == BLUE_MOVE_PHASE && $unit->status == STATUS_READY) {
         $this->movementCache->{$id} = $unit->maxMove;
         $unit->maxMove = $unit->maxMove + 1;
     }
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == BLUE_COMBAT_PHASE && isset($this->movementCache->{$id})) {
         $unit->maxMove = $this->movementCache->{$id};
         unset($this->movementCache->{$id});
     }
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == RED_MOVE_PHASE && $unit->status == STATUS_READY) {
         $this->movementCache->{$id} = $unit->maxMove;
         $unit->maxMove = floor($unit->maxMove / 2);
     }
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == RED_COMBAT_PHASE && isset($this->movementCache->{$id})) {
         $unit->maxMove = $this->movementCache->{$id};
         unset($this->movementCache->{$id});
     }
 }
예제 #21
0
 static function getPlayerData($scenario)
 {
     return \Wargame\Battle::register(["Observer", "Prussian", "Russian"], ["Observer", "Russian", "Prussian"]);
 }
예제 #22
0
 public function playerTurnChange($arg)
 {
     $attackingId = $arg[0];
     $battle = Battle::getBattle();
     $mapData = $battle->mapData;
     $vp = $this->victoryPoints;
     $specialHexes = $mapData->specialHexes;
     $gameRules = $battle->gameRules;
     if ($gameRules->phase == BLUE_MECH_PHASE || $gameRules->phase == RED_MECH_PHASE) {
         $gameRules->flashMessages[] = "@hide crt";
     }
     if ($attackingId == REBEL_FORCE) {
         $gameRules->flashMessages[] = "Rebel Player Turn";
         $gameRules->replacementsAvail = 1;
     }
     if ($attackingId == LOYALIST_FORCE) {
         $gameRules->flashMessages[] = "Loyalist Player Turn";
         $gameRules->replacementsAvail = 10;
     }
     /*only get special VPs' at end of first Movement Phase */
     $this->victoryPoints = $vp;
 }
예제 #23
0
 static function getPlayerData($scenario)
 {
     $forceName = ["Neutral Observer", "German", "Soviet"];
     return \Wargame\Battle::register($forceName, [$forceName[0], $forceName[2], $forceName[1]]);
 }
예제 #24
0
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     if ($b->gameRules->turn <= 2 && !isset($this->southOfTheRiver)) {
         $terrain = $b->terrain;
         $reinforceZones = $terrain->reinforceZones;
         $southOfTheRiver = [];
         foreach ($reinforceZones as $reinforceZone) {
             if ($reinforceZone->name == 'D') {
                 $southOfTheRiver[$reinforceZone->hexagon->name] = true;
             }
         }
         $this->southOfTheRiver = $southOfTheRiver;
     }
     parent::postRecoverUnit($args);
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == RED_MOVE_PHASE && $unit->status == STATUS_READY && $unit->forceId == ALLIED_FORCE) {
         /* if early Movement set and unit is north of river they can move */
         if (!(isset($scenario->earlyMovement) && empty($this->southOfTheRiver[$unit->hexagon->name]))) {
             $unit->status = STATUS_UNAVAIL_THIS_PHASE;
         }
     }
     if ($b->gameRules->turn == 2 && $b->gameRules->phase == RED_MOVE_PHASE) {
         if ($unit->status == STATUS_READY && $unit->forceId == ALLIED_FORCE && !empty($this->southOfTheRiver[$unit->hexagon->name])) {
             $unit->status = STATUS_UNAVAIL_THIS_PHASE;
         }
     }
 }
예제 #25
0
 public function playerTurnChange($arg)
 {
     $attackingId = $arg[0];
     $battle = Battle::getBattle();
     $mapData = $battle->mapData;
     $vp = $this->victoryPoints;
     $specialHexes = $mapData->specialHexes;
     $gameRules = $battle->gameRules;
     if ($gameRules->phase == BLUE_MECH_PHASE || $gameRules->phase == RED_MECH_PHASE) {
         $gameRules->flashMessages[] = "@hide crt";
     }
     if ($attackingId == REBEL_FORCE) {
         $gameRules->flashMessages[] = "Rebel Player Turn";
         $gameRules->replacementsAvail = 1;
     }
     if ($attackingId == LOYALIST_FORCE) {
         $gameRules->flashMessages[] = "Loyalist Player Turn";
         $gameRules->replacementsAvail = 10;
     }
     /*only get special VPs' at end of first Movement Phase */
     if ($specialHexes) {
         $scenario = $battle->scenario;
         if (!empty($scenario->supply) === true) {
             $inCity = false;
             $roadCut = false;
             foreach ($specialHexes as $k => $v) {
                 if ($v == REBEL_FORCE) {
                     $points = 1;
                     if ($k == 2414 || $k == 2415 || $k == 2515) {
                         $inCity = true;
                         $points = 5;
                     } elseif ($k >= 2416) {
                         /* Remember the first road Cut */
                         if ($roadCut === false) {
                             $roadCut = $k;
                         }
                         continue;
                     }
                     $vp[$v] += $points;
                     $battle->mapData->specialHexesVictory->{$k} = "<span class='rebelVictoryPoints'>+{$points} vp</span>";
                 } else {
                     //                    $vp[$v] += .5;
                 }
             }
             if ($roadCut !== false) {
                 $vp[REBEL_FORCE] += 3;
                 $battle->mapData->specialHexesVictory->{$roadCut} = "<span class='rebelVictoryPoints'>+3 vp</span>";
             }
             if (!$inCity) {
                 /* Cuneiform isolated? */
                 $cuneiform = 2515;
                 if (!$battle->moveRules->calcSupplyHex($cuneiform, array(3014, 3015, 3016, 3017, 3018, 3019, 3020, 2620, 2720, 2820, 2920), array(2 => true, 3 => true), RED_FORCE, $this->supplyLen)) {
                     $vp[REBEL_FORCE] += 5;
                     $battle->mapData->specialHexesVictory->{$cuneiform} = "<span class='rebelVictoryPoints'>+5 vp</span>";
                 }
             }
         } else {
             foreach ($specialHexes as $k => $v) {
                 if ($v == 1) {
                     $points = 1;
                     if ($k == 2414 || $k == 2415 || $k == 2515) {
                         $points = 5;
                     } elseif ($k >= 2416) {
                         $points = 3;
                     }
                     $vp[$v] += $points;
                     $battle = Battle::getBattle();
                     $battle->mapData->specialHexesVictory->{$k} = "<span class='rebelVictoryPoints'>+{$points} vp</span>";
                 } else {
                     //                    $vp[$v] += .5;
                 }
             }
         }
     }
     $this->victoryPoints = $vp;
 }
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     parent::postRecoverUnit($args);
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == BLUE_MOVE_PHASE && $unit->status == STATUS_READY) {
         $this->movementCache->{$id} = $unit->maxMove;
         $unit->maxMove = $unit->maxMove + 1;
     }
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == BLUE_COMBAT_PHASE && isset($this->movementCache->{$id})) {
         $unit->maxMove = $this->movementCache->{$id};
         unset($this->movementCache->{$id});
     }
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == RED_MOVE_PHASE && $unit->status == STATUS_READY) {
         $this->movementCache->{$id} = $unit->maxMove;
         if (!empty($scenario->noMovementFirstTurn)) {
             $unit->status = STATUS_UNAVAIL_THIS_PHASE;
         } else {
             $unit->maxMove = floor($unit->maxMove / 2);
         }
     }
     if ($b->gameRules->turn == 1 && $b->gameRules->phase == RED_COMBAT_PHASE && isset($this->movementCache->{$id})) {
         $unit->maxMove = $this->movementCache->{$id};
         unset($this->movementCache->{$id});
     }
 }
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     parent::postRecoverUnit($args);
     if ($this->isIndecisive && $unit->status == STATUS_READY) {
         $unit->status = STATUS_UNAVAIL_THIS_PHASE;
     }
 }
예제 #28
0
 function reinforce($id, Hexagon $hexagon)
 {
     $battle = Battle::getBattle();
     if ($this->force->unitIsReinforcing($id) == true) {
         list($zones) = $battle->victory->postReinforceZoneNames($this->terrain->getReinforceZoneList($hexagon), $battle->force->units[$id]);
         /* @var Unit $movingUnit */
         $movingUnit = $this->force->getUnit($id);
         if (in_array($movingUnit->getUnitReinforceZone($id), $zones)) {
             if ($movingUnit->setStatus(STATUS_MOVING) == true) {
                 $battle = Battle::getBattle();
                 $victory = $battle->victory;
                 $victory->reinforceUnit($movingUnit, $hexagon);
                 $this->force->updateMoveStatus($id, $hexagon, 0);
             }
         }
     }
 }
예제 #29
0
 static function getPlayerData($scenario)
 {
     $forceName = ["Neutral Observer", "Laconians", "Caprolians"];
     return \Wargame\Battle::register($forceName, [$forceName[0], $forceName[2], $forceName[1]]);
 }
예제 #30
0
 function getCombatResults($Die, $index, $combat)
 {
     $battle = Battle::getBattle();
     if ($battle->gameRules->phase == BLUE_TORP_COMBAT_PHASE || $battle->gameRules->phase == RED_TORP_COMBAT_PHASE) {
         $hits = $this->crts->torpedo[$Die][$index];
         $combat->hits = $hits;
         switch ($hits) {
             case MISS:
                 return MISS;
             case H:
                 $Die = floor($this->dieSideCount * (rand() / getrandmax()));
                 //                    $Die = 0;
                 $combat->hitDie = $Die + 1;
                 $defense = $combat->unitDefenseStrength;
                 $col = $this->getOneHitColumn($defense);
                 $combat->hitCol = $col + 1;
                 return $this->crts->torpedoHitOne[$Die][$col];
                 break;
             case HH:
                 $Die = floor($this->dieSideCount * (rand() / getrandmax()));
                 //                    $Die = 2;
                 $combat->hitDie = $Die + 1;
                 $defense = $combat->unitDefenseStrength;
                 $col = $this->getTwoHitColumn($defense);
                 $combat->hitCol = $col + 1;
                 return $this->crts->torpedoHitTwo[$Die][$col];
         }
         return MISS;
     }
     return $this->crts->normal[$Die][$index];
 }