java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<Attack>
com.pixelmonmod.pixelmon.api.pokemon.stats.Moveset
All Implemented Interfaces:
Cloneable, Iterable<Attack>, Collection<Attack>, List<Attack>, RandomAccess

public class Moveset extends AbstractList<Attack> implements RandomAccess, Cloneable
A Pokémon's moveset.
  • Field Details

    • pokemon

      public Pokemon pokemon
    • attacks

      public Attack[] attacks
    • ability

      protected Ability ability
    • tempAbility

      protected String tempAbility
  • Constructor Details

    • Moveset

      public Moveset()
    • Moveset

      public Moveset(Attack[] attacks, Ability ability)
      Initializes a moveset with attacks and an ability.
      Parameters:
      attacks - The attacks in the moveset.
      ability - The ability in the moveset.
    • Moveset

      public Moveset(Attack attack, Ability ability)
      Initializes the moveset with an attack and an ability.
      Parameters:
      attack - The attack to initialize the moveset with.
      ability - The ability to initialize the moveset with.
  • Method Details

    • withPokemon

      public Moveset withPokemon(Pokemon pokemon)
    • setTempAbility

      public void setTempAbility(String tempAbility)
    • getTempAbility

      @Nullable public String getTempAbility()
    • get

      @Nullable public Attack get(int index)
      Specified by:
      get in interface List<Attack>
      Specified by:
      get in class AbstractList<Attack>
    • add

      public boolean add(Attack a)
      Specified by:
      add in interface Collection<Attack>
      Specified by:
      add in interface List<Attack>
      Overrides:
      add in class AbstractList<Attack>
    • set

      public Attack set(int index, Attack a)
      Specified by:
      set in interface List<Attack>
      Overrides:
      set in class AbstractList<Attack>
    • tryNotifyPokemon

      public void tryNotifyPokemon()
    • swap

      public void swap(int index, int index2)
      Swaps the positions of two attacks.
      Parameters:
      index - One attack to swap.
      index2 - The attack to swap the first attack with.
    • remove

      public Attack remove(int index)
      Specified by:
      remove in interface List<Attack>
      Overrides:
      remove in class AbstractList<Attack>
    • removeIf

      public boolean removeIf(Predicate<? super Attack> predicate)
      Specified by:
      removeIf in interface Collection<Attack>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<Attack>
      Specified by:
      remove in interface List<Attack>
      Overrides:
      remove in class AbstractCollection<Attack>
    • size

      public int size()
      Specified by:
      size in interface Collection<Attack>
      Specified by:
      size in interface List<Attack>
      Specified by:
      size in class AbstractCollection<Attack>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<Attack>
      Specified by:
      isEmpty in interface List<Attack>
      Overrides:
      isEmpty in class AbstractCollection<Attack>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<Attack>
      Specified by:
      contains in interface List<Attack>
      Overrides:
      contains in class AbstractCollection<Attack>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<Attack>
      Specified by:
      clear in interface List<Attack>
      Overrides:
      clear in class AbstractList<Attack>
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag nbt)
      Writes the moveset to NBT.
      Parameters:
      nbt - The NBT tag to write to.
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag nbt)
      Reads the moveset from NBT.
      Parameters:
      nbt - The NBT tag to read from.
    • fromBytes

      public void fromBytes(net.minecraft.network.FriendlyByteBuf buf)
    • toBytes

      public void toBytes(net.minecraft.network.FriendlyByteBuf buf)
    • addCurrentMovesToReminder

      public void addCurrentMovesToReminder()
      Adds the current moves to the list of moves available via move reminder.
    • hasAttack

      public boolean hasAttack(Attack a)
      Checks if the Pokémon has the specified attack.
      Parameters:
      a - The attack to check for.
      Returns:
      Whether the Pokémon has the attack.
    • hasAttack

      public boolean hasAttack(ImmutableAttack... moves)
      Checks if the Pokémon has one of the specified moves.
      Parameters:
      moves - The attack(s) to look for.
      Returns:
      Whether the Pokémon has one of the specified moves.
    • hasAttack

      @SafeVarargs public final boolean hasAttack(Optional<ImmutableAttack>... moves)
      Checks if the Pokémon has one of the specified moves.
      Parameters:
      moves - The attack(s) to look for.
      Returns:
      Whether the Pokémon has one of the specified moves.
    • hasAttack

      @SafeVarargs public final boolean hasAttack(RegistryValue<ImmutableAttack>... moves)
      Checks if the Pokémon has one of the specified moves.
      Parameters:
      moves - The attack(s) to look for.
      Returns:
      Whether the Pokémon has one of the specified moves.
    • hasAttackCategory

      public boolean hasAttackCategory(AttackCategory attackCategory)
      Checks if the Pokémon has an offensive attack of a certain type.
      Parameters:
      attackCategory - The type to look for.
      Returns:
      Whether the Pokémon has an offensive attack of the specified type.
    • hasOffensiveAttackType

      public boolean hasOffensiveAttackType(Element... types)
      Checks if the Pokémon has an offensive attack of certain types.
      Parameters:
      types - The types to look for.
      Returns:
      Whether the Pokémon has an offensive attack of one of the specified types.
    • removeAttack

      public boolean removeAttack(ImmutableAttack removedAttack)
    • removeAttack

      @SafeVarargs public final void removeAttack(Optional<ImmutableAttack>... removedAttack)
    • removeAttack

      @SafeVarargs public final void removeAttack(RegistryValue<ImmutableAttack>... removedAttack)
    • replaceWith

      public void replaceWith(List<String> attackIds)
      Replaces the Pokémon moveset with a new one.
      Parameters:
      attackIds - The attack IDs of the moves to replace the moveset with.
    • hasFullPP

      public boolean hasFullPP()
      Checks if all of the moves in the moveset have full PP.
      Returns:
      Whether all of the moves in the moveset have full PP.
    • copy

      public Moveset copy()
      Makes a copy of the moveset.
    • replaceMove

      public boolean replaceMove(RegistryValue<ImmutableAttack> oldMove, Attack newMove)
      Replaces a move in the moveset with another move.
      Parameters:
      oldMove - The name of the move to replace.
      newMove - The move to replace the old move with.
      Returns:
      Whether the move was replaced successfully.
    • replaceMove

      public boolean replaceMove(RegistryValue<ImmutableAttack> oldMove, RegistryValue<ImmutableAttack> newMove, boolean persistPP)
    • healAllPP

      public void healAllPP()
      Restores the PP of all moves.
    • getReminderMoves

      public Set<ImmutableAttack> getReminderMoves()
      Returns:
      the set of moves that can be relearned by a Move Reminder. Added to by TRs.
    • loadMoveset

      public static Moveset loadMoveset(PokemonLink pokemon)
      Loads a Pokémon's moveset with random moves from its pokemonLevel-up movepool.
      Parameters:
      pokemon - The Pokémon to load.
    • getAbility

      public Ability getAbility()
    • setAbility

      public void setAbility(Ability ability)
    • isHiddenAbility

      public boolean isHiddenAbility(Pokemon pokemon)
    • isHiddenAbility

      public TriBoolean isHiddenAbility()
    • addImmutable

      public boolean addImmutable(Collection<ImmutableAttack> attacks)
    • addImmutable

      public boolean addImmutable(ImmutableAttack... attacks)
    • asImmutable

      public List<ImmutableAttack> asImmutable()
    • hasAbility

      public boolean hasAbility()
    • removeIllegalMoves

      public void removeIllegalMoves()
      Removes moves that the species/form should not be able to learn
    • toString

      public String toString()
      Overrides:
      toString in class AbstractCollection<Attack>