Class Attack
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intattack categories.static final intattack categories.static final intattack categories.booleanWhether the attack can never miss the targetfloatThe amount of damage dealt by the attack.booleanWhether the move critically hit or not.booleanbooleanstatic final intSpecial accuracy cases.booleanbooleanintThe accuracy of the attack.intThe base power of the attack.The result of the attack.static final intSpecial accuracy cases.intOverridden base power of the attack.intThe attack's PP.intThe number of PP UP's that have been used, always 3 for a PP maxintThe original accuracy of the attack before modifications.The original attack before modifications.intThe original power of the attack before modifications. -
Constructor Summary
ConstructorsConstructorDescriptionAttack(RegistryValue<ImmutableAttack> move) Makes a deep copy of the Attack objectAttack(ImmutableAttack base) Initializes an attack with its base attack stats.Initializes an attack with its base attack stats. -
Method Summary
Modifier and TypeMethodDescriptionApplies status and stat modifiers.static voidapplyContactEarly(PixelmonWrapper user, PixelmonWrapper target) Triggered when a Pokémon makes contact.static voidapplyContactLate(PixelmonWrapper user, PixelmonWrapper target) Triggered when a Pokémon makes contact.static voidapplyEffectAfterContactEffects(PixelmonWrapper user, PixelmonWrapper target) static voidapplyEffectBeforeContactLate(PixelmonWrapper user, PixelmonWrapper target) Applies an ability effect after most attack effects, but beforeapplyContactLate(PixelmonWrapper, PixelmonWrapper).static voidapplyOnDamageAbilityLate(PixelmonWrapper user, PixelmonWrapper target) Triggered when a Pokémon makes has a move used on it.static voidApplies status that affect the opponent's entire team.voidapplySelfStatusMove(PixelmonWrapper user, SingleInstanceMoveResult singleInstanceMoveResult) Triggered when a Pokémon uses a status move that targets itself.booleanattackMakesContact(PixelmonWrapper user, PixelmonWrapper target) Checks if the Pokémon's attack makes contact against the target.static doublecalcCriticalHit(EffectBase e, PixelmonWrapper user, PixelmonWrapper target) Calculates whether the attack will land a critical hit.doublecalculateMoveAccuracy(PixelmonWrapper user, PixelmonWrapper target, Ability userAbility) Make the calculations on how accurate a move will be.booleancanHit(PixelmonWrapper pixelmon1, PixelmonWrapper pixelmon2) Determines whether or not the attack can occur due to fainting.booleanChecks if the move succeeds even if there is no target.booleancanReachTarget(PixelmonWrapper user, PixelmonWrapper target) Determines whether or not the attack can reach the target based on targeting infobooleanChecks if the move is an offensive move that can remove a held Berry.booleancantMiss(PixelmonWrapper user, PixelmonWrapper target) Determines whether the move will never miss.booleanvoidcopy()Makes a copy of the move object.Creates a list containing the attack.createMoveChoices(PixelmonWrapper pw, boolean includeAllies) Creates a list of move choices for an attack.voidcreateMoveChoices(PixelmonWrapper pw, List<MoveChoice> choices, boolean includeAllies) Creates move choices out of an attack and adds them to a list.static booleandealsDamage(Attack attack) Determines whether the attack deals direct damage.deepCopy()Makes a copy of the move object.intdoDamageCalc(PixelmonWrapper userWrapper, PixelmonWrapper targetWrapper, double crit) Calculates the attack's damage.booleanDetermines whether the attack continues between turns.booleanvoidContains all the attack effects that are done after dealing damage.The unmodified attack details.net.minecraft.core.Holder<Type> The attack's category, Physical/Special/Status.static ImmutableAttack[]getAttacks(String[] nameList) Gets move details for an array of moves.static floatgetChanceToCrit(EffectBase e, PixelmonWrapper user, PixelmonWrapper target) booleanReturns whether the move is disabled.intgetMaxPP()The attack's maximum PP with PP Ups.getMove()The current attack.Iterates through theMoveResults.getMoveResultsList()backwards to grab the most recentSingleInstanceMoveResultthat has the specified Pixelmon as its target and returns it.intintgetPP()The attack's current PP.intThe amount of PP Ups that have been used to upgrade the maximum PP of the move.net.minecraft.core.Holder<Type> getType()doublegetTypeEffectiveness(PixelmonWrapper user, PixelmonWrapper target) Gets the type effectiveness of the move on its target.static booleanChecks if there is a move with a certain name.static booleanhasAttack(List<Attack> attackList, RegistryValue<ImmutableAttack>... attacks) Checks if a list of attacks has certain attacks in it.static booleanhasAttack(List<Attack> attackList, Optional<ImmutableAttack>... attacks) Checks if a list of attacks has certain attacks in it.inthashCode()static booleanhasMoreEffects(Attack attack, EffectBase effect) Determines whether the attack has more possible effects to try.booleanhasNoEffect(PixelmonWrapper user, PixelmonWrapper target) Checks if the move has no effect on the target Pokémon.static booleanhasOffensiveAttackType(List<Attack> attackList, net.minecraft.resources.ResourceKey<Type> type) Checks if a list of attacks has an offensive attack of a certain type.booleanhasSTAB(PixelmonWrapper user) Determines whether the attack has STAB.booleanWhether the move has any effect that makes it ignore the weather.voidInitializes the attack's stats and PP.final booleanisAttack(RegistryValue<ImmutableAttack>... attacks) booleanisAttack(ImmutableAttack... attacks) Determines whether the attack is one of the specified attacks.final booleanisAttack(List<Supplier<ImmutableAttack>> attacks) final booleanisAttack(Optional<ImmutableAttack>... attacks) booleanvoidmanageDealingDamage(PixelmonWrapper user, EffectBase critModifier, float damageMultiplier) A function for keeping together all the code that helps the attacking Pixelmon finally deal damage.static voidmodifyMoveEffects(PixelmonWrapper user, PixelmonWrapper target, List<EffectBase> effects) int[]modifyPowerAndAccuracy(PixelmonWrapper user, PixelmonWrapper target, Ability userAbility, Ability targetAbility, int livePower) Modify the attacker's power and accuracy based on abilities, items, and statuses.voidonMiss(PixelmonWrapper user, PixelmonWrapper target, SingleInstanceMoveResult singleInstanceMoveResult, Object cause) Handles procedures when the attack misses.voidoverrideAttackCategory(AttackCategory category) voidoverridePPMax(int pp) Replaces the maximum PP of a move, overriding any PP Up/PP Max used.voidoverrideType(net.minecraft.core.Holder<Type> type) voidoverrideType(net.minecraft.resources.ResourceKey<Type> type) voidplayAnimation(PixelmonWrapper user, PixelmonWrapper target) Does animation for the attack.static voidpostProcessAttackAllHits(PixelmonWrapper user, PixelmonWrapper target, Attack attack, float totalDamage, DamageTypeEnum damageType, boolean onSubstitute) Applies any post-damage effects after all hits of a move.voidRestores the base attack's details if they are modified during the attack.voidvoidRestores the base attack's details if they are modified during the attack.voidSaves the base attack's details.voidsendEffectiveChat(PixelmonWrapper user, PixelmonWrapper target) Sends a battle message about the type effectiveness of an attack.voidsetDisabled(boolean value, PixelmonWrapper pixelmon) Disables or enables a move.voidsetDisabled(boolean value, PixelmonWrapper pixelmon, boolean switching) Disables or enables a move.voidsetMoveAccuracy(int moveAccuracy) voidsetOverridePower(int overridePower) voidsetPP(int pp) Sets this attack's current PP.voidsetPPLevel(int ppLevel) Sets how many PP Ups have been used on the Pokémon to increase the maximum PP for this move.toString()booleanuse(PixelmonWrapper user) booleanuse(PixelmonWrapper user, ZMove zMove) Executes the attack.
-
Field Details
-
ATTACK_PHYSICAL
public static final int ATTACK_PHYSICALattack categories.- See Also:
-
ATTACK_SPECIAL
public static final int ATTACK_SPECIALattack categories.- See Also:
-
ATTACK_STATUS
public static final int ATTACK_STATUSattack categories.- See Also:
-
NEVER_MISS
public static final int NEVER_MISSSpecial accuracy cases.- See Also:
-
IGNORE_SEMIINVULNERABLE
public static final int IGNORE_SEMIINVULNERABLESpecial accuracy cases.- See Also:
-
pp
public int ppThe attack's PP. -
ppLevel
public int ppLevelThe number of PP UP's that have been used, always 3 for a PP max -
movePower
public int movePowerThe base power of the attack. -
overridePower
public int overridePowerOverridden base power of the attack. -
moveAccuracy
public int moveAccuracyThe accuracy of the attack. -
cantMiss
public boolean cantMissWhether the attack can never miss the target -
moveResults
The result of the attack. -
damageResult
public float damageResultThe amount of damage dealt by the attack. -
didCrit
public boolean didCritWhether the move critically hit or not. -
savedAttack
The original attack before modifications. -
savedPower
public int savedPowerThe original power of the attack before modifications. -
savedAccuracy
public int savedAccuracyThe original accuracy of the attack before modifications. -
hasPlayedAnimationOnce
public transient boolean hasPlayedAnimationOnce -
isZ
public transient boolean isZ -
isMax
public transient boolean isMax -
originalMove
-
fromDancer
public transient boolean fromDancer
-
-
Constructor Details
-
Attack
Initializes an attack with its base attack stats.- Parameters:
base- The base attack stats of this attack.
-
Attack
Initializes an attack with its base attack stats.- Parameters:
moveName- The name of the attack.
-
Attack
-
Attack
Makes a deep copy of the Attack object- Parameters:
attack- The attack we are assigning
-
-
Method Details
-
initializeAttack
Initializes the attack's stats and PP.- Parameters:
base- The base attack to initialize the attack from.
-
getMove
The current attack. -
getActualMove
The unmodified attack details. -
getPP
public int getPP()The attack's current PP. -
setPP
public void setPP(int pp) Sets this attack's current PP.- Parameters:
pp- A non-negative number.
-
getPPLevel
public int getPPLevel()The amount of PP Ups that have been used to upgrade the maximum PP of the move.This should have a minimum value of 0 and a maximum value of 3.
-
setPPLevel
public void setPPLevel(int ppLevel) Sets how many PP Ups have been used on the Pokémon to increase the maximum PP for this move.- Parameters:
ppLevel- An integer between 0 and 3.
-
getMaxPP
public int getMaxPP()The attack's maximum PP with PP Ups. -
overridePPMax
public void overridePPMax(int pp) Replaces the maximum PP of a move, overriding any PP Up/PP Max used.Typically used for transforming into another Pokemon or into another form, such as during Dynamaxing.
- Parameters:
pp- The number that the move's maximum PP will be set to.
-
getOverriddenPPMax
- Returns:
- the overriddenPPMax. used for updating the client that there is a override.
-
getEffects
- Returns:
- The effects for the move, whether modified by the field or base.
-
getAttackCategory
The attack's category, Physical/Special/Status. -
overrideAttackCategory
-
getType
-
getActualType
-
clearOverrideType
public void clearOverrideType() -
overrideType
-
overrideType
-
resetMove
public void resetMove()Restores the base attack's details if they are modified during the attack. -
resetOverridePower
public void resetOverridePower() -
use
-
use
Executes the attack.- Returns:
- boolean Whether the attack's PP will be lowered.
-
modifyMoveEffects
public static void modifyMoveEffects(PixelmonWrapper user, PixelmonWrapper target, List<EffectBase> effects) -
modifyPowerAndAccuracy
public int[] modifyPowerAndAccuracy(PixelmonWrapper user, PixelmonWrapper target, Ability userAbility, Ability targetAbility, int livePower) Modify the attacker's power and accuracy based on abilities, items, and statuses.- Parameters:
user- The Pokémon using the move.target- The Pokémon being attacked.userAbility- The attacking Pokémon's ability.livePower- The current power of the move.- Returns:
- Returns an integer array of size 2, with the first index representing the power of the move and the second index representing the accuracy of the move.
-
calculateMoveAccuracy
public double calculateMoveAccuracy(PixelmonWrapper user, PixelmonWrapper target, Ability userAbility) Make the calculations on how accurate a move will be.- Parameters:
user- The Pokémon using the move.target- The Pokémon being attacked.userAbility- The user's ability.- Returns:
- Whether a Pokémon self-targeted themselves with a move.
-
hasNoEffect
Checks if the move has no effect on the target Pokémon.- Parameters:
user- The Pokémon using the move.target- The Pokémon being targeted by the move.- Returns:
- Whether the move has no effect on the target Pokémon.
-
manageDealingDamage
public void manageDealingDamage(PixelmonWrapper user, EffectBase critModifier, float damageMultiplier) A function for keeping together all the code that helps the attacking Pixelmon finally deal damage.Manages whether a critical hit occurs, how much damage will be dealt, notifying players of critical hits, dealing the damage, and the result of the damage.
- Parameters:
user- The Pixelmon making an attack.critModifier- An effect for adjusting the power of critical hits.damageMultiplier- Adjust how much damage will be dealt.
-
playAnimation
Does animation for the attack.- Parameters:
user- The attack's user.target- The attack's target.
-
doDamageCalc
Calculates the attack's damage.- Parameters:
userWrapper- The attack's user.targetWrapper- The attack's target.crit- The critical hit modifier.- Returns:
- The calculated damage.
-
applySelfStatusMove
public void applySelfStatusMove(PixelmonWrapper user, SingleInstanceMoveResult singleInstanceMoveResult) Triggered when a Pokémon uses a status move that targets itself.- Parameters:
user- The attack's user.singleInstanceMoveResult- The results of the attack.
-
executeAttackEffectsAfterDamage
Contains all the attack effects that are done after dealing damage.- Parameters:
user- The source of the attack or damage.
-
applyAttackEffect
Applies status and stat modifiers.- Parameters:
user- The attack's user.- Returns:
- The attack's result.
-
applyContactEarly
Triggered when a Pokémon makes contact.- Parameters:
user- The attack's user.target- The attack's target.
-
applyOnDamageAbilityLate
Triggered when a Pokémon makes has a move used on it. Occurs after other end-of-move effects.Guarantees for its effects that the target took damage this turn.
- Parameters:
user- The move's user.target- The move's target.
-
applyEffectBeforeContactLate
Applies an ability effect after most attack effects, but beforeapplyContactLate(PixelmonWrapper, PixelmonWrapper).Does not require the user or target to make contact.
- Parameters:
user- The user with the ability that is attacking.target- The target of the attack.
-
applyContactLate
Triggered when a Pokémon makes contact. Occurs after other end-of-move effects.Also handles the special interaction between Protective Pads and
Pickpocket.- Parameters:
user- The move's user.target- The move's target.
-
applyEffectAfterContactEffects
-
applyOppositeTeamStatusesAfterContactEffects
Applies status that affect the opponent's entire team.This occurs after contact effects so that effect such as Ceaseless Edge's Spikes will only apply so long as the user has not fainted.
- Parameters:
user- The Pixelmon using the move to apply an effect.
-
postProcessAttackAllHits
public static void postProcessAttackAllHits(PixelmonWrapper user, PixelmonWrapper target, Attack attack, float totalDamage, DamageTypeEnum damageType, boolean onSubstitute) Applies any post-damage effects after all hits of a move.- Parameters:
user- The attack's user.target- The attack's target.attack- The attack.totalDamage- The total damage dealt by the attack.damageType- The type of damage dealt.onSubstitute- Whether the damage was done on a substitute.
-
onMiss
public void onMiss(PixelmonWrapper user, PixelmonWrapper target, SingleInstanceMoveResult singleInstanceMoveResult, Object cause) Handles procedures when the attack misses.- Parameters:
user- The attack's user.singleInstanceMoveResult- The result of the move.cause- The cause of the attack missing.
-
hasSTAB
Determines whether the attack has STAB.- Parameters:
user- The attack's user.- Returns:
- Whether the attack has STAB.
-
setDisabled
Disables or enables a move.- Parameters:
value- Whether the move is to be disabled (true) or enabled (false).pixelmon- The Pokémon with the move.
-
setDisabled
Disables or enables a move.- Parameters:
value- Whether the move is to be disabled (true) or enabled (false).pixelmon- The Pokémon with the move.switching- Whether the Pokémon is switching out.
-
getDisabled
public boolean getDisabled()Returns whether the move is disabled.- Returns:
- Whether the move is disabled.
-
canUseMove
public boolean canUseMove() -
calcCriticalHit
Calculates whether the attack will land a critical hit.- Parameters:
e- An attack effect that influences critical hit calculation, if applicable.user- The attack's user.target- The attack's target.- Returns:
- The critical hit modifier.
-
getChanceToCrit
-
canHit
Determines whether or not the attack can occur due to fainting.- Parameters:
pixelmon1- The attack's user.pixelmon2- The attack's target.- Returns:
- Whether the attack can occur.
-
canReachTarget
Determines whether or not the attack can reach the target based on targeting info- Parameters:
user- The attack's user.target- The attack's target.- Returns:
- Whether the attack can reach the opponent.
-
doesPersist
Determines whether the attack continues between turns.- Parameters:
pw- The attack's user.- Returns:
- Whether the attack continues between turns.
-
cantMiss
Determines whether the move will never miss.- Parameters:
user- The move's user.target- The move's target.- Returns:
- Whether the move will never miss.
-
sendEffectiveChat
Sends a battle message about the type effectiveness of an attack.- Parameters:
user- The attack's user.target- The attack's target.
-
dealsDamage
Determines whether the attack deals direct damage.- Parameters:
attack- The attack to check.- Returns:
- Whether the attack deals direct damage.
-
hasMoreEffects
Determines whether the attack has more possible effects to try.- Parameters:
attack- The attack to check.effect- The current effect.- Returns:
- Whether the attack deals direct damage.
-
saveAttack
public void saveAttack()Saves the base attack's details. -
restoreAttack
public void restoreAttack()Restores the base attack's details if they are modified during the attack. -
isAttack
Determines whether the attack is one of the specified attacks.- Parameters:
attacks- The attacks to compare this attack to.- Returns:
- Whether the attack is one of the specified attacks.
-
isAttack
-
isAttack
-
isAttack
-
hasAttack
@SafeVarargs public static boolean hasAttack(List<Attack> attackList, Optional<ImmutableAttack>... attacks) Checks if a list of attacks has certain attacks in it.- Parameters:
attackList- The list of attacks to search.attacks- The attacks to look for.- Returns:
- Whether the attack list has at least one of the specified attacks.
-
hasAttack
@SafeVarargs public static boolean hasAttack(List<Attack> attackList, RegistryValue<ImmutableAttack>... attacks) Checks if a list of attacks has certain attacks in it.- Parameters:
attackList- The list of attacks to search.attacks- The attacks to look for.- Returns:
- Whether the attack list has at least one of the specified attacks.
-
hasOffensiveAttackType
public static boolean hasOffensiveAttackType(List<Attack> attackList, net.minecraft.resources.ResourceKey<Type> type) Checks if a list of attacks has an offensive attack of a certain type.- Parameters:
attackList- The list of attacks to search.type- The type to look for.- Returns:
- Whether the list of attacks has an offensive attack of the specified type.
-
createMoveChoices
Creates move choices out of an attack and adds them to a list.- Parameters:
pw- The Pokémon using the attack.choices- The list of choices to add the new choices to.includeAllies- Whether to include choices that only target teammates.
-
createMoveChoices
Creates a list of move choices for an attack.- Parameters:
pw- The Pokémon using the attack.includeAllies- Whether to include choices that only target teammates.- Returns:
- A list of the move choices for an attack.
-
createList
Creates a list containing the attack.- Returns:
- A list containing the attack.
-
equals
-
hashCode
public int hashCode() -
getTypeEffectiveness
Gets the type effectiveness of the move on its target.- Parameters:
user- The user of the move.target- The target of the move.- Returns:
- The type effectiveness multiplier of the move on its target.
-
canRemoveBerry
public boolean canRemoveBerry()Checks if the move is an offensive move that can remove a held Berry. Used to delay the potential activation of Berries for these moves.- Returns:
- Whether the move is an offensive move that can remove a held Berry.
-
copy
Makes a copy of the move object.Creates a new Attack using
Attack(Attack)and copies the current amount of PP the old Attack has, the old Attack's PP Level (PP Up usage), and whether it was activated by a Dancer ability.- Returns:
- A copy of the move object.
-
deepCopy
Makes a copy of the move object.As opposed to
copy(), this function should copy every member variable of the current Attack.- Returns:
- A copy of the move object.
-
canHitNoTarget
public boolean canHitNoTarget()Checks if the move succeeds even if there is no target.- Returns:
- Whether the move succeeds even if there is no target.
-
isSoundBased
public boolean isSoundBased() -
hasAttack
Checks if there is a move with a certain name.- Parameters:
moveName- The name of the move to look for.- Returns:
- Whether there is a move with the specified name.
-
getAttacks
Gets move details for an array of moves.- Parameters:
nameList- The names of the moves to get details for.- Returns:
- An array of move details corresponding to the specified moves.
-
setOverridePower
public void setOverridePower(int overridePower) -
getOverridePower
public int getOverridePower() -
setMoveAccuracy
public void setMoveAccuracy(int moveAccuracy) -
ignoresWeather
Whether the move has any effect that makes it ignore the weather.- Parameters:
pw- The user of the move.- Returns:
- True if the move ignores the weather.
-
toString
-
getMoveResultForPixelmonWrapper
Iterates through theMoveResults.getMoveResultsList()backwards to grab the most recentSingleInstanceMoveResultthat has the specified Pixelmon as its target and returns it. If one is not found, a new SingleInstanceMoveResult is created, added to that list, and returned.- Parameters:
pw- The Pixelmon that is the target of the attack.- Returns:
- The most recent
SingleInstanceMoveResultfor the specified Pixelmon.
-
attackMakesContact
Checks if the Pokémon's attack makes contact against the target.- Parameters:
user- The attackertarget- The defender- Returns:
- Whether the Pokémon's attack should be treated as making contact
-