test: cover scenario to match flow with ability and objective
This commit is contained in:
@@ -6,6 +6,7 @@ namespace BattleForge\Tests\Unit\Domain;
|
||||
|
||||
use BattleForge\Domain\Archetype;
|
||||
use BattleForge\Domain\Battlefield;
|
||||
use BattleForge\Domain\CombatEngine;
|
||||
use BattleForge\Domain\DeploymentZone;
|
||||
use BattleForge\Domain\MatchState;
|
||||
use BattleForge\Domain\ObjectiveMarker;
|
||||
@@ -167,6 +168,40 @@ final class ScenarioTest extends TestCase
|
||||
self::assertSame($original->id, $fromMatch->id);
|
||||
}
|
||||
|
||||
public function testStartingAMatchWithAbilityAndObjectivePlaysThrough(): void
|
||||
{
|
||||
$units = [
|
||||
new UnitState('alpha-1', 'alpha', new Position(0, 0), 10, 10, 4, 2, 4, 2, false, Archetype::Striker, ['area_damage']),
|
||||
new UnitState('alpha-2', 'alpha', new Position(1, 0), 9, 9, 3, 2, 4, 2, false, Archetype::Support, ['heal', 'buff']),
|
||||
new UnitState('alpha-3', 'alpha', new Position(2, 0), 10, 10, 4, 3, 3, 2, false, Archetype::Defender),
|
||||
new UnitState('bravo-1', 'bravo', new Position(7, 7), 7, 7, 4, 2, 5, 2, false, Archetype::Scout),
|
||||
new UnitState('bravo-2', 'bravo', new Position(6, 7), 10, 10, 4, 2, 4, 2, false, Archetype::Striker),
|
||||
new UnitState('bravo-3', 'bravo', new Position(5, 7), 10, 10, 4, 3, 3, 2, false, Archetype::Defender),
|
||||
];
|
||||
$scenario = new Scenario(
|
||||
id: 'demo',
|
||||
name: 'Demo',
|
||||
battlefield: new Battlefield(8, 8),
|
||||
units: $units,
|
||||
deploymentZones: [
|
||||
'alpha' => new DeploymentZone('alpha', [new Position(0, 0), new Position(1, 0), new Position(2, 0)]),
|
||||
'bravo' => new DeploymentZone('bravo', [new Position(7, 7), new Position(6, 7), new Position(5, 7)]),
|
||||
],
|
||||
objectives: ['objective-1' => new ObjectiveMarker('objective-1', new Position(0, 0))],
|
||||
victoryCondition: VictoryCondition::HoldObjective,
|
||||
holdRoundsRequired: 2,
|
||||
);
|
||||
|
||||
$match = $scenario->startMatch('alpha');
|
||||
$engine = new CombatEngine();
|
||||
$end1 = $engine->endTurn($match);
|
||||
$end2 = $engine->endTurn($end1);
|
||||
|
||||
self::assertSame('alpha', $end2->activeTeamId);
|
||||
self::assertSame(['alpha' => 1], $end2->objectiveControl);
|
||||
self::assertNull($end2->winnerTeamId);
|
||||
}
|
||||
|
||||
/** @return list<UnitState> */
|
||||
private function validUnitSet(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user