// w物品获取


//概率修改其他盲盒


let proKuaid = [5,5,5,5,5,5,5,5,5,6,6,6,6,6,5,5,5,5,1,1,1,1,1]

let shoulieshenzi = [7,7,8,8,8,7,7,7,7,5,5,5,3,3,3,3,3,1,1,1,1,0,0,0]
let shouliejian = [6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,3,3,2,2,1,1,0,0,0]//弓弩
let shoulieqiang = [0,0,0,0,0,5,5,5,5,5,5,6,7,7,8,8,7,7,6,6,2,2,2,2]
let shoulievd = [0,0,0,0,0,5,5,5,5,6,6,6,6,6,6,6,6,6,5,5,4,4,4,4]
let shoulieWulian = [0,0,0,0,0,0,3,3,4,4,7,7,7,7,8,8,8,7,7,7,7,2,2,2]//五连

let xiaomaibuCommon = [9, 8, 6, 0, 8, 10, 8, 7, 6, 7, 6, 8, 6, 6, 5]//卖货郎
let xiaomaibuVd = [9, 8, 6, 0, 8, 10, 8, 7, 6, 7, 6, 8, 6, 6, 5]


let binghuCommon = [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0]
let binghuVd = [0,0,0,0,0,0,0,0,5,5,6,6,8,8,9,9,9,10,10,3,3,3,3,3]//五连

let lajiCommon = [2,2,2,2,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,3,3,3,1,0,0]
let lajiVd = [0,0,0,0,0,0,0,0,0,0,0,5,5,5,10,10,10,10,10,10,10,10,2,2,1]//翻个够
let taofenGunzi = [6,6,6,6,6,6,6,6,6,6,6,6,6,4,4,3,3,2,2,2,1,1,0,0,0]
let taofenTanhuang = [2,2,2,2,2,6,6,6,6,7,7,7,7,7,7,5,5,3,3,3,2,2,1,0,0]
let taofenxichenqi = [5,5,5,5,5,7,7,7,7,7,7,6,6,6,6,3,3,2,1,0,0,0,0,0]//疏通
let taofenjiuchi = [0,0,0,0,0,4,4,4,8,8,8,8,9,9,9,8,8,3,3,2,2,1,1,1]//五连掏

let diaoYuCommon = [8,8,8,8,7,7,7,7,5,5,5,5,3,3,3,3,2,2,2,2,0,0,0,0,0,0]//鱼饵
let diaoYuAD = [0,0,0,0,0,0,0,0,0,4,4,4,5,7,7,7,8,8,8,8,6,6,5,5,4,4]//五连

let proQinWangLing = [5,5,5,6,6,6,5,5,5,6,6,6,6,6,3,4,4,4,4,3]


let chaChangCommon = [12,10,10,10,10,10,10,8,8,8,2,2]//茶场
let chaChangVd = [12,10,10,10,10,10,10,8,8,8,2,2]


let baiCaoJiCommon = [10,10,10,8,8,8,8,8,5,5,5,3,3,3,2,2,2,0,0,0]//佰草集
let baiCaoJiVd = [0,0,0,1,1,10,10,10,10,10,10,10,10,3,3,3,3,2,2,2]

let guShuCommon = [11,11,11,11,11,11,11,11,12]//古树
let guShuVd = [11,11,11,11,11,11,11,11,12]

let xiuXianNongZhuangCommon = [5,5,5,7,7,6,6,6,6,8,8,8,3,3,3,3,3,2,2,2,2,0,0,0]//休闲农庄
let xiuXianNongZhuangVd = [0,0,0,0,0,2,3,3,3,6,6,6,6,7,7,7,7,5,5,5,5,5,6,6]

export default class ProbabilityManager  {

    public static shoulieCommonIndex = 0;
    public static shoulieCommonFix = 2;
    public static shoulieAdIndex = 0;

    public static xiaomaibuCommonIndex = 0;
    public static xiaomaibuAdIndex = 0;

    public static taofenCommonIndex = 0;
    public static taofenCommonFix = 2;
    public static taofenAdIndex = 0;

    public static binghuCommonIndex = 0;
    public static binghuCommonFix = 3;
    public static binghuAdIndex = 0;

    public static kuaidiCommonIndex = 0;
    public static commonIndexKuaiDiFix = 3;
    public static kuaidiAdIndex = 0;

    public static lajiCommonIndex = 0;
    public static lajiCommonFix = 2;
    public static lajiAdIndex = 0;

    public static diaoYuCommonIndex = 0;
    public static diaoYuCommonFix = 2;
    public static diaoYuIndex = 0;
    
    public static commonIndexFix = 10;
    
    public static adIndexFix = 1;
    public static shopAdIndexFix = 1;

    public static qinWangLingCommonIndex = 0;
    public static commonIndexQinWangLingFix = 3;
    public static qinWangLingAdIndex = 0;

    public static chaChangCommonIndex = 0;
    public static chaChangAdIndex = 0;
    public static chaChangAdIndexFix = 1;

    public static baiCaoJiCommonIndex = 0;
    public static baiCaoJiAdIndex = 0;
    public static baiCaoJiAdIndexFix = 1;

    public static guShuCommonIndex = 0;
    public static guShuAdIndex = 0;
    public static guShuAdIndexFix = 1;

    public static setShoulieCommonFixFixIndex(index){
        ProbabilityManager.shoulieCommonFix = index
    }

    public static setCanChangeKuaiDiFixIndex(index){
        ProbabilityManager.commonIndexKuaiDiFix = index
    }
    
    public static setCanChangeQinWangLingFixIndex(index){
        ProbabilityManager.commonIndexQinWangLingFix = index
    }

    public static setCanChangeBingHuIndex(index){
        ProbabilityManager.binghuCommonFix = index
    }

    public static setCanChangeDiaoyuIndex(index){
        ProbabilityManager.diaoYuCommonFix = index
    }

    public static getCanChangeList(gameType){
        if(gameType == 'Dustbin'){
            if(this.lajiAdIndex>=this.adIndexFix || this.lajiCommonIndex>=this.lajiCommonFix){
                this.lajiAdIndex = 0
                this.lajiCommonIndex = 0
                return true
            }else{
                return false
            }
        
        }else if(gameType == 'IceWorld'){
            if(this.binghuAdIndex>=this.adIndexFix || this.binghuCommonIndex>=this.binghuCommonFix){
                this.binghuAdIndex = 0
                this.binghuCommonIndex = 0
                return true
            }else{
                return false
            }


        }else if(gameType == 'Diaoyu'){
            if(this.diaoYuIndex>=this.adIndexFix || this.diaoYuCommonIndex>=this.diaoYuCommonFix){
                this.diaoYuIndex = 0
                this.diaoYuCommonIndex = 0
                return true
            }else{
                return false
            }


        }else if(gameType == 'NiFengKuaidi'){
            if(this.kuaidiAdIndex>=this.adIndexFix || this.kuaidiCommonIndex>=this.commonIndexKuaiDiFix){
                this.kuaidiAdIndex = 0
                this.kuaidiCommonIndex = 0
                return true
            }else{
                return false
            }
         
        }else if(gameType == 'ShouLie'){
            if(this.shoulieAdIndex>=this.adIndexFix || this.shoulieCommonIndex>=this.shoulieCommonFix){
                this.shoulieAdIndex = 0
                this.shoulieCommonIndex = 0
                return true
            }else{
                return false
            }
         
        }else if(gameType == 'TaoFen'){
            if(this.taofenAdIndex>=this.adIndexFix || this.taofenCommonIndex>=this.taofenCommonFix){
                this.taofenAdIndex = 0
                this.taofenCommonIndex = 0
                return true
            }else{
                return false
            }
         
        }else if(gameType == 'XiaoMaibu'){
            if(this.xiaomaibuAdIndex>=this.shopAdIndexFix || this.xiaomaibuCommonIndex>=this.commonIndexFix){
                this.xiaomaibuAdIndex = 0
                this.xiaomaibuCommonIndex = 0
                return true
            }else{
                return false
            }
        }else if(gameType == 'ChaoFanLin'){
            if(this.qinWangLingAdIndex>=this.adIndexFix || this.qinWangLingCommonIndex>=this.commonIndexQinWangLingFix){
                this.qinWangLingAdIndex = 0
                this.qinWangLingCommonIndex = 0
                return true
            }else{
                return false
            }
         
        }else if(gameType == 'ChaChang'){
            if(this.chaChangAdIndex>=this.chaChangAdIndexFix || this.chaChangCommonIndex>=this.commonIndexFix){
                this.chaChangAdIndex = 0
                this.chaChangCommonIndex = 0
                return true
            }else{
                return false
            }
        }else if(gameType == 'BaiCaoJi'){
            if(this.baiCaoJiAdIndex>=this.baiCaoJiAdIndexFix || this.baiCaoJiCommonIndex>=this.commonIndexFix){
                this.baiCaoJiAdIndex = 0
                this.baiCaoJiCommonIndex = 0
                return true
            }else{
                return false
            }
        }else if(gameType == 'GuShu'){
            if(this.guShuAdIndex>=this.guShuAdIndexFix || this.guShuCommonIndex>=this.commonIndexFix){
                this.guShuAdIndex = 0
                this.guShuCommonIndex = 0
                return true
            }else{
                return false
            }
        }
    }

    public static gameClickLajiTimeAdd(isAD){
        if(isAD){
            this.lajiAdIndex++
        }else{
            this.lajiCommonIndex++
        }
    }
    
    public static gameClickTimeAdd(gameType, isAD){
        if(gameType == 'Dustbin'){
            // if(isAD){
            //     this.lajiAdIndex++
            // }else{
            //     this.lajiCommonIndex++
            // }
        }else if(gameType == 'IceWorld'){
            if(isAD){
                this.binghuAdIndex++
            }else{
                this.binghuCommonIndex++
            }
        }else if(gameType == 'Diaoyu'){
            if(isAD){
                this.diaoYuIndex++
            }else{
                this.diaoYuCommonIndex++
            }
        }else if(gameType == 'NiFengKuaidi'){
            if(isAD){
                this.kuaidiAdIndex++
            }else{
                this.kuaidiCommonIndex++
            }
        }else if(gameType == 'ShouLie'){
            if(isAD){
                this.shoulieAdIndex++
            }else{
                this.shoulieCommonIndex++
            }
        }else if(gameType == 'TaoFen'){
            if(isAD){
                this.taofenAdIndex++
            }else{
                this.taofenCommonIndex++
            }
        }else if(gameType == 'XiaoMaibu'){
            if(isAD){
                this.xiaomaibuAdIndex++
            }else{
                this.xiaomaibuCommonIndex++
            }
        }else if(gameType == 'ChaoFanLin'){
            if(isAD){
                this.qinWangLingAdIndex++
            }else{
                this.qinWangLingCommonIndex++
            }
        }else if(gameType == 'ChaChang'){
            if(isAD){
                this.chaChangAdIndex++
            }else{
                this.chaChangCommonIndex++
            }
        }else if(gameType == 'BaiCaoJi'){
            if(isAD){
                this.baiCaoJiAdIndex++
            }else{
                this.baiCaoJiCommonIndex++
            }
        }else if(gameType == 'GuShu'){
            if(isAD){
                this.guShuAdIndex++
            }else{
                this.guShuCommonIndex++
            }
        }
    }


    public static getMangHeProbability(gameType, goodsNum,isAD,probabilityType){
        this.gameClickTimeAdd(gameType, isAD)
        if(gameType == 'IceWorld'){
            if(isAD){
                return binghuVd
            }else{
                return binghuCommon 
            }
        }else if(gameType == 'Dustbin'){
            if(goodsNum == 1){
                return lajiCommon
            }else{
                return lajiVd 
            }
        }else if(gameType == 'NiFengKuaidi'){
            return proKuaid
        }else if(gameType == 'ShouLie'){
            if(isAD){
                return shoulieWulian
            }else{
                if(probabilityType == 'ShengZi'){
                    return shoulieshenzi
                }else if(probabilityType == 'GongNu'){
                    return shouliejian
                }else if(probabilityType == 'LieQiang'){
                    return shoulieqiang
                }else if(probabilityType == 'Wang'){
                    return shoulievd
                }
            }


        }else if(gameType == 'TaoFen'){
            if(isAD){
                return taofenjiuchi
            }else{
                //'gunzi', 'tanhuangguan', 'xichengqi','jiuchidingpa'
                if(probabilityType == 'gunzi'){
                    return taofenGunzi
                }else if(probabilityType == 'tanhuangguan'){
                    return taofenTanhuang
                }else if(probabilityType == 'xichengqi'){
                    return taofenxichenqi
                }else if(probabilityType == 'jiuchidingpa'){
                    return taofenjiuchi
                }
            }
        }else if(gameType == 'XiaoMaibu'){
            if(isAD){
                return xiaomaibuVd
            }else{
                return xiaomaibuCommon 
            }
        }else if(gameType == 'Diaoyu'){
            if(isAD){
                return diaoYuAD
            }else{
                return diaoYuCommon 
            }
        }else if(gameType == 'ChaoFanLin'){
            return proQinWangLing
        }else if(gameType == 'ChaChang'){
            if(isAD){
                return chaChangVd
            }else{
                return chaChangCommon 
            }
        }else if(gameType == 'BaiCaoJi'){
            if(isAD){
                return baiCaoJiVd
            }else{
                return baiCaoJiCommon 
            }
        }else if(gameType == 'GuShu'){
            if(isAD){
                return guShuVd
            }else{
                return guShuCommon 
            }
        }else if(gameType == 'XiuXianNongZhuang'){
            if(isAD){
                return xiuXianNongZhuangVd
            }else{
                return xiuXianNongZhuangCommon 
            }
        }else if (gameType == 'ShouHuoJi') {
            if (isAD) {
                return xiaomaibuVd
            } else {
                return xiaomaibuCommon
            }
        }
       
    }

}