Fixes BattleEvents to accept correct game

This commit is contained in:
Vassyli
2017-09-27 11:59:14 +02:00
parent 94763f8d6e
commit 829d63d7f6
11 changed files with 21 additions and 22 deletions
+2 -20
View File
@@ -16,11 +16,7 @@ use LotGD\Core\{
Models\FighterInterface
};
use LotGD\Core\Models\{
Buff,
BattleEvents\BuffMessageEvent,
BattleEvents\CriticalHitEvent,
BattleEvents\DamageEvent,
BattleEvents\DeathEvent
Buff, BattleEvents\BuffMessageEvent, BattleEvents\CriticalHitEvent, BattleEvents\DamageEvent, BattleEvents\DeathEvent, Scene
};
/**
@@ -102,23 +98,9 @@ class Battle
return $battle;
}
/**
* @ToDo Returns at some point battle actions
*/
public function getActions()
{
}
/**
* @ToDo Do some action
*/
public function selectAction()
{
}
/**
* Returns a list of all battle events
* @return \LotGD\Core\Collection
* @return Collection
*/
public function getEvents(): Collection
{
+1
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Exceptions\BattleEventException;
use LotGD\Core\Game;
/**
* A representation of something that happened in battle.
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Exceptions\BattleEventException;
use LotGD\Core\Game;
/**
* A battle event representing a message generated by a buff.
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
+1
View File
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
+1
View File
@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Exceptions\BattleEventException;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
@@ -39,7 +40,7 @@ class MinionDamageEvent extends BattleEvent
*/
public function decorate(Game $game): string
{
parent::decorate();
parent::decorate($game);
return str_replace(
[
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LotGD\Core\Models\BattleEvents;
use LotGD\Core\Exceptions\BattleEventException;
use LotGD\Core\Game;
use LotGD\Core\Models\FighterInterface;
/**
@@ -44,7 +45,7 @@ class RegenerationBuffEvent extends BattleEvent
*/
public function decorate(Game $game): string
{
parent::decorate();
parent::decorate($game);
if ($this->regeneration === 0) {
return str_replace(
+8
View File
@@ -85,6 +85,10 @@ class BattleTest extends CoreModelTestCase
if ($battle->isOver()) {
break;
}
foreach ($battle->getEvents() as $event) {
$this->assertNotNull($event->decorate($this->getMockGame($character)));
}
}
$this->assertTrue($battle->isOver());
@@ -113,6 +117,10 @@ class BattleTest extends CoreModelTestCase
break;
}
foreach ($battle->getEvents() as $event) {
$this->assertNotNull($event->decorate($this->getMockGame($character)));
}
$battle = $battle->serialize();
}