From 8805738c50f80d714c881cad4c56292d78b6d4a8 Mon Sep 17 00:00:00 2001 From: Bazsalanszky Date: Thu, 3 Jan 2019 16:59:27 +0100 Subject: [PATCH] Added construct --- src/DnDAssistant/main.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/DnDAssistant/main.php b/src/DnDAssistant/main.php index 69e0682..ca24183 100644 --- a/src/DnDAssistant/main.php +++ b/src/DnDAssistant/main.php @@ -13,7 +13,7 @@ class Entity{ private $wis; private $chr; private $align; - + public function setName(String $name){ $this->name = $name; } @@ -32,12 +32,15 @@ class Entity{ public function getAC(){ return $this->armour_class; } - + public function getCurrentHP(){ return $this->hp; } public function getMaxHP(){ - return $this->hp; + return $this->fullhp; + } + public function setMaxHP(int $hp){ + $this->fullhp = $hp; } public function restoreToFullHP(){ $this->hp = $this->fullhp; @@ -91,9 +94,22 @@ class Entity{ public function getCharisma,(){ return $this->chr; } - + public function __construct($name , $armour_class , $inisitive , $fullhp, $str , $dex , $con , $int , $wis , $chr) { + $this->setName($name); + $this->setAC($armour_class); + $this->setInisitive($inisitive); + $this->setMaxHP($fullhp); + $this->restoreToFullHP(); + $this->setStrength($str); + $this->setDexterity($dex); + $this->setConstitution($con); + $this->setInisitive($int); + $this->setWisdom($wis); + $this->setCharisma($chr); + } + } class Enemy extends Entity{ - -} \ No newline at end of file + +}