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

class BuildRock extends DungeonAbstractChangeZoneTypeAction {
    function __construct() {
        parent::__construct(DungeonConstante::$ACTION_BUILD_ROCK, DungeonConstante::$ZONE_TYPE_ROCK, DungeonConstante::$ACTION_BUY_ROCK_COST, true);
    }
    
    public function isOkToChange($locBlock, $locZone) {
        $locManageAction = ManageAction::getInstance();
        $locPlayer = $locManageAction->getPlayer();

        if(!(((
        		$locZone->zoneType == Constante::$ZONE_TYPE_PLAIN
        	||$locZone->zoneType == DungeonConstante::$ZONE_TYPE_ROAD
        	||$locZone->zoneType == DungeonConstante::$ZONE_TYPE_DOOR
        	||$locZone->zoneType == DungeonConstante::$ZONE_TYPE_STAIR
        	)
                && !$locZone->isOccuped())
                || ($locZone->zoneType == DungeonConstante::$ZONE_TYPE_STONE)
                || ($locZone->zoneType == DungeonConstante::$ZONE_TYPE_ROCK))) {
            $locManageAction->addPlayerInfo("Target zone is not plain, road, door, stone or stair");
            return false;
        }
        
        if($locZone->zoneType == DungeonConstante::$ZONE_TYPE_ROCK
        	&& $locZone->getDig() == 0) {
        	$locManageAction->addPlayerInfo("Target zone is already a rock");
        	return false;
        }
        
        return parent::isOkToChange($locBlock, $locZone);
    }
}
?>
Return current item: PhpBlock