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

class ZizanySpellAction extends DungeonAbstractSpellAction {
	function __construct() {
		parent::__construct(DungeonConstante::$ACTION_ZIZANY_SPELL, DungeonConstante::$ACTION_BUY_ZIZANY_SPELL_COST, true);
	}
	protected function doAction($parZoneActionArray, $locZone, $locBlock) {
		$locManageAction = ManageAction::getInstance();
		$locPlayer = $locManageAction->getPlayer();
		global $gloObjectManager;
		$locAtLeastOneChoose=false;
		$locRes = $locBlock->getOtherAllianceObjectNear(0, 0, 0, 0);
		while($row = mysql_fetch_row($locRes)) {
			$locRealObjectId=$row[0];
			$locRealObject = $gloObjectManager->getRealObject($locRealObjectId);
			if($locRealObject->getHeroMode() == 0) {
				$locAtLeastOneChoose=true;
				if(urand() < 0.6/sqrt($locRealObject->getLevel())) {
					$locUnitKilled .= "You kill ".$locRealObject->toStringMessage()."\n";
					$locRealObject->killWithAMessage($locPlayer->playerName, "zizany spell");
				}
			}
		}
		if($locAtLeastOneChoose) {
			$locManageAction->addPlayerInfo("You spell zizany against units".(strlen($locUnitKilled)==0 ? " but without effect":"\n$locUnitKilled"));
		} else {
			$locManageAction->addPlayerInfo("No targatable unit has been found here");
		}
		return $locAtLeastOneChoose;
	}
}
?>
Return current item: PhpBlock