Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/tick/monsterchoiceactiontick.class.php
<?php
include_once $PATH_TO_CODE."/script/tick/allincludefortick.php";
include_once $PATH_TO_CODE."/modules/dungeon/algorithm/monsterchoiceaction.class.php";

class MonsterChoiceActionTick extends TickRunnable {
	public function getName() {
		return "Monster decision";
	}
	public function run() {
		global $gloObjectManager;
		$locMoveAlgo = $gloObjectManager->getPathFinder(500, 30, 4.0);
		$locMoveAlgo->globalReturnLastChoiceOnFailure = true;
		
		$locMonsterChoiceAction = new MonsterChoiceAction($locMoveAlgo);

		//Random to make a smaller lot and be less precise for human anticipation
		$res = executer("SELECT objectId FROM object WHERE 0.75 >= RAND() AND isBattling=0 AND IAMode <> 0 AND isLobotomize=".RealObject::$UNIT_IS_NOT_LOBOTOMIZE);
		$locObjectIdList = array();
		while($row = mysql_fetch_array($res)) {
			array_push($locObjectIdList, $row[0]);
		}
		global $gloObjectManager;
		$locObjectList = $gloObjectManager->getRealObjects($locObjectIdList);
		foreach($locObjectList as $locObject) {
			if($locObject->getFightActionPoint()*1.5 < $locObject->getFightCost()
			&& $locObject->getFightActionPoint() != $locObject->getMaxFightActionPoint()) {
				Log::info("not enough fight action point");
				continue;
			}
			if($locObject->getActionPoint() < $locObject->getMaxActionPoint()*0.25
			&& $locObject->getActionPoint() != $locObject->getMaxActionPoint()) {
				Log::info("not enough action point ".$locObject->getActionPoint()."/".$locObject->getMaxActionPoint());
				continue;
			}
			$locMonsterChoiceAction->choiceAction($locObject);
		}
	}
}
?>
Return current item: PhpBlock