command
This commit is contained in:
parent
008818c357
commit
7cc2352b90
2 changed files with 9 additions and 9 deletions
|
@ -2,7 +2,11 @@ package com.github.dtschust.zork;
|
||||||
|
|
||||||
/* Special Command condition*/
|
/* Special Command condition*/
|
||||||
public class ZorkCommand extends ZorkCondition {
|
public class ZorkCommand extends ZorkCondition {
|
||||||
public String command;
|
public final String command;
|
||||||
|
|
||||||
|
public ZorkCommand(String command) {
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean evaluate(Zork zork) {
|
public boolean evaluate(Zork zork) {
|
||||||
return command.equals(zork.userInput);
|
return command.equals(zork.userInput);
|
||||||
|
|
|
@ -90,8 +90,7 @@ public class ZorkReader {
|
||||||
NodeList commands = trigger.getElementsByTagName("command");
|
NodeList commands = trigger.getElementsByTagName("command");
|
||||||
for (l = 0; l < commands.getLength(); l++) {
|
for (l = 0; l < commands.getLength(); l++) {
|
||||||
Element command = (Element) commands.item(l);
|
Element command = (Element) commands.item(l);
|
||||||
ZorkCommand tempCommand = new ZorkCommand();
|
ZorkCommand tempCommand = new ZorkCommand(getString(command));
|
||||||
tempCommand.command = getString(command);
|
|
||||||
tempTrigger.conditions.add(tempCommand);
|
tempTrigger.conditions.add(tempCommand);
|
||||||
tempTrigger.hasCommand = true;
|
tempTrigger.hasCommand = true;
|
||||||
}
|
}
|
||||||
|
@ -202,8 +201,7 @@ public class ZorkReader {
|
||||||
NodeList commands = trigger.getElementsByTagName("command");
|
NodeList commands = trigger.getElementsByTagName("command");
|
||||||
for (l = 0; l < commands.getLength(); l++) {
|
for (l = 0; l < commands.getLength(); l++) {
|
||||||
Element command = (Element) commands.item(l);
|
Element command = (Element) commands.item(l);
|
||||||
ZorkCommand tempCommand = new ZorkCommand();
|
ZorkCommand tempCommand = new ZorkCommand(getString(command));
|
||||||
tempCommand.command = getString(command);
|
|
||||||
tempTrigger.conditions.add(tempCommand);
|
tempTrigger.conditions.add(tempCommand);
|
||||||
tempTrigger.hasCommand = true;
|
tempTrigger.hasCommand = true;
|
||||||
}
|
}
|
||||||
|
@ -297,8 +295,7 @@ public class ZorkReader {
|
||||||
NodeList commands = trigger.getElementsByTagName("command");
|
NodeList commands = trigger.getElementsByTagName("command");
|
||||||
for (l = 0; l < commands.getLength(); l++) {
|
for (l = 0; l < commands.getLength(); l++) {
|
||||||
Element command = (Element) commands.item(l);
|
Element command = (Element) commands.item(l);
|
||||||
ZorkCommand tempCommand = new ZorkCommand();
|
ZorkCommand tempCommand = new ZorkCommand(getString(command));
|
||||||
tempCommand.command = getString(command);
|
|
||||||
tempTrigger.conditions.add(tempCommand);
|
tempTrigger.conditions.add(tempCommand);
|
||||||
tempTrigger.hasCommand = true;
|
tempTrigger.hasCommand = true;
|
||||||
}
|
}
|
||||||
|
@ -419,8 +416,7 @@ public class ZorkReader {
|
||||||
NodeList commands = trigger.getElementsByTagName("command");
|
NodeList commands = trigger.getElementsByTagName("command");
|
||||||
for (l = 0; l < commands.getLength(); l++) {
|
for (l = 0; l < commands.getLength(); l++) {
|
||||||
Element command = (Element) commands.item(l);
|
Element command = (Element) commands.item(l);
|
||||||
ZorkCommand tempCommand = new ZorkCommand();
|
ZorkCommand tempCommand = new ZorkCommand(getString(command));
|
||||||
tempCommand.command = getString(command);
|
|
||||||
tempTrigger.conditions.add(tempCommand);
|
tempTrigger.conditions.add(tempCommand);
|
||||||
tempTrigger.hasCommand = true;
|
tempTrigger.hasCommand = true;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue