Exemple #1
0
        public override bool OneBulletKillFish(int bulletScore, FishOddsData fishFirst)
        {
            _totalBullet += bulletScore;
            //鱼死亡
            if (fishFirst.Odds <= 1)
            {
                YxDebug.LogError("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
                return(false);
            }
            _current -= bulletScore;
            _coin    -= bulletScore;
            int win      = fishFirst.Odds * bulletScore;
            int winScore = _current + win;

            if (OutMaxScore(winScore))
            {
                return(false);
            }
            bool kill = IsKill(fishFirst.Odds);

            if (kill)
            {
                _current += win;
                _coin    += win;
            }
            return(kill);
        }
Exemple #2
0
        public static FishOddsData OneBulletKillFish(int bulletScore, FishOddsData fishFirst)
        {
            //鱼死亡
            int oddsTotal = fishFirst.Odds;

            if (fishFirst.Odds <= 1)
            {
                Debug.LogWarning("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
                return(_fd);
            }


            float gainRatio = GainRatio;

            if (gainRatio > 0F && oddsTotal >= mReduceGainOddLine)
            {
                gainRatio *= GainRatioConditFactor;
            }

            //第一条死亡几率
            float firstDieRatio = (1F - gainRatio) * (fishFirst.Odds + oddsTotal) / (2F * oddsTotal * fishFirst.Odds);

            //Debug.Log("2F * oddsTotal * fishFirst.Odds = " + firstDieRatio);
            //Debug.Log("firstDieRatio = " + firstDieRatio + "    odds =" + fishFirst.Odds);
            if (IsHitInOne(firstDieRatio))//第一条鱼命中
            {
                return(fishFirst);
            }
            return(_fd);
        }
Exemple #3
0
 public virtual bool OneBulletKillFish(int bulletScore, FishOddsData fishFirst)
 {
     //鱼死亡
     if (fishFirst.Odds <= 1)
     {
         Debug.LogWarning("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
         return(false);
     }
     return(IsKill(fishFirst.Odds));
 }
Exemple #4
0
        /// <summary>
        ///  一子弹获得分值
        /// </summary>
        /// <returns>获得分值</returns>
        public static List <FishOddsData> OneBulletKillFish(int bulletScore, FishOddsData fishFirst, List <FishOddsData> otherFish)
        {
            List <FishOddsData> fishDieList = new List <FishOddsData>();
            //鱼死亡
            int oddsTotal = fishFirst.Odds;

            if (fishFirst.Odds <= 1)
            {
                YxDebug.LogWarning("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
                return(fishDieList);
            }
            foreach (FishOddsData f in otherFish)
            {
                if (f.Odds <= 1)
                {
                    YxDebug.LogWarning("otherFish的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!");
                    //return fishDieList;
                }

                oddsTotal += f.Odds;
            }
            //YxDebug.Log("oddsTotal = " + oddsTotal);

            float gainRatio = GainRatio;

            if (gainRatio > 0F && oddsTotal >= mReduceGainOddLine)
            {
                gainRatio *= GainRatioConditFactor;
            }

            //第一条死亡几率
            float firstDieRatio = (1F - gainRatio) * (fishFirst.Odds + oddsTotal) / (2F * oddsTotal * fishFirst.Odds);

            //YxDebug.Log("2F * oddsTotal * fishFirst.Odds = " + firstDieRatio);
            //YxDebug.Log("firstDieRatio = " + firstDieRatio + "    odds =" + fishFirst.Odds);
            if (IsHitInOne(firstDieRatio))//第一条鱼命中
            {
                fishDieList.Add(fishFirst);
                //Debug.Log("firstDieRatio = " + firstDieRatio+"    odds ="+fishFirst.Odds);
                //求其他鱼死是否死亡 ,逐条计算几率
                foreach (FishOddsData f in otherFish)
                {
                    float dieRatio = (1F - gainRatio - firstDieRatio * fishFirst.Odds) / (firstDieRatio * (oddsTotal - fishFirst.Odds));
                    //Debug.Log("otherDieRatio = " + dieRatio + "    odds =" + f.Odds);
                    if (IsHitInOne(dieRatio))
                    {
                        fishDieList.Add(f);
                    }
                }
            }

            return(fishDieList);
        }
Exemple #5
0
        /// <summary>
        ///  一子弹获得分值
        /// </summary>
        /// <returns>获得分值</returns>
        public virtual List <FishOddsData> OneBulletKillFish(int bulletScore, FishOddsData fishFirst, List <FishOddsData> otherFish)
        {
            var fishDieList = new List <FishOddsData>();
            //鱼死亡
            var oddsTotal = fishFirst.Odds;

            if (fishFirst.Odds <= 1)
            {
                YxDebug.LogWarning("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
                return(fishDieList);
            }

            //Debug.Log("oddsTotal = " + oddsTotal);
            if (IsKill(fishFirst.Odds))//第一条鱼命中
            {
                fishDieList.Add(fishFirst);
                //Debug.Log("firstDieRatio = " + firstDieRatio+"    odds ="+fishFirst.Odds);
                //求其他鱼死是否死亡 ,逐条计算几率
                foreach (FishOddsData f in otherFish)
                {
                    if (f.Odds <= 1)
                    {
                        Debug.LogWarning("otherFish的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!");
                        //return fishDieList;
                    }

                    oddsTotal += f.Odds;
                }
                foreach (FishOddsData f in otherFish)
                {
                    //Debug.Log("otherDieRatio = " + dieRatio + "    odds =" + f.Odds);
                    if (IsKill(oddsTotal))
                    {
                        fishDieList.Add(f);
                    }
                }
            }
            return(fishDieList);
        }
Exemple #6
0
        public override List <FishOddsData> OneBulletKillFish(int bulletScore, FishOddsData fishFirst, List <FishOddsData> otherFish)
        {
            _totalBullet += bulletScore;
            YxDebug.Log("========手中金币:" + _coin + "  子弹:" + bulletScore);
            _coin -= bulletScore;
            YxDebug.Log("          手中金币:" + _coin);
            var fishDieList = new List <FishOddsData>();
            //鱼死亡
            int oddsTotal = fishFirst.Odds;

            if (fishFirst.Odds <= 1)
            {
                YxDebug.LogError("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
                return(fishDieList);
            }
            _current -= bulletScore;
            int win      = fishFirst.Odds * bulletScore;
            int winScore = _current + win;

            if (OutMaxScore(winScore))
            {
                return(fishDieList);
            }

            //YxDebug.Log("oddsTotal = " + oddsTotal);
            if (IsKill(fishFirst.Odds))//第一条鱼命中
            {
                fishDieList.Add(fishFirst);
                //YxDebug.Log("firstDieRatio = " + firstDieRatio+"    odds ="+fishFirst.Odds);
                //求其他鱼死是否死亡 ,逐条计算几率
                foreach (FishOddsData f in otherFish)
                {
                    if (f.Odds <= 1)
                    {
                        YxDebug.LogError("otherFish的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!");
                    }
                    else
                    {
                        oddsTotal += f.Odds;
                    }
                }
                foreach (FishOddsData f in otherFish)
                {
                    int preWin = f.Odds * bulletScore;
                    if (OutMaxScore(preWin + winScore))
                    {
                        continue;
                    }
                    //YxDebug.Log("otherDieRatio = " + dieRatio + "    odds =" + f.Odds);
                    if (IsKill(oddsTotal))
                    {
                        fishDieList.Add(f);
                        winScore += preWin;
                        win      += preWin;
                    }
                }
                _current += win;
                _coin    += win;
            }
            return(fishDieList);
        }