attackPoly = new Polygon(); attackPoly.addPoint(a.x + 42 - (int)Math.round(Math.sin(an) * lw), a.y + 36 + (int)Math.round(Math.cos(an) * lw)); attackPoly.addPoint(a.x + 42 + (int)Math.round(Math.sin(an) * lw), a.y + 36 - (int)Math.round(Math.cos(an) * lw)); attackPoly.addPoint(t.x + 42 + (int)Math.round(Math.sin(an) * lw), t.y + 36 - (int)Math.round(Math.cos(an) * lw)); attackPoly.addPoint(t.x + 42 - (int)Math.round(Math.sin(an) * lw), t.y + 36 + (int)Math.round(Math.cos(an) * lw));
a.x = a.x + 42 + (int)Math.round(Math.cos(an) * 18); t.x = t.x + 42 - (int)Math.round(Math.cos(an) * 18); a.y = a.y + 36 + (int)Math.round(Math.sin(an) * 18); t.y = t.y + 36 - (int)Math.round(Math.sin(an) * 18);   if (isMutualAttack()){ attackPoly = new StraightArrowPolygon(a, t, 8, 12, true); } else { attackPoly = new StraightArrowPolygon(a, t, 4, 8, false); }
        public AttackSprite(AttackAction attack) {            this.attacks.addElement(attack);            this.entityId = attack.getEntityId();            this.targetType = attack.getTargetType();            this.targetId = attack.getTargetId();                        final Entity ae = game.getEntity(attack.getEntityId());            final Targetable target = game.getTarget(targetType, targetId);            final Point a = getHexLocation(ae.getPosition());            final Point t = getHexLocation(target.getPosition());                        // color?            attackColor = ae.getOwner().getColor();                    final double an = (ae.getPosition().radian(target.getPosition()) + (Math.PI * 1.5)) % (Math.PI * 2); // angle            final double lw = 3; // line width                    // make a polygon            attackPoly = new Polygon();            attackPoly.addPoint(a.x + 42 - (int)Math.round(Math.sin(an) * lw), a.y + 36 + (int)Math.round(Math.cos(an) * lw));            attackPoly.addPoint(a.x + 42 + (int)Math.round(Math.sin(an) * lw), a.y + 36 - (int)Math.round(Math.cos(an) * lw));            attackPoly.addPoint(t.x + 42 + (int)Math.round(Math.sin(an) * lw), t.y + 36 - (int)Math.round(Math.cos(an) * lw));            attackPoly.addPoint(t.x + 42 - (int)Math.round(Math.sin(an) * lw), t.y + 36 + (int)Math.round(Math.cos(an) * lw));                        // set bounds            this.bounds = new Rectangle(attackPoly.getBounds());            bounds.setSize(bounds.getSize().width + 1, bounds.getSize().height + 1);                        // move poly to upper right of image            attackPoly.translate(-bounds.getLocation().x, -bounds.getLocation().y);                        // set names & stuff            attackerDesc = ae.getDisplayName();            targetDesc = target.getDisplayName();            if (attack instanceof WeaponAttackAction) {                addWeapon((WeaponAttackAction)attack);            }                        // nullify image            this.image = null;        }