Example #1
0
 /**
  * Settings, starting armies
  *
  * @param \Mastercoding\Conquest\Object\Map $map
  * @param \Mastercoding\Conquest\Command\Settings\Player
  * $continentsCommand
  *
  */
 public function updatePlaceArmies(\Mastercoding\Conquest\Object\Map $map, \Mastercoding\Conquest\Move\PlaceArmies $placeArmiesMove)
 {
     // update map with armies
     foreach ($placeArmiesMove->getPlaceArmies() as $regionId => $armies) {
         $map->getRegionById($regionId)->addArmies($armies);
     }
 }
Example #2
0
 /**
  * @inheritDoc
  */
 public function placeArmies(\Mastercoding\Conquest\Bot\AbstractBot $bot, \Mastercoding\Conquest\Move\PlaceArmies $move, $amountLeft, \Mastercoding\Conquest\Command\Go\PlaceArmies $placeArmiesCommand)
 {
     // place on any of my regions
     $myRegions = $bot->getMap()->getRegionsForPlayer($bot->getMap()->getYou());
     // first
     $myRegions->rewind();
     $first = $myRegions->current();
     // moves
     $move->addPlaceArmies($first->getId(), $amountLeft);
     return array($move, 0);
 }
Example #3
0
 /**
  * @inheritDoc
  */
 public function placeArmies(\Mastercoding\Conquest\Bot\AbstractBot $bot, \Mastercoding\Conquest\Move\PlaceArmies $move, $amountLeft, \Mastercoding\Conquest\Command\Go\PlaceArmies $placeArmiesCommand)
 {
     // place on any of my regions
     $myRegions = $bot->getMap()->getRegionsForPlayer($bot->getMap()->getYou());
     // first
     $random = rand(0, $myRegions->count() - 1);
     $myRegions->rewind();
     for ($i = 0; $i < $random; $i++) {
         $myRegions->next();
     }
     // region
     $region = $myRegions->current();
     // moves
     $move->addPlaceArmies($region->getId(), $amountLeft);
     return array($move, 0);
 }