Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged

This commit is contained in:
PEMapModder
2015-03-17 20:04:59 +08:00
parent 220d2b7bee
commit 8aa8ae5094
31 changed files with 399 additions and 205 deletions

View File

@ -25,6 +25,7 @@ use pocketmine\entity\Human;
use pocketmine\event\entity\EntityArmorChangeEvent;
use pocketmine\event\entity\EntityInventoryChangeEvent;
use pocketmine\event\player\PlayerItemHeldEvent;
use pocketmine\item\Armor;
use pocketmine\item\Item;
use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\ContainerSetSlotPacket;
@ -299,6 +300,15 @@ class PlayerInventory extends BaseInventory{
return $armor;
}
public function getArmorPoints(){
$points = 0;
foreach($this->getArmorContents() as $i){
if($i instanceof Armor){
$points += $i->getArmorPoints();
}
}
return $points;
}
public function clearAll(){
$limit = $this->getSize() + 4;
for($index = 0; $index < $limit; ++$index){
@ -473,4 +483,4 @@ class PlayerInventory extends BaseInventory{
return parent::getHolder();
}
}
}