diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 572db9d14..9fec76077 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -68,6 +68,7 @@ use pocketmine\inventory\InventoryHolder; use pocketmine\inventory\PlayerInventory; use pocketmine\inventory\SimpleTransactionGroup; use pocketmine\inventory\StonecutterShapelessRecipe; +use pocketmine\item\Armor; use pocketmine\item\Item; use pocketmine\level\format\FullChunk; use pocketmine\level\format\LevelProvider; @@ -1982,6 +1983,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ EntityDamageEvent::MODIFIER_BASE => isset($damageTable[$item->getId()]) ? $damageTable[$item->getId()] : 1, ]; + $points = 0; if($this->distance($target) > 8){ $cancelled = true; }elseif($target instanceof Player){ @@ -1991,34 +1993,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $cancelled = true; } - $armorValues = [ - Item::LEATHER_CAP => 1, - Item::LEATHER_TUNIC => 3, - Item::LEATHER_PANTS => 2, - Item::LEATHER_BOOTS => 1, - Item::CHAIN_HELMET => 1, - Item::CHAIN_CHESTPLATE => 5, - Item::CHAIN_LEGGINGS => 4, - Item::CHAIN_BOOTS => 1, - Item::GOLD_HELMET => 1, - Item::GOLD_CHESTPLATE => 5, - Item::GOLD_LEGGINGS => 3, - Item::GOLD_BOOTS => 1, - Item::IRON_HELMET => 2, - Item::IRON_CHESTPLATE => 6, - Item::IRON_LEGGINGS => 5, - Item::IRON_BOOTS => 2, - Item::DIAMOND_HELMET => 3, - Item::DIAMOND_CHESTPLATE => 8, - Item::DIAMOND_LEGGINGS => 6, - Item::DIAMOND_BOOTS => 3, - ]; - $points = 0; - foreach($target->getInventory()->getArmorContents() as $index => $i){ - if(isset($armorValues[$i->getId()])){ - $points += $armorValues[$i->getId()]; - } - } + $points = $target->getInventory()->getArmorPoints(); $damage[EntityDamageEvent::MODIFIER_ARMOR] = -floor($damage[EntityDamageEvent::MODIFIER_BASE] * $points * 0.04); } @@ -2046,7 +2021,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ } } - break; case ProtocolInfo::ANIMATE_PACKET: if($this->spawned === false or $this->dead === true){ @@ -2684,8 +2658,24 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ parent::attack($damage, $source); - if($source instanceof EntityDamageEvent and $source->isCancelled()){ - return; + if($source instanceof EntityDamageEvent){ + if($source->isCancelled()){ + return; + } + if($source->getDamage(EntityDamageEvent::MODIFIER_ARMOR) > 0){ + for($i = 0; $i < 4; $i++){ + $piece = $this->getInventory()->getArmorItem($i); + if($piece instanceof Armor){ + $damage = $piece->getDamage(); + if($damage >= $piece->getMaxDurability()){ + $this->getInventory()->setArmorItem($i, Item::get(Item::AIR)); + }else{ + $piece->setDamage($damage + 1); + $this->getInventory()->setArmorItem($i, $piece); + } + } + } + } } if($this->getLastDamageCause() === $source){ @@ -2694,6 +2684,8 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $pk->event = 2; $this->dataPacket($pk); } + + } public function getData(){ //TODO diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index 54dec6193..2f8426eda 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -25,6 +25,8 @@ use pocketmine\entity\Entity; use pocketmine\event\block\BlockGrowEvent; use pocketmine\event\entity\EntityDamageByBlockEvent; use pocketmine\event\entity\EntityDamageEvent; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\item\Item; use pocketmine\level\Level; use pocketmine\math\AxisAlignedBB; @@ -65,7 +67,14 @@ class Cactus extends Transparent{ } public function onEntityCollide(Entity $entity){ - $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, 1); + $damage = [EntityDamageEvent::MODIFIER_BASE => 1]; + if($entity instanceof InventoryHolder){ + $inventory = $entity->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } + } + $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, $damage); $entity->attack($ev->getFinalDamage(), $ev); } @@ -128,4 +137,4 @@ class Cactus extends Transparent{ [$this->id, 0, 1], ]; } -} \ No newline at end of file +} diff --git a/src/pocketmine/block/Fire.php b/src/pocketmine/block/Fire.php index 28eb20635..89767345c 100644 --- a/src/pocketmine/block/Fire.php +++ b/src/pocketmine/block/Fire.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -25,6 +25,8 @@ use pocketmine\entity\Entity; use pocketmine\event\entity\EntityCombustByBlockEvent; use pocketmine\event\entity\EntityDamageByBlockEvent; use pocketmine\event\entity\EntityDamageEvent; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\item\Item; use pocketmine\level\Level; use pocketmine\Server; @@ -58,7 +60,14 @@ class Fire extends Flowable{ } public function onEntityCollide(Entity $entity){ - $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1); + $damage = [EntityDamageEvent::MODIFIER_BASE => 1]; + if($entity instanceof InventoryHolder){ + $inventory = $entity->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } + } + $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, $damage); $entity->attack($ev->getFinalDamage(), $ev); $ev = new EntityCombustByBlockEvent($this, $entity, 8); @@ -94,4 +103,4 @@ class Fire extends Flowable{ return false; } -} \ No newline at end of file +} diff --git a/src/pocketmine/block/Lava.php b/src/pocketmine/block/Lava.php index 5c1db3993..972e67432 100644 --- a/src/pocketmine/block/Lava.php +++ b/src/pocketmine/block/Lava.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -25,6 +25,8 @@ use pocketmine\entity\Entity; use pocketmine\event\entity\EntityCombustByBlockEvent; use pocketmine\event\entity\EntityDamageByBlockEvent; use pocketmine\event\entity\EntityDamageEvent; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\item\Item; use pocketmine\Player; use pocketmine\Server; @@ -51,7 +53,14 @@ class Lava extends Liquid{ public function onEntityCollide(Entity $entity){ $entity->fallDistance *= 0.5; - $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, 4); + $damage = [EntityDamageEvent::MODIFIER_BASE => 1]; + if($entity instanceof InventoryHolder){ + $inventory = $entity->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } + } + $ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, $damage); $entity->attack($ev->getFinalDamage(), $ev); $ev = new EntityCombustByBlockEvent($this, $entity, 15); diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 0e72eb431..8e6228cb7 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -33,6 +33,8 @@ use pocketmine\event\entity\EntityRegainHealthEvent; use pocketmine\event\entity\EntitySpawnEvent; use pocketmine\event\entity\EntityTeleportEvent; use pocketmine\event\Timings; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\level\format\Chunk; use pocketmine\level\format\FullChunk; use pocketmine\level\Level; @@ -735,6 +737,13 @@ abstract class Entity extends Location implements Metadatable{ public function fall($fallDistance){ $damage = floor($fallDistance - 3); if($damage > 0){ + $damage = [EntityDamageEvent::MODIFIER_BASE => $damage]; + if($this instanceof InventoryHolder){ + $inventory = $this->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } + } $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FALL, $damage); $this->attack($ev->getFinalDamage(), $ev); } diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index c6714acb2..334b4c01e 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -28,6 +28,8 @@ use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityDeathEvent; use pocketmine\event\entity\EntityRegainHealthEvent; use pocketmine\event\Timings; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\item\Item as ItemItem; use pocketmine\math\Vector3; use pocketmine\nbt\tag\Short; @@ -168,7 +170,14 @@ abstract class Living extends Entity implements Damageable{ if($this->dead !== true and $this->isInsideOfSolid()){ $hasUpdate = true; - $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1); + $damage = [EntityDamageEvent::MODIFIER_BASE => 1]; + if($this instanceof InventoryHolder){ + $inventory = $this->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory; + } + } + $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, $damage); $this->attack($ev->getFinalDamage(), $ev); } @@ -178,7 +187,14 @@ abstract class Living extends Entity implements Damageable{ if($this->airTicks <= -20){ $this->airTicks = 0; - $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_DROWNING, 2); + $damage = [EntityDamageEvent::MODIFIER_BASE => 2]; + if($this instanceof InventoryHolder){ + $inventory = $this->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } + } + $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_DROWNING, $damage); $this->attack($ev->getFinalDamage(), $ev); } }else{ diff --git a/src/pocketmine/entity/Projectile.php b/src/pocketmine/entity/Projectile.php index c155f7b73..83649028f 100644 --- a/src/pocketmine/entity/Projectile.php +++ b/src/pocketmine/entity/Projectile.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -24,10 +24,11 @@ namespace pocketmine\entity; use pocketmine\event\entity\EntityCombustByEntityEvent; use pocketmine\event\entity\EntityDamageByChildEntityEvent; -use pocketmine\event\entity\EntityDamageByEntityEvent; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityRegainHealthEvent; use pocketmine\event\entity\ProjectileHitEvent; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\level\MovingObjectPosition; use pocketmine\math\Vector3; use pocketmine\nbt\tag\Short; @@ -136,15 +137,22 @@ abstract class Projectile extends Entity{ $this->server->getPluginManager()->callEvent(new ProjectileHitEvent($this)); $motion = sqrt($this->motionX ** 2 + $this->motionY ** 2 + $this->motionZ ** 2); - $damage = ceil($motion * $this->damage); - - if($this->shootingEntity === null){ - $ev = new EntityDamageByEntityEvent($this, $movingObjectPosition->entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage); - }else{ - $ev = new EntityDamageByChildEntityEvent($this->shootingEntity, $this, $movingObjectPosition->entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage); + $damage = [EntityDamageEvent::MODIFIER_BASE => ceil($motion * $this->damage)]; + $hit = $movingObjectPosition->entityHit; + if($hit instanceof InventoryHolder){ + $inventory = $hit->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } } - $movingObjectPosition->entityHit->attack($ev->getFinalDamage(), $ev); + if($this->shootingEntity === null){ + $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_PROJECTILE, $damage); + }else{ + $ev = new EntityDamageByChildEntityEvent($this->shootingEntity, $this, $hit, EntityDamageEvent::CAUSE_PROJECTILE, $damage); + } + + $hit->attack($ev->getFinalDamage(), $ev); if($this->fireTicks > 0){ @@ -188,4 +196,4 @@ abstract class Projectile extends Entity{ return $hasUpdate; } -} \ No newline at end of file +} diff --git a/src/pocketmine/event/entity/EntityDamageByBlockEvent.php b/src/pocketmine/event/entity/EntityDamageByBlockEvent.php index bb4075d76..acb3c3175 100644 --- a/src/pocketmine/event/entity/EntityDamageByBlockEvent.php +++ b/src/pocketmine/event/entity/EntityDamageByBlockEvent.php @@ -49,4 +49,4 @@ class EntityDamageByBlockEvent extends EntityDamageEvent{ } -} \ No newline at end of file +} diff --git a/src/pocketmine/inventory/PlayerInventory.php b/src/pocketmine/inventory/PlayerInventory.php index 83cc156ec..3e48dc96d 100644 --- a/src/pocketmine/inventory/PlayerInventory.php +++ b/src/pocketmine/inventory/PlayerInventory.php @@ -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(); } -} \ No newline at end of file +} diff --git a/src/pocketmine/item/Armor.php b/src/pocketmine/item/Armor.php index af5264fbf..e11fbe219 100644 --- a/src/pocketmine/item/Armor.php +++ b/src/pocketmine/item/Armor.php @@ -27,4 +27,8 @@ abstract class Armor extends Item{ public function getMaxStackSize(){ return 1; } -} \ No newline at end of file + /** + * @return int + */ + public abstract function getArmorPoints(); +} diff --git a/src/pocketmine/item/ChainBoots.php b/src/pocketmine/item/ChainBoots.php index bd5cc6a2b..eca96ca5d 100644 --- a/src/pocketmine/item/ChainBoots.php +++ b/src/pocketmine/item/ChainBoots.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class ChainBoots extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::CHAIN_BOOTS, $meta, $count, "Chainmail Boots"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 1; + } + public function getMaxDurability(){ + return 196; + } +} diff --git a/src/pocketmine/item/ChainChestplate.php b/src/pocketmine/item/ChainChestplate.php index 6037ef957..20668e180 100644 --- a/src/pocketmine/item/ChainChestplate.php +++ b/src/pocketmine/item/ChainChestplate.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class ChainChestplate extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::CHAIN_CHESTPLATE, $meta, $count, "Chain Chestplate"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 5; + } + public function getMaxDurability(){ + return 241; + } +} diff --git a/src/pocketmine/item/ChainHelmet.php b/src/pocketmine/item/ChainHelmet.php index 3455ab088..36f8898a4 100644 --- a/src/pocketmine/item/ChainHelmet.php +++ b/src/pocketmine/item/ChainHelmet.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class ChainHelmet extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::CHAIN_HELMET, $meta, $count, "Chainmail Helmet"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 2; + } + public function getMaxDurability(){ + return 166; + } +} diff --git a/src/pocketmine/item/ChainLeggings.php b/src/pocketmine/item/ChainLeggings.php index b005c7aff..53e98addf 100644 --- a/src/pocketmine/item/ChainLeggings.php +++ b/src/pocketmine/item/ChainLeggings.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class ChainLeggings extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::CHAIN_LEGGINGS, $meta, $count, "Chain Leggings"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 3; + } + public function getMaxDurability(){ + return 226; + } +} diff --git a/src/pocketmine/item/DiamondBoots.php b/src/pocketmine/item/DiamondBoots.php index cabd1d6a7..3b2f031da 100644 --- a/src/pocketmine/item/DiamondBoots.php +++ b/src/pocketmine/item/DiamondBoots.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class DiamondBoots extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::DIAMOND_BOOTS, $meta, $count, "Diamond Boots"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 3; + } + public function getMaxDurability(){ + return 430; + } +} diff --git a/src/pocketmine/item/DiamondChestplate.php b/src/pocketmine/item/DiamondChestplate.php index 61e3e1659..080f9d6da 100644 --- a/src/pocketmine/item/DiamondChestplate.php +++ b/src/pocketmine/item/DiamondChestplate.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class DiamondChestplate extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::DIAMOND_CHESTPLATE, $meta, $count, "Diamond Chestplate"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 8; + } + public function getMaxDurability(){ + return 529; + } +} diff --git a/src/pocketmine/item/DiamondHelmet.php b/src/pocketmine/item/DiamondHelmet.php index d884b2ae9..cd42dd712 100644 --- a/src/pocketmine/item/DiamondHelmet.php +++ b/src/pocketmine/item/DiamondHelmet.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class DiamondHelmet extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::DIAMOND_HELMET, $meta, $count, "Diamond Helmet"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 3; + } + public function getMaxDurability(){ + return 364; + } +} diff --git a/src/pocketmine/item/DiamondLeggings.php b/src/pocketmine/item/DiamondLeggings.php index abb772376..5aab5e97b 100644 --- a/src/pocketmine/item/DiamondLeggings.php +++ b/src/pocketmine/item/DiamondLeggings.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class DiamondLeggings extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::DIAMOND_LEGGINGS, $meta, $count, "Diamond Leggings"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 6; + } + public function getMaxDurability(){ + return 496; + } +} diff --git a/src/pocketmine/item/GoldBoots.php b/src/pocketmine/item/GoldBoots.php index 7f10dd509..17677ff5b 100644 --- a/src/pocketmine/item/GoldBoots.php +++ b/src/pocketmine/item/GoldBoots.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class GoldBoots extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::GOLD_BOOTS, $meta, $count, "Gold Boots"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 1; + } + public function getMaxDurability(){ + return 92; + } +} diff --git a/src/pocketmine/item/GoldChestplate.php b/src/pocketmine/item/GoldChestplate.php index 262994965..d6051d74e 100644 --- a/src/pocketmine/item/GoldChestplate.php +++ b/src/pocketmine/item/GoldChestplate.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class GoldChestplate extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::GOLD_CHESTPLATE, $meta, $count, "Gold Chestplate"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 5; + } + public function getMaxDurability(){ + return 113; + } +} diff --git a/src/pocketmine/item/GoldHelmet.php b/src/pocketmine/item/GoldHelmet.php index e54d1b44a..9255a886e 100644 --- a/src/pocketmine/item/GoldHelmet.php +++ b/src/pocketmine/item/GoldHelmet.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class GoldHelmet extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::GOLD_HELMET, $meta, $count, "Gold Helmet"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 2; + } + public function getMaxDurability(){ + return 78; + } +} diff --git a/src/pocketmine/item/GoldLeggings.php b/src/pocketmine/item/GoldLeggings.php index f7eabe43e..439c62635 100644 --- a/src/pocketmine/item/GoldLeggings.php +++ b/src/pocketmine/item/GoldLeggings.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class GoldLeggings extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::GOLD_LEGGINGS, $meta, $count, "Gold Leggings"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 3; + } + public function getMaxDurability(){ + return 106; + } +} diff --git a/src/pocketmine/item/IronBoots.php b/src/pocketmine/item/IronBoots.php index 370bd635e..2bcb03090 100644 --- a/src/pocketmine/item/IronBoots.php +++ b/src/pocketmine/item/IronBoots.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class IronBoots extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::IRON_BOOTS, $meta, $count, "Iron Boots"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 2; + } + public function getMaxDurability(){ + return 196; + } +} diff --git a/src/pocketmine/item/IronChestplate.php b/src/pocketmine/item/IronChestplate.php index 1a485229a..55e13a3b7 100644 --- a/src/pocketmine/item/IronChestplate.php +++ b/src/pocketmine/item/IronChestplate.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class IronChestplate extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::IRON_CHESTPLATE, $meta, $count, "Iron Chestplate"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 6; + } + public function getMaxDurability(){ + return 241; + } +} diff --git a/src/pocketmine/item/IronHelmet.php b/src/pocketmine/item/IronHelmet.php index eb1fbbd0f..3848f5ce4 100644 --- a/src/pocketmine/item/IronHelmet.php +++ b/src/pocketmine/item/IronHelmet.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class IronHelmet extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::IRON_HELMET, $meta, $count, "Iron Helmet"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 2; + } + public function getMaxDurability(){ + return 166; + } +} diff --git a/src/pocketmine/item/IronLeggings.php b/src/pocketmine/item/IronLeggings.php index 5d99d1d20..211a27697 100644 --- a/src/pocketmine/item/IronLeggings.php +++ b/src/pocketmine/item/IronLeggings.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class IronLeggings extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::IRON_LEGGINGS, $meta, $count, "Iron Leggings"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 5; + } + public function getMaxDurability(){ + return 226; + } +} diff --git a/src/pocketmine/item/LeatherBoots.php b/src/pocketmine/item/LeatherBoots.php index 2a7b1816c..a72656c28 100644 --- a/src/pocketmine/item/LeatherBoots.php +++ b/src/pocketmine/item/LeatherBoots.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class LeatherBoots extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::LEATHER_BOOTS, $meta, $count, "Leather Boots"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 1; + } + public function getMaxDurability(){ + return 66; + } +} diff --git a/src/pocketmine/item/LeatherCap.php b/src/pocketmine/item/LeatherCap.php index 4179b7725..c3ff7392a 100644 --- a/src/pocketmine/item/LeatherCap.php +++ b/src/pocketmine/item/LeatherCap.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class LeatherCap extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::LEATHER_CAP, $meta, $count, "Leather Cap"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 1; + } + public function getMaxDurability(){ + return 56; + } +} diff --git a/src/pocketmine/item/LeatherPants.php b/src/pocketmine/item/LeatherPants.php index 98e65c09e..3c300c3e0 100644 --- a/src/pocketmine/item/LeatherPants.php +++ b/src/pocketmine/item/LeatherPants.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class LeatherPants extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::LEATHER_PANTS, $meta, $count, "Leather Pants"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 2; + } + public function getMaxDurability(){ + return 76; + } +} diff --git a/src/pocketmine/item/LeatherTunic.php b/src/pocketmine/item/LeatherTunic.php index af4d18259..4c9d47c69 100644 --- a/src/pocketmine/item/LeatherTunic.php +++ b/src/pocketmine/item/LeatherTunic.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -26,4 +26,10 @@ class LeatherTunic extends Armor{ public function __construct($meta = 0, $count = 1){ parent::__construct(self::LEATHER_TUNIC, $meta, $count, "Leather Tunic"); } -} \ No newline at end of file + public function getArmorPoints(){ + return 3; + } + public function getMaxDurability(){ + return 81; + } +} diff --git a/src/pocketmine/level/Explosion.php b/src/pocketmine/level/Explosion.php index c2c4603ad..a3608dda2 100644 --- a/src/pocketmine/level/Explosion.php +++ b/src/pocketmine/level/Explosion.php @@ -2,11 +2,11 @@ /* * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,7 +15,7 @@ * * @author PocketMine Team * @link http://www.pocketmine.net/ - * + * * */ @@ -27,6 +27,8 @@ use pocketmine\event\entity\EntityDamageByBlockEvent; use pocketmine\event\entity\EntityDamageByEntityEvent; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityExplodeEvent; +use pocketmine\inventory\InventoryHolder; +use pocketmine\inventory\PlayerInventory; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Math; @@ -161,7 +163,13 @@ class Explosion{ $impact = (1 - $distance) * ($exposure = 1); - $damage = (int) ((($impact * $impact + $impact) / 2) * 8 * $explosionSize + 1); + $damage = [EntityDamageEvent::MODIFIER_BASE => (int) ((($impact * $impact + $impact) / 2) * 8 * $explosionSize + 1)]; + if($entity instanceof InventoryHolder){ + $inventory = $entity->getInventory(); + if($inventory instanceof PlayerInventory){ + $damage[EntityDamageEvent::MODIFIER_ARMOR] = $inventory->getArmorPoints(); + } + } if($this->what instanceof Entity){ $ev = new EntityDamageByEntityEvent($this->what, $entity, EntityDamageEvent::CAUSE_ENTITY_EXPLOSION, $damage);