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

class ObjectDig extends AbstractObjectAction {
    function __construct() {
        parent::__construct(DungeonConstante::$ACTION_OBJECT_DIG);
    }

    public function action($locZoneActionArray) {
        global $gloObjectManager;
        $locManageAction = ManageAction::getInstance();
        $locPlayer = $locManageAction->getPlayer();

        $locTargetObjectId= $locZoneActionArray[1];
        $locTargetZoneId = $locZoneActionArray[2];
        $locTargetZone = $gloObjectManager->getZone($locTargetZoneId);
        if($locTargetObject = $this->getObjectOfPlayer($locTargetObjectId, $locPlayer->playerId, true, true)) {
        	if($locTargetZone->isDigableForUnit($locTargetObject)) {
            	if(Zone::getRange3d($locTargetZoneId, $locTargetObject->zoneId) > 1) {
                    $locManageAction->addPlayerInfo("too far to dig at zone ". Zone::staticGetTextZoneCoord($locTargetZoneId)." with unit at ".Zone::staticGetTextZoneCoord($locTargetObject->zoneId));
                } else {
                    $locActionPoint = $locTargetObject->getActionPoint();
                    $locDigCost = $locTargetObject->getDigCost();
                    if($locActionPoint < $locDigCost) {
                        $locManageAction->addPlayerInfo("target object has not enough action point to dig (only $locActionPoint, $locDigCost are necessary)");
                    } else {
                        if($locTargetObject->dig($locTargetZoneId)) {
                        	$locManageAction->addPlayerInfo("dig on ". Zone::staticGetTextZoneCoord($locTargetZoneId)." is ok, new rock strengh=".$locTargetZone->getDisplayedRockStrength());
                        }
                    }
                }
	        } else {
	            $locManageAction->addPlayerInfo("no rock or stone or door to dig");
	        }
        }
    }
}



















?>
Return current item: PhpBlock