mirror of
https://github.com/openlegends/asset-php.git
synced 2025-02-08 13:04:22 +00:00
implement heal action
This commit is contained in:
parent
d88a7966c7
commit
cc1e9f642b
36
src/Test/Card/Action/Heal.php
Normal file
36
src/Test/Card/Action/Heal.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OpenLegends\Asset\Test\Card\Action;
|
||||
|
||||
class Heal extends \OpenLegends\Engine\Abstract\Card\Action
|
||||
{
|
||||
private \OpenLegends\Engine\Abstract\Card $_card;
|
||||
|
||||
public function __construct(
|
||||
\OpenLegends\Engine\Abstract\Card $card
|
||||
) {
|
||||
$this->_card = $card;
|
||||
}
|
||||
|
||||
public function card(
|
||||
\OpenLegends\Engine\Abstract\Card &$card,
|
||||
?int $power = null
|
||||
): void
|
||||
{
|
||||
$card->setHealth(
|
||||
$card->getHealth() + ($power ? $power : $this->_card->getPower())
|
||||
);
|
||||
}
|
||||
|
||||
public function player(
|
||||
\OpenLegends\Engine\Abstract\Player &$player,
|
||||
?int $power = null
|
||||
): void
|
||||
{
|
||||
$player->setHealth(
|
||||
$player->getHealth() + ($power ? $power : $this->_card->getPower())
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user