Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Gectou4 committed May 3, 2023
1 parent 2ead31e commit 6945d75
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AlchimieHandler extends CompetenceHandler

public function give(): void
{
// TODO FILTER if personnage know all
$this->applyRules(
[
// le personnage doit choisir 2 potions de niveau apprenti
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class LitteratureHandler extends CompetenceHandler

public function give(): void
{
// Todo filter if personnage know all of them or will reach more than exists
$this->applyRules(
[
// 2 langues communes supplémentaires de son choix
Expand Down
18 changes: 18 additions & 0 deletions src/LarpManager/Services/Manager/Competence/MagieHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,31 @@

use LarpManager\Entities\Level;
use LarpManager\Entities\PersonnageTrigger;
use LarpManager\Repository\SortRepository;

class MagieHandler extends CompetenceHandler
{
protected bool $hasBonus = true;

public function canGetBonus(): bool
{
// TODO by competence LEVEL
// Todo Domaine magie ?
$personnageNbSorts = $this->personnage->getSorts()->count();
$availableSorts = $this->app['orm.em']->getRepository('\LarpManager\Entities\Sort')->count();

// Plus de sorts à apprendre
if ($personnageNbSorts >= $availableSorts) {
return false;
}

return parent::canGetBonus();
}

public function give(): void
{
// TODO filter Domaine if Personnage know all domaine;
// TODO Filter SORT tag if Personnage know all Sort of given Level
$this->applyRules([
// le personnage doit choisir un domaine de magie et un sort de niveau 1
Level::NIVEAU_1 => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ public function give(): void
foreach ($sphere->getPrieres() as $priere) {
if (
!$this->personnage->hasPriere($priere)
&& $priere->getNiveau() === $this->competence->getLevel()->getId()
&& $priere->getNiveau() === $this->competence->getLevel()->getIndex()
) {
$priere->addPersonnage($this->personnage);
$this->personnage->addPriere($priere);
}
}
}

// TODO Filter by available

$this->applyRules(
[
Level::NIVEAU_2 => [PersonnageTrigger::TAG_PRETRISE_INITIE => 3],
Expand Down

0 comments on commit 6945d75

Please sign in to comment.