当前位置: 首页>>代码示例>>PHP>>正文


PHP Wargame\Battle类代码示例

本文整理汇总了PHP中Wargame\Battle的典型用法代码示例。如果您正苦于以下问题:PHP Battle类的具体用法?PHP Battle怎么用?PHP Battle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Battle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == AUSTRIAN_FORCE) {
             $this->victoryPoints[AUSTRIAN_FORCE] += 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>+10 Austrian vp</span>";
         }
         if ($forceId == PRUSSIAN_FORCE) {
             $this->victoryPoints[AUSTRIAN_FORCE] -= 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>-10 Prussian vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == PRUSSIAN_FORCE) {
             $this->victoryPoints[PRUSSIAN_FORCE] += 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>+20 Prussian vp</span>";
         }
         if ($forceId == AUSTRIAN_FORCE) {
             $this->victoryPoints[PRUSSIAN_FORCE] -= 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>-20 Austrian vp</span>";
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:25,代码来源:kolin1757VictoryCore.php

示例2: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == ANGLO_ALLIED_FORCE) {
             $this->victoryPoints[ANGLO_ALLIED_FORCE] += 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='angloallied'>+15 Anglo Allied vp</span>";
         }
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[ANGLO_ALLIED_FORCE] -= 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>-15 Anglo Allied vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] += 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+10 French vp</span>";
         }
         if ($forceId == ANGLO_ALLIED_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] -= 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='angloallied'>-10 French vp</span>";
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:25,代码来源:oudenarde1708VictoryCore.php

示例3: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] += 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>+20 Sikh vp</span>";
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] -= 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>-20 Sikh vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB) || in_array($mapHexName, $battle->specialHexC) || in_array($mapHexName, $battle->specialHexD)) {
         $vp = 20;
         if (in_array($mapHexName, $battle->specialHexC)) {
             $vp = 10;
         }
         if (in_array($mapHexName, $battle->specialHexD)) {
             $vp = 5;
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='austrian'>+{$vp} British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>-{$vp} British vp</span>";
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:32,代码来源:moodkee1845VictoryCore.php

示例4: getPlayerData

 static function getPlayerData($scenario)
 {
     $forceName[0] = "Neutral Observer";
     $forceName[1] = "Eastern";
     $forceName[2] = "Western";
     $forceName[3] = "West German";
     $forceName[4] = "East German";
     $deployName = [0, 1, 2, 3, 4];
     return \Wargame\Battle::register($forceName, $deployName);
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:10,代码来源:FinalChapter.php

示例5: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if ($forceId == PRUSSIAN_FORCE) {
         $this->victoryPoints[PRUSSIAN_FORCE] += 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>+5 Prussian vp</span>";
     }
     if ($forceId == RUSSIAN_FORCE) {
         $this->victoryPoints[PRUSSIAN_FORCE] -= 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='russian'>-5 Prussian vp</span>";
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:13,代码来源:zorndorfVictoryCore.php

示例6: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == FRENCH_FORCE) {
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>French Control Vital Objective</span>";
         }
         if ($forceId == ALLIED_FORCE) {
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='prussian'>French Lose Vital Objective</span>";
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:13,代码来源:montmirail1814VictoryCore.php

示例7: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if ($forceId == BELUCHI_FORCE) {
         $this->victoryPoints[BELUCHI_FORCE] += 15;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>+15 Beluchis  vp</span>";
     }
     if ($forceId == BRITISH_FORCE) {
         $this->victoryPoints[BELUCHI_FORCE] -= 15;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-15 Beluchis  vp</span>";
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:13,代码来源:dubba1843VictoryCore.php

示例8: preStartMovingUnit

 public function preStartMovingUnit($arg)
 {
     /* @var unit $unit */
     list($unit) = $arg;
     /* @var Dubba1843 $battle */
     $battle = Battle::getBattle();
     $zocBlocksRetreat = !empty($battle->scenario->zocBlocksRetreat);
     if ($unit->forceId !== BRITISH_FORCE || $zocBlocksRetreat) {
         $battle->moveRules->zocBlocksRetreat = true;
     } else {
         $battle->moveRules->zocBlocksRetreat = false;
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:13,代码来源:troopersVictoryCore.php

示例9: getPlayerData

 static function getPlayerData($scenario)
 {
     $forceName = ["Neutral Observer", "IJN", "USN"];
     if (!empty($scenario->one)) {
         $forceName[1] = "RN";
         $forceName[2] = "IJN";
     }
     if (!empty($scenario->eight)) {
         $forceNname[1] = "USN";
         $forceNname[2] = "IJN";
     }
     $deployName = $forceName;
     return \Wargame\Battle::register($forceName, $deployName);
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:14,代码来源:TinCans.php

示例10: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>+10 British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= 10;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-10 British vp</span>";
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:15,代码来源:aliwal1845VictoryCore.php

示例11: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == ALLIED_FORCE) {
             $this->victoryPoints[ALLIED_FORCE] += 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>+5 Allied vp</span>";
         }
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[ALLIED_FORCE] -= 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>-5 Allied vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         $vp = 5;
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+{$vp} French vp</span>";
         }
         if ($forceId == ALLIED_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] -= $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>-{$vp} French vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexC)) {
         $vp = 5;
         $prevForceId = $battle->mapData->specialHexes->{$mapHexName};
         if ($forceId == FRENCH_FORCE) {
             $this->victoryPoints[FRENCH_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+{$vp} French vp</span>";
             if ($prevForceId !== 0) {
                 $this->victoryPoints[ALLIED_FORCE] -= $vp;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>-{$vp} Allied vp</span>";
             }
         }
         if ($forceId == ALLIED_FORCE) {
             $this->victoryPoints[ALLIED_FORCE] += $vp;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>+{$vp} Allied vp</span>";
             if ($prevForceId !== 0) {
                 $this->victoryPoints[FRENCH_FORCE] -= $vp;
                 $battle->mapData->specialHexesVictory->{$mapHexName} .= "<span class='french'>-{$vp} French vp</span>";
             }
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:46,代码来源:hastenbeckVictoryCore.php

示例12: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     list($mapHexName, $forceId) = $args;
     if ($forceId == FRENCH_FORCE && in_array($mapHexName, $battle->angloSpecialHexes)) {
         $this->victoryPoints[FRENCH_FORCE] += 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>+5 French vp</span>";
     }
     if ($forceId == ANGLO_FORCE && in_array($mapHexName, $battle->angloSpecialHexes)) {
         $this->victoryPoints[FRENCH_FORCE] -= 5;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='french'>-5 French vp</span>";
     }
     if ($forceId == ANGLO_FORCE && in_array($mapHexName, $battle->frenchSpecialHexes)) {
         $this->victoryPoints[ANGLO_FORCE] += 10;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>+10 Anglo Allied vp</span>";
     }
     if ($forceId == FRENCH_FORCE && in_array($mapHexName, $battle->frenchSpecialHexes)) {
         $this->victoryPoints[ANGLO_FORCE] -= 10;
         $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='anglo'>-10 Anglo Allied vp</span>";
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:21,代码来源:mindenVictoryCore.php

示例13: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     if (!empty($battle->scenario->dayTwo)) {
         list($mapHexName, $forceId) = $args;
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] += 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>+5 Sikh  vp</span>";
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] -= 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-5 Sikh  vp</span>";
         }
     } else {
         list($mapHexName, $forceId) = $args;
         if ($mapHexName == $battle->moodkee) {
             if ($forceId == SIKH_FORCE) {
                 $this->victoryPoints[SIKH_FORCE] += 20;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>+5 Sikh  vp</span>";
             }
             if ($forceId == BRITISH_FORCE) {
                 $this->victoryPoints[SIKH_FORCE] -= 20;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-5 Sikh  vp</span>";
             }
         } else {
             if ($forceId == BRITISH_FORCE) {
                 $this->victoryPoints[BRITISH_FORCE] += 5;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>+5 British  vp</span>";
             }
             if ($forceId == SIKH_FORCE) {
                 $this->victoryPoints[BRITISH_FORCE] -= 5;
                 $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='beluchi'>-5 British  vp</span>";
             }
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:36,代码来源:ferozeshaVictoryCore.php

示例14: unitSupplyEffects

 protected function unitSupplyEffects($unit, $goal, $bias, $supplyLen)
 {
     $b = Battle::getBattle();
     $id = $unit->id;
     if ($b->gameRules->mode == REPLACING_MODE) {
         if ($unit->status == STATUS_CAN_UPGRADE) {
             $unit->supplied = $b->moveRules->calcSupply($unit->id, $goal, $bias, $supplyLen);
             if (!$unit->supplied) {
                 /* TODO: make this not cry  (call a method) */
                 $unit->status = STATUS_STOPPED;
             }
         }
         return;
     }
     if ($unit->status == STATUS_READY || $unit->status == STATUS_UNAVAIL_THIS_PHASE) {
         $unit->supplied = $b->moveRules->calcSupply($unit->id, $goal, $bias, $supplyLen);
     } else {
         return;
     }
     if (!$unit->supplied) {
         $unit->addAdjustment('movement', 'floorHalfMovement');
     }
     if ($unit->supplied) {
         $unit->removeAdjustment('movement');
     }
     if ($unit->status == STATUS_READY || $unit->status == STATUS_DEFENDING || $unit->status == STATUS_UNAVAIL_THIS_PHASE) {
         $unit->supplied = $b->moveRules->calcSupply($unit->id, $goal, $bias, $supplyLen);
     } else {
         return;
     }
     if ((!empty($this->unsuppliedDefenderHalved) || $unit->forceId == $b->gameRules->attackingForceId) && !$unit->supplied) {
         $unit->addAdjustment('supply', 'half');
     } else {
         $unit->removeAdjustment('supply');
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:36,代码来源:ModernSupplyRules.php

示例15: specialHexChange

 public function specialHexChange($args)
 {
     $battle = \Wargame\Battle::getBattle();
     $scenario = $battle->scenario;
     list($mapHexName, $forceId) = $args;
     if (in_array($mapHexName, $battle->specialHexA)) {
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] += 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>+20 Sikh vp</span>";
         }
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[SIKH_FORCE] -= 20;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>-20 Sikh vp</span>";
         }
     }
     if (in_array($mapHexName, $battle->specialHexB)) {
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>+15 British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= 15;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>-15 British vp</span>";
         }
     }
     if (!empty($scenario->altScenario) && in_array($mapHexName, $battle->specialHexC)) {
         if ($forceId == BRITISH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] += 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='british'>+5 British vp</span>";
         }
         if ($forceId == SIKH_FORCE) {
             $this->victoryPoints[BRITISH_FORCE] -= 5;
             $battle->mapData->specialHexesVictory->{$mapHexName} = "<span class='sikh'>-5 British vp</span>";
         }
     }
 }
开发者ID:daverodal,项目名称:wargaming,代码行数:36,代码来源:goojerat1849VictoryCore.php


注:本文中的Wargame\Battle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。