Beispiel #1
0
        public bool TryRandAskNpc(int npcId, out int newRank, out int newNpcId)
        {
            newRank  = MINAskRank;
            newNpcId = MINAskNpc;
            ConfigSkillcardaskrankEntity npc;

            if (!TryGetAskNPC(npcId, out npc))
            {
                return(false);
            }
            int askRank = npc.AskRank;

            if (askRank >= MAXAskRank)
            {
                return(true);
            }
            int succVal = Convert.ToInt32(npc.SuccRate * 10000);

            if (RandomPicker.RandomInt(1, 10000) > succVal)
            {
                return(true);
            }
            newRank = askRank + 1;
            return(TryRandAskNpc_Rank(newRank, out newNpcId));
        }
Beispiel #2
0
        /// <summary>
        /// 踢球状态
        /// </summary>
        /// <param name="shootProp"></param>
        /// <returns></returns>
        ShootItem GetShootResult(int shootProp)
        {
            var rand = RandomPicker.GetRandom();
            var obj  = new ShootItem();
            int val  = RandomPicker.RandomInt(0, 100, rand);

            if (val <= _aDRateShootFly)
            {
                obj.ShootPos = 2;//射飞
            }
            else if (val <= _aDRateShootFrame)
            {
                obj.ShootPos = 1;//射中门框
            }
            else
            {
                obj.ShootPos = 0;//射中
            }
            bool diveSame = val <= _aDRateDiveSame;

            obj.DiveDir = diveSame;

            if (obj.ShootPos == 0)
            {
                if (!diveSame ||
                    RandomPicker.RandomInt(1, 100) <= shootProp * 100 / (shootProp + 200))
                {
                    obj.IsGoals = true;
                    return(obj);
                }
            }
            obj.IsGoals = false;
            return(obj);
        }
Beispiel #3
0
        public bool TryRandSkillCode(int skillClass, int skillLevel, out string skillCode)
        {
            skillCode = string.Empty;
            int           libKey = CastLibKey(skillClass, skillLevel);
            List <string> lib    = null;

            if (!s_dicSkillLib.TryGetValue(libKey, out lib) || lib.Count == 0)
            {
                return(false);
            }
            skillCode = lib[RandomPicker.RandomInt(0, lib.Count - 1)];
            return(true);
        }