It's just a little gift for Smogon U. If a reason needs to be given, it is this: THANK YOU FOR NOT ALLOWING GARCHOMP TO RUN RAMPANT ON THIS GREAT SERVER.
Code:
new Clause("Free Switch Clause") {
public String getClauseDescription() {
return "No Pokémon may lay or know Stealth Rock, Spikes OR "
+ "Toxic Spikes. Any attempt WILL FAIL.";
}
public boolean isTeamValid(BattleField field, Pokemon[] team, int idx) {
Set set = new HashSet(Arrays.asList(new String[] {
"Stealth Rock",
"Spikes",
"Toxic Spikes",
}));
for (int i = 0; i < team.length; ++i) {
if (team[i] == null)
continue;
for (int j = 0; j < 4; j++){
if (team[i].getMoveName(j) == null)
continue;
if (set.contains(team[i].getMoveName(j))){
return false;
}
}
}
return true;
}
public boolean isMoveTransformer(boolean enemy){
return true;
}
public MoveListEntry getTransformedMove(Pokemon p, MoveListEntry entry){
Set set = new HashSet(Arrays.asList(new String[] {
"Stealth Rock",
"Spikes",
"Toxic Spikes",
}));
if (set.contains(entry.getName())){
p.getField().showMessage("But it failed due to the Free Switch Clause!");
return null;
}
return entry;
}
};