Exemplo n.º 1
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->specialHexA = $data->specialHexA;
         $this->specialHexB = $data->specialHexB;
     } else {
         $this->victory = new \Wargame\Victory('\\Wargame\\Mollwitz\\Golymin1806\\golymin1806VictoryCore');
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->zocBlocksRetreat = true;
         // game data
         $this->gameRules->setMaxTurn(9);
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         //            $this->gameRules->addPhaseChange(BLUE_REPLACEMENT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         //            $this->gameRules->addPhaseChange(RED_REPLACEMENT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
 }
Exemplo n.º 2
0
 function terrainGen($mapDoc, $terrainDoc)
 {
     $this->terrain->addTerrainFeature("wadi", "wadi", "v", 0, 2, 0, false);
     $this->terrain->addTerrainFeature("slope", "slope", "s", 0, 1, 0, false);
     parent::terrainGen($mapDoc, $terrainDoc);
     $this->terrain->addTerrainFeature("road", "road", "r", 0.75, 0, 0, false);
     $this->terrain->addNatAltEntranceCost('forest', 'Beluchi', 'infantry', 1);
     $this->terrain->addNatAltEntranceCost('forest', 'Sikh', 'infantry', 1);
     $this->terrain->addAltEntranceCost('forest', 'horseartillery', 4);
 }
Exemplo n.º 3
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->specialHexA = $data->specialHexA;
         $this->specialHexB = $data->specialHexB;
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Lesnaya1708\\Lesnaya1708VictoryCore");
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->zocBlocksRetreat = true;
         // game data
         $this->gameRules->setMaxTurn(8);
         $this->gameRules->setInitialPhaseMode(BLUE_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = RED_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, RED_DEPLOY_PHASE, DEPLOY_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
     $this->moveRules->stacking = function ($mapHex, $forceId, $unit) {
         $wagon = false;
         if ($unit->class === "wagon") {
             $wagon = true;
         }
         foreach ($mapHex->forces[$forceId] as $mKey => $mVal) {
             if ($this->force->units[$mKey]->class === "wagon") {
                 if ($wagon) {
                     return true;
                 }
                 return count((array) $mapHex->forces[$forceId]) >= 2;
             }
         }
         if ($wagon) {
             return count((array) $mapHex->forces[$forceId]) >= 2;
         }
         return count((array) $mapHex->forces[$forceId]) >= 1;
     };
 }
Exemplo n.º 4
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
     } else {
         $this->game = $game;
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Zorndorf\\zorndorfVictoryCore");
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->stickyZoc = false;
         $this->players = array("", "", "");
         // game data
         if (!empty($scenario->deployForward)) {
             $this->gameRules->setMaxTurn(14);
         } else {
             $this->gameRules->setMaxTurn(15);
         }
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
 }
Exemplo n.º 5
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Jagersdorf\\jagerVictoryCore");
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->stickyZoc = false;
         // game data
         $this->gameRules->setMaxTurn(12);
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         /**
          * not not prussian deploy phase for now
          */
         if (!empty($scenario->prussianDeploy)) {
             $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
             $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         } else {
             $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         }
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
         // end terrain data ----------------------------------------
     }
 }
Exemplo n.º 6
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->specialHexA = $data->specialHexA;
         $this->specialHexB = $data->specialHexB;
         $this->specialHexC = $data->specialHexC;
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Hohenfriedeberg\\hohenfriedebergVictoryCore");
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         // game data
         if (!empty($scenario->deployForward)) {
             $this->gameRules->setMaxTurn(14);
         } else {
             $this->gameRules->setMaxTurn(15);
         }
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
 }
Exemplo n.º 7
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->austrianSpecialHexes = $data->austrianSpecialHexes;
         $this->prussianSpecialHexes = $data->prussianSpecialHexes;
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Lobositz\\lobositzVictoryCore");
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         // game data
         $this->gameRules->setMaxTurn(14);
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
 }
Exemplo n.º 8
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->specialHexA = $data->specialHexA;
         $this->specialHexB = $data->specialHexB;
         if ($data->pontoons) {
             $this->pontoons = $data->pontoons;
             foreach ($this->pontoons as $pontoon) {
                 if (isset($this->terrain) && is_object($this->terrain) && method_exists($this->terrain, 'changeTerrain')) {
                     $this->terrain->changeTerrain($pontoon, HEXAGON_CENTER, "clear");
                 }
             }
         }
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Holowczyn1708\\Holowczyn1708VictoryCore");
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->zocBlocksRetreat = true;
         // game data
         $this->gameRules->setMaxTurn(8);
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         //            $this->gameRules->addPhaseChange(BLUE_REPLACEMENT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         //            $this->gameRules->addPhaseChange(RED_REPLACEMENT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
 }
Exemplo n.º 9
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     //        \Wargame\Battle::$forceName = ["Observer", "Austrian", "Prussian"];
     //        \Wargame\Battle::$deployName = ["Observer", "Austrian", "Prussian"];
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->cities = $data->cities;
         $this->loc = $data->loc;
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Burkersdorf\\burkersdorfVictoryCore");
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         // game data
         $this->gameRules->setMaxTurn(12);
         $this->gameRules->setInitialPhaseMode(BLUE_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = RED_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, RED_DEPLOY_PHASE, DEPLOY_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
 }
Exemplo n.º 10
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     //        $this->moveRules->noZoc = true;
     if ($data) {
         $this->specialHexA = $data->specialHexA;
         $this->specialHexB = $data->specialHexB;
     } else {
         $this->victory = new \Wargame\Victory('\\Wargame\\Mollwitz\\FreemansFarm1777\\FreemansFarm1777VictoryCore');
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->zocBlocksRetreat = true;
         // game data
         $this->gameRules->setMaxTurn(12);
         $this->gameRules->setInitialPhaseMode(BLUE_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = RED_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, RED_DEPLOY_PHASE, DEPLOY_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
     $this->moveRules->stacking = function ($mapHex, $forceId, $unit) {
         $armyGroup = false;
         if ($unit->class == "hq") {
             return false;
         }
         if ($unit->name === "sharpshooter") {
             $nUnits = 0;
             foreach ($mapHex->forces[$forceId] as $mKey => $mVal) {
                 if ($this->force->units[$mKey]->class == "hq") {
                     continue;
                 }
                 $nUnits++;
             }
             return $nUnits >= 2;
         }
         $nUnits = 0;
         $smallUnit = false;
         foreach ($mapHex->forces[$forceId] as $mKey => $mVal) {
             if ($this->force->units[$mKey]->class == "hq") {
                 continue;
             }
             if ($this->force->units[$mKey]->name == "sharpshooter") {
                 $smallUnit = true;
             }
             $nUnits++;
         }
         if ($smallUnit) {
             return $nUnits >= 2;
         }
         return $nUnits >= 1;
     };
 }
Exemplo n.º 11
0
 function __construct($data = null, $arg = false, $scenario = false, $game = false)
 {
     parent::__construct($data, $arg, $scenario, $game);
     if ($data) {
         $this->specialHexA = $data->specialHexA;
         $this->specialHexB = $data->specialHexB;
         if ($data->pontoons) {
             $this->pontoons = $data->pontoons;
             foreach ($this->pontoons as $pontoon) {
                 if (isset($this->terrain) && is_object($this->terrain) && method_exists($this->terrain, 'changeTerrain')) {
                     $this->terrain->changeTerrain($pontoon, HEXAGON_CENTER, "clear");
                 }
             }
         }
     } else {
         $this->victory = new \Wargame\Victory("\\Wargame\\Mollwitz\\Germantown1777\\germantown1777VictoryCore");
         $this->mapData->blocksZoc->blocked = true;
         $this->mapData->blocksZoc->blocksnonroad = true;
         $this->moveRules->enterZoc = "stop";
         $this->moveRules->exitZoc = "stop";
         $this->moveRules->noZocZoc = true;
         $this->moveRules->zocBlocksRetreat = true;
         $this->moveRules->oneHex = false;
         // game data
         $this->gameRules->setMaxTurn(12);
         $this->gameRules->setInitialPhaseMode(RED_DEPLOY_PHASE, DEPLOY_MODE);
         $this->gameRules->attackingForceId = RED_FORCE;
         /* object oriented! */
         $this->gameRules->defendingForceId = BLUE_FORCE;
         /* object oriented! */
         $this->force->setAttackingForceId($this->gameRules->attackingForceId);
         /* so object oriented */
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_DEPLOY_PHASE, DEPLOY_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(RED_DEPLOY_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         //            $this->gameRules->addPhaseChange(BLUE_REPLACEMENT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_MOVE_PHASE, BLUE_COMBAT_PHASE, COMBAT_SETUP_MODE, BLUE_FORCE, RED_FORCE, false);
         $this->gameRules->addPhaseChange(BLUE_COMBAT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         //            $this->gameRules->addPhaseChange(RED_REPLACEMENT_PHASE, RED_MOVE_PHASE, MOVING_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_MOVE_PHASE, RED_COMBAT_PHASE, COMBAT_SETUP_MODE, RED_FORCE, BLUE_FORCE, false);
         $this->gameRules->addPhaseChange(RED_COMBAT_PHASE, BLUE_MOVE_PHASE, MOVING_MODE, BLUE_FORCE, RED_FORCE, true);
     }
     $this->moveRules->stacking = function ($mapHex, $forceId, $unit) {
         $armyGroup = false;
         if ($unit->class == "hq") {
             return false;
         }
         if ($unit->name === "sharpshooter") {
             $nUnits = 0;
             foreach ($mapHex->forces[$forceId] as $mKey => $mVal) {
                 if ($this->force->units[$mKey]->class == "hq") {
                     continue;
                 }
                 $nUnits++;
             }
             return $nUnits >= 2;
         }
         $nUnits = 0;
         $smallUnit = false;
         foreach ($mapHex->forces[$forceId] as $mKey => $mVal) {
             if ($this->force->units[$mKey]->class == "hq") {
                 continue;
             }
             if ($this->force->units[$mKey]->name == "sharpshooter") {
                 $smallUnit = true;
             }
             $nUnits++;
         }
         if ($smallUnit) {
             return $nUnits >= 2;
         }
         return $nUnits >= 1;
     };
 }