public class MoveChoice extends java.lang.Object implements java.lang.Comparable<MoveChoice>
Modifier and Type | Field and Description |
---|---|
Attack |
attack
The attack to use.
|
MoveResults |
result
The result of the simulated attack.
|
java.util.UUID |
switchPokemon
The UUID of the Pokémon to switch to.
|
java.util.List<PixelmonWrapper> |
targets
The targets of the attack to use.
|
int |
tier
The tier of usefulness of the move.
|
static int |
TIER_KO
The move KOes an opponent or has a similar high-priority effect.
|
static int |
TIER_MINIMAL
The Pokémon will not be able to make use of the move before fainting if the opponent acts optimally.
|
static int |
TIER_NORMAL
The move has an effect in battle.
|
static int |
TIER_USELESS
The move has no beneficial effects.
|
PixelmonWrapper |
user
The Pokémon using the move.
|
float |
weight
The usefulness of the move within the tier.
|
Constructor and Description |
---|
MoveChoice(PixelmonWrapper user,
Attack attack,
java.util.List<PixelmonWrapper> targets)
Makes a choice to attack.
|
MoveChoice(PixelmonWrapper user,
java.util.UUID switchPokemon)
Makes a choice to switch.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
canBreakProtect(java.util.List<PixelmonWrapper> opponents,
java.util.List<MoveChoice> choices)
Checks if the opponent can break through a Protect status.
|
static boolean |
canKOFromFull(java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw,
int numTurns)
Checks if the opponent can KO the Pokémon at full heatlh within a certain number of turns.
|
static boolean |
canOHKO(java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw)
Checks if a list of choices contains a Pokémon that can OHKO the specified Pokémon.
|
static boolean |
canOutspeed(java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw,
java.util.List<MoveChoice> userChoices)
Checks if an opponent can outspeed a Pokémon.
|
static boolean |
canOutspeedAnd2HKO(java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw)
Checks if a list of choices contains a Pokémon that can outspeed and at most 2HKO the specified Pokémon.
|
static boolean |
canOutspeedAnd2HKO(java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw,
java.util.List<MoveChoice> userChoices)
Checks if a list of choices contains a Pokémon that can outspeed and at most 2HKO the specified Pokémon.
|
static boolean |
canOutspeedAndKO(int numTurns,
java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw,
java.util.List<MoveChoice> userChoices) |
static boolean |
canOutspeedAndOHKO(java.util.List<MoveChoice> opponentChoices,
PixelmonWrapper pw,
java.util.List<MoveChoice> userChoices)
Checks if a list of choices contains a Pokémon that can outspeed and OHKO the specified Pokémon.
|
static void |
checkBestChoice(MoveChoice choice,
java.util.List<MoveChoice> bestChoices)
Checks whether a move choice is best and modifies the best choices if it is.
|
static void |
checkBestChoice(MoveChoice choice,
java.util.List<MoveChoice> bestChoices,
boolean excludeStatus)
Checks whether a move choice is best and modifies the best choices if it is.
|
int |
compareTo(MoveChoice otherChoice) |
static java.util.List<MoveChoice> |
createChoicesFromChoices(PixelmonWrapper pw,
java.util.List<MoveChoice> choices,
boolean includeAllies)
Creates a list of choices consisting of another list of choices's attacks.
|
java.util.List<MoveChoice> |
createList()
Makes a list containing the choice.
|
static java.util.List<MoveChoice> |
createMoveChoicesFromList(java.util.List<Attack> possibleAttacks,
PixelmonWrapper pw)
Adds choices to a list based on a provided list of attacks.
|
static java.util.List<MoveChoice> |
getAffectedChoices(MoveChoice choice,
java.util.List<MoveChoice> opponentChoices)
Filters a list of opponent choices to include only opponents that are affected by a move.
|
static float |
getMaxDamagePercent(PixelmonWrapper pw,
java.util.List<MoveChoice> opponentChoices)
Gets the maximum percent damage a list of choices can do to a Pokémon.
|
static float |
getMaxPriority(java.util.List<MoveChoice> choices)
Gets the highest priority in a list of choices.
|
static java.util.List<MoveChoice> |
getTargetedChoices(PixelmonWrapper pw,
java.util.List<MoveChoice> opponentChoices) |
static boolean |
hasAttackCategory(java.util.List<MoveChoice> choices,
AttackCategory category)
Checks if a list of choices has a move that is in a certain attack category.
|
static boolean |
hasMove(java.util.List<MoveChoice> choices,
java.util.Optional<ImmutableAttack>... moveNames)
Checks if a list of move choices has a move.
|
static boolean |
hasOffensiveAttackType(java.util.List<MoveChoice> choices,
Element type)
Checks if a list of choices has an offensive move of a certain type.
|
static boolean |
hasPriority(java.util.List<MoveChoice>... choices)
Checks whether any choices in the given lists have priority.
|
static boolean |
hasSpreadMove(java.util.List<MoveChoice> choices)
Checks if a list of choices has a spread move.
|
static boolean |
hasSuccessfulAttackChoice(java.util.List<MoveChoice> choices,
java.util.Optional<ImmutableAttack>... attackNames)
Checks if a list of choices has certain attacks that can be used successfully.
|
boolean |
hitsAlly()
Checks if the move choice hits an ally.
|
boolean |
isAttack()
Checks if the choice is an attack.
|
boolean |
isMiddleTier()
Checks if the choice's tier is one of the middle tiers.
|
boolean |
isOffensiveMove()
Checks if the choice is an offensive move.
|
boolean |
isSameType(MoveChoice other)
Checks if this choice is the same type (attack/switch) as another type.
|
boolean |
isSimilarWeight(MoveChoice other)
Checks if this choice has a similar weight as another choice.
|
boolean |
isStatusMove()
Checks if the choice is a status move.
|
void |
lowerTier(int newTier)
Lowers the tier of the choice.
|
static java.util.List<MoveChoice> |
mergeChoices(java.util.List<java.util.List<MoveChoice>> choices)
Merges a separated list of choices into one list.
|
void |
raiseTier(int newTier)
Raises the tier of the choice.
|
void |
raiseWeight(float newWeight)
Raises the weight of the choice.
|
void |
raiseWeightLimited(float newWeight)
Raises the weight of the choice, but not above 100.
|
void |
resetWeight()
Sets the choice's tier and weight to 0.
|
void |
setWeight(float newWeight)
Sets the weight of the choice.
|
static java.util.List<java.util.List<MoveChoice>> |
splitChoices(java.util.List<PixelmonWrapper> pokemonList,
java.util.List<MoveChoice> choices)
Splits a list of choices into separate lists for each Pokémon's choice.
|
static float |
sumWeights(java.util.List<MoveChoice> choices)
Gets the sum of the weights of a list of choices.
|
java.lang.String |
toString() |
public PixelmonWrapper user
public Attack attack
public java.util.List<PixelmonWrapper> targets
public MoveResults result
public java.util.UUID switchPokemon
public int tier
public float weight
public static final int TIER_USELESS
public static final int TIER_MINIMAL
public static final int TIER_NORMAL
public static final int TIER_KO
public MoveChoice(PixelmonWrapper user, Attack attack, java.util.List<PixelmonWrapper> targets)
attack
- The attack to use.targets
- the targets of the attack to use.public MoveChoice(PixelmonWrapper user, java.util.UUID switchPokemon)
switchPokemon
- The UUID of the Pokémon to switch to.public boolean isAttack()
public boolean isStatusMove()
public boolean isOffensiveMove()
public boolean isSameType(MoveChoice other)
other
- The choice to compare with.public boolean isSimilarWeight(MoveChoice other)
other
- The choice to compare with.public void raiseWeight(float newWeight)
newWeight
- The amount of weight to add to the current weight.public void raiseWeightLimited(float newWeight)
newWeight
- The amount of weight to add to the current weight.public void setWeight(float newWeight)
newWeight
- The weight to set the choice to.public void raiseTier(int newTier)
newTier
- The new tier to set the choice to.public void lowerTier(int newTier)
newTier
- public boolean isMiddleTier()
public void resetWeight()
public boolean hitsAlly()
public java.util.List<MoveChoice> createList()
public int compareTo(MoveChoice otherChoice)
compareTo
in interface java.lang.Comparable<MoveChoice>
public java.lang.String toString()
toString
in class java.lang.Object
public static void checkBestChoice(MoveChoice choice, java.util.List<MoveChoice> bestChoices)
choice
- The move choice to check.bestChoices
- The current list of best choices.public static void checkBestChoice(MoveChoice choice, java.util.List<MoveChoice> bestChoices, boolean excludeStatus)
choice
- The move choice to check.bestChoices
- The current list of best choices.excludeStatus
- Whether to exclude status moves from the choices.public static float getMaxPriority(java.util.List<MoveChoice> choices)
choices
- The choices to find the highest priority for.public static boolean canOutspeed(java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw, java.util.List<MoveChoice> userChoices)
opponentChoices
- The choices to check for outspeeding.pw
- The Pokémon to check for being outsped.userChoices
- The Pokémon's choice to search for priority moves.public static boolean canOHKO(java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw)
opponentChoices
- The choices to check for OHKOing the Pokémon.pw
- The Pokémon to check for being OHKOed.public static boolean canOutspeedAndOHKO(java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw, java.util.List<MoveChoice> userChoices)
opponentChoices
- The choices to check for outspeeding and OHKOing the Pokémon.pw
- The Pokémon to check for being outsped and OHKOed.public static boolean canOutspeedAnd2HKO(java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw)
opponentChoices
- The choices to check for outspeeding and 2HKOing the Pokémon.pw
- The Pokémon to check for being outsped and 2HKOed.public static boolean canOutspeedAnd2HKO(java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw, java.util.List<MoveChoice> userChoices)
pw
- The Pokémon to check for being outsped and 2HKOed.userChoices
- The specified Pokémon choices to be checked for priority moves.opponentChoices
- The choices to check for outspeeding and 2HKOing the Pokémon.public static boolean canOutspeedAndKO(int numTurns, java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw, java.util.List<MoveChoice> userChoices)
public static boolean canKOFromFull(java.util.List<MoveChoice> opponentChoices, PixelmonWrapper pw, int numTurns)
opponentChoices
- The opponent choices for the turn.pw
- The Pokémon to check for being KOed.numTurns
- The maximum number of turns the opponent can take to KO the Pokémon.@SafeVarargs public static boolean hasSuccessfulAttackChoice(java.util.List<MoveChoice> choices, java.util.Optional<ImmutableAttack>... attackNames)
choices
- The list of choices to search through.attackNames
- The names of attacks to look for.public static java.util.List<MoveChoice> getAffectedChoices(MoveChoice choice, java.util.List<MoveChoice> opponentChoices)
choice
- The move choice to be used.opponentChoices
- A list of all opponent choices.public static java.util.List<MoveChoice> getTargetedChoices(PixelmonWrapper pw, java.util.List<MoveChoice> opponentChoices)
@SafeVarargs public static boolean hasPriority(java.util.List<MoveChoice>... choices)
choices
- The choices to check.public static java.util.List<java.util.List<MoveChoice>> splitChoices(java.util.List<PixelmonWrapper> pokemonList, java.util.List<MoveChoice> choices)
pokemonList
- The different Pokémon that are using the choices.choices
- The choices to split.public static java.util.List<MoveChoice> mergeChoices(java.util.List<java.util.List<MoveChoice>> choices)
choices
- The separated list of choices to merge.public static java.util.List<MoveChoice> createChoicesFromChoices(PixelmonWrapper pw, java.util.List<MoveChoice> choices, boolean includeAllies)
pw
- The Pokémon using the choices.choices
- The choices to create a new list of choices from.includeAllies
- Whether to include moves that only target allies.public static float getMaxDamagePercent(PixelmonWrapper pw, java.util.List<MoveChoice> opponentChoices)
pw
- The Pokémon to get the maximum damage for.opponentChoices
- The choices doing damage to the Pokémon.public static java.util.List<MoveChoice> createMoveChoicesFromList(java.util.List<Attack> possibleAttacks, PixelmonWrapper pw)
possibleAttacks
- The list of attacks to make choices for.pw
- The Pokémon deciding on a move.public static boolean hasAttackCategory(java.util.List<MoveChoice> choices, AttackCategory category)
choices
- The list of choices to search.category
- The attack category to search for.public static boolean hasOffensiveAttackType(java.util.List<MoveChoice> choices, Element type)
choices
- The list of choices to search.type
- The type to search for.public static boolean hasSpreadMove(java.util.List<MoveChoice> choices)
choices
- The list of choices to search.public static float sumWeights(java.util.List<MoveChoice> choices)
choices
- The list of choices to get a weight sum from.public static boolean canBreakProtect(java.util.List<PixelmonWrapper> opponents, java.util.List<MoveChoice> choices)
opponents
- The opponents of the Protect user.choices
- The move choices of the opponent on the next turn.@SafeVarargs public static boolean hasMove(java.util.List<MoveChoice> choices, java.util.Optional<ImmutableAttack>... moveNames)
choices
- The move choices to search in.moveNames
- The moves to look for.