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); }
makePoly();
        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);            this.a = getHexLocation(ae.getPosition());            this.t = getHexLocation(target.getPosition());            // color?            attackColor = ae.getOwner().getColor();            //angle of line connecting two hexes            this.an = (ae.getPosition().radian(target.getPosition()) + (Math.PI * 1.5)) % (Math.PI * 2); // angle            // make a polygon            // OK, that is actually not good. I do not like hard coded figures.            // 42 - x distance in pixels from origin of hex bounding box to the center of hex.            // 36 - y distance in pixels from origin of hex bounding box to the center of hex.            // 18 - is actually 36/2 - we do not want arrows to start and end directly            // in the centes of hex and hiding mek under.            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);            // Checking if given attack is mutual. In this case we building halved arrow            if (isMutualAttack()){                attackPoly = new StraightArrowPolygon(a, t, 8, 12, true);            } else {                attackPoly = new StraightArrowPolygon(a, t, 4, 8, false);            }            // 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);            }            if (attack instanceof KickAttackAction) {                addWeapon((KickAttackAction)attack);            }            if (attack instanceof PunchAttackAction) {                addWeapon((PunchAttackAction)attack);            }            if (attack instanceof PushAttackAction) {                addWeapon((PushAttackAction)attack);            }            if (attack instanceof ClubAttackAction) {                addWeapon((ClubAttackAction)attack);            }            if (attack instanceof ChargeAttackAction) {                addWeapon((ChargeAttackAction)attack);            }            if (attack instanceof DfaAttackAction) {                addWeapon((DfaAttackAction)attack);            }            // nullify image            this.image = null;        }