Skip to content

Commit

Permalink
Tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
solcloud committed Oct 22, 2022
1 parent 01c03b8 commit 5cb05db
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion server/src/Weapon/AmmoBasedWeapon.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ public function unEquip(): void

public function reset(): void
{
$this->reloading = false;
$this->ammo = static::magazineCapacity;
$this->ammoReserve = static::reserveAmmo;
$this->reloading = false;
$this->lastAttackTick = 0;
}

public function canAttack(int $tickId): bool
Expand Down
2 changes: 1 addition & 1 deletion server/src/Weapon/PistolGlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class PistolGlock extends AmmoBasedWeapon
public const magazineCapacity = 12;
public const reserveAmmo = 120;
public const killAward = 300;
public const fireRateMs = 35;
public const fireRateMs = 150;
public const damage = 61;
public const range = 5123;

Expand Down
2 changes: 1 addition & 1 deletion server/src/Weapon/PistolP250.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class PistolP250 extends AmmoBasedWeapon
public const magazineCapacity = 13;
public const reserveAmmo = 26;
public const killAward = 300;
public const fireRateMs = 35;
public const fireRateMs = 150;
public const damage = 61;
public const range = 5123;

Expand Down
2 changes: 1 addition & 1 deletion server/src/Weapon/PistolUsp.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class PistolUsp extends AmmoBasedWeapon
public const magazineCapacity = 12;
public const reserveAmmo = 24;
public const killAward = 300;
public const fireRateMs = 10;
public const fireRateMs = 170;
public const damage = 116;
public const range = 5123;

Expand Down
2 changes: 1 addition & 1 deletion server/src/Weapon/RifleAk.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class RifleAk extends AmmoBasedWeapon
public const reserveAmmo = 90;
public const killAward = 300;
public const runningSpeed = 215;
public const fireRateMs = 10;
public const fireRateMs = 100;
public const damage = 36;
public const armorPenetration = 77;
public const range = 250123;
Expand Down
2 changes: 1 addition & 1 deletion server/src/Weapon/RifleM4A4.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class RifleM4A4 extends AmmoBasedWeapon
public const reserveAmmo = 90;
public const killAward = 300;
public const runningSpeed = 215;
public const fireRateMs = 12;
public const fireRateMs = 90;
public const damage = 33;
public const armorPenetration = 67;
public const range = 150123;
Expand Down
13 changes: 10 additions & 3 deletions test/og/Shooting/PlayerKillTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use cs\Core\Player;
use cs\Core\Point;
use cs\Core\Setting;
use cs\Core\Util;
use cs\Core\Wall;
use cs\Enum\ArmorType;
use cs\Enum\BuyMenuItem;
Expand Down Expand Up @@ -124,19 +125,25 @@ public function testUspKillPlayerInThreeBulletsInChestWithNoKevlar(): void
$this->assertTrue($player2->isAlive());

$tickId = $game->getTickId();
$game->tick(++$tickId);
for ($i = 1; $i <= Util::millisecondsToFrames(PistolUsp::fireRateMs); $i++) {
$game->tick(++$tickId);
}
$this->assertNotNull($player2->attack());
$this->assertTrue($player1->isAlive());
$this->assertTrue($player2->isAlive());
$this->assertSame(1, $game->getRoundNumber());

$game->tick(++$tickId);
for ($i = 1; $i <= Util::millisecondsToFrames(PistolUsp::fireRateMs); $i++) {
$game->tick(++$tickId);
}
$this->assertNotNull($player2->attack());
$this->assertFalse($player1->isAlive());
$this->assertTrue($player2->isAlive());
$this->assertSame(1, $game->getRoundNumber());

$game->tick(++$tickId);
for ($i = 1; $i <= Util::millisecondsToFrames(PistolUsp::fireRateMs); $i++) {
$game->tick(++$tickId);
}
$this->assertFalse($game->getScore()->attackersIsWinning());
$this->assertSame(0, $game->getScore()->getScoreAttackers());
$this->assertSame(1, $game->getScore()->getScoreDefenders());
Expand Down

0 comments on commit 5cb05db

Please sign in to comment.