This commit is contained in:
RaffaeleMorganti 2022-11-16 17:35:32 +01:00
parent 008818c357
commit 7cc2352b90
2 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,11 @@ package com.github.dtschust.zork;
/* Special Command condition*/
public class ZorkCommand extends ZorkCondition {
public String command;
public final String command;
public ZorkCommand(String command) {
this.command = command;
}
public boolean evaluate(Zork zork) {
return command.equals(zork.userInput);

View file

@ -90,8 +90,7 @@ public class ZorkReader {
NodeList commands = trigger.getElementsByTagName("command");
for (l = 0; l < commands.getLength(); l++) {
Element command = (Element) commands.item(l);
ZorkCommand tempCommand = new ZorkCommand();
tempCommand.command = getString(command);
ZorkCommand tempCommand = new ZorkCommand(getString(command));
tempTrigger.conditions.add(tempCommand);
tempTrigger.hasCommand = true;
}
@ -202,8 +201,7 @@ public class ZorkReader {
NodeList commands = trigger.getElementsByTagName("command");
for (l = 0; l < commands.getLength(); l++) {
Element command = (Element) commands.item(l);
ZorkCommand tempCommand = new ZorkCommand();
tempCommand.command = getString(command);
ZorkCommand tempCommand = new ZorkCommand(getString(command));
tempTrigger.conditions.add(tempCommand);
tempTrigger.hasCommand = true;
}
@ -297,8 +295,7 @@ public class ZorkReader {
NodeList commands = trigger.getElementsByTagName("command");
for (l = 0; l < commands.getLength(); l++) {
Element command = (Element) commands.item(l);
ZorkCommand tempCommand = new ZorkCommand();
tempCommand.command = getString(command);
ZorkCommand tempCommand = new ZorkCommand(getString(command));
tempTrigger.conditions.add(tempCommand);
tempTrigger.hasCommand = true;
}
@ -419,8 +416,7 @@ public class ZorkReader {
NodeList commands = trigger.getElementsByTagName("command");
for (l = 0; l < commands.getLength(); l++) {
Element command = (Element) commands.item(l);
ZorkCommand tempCommand = new ZorkCommand();
tempCommand.command = getString(command);
ZorkCommand tempCommand = new ZorkCommand(getString(command));
tempTrigger.conditions.add(tempCommand);
tempTrigger.hasCommand = true;
}