feat(tyrant): add permanent powers and intelligence
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package games.dmg.spigottyrant;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class TyrantAbilityServiceTest {
|
||||
private static final UUID TYRANT = UUID.fromString("11111111-1111-1111-1111-111111111111");
|
||||
private static final UUID VIGILANTE = UUID.fromString("22222222-2222-2222-2222-222222222222");
|
||||
private static final UUID FOLLOWER = UUID.fromString("33333333-3333-3333-3333-333333333333");
|
||||
private static final Instant NOW = Instant.parse("2026-08-14T12:00:00Z");
|
||||
private final TyrantAbilityService service = new TyrantAbilityService(
|
||||
Duration.ofHours(24)
|
||||
);
|
||||
|
||||
@Test
|
||||
void intelligenceCountsVigilanteSideWithoutIdentitiesAndStartsCooldown() {
|
||||
GameState game = new GameState(
|
||||
GameLifecycle.RUNNING, Optional.of(TYRANT), Optional.of(VIGILANTE),
|
||||
Optional.empty(), Optional.empty(), Optional.empty(), Duration.ZERO,
|
||||
1, 0, Set.of(TyrantUnlock.ROSTER_INTELLIGENCE)
|
||||
);
|
||||
PlayerState tyrant = PlayerState.newPlayer(TYRANT, "Tyrant");
|
||||
PlayerState follower = new PlayerState(
|
||||
FOLLOWER, "Follower", Optional.empty(), Optional.empty(), TyrantClass.NONE,
|
||||
Optional.of(VIGILANTE), Map.of(), Set.of(), java.util.List.of()
|
||||
);
|
||||
|
||||
IntelligenceResult used = service.useIntelligence(
|
||||
game, tyrant, Map.of(TYRANT, tyrant, FOLLOWER, follower), NOW
|
||||
);
|
||||
IntelligenceResult blocked = service.useIntelligence(
|
||||
game, used.tyrant(), Map.of(TYRANT, used.tyrant(), FOLLOWER, follower),
|
||||
NOW.plusSeconds(1)
|
||||
);
|
||||
|
||||
assertEquals(AbilityUseStatus.ACTIVATED, used.status());
|
||||
assertEquals(2, used.memberCount());
|
||||
assertEquals(NOW.plus(Duration.ofHours(24)), used.tyrant().cooldownEnds()
|
||||
.get(Ability.ROSTER_INTELLIGENCE));
|
||||
assertEquals(AbilityUseStatus.COOLDOWN, blocked.status());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user