update engine api

This commit is contained in:
openlegends 2024-03-19 18:29:47 +02:00
parent 99c9290bbb
commit feb357e1a6
3 changed files with 108 additions and 37 deletions

View File

@ -8,45 +8,12 @@ class Arena extends \OpenLegends\Engine\Abstract\Game
{ {
public function __construct() public function __construct()
{ {
$deck = new \OpenLegends\Asset\Test\Pool\Card(); $this->addPlayer(
new \OpenLegends\Asset\Test\Game\Player\Player1()
for ($i = 0; $i < 3; $i++) // generate 3 copies of each card
{
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Goblin()
);
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Mouse()
);
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Rat()
);
}
$this->setDeck(
$deck
); );
$this->setHand( $this->addPlayer(
new \OpenLegends\Asset\Test\Pool\Card() new \OpenLegends\Asset\Test\Game\Player\Player2()
);
$this->setPile(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setLeft(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setRight(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setPlayer(
new \OpenLegends\Asset\Test\Player\Elf()
); );
} }
} }

View File

@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace OpenLegends\Asset\Test\Game\Player;
class Player1 extends \OpenLegends\Engine\Abstract\Game\Player
{
public function __construct()
{
$this->setHealth(
30
);
$deck = new \OpenLegends\Asset\Test\Pool\Card();
for ($i = 0; $i < 3; $i++) // generate 3 copies of each card
{
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Goblin()
);
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Mouse()
);
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Rat()
);
}
$this->setDeck(
$deck
);
$this->setHand(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setPile(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setLeft(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setRight(
new \OpenLegends\Asset\Test\Pool\Card()
);
}
}

View File

@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace OpenLegends\Asset\Test\Game\Player;
class Player2 extends \OpenLegends\Engine\Abstract\Game\Player
{
public function __construct()
{
$this->setHealth(
30
);
$deck = new \OpenLegends\Asset\Test\Pool\Card();
for ($i = 0; $i < 3; $i++) // generate 3 copies of each card
{
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Goblin()
);
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Mouse()
);
$deck->addCard(
new \OpenLegends\Asset\Test\Card\Rat()
);
}
$this->setDeck(
$deck
);
$this->setHand(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setPile(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setLeft(
new \OpenLegends\Asset\Test\Pool\Card()
);
$this->setRight(
new \OpenLegends\Asset\Test\Pool\Card()
);
}
}