コード例 #1
0
 public function save()
 {
     $ret = parent::save();
     $ret->victoryPoints = $this->victoryPoints;
     $ret->movementCache = $this->movementCache;
     $ret->gameOver = $this->gameOver;
     return $ret;
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     parent::postRecoverUnit($args);
 }
コード例 #4
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});
     }
 }
コード例 #5
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;
         }
     }
 }
コード例 #6
0
 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});
     }
 }
コード例 #7
0
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $id = $unit->id;
     if ($b->gameRules->turn === 1 && $b->gameRules->phase === BLUE_MOVE_PHASE) {
         $reserveHexes = [];
         $dZones = $b->terrain->getReinforceZonesByName('D');
         foreach ($dZones as $dZone) {
             $reserveHexes[$dZone->hexagon->name] = true;
         }
         /* this will get turned into an object */
         if (isset($reserveHexes[$unit->hexagon->name])) {
             $this->reserveDivisionIds->{$id} = true;
         }
     }
     if ($this->divisionReleased === false && $unit->status == STATUS_READY && isset($this->reserveDivisionIds->{$id})) {
         $unit->status = STATUS_UNAVAIL_THIS_PHASE;
     }
     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});
     }
 }
コード例 #8
0
 public function save()
 {
     $ret = parent::save();
     return $ret;
 }
コード例 #9
0
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     parent::postRecoverUnit($args);
     if ($this->isDemoralized) {
         if ($b->gameRules->phase == RED_COMBAT_PHASE) {
             $unit->status = STATUS_UNAVAIL_THIS_PHASE;
         }
     }
 }
コード例 #10
0
 public function postRecoverUnit($args)
 {
     $unit = $args[0];
     $b = Battle::getBattle();
     $scenario = $b->scenario;
     $id = $unit->id;
     parent::postRecoverUnit($args);
     if ($b->gameRules->mode === COMBAT_SETUP_MODE) {
         if ($unit->class === "wagon") {
             $unit->status = STATUS_UNAVAIL_THIS_PHASE;
         }
     }
 }
コード例 #11
0
 public function save()
 {
     $ret = parent::save();
     $ret->deadGuardInf = $this->deadGuardInf;
     return $ret;
 }