ArmorProto.java
jmud-0.11/src/ArmorProto.java · 1.4 KB
From the archive jmud-0_11.tgz
Download the archive « Back to the archive contents
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import util.file.InvalidFileFormatException;
import misc.Separators;
import util.log.Log;
class ArmorProto extends ItemProto {
int physical;
int mental;
int mystic;
ArmorProto(int zoneBase, int itemId, BufferedReader itemFile)
throws InvalidFileFormatException {
super(zoneBase, itemId, itemFile);
Log.log("Armadura: " + getName());
StringTokenizer tok = null;
try {
String line = itemFile.readLine();
tok = new StringTokenizer(line);
}
catch(IOException e) {
throw new InvalidFileFormatException();
}
// physic
if (!tok.hasMoreTokens())
throw new InvalidFileFormatException();
physical = Integer.parseInt(tok.nextToken());
// mental
if (!tok.hasMoreTokens())
throw new InvalidFileFormatException();
mental = Integer.parseInt(tok.nextToken());
// mistic
if (!tok.hasMoreTokens())
throw new InvalidFileFormatException();
mystic = Integer.parseInt(tok.nextToken());
}
protected void finalize() {
super.finalize();
}
int getProtoType() {
return Item.T_ARMOR;
}
Item create() {
return new Armor(this);
}
/////////////
// Sheetable:
public String getSheet() {
return super.getSheet() + Separators.NL +
"Proteção: Física [" + physical + "] Mental [" + mental + "] Mística [" + mystic + "]";
}
}