feat(command): route use X on Y to the combination engine
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package thb.jeanluc.adventure.command.impl;
|
||||
|
||||
import thb.jeanluc.adventure.command.Command;
|
||||
import thb.jeanluc.adventure.game.Combinations;
|
||||
import thb.jeanluc.adventure.game.GameContext;
|
||||
import thb.jeanluc.adventure.model.item.Item;
|
||||
|
||||
@@ -20,6 +21,10 @@ public class UseCommand implements Command {
|
||||
ctx.getIo().write("Use what?");
|
||||
return;
|
||||
}
|
||||
if (args.size() >= 2) {
|
||||
Combinations.tryUse(ctx, args.get(0), args.get(1));
|
||||
return;
|
||||
}
|
||||
String itemId = args.getFirst();
|
||||
Optional<Item> item = ctx.getPlayer().findItem(itemId);
|
||||
if (item.isEmpty()) {
|
||||
@@ -34,6 +39,6 @@ public class UseCommand implements Command {
|
||||
|
||||
@Override
|
||||
public String help() {
|
||||
return "use <item> - use an item (read it, switch it on/off, ...)";
|
||||
return "use <item> - use an item; or use <item> on <item> to combine them";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user