Example #1
0
 private function execMove(Dolumar_Underworld_Map_Locations_Location $location)
 {
     $oldlocation = $this->getUnderworldLocation();
     if ($path = $this->canReach($location)) {
         $points = $path->getCost();
         $this->setLocation($location);
         $this->decreaseMovepoints($points, false);
         Dolumar_Underworld_Mappers_ArmyMapper::save($this);
         $this->getMap()->addMapUpdate($oldlocation, 'DESTROY');
         $this->getMap()->addMapUpdate($location, 'BUILD');
         // Now we should make the whole line "explored"
         foreach ($path->getPath() as $v) {
             $this->getMap()->setExplored($v);
         }
         // And notify the objective
         $this->getMap()->getMission()->onMove($this, $oldlocation, $location);
         return $path;
     } else {
         return false;
     }
 }