public class Attack
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ATTACK_PHYSICAL
attack categories.
|
static int |
ATTACK_SPECIAL
attack categories.
|
static int |
ATTACK_STATUS
attack categories.
|
boolean |
cantMiss
Whether the attack can never miss the target
|
float |
damageResult
The amount of damage dealt by the attack.
|
boolean |
didCrit
Whether the move critically hit or not.
|
static float |
EFFECTIVE_BARELY
Type effectiveness multipliers.
|
static float |
EFFECTIVE_MAX
Type effectiveness multipliers.
|
static float |
EFFECTIVE_NONE
Type effectiveness multipliers.
|
static float |
EFFECTIVE_NORMAL
Type effectiveness multipliers.
|
static float |
EFFECTIVE_NOT
Type effectiveness multipliers.
|
static float |
EFFECTIVE_SUPER
Type effectiveness multipliers.
|
boolean |
fromDancer |
boolean |
hasPlayedAnimationOnce |
static int |
IGNORE_SEMIINVULNERABLE
Special accuracy cases.
|
boolean |
isMax |
boolean |
isZ |
int |
moveAccuracy
The accuracy of the attack.
|
int |
movePower
The base power of the attack.
|
MoveResults |
moveResult
The result of the attack.
|
static int |
NEVER_MISS
Special accuracy cases.
|
Attack |
originalMove |
int |
overridePower
Overridden base power of the attack.
|
int |
pp
The attack's PP.
|
int |
ppLevel
The number of PP UP's that have been used, always 3 for a PP max
|
int |
savedAccuracy
The original accuracy of the attack before modifications.
|
ImmutableAttack |
savedAttack
The original attack before modifications.
|
int |
savedPower
The original power of the attack before modifications.
|
Constructor and Description |
---|
Attack(Attack attack)
Makes a deep copy of the Attack object
|
Attack(ImmutableAttack base)
Initializes an attack with its base attack stats.
|
Attack(java.util.Optional<ImmutableAttack> move) |
Attack(java.lang.String moveName)
Initializes an attack with its base attack stats.
|
Modifier and Type | Method and Description |
---|---|
AttackResult |
applyAttackEffect(PixelmonWrapper user,
PixelmonWrapper target)
Applies status and stat modifiers.
|
static void |
applyContact(PixelmonWrapper user,
PixelmonWrapper target)
Triggered when a Pokémon makes contact.
|
static void |
applyContactLate(PixelmonWrapper user,
PixelmonWrapper target)
Triggered when a Pokémon makes contact.
|
void |
applySelfStatusMove(PixelmonWrapper user,
MoveResults moveResults)
Triggered when a Pokémon uses a status move that targets itself.
|
static double |
calcCriticalHit(EffectBase e,
PixelmonWrapper user,
PixelmonWrapper target)
Calculates whether the attack will land a critical hit.
|
boolean |
canHit(PixelmonWrapper pixelmon1,
PixelmonWrapper pixelmon2)
Determines whether or not the attack can occur due to fainting.
|
boolean |
canHitNoTarget()
Checks if the move succeeds even if there is no target.
|
boolean |
canRemoveBerry()
Checks if the move is an offensive move that can remove a held Berry.
|
boolean |
cantMiss(PixelmonWrapper user)
Determines whether the move will never miss.
|
boolean |
canUseMove() |
boolean |
checkSkyBattle(BattleController bc)
Checks if the move can be used if the battle is a Sky Battle.
|
Attack |
copy()
Makes a copy of the move object.
|
java.util.ArrayList<Attack> |
createList()
Creates a list containing the attack.
|
java.util.ArrayList<MoveChoice> |
createMoveChoices(PixelmonWrapper pw,
boolean includeAllies)
Creates a list of move choices for an attack.
|
void |
createMoveChoices(PixelmonWrapper pw,
java.util.List<MoveChoice> choices,
boolean includeAllies)
Creates move choices out of an attack and adds them to a list.
|
static boolean |
dealsDamage(Attack attack)
Determines whether the attack deals direct damage.
|
Attack |
deepCopy()
Makes a copy of the move object.
|
int |
doDamageCalc(PixelmonWrapper userWrapper,
PixelmonWrapper targetWrapper,
double crit)
Calculates the attack's damage.
|
boolean |
doesPersist(PixelmonWrapper pw)
Determines whether the attack continues between turns.
|
boolean |
equals(java.lang.Object compare) |
ImmutableAttack |
getActualMove()
The unmodified attack details.
|
Element |
getActualType() |
AttackCategory |
getAttackCategory()
The attack's category, Physical/Special/Status.
|
static ImmutableAttack[] |
getAttacks(java.lang.String[] nameList)
Gets move details for an array of moves.
|
boolean |
getDisabled()
Returns whether the move is disabled.
|
int |
getMaxPP()
The attack's maximum PP with PP Ups.
|
ImmutableAttack |
getMove()
The current attack.
|
java.lang.Integer |
getOverriddenPPMax() |
int |
getOverridePower() |
Element |
getType() |
double |
getTypeEffectiveness(PixelmonWrapper user,
PixelmonWrapper target)
Gets the type effectiveness of the move on its target.
|
static boolean |
hasAttack(java.util.List<Attack> attackList,
java.util.Optional<ImmutableAttack>... attacks)
Checks if a list of attacks has certain attacks in it.
|
static boolean |
hasAttack(java.lang.String moveName)
Checks if there is a move with a certain name.
|
int |
hashCode() |
static boolean |
hasMoreEffects(Attack attack,
EffectBase effect)
Determines whether the attack has more possible effects to try.
|
boolean |
hasNoEffect(PixelmonWrapper user,
PixelmonWrapper target)
Checks if the move has no effect on the target Pokémon.
|
static boolean |
hasOffensiveAttackType(java.util.List<Attack> attackList,
Element type)
Checks if a list of attacks has an offensive attack of a certain type.
|
boolean |
hasSTAB(PixelmonWrapper user)
Determines whether the attack has STAB.
|
boolean |
ignoresWeather(PixelmonWrapper pw)
Whether the move has any effect that makes it ignore the weather.
|
void |
initializeAttack(ImmutableAttack base)
Initializes the attack's stats and PP.
|
boolean |
isAttack(ImmutableAttack... attacks)
Determines whether the attack is one of the specified attacks.
|
boolean |
isAttack(java.util.List<java.util.function.Supplier<ImmutableAttack>> attacks) |
boolean |
isAttack(java.util.Optional<ImmutableAttack>... attacks) |
boolean |
isSoundBased() |
void |
onMiss(PixelmonWrapper user,
PixelmonWrapper target,
MoveResults results,
java.lang.Object cause)
Handles procedures when the attack misses.
|
void |
overrideAttackCategory(AttackCategory category) |
void |
overridePPMax(int pp) |
void |
overrideType(Element type) |
void |
playAnimation(PixelmonWrapper user,
PixelmonWrapper target)
Does animation for the attack.
|
static void |
postProcessAttackAllHits(PixelmonWrapper user,
PixelmonWrapper target,
Attack attack,
float power,
DamageTypeEnum damageType,
boolean onSubstitute)
Applies any post-damage effects after all hits of a move.
|
void |
resetMove()
Restores the base attack's details if they are modified during the attack.
|
void |
resetOverridePower() |
void |
restoreAttack()
Restores the base attack's details if they are modified during the attack.
|
void |
saveAttack()
Saves the base attack's details.
|
void |
sendEffectiveChat(PixelmonWrapper user,
PixelmonWrapper target)
Sends a battle message about the type effectiveness of an attack.
|
void |
setDisabled(boolean value,
PixelmonWrapper pixelmon)
Disables or enables a move.
|
void |
setDisabled(boolean value,
PixelmonWrapper pixelmon,
boolean switching)
Disables or enables a move.
|
void |
setMoveAccuracy(int moveAccuracy) |
void |
setOverridePower(int overridePower) |
java.lang.String |
toString() |
boolean |
use(PixelmonWrapper user,
PixelmonWrapper target,
MoveResults moveResults) |
boolean |
use(PixelmonWrapper user,
PixelmonWrapper target,
MoveResults moveResults,
ZMove zMove)
Executes the attack.
|
public static final float EFFECTIVE_NORMAL
public static final float EFFECTIVE_SUPER
public static final float EFFECTIVE_MAX
public static final float EFFECTIVE_NOT
public static final float EFFECTIVE_BARELY
public static final float EFFECTIVE_NONE
public static final int ATTACK_PHYSICAL
public static final int ATTACK_SPECIAL
public static final int ATTACK_STATUS
public static final int NEVER_MISS
public static final int IGNORE_SEMIINVULNERABLE
public int pp
public int ppLevel
public int movePower
public int overridePower
public int moveAccuracy
public boolean cantMiss
public MoveResults moveResult
public float damageResult
public boolean didCrit
public ImmutableAttack savedAttack
public int savedPower
public int savedAccuracy
public transient boolean hasPlayedAnimationOnce
public transient boolean isZ
public transient boolean isMax
public transient Attack originalMove
public transient boolean fromDancer
public Attack(ImmutableAttack base)
base
- The base attack stats of this attack.public Attack(java.lang.String moveName)
moveName
- The name of the attack.public Attack(java.util.Optional<ImmutableAttack> move)
public Attack(Attack attack)
attack
- The attack we are assigningpublic void initializeAttack(ImmutableAttack base)
base
- The base attack to initialize the attack from.public ImmutableAttack getMove()
public ImmutableAttack getActualMove()
public int getMaxPP()
public void overridePPMax(int pp)
public java.lang.Integer getOverriddenPPMax()
public AttackCategory getAttackCategory()
public void overrideAttackCategory(AttackCategory category)
public Element getType()
public Element getActualType()
public void overrideType(Element type)
public void resetMove()
public void resetOverridePower()
public boolean use(PixelmonWrapper user, PixelmonWrapper target, MoveResults moveResults)
public boolean use(PixelmonWrapper user, PixelmonWrapper target, MoveResults moveResults, ZMove zMove)
public boolean hasNoEffect(PixelmonWrapper user, PixelmonWrapper target)
user
- The Pokémon using the move.target
- The Pokémon being targeted by the move.public void playAnimation(PixelmonWrapper user, PixelmonWrapper target)
user
- The attack's user.target
- The attack's target.public int doDamageCalc(PixelmonWrapper userWrapper, PixelmonWrapper targetWrapper, double crit)
userWrapper
- The attack's user.targetWrapper
- The attack's target.crit
- The critical hit modifier.public void applySelfStatusMove(PixelmonWrapper user, MoveResults moveResults)
user
- The attack's user.moveResults
- The results of the attack.public AttackResult applyAttackEffect(PixelmonWrapper user, PixelmonWrapper target)
user
- The attack's user.target
- The attack's target.public static void applyContact(PixelmonWrapper user, PixelmonWrapper target)
user
- The attack's user.target
- The attack's target.public static void applyContactLate(PixelmonWrapper user, PixelmonWrapper target)
user
- The move's user.target
- The move's target.public static void postProcessAttackAllHits(PixelmonWrapper user, PixelmonWrapper target, Attack attack, float power, DamageTypeEnum damageType, boolean onSubstitute)
user
- The attack's user.target
- The attack's target.attack
- The attack.power
- The damage dealt by the attack.damageType
- The type of damage dealt.onSubstitute
- Whether the damage was done on a substitute.public void onMiss(PixelmonWrapper user, PixelmonWrapper target, MoveResults results, java.lang.Object cause)
user
- The attack's user.target
- The attack's target.results
- The results of the move.cause
- The cause of the attack missing.public boolean hasSTAB(PixelmonWrapper user)
user
- The attack's user.public void setDisabled(boolean value, PixelmonWrapper pixelmon)
value
- Whether the move is to be disabled (true) or enabled (false).pixelmon
- The Pokémon with the move.public void setDisabled(boolean value, PixelmonWrapper pixelmon, boolean switching)
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.public boolean getDisabled()
public boolean canUseMove()
public static double calcCriticalHit(EffectBase e, PixelmonWrapper user, PixelmonWrapper target)
e
- An attack effect that influences critical hit calculation, if applicable.user
- The attack's user.target
- The attack's target.public boolean canHit(PixelmonWrapper pixelmon1, PixelmonWrapper pixelmon2)
pixelmon1
- The attack's user.pixelmon2
- The attack's target.public boolean doesPersist(PixelmonWrapper pw)
pw
- The attack's user.public boolean cantMiss(PixelmonWrapper user)
user
- The move's user.public void sendEffectiveChat(PixelmonWrapper user, PixelmonWrapper target)
user
- The attack's user.target
- The attack's target.public static boolean dealsDamage(Attack attack)
attack
- The attack to check.public static boolean hasMoreEffects(Attack attack, EffectBase effect)
attack
- The attack to check.effect
- The current effect.public void saveAttack()
public void restoreAttack()
public boolean isAttack(ImmutableAttack... attacks)
attacks
- The attacks to compare this attack to.@SafeVarargs public final boolean isAttack(java.util.Optional<ImmutableAttack>... attacks)
public final boolean isAttack(java.util.List<java.util.function.Supplier<ImmutableAttack>> attacks)
@SafeVarargs public static boolean hasAttack(java.util.List<Attack> attackList, java.util.Optional<ImmutableAttack>... attacks)
attackList
- The list of attacks to search.attacks
- The attacks to look for.public static boolean hasOffensiveAttackType(java.util.List<Attack> attackList, Element type)
attackList
- The list of attacks to search.type
- The type to look for.public void createMoveChoices(PixelmonWrapper pw, java.util.List<MoveChoice> choices, boolean includeAllies)
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.public java.util.ArrayList<MoveChoice> createMoveChoices(PixelmonWrapper pw, boolean includeAllies)
pw
- The Pokémon using the attack.includeAllies
- Whether to include choices that only target teammates.public java.util.ArrayList<Attack> createList()
public boolean equals(java.lang.Object compare)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public double getTypeEffectiveness(PixelmonWrapper user, PixelmonWrapper target)
user
- The user of the move.target
- The target of the move.public boolean canRemoveBerry()
public Attack copy()
public Attack deepCopy()
public boolean checkSkyBattle(BattleController bc)
bc
- The battle that the move is to be used in.public boolean canHitNoTarget()
public boolean isSoundBased()
public static boolean hasAttack(java.lang.String moveName)
moveName
- The name of the move to look for.public static ImmutableAttack[] getAttacks(java.lang.String[] nameList)
nameList
- The names of the moves to get details for.public void setOverridePower(int overridePower)
public int getOverridePower()
public void setMoveAccuracy(int moveAccuracy)
public boolean ignoresWeather(PixelmonWrapper pw)
pw
- The user of the move.public java.lang.String toString()
toString
in class java.lang.Object