Record Class BattleAI
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.battles.controller.ai.BattleAI
- All Implemented Interfaces:
BattleAILogic
public record BattleAI(net.minecraft.network.chat.Component name, BattleAIBase ai)
extends Record
implements BattleAILogic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceKey<BattleAI> static final net.minecraft.resources.ResourceKey<BattleAI> static final com.mojang.serialization.Codec<net.minecraft.core.Holder<BattleAI>> static final com.mojang.serialization.Codec<BattleAI> static final com.mojang.serialization.Codec<BattleAI> static final net.minecraft.resources.ResourceKey<BattleAI> static final net.minecraft.resources.ResourceKey<BattleAI> static final net.minecraft.resources.ResourceKey<BattleAI> static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<BattleAI>> -
Constructor Summary
ConstructorsConstructorDescriptionBattleAI(net.minecraft.network.chat.Component name) BattleAI(net.minecraft.network.chat.Component name, BattleAIBase ai) Creates an instance of aBattleAIrecord class. -
Method Summary
Modifier and TypeMethodDescriptionai()Returns the value of theairecord component.com.mojang.serialization.MapCodec<? extends BattleAIBase> codec()final booleanIndicates whether some other object is "equal to" this one.static net.minecraft.core.Holder<BattleAI> getAdvancedAI(net.minecraft.core.RegistryAccess registryAccess) Finds the strongest offensive move choices in the situation.getBestAttackChoices(List<PixelmonWrapper> pokemonList) Gets the best attack choices for multiple Pokémon.getFaintedPokemonToRevive(BattleParticipant participant) Gets a Pokémon to revive when forced to revive.Returns the moveset that the AI thinks a Pokémon has.Gets the move the AI will make next.Gets a Pokémon to switch to when forced to switch.static net.minecraft.core.Holder<BattleAI> getNoOpAI(net.minecraft.core.RegistryAccess registryAccess) static net.minecraft.core.Holder<BattleAI> getRandomAI(net.minecraft.core.RegistryAccess registryAccess) getTopNAttackChoices(int count, PixelmonWrapper pw) Weights and returns all offensive move choices of a Pokémon.final inthashCode()Returns a hash code value for this object.net.minecraft.network.chat.Componentname()Returns the value of thenamerecord component.voidregisterMove(PixelmonWrapper user) Registers an enemy move into the AI's memory.voidregisterSwitch(PixelmonWrapper switchOut, PixelmonWrapper switchIn) Registers an enemy switch-in into the AI's memory.final StringtoString()Returns a string representation of this record class.BattleAIType<? extends BattleAIBase> type()voidweightFromOpponentOptions(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.voidweightFromOpponentOptions(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.voidweightFromUserOptions(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.voidweightFromUserOptions(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.voidweightRandomMove(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> possibleChoices) Weights a move that randomly selects from an assortment of moves.voidweightSingleTypeChange(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.voidweightStatusOpponentOptions(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.voidweightTypeChange(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.voidweightTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<net.minecraft.resources.ResourceKey<Type>> possibleTypes, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Weights the effectiveness of a type change.
-
Field Details
-
REGISTRY
public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<BattleAI>> REGISTRY -
DIRECT_CODEC
-
NETWORK_CODEC
-
CODEC
-
RANDOM
-
NO_OP
-
AGGRESSIVE
-
ADVANCED
-
RAID
-
-
Constructor Details
-
BattleAI
@Internal public BattleAI(net.minecraft.network.chat.Component name) -
BattleAI
Creates an instance of aBattleAIrecord class.- Parameters:
name- the value for thenamerecord componentai- the value for theairecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceBattleAILogic
-
type
- Specified by:
typein interfaceBattleAILogic
-
getNextMove
Description copied from interface:BattleAILogicGets the move the AI will make next.- Specified by:
getNextMovein interfaceBattleAILogic- Parameters:
pw- The Pokémon to make a move with.- Returns:
- The move the AI will make next.
-
getNextSwitch
Description copied from interface:BattleAILogicGets a Pokémon to switch to when forced to switch.- Specified by:
getNextSwitchin interfaceBattleAILogic- Parameters:
pw- The Pokémon switching out.- Returns:
- The ID of the Pokémon to switch to.
-
getFaintedPokemonToRevive
Description copied from interface:BattleAILogicGets a Pokémon to revive when forced to revive.- Specified by:
getFaintedPokemonToRevivein interfaceBattleAILogic- Returns:
- The ID of the Pokémon to switch to.
-
registerMove
Description copied from interface:BattleAILogicRegisters an enemy move into the AI's memory.- Specified by:
registerMovein interfaceBattleAILogic
-
registerSwitch
Description copied from interface:BattleAILogicRegisters an enemy switch-in into the AI's memory.- Specified by:
registerSwitchin interfaceBattleAILogic
-
getMoveset
Description copied from interface:BattleAILogicReturns the moveset that the AI thinks a Pokémon has.- Specified by:
getMovesetin interfaceBattleAILogic- Parameters:
pw- The Pokémon to get moves for.- Returns:
- The moveset that the AI thinks the Pokémon has.
-
getTopNAttackChoices
- Specified by:
getTopNAttackChoicesin interfaceBattleAILogic
-
weightRandomMove
public void weightRandomMove(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> possibleChoices) Description copied from interface:BattleAILogicWeights a move that randomly selects from an assortment of moves.- Specified by:
weightRandomMovein interfaceBattleAILogic- 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, boolean weightNegative) Description copied from interface:BattleAILogicWeights a move based on the amount of turns the user takes to KO the opponent after using the move.- Specified by:
weightFromUserOptionsin interfaceBattleAILogic- 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.
-
weightFromUserOptions
public void weightFromUserOptions(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> bestChoicesBefore, List<MoveChoice> bestChoicesAfter) Description copied from interface:BattleAILogicWeights a move based on the amount of turns the user takes to KO the opponent after using the move.- Specified by:
weightFromUserOptionsin interfaceBattleAILogic- 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.
-
getWeightedOffensiveChoices
Description copied from interface:BattleAILogicWeights and returns all offensive move choices of a Pokémon.- Specified by:
getWeightedOffensiveChoicesin interfaceBattleAILogic- 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
Description copied from interface:BattleAILogicFinds the strongest offensive move choices in the situation. This should only be called when already in simulate mode.- Specified by:
getBestAttackChoicesin interfaceBattleAILogic- Parameters:
pw- The Pokémon to get the best move choices for.- Returns:
- The strongest offensive move choices in the situation.
-
getBestAttackChoices
Description copied from interface:BattleAILogicGets the best attack choices for multiple Pokémon.- Specified by:
getBestAttackChoicesin interfaceBattleAILogic- Parameters:
pokemonList- The Pokémon to get attack choices for.- Returns:
- A list of attack choices for each specified Pokémon.
-
weightFromOpponentOptions
public void weightFromOpponentOptions(PixelmonWrapper pw, MoveChoice userChoice, List<List<MoveChoice>> bestChoicesBefore, List<List<MoveChoice>> bestChoicesAfter) Description copied from interface:BattleAILogicWeights a move based on the amount of turns the opponent takes to KO the Pokémon before and after using the move.- Specified by:
weightFromOpponentOptionsin interfaceBattleAILogic- 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) Description copied from interface:BattleAILogicWeights a move based on the amount of turns the opponent takes to KO the Pokémon before and after using the move.- Specified by:
weightFromOpponentOptionsin interfaceBattleAILogic- 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<net.minecraft.resources.ResourceKey<Type>> possibleTypes, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Description copied from interface:BattleAILogicWeights the effectiveness of a type change.- Specified by:
weightTypeChangein interfaceBattleAILogic- 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<net.minecraft.resources.ResourceKey<Type>> possibleTypes, PixelmonWrapper target, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Description copied from interface:BattleAILogicWeights the effectiveness of a type change.- Specified by:
weightTypeChangein interfaceBattleAILogic- 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
public void weightStatusOpponentOptions(PixelmonWrapper pw, MoveChoice userChoice, PixelmonWrapper target, StatusBase status, List<PixelmonWrapper> opponents, List<MoveChoice> bestOpponentChoices) Description copied from interface:BattleAILogicWeights a status based on the damage output of the opponent before and after applying it.- Specified by:
weightStatusOpponentOptionsin interfaceBattleAILogic- 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
public void weightSingleTypeChange(PixelmonWrapper pw, MoveChoice userChoice, List<net.minecraft.core.Holder<Type>> newType, PixelmonWrapper target, List<MoveChoice> bestUserChoices, List<MoveChoice> bestOpponentChoices) Description copied from interface:BattleAILogicWeights the effectiveness of a type change.- Specified by:
weightSingleTypeChangein interfaceBattleAILogic- 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.
-
getRandomAI
public static net.minecraft.core.Holder<BattleAI> getRandomAI(net.minecraft.core.RegistryAccess registryAccess) -
getAdvancedAI
public static net.minecraft.core.Holder<BattleAI> getAdvancedAI(net.minecraft.core.RegistryAccess registryAccess) -
getNoOpAI
public static net.minecraft.core.Holder<BattleAI> getNoOpAI(net.minecraft.core.RegistryAccess registryAccess) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
public net.minecraft.network.chat.Component name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
ai
Returns the value of theairecord component.- Returns:
- the value of the
airecord component
-