Class AttackPainter
java.lang.Object
games.stendhal.client.gui.j2d.entity.helpers.AttackPainter
An utility for drawing the attack sprites.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
draw(Graphics2D g2d, Direction direction, int x, int y, int width, int height)
Draw a melee attack.void
drawDistanceAttack(Graphics2D g2d, RPEntity entity, IEntity target, int x, int y, int width, int height)
Draw a distance attack line.static AttackPainter
Get a painter for attack of a given nature, and size of a creature.boolean
hasNatureAndWeapon(Nature nature, String weapon)
Check if this painter has the given nature an weapon.boolean
Check if the current attack has been completely drawn.void
Prepare for an attack to a given direction.
-
Method Details
-
get
Get a painter for attack of a given nature, and size of a creature.- Parameters:
nature
- attack natureweapon
- weapon, ornull
if not specifiedsize
- creature size- Returns:
- painter
-
draw
Draw a melee attack.- Parameters:
g2d
- graphicsdirection
- attack directionx
- x coordinatey
- y coordinatewidth
- entity widthheight
- 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
- graphicsentity
- attacking entitytarget
- attack targetx
- attacker x coordinatey
- attacker y coordinatewidth
- attacker widthheight
- attacker height
-
hasNatureAndWeapon
Check if this painter has the given nature an weapon.- Parameters:
nature
- nature to compare toweapon
- weapon to compare to- Returns:
true
if the painter has the given nature, otherwisefalse
-
isDoneAttacking
public boolean isDoneAttacking()Check if the current attack has been completely drawn.- Returns:
true
if drawing the attack has been completed, otherwisefalse
-
prepare
Prepare for an attack to a given direction.- Parameters:
direction
- attack direction
-