Ejemplo n.º 1
0
 public function resetUnit()
 {
     parent::resetUnit();
     $this->steps = 1;
     $this->supplied = true;
     $this->forceMarch = true;
 }
Ejemplo n.º 2
0
 function moveIsValid(MovableUnit $movingUnit, $hexagon, $startHex = false, $firstHex = false)
 {
     // all 4 conditions must be true, so any one that is false
     //    will make the move invalid
     $isValid = true;
     if ($startHex === false) {
         $startHex = $movingUnit->getUnitHexagon()->name;
     }
     if ($firstHex === false) {
         $firstHex = $movingUnit->unitHasNotMoved();
     }
     // condition 1
     // can only move to nearby hexagon
     if ($this->rangeIsOneHexagon($startHex, $hexagon) == false) {
         $isValid = false;
     }
     // condition 2
     // check if unit has enough move points
     $moveAmount = $this->terrain->getTerrainMoveCost($startHex, $hexagon, $movingUnit->forceMarch, $movingUnit);
     // need move points, but can always move at least one hexagon
     //  can always move at least one hexagon if this->oneHex is true
     //  only check move amount if unit has been moving
     if (!($firstHex == true && !empty($this->oneHex))) {
         if ($movingUnit->unitHasMoveAmountAvailable($moveAmount) == false) {
             $isValid = false;
         }
     }
     // condition 3
     // can only move across river hexside if at start of move
     //        if (($this->isAlongRail($startHex, $hexagon) == false) && $this->railMove) {
     //            $isValid = false;
     //        }
     // condition 4
     // can not exit
     if ($this->terrain->isExit($hexagon) == true) {
         $isValid = false;
     }
     return $isValid;
 }
Ejemplo n.º 3
0
 function stopDeploying(MovableUnit $unit)
 {
     /* @var Unit $unit */
     if ($unit->unitIsDeploying() == true) {
         if ($unit->setStatus(STATUS_CAN_DEPLOY) == true) {
             $this->anyUnitIsMoving = false;
             $this->movingUnitId = NONE;
             $this->moves = new stdClass();
         }
     }
 }