Class EffectBase

java.lang.Object
com.pixelmonmod.pixelmon.battles.attacks.EffectBase
Direct Known Subclasses:
AttackModifierBase, ClearTerrain, IgnoreDefense, MultiTurnSpecialAttackBase, SpecialAttackBase, StatsEffect, StatsEffectPost, StatusBase, StrengthSap, ZCurse

public abstract class EffectBase extends Object
A move attribute that causes varying effects in battle.
  • Field Details

  • 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

      public AttackResult applyEffectStart(PixelmonWrapper user, PixelmonWrapper target)
      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

      public abstract void applyEffect(PixelmonWrapper user, PixelmonWrapper target)
      Causes various effects during the move.
      Parameters:
      user - The move's user.
      target - The move's target.
    • checkChance

      public boolean checkChance(BattleController controller)
      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

      public abstract boolean cantMiss(PixelmonWrapper user)
      Determines whether a move cannot miss.
      Parameters:
      user - The move's user.
      Returns:
      Whether the move can't miss.
    • doesPersist

      public boolean doesPersist(PixelmonWrapper user)
      Returns whether the move lasts multiple turns.
      Parameters:
      user - The move's user.
      Returns:
      Whether the move lasts multiple turns.
    • applyMissEffect

      public void applyMissEffect(PixelmonWrapper user, PixelmonWrapper target)
      Triggers when the move misses.
      Parameters:
      user - The move's user.
      target - The move's target.
    • applyEarlyEffect

      public void applyEarlyEffect(PixelmonWrapper user)
      Triggers before the move is used.
      Parameters:
      user - The move's user.
    • applyEffectAfterAllTargets

      public void applyEffectAfterAllTargets(PixelmonWrapper user)
      Triggers after a Pokemon attacks all of its targets.
      Parameters:
      user - The move's user.
    • applyEffectHitOrMiss

      public void applyEffectHitOrMiss(PixelmonWrapper user, PixelmonWrapper target)
      Triggers after a Pokemon attacks, no matter if it hits or misses.
      Parameters:
      user - The move's user.
    • applyEffectAfterStatus

      public void applyEffectAfterStatus(PixelmonWrapper user)
      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.
    • 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

      public int modifyPriority(int priority, ImmutableAttack attack, PixelmonWrapper pw)
      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

      public void modifyTargets(List<PixelmonWrapper> targets, Attack attack, PixelmonWrapper pw)
      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

      public boolean canHitMultipleTargets(Attack attack, PixelmonWrapper pw)
      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

      public int modifyDamage(int damage, PixelmonWrapper user, PixelmonWrapper target, Attack a)
      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.