Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private void PunishMental(ref int index)
        {
            var mentalLoss = (uint)(GameResourceBook.OutMentalSceneQuest(config.PunishMental) * (10 + hardness) / 10);

            if (mentalLoss > 0)
            {
                UserProfile.Profile.InfoBasic.SubMental(mentalLoss);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Mental, (int)-mentalLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 3
0
        private void PunishGold(ref int index)
        {
            var goldLoss = GameResourceBook.OutGoldSceneQuest(level, config.PunishGold);

            if (goldLoss > 0)
            {
                UserProfile.Profile.InfoBag.SubResource(GameResourceType.Gold, goldLoss);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Gold, (int)-goldLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 4
0
        private void PunishFood(ref int index)
        {
            var foodLoss = GameResourceBook.OutFoodSceneQuest(config.PunishFood);

            if (foodLoss > 0)
            {
                UserProfile.Profile.InfoBasic.SubFood(foodLoss);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Food, (int)-foodLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 5
0
        private void PunishHealth(ref int index)
        {
            var healthLoss = GameResourceBook.OutHealthSceneQuest(config.PunishHealth);

            if (healthLoss > 0)
            {
                UserProfile.Profile.InfoBasic.SubHealth(healthLoss);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Health, (int)-healthLoss);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 6
0
        private void RewardEndu(ref int index)
        {
            var enduGet = config.RewardEndu;

            if (enduGet > 0 && UserProfile.InfoDungeon.Endu >= 0)
            {
                UserProfile.InfoDungeon.ChangeAttr(0, 0, 0, 0, enduGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Endu, enduGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 7
0
        private void RewardStr(ref int index)
        {
            var strGet = config.RewardStr;

            if (strGet > 0 && UserProfile.InfoDungeon.Str >= 0)
            {
                UserProfile.InfoDungeon.ChangeAttr(strGet, 0, 0, 0, 0);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Str, strGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 8
0
        private void RewardGold(ref int index)
        {
            var goldGet = (uint)(GameResourceBook.InGoldSceneQuest(level, config.RewardGold) * (10 + hardness) / 10); //难度越高资源越多

            if (goldGet > 0)
            {
                UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gold, goldGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Gold, (int)goldGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 9
0
        private void RewardFood(ref int index)
        {
            var foodGet = (uint)(GameResourceBook.InFoodSceneQuest(config.RewardFood) * (10 - hardness) / 10);

            if (foodGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddFood(foodGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Food, (int)foodGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 10
0
        private void RewardExp(ref int index)
        {
            var expGet = (uint)(GameResourceBook.InExpSceneQuest(level, config.RewardExp) * (10 + hardness) / 10); //难度越高经验越多

            if (expGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddExp((int)expGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Exp, (int)expGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 11
0
        private void RewardHealth(ref int index)
        {
            var healthGet = GameResourceBook.InHealthSceneQuest(config.RewardHealth);

            if (healthGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddHealth(healthGet);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Health, (int)healthGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 12
0
        private void RewardMental(ref int index)
        {
            var mentalGet = GameResourceBook.InMentalSceneQuest(config.RewardMental);

            if (mentalGet > 0)
            {
                UserProfile.Profile.InfoBasic.AddMental(mentalGet);
                var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                     60, ImageRegionCellType.Mental, (int)mentalGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 13
0
        private void RewardRes(ref int index)
        {
            var resId  = config.RewardResId;
            var resGet = (uint)(GameResourceBook.InResSceneQuest(resId, level, config.RewardResAmount) * (10 + hardness) / 10); //难度越高资源越多

            if (resGet > 0)
            {
                UserProfile.Profile.InfoBag.AddResource((GameResourceType)resId, resGet);
                var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25),
                                                                   60, ImageRegionCellType.Lumber + resId - 1, (int)resGet);
                vRegion.AddRegion(pictureRegion);
                index++;
            }
        }
Esempio n. 14
0
        private void DoTrade()
        {
            int    multi = int.Parse(evt.ParamList[0]);
            string type  = "all";

            if (evt.ParamList.Count >= 2)
            {
                type = evt.ParamList[1];
            }
            double multiNeed = multi * MathTool.Clamp(1, 0.2f, 5);
            double multiGet  = multi * MathTool.Clamp(1, 0.2f, 5);
            int    index     = 1;

            if (config.TradeGold > 0 && (type == "all" || type == "gold"))
            {
                var goldGet = GameResourceBook.InGoldSceneQuest(level, (int)(config.TradeGold * multiGet), true);
                if (goldGet > 0)
                {
                    UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gold, goldGet);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Gold, (int)goldGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeGold < 0)
            {
                var goldLoss = GameResourceBook.OutGoldSceneQuest(level, (int)(-config.TradeGold * multiNeed), true);
                if (goldLoss > 0)
                {
                    UserProfile.Profile.InfoBag.SubResource(GameResourceType.Gold, goldLoss);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Gold, (int)-goldLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (config.TradeFood > 0 && (type == "all" || type == "food"))
            {
                var foodGet = Math.Min(100, GameResourceBook.InFoodSceneQuest((int)(config.TradeFood * multiGet), true));
                if (foodGet > 0)
                {
                    UserProfile.Profile.InfoBasic.AddFood(foodGet);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Food, (int)foodGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeFood < 0)
            {
                var foodLoss = Math.Min(100, GameResourceBook.OutFoodSceneQuest((int)(-config.TradeFood * multiNeed), true));
                if (foodLoss > 0)
                {
                    UserProfile.Profile.InfoBasic.SubFood(foodLoss);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Food, (int)-foodLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (config.TradeHealth > 0 && (type == "all" || type == "health"))
            {
                var healthGet = Math.Min(100, GameResourceBook.InHealthSceneQuest((int)(config.TradeHealth * multiGet), true));
                if (healthGet > 0)
                {
                    UserProfile.Profile.InfoBasic.AddHealth(healthGet);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Health, (int)healthGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeHealth < 0)
            {
                var healthLoss = Math.Min(100, GameResourceBook.OutHealthSceneQuest((int)(-config.TradeHealth * multiNeed), true));
                if (healthLoss > 0)
                {
                    UserProfile.Profile.InfoBasic.SubHealth(healthLoss);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Health, (int)-healthLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (config.TradeMental > 0 && (type == "all" || type == "mental"))
            {
                var mentalGet = Math.Min(100, GameResourceBook.InMentalSceneQuest((int)(config.TradeMental * multiGet), true));
                if (mentalGet > 0)
                {
                    UserProfile.Profile.InfoBasic.AddMental(mentalGet);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Mental, (int)mentalGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeMental < 0)
            {
                var mentalLoss = Math.Min(100, GameResourceBook.OutMentalSceneQuest((int)(-config.TradeMental * multiNeed), true));
                if (mentalLoss > 0)
                {
                    UserProfile.Profile.InfoBasic.SubMental(mentalLoss);
                    var pictureRegion = ComplexRegion.GetResShowRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Mental, (int)-mentalLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (!string.IsNullOrEmpty(config.TradeDropItem))
            {
                var itemList = DropBook.GetDropItemList(config.TradeDropItem);
                foreach (var itemId in itemList)
                {
                    UserProfile.InfoBag.AddItem(itemId, 1);
                    vRegion.AddRegion(new PictureRegion(index, pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25, 60, 60, PictureRegionCellType.Item, itemId));


                    index++;
                }
            }
        }
Esempio n. 15
0
        public override void Init(int width, int height)
        {
            base.Init(width, height);

            isWin = BattleManager.Instance.StatisticData.PlayerWin;
            if (isWin)
            {
                SoundManager.Play("System", "QuestCompleted.wav");
            }
            else
            {
                SoundManager.Play("System", "Failed.mp3");
            }

            rightId = BattleManager.Instance.PlayerManager.RightPlayer.PeopleId;
            leftId  = BattleManager.Instance.PlayerManager.LeftPlayer.PeopleId;
            if (leftId == 0)
            {
                BattleStatisticData statisticData = BattleManager.Instance.StatisticData;
                PeopleDrop          drop          = new PeopleDrop(rightId);
                resource = drop.GetDropResource();
                PeopleConfig peopleConfig = ConfigData.GetPeopleConfig(rightId);
                exp = GameResourceBook.InExpFight(UserProfile.InfoBasic.Level, peopleConfig.Level);

                resource[0] = resource[0] * (100 + statisticData.GoldRatePlus) / 100;
                exp         = exp * (100 + (uint)statisticData.ExpRatePlus) / 100;

                if (isWin)
                {
                    var dropItemId = drop.GetDropItem();//获胜可以获得掉落物
                    if (dropItemId != 0)
                    {
                        statisticData.Items.Insert(0, dropItemId);
                    }
                }
                else
                {
                    for (int i = 0; i < 7; i++)
                    {
                        resource[i] /= 5;
                    }
                    exp /= 4;
                }
                //resource[0] = 10;  //todo 测试使用
                //for (int i = 0; i < 10; i++)
                //{
                //    StatisticData.Items.Add(22033032);
                //}
                //exp = 15;
                if (resource[0] > 0)
                {
                    var pos           = GetCellPosition();
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(cellIndex, pos, 45, ImageRegionCellType.Gold, resource[0]);
                    virtualRegion.AddRegion(pictureRegion);
                }

                if (exp > 0)
                {
                    var pos           = GetCellPosition();
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(cellIndex, pos, 45, ImageRegionCellType.Exp, (int)exp);
                    virtualRegion.AddRegion(pictureRegion);
                }

                for (int i = 0; i < statisticData.Items.Count; i++)
                {
                    rewardItemList.Add(statisticData.Items[i]);
                    var pos = GetCellPosition();
                    virtualRegion.AddRegion(new PictureAnimRegion(cellIndex, pos.X, pos.Y, 45, 45, PictureRegionCellType.Item, statisticData.Items[i]));
                }
            }
            else
            {
                resource = (new GameResource()).ToArray();
            }
            show = true;
            Reward();

            UserProfile.Profile.InfoEquip.CheckExpireAndDura(false);
        }
Esempio n. 16
0
        private void DoTrade()
        {
            int multi = int.Parse(evt.ParamList[0]);
            int index = 1;

            if (config.TradeGold > 0)
            {
                var goldGet = GameResourceBook.InGoldSceneQuest(level, config.TradeGold * multi, true);
                if (goldGet > 0)
                {
                    UserProfile.Profile.InfoBag.AddResource(GameResourceType.Gold, goldGet);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index,
                                                                         new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Gold,
                                                                         (int)goldGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeGold < 0)
            {
                var goldLoss = GameResourceBook.OutGoldSceneQuest(level, -config.TradeGold * multi, true);
                if (goldLoss > 0)
                {
                    UserProfile.Profile.InfoBag.SubResource(GameResourceType.Gold, goldLoss);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Gold, (int)-goldLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (config.TradeFood > 0)
            {
                var foodGet = Math.Min(100, GameResourceBook.InFoodSceneQuest(config.TradeFood * multi, true));
                if (foodGet > 0)
                {
                    UserProfile.Profile.InfoBasic.AddFood(foodGet);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index,
                                                                         new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Food,
                                                                         (int)foodGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeFood < 0)
            {
                var foodLoss = Math.Min(100, GameResourceBook.OutFoodSceneQuest(-config.TradeFood * multi, true));
                if (foodLoss > 0)
                {
                    UserProfile.Profile.InfoBasic.SubFood(foodLoss);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Food, (int)-foodLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (config.TradeHealth > 0)
            {
                var healthGet = Math.Min(100, GameResourceBook.InHealthSceneQuest(config.TradeHealth * multi, true));
                if (healthGet > 0)
                {
                    UserProfile.Profile.InfoBasic.AddHealth(healthGet);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index,
                                                                         new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Health,
                                                                         (int)healthGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeHealth < 0)
            {
                var healthLoss = Math.Min(100, GameResourceBook.OutHealthSceneQuest(-config.TradeHealth * multi, true));
                if (healthLoss > 0)
                {
                    UserProfile.Profile.InfoBasic.SubHealth(healthLoss);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Health, (int)-healthLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            if (config.TradeMental > 0)
            {
                var mentalGet = Math.Min(100, GameResourceBook.InMentalSceneQuest(config.TradeMental * multi, true));
                if (mentalGet > 0)
                {
                    UserProfile.Profile.InfoBasic.AddMental(mentalGet);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index,
                                                                         new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Mental,
                                                                         (int)mentalGet);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
            else if (config.TradeMental < 0)
            {
                var mentalLoss = Math.Min(100, GameResourceBook.OutMentalSceneQuest(-config.TradeMental * multi, true));
                if (mentalLoss > 0)
                {
                    UserProfile.Profile.InfoBasic.SubMental(mentalLoss);
                    var pictureRegion = ComplexRegion.GetSceneDataRegion(index, new Point(pos.X + 3 + 20 + (index - 1) * 70, pos.Y + 3 + 25), 60, ImageRegionCellType.Mental, (int)-mentalLoss);
                    vRegion.AddRegion(pictureRegion);
                    index++;
                }
            }
        }