mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-01 07:43:03 +00:00
Effect: Added Fatal Poison effect
This is identical to normal Poison, except that it kills the victim. Parrots receive this effect when they are fed cookies.
This commit is contained in:
parent
4ae278686c
commit
f5ebfc3418
@ -55,6 +55,7 @@ class Effect{
|
|||||||
public const ABSORPTION = 22;
|
public const ABSORPTION = 22;
|
||||||
public const SATURATION = 23;
|
public const SATURATION = 23;
|
||||||
public const LEVITATION = 24; //TODO
|
public const LEVITATION = 24; //TODO
|
||||||
|
public const FATAL_POISON = 25;
|
||||||
|
|
||||||
/** @var Effect[] */
|
/** @var Effect[] */
|
||||||
protected static $effects = [];
|
protected static $effects = [];
|
||||||
@ -295,6 +296,7 @@ class Effect{
|
|||||||
public function canTick() : bool{
|
public function canTick() : bool{
|
||||||
switch($this->id){
|
switch($this->id){
|
||||||
case Effect::POISON:
|
case Effect::POISON:
|
||||||
|
case Effect::FATAL_POISON:
|
||||||
if(($interval = (25 >> $this->amplifier)) > 0){
|
if(($interval = (25 >> $this->amplifier)) > 0){
|
||||||
return ($this->duration % $interval) === 0;
|
return ($this->duration % $interval) === 0;
|
||||||
}
|
}
|
||||||
@ -332,11 +334,14 @@ class Effect{
|
|||||||
*/
|
*/
|
||||||
public function applyEffect(Entity $entity){
|
public function applyEffect(Entity $entity){
|
||||||
switch($this->id){
|
switch($this->id){
|
||||||
|
/** @noinspection PhpMissingBreakStatementInspection */
|
||||||
case Effect::POISON:
|
case Effect::POISON:
|
||||||
if($entity->getHealth() > 1){
|
if($entity->getHealth() <= 1){
|
||||||
$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 1);
|
break;
|
||||||
$entity->attack($ev);
|
|
||||||
}
|
}
|
||||||
|
case Effect::FATAL_POISON:
|
||||||
|
$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 1);
|
||||||
|
$entity->attack($ev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Effect::WITHER:
|
case Effect::WITHER:
|
||||||
|
@ -131,5 +131,11 @@
|
|||||||
"id": 24,
|
"id": 24,
|
||||||
"color": "#FFCEFFFF",
|
"color": "#FFCEFFFF",
|
||||||
"name": "levitation"
|
"name": "levitation"
|
||||||
|
},
|
||||||
|
"fatal_poison": {
|
||||||
|
"id": 25,
|
||||||
|
"color": "#FF4E9331",
|
||||||
|
"name": "poison",
|
||||||
|
"isBad": true
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user