Exemplo n.º 1
0
        private void _DieHandle(int win, RequsetFishData fish_data, long die_rate)
        {
            new SaveDeathFishHistory(_Visitor, fish_data).Run();
            new CheckTreasureRule(_Visitor, fish_data).Run();
            new SaveScoreHistory(_Visitor, win).Run();

            _Die(fish_data, _Request.WeaponData, die_rate);
        }
Exemplo n.º 2
0
        private bool _CheckIsFreeze(RequsetFishData fish_data)
        {
            if (fish_data.FishType >= FISH_TYPE.SPECIAL_SCREEN_BOMB &&
                fish_data.FishType <= FISH_TYPE.SPECIAL_BIG_OCTOPUS_BOMB)
            {
                return(false);                // 特殊鱼 不翻倍
            }

            // 其它魚只要冰凍必翻2倍
            return(_FishData.FishStatus == FISH_STATUS.FREEZE);
        }
Exemplo n.º 3
0
 private static HitResponse _Miss(RequsetFishData fish_data, RequestWeaponData weapon_data)
 {
     return(new HitResponse
     {
         WepId = weapon_data.BulletId,
         FishId = fish_data.FishId,
         DieResult = FISH_DETERMINATION.SURVIVAL,
         FeedbackWeapons = new[]
         {
             WEAPON_TYPE.INVALID
         },
         WeaponBet = 0,
         OddsResult = 0
     });
 }
Exemplo n.º 4
0
 private HitResponse _Die(RequsetFishData fish_data, RequestWeaponData weapon_data)
 {
     return(new HitResponse
     {
         WepId = weapon_data.BulletId,
         FishId = fish_data.FishId,
         DieResult = FISH_DETERMINATION.DEATH,
         FeedbackWeapons = new[]
         {
             (WEAPON_TYPE)_WeaponChancesTable.Dice(Random.Instance.NextFloat(0, 1))
         },
         WeaponBet = weapon_data.WeaponBet,
         OddsResult = _ScoreOddsTable.Dice(Random.Instance.NextFloat(0, 1))
     });
 }
Exemplo n.º 5
0
 private void _Miss(RequsetFishData fish_data, RequestWeaponData weapon_data, long die_rate)
 {
     _HitResponses.Add(
         new HitResponse()
     {
         WepId           = weapon_data.BulletId,
         FishId          = fish_data.FishId,
         DieResult       = FISH_DETERMINATION.SURVIVAL,
         FeedbackWeapons = new[]
         {
             WEAPON_TYPE.INVALID
         },
         WeaponBet  = weapon_data.WeaponBet,
         OddsResult = 0,
         DieRate    = die_rate
     });
 }
Exemplo n.º 6
0
        private void _Die(RequsetFishData fish_data, RequestWeaponData weapon_data, long die_rate)
        {
            var bufferData = _Visitor.Farm.FindBuffer(
                _Visitor.FocusBufferBlock,
                FarmBuffer.BUFFER_TYPE.NORMAL);

            _HitResponses.Add(
                new HitResponse()
            {
                WepId           = weapon_data.BulletId,
                FishId          = fish_data.FishId,
                DieResult       = FISH_DETERMINATION.DEATH,
                FeedbackWeapons = _Visitor.GotTreasures.ToArray(),
                WeaponBet       = weapon_data.WeaponBet,
                DieRate         = die_rate,
                OddsResult      = new OddsRuler(_Visitor, fish_data, bufferData).RuleResult()
            });
        }
Exemplo n.º 7
0
        private bool _CheckFishTypeToOddsRule(RequsetFishData fish_data)
        {
            if (fish_data.FishType >= FISH_TYPE.SPECIAL_SCREEN_BOMB &&
                fish_data.FishType <= FISH_TYPE.SPECIAL_BIG_OCTOPUS_BOMB)
            {
                return(false);                // 特殊鱼 不翻倍
            }

            if (fish_data.FishOdds < 10)
            {
                return(false);                // 小鱼 不翻倍
            }

            if (fish_data.FishType == FISH_TYPE.BLUE_WHALE)
            {
                var randNumber = _Visitor.FindIRandom(RandomData.RULE.ODDS, 0).NextInt(0, 1000);
                if (randNumber < 500)
                {
                    return(false);                    // 藍鯨 50%不翻倍
                }
            }

            if (fish_data.FishType == FISH_TYPE.RED_WHALE)
            {
                var randNumber = _Visitor.FindIRandom(RandomData.RULE.ODDS, 1).NextInt(0, 1000);
                if (randNumber < 750)
                {
                    return(false);                    // 藍鯨 75%不翻倍
                }
            }

            if (fish_data.FishType == FISH_TYPE.GOLDEN_WHALE)
            {
                var randNumber = _Visitor.FindIRandom(RandomData.RULE.ODDS, 2).NextInt(0, 1000);
                if (randNumber < 875)
                {
                    return(false);                    // 金鯨 87%不翻倍
                }
            }

            return(true);
        }
Exemplo n.º 8
0
        private void _SpecialWeapon(RequsetFishData fish_data)
        {
            long dieRate =
                new SpecialWeaponPowerTable().WeaponPowers.Find(x => x.WeaponType == _Request.WeaponData.WeaponType).Power;

            dieRate *= 0x0FFFFFFF;

            dieRate /= _Request.FishDatas.Sum(x => x.FishOdds);             // 总倍数

            var bufferData = _Visitor.Farm.FindBuffer(
                _Visitor.FocusBufferBlock,
                FarmBuffer.BUFFER_TYPE.NORMAL);

            var oddsRule = new OddsRuler(_Visitor, fish_data, bufferData).RuleResult();

            dieRate /= oddsRule;


            if (dieRate > 0x0FFFFFFF)
            {
                dieRate = 0x10000000;                 // > 100%
            }

            if (_Request.WeaponData.WeaponType == WEAPON_TYPE.BIG_OCTOPUS_BOMB)
            {
                dieRate = 0x10000000;                 // > 100%
            }

            var randomValue = _Visitor.FindIRandom(RandomData.RULE.DEATH, 0).NextInt(0, 0x10000000);

            if (randomValue >= dieRate)
            {
                _Miss(fish_data, _Request.WeaponData, dieRate);
                return;
            }

            var win = fish_data.FishOdds * _Request.WeaponData.GetTotalBet() * oddsRule;

            _DieHandle(win, fish_data, dieRate);
        }
Exemplo n.º 9
0
 public OddsRuler(DataVisitor visitor, RequsetFishData fish_data, FarmBuffer buffer_data)
 {
     _Visitor    = visitor;
     _FishData   = fish_data;
     _BufferData = buffer_data;
 }
Exemplo n.º 10
0
 private bool _CheckFishToOddsRule(RequsetFishData fish_data, int odds)
 {
     return((fish_data.FishOdds >= 50) || (odds != 10));
 }
Exemplo n.º 11
0
 public CheckTreasureRule(DataVisitor data_visitor, RequsetFishData fish_data)
 {
     _DataVisitor  = data_visitor;
     _FishData     = fish_data;
     _GotTreasures = new List <WEAPON_TYPE>();
 }
Exemplo n.º 12
0
 public SaveDeathFishHistory(DataVisitor data_visitor, RequsetFishData fish)
 {
     _Fish        = fish;
     _DataVisitor = data_visitor;
 }
Exemplo n.º 13
0
        private void _NomralWeapon(RequsetFishData fish_data, int hit_sequence)
        {
            var bufferData = _Visitor.Farm.FindBuffer(
                _Visitor.FocusBufferBlock,
                FarmBuffer.BUFFER_TYPE.SPEC);

            long dieRate = _Visitor.Farm.GameRate - 10;

            dieRate -= bufferData.Rate;

            dieRate += bufferData.BufferTempValue.HiLoRate;

            if (_Visitor.PlayerRecord.Status != 0)
            {
                dieRate += 200;                 // 提高20%
            }

            if (_Request.WeaponData.WeaponType == WEAPON_TYPE.FREE_POWER)
            {
                // 特武 免费炮
                dieRate /= 2;
            }

            if (dieRate < 0)
            {
                dieRate = 0;
            }

            dieRate *= 0x0FFFFFFF;                     // 自然死亡率

            dieRate *= _Request.WeaponData.WeaponOdds; // 子弹威力

            dieRate *= new FishHitAllocateTable().GetAllocateData(_Request.WeaponData.TotalHits, hit_sequence);

            dieRate /= 1000;

            dieRate /= fish_data.FishOdds;             // 鱼的倍数

            var oddsRule = new OddsRuler(_Visitor, fish_data, bufferData).RuleResult();

            dieRate /= oddsRule;         // 翻倍

            dieRate /= 1000;             // 死亡率换算回实际百分比

            if (dieRate > 0x0FFFFFFF)
            {
                dieRate = 0x10000000;                 // > 100%
            }

            var randomValue = _Visitor.FindIRandom(RandomData.RULE.DEATH, 1).NextInt(0, 0x10000000);

            if (randomValue >= dieRate)
            {
                _Miss(fish_data, _Request.WeaponData, dieRate);
                return;
            }

            var bet = _Request.WeaponData.GetTotalBet();
            var win = fish_data.FishOdds * bet * oddsRule;

            _DieHandle(win, fish_data, dieRate);
        }