Skip to content

Instantly share code, notes, and snippets.

@Flashback083
Created July 20, 2021 00:23
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/ae0eeb1c55a7ed6999679c3bf9514931 to your computer and use it in GitHub Desktop.
Save Flashback083/ae0eeb1c55a7ed6999679c3bf9514931 to your computer and use it in GitHub Desktop.
public AttackResult applyEffectDuring(PixelmonWrapper user, PixelmonWrapper target) {
AbilityBase targetAbility = target.getBattleAbility();
if (targetAbility instanceof Illusion && ((Illusion)targetAbility).disguisedPokemon != null || target.hasStatus(StatusType.Substitute, StatusType.Transformed)) {
user.bc.sendToAll("pixelmon.effect.effectfailed");
return AttackResult.failed;
}
if (!user.bc.simulateMode) {
EntityDataManager dataManager = user.entity.getDataManager();
if (user.removeStatus(StatusType.Transformed)) {
dataManager.set(EntityPixelmon.dwTransformation, 0);
}
user.bc.sendToAll("pixelmon.status.transform", user.getNickname(), target.getNickname());
dataManager.set(EntityPixelmon.dwTransformation, -1);
Transformed transformed = new Transformed(user, target);
if (target.entity.getSpecies().is(EnumSpecies.Mimikyu)){
AbilityBase ability = AbilityBase.getAbility(user.getAbility().getName()).get();
user.addStatus(transformed, target);
user.setTempAbility(ability);
}else{
user.addStatus(transformed, target);
}
Moveset tempMoveset = new Moveset().withPokemon(user.pokemon);
for (Attack a : target.getMoveset()) {
if (a == null) continue;
Attack copy = a.copy();
copy.pp = 5;
copy.overridePPMax(5);
tempMoveset.add(copy);
}
user.setTemporaryMoveset(tempMoveset);
}
return AttackResult.succeeded;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment