Interface BattleAILogic

All Known Implementing Classes:
AdvancedAI, AggressiveAI, BattleAI, BattleAIBase, NoOpAI, RaidAI, RandomAI, TacticalAI

public interface BattleAILogic
  • Field Details

    • CODEC

      static final com.mojang.serialization.Codec<BattleAIBase> CODEC
  • Method Details

    • codec

      com.mojang.serialization.MapCodec<? extends BattleAIBase> codec()
    • type

      BattleAIType<? extends BattleAIBase> type()
    • getNextMove

      MoveChoice getNextMove(PixelmonWrapper pw)
      Gets the move the AI will make next.
      Parameters:
      pw - The Pokémon to make a move with.
      Returns:
      The move the AI will make next.
    • getNextSwitch

      UUID getNextSwitch(PixelmonWrapper pw)
      Gets a Pokémon to switch to when forced to switch.
      Parameters:
      pw - The Pokémon switching out.
      Returns:
      The ID of the Pokémon to switch to.
    • getFaintedPokemonToRevive

      UUID getFaintedPokemonToRevive(BattleParticipant participant)
      Gets a Pokémon to revive when forced to revive.
      Returns:
      The ID of the Pokémon to switch to.
    • registerMove

      default void registerMove(PixelmonWrapper user)
      Registers an enemy move into the AI's memory.
    • registerSwitch

      default void registerSwitch(PixelmonWrapper switchOut, PixelmonWrapper switchIn)
      Registers an enemy switch-in into the AI's memory.
    • getTopNAttackChoices

      default List<MoveChoice> getTopNAttackChoices(int count, PixelmonWrapper pw)
    • getMoveset

      List<Attack> getMoveset(PixelmonWrapper pw)
      Returns the moveset that the AI thinks a Pokémon has.
      Parameters:
      pw - The Pokémon to get moves for.
      Returns:
      The moveset that the AI thinks the Pokémon has.
    • getBestAttackChoices

      default List<List<MoveChoice>> getBestAttackChoices(List<PixelmonWrapper> pokemonList)
      Gets the best attack choices for multiple Pokémon.
      Parameters:
      pokemonList - The Pokémon to get attack choices for.
      Returns:
      A list of attack choices for each specified Pokémon.
    • getBestAttackChoices

      List<MoveChoice> getBestAttackChoices(PixelmonWrapper pw)
      Finds the strongest offensive move choices in the situation. This should only be called when already in simulate mode.
      Parameters:
      pw - The Pokémon to get the best move choices for.
      Returns:
      The strongest offensive move choices in the situation.
    • getWeightedOffensiveChoices

      List<MoveChoice> getWeightedOffensiveChoices(PixelmonWrapper pw)
      Weights and returns all offensive move choices of a Pokémon.
      Parameters:
      pw - The Pokémon to get choices for.
      Returns:
      A list of offensive move choices that can be made by the Pokémon.
    • weightFromUserOptions

      default void weightFromUserOptions(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> bestChoicesBefore, List<MoveChoice> bestChoicesAfter)
      Weights a move based on the amount of turns the user takes to KO the opponent after using the move.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      bestChoicesBefore - The user's best choices before using the move.
      bestChoicesAfter - The user's best choices after using the move.
    • weightFromUserOptions

      void weightFromUserOptions(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> bestChoicesBefore, List<MoveChoice> bestChoicesAfter, boolean weightNegative)
      Weights a move based on the amount of turns the user takes to KO the opponent after using the move.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      bestChoicesBefore - The user's best choices before using the move.
      bestChoicesAfter - The user's best choices after using the move.
      weightNegative - Whether to weight negatively if the move causes the user to take more turns to KO the opponent.
    • weightRandomMove

      void weightRandomMove(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> possibleChoices)
      Weights a move that randomly selects from an assortment of moves.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move with random selection.
      possibleChoices - The possible moves that the move can select.
    • weightFromOpponentOptions

      default void weightFromOpponentOptions(PixelmonWrapper pw, MoveChoice userChoice, List<List<MoveChoice>> bestChoicesBefore, List<List<MoveChoice>> bestChoicesAfter)
      Weights a move based on the amount of turns the opponent takes to KO the Pokémon before and after using the move.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      bestChoicesBefore - The opponent's best options before using the move.
      bestChoicesAfter - The opponent's best options after using the move.
    • weightFromOpponentOptions

      void weightFromOpponentOptions(PixelmonWrapper pw, MoveChoice userChoice, List<List<MoveChoice>> bestChoicesBefore, List<List<MoveChoice>> bestChoicesAfter, boolean weightNegative)
      Weights a move based on the amount of turns the opponent takes to KO the Pokémon before and after using the move.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      bestChoicesBefore - The opponent's best options before using the move.
      bestChoicesAfter - The opponent's best options after using the move.
      weightNegative - Whether to weight negatively if the move causes the opponent to KO the Pokémon faster.
    • weightTypeChange

      default void weightTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<net.minecraft.resources.ResourceKey<Type>> possibleTypes, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices)
      Weights the effectiveness of a type change.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      possibleTypes - The possible types the Pokémon can become.
      bestUserChoices - The best user choices before the type change.
      bestOpponentChoices - The best opponent choices before the type change.
    • weightTypeChange

      void weightTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<net.minecraft.resources.ResourceKey<Type>> possibleTypes, PixelmonWrapper target, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices)
      Weights the effectiveness of a type change.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      possibleTypes - The possible types the Pokémon can become.
      target - The Pokémon whose type is being changed.
      bestUserChoices - The best user choices before the type change.
      bestOpponentChoices - The best opponent choices before the type change.
    • weightStatusOpponentOptions

      void weightStatusOpponentOptions(PixelmonWrapper pw, MoveChoice userChoice, PixelmonWrapper target, StatusBase status, List<PixelmonWrapper> opponents, List<MoveChoice> bestOpponentChoices)
      Weights a status based on the damage output of the opponent before and after applying it.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move to be used.
      target - The Pokémon targeted by the status.
      status - The status being applied.
      opponents - The opponents of the move's user.
      bestOpponentChoices - The best choices of the opponent.
    • weightSingleTypeChange

      void weightSingleTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<net.minecraft.core.Holder<Type>> newType, PixelmonWrapper target, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices)
      Weights the effectiveness of a type change.
      Parameters:
      pw - The Pokémon using the move.
      userChoice - The move being used.
      newType - The type that the target will become.
      target - The Pokémon whose type is being changed.
      bestUserChoices - The best user choices before the type change.
      bestOpponentChoices - The best opponent choices before the type change.