package com.yutou.qqbot.data.jianr;

import lombok.Data;

import java.util.Random;

@Data
public class Vector2D {
    double x, y;
    boolean enableRandomX, enableRandomY;
    boolean absRandomX, absRandomY;
    int randomNumX, randomNumY;


    public double getX() {
        if (isEnableRandomX()) {
            double tmp = new Random().nextDouble(-randomNumX, randomNumX);
            if (isAbsRandomX()) {
                return Math.abs(tmp) + x;
            } else {
                return tmp + x;
            }
        }
        return x;
    }
    public double getNotRandomY() {
        return y;
    }
    public double getNotRandomX() {
        return x;
    }


    public double getY() {
        if(isEnableRandomY()){
            double tmp = new Random().nextDouble(-randomNumY, randomNumY);
            if (isAbsRandomY()) {
                return Math.abs(tmp) + y;
            } else {
                return tmp + y;
            }
        }
        return y;
    }
}
