@Override public void switchActivePokemon(MoveWithPP switchOption) { Move switchTo = switchOption.getMove(); AiWriter.writeSwitch(activePokemon, teamId); activePokemon.setSleep(activePokemon.getInitialSleepDuration()); switch (switchTo) { case SWITCH_1: activePokemon = new ActivePokemon(party.get(0)); break; case SWITCH_2: activePokemon = new ActivePokemon(party.get(1)); break; case SWITCH_3: activePokemon = new ActivePokemon(party.get(2)); break; case SWITCH_4: activePokemon = new ActivePokemon(party.get(3)); break; case SWITCH_5: activePokemon = new ActivePokemon(party.get(4)); break; case SWITCH_6: activePokemon = new ActivePokemon(party.get(5)); break; default: break; } EntryHazardDamage.applyToxicSpikes(this); EntryHazardDamage.applySpikeDamage(this); EntryHazardDamage.applyStealthRocks(this); }
@Override public boolean canSwitch(MoveWithPP switchOption, Team opponent) { if (opponent.getActivePokemon().getAbility().preventsSwitching(activePokemon)) { return false; } Move switchTo = switchOption.getMove(); Pokemon pokeToSwitchIn = null; switch (switchTo) { case SWITCH_1: pokeToSwitchIn = party.get(0); break; case SWITCH_2: pokeToSwitchIn = party.get(1); break; case SWITCH_3: pokeToSwitchIn = party.get(2); break; case SWITCH_4: pokeToSwitchIn = party.get(3); break; case SWITCH_5: pokeToSwitchIn = party.get(4); break; case SWITCH_6: pokeToSwitchIn = party.get(5); break; default: break; } if (!pokeToSwitchIn.hasFainted()) { return true; } else { return false; } }