44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
package com.github.dtschust.zork.objects;
|
|
|
|
import com.github.dtschust.zork.ZorkTrigger;
|
|
import com.github.dtschust.zork.types.HasPrintsAndActions;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/* Item*/
|
|
public class ZorkItem extends ZorkObject implements HasPrintsAndActions {
|
|
private final String writing;
|
|
private final List<String> turnOnPrint;
|
|
private final List<String> turnOnAction;
|
|
|
|
public ZorkItem(final String name,
|
|
final String description,
|
|
final String status,
|
|
final String writing,
|
|
final Collection<ZorkTrigger> triggers,
|
|
final Collection<String> turnOnPrint,
|
|
final Collection<String> turnOnAction) {
|
|
super(name, description, status, triggers);
|
|
this.writing = writing;
|
|
this.turnOnPrint = new ArrayList<>(turnOnPrint);
|
|
this.turnOnAction = new ArrayList<>(turnOnAction);
|
|
}
|
|
|
|
public String getWriting() {
|
|
return writing != null && !writing.isEmpty() ? writing : "Nothing written.";
|
|
}
|
|
|
|
@Override
|
|
public List<String> getPrints() {
|
|
return Collections.unmodifiableList(turnOnPrint);
|
|
}
|
|
|
|
@Override
|
|
public List<String> getActions() {
|
|
return Collections.unmodifiableList(turnOnAction);
|
|
}
|
|
}
|