feat(io,command): quests command, QuestText, per-turn quest tick

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 22:31:33 +02:00
parent fe9ac65f25
commit c2e5789118
6 changed files with 100 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package thb.jeanluc.adventure.command.impl;
import org.junit.jupiter.api.Test;
import thb.jeanluc.adventure.game.GameContext;
import thb.jeanluc.adventure.game.QuestEngine;
import thb.jeanluc.adventure.io.TestIO;
import thb.jeanluc.adventure.model.Condition;
import thb.jeanluc.adventure.model.Player;
import thb.jeanluc.adventure.model.Quest;
import thb.jeanluc.adventure.model.QuestStage;
import thb.jeanluc.adventure.model.Room;
import thb.jeanluc.adventure.model.World;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
class QuestsCommandTest {
@Test
void showsActiveObjective() {
Quest q = new Quest("q", "My Quest", true,
List.of(new QuestStage("Do the thing",
List.of(new Condition(Condition.Type.FLAG, "x")), List.of())), List.of());
World w = new World(Map.of(), Map.of(), Map.of(), "t", "w", Map.of("q", q));
GameContext ctx = new GameContext(w, new Player(new Room("k", "K", "d"), 0), new TestIO());
QuestEngine.tick(ctx); // auto-start
new QuestsCommand().execute(ctx, List.of());
String out = ((TestIO) ctx.getIo()).allOutput();
assertThat(out).contains("My Quest").contains("Do the thing");
}
}