Beispiel #1
0
        static Question GetQuestionInfoWeapon()
        {
            string[] eids = { "atf", "skill", "star", "attr" };
            string[] cids = { "初始攻/防", "技能", "星级", "属性" };
            int      type = MathTool.GetRandom(eids.Length);

            int      weaponId = WeaponBook.GetRandWeaponId();
            Question question = new Question();

            question.info = string.Format("|以下哪一个武器的{0}是|Yellow|{1}||?", cids[type], WeaponBook.GetAttrByString(weaponId, eids[type]));
            question.ans  = new string[4];
            question.ans[MathTool.GetRandom(4)] = ConfigData.GetWeaponConfig(weaponId).Name;
            int idx = 0;
            SimpleSet <string> set = new SimpleSet <string>();

            set.Add(WeaponBook.GetAttrByString(weaponId, eids[type]));
            while (idx < 4)
            {
                if (question.ans[idx] != null)
                {
                    idx++;
                    continue;
                }

                int guessId = WeaponBook.GetRandWeaponId();
                if (!set.Has(ConfigData.GetWeaponConfig(guessId).Name) && WeaponBook.GetAttrByString(guessId, eids[type]) != WeaponBook.GetAttrByString(weaponId, eids[type]))
                {
                    question.ans[idx] = ConfigData.GetWeaponConfig(guessId).Name;
                    set.Add(ConfigData.GetWeaponConfig(guessId).Name);
                    idx++;
                }
            }
            question.result = ConfigData.GetWeaponConfig(weaponId).Name;
            return(question);
        }
Beispiel #2
0
        public static int GetRandEquipByLevelQuality(int lv, int qual)
        {
            if (equipLevelDict == null)
            {
                equipLevelDict = new Dictionary <int, List <int> >();
                foreach (var equipConfig in ConfigData.EquipDict.Values)
                {
                    if (equipConfig.Disable)
                    {
                        continue;
                    }
                    int catalog = equipConfig.Level * 10 + equipConfig.Quality;
                    if (!equipLevelDict.ContainsKey(catalog))
                    {
                        equipLevelDict.Add(catalog, new List <int>());
                    }
                    equipLevelDict[catalog].Add(equipConfig.Id);
                }
            }

            int        keyType = lv * 10 + qual;
            List <int> datas;

            if (!equipLevelDict.TryGetValue(keyType, out datas))
            {
                return(0);
            }
            if (datas.Count == 0)
            {
                return(0);
            }
            return(datas[MathTool.GetRandom(datas.Count)]);
        }
Beispiel #3
0
        static Question GetQuestionInfoMonster()
        {
            string[] eids = { "hp", "race", "star", "type", "atk", "def" };
            string[] cids = { "初始生命值", "种族", "星级", "属性", "初始攻击", "初始防御" };
            int      type = MathTool.GetRandom(eids.Length);

            MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(MonsterBook.GetRandMonsterId());
            Question      question      = new Question();

            question.info = string.Format("|以下哪一个怪物的{0}是|Yellow|{1}||?", cids[type], MonsterBook.GetAttrByString(monsterConfig.Id, eids[type]));
            question.ans  = new string[4];
            question.ans[MathTool.GetRandom(4)] = monsterConfig.Name;
            int idx = 0;
            SimpleSet <string> set = new SimpleSet <string>();

            set.Add(MonsterBook.GetAttrByString(monsterConfig.Id, eids[type]));
            while (idx < 4)
            {
                if (question.ans[idx] != null)
                {
                    idx++;
                    continue;
                }

                MonsterConfig guessConfig = ConfigData.GetMonsterConfig(MonsterBook.GetRandMonsterId());
                if (!set.Has(guessConfig.Name) && MonsterBook.GetAttrByString(monsterConfig.Id, eids[type]) != MonsterBook.GetAttrByString(guessConfig.Id, eids[type]))
                {
                    question.ans[idx] = guessConfig.Name;
                    set.Add(guessConfig.Name);
                    idx++;
                }
            }
            question.result = monsterConfig.Name;
            return(question);
        }
Beispiel #4
0
        /// <summary>
        /// 限制战斗时调用
        /// </summary>
        public static int CheckPieceDrop(int id, int luk)
        {
            TryUpdateCache(id);

            int blankTotal = 10000;

            foreach (var cardPieceRate in pieces[id])
            {
                blankTotal -= cardPieceRate.Rate;
            }

            int roll = MathTool.GetRandom(10000 + luk * GameConstants.LukToRoll);//万分之roll点

            if (roll < blankTotal)
            {
                return(0);
            }

            int baseValue = blankTotal;

            foreach (var cardPieceRate in pieces[id])
            {
                baseValue += cardPieceRate.Rate;
                if (baseValue > roll)
                {
                    return(cardPieceRate.ItemId);
                }
            }

            return(0);
        }
Beispiel #5
0
        private static void RandomSwitch(byte[] pixelValues, int imageWidth, int imageHeight, int level)
        {
            int index = 0;

            for (int i = 0; i < imageHeight; i++)
            {
                for (int j = 0; j < imageWidth; j++)
                {
                    int yoff = i + MathTool.GetRandom(level * 3);
                    if (yoff >= imageHeight)
                    {
                        yoff = imageHeight - 1;
                    }
                    int xoff = j + MathTool.GetRandom(level * 3);
                    if (xoff >= imageWidth)
                    {
                        xoff = imageWidth - 1;
                    }
                    int tindex = (yoff * imageWidth + xoff) * 4;

                    pixelValues[index] = pixelValues[tindex];
                    index++;
                    pixelValues[index] = pixelValues[tindex + 1];
                    index++;
                    pixelValues[index] = pixelValues[tindex + 2];
                    index++;
                    pixelValues[index] = pixelValues[tindex + 3];
                    index++; //A
                }
            }
        }
Beispiel #6
0
        private void InitIconArray()
        {
            for (int i = 0; i < ColumnCount + 2; i++)
            {
                for (int j = 0; j < RowCount + 2; j++)
                {
                    iconArray[i, j] = 0;
                }
            }
            for (int i = 0; i < ColumnCount; i++)
            {
                for (int j = 0; j < RowCount; j++)
                {
                    iconArray[i + 1, j + 1] = ((i + j * ColumnCount) / 2) % 16 + 1;
                }
            }
            for (int i = 0; i < 4; i++)
            {
                int sel   = (MathTool.GetRandom(0, int.MaxValue) % (RowCount * ColumnCount)) / 2 * 2; //取偶
                int symid = (MathTool.GetRandom(0, int.MaxValue) % 6) + 1;
                iconArray[(sel % ColumnCount) + 1, sel / ColumnCount + 1]     = 20 + symid;
                iconArray[(sel % ColumnCount) + 1 + 1, sel / ColumnCount + 1] = 20 + symid;
            }

            for (int i = 0; i < 1000; i++)
            {
                Swap(MathTool.GetRandom(0, int.MaxValue) % ColumnCount, MathTool.GetRandom(0, int.MaxValue) % RowCount,
                     MathTool.GetRandom(0, int.MaxValue) % ColumnCount, MathTool.GetRandom(0, int.MaxValue) % RowCount);
            }
        }
Beispiel #7
0
        public void QuestNext(string qname)
        {
            int fromId = UserProfile.InfoBasic.Position;

            while (true)
            {
                int index      = MathTool.GetRandom(sceneItems.Count);
                var targetCell = sceneItems[index];
                if (targetCell.Id == fromId)
                {
                    continue;
                }
                if (!targetCell.CanBeReplaced())
                {
                    continue;
                }
                int qId = SceneBook.GetSceneQuestByName(qname);
                sceneItems[index] =
                    new SceneQuest(targetCell.Id, targetCell.X, targetCell.Y, targetCell.Width, targetCell.Height, qId);
                sceneItems[index].MapSetting = true;
                UserProfile.InfoWorld.UpdatePosInfo(targetCell.Id, qId);
                UserProfile.InfoWorld.UpdatePosMapSetting(targetCell.Id, true);
                break;
            }

            parent.Invalidate();
        }
        public static int GetRateCard(int[] rate, RandomCardSelectorDelegate del, int funcInfo)
        {
            while (true)
            {
                int sum = 0;
                foreach (var r in rate)
                {
                    sum += r;
                }
                int roll    = MathTool.GetRandom(sum);
                int quality = 0;
                sum = 0;
                for (int i = 0; i < rate.Length; i++)
                {
                    sum += rate[i];
                    if (roll < sum)
                    {
                        quality = i;
                        break;
                    }
                }

                var cardId = del(funcInfo, quality);
                if (cardId > 0)
                {
                    return(cardId);
                }
                else
                {
                    NLog.Debug("GetRateCard cardId = 0 funcInfo " + funcInfo);
                }
            }

            return(0);
        }
Beispiel #9
0
        private static int GetSpeed(int type, int danger)
        {
            if (MathTool.GetRandom(100) < breakTable[type - 1, danger])
            {
                return(0);
            }

            int realSpd = 0;

            if (type == SpeedSlow)
            {
                realSpd = MathTool.GetRandom(50, 70);
            }
            else if (type == SpeedMed)
            {
                realSpd = MathTool.GetRandom(90, 110);
            }
            else if (type == SpeedHigh)
            {
                realSpd = MathTool.GetRandom(130, 150);
            }
            else if (type == SpeedSuper)
            {
                realSpd = MathTool.GetRandom(200, 250);
            }
            return(realSpd);
        }
Beispiel #10
0
        public CardProductMarkTypes GetSellMark()
        {
            CardProductMarkTypes mark = CardProductMarkTypes.Null;
            var cardData = CardConfigManager.GetCardConfig(WeaponConfig.Id);

            if (cardData.Quality == CardQualityTypes.Legend)
            {
                mark = CardProductMarkTypes.Only;
            }
            else if (cardData.Quality < CardQualityTypes.Excel && MathTool.GetRandom(10) > 7)
            {
                mark = CardProductMarkTypes.Sale;
            }
            else
            {
                int roll = MathTool.GetRandom(10);
                if (roll == 0)
                {
                    mark = CardProductMarkTypes.Hot;
                }
                else if (roll == 1)
                {
                    mark = CardProductMarkTypes.Gold;
                }
            }
            return(mark);
        }
Beispiel #11
0
        private static Dictionary <HItemRandomGroups, Dictionary <int, List <int> > > rareMidDict;//随机组,稀有度

        public static int GetRandRareItemIdWithGroup(HItemRandomGroups group, int rare)
        {
            if (rareMidDict == null)
            {
                rareMidDict = new Dictionary <HItemRandomGroups, Dictionary <int, List <int> > >();
                foreach (var value in Enum.GetValues(typeof(HItemRandomGroups)))
                {
                    rareMidDict[(HItemRandomGroups)value] = new Dictionary <int, List <int> >();
                }
                foreach (var hItemConfig in ConfigData.HItemDict.Values)
                {
                    if (hItemConfig.RandomGroup > 0)
                    {
                        HItemRandomGroups group1 = (HItemRandomGroups)hItemConfig.RandomGroup;
                        if (!rareMidDict[group1].ContainsKey(hItemConfig.Rare))
                        {
                            rareMidDict[group1].Add(hItemConfig.Rare, new List <int>());
                        }
                        rareMidDict[group1][hItemConfig.Rare].Add(hItemConfig.Id);
                    }
                }
            }

            var rareList = rareMidDict[group][rare];

            return(rareList[MathTool.GetRandom(rareList.Count)]);
        }
Beispiel #12
0
        private void CalculateRequire()
        {
            int            index = 1;
            List <IntPair> items;

            if (config.PayKey == null || config.PayKey.Length == 0)
            {
                items = ArraysUtils.GetSubArray(UserProfile.InfoBag.GetItemCountByType((int)HItemTypes.Material), 0, 13);
            }
            else
            {
                string pickKey = config.PayKey[MathTool.GetRandom(config.PayKey.Length)];
                items = ArraysUtils.GetSubArray(UserProfile.InfoBag.GetItemCountByAttribute(pickKey), 0, 13);
            }
            for (int i = 0; i < items.Count; i++)
            {
                var region = new ButtonRegion(index, pos.X + 3 + 20 + (index - 1) % 7 * 70, pos.Y + 3 + 25 + (index - 1) / 7 * 70, 60, 60, HItemBook.GetHItemImage(items[i].Type));
                region.SetKeyValue(items[i].Type);
                region.AddDecorator(new RegionTextDecorator(37, 42, 12, Color.White, true, items[i].Value.ToString()));
                vRegion.AddRegion(region);
                index++;
            }

            var button = new ButtonRegion(20, pos.X + 3 + 20 + (index - 1) % 7 * 70, pos.Y + 3 + 25 + (index - 1) / 7 * 70, 60, 60, "iconbg.jpg", "");

            button.AddDecorator(new RegionImageDecorator(HSIcons.GetIconsByEName("rot7"), 60 / 2));
            vRegion.AddRegion(button);
        }
Beispiel #13
0
            public void Draw(Graphics g, int tick)
            {
                var img = HSIcons.GetIconsByEName(this.icon);

                switch (danceType)
                {
                case TextDanceTypes.Normal:
                    g.DrawImage(img, x, y, width, width); break;

                case TextDanceTypes.Jump:
                    g.DrawImage(img, x, y + (int)(Math.Sin((double)(tick) / 2) * 5), width, width); break;

                case TextDanceTypes.Shake:
                    g.DrawImage(img, x + (int)(Math.Sin((double)(tick)) * 5), y + (float)(MathTool.GetRandom(0f, 1) * 2), width, width); break;

                case TextDanceTypes.Lovely:
                    g.DrawImage(img, x, y + (int)(Math.Sin(Math.Tan((double)(tick) / 2)) * 3), width, width); break;

                case TextDanceTypes.Random:
                    var rd = MathTool.GetRandom(0, 16); g.DrawImage(img, x + (rd / 4) - 2, y + (rd % 4) - 2, width, width); break;

                case TextDanceTypes.Stripe:
                    g.DrawImage(img, x + (int)(Math.Sin((double)(tick) / 2) * 5), y + (int)(Math.Sin((double)(tick) / 2) * 5), width, width); break;

                case TextDanceTypes.UpDown:
                    g.DrawImage(img, x, y + (int)(Math.Sin((double)(tick) / 3) * 5), width, width); break;

                case TextDanceTypes.UpdownUniform:
                    g.DrawImage(img, x, y + (int)(Math.Sin((double)(tick) / 3) * 5), width, width); break;

                case TextDanceTypes.LeftRightUniform:
                    g.DrawImage(img, x + (int)(Math.Sin((double)(tick) / 3) * 5), y, width, width); break;
                }
            }
        private void CalculateRequire()
        {
            int index = 1;

            winRate        = config.ChooseWinRate * (10 - hardness) / 10;
            rollItemSpeedX = MathTool.GetRandom(40, 70);

            if (config.ChooseFood > 0)
            {
                int foodCost = (int)GameResourceBook.OutFoodSceneQuest(config.ChooseFood, true);
                var region   = ComplexRegion.GetResButtonRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25 + 70), 60, ImageRegionCellType.Food, -foodCost);
                region.Parm = ImageRegionCellType.Food;
                vRegion.AddRegion(region);
                index++;
            }

            if (config.ChooseGold > 0)
            {
                int goldCost = (int)GameResourceBook.OutGoldSceneQuest(level, config.ChooseGold, true);
                var region   = ComplexRegion.GetResButtonRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25 + 70), 60, ImageRegionCellType.Gold, -goldCost);
                region.Parm = ImageRegionCellType.Gold;
                vRegion.AddRegion(region);
                index++;
            }

            var button = new ButtonRegion(20, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25 + 70, 60, 60, "iconbg.jpg", "");

            button.AddDecorator(new RegionImageDecorator(HSIcons.GetIconsByEName("rot7"), 60 / 2));
            vRegion.AddRegion(button);
        }
Beispiel #15
0
        public void CheckAllTournament(int day)
        {
            foreach (var tournamentConfig in ConfigData.TournamentDict.Values)
            {
                if (tournamentConfig.ApplyDate == day)
                {
                    DbTournamentData tourdata = GetTournamentData(tournamentConfig.Id);
                    tourdata.Pids = PeopleBook.GetRandNPeople(tournamentConfig.PlayerCount, tournamentConfig.MinLevel, tournamentConfig.MaxLevel);
                    if (tourdata.Engage)
                    {
                        tourdata.Pids[MathTool.GetRandom(tournamentConfig.PlayerCount)] = -1; //player
                    }
                    tourdata.Results = new MatchResult[tournamentConfig.MaxLevel];
                }

                if (tournamentConfig.BeginDate <= day && tournamentConfig.EndDate >= day)
                {
                    foreach (int mid in TournamentBook.GetTournamentMatchIds(tournamentConfig.Id))
                    {
                        TournamentMatchConfig tournamentMatchConfig = ConfigData.GetTournamentMatchConfig(mid);
                        if (tournamentMatchConfig.Date == day && Tournaments[tournamentConfig.Id].Results[tournamentMatchConfig.Offset].Winner == 0)
                        {
                            Tournaments[tournamentConfig.Id].CheckMatch(tournamentMatchConfig.Offset, true);
                        }
                    }
                }
                if (tournamentConfig.EndDate == day)
                {
                    Tournaments[tournamentConfig.Id].Award();
                }
            }
        }
Beispiel #16
0
        public bool BeHited(LiveMonster src)
        {
            int hitrate = SkillAssistant.GetHit(src, this);

            if (hitrate > MathTool.GetRandom(100))
            {
                HitDamage damage = SkillAssistant.GetDamage(src, this);
                CheckDamageBuffEffect(src, damage);

                HpBar.OnDamage(damage);
                SkillAssistant.CheckHitEffectAfter(src, this, damage);
                if (src.WeaponId > 0)
                {
                    src.Weapon.OnHit();
                }
                if (WeaponId > 0)
                {
                    Weapon.OnHited();
                }
                if (damage.Value > 0)
                {
                    BuffManager.CheckRecoverOnHit();
                    lastDamagerId  = src.Id;
                    peakDamagerLuk = Math.Max(peakDamagerLuk, src.RealLuk);
                }
                return(true);
            }
            return(false);
        }
Beispiel #17
0
        private void bitmapButtonC1_Click(object sender, EventArgs e)
        {
            int get = MathTool.GetRandom(4) + 2;

            itemGet[level] += get;
            string[] itemNames = { "牛肉", "蜂蜜", "黄油", "水" };
            AddFlowCenter(string.Format("{0}x{1}", itemNames[level], get), "LimeGreen");
            score = GetPoints();
            if (itemGet[level] > itemRequired[level] || score >= 100)
            {
                EndGame();
            }
            else if (itemGet[level] == itemRequired[level])
            {
                for (int i = 1; i < 4; i++)
                {
                    int rlevel = (i + level) % 4;
                    if (itemGet[rlevel] != itemRequired[rlevel])
                    {
                        ChangeFood(rlevel + 1);
                        break;
                    }
                }
            }
        }
Beispiel #18
0
        private static void DropEquips(int equipLevel, List <int> items)
        {
            int[] qualRate   = { 70, 20, 5, 4, 1 };
            int   resultQual = 0;
            int   sum        = 0;
            int   roll       = MathTool.GetRandom(100);

            for (int i = 0; i < 5; i++)
            {
                sum += qualRate[i];
                if (roll < sum)
                {
                    resultQual = i;
                    break;
                }
            }

            int resultItemId = 0;

            while (resultItemId == 0)
            {
                resultItemId = EquipBook.GetRandEquipByLevelQuality(equipLevel, resultQual);
                resultQual--;//如果该品质没有道具,就降低一档品质继续查找
            }

            items.Add(resultItemId);
        }
Beispiel #19
0
        public override void OnFrame(int tick)
        {
            rollItemX += rollItemSpeedX;
            if (rollItemX < 0)
            {
                rollItemX       = 0;
                rollItemSpeedX *= -1;
            }
            if (rollItemX > pos.Width - FrameOff * 2)
            {
                rollItemX       = pos.Width - FrameOff * 2;
                rollItemSpeedX *= -1;
            }

            if (MathTool.GetRandom(10) < 2)
            {
                if (rollItemSpeedX > 0)
                {
                    rollItemSpeedX = rollItemSpeedX - MathTool.GetRandom(1, 3);
                }
                else
                {
                    rollItemSpeedX = rollItemSpeedX + MathTool.GetRandom(1, 3);
                }
                if (Math.Abs(rollItemSpeedX) <= 1)
                {
                    OnStop();
                }
            }
        }
Beispiel #20
0
        public static Question GetQuestion()
        {
            int type = MathTool.GetRandom(8) + 1;

            switch ((QuestionTypes)type)
            {
            case QuestionTypes.MonsterInfo: return(GetQuestionMonsterInfo());

            case QuestionTypes.InfoMonster: return(GetQuestionInfoMonster());

            case QuestionTypes.WeaponInfo: return(GetQuestionWeaponInfo());

            case QuestionTypes.InfoWeapon: return(GetQuestionInfoWeapon());

            case QuestionTypes.SpellInfo: return(GetQuestionSpellInfo());

            case QuestionTypes.InfoSpell: return(GetQuestionInfoSpell());

            case QuestionTypes.SkillInfo: return(GetQuestionSkillInfo());

            case QuestionTypes.InfoSkill: return(GetQuestionInfoSkill());
            }

            return(new Question());
        }
Beispiel #21
0
    private void AiThink()
    {
        if (MatchManager.Instance.PlayerTurn)
        {
            return;
        }

        var attackPair = GetAttackPair();

        if (attackPair != null)
        {
            Panel.Fight(attackPair.Attacker.Id, attackPair.Defender.Id);
            MatchManager.Instance.NextTurn();
            return;
        }

        var hiddenCells = MatchManager.Instance.GetAll().FindAll(cell => cell.IsHide && cell.Side > 0);

        if (hiddenCells.Count > 10)//todo temp code
        {
            var openTarget = hiddenCells[MathTool.GetRandom(hiddenCells.Count)];
            Panel.Open(openTarget.Id);
            MatchManager.Instance.NextTurn();
            return;
        }
    }
Beispiel #22
0
 private static bool IsQuestRateAvail(SceneQuestConfig questConfig)
 {
     if (questConfig.TriggerRate == 0)
     {
         return(true);
     }
     return(MathTool.GetRandom(100) >= questConfig.TriggerRate);
 }
Beispiel #23
0
 private void CreatePlayerForm_Load(object sender, EventArgs e)
 {
     headId = 1;
     pictureBoxHead.Image = PicLoader.Read("Player", "1.PNG");
     constellation        = MathTool.GetRandom(12);
     type    = MathTool.GetRandom(7);
     bldType = MathTool.GetRandom(4);
     myCursor.ChangeCursor("default");
 }
Beispiel #24
0
 /// <summary>
 /// 场景剧情消耗金币
 /// </summary>
 public static uint OutGoldSceneQuest(int level, int rate, bool noRandom = false)
 {
     if (rate <= 0)
     {
         return(0);
     }
     double[] factor = new[] { 0.5, 1, 1, 1.5 };
     rate = (int)(rate * (noRandom ? 1 : factor[MathTool.GetRandom(factor.Length)])) * 3 / 4;
     return(Math.Max(1, (uint)(ExpTree.GetGoldFactor(level) * GoldFactor * rate / 100)));
 }
Beispiel #25
0
        private NpcPieceData CreatePieceMethod(int index)
        {
            NpcPieceData piece = new NpcPieceData();
            int          rare  = MathTool.GetRandom(Math.Max(index / 2, 1), index / 2 + 3);

            piece.Id    = HItemBook.GetRandRareItemId(HItemRandomGroups.Fight, rare);
            piece.Count = MathTool.GetRandom((8 - rare) / 2, 8 - rare);

            return(piece);
        }
Beispiel #26
0
        private void bitmapButtonC1_Click(object sender, EventArgs e)
        {
            c1Speed = MathTool.GetRandom(15, 20);
            c2Speed = MathTool.GetRandom(15, 20);
            c3Speed = MathTool.GetRandom(15, 20);

            bitmapButtonC1.Visible = false;
            bitmapButtonC2.Visible = true;
            bitmapButtonC3.Visible = true;
            bitmapButtonC4.Visible = true;
        }
Beispiel #27
0
 public int GetRevivePos()
 {
     foreach (var sceneObject in sceneItems)
     {
         if (sceneObject.Id == RevivePos)
         {
             return(sceneObject.Id);
         }
     }
     return(sceneItems[MathTool.GetRandom(sceneItems.Count)].Id); //随机给一个
 }
Beispiel #28
0
 public void AddLand(int id, LandData data)
 {
     landDict[id]     = data;
     data.Commerce    = MathTool.GetRandom(10, 1000);
     data.Agriculture = MathTool.GetRandom(35, 60);
     data.IndustryL   = MathTool.GetRandom(0, 10);
     data.IndustryH   = MathTool.GetRandom(0, 2);
     data.Population  = MathTool.GetRandom(0, 10);
     data.Defence     = 0;
     data.Food        = MathTool.GetRandom(0, 100);
 }
 public int GetRandom(int quality)
 {
     if (quality == -1)
     {
         return(dataList[MathTool.GetRandom(dataList.Count)].Type);
     }
     if (quality < 4)
     {
         return(dataList[MathTool.GetRandom(qualityIndex[quality], qualityIndex[quality + 1])].Type);
     }
     return(dataList[MathTool.GetRandom(qualityIndex[quality], dataList.Count)].Type);
 }
Beispiel #30
0
 public override void RestartGame()
 {
     base.RestartGame();
     eraGoodBad    = MathTool.GetRandom(6, 15);
     eraBadGood    = MathTool.GetRandom(6, 15);
     population    = 50;
     populationDry = 0;
     food          = 250;
     sci           = 0;
     isGoodEra     = true;
     ChangeWork(WorkPopu);
 }