Beispiel #1
0
        public CertainTreasure(DataVisitor data_visitor, RequsetFishData fish_data)
        {
            _DataVisitor = data_visitor;
            _FishData = fish_data;

            _GotTreasures = new List<WEAPON_TYPE>();
        }
Beispiel #2
0
        private void _Die(RequsetFishData fish_data)
        {
            new CertainTreasure(_Visitor, fish_data).Run();

            _Build(fish_data, FISH_DETERMINATION.DEATH);

            _Record(fish_data);
        }
Beispiel #3
0
        // : Provider<BigOctopusBomb>
        RequsetFishData[] IFilterable.Filter(RequsetFishData[] fish_datas)
        {
            var t = from fish in fish_datas
                    where fish.FishType < FISH_TYPE.SPECIAL_FREEZE_BOMB
                    select fish;

            return t.ToArray();
        }
Beispiel #4
0
        void IFloatingCalculator.Calculate(RequsetFishData[] fish_data)
        {
            var octs = fish_data.Where(x => x.FishType == FISH_TYPE.SPECIAL_BIG_OCTOPUS_BOMB);

            foreach(var oct in octs)
            {
                oct.FishOdds += oct.GraveGoods.Sum(x => x.GetRealOdds());
            }
        }
Beispiel #5
0
        public void Serializer()
        {
            RequsetFishData data1 = new RequsetFishData();
            data1.GraveGoods = new RequsetFishData[0];

            var serData = Regulus.TypeHelper.Serializer(data1);

            var data2 = Regulus.TypeHelper.Deserialize<RequsetFishData>(serData);

            Assert.AreEqual(data2.GraveGoods, null);
        }
Beispiel #6
0
        void IFloatingCalculator.Calculate(RequsetFishData[] fish_data)
        {
            var whales = fish_data.Where(x => x.FishType == FISH_TYPE.WHALE_COLOR);

            foreach(var whale in whales)
            {
                var random = Random.Instance.NextInt(0, 7);
                whale.FishOdds = _OddsDatas.Find(x => x.Rate == random)
                                            .Odds;
            }
        }
Beispiel #7
0
        private void _Make(RequsetFishData fish_data)
        {
            var randomValue = _Visitor.FindIRandom(RandomData.RULE.DEATH, 1)
                                    .NextInt(0, 0x10000000);

            if(randomValue >= fish_data.HitDieRate)
            {
                _Miss(fish_data);
                return;
            }

            _Die(fish_data);
        }
        private bool _IsCertainDeath(RequsetFishData fish_data)
        {
            if(_Request.WeaponData.WeaponType != WEAPON_TYPE.BIG_OCTOPUS_BOMB && !fish_data.IsGift)
            {
                return false;
            }

            fish_data.HitDieRate = 0x10000000; // > 100%

            // 必死不翻倍
            fish_data.Multiple = 1;

            return true;
        }
Beispiel #9
0
        RequsetFishData[] IFilterable.Filter(RequsetFishData[] fish_datas)
        {
            // 只电10倍以上的鱼
            var filter1 = from fish in fish_datas
                        where fish.FishOdds >= 10
                        select fish;

            // 最多电15只鱼
            var filter2 = new List<RequsetFishData>();

            foreach(var t in filter1.TakeWhile(t => filter2.Count <= 15))
            {
                filter2.Add(t);
            }

            return filter2.ToArray();
        }
Beispiel #10
0
        void IFloatingCalculator.Calculate(RequsetFishData[] fish_data)
        {
            var kings = fish_data.Where(x => x.FishStatus == FISH_STATUS.KING);

            foreach(var king in kings.Where(king => king.GraveGoods.Any()))
            {
                if(king.GraveGoods.Any(x => x.FishType != king.FishType))
                {
                    // _OnException.Invoke("king.GraveGoods抄府辰篈ぃ才");
                    Singleton<Log>.Instance.WriteInfo("king.GraveGoods抄府辰篈ぃ才");

                    LogManager.GetCurrentClassLogger()
                            .Fatal("king.GraveGoods抄府辰篈ぃ才");
                    continue;
                }

                king.FishOdds += king.GraveGoods.Sum(x => x.GetRealOdds());
            }
        }
Beispiel #11
0
        private void _Build(RequsetFishData fish_data, FISH_DETERMINATION status)
        {
            var tmp = _Visitor.GetAllTreasures();
            if(tmp.Count == 0)
            {
                tmp.Add(WEAPON_TYPE.INVALID);
            }

            _HitResponses.Add(new HitResponse
            {
                WepId = _Request.WeaponData.BulletId,
                FishId = fish_data.FishId,
                FishOdds = fish_data.FishOdds,
                DieResult = status,
                FeedbackWeapons = tmp.ToArray(),
                WeaponBet = _Request.WeaponData.WeaponBet,
                DieRate = fish_data.HitDieRate,
                Multiple = fish_data.Multiple
            });
        }
        public void Cal(RequsetFishData fish_data)
        {
            if(_IsCertainDeath(fish_data))
            {
                return;
            }

            long dieRate = new SpecialWeaponPowerTable().WeaponPowers.Find(x => x.WeaponType == _Request.WeaponData.WeaponType)
                                                        .Power;

            dieRate *= 0x0FFFFFFF;

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

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

            fish_data.HitDieRate = dieRate;
        }
        public void Cal(RequsetFishData fish_data)
        {
            var normal = _Visitor.Farm.FindDataRoot(_Visitor.FocusBlockName, FarmDataRoot.BufferNode.BUFFER_NAME.NORMAL);

            long dieRate = normal.Buffer.Rate;

            dieRate += normal.TempValueNode.HiLoRate;

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

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

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

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

            dieRate *= fish_data.HitDieRate;

            dieRate /= 1000;

            dieRate /= fish_data.GetRealOdds(); // 翻倍後鱼的倍数

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

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

            fish_data.HitDieRate = dieRate;
        }
Beispiel #14
0
 private 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,
         Multiple = _ScoreOddsTable.Dice(Random.Instance.NextInt(0, 1)) + 1
     };
 }
Beispiel #15
0
        /// <summary>
        ///     例外魚種
        /// </summary>
        private bool _CheckExceptionsFishType(RequsetFishData fish_data)
        {
            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;
        }
Beispiel #16
0
 /// <summary>
 ///     特殊魚不翻倍
 /// </summary>
 private static bool _IsSpecialFish(RequsetFishData fish_data)
 {
     return fish_data.FishType >= FISH_TYPE.SPECIAL_SCREEN_BOMB && fish_data.FishType <= FISH_TYPE.SPECIAL_BIG_OCTOPUS_BOMB;
 }
Beispiel #17
0
 private static bool _IsSpecialFish2(RequsetFishData fish_data)
 {
     return fish_data.FishType == FISH_TYPE.SPECIAL_EAT_FISH || fish_data.FishType == FISH_TYPE.SPECIAL_EAT_FISH_CRAZY;
 }
Beispiel #18
0
 /// <summary>
 ///     其它魚只要冰凍必翻2倍
 /// </summary>
 private static bool _IsFreeze(RequsetFishData fish_data)
 {
     return fish_data.FishStatus == FISH_STATUS.FREEZE;
 }
Beispiel #19
0
 /// <summary>
 ///     小倍數魚不翻倍
 /// </summary>
 private static bool _IsSmallFish(RequsetFishData fish_data)
 {
     return fish_data.FishOdds < 10;
 }
Beispiel #20
0
        private void _StartSet(RequsetFishData fish_data)
        {
            if(_IsSpecialFish(fish_data))
            {
                fish_data.Multiple = 1;
                return;
            }

            if(_IsSpecialFish2(fish_data))
            {
                fish_data.Multiple = 1;
                return;
            }

            if(_IsSmallFish(fish_data))
            {
                fish_data.Multiple = 1;
                return;
            }

            if(_IsFreeze(fish_data))
            {
                fish_data.Multiple = 2;
                return;
            }

            if(!_CheckExceptionsFishType(fish_data))
            {
                fish_data.Multiple = 1;
                return;
            }

            if(!_CheckStageRate())
            {
                fish_data.Multiple = 1;
                return;
            }

            fish_data.Multiple = _GetResult(fish_data);
        }
Beispiel #21
0
 /// <summary>
 ///     例外狀況
 /// </summary>
 private static bool _IsExceptions(RequsetFishData fish_data, int odds)
 {
     return fish_data.FishOdds < 50 && odds == 10;
 }
Beispiel #22
0
        private void _RecordTreasureForFarm(RequsetFishData fish)
        {
            var fishHitRecords = _Visitor.Farm.Record;

            _SaveTreasureHistory(fishHitRecords);
        }
Beispiel #23
0
        private void _RecordTreasureForPlayer(RequsetFishData fish)
        {
            var fishHitRecords = _Visitor.PlayerRecord.FindFarmRecord(_Visitor.Farm.FarmId);

            _SaveTreasureHistory(fishHitRecords);
        }
Beispiel #24
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,
         Multiple = _ScoreOddsTable.Dice(Random.Instance.NextInt(0, 1)) + 1
     };
 }
Beispiel #25
0
 private void _Miss(RequsetFishData fish_data)
 {
     _Build(fish_data, FISH_DETERMINATION.SURVIVAL);
 }
 public SaveDeathFishHistory(DataVisitor data_visitor, RequsetFishData fish, RequestWeaponData weapon_data_data)
 {
     _Fish = fish;
     _WeaponData = weapon_data_data;
     _DataVisitor = data_visitor;
 }
Beispiel #27
0
        private void _Record(RequsetFishData fish_data)
        {
            var bet = _Request.WeaponData.GetTotalBet();
            var winScore = fish_data.GetRealOdds() * bet;

            new SaveDeathFishHistory(_Visitor, fish_data, _Request.WeaponData).Run();

            new SaveScoreHistory(_Visitor, winScore).Run();

            new SaveTreasure(_Visitor, fish_data).Run();
        }
Beispiel #28
0
 public SaveTreasure(DataVisitor visitor, RequsetFishData fish_data)
 {
     _Visitor = visitor;
     _FishData = fish_data;
 }
Beispiel #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HitRequest"/> class. 
 /// </summary>
 public HitRequest(RequsetFishData[] fish_datas, RequestWeaponData weapon_data, bool is_first_trigger)
 {
     IsFirstTrigger = is_first_trigger;
     FishDatas = fish_datas;
     WeaponData = weapon_data;
 }
Beispiel #30
0
        /// <summary>
        ///     計算翻倍結果
        /// </summary>
        private int _GetResult(RequsetFishData fish_data)
        {
            var randNumber = _Visitor.FindIRandom(RandomData.RULE.ODDS, 4)
                                    .NextInt(0, 1000);

            var oddsValue = new OddsTable().CheckRule(randNumber);

            return _IsExceptions(fish_data, oddsValue) ? 1 : oddsValue;
        }