Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/action/conquerblock.class.php
<?php
include_once $PATH_TO_CODE."/modules/dungeon/action/abstractaction.class.php";

class ConquerBlock extends DungeonAbstractAction {
	function __construct() {
		parent::__construct(DungeonConstante::$ACTION_CONQUER_BLOCK);
	}

	public function action($parZoneActionArray) {
		$locManageAction = ManageAction::getInstance();
		$locPlayer = $locManageAction->getPlayer();
		if($this->getZoneAndBlock($parZoneActionArray, $locZone, $locBlock)) {
			if($locBlock->playerId == 0) {
				if($locBlock->testIsInLostOfControlForAllianceId($locPlayer->allianceId) || !($locBlock->atLeastOneUnitCanTakeControl($locPlayer->allianceId))) {
					$locManageAction->addPlayerInfo("You must have troop on this block to conquer it. If ennemies are present, you can't conquer it.");
				} else {
					$locBlock->setPlayerId($locPlayer->playerId);
				}
			} else {
				$locManageAction->addPlayerInfo("block is already own");
			}
		}
	}
}
?>
Return current item: PhpBlock