本文整理汇总了PHP中Wargame\Battle::getBattle方法的典型用法代码示例。如果您正苦于以下问题:PHP Battle::getBattle方法的具体用法?PHP Battle::getBattle怎么用?PHP Battle::getBattle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wargame\Battle
的用法示例。
在下文中一共展示了Battle::getBattle方法的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>";
}
}
}
示例2: 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>";
}
}
}
示例3: 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>";
}
}
}
示例4: 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>";
}
}
示例5: 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>";
}
}
}
示例6: 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;
}
}
示例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>";
}
}
示例8: 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>";
}
}
}
示例9: 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>";
}
}
}
}
示例10: 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>";
}
}
示例11: 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');
}
}
示例12: 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>";
}
}
}
}
示例13: 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>";
}
}
}
示例14: playerTurnChange
public function playerTurnChange($arg)
{
$attackingId = $arg[0];
$battle = Battle::getBattle();
$mapData = $battle->mapData;
$vp = $this->victoryPoints;
$specialHexes = $mapData->specialHexes;
$gameRules = $battle->gameRules;
if ($gameRules->phase == BLUE_MECH_PHASE || $gameRules->phase == RED_MECH_PHASE) {
$gameRules->flashMessages[] = "@hide crt";
}
if ($attackingId == REBEL_FORCE) {
$gameRules->flashMessages[] = "Rebel Player Turn";
$gameRules->replacementsAvail = 1;
}
if ($attackingId == LOYALIST_FORCE) {
$gameRules->flashMessages[] = "Loyalist Player Turn";
$gameRules->replacementsAvail = 10;
}
/*only get special VPs' at end of first Movement Phase */
$this->victoryPoints = $vp;
}
示例15: getCombatResults
function getCombatResults($Die, $index, $combat)
{
$battle = Battle::getBattle();
if ($battle->gameRules->phase == BLUE_TORP_COMBAT_PHASE || $battle->gameRules->phase == RED_TORP_COMBAT_PHASE) {
$hits = $this->crts->torpedo[$Die][$index];
$combat->hits = $hits;
switch ($hits) {
case MISS:
return MISS;
case H:
$Die = floor($this->dieSideCount * (rand() / getrandmax()));
// $Die = 0;
$combat->hitDie = $Die + 1;
$defense = $combat->unitDefenseStrength;
$col = $this->getOneHitColumn($defense);
$combat->hitCol = $col + 1;
return $this->crts->torpedoHitOne[$Die][$col];
break;
case HH:
$Die = floor($this->dieSideCount * (rand() / getrandmax()));
// $Die = 2;
$combat->hitDie = $Die + 1;
$defense = $combat->unitDefenseStrength;
$col = $this->getTwoHitColumn($defense);
$combat->hitCol = $col + 1;
return $this->crts->torpedoHitTwo[$Die][$col];
}
return MISS;
}
return $this->crts->normal[$Die][$index];
}