Class AttackPainter

java.lang.Object
games.stendhal.client.gui.j2d.entity.helpers.AttackPainter

public final class AttackPainter extends Object
An utility for drawing the attack sprites.
  • Method Details

    • get

      public static AttackPainter get(Nature nature, String weapon, int size)
      Get a painter for attack of a given nature, and size of a creature.
      Parameters:
      nature - attack nature
      weapon - weapon, or null if not specified
      size - creature size
      Returns:
      painter
    • draw

      public void draw(Graphics2D g2d, Direction direction, int x, int y, int width, int height)
      Draw a melee attack.
      Parameters:
      g2d - graphics
      direction - attack direction
      x - x coordinate
      y - y coordinate
      width - entity width
      height - entity height
    • drawDistanceAttack

      public void drawDistanceAttack(Graphics2D g2d, RPEntity entity, IEntity target, int x, int y, int width, int height)
      Draw a distance attack line.
      Parameters:
      g2d - graphics
      entity - attacking entity
      target - attack target
      x - attacker x coordinate
      y - attacker y coordinate
      width - attacker width
      height - attacker height
    • hasNatureAndWeapon

      public boolean hasNatureAndWeapon(Nature nature, String weapon)
      Check if this painter has the given nature an weapon.
      Parameters:
      nature - nature to compare to
      weapon - weapon to compare to
      Returns:
      true if the painter has the given nature, otherwise false
    • isDoneAttacking

      public boolean isDoneAttacking()
      Check if the current attack has been completely drawn.
      Returns:
      true if drawing the attack has been completed, otherwise false
    • prepare

      public void prepare(Direction direction)
      Prepare for an attack to a given direction.
      Parameters:
      direction - attack direction