Location: PHPKode > scripts > RPG Ajax Creator > class/oavatar.cls.php
<?php
abstract class oavatar extends ocharacter {

	protected $aOnFightCan = array (
		'hit' => 100,
		'heal' => 50
		);

	protected $aOnMapCan = array (
		'heal' => true,
		'search' => true
		);

	public $iXP = 0;
	public $isDead = false;
	public $aTrophy = array ();

	protected function __construct ($sImage, array $aCar) {
		parent :: __construct ($sImage, $aCar);
	}

	public function getOnMapCan ($sAbility = null) {
		if (is_array ($this -> aOnMapCan) && !empty ($this -> aOnMapCan)) {
			if (is_null ($sAbility)) {
				return array_keys ($this -> aOnMapCan);
			} else {
				if (array_key_exists ($sAbility, $this -> aOnMapCan) && $this -> aOnMapCan[$sAbility] === true) {
					return true;
				} else {
					return false;
				}
			}
		} else {
			return false;
		}
	}

	public function isHit ($pv) {
		$this -> aCar['pv'] -= $pv;
		if ($this -> aCar['pv'] <= 0) {
			$this -> isDead = true;
		}
	}

	public function xpGain ($xp) {
		$this -> iXP += $xp;
	}

	public function setTrophies ($sName) {
		if (array_key_exists ($sName, $this -> aTrophy)) {
			$this -> aTrophy[$sName] += 1;
		} else {
			$this -> aTrophy[$sName] = 1;
		}
	}
}
?>
Return current item: RPG Ajax Creator