Class EffectBase
java.lang.Object
com.pixelmonmod.pixelmon.battles.attacks.EffectBase
- Direct Known Subclasses:
AttackModifierBase
,ClearTerrain
,IgnoreDefense
,MultiTurnSpecialAttackBase
,SpecialAttackBase
,StatsEffect
,StatsEffectPost
,StatusBase
,StrengthSap
,ZCurse
A move attribute that causes varying effects in battle.
-
Field Summary
Modifier and TypeFieldDescriptionChance modifiers for the effect. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Triggers before the move is used.abstract void
applyEffect
(PixelmonWrapper user, PixelmonWrapper target) Causes various effects during the move.void
Triggers after a Pokemon attacks all of its targets.void
Triggers at the end of every turn after residual status damage has been applied.void
applyEffectHitOrMiss
(PixelmonWrapper user, PixelmonWrapper target) Triggers after a Pokemon attacks, no matter if it hits or misses.applyEffectStart
(PixelmonWrapper user, PixelmonWrapper target) Causes effects before the move's power is calculated.void
applyMissEffect
(PixelmonWrapper user, PixelmonWrapper target) Triggers when the move misses.boolean
canHitMultipleTargets
(Attack attack, PixelmonWrapper pw) Returns whether a move can conditionally hit multiple targets.abstract boolean
cantMiss
(PixelmonWrapper user) Determines whether a move cannot miss.void
changeChance
(float multiplier) Modifies the chance of a modifier's secondary effect occurring.boolean
checkChance
(BattleController controller) Randomly determines whether a secondary effect will occur based on the multiplier.void
dealtDamage
(PixelmonWrapper attacker, PixelmonWrapper defender, Attack attack, DamageTypeEnum damageType) Triggers when an attacker deals damage.void
dealtDamagePerHit
(PixelmonWrapper attacker, PixelmonWrapper defender, Attack attack, DamageTypeEnum damageType, int damageAmount) Triggers when an attacker deals damage.boolean
doesPersist
(PixelmonWrapper user) Returns whether the move lasts multiple turns.float
Gets the chance that the effect will occur.protected float
getWeightWithChance
(float weight) Chooses a weight for the effect based on the chance of it occurring.boolean
isChance()
Determines whether the move has a secondary effect.boolean
isUser()
Determines whether the move only affects the user.int
modifyDamage
(int damage, PixelmonWrapper user, PixelmonWrapper target, Attack a) Triggers when the Pokémon deals direct damage.int
modifyPriority
(int priority, ImmutableAttack attack, PixelmonWrapper pw) Modifies the priority of a move.void
modifyTargets
(List<PixelmonWrapper> targets, Attack attack, PixelmonWrapper pw) Modifies the targets of a move.double
modifyTypeEffectiveness
(List<Element> effectiveTypes, Element moveType, double baseEffectiveness) Modifies the type effectiveness of a move.double
modifyTypeEffectiveness
(List<Element> effectiveTypes, Element moveType, double baseEffectiveness, BattleController bc) Modifies the type effectiveness of a move.boolean
preventsRedirection
(PixelmonWrapper user, Attack attack) Prevents redirection abilities and moves from changing the targets of the user's attacksvoid
setChance
(float chance) Adds or sets the chance modifier for the event.void
weightEffect
(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> userChoices, List<MoveChoice> bestUserChoices, List<MoveChoice> opponentChoices, List<MoveChoice> bestOpponentChoices) Determines a weight for the move that has this effect.
-
Field Details
-
modifiers
Chance modifiers for the effect.
-
-
Constructor Details
-
EffectBase
public EffectBase()Initializes an effect. -
EffectBase
public EffectBase(boolean persists) Initializes an effect.- Parameters:
persists
- Whether the effect is a multi-turn move.
-
-
Method Details
-
applyEffectStart
Causes effects before the move's power is calculated.- Parameters:
user
- The move's user.target
- The move's target.- Returns:
- The result of the effect.
-
applyEffect
Causes various effects during the move.- Parameters:
user
- The move's user.target
- The move's target.
-
checkChance
Randomly determines whether a secondary effect will occur based on the multiplier.- Returns:
- True if the secondary effect will occur.
-
isChance
public boolean isChance()Determines whether the move has a secondary effect.- Returns:
- Whether the move has a secondary effect.
-
getChance
public float getChance()Gets the chance that the effect will occur.- Returns:
- The chance that the effect will occur.
-
changeChance
public void changeChance(float multiplier) Modifies the chance of a modifier's secondary effect occurring.- Parameters:
multiplier
- The multiplier to apply to the chance.
-
setChance
public void setChance(float chance) Adds or sets the chance modifier for the event.- Parameters:
chance
- The chance value to apply to the effect.
-
isUser
public boolean isUser()Determines whether the move only affects the user.- Returns:
- Whether the move only affects the user.
-
cantMiss
Determines whether a move cannot miss.- Parameters:
user
- The move's user.- Returns:
- Whether the move can't miss.
-
doesPersist
Returns whether the move lasts multiple turns.- Parameters:
user
- The move's user.- Returns:
- Whether the move lasts multiple turns.
-
applyMissEffect
Triggers when the move misses.- Parameters:
user
- The move's user.target
- The move's target.
-
applyEarlyEffect
Triggers before the move is used.- Parameters:
user
- The move's user.
-
applyEffectAfterAllTargets
Triggers after a Pokemon attacks all of its targets.- Parameters:
user
- The move's user.
-
applyEffectHitOrMiss
Triggers after a Pokemon attacks, no matter if it hits or misses.- Parameters:
user
- The move's user.
-
applyEffectAfterStatus
Triggers at the end of every turn after residual status damage has been applied.- Parameters:
user
- The Pokémon that attacked.
-
dealtDamage
public void dealtDamage(PixelmonWrapper attacker, PixelmonWrapper defender, Attack attack, DamageTypeEnum damageType) Triggers when an attacker deals damage.- Parameters:
attacker
- The source of the damage.defender
- The target of the damage.attack
- The attack used by the attacker.damageType
- The type of damage that was dealt.
-
dealtDamagePerHit
public void dealtDamagePerHit(PixelmonWrapper attacker, PixelmonWrapper defender, Attack attack, DamageTypeEnum damageType, int damageAmount) Triggers when an attacker deals damage.- Parameters:
attacker
- The source of the damage.defender
- The target of the damage.attack
- The attack used by the attacker.damageType
- The type of damage that was dealt.damageAmount
- The amount of damage that was dealt.
-
weightEffect
public void weightEffect(PixelmonWrapper pw, MoveChoice userChoice, List<MoveChoice> userChoices, List<MoveChoice> bestUserChoices, List<MoveChoice> opponentChoices, List<MoveChoice> bestOpponentChoices) Determines a weight for the move that has this effect. Used for battle AI.- Parameters:
pw
- The Pokémon using the move.userChoice
- The move with this effect.userChoices
- All choices the Pokémon has for the turn.bestUserChoices
- The best offensive choices the Pokémon has for the turn.opponentChoices
- All choices the opponent has for the turn.bestOpponentChoices
- The best choices the opponent has for the turn.
-
getWeightWithChance
protected float getWeightWithChance(float weight) Chooses a weight for the effect based on the chance of it occurring. Used for battle AI.- Parameters:
weight
- The weight to assign to the effect if it has more than a 50% chance of occurring.- Returns:
- The weight to assign to the effect.
-
modifyTypeEffectiveness
public double modifyTypeEffectiveness(List<Element> effectiveTypes, Element moveType, double baseEffectiveness) Modifies the type effectiveness of a move.- Parameters:
effectiveTypes
- The types of the Pokémon targeted by the move.moveType
- The type of the move being used in the calculation.baseEffectiveness
- The type effectiveness before modification.- Returns:
- The new type effectiveness.
-
modifyTypeEffectiveness
public double modifyTypeEffectiveness(List<Element> effectiveTypes, Element moveType, double baseEffectiveness, BattleController bc) Modifies the type effectiveness of a move.- Parameters:
effectiveTypes
- The types of the Pokémon targeted by the move.moveType
- The type of the move being used in the calculation.baseEffectiveness
- The type effectiveness before modification.bc
- The active in use battle controller, this method calls the method without BC if unused specifically by the effect- Returns:
- The new type effectiveness.
-
modifyPriority
Modifies the priority of a move.- Parameters:
priority
- The current calculated priority.attack
- The attack being used.pw
- The Pokémon using the move.- Returns:
- The new priority.
-
modifyTargets
Modifies the targets of a move.- Parameters:
targets
- The current targets of the attack.attack
- The attack being used.pw
- The Pokémon using the move.
-
canHitMultipleTargets
Returns whether a move can conditionally hit multiple targets.- Parameters:
attack
- The attack being used.pw
- The Pokémon using the move.- Returns:
- The new priority.
-
modifyDamage
Triggers when the Pokémon deals direct damage.- Parameters:
damage
- The amount of damage dealt.user
- The attack's user.target
- The attack's target.a
- The attack.- Returns:
- The modified damage.
-
preventsRedirection
Prevents redirection abilities and moves from changing the targets of the user's attacks- Parameters:
user
- The Pokémon using the attack.attack
- The attack.- Returns:
- Whether the attack will maintain its target.
-