Class BattleAIBase
java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.ai.BattleAIBase
- Direct Known Subclasses:
AggressiveAI
,NoOpAI
,RandomAI
Base class for battle AI.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<MoveChoice>
Gets all attack choices the AI can make during the turn.protected List<MoveChoice>
Gets all attack choices that do not specifically target allies.Finds the strongest offensive move choices in the situation.getBestAttackChoices
(List<PixelmonWrapper> pokemonList) Gets the best attack choices for multiple Pokémon.protected List<MoveChoice>
Gets all choices that the AI can make during the turn.abstract UUID
Gets a Pokémon to revive when forced to revive.Returns the moveset that the AI thinks a Pokémon has.abstract MoveChoice
Gets the move the AI will make next.abstract UUID
Gets a Pokémon to switch to when forced to switch.Gets the IDs of all Pokémon in the participant's party that can be revived.Gets the IDs of all Pokémon in the participant's party that can switch in.protected MoveChoice
Gets a random attack choice to use.Gets all possible switch choices the participant can make.protected List<MoveChoice>
Weights and returns all offensive move choices of a Pokémon.void
registerMove
(PixelmonWrapper user) Registers an enemy move into the AI's memory.void
registerSwitch
(PixelmonWrapper switchOut, PixelmonWrapper switchIn) Registers an enemy switch-in into the AI's memory.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.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.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.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.protected void
weightOffensiveMove
(PixelmonWrapper pw, MoveChoice choice) Determines the weight of offensive moves.protected void
weightOffensiveMove
(PixelmonWrapper pw, MoveChoice choice, List<PixelmonWrapper> allies) Determines the weight of offensive moves.protected void
weightOffensiveMoves
(PixelmonWrapper pw, List<MoveChoice> choices) Weights all offensive moves in a list of choices.void
weightRandomMove
(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> possibleChoices) Weights a move that randomly selects from an assortment of moves.void
weightSingleTypeChange
(PixelmonWrapper pw, MoveChoice userChoice, List<Element> newType, PixelmonWrapper target, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Weights the effectiveness of a type change.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.void
weightTypeChange
(PixelmonWrapper pw, MoveChoice userChoice, List<Element> possibleTypes, PixelmonWrapper target, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Weights the effectiveness of a type change.void
weightTypeChange
(PixelmonWrapper pw, MoveChoice userChoice, List<Element> possibleTypes, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Weights the effectiveness of a type change.
-
Constructor Details
-
BattleAIBase
Initializes the AI.- Parameters:
participant
- The participant controlled by the AI.
-
-
Method Details
-
getNextMove
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
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
Gets a Pokémon to revive when forced to revive.- Returns:
- The ID of the Pokémon to switch to.
-
registerMove
Registers an enemy move into the AI's memory. -
registerSwitch
Registers an enemy switch-in into the AI's memory. -
getChoices
Gets all choices that the AI can make during the turn.- Parameters:
pw
- The Pokémon to get choices for, or null if the AI is forced to switch.- Returns:
- A list of all choices that the AI can make during the turn.
-
getAttackChoices
Gets all attack choices the AI can make during the turn.- Parameters:
pw
- The Pokémon to get choices for.- Returns:
- A list of all attack choices that the AI can make during the turn.
-
getAttackChoicesOpponentOnly
Gets all attack choices that do not specifically target allies.- Parameters:
pw
- The Pokémon to get choices for.- Returns:
- A list of attack choices that the AI can make during the turn.
-
getSwitchChoices
Gets all possible switch choices the participant can make.- Parameters:
pw
- The Pokémon making a move, or null if switching in from a fainted Pokémon.- Returns:
- A list of All possible switch choices the participant can make.
-
getPossibleSwitchIDs
Gets the IDs of all Pokémon in the participant's party that can switch in.- Returns:
- The IDs of all Pokémon in the participant's party that can switch in.
-
getPossibleReviveIDs
Gets the IDs of all Pokémon in the participant's party that can be revived.- Returns:
- The IDs of all Pokémon in the participant's party that can be revived.
-
getRandomAttackChoice
Gets a random attack choice to use.- Parameters:
pw
- The Pokémon to make a move with.- Returns:
- The move the AI will make next.
-
weightOffensiveMove
Determines the weight of offensive moves.- Parameters:
pw
- The Pokémon using the move.choice
- The move choice being evaluated.
-
weightOffensiveMove
protected void weightOffensiveMove(PixelmonWrapper pw, MoveChoice choice, List<PixelmonWrapper> allies) Determines the weight of offensive moves.- Parameters:
pw
- The Pokémon using the move.choice
- The move choice being evaluated.allies
- The allies of the Pokémon in battle.
-
weightOffensiveMoves
Weights all offensive moves in a list of choices.- Parameters:
pw
- The Pokémon deciding a move.choices
- The move choices the Pokémon has.
-
getWeightedOffensiveChoices
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.
-
getBestAttackChoices
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.
-
getBestAttackChoices
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.
-
getMoveset
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.
-
weightRandomMove
public 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.
-
weightFromUserOptions
public 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
public 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.
-
weightFromOpponentOptions
public 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
public 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
public void weightTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<Element> 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
public void weightTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<Element> 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.
-
weightSingleTypeChange
public void weightSingleTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<Element> 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.
-
weightStatusOpponentOptions
public 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.
-