diff --git a/src/pocketmine/entity/Effect.php b/src/pocketmine/entity/Effect.php index 67137c739..24b8edb5c 100644 --- a/src/pocketmine/entity/Effect.php +++ b/src/pocketmine/entity/Effect.php @@ -55,6 +55,7 @@ class Effect{ public const ABSORPTION = 22; public const SATURATION = 23; public const LEVITATION = 24; //TODO + public const FATAL_POISON = 25; /** @var Effect[] */ protected static $effects = []; @@ -295,6 +296,7 @@ class Effect{ public function canTick() : bool{ switch($this->id){ case Effect::POISON: + case Effect::FATAL_POISON: if(($interval = (25 >> $this->amplifier)) > 0){ return ($this->duration % $interval) === 0; } @@ -332,11 +334,14 @@ class Effect{ */ public function applyEffect(Entity $entity){ switch($this->id){ + /** @noinspection PhpMissingBreakStatementInspection */ case Effect::POISON: - if($entity->getHealth() > 1){ - $ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 1); - $entity->attack($ev); + if($entity->getHealth() <= 1){ + break; } + case Effect::FATAL_POISON: + $ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 1); + $entity->attack($ev); break; case Effect::WITHER: diff --git a/src/pocketmine/resources/effects.json b/src/pocketmine/resources/effects.json index 54a0203f1..f6ebd1764 100644 --- a/src/pocketmine/resources/effects.json +++ b/src/pocketmine/resources/effects.json @@ -131,5 +131,11 @@ "id": 24, "color": "#FFCEFFFF", "name": "levitation" + }, + "fatal_poison": { + "id": 25, + "color": "#FF4E9331", + "name": "poison", + "isBad": true } } \ No newline at end of file