mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-19 01:16:38 +00:00
Living: don't knockback or do hurt FX when attacked during cooldown
players were switching from a weaker tool to a stronger one to get double knockback in PvP. while it's intended that we don't cancel the second attack during hit cooldown if the damage is higher (the first damage is subtracted to prevent doubling up), we don't want them to get double knockback. this behaviour now matches vanilla to the best of my observations. Come at me PvP community... I know some people are going to hate this change
This commit is contained in:
parent
be6754494f
commit
d70a7d34a7
@ -555,26 +555,33 @@ abstract class Living extends Entity{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attackTime = $source->getAttackCooldown();
|
if($this->attackTime <= 0){
|
||||||
|
//this logic only applies if the entity was cold attacked
|
||||||
|
|
||||||
if($source instanceof EntityDamageByChildEntityEvent){
|
$this->attackTime = $source->getAttackCooldown();
|
||||||
$e = $source->getChild();
|
|
||||||
if($e !== null){
|
if($source instanceof EntityDamageByChildEntityEvent){
|
||||||
$motion = $e->getMotion();
|
$e = $source->getChild();
|
||||||
$this->knockBack($motion->x, $motion->z, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
|
if($e !== null){
|
||||||
|
$motion = $e->getMotion();
|
||||||
|
$this->knockBack($motion->x, $motion->z, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
|
||||||
|
}
|
||||||
|
}elseif($source instanceof EntityDamageByEntityEvent){
|
||||||
|
$e = $source->getDamager();
|
||||||
|
if($e !== null){
|
||||||
|
$deltaX = $this->location->x - $e->location->x;
|
||||||
|
$deltaZ = $this->location->z - $e->location->z;
|
||||||
|
$this->knockBack($deltaX, $deltaZ, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}elseif($source instanceof EntityDamageByEntityEvent){
|
|
||||||
$e = $source->getDamager();
|
if($this->isAlive()){
|
||||||
if($e !== null){
|
$this->doHitAnimation();
|
||||||
$deltaX = $this->location->x - $e->location->x;
|
|
||||||
$deltaZ = $this->location->z - $e->location->z;
|
|
||||||
$this->knockBack($deltaX, $deltaZ, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->isAlive()){
|
if($this->isAlive()){
|
||||||
$this->applyPostDamageEffects($source);
|
$this->applyPostDamageEffects($source);
|
||||||
$this->doHitAnimation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user