Living: Reset attack cooldown before applying post damage effects

this fixes things causing damage during post-damage calls coming back and being able to do even more damage
This commit is contained in:
Dylan K. Taylor 2018-06-22 17:47:11 +01:00
parent 6c6630d845
commit 484d34fe04

View File

@ -535,6 +535,8 @@ abstract class Living extends Entity implements Damageable{
return; return;
} }
$this->attackTime = 10; //0.5 seconds cooldown
if($source instanceof EntityDamageByEntityEvent){ if($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager(); $e = $source->getDamager();
if($source instanceof EntityDamageByChildEntityEvent){ if($source instanceof EntityDamageByChildEntityEvent){
@ -552,15 +554,12 @@ abstract class Living extends Entity implements Damageable{
} }
} }
if($this->isAlive()){ if($this->isAlive()){
$this->applyPostDamageEffects($source); $this->applyPostDamageEffects($source);
$this->doHitAnimation(); $this->doHitAnimation();
}else{ }else{
$this->startDeathAnimation(); $this->startDeathAnimation();
} }
$this->attackTime = 10; //0.5 seconds cooldown
} }
protected function doHitAnimation() : void{ protected function doHitAnimation() : void{