}
public String getName() {
return "Toxic spikes";
}
public void switchIn(Pokemon p) {
BattleField field = p.getField();
if ((PokemonMove.getEffectiveness(PokemonType.T_GROUND, null, p) == 0.0)
|| p.isType(PokemonType.T_STEEL)
|| p.hasAbility("Levitate")
|| (getLayers(p) <= 0)) {
return;
}
if (p.isType(PokemonType.T_POISON)) {
field.showMessage(p.getName() + " absorbed the Toxic Spikes!");
removeSpikes(p);
return;
}
int layers = getLayers(p);
if (layers == 1) {
if (p.addStatus(null, new PoisonEffect()) != null) {
field.showMessage(p.getName() + " was poisoned by the Toxic Spikes!");
}
} else if (layers == 2) {
if (p.addStatus(null, new ToxicEffect()) != null) {
field.showMessage(p.getName() + " was badly poisoned by the Toxic Spikes!");
}
}
}