package games.mapacman.common;
import games.mapacman.client.GameScreen;
import games.mapacman.server.MaPacmanZone;
import marauroa.common.game.RPClass;
import marauroa.common.game.RPObject;
import marauroa.server.game.Statistics;
public class Superdot extends Dot{
private int superprob=1;
private int superdot_score;
private boolean isSuperdot;
public Superdot(int x, int y, int dot_score, int superdot_score, int superdot_probability, MaPacmanZone zone) {
super(x,y,dot_score,zone);
myObject.put("type",consts.TYPE_SUPERDOT);
myObject.put("superprob",superdot_probability);
myObject.put("score",superdot_score);
myObject.put("dottype",TYPE_SUPERDOT);
superprob = superdot_probability;
this.superdot_score = superdot_score;
}
public Superdot(RPObject object) {
super(object);
isSuperdot=(myObject.getInt("dottype")==TYPE_SUPERDOT);
}
public static void initRPClass()
{
RPClass superdot = new RPClass(consts.TYPE_SUPERDOT);
superdot.isA(consts.TYPE_DOT);
superdot.add("dottype",RPClass.INT);
superdot.add("superprob",RPClass.INT);
}
public void setRespawnTime()
{
if (zone.getRandom().nextInt(superprob)==0)
{ // Superdot
myObject.put("score",superdot_score);
myObject.put("dottype",TYPE_SUPERDOT);
setRespawnTime(zone.getSuperDotRespawnTime());
}
else
{
myObject.put("dottype",TYPE_DOT);
myObject.put("score",dot_score);
setRespawnTime(zone.getDotRespawnTime());
}
}
public void addStats(Statistics stats) {
if (myObject.getInt("dottype")==TYPE_SUPERDOT)
{
stats.add("Superdots eaten",1);
}
else super.addStats(stats);
}
public void draw(GameScreen screen) {
if (isSuperdot)
screen.draw(screen.getDotSprite(TYPE_SUPERDOT),x,y);
else
screen.draw(screen.getDotSprite(TYPE_DOT),x,y);
}
}