fixed difficulty affecting player damage & armor for creatures

This commit is contained in:
GameHerobrine 2024-05-29 03:57:31 +03:00
parent 3a15dacf51
commit fc0f3f6bde
2 changed files with 14 additions and 13 deletions

View file

@ -44,10 +44,10 @@ abstract class Creature extends Living{
} }
public function getSpeedModifer(){ public function getSpeedModifer(){
return 0.7; //$this->speedModifer; //should be 0.7? return 0.7;
} }
public function getArmorValue(){ public function getArmorValue(){
return 2; return 0;
} }
public function spawn($player){ public function spawn($player){
if(!($player instanceof Player)){ if(!($player instanceof Player)){

View file

@ -1328,19 +1328,20 @@ class Entity extends Position
if (!$this->canBeAttacked) { if (!$this->canBeAttacked) {
return false; return false;
} }
if(is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false){ if(is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false){
if($this->attackTimeout > 0) return false; if($this->attackTimeout > 0) return false;
switch($this->server->difficulty){ if(!$entity->isPlayer()){
//case 0: looks like mobs also have 0 attack dmg in peaceful mode switch($this->server->difficulty){
// $dmg = 0; //case 0: looks like mobs also have 0 attack dmg in peaceful mode
// break; // $dmg = 0;
case 1: // break;
$dmg = (int)($dmg / 3) + 1; case 1:
break; $dmg = (int)($dmg / 3) + 1;
case 3: break;
$dmg = 3 * (int)($dmg / 2); case 3:
break; $dmg = 3 * (int)($dmg / 2);
break;
}
} }
} }