Skip to content

Instantly share code, notes, and snippets.

@Flashback083
Created July 20, 2021 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Flashback083/619edb1d638a1cb6f72b73b0211038d0 to your computer and use it in GitHub Desktop.
Save Flashback083/619edb1d638a1cb6f72b73b0211038d0 to your computer and use it in GitHub Desktop.
public void applySwitchInEffect(PixelmonWrapper newPokemon) {
if (newPokemon.bc.simulateMode) {
return;
}
PixelmonWrapper target = newPokemon.bc.getOppositePokemon(newPokemon);
if (target.getBattleAbility() instanceof Illusion && ((Illusion)target.getBattleAbility()).disguisedPokemon != null || target.hasStatus(StatusType.Substitute, StatusType.Transformed)) {
return;
}
newPokemon.bc.sendToAll("pixelmon.abilities.imposter", newPokemon.getNickname(), target.getNickname());
EntityDataManager dataManager = newPokemon.entity.getDataManager();
dataManager.set(EntityPixelmon.dwTransformation, -1);
Transformed transformed = new Transformed(newPokemon, target);
if (newPokemon.entity.getSpecies().is(EnumSpecies.Ditto) && target.entity.getSpecies().is(EnumSpecies.Mimikyu)){
newPokemon.addStatus(transformed, target);
AbilityBase ability = AbilityBase.getAbility("Imposter").get();
newPokemon.setTempAbility(ability);
}else{
newPokemon.addStatus(transformed, target);
}
Moveset tempMoveset = new Moveset().withPokemon(newPokemon.pokemon);
for (Attack a : target.getMoveset()) {
if (a == null) continue;
Attack copy = a.copy();
copy.pp = 5;
copy.overridePPMax(5);
tempMoveset.add(copy);
}
newPokemon.setTemporaryMoveset(tempMoveset);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment