mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
default difficulty is now 2(normal), damage will change on easy/hard difficulty
This commit is contained in:
parent
2fb69cf607
commit
093efa0f2e
5 changed files with 21 additions and 3 deletions
|
|
@ -126,7 +126,7 @@ class ServerAPI{
|
||||||
"gamemode" => SURVIVAL,
|
"gamemode" => SURVIVAL,
|
||||||
"hardcore" => false,
|
"hardcore" => false,
|
||||||
"pvp" => true,
|
"pvp" => true,
|
||||||
"difficulty" => 1,
|
"difficulty" => 2,
|
||||||
"generator-settings" => "",
|
"generator-settings" => "",
|
||||||
"level-name" => "world",
|
"level-name" => "world",
|
||||||
"level-seed" => "",
|
"level-seed" => "",
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class PocketMinecraftServer{
|
||||||
$this->handlers = [];
|
$this->handlers = [];
|
||||||
$this->invisible = false;
|
$this->invisible = false;
|
||||||
$this->levelData = false;
|
$this->levelData = false;
|
||||||
$this->difficulty = 1;
|
$this->difficulty = 2;
|
||||||
$this->tiles = [];
|
$this->tiles = [];
|
||||||
$this->entities = [];
|
$this->entities = [];
|
||||||
$this->custom = [];
|
$this->custom = [];
|
||||||
|
|
|
||||||
|
|
@ -1315,6 +1315,21 @@ 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){
|
||||||
|
switch($this->server->difficulty){
|
||||||
|
//case 0: looks like mobs also have 0 attack dmg in peaceful mode
|
||||||
|
// $dmg = 0;
|
||||||
|
// break;
|
||||||
|
case 1:
|
||||||
|
$dmg = (int)($dmg / 3) + 1;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$dmg = 3 * (int)($dmg / 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$dmg = $this->applyArmor($dmg, $cause);
|
$dmg = $this->applyArmor($dmg, $cause);
|
||||||
$ret = $this->setHealth(max(- 128, $this->getHealth() - ((int) $dmg)), $cause, $force);
|
$ret = $this->setHealth(max(- 128, $this->getHealth() - ((int) $dmg)), $cause, $force);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class Skeleton extends Monster{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttackDamage(){
|
public function getAttackDamage(){
|
||||||
return 0; //TODO special attack
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateBurning(){
|
public function updateBurning(){
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ class Spider extends Monster{
|
||||||
$this->ai->addTask(new TaskAttackPlayer(1.0, 16)); //TODO fix range?
|
$this->ai->addTask(new TaskAttackPlayer(1.0, 16)); //TODO fix range?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAttackDamage(){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
public function attackEntity($entity, $distance){
|
public function attackEntity($entity, $distance){
|
||||||
if($distance > 2.0 && $distance < 6.0){
|
if($distance > 2.0 && $distance < 6.0){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue