<?php
include_once $PATH_TO_CODE."/modules/dungeon/action/abstractchangezonetype.class.php";
class BuildUnexploitedGold extends DungeonAbstractChangeZoneTypeAction {
function __construct() {
parent::__construct(DungeonConstante::$ACTION_STOP_EXPLOIT_GOLD, DungeonConstante::$ZONE_TYPE_GOLD, 0);
}
public function isOkToChange($locBlock, $locZone) {
$locManageAction = ManageAction::getInstance();
$locPlayer = $locManageAction->getPlayer();
if($locZone->zoneType != DungeonConstante::$ZONE_TYPE_GOLD_EXPLOITED) {
$locManageAction->addPlayerInfo("Target zone is not an exploited gold mine");
return false;
}
return parent::isOkToChange($locBlock, $locZone);
}
/*
public function isOkToChange($locBlock, $locZone) {
$locManageAction = ManageAction::getInstance();
$locPlayer = $locManageAction->getPlayer();
if(!((($locZone->zoneType == Constante::$ZONE_TYPE_PLAIN)
&& !$locZone->isOccuped())
|| $locZone->isHole()
|| ($locZone->zoneType == DungeonConstante::$ZONE_TYPE_STONE)
|| ($locZone->zoneType == DungeonConstante::$ZONE_TYPE_ROCK))) {
$locManageAction->addPlayerInfo("Target zone is not free (or not rock)");
return false;
}
return parent::isOkToChange($locZone, $locBlock);
/*
if($this->getZoneAndBlock($parZoneActionArray, $locZone, $locBlock)) {
if($locBlock->playerId==$locPlayer->playerId
|| ($locBlock->playerId == 0 && $locZone->atLeastOneZoneIsOwn($locPlayer->playerId, 1, 1, 1))) {
if((($locZone->zoneType == Constante::$ZONE_TYPE_PLAIN)
&& !$locZone->isOccuped())
|| $locZone->isHole()
|| ($locZone->zoneType == DungeonConstante::$ZONE_TYPE_STONE)
|| ($locZone->zoneType == DungeonConstante::$ZONE_TYPE_ROCK)) {
$this->setNewZoneType($locZone, DungeonConstante::$ZONE_TYPE_STONE, DungeonConstante::$ACTION_BUY_STONE_COST);
} else {
$locManageAction->addPlayerInfo("Target zone is not free (or not rock)");
}
} else {
$locManageAction->addPlayerInfo("You are not authorized to build here");
}
}
*/
}
?>