Skip to content

Commit

Permalink
Support Speed levels up to 4, disable check entirely if player has sp…
Browse files Browse the repository at this point in the history
…eed 5 or higher. Slight Comat heuristics improvements
  • Loading branch information
DarkWav authored Mar 6, 2018
1 parent 2ef0c19 commit 2df0ba5
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions src/DarkWav/SAC/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ public function __construct($player, SAC $SAC)

if ($this->GetConfigEntry("Heuristics") == 1)
{
$this->dist_thr1 = 4.00;
$this->dist_thr2 = 3.75;
$this->dist_thr1 = 4.0;
$this->dist_thr2 = 3.7;
}
elseif ($this->GetConfigEntry("Heuristics") == 2)
{
$this->dist_thr1 = 3.75;
$this->dist_thr2 = 3.50;
$this->dist_thr1 = 3.7;
$this->dist_thr2 = 3.5;
}
elseif ($this->GetConfigEntry("Heuristics") == 3)
{
$this->dist_thr1 = 3.50;
$this->dist_thr2 = 3.25;
$this->dist_thr1 = 3.5;
$this->dist_thr2 = 3.2;
}
else
{
Expand All @@ -105,11 +105,11 @@ public function __construct($player, SAC $SAC)
}
if ($this->GetConfigEntry("DeepHeuristics") == 1)
{
$this->dist_thr3 = 4.125;
$this->dist_thr3 = 4.1;
}
elseif ($this->GetConfigEntry("DeepHeuristics") == 2)
{
$this->dist_thr3 = 3.825;
$this->dist_thr3 = 3.8;
}
else
{
Expand Down Expand Up @@ -482,7 +482,7 @@ public function CheckSpeedFlyGlide($event)
if ($this->Player->hasEffect(Effect::SPEED))
{
$this->SpeedAMP = $this->Player->getEffect(Effect::SPEED)->getAmplifier();
if ($this->SpeedAMP < 3)
if ($this->SpeedAMP < 3) # Speed 1 and 2
{
if ($this->x_speed > 10)
{
Expand All @@ -499,9 +499,34 @@ public function CheckSpeedFlyGlide($event)
}
}
}
elseif ($this->SpeedAMP == 3 or $this->SpeedAMP == 4) # Speed 3 and 4
{
if ($this->x_speed > 11.5)
{
if (($tick - $this->LastDamageTick) > 30) # deactivate 1.5 seconds after receiving damage
{
$this->PlayerSpeedCounter += 10;
}
}
else
{
if ($this->PlayerSpeedCounter > 0)
{
$this->PlayerSpeedCounter--;
}
}
}
elseif ($this->SpeedAMP > 4) #Speed 5 and higher
{
$this->PlayerSpeedCounter++; # do nothing
$this->PlayerSpeedCounter--; # do nothing
}
else
{
$this->PlayerSpeedCounter--;
if ($this->PlayerSpeedCounter > 0)
{
$this->PlayerSpeedCounter--;
}
}
}
elseif ($this->x_speed > 8.5)
Expand Down Expand Up @@ -1119,4 +1144,4 @@ public function onTeleport($event)
// SAC by DarkWav. //
// Distributed under the GGPL License. //
// //
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////

0 comments on commit 2df0ba5

Please sign in to comment.