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

class LavaSpellAction extends DungeonAbstractSpellAction {
	function __construct() {
		parent::__construct(DungeonConstante::$ACTION_LAVA_SPELL, DungeonConstante::$ACTION_BUY_LAVA_SPELL_COST, true);
	}
	protected function doAction($parZoneActionArray, $locZone, $locBlock) {
		$locAtLeastOneChoose=false;
		$locManageAction = ManageAction::getInstance();
		$locPlayer = $locManageAction->getPlayer();
		global $gloObjectManager;
		$res=executer("SELECT zoneId FROM zone WHERE population > 0 AND blockId=$locBlock->blockId  ORDER BY RAND() LIMIT 5");
		while($row=mysql_fetch_array($res)) {
			$locZone = $gloObjectManager->getZone($row[0]);
			$locZone->setPopulation($locZone->getPopulation()-0.2*DungeonConstante::$MAX_POPULATION_PER_ZONE);
			$locAtLeastOneChoose=true;
		}
		$locArrayOfRealObjectId = $locBlock->getAllRealObjectId();
		foreach($locArrayOfRealObjectId as $locRealObjectId) {
			$locRealObject = $gloObjectManager->getRealObject($locRealObjectId);
			if($locRealObject->getIAMode() > 0) {
				$locDamage = 2;
				if($locRealObject->getHeroMode() == 0) {
					$locAtLeastOneChoose=true;
				} else {
					if($locRealObject->getLife() > $locRealObject->getMaxLife()/3) {
						$locDamage = 1;
					} else {
						$locDamage = 0;
					}
				}
				$locDamage += $locRealObject->getShield();
				$locRealObject->damage(false, $locDamage, $locPlayer->playerName, "lava spell");
			}
		}
		if($locAtLeastOneChoose) {
			$locManageAction->addPlayerInfo("You spell lava against units and population");
		} else {
			$locManageAction->addPlayerInfo("No targatable unit or population has been found here");
		}
		return true;
	}
}
?>
Return current item: PhpBlock