for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace AardsGerds\Game\Entity\Human;
use AardsGerds\Game\Build\Attribute\Health;
use AardsGerds\Game\Build\Attribute\Strength;
use AardsGerds\Game\Build\Talent\TalentCollection;
use AardsGerds\Game\Build\Talent\WeaponMastery\WeaponMasteryLevel;
use AardsGerds\Game\Inventory\Weapon\Weapon;
use AardsGerds\Game\Fight\Fighter;
abstract class Human implements Fighter
{
public function __construct(
protected string $name,
protected Health $health,
protected Strength $strength,
protected TalentCollection $talentCollection,
protected ?Weapon $weapon,
) {}
public function getHealth(): Health
return $this->health;
}
public function getStrength(): Strength
return $this->strength;
public function getWeaponMasteryLevel(): WeaponMasteryLevel
if ($this->weapon === null) {
return WeaponMasteryLevel::inexperienced();
$weaponMastery = $this->talentCollection->findWeaponMasteryForWeaponType($this->weapon->getType());
if ($weaponMastery === null) {
return $weaponMastery->getLevel();
public function getWeapon(): ?Weapon
return $this->weapon;