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

class KillObject extends AbstractObjectAction {
	function __construct() {
		parent::__construct(DungeonConstante::$ACTION_KILL_OBJECT);
	}

	function isObjectOfPlayerMustBeNoIA() {
		return false;
	}

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

		$locTargetObjectId = $locActionArray[1];

		if($locTargetObject = $this->getObjectOfPlayer($locTargetObjectId, $locPlayer->playerId, false, true)) {
			if(RealObject::$UNIT_IS_DEAD == $locTargetObject->isLobotomize) {
				$locManageAction->addPlayerInfo("unit is already dead");
				//FIXME : use a true flag hero !
			} else if($locTargetObject->getHeroMode() > 0) {
				$locManageAction->addPlayerInfo("you can't kill a unit that you control (e.g: heroes)");
			} else {
				$locManageAction->addPlayerInfo("you kill ".$locTargetObject->toStringMessage());
				$locTargetObject->increasePopulationDueToHumanKillAction();
			}
		}
	}
}
?>
Return current item: PhpBlock