public async Task <ActionResult <object> > PracticeMastery()
        {
            int mastery = await this.characteristicsService.IncreaseMastery();

            object result = new
            {
                Stat  = mastery,
                Price = CharacteristicsFormulas.CalculateDefensePrice(mastery),
                Gold  = await this.resourcePouchService.GetResource(ResourceNames.Gold),
            };

            return(result);
        }
        public async Task <ActionResult <object> > PracticeAttack()
        {
            int attack = await this.characteristicsService.IncreaseAttack();

            object result = new
            {
                Stat  = attack,
                Price = CharacteristicsFormulas.CalculateAttackPrice(attack),
                Gold  = await this.resourcePouchService.GetResource(ResourceNames.Gold),
            };

            return(result);
        }
        public async Task <int> IncreaseMastery()
        {
            Characteristics characteristics = await this.GetCharacteristics();

            int goldNeeded = CharacteristicsFormulas.CalculateMasteryPrice(characteristics.Mastery);

            await this.resourcesService.DecreaseResource(ResourceNames.Gold, goldNeeded);

            characteristics.Mastery++;

            await this.context.SaveChangesAsync();

            return(characteristics.Mastery);
        }
        public async Task <ActionResult <object> > PracticeMass()
        {
            int mass = await this.characteristicsService.IncreaseMass();

            Health health = await this.healthService.GetHealth();

            object result = new
            {
                Stat  = mass,
                Price = CharacteristicsFormulas.CalculateMassPrice(mass),
                Gold  = await this.resourcePouchService.GetResource(ResourceNames.Gold),
                health.Current,
                health.Maximum,
            };

            return(result);
        }
        private Characteristics GenerateFightMonsterCharacteristics(int monsterLevel, int monsterBattlePowerPercent, Characteristics heroCharacteristics)
        {
            Characteristics monsterCharacteristics = new Characteristics();

            int heroBattlePower = CharacteristicsFormulas.CalculateBattlePower(heroCharacteristics);

            Random random = new Random();

            int maxPercent              = MaxPercent;
            int monsterAttackPercent    = random.Next(MinimumPercentAttack, MaximumPercentAttack);
            int monsterDefensePercent   = random.Next(MinimumPercentDefense, MaximumPercentDefense);
            int monsterMasteryPercent   = random.Next(MinimumPercentMastery, MaximumPercentMastery);
            int monsterDexterityPercent = maxPercent - monsterAttackPercent - monsterDefensePercent - monsterMasteryPercent;
            int monsterBattlePower      = MonsterFormulas.CalculateBattlePower(heroBattlePower, monsterBattlePowerPercent);

            monsterCharacteristics.Attack    = MonsterFormulas.CalculateAttack(monsterLevel, monsterBattlePower, monsterAttackPercent);
            monsterCharacteristics.Defense   = MonsterFormulas.CalculateDefense(monsterLevel, monsterBattlePower, monsterAttackPercent);
            monsterCharacteristics.Mastery   = MonsterFormulas.CalculateMastery(monsterLevel, monsterBattlePower, monsterMasteryPercent);
            monsterCharacteristics.Dexterity = MonsterFormulas.CalculateDexterity(monsterLevel, monsterBattlePower, monsterDexterityPercent);
            monsterCharacteristics.Mass      = heroCharacteristics.Mass;

            return(monsterCharacteristics);
        }
        public FarmHeroesProfile()
        {
            this.CreateMap <HeroCreateInputModel, Hero>();

            this.CreateMap <Hero, HeroOverviewViewModel>()
            .ForMember(x => x.EquippedSetHelmet, cfg => cfg.MapFrom(x => x.EquippedSet.Equipped.Find(x => x.Type == EquipmentType.Helmet)))
            .ForMember(x => x.EquippedSetArmor, cfg => cfg.MapFrom(x => x.EquippedSet.Equipped.Find(x => x.Type == EquipmentType.Armor)))
            .ForMember(x => x.EquippedSetWeapon, cfg => cfg.MapFrom(x => x.EquippedSet.Equipped.Find(x => x.Type == EquipmentType.Weapon)))
            .ForMember(x => x.EquippedSetShield, cfg => cfg.MapFrom(x => x.EquippedSet.Equipped.Find(x => x.Type == EquipmentType.Shield)));

            this.CreateMap <Hero, HeroViewModel>();

            this.CreateMap <Characteristics, CharacteristicsPracticeViewModel>()
            .ForMember(x => x.AttackPrice, cfg => cfg.MapFrom(x => CharacteristicsFormulas.CalculateAttackPrice(x.Attack)))
            .ForMember(x => x.DefensePrice, cfg => cfg.MapFrom(x => CharacteristicsFormulas.CalculateDefensePrice(x.Defense)))
            .ForMember(x => x.MassPrice, cfg => cfg.MapFrom(x => CharacteristicsFormulas.CalculateMassPrice(x.Mass)))
            .ForMember(x => x.MasteryPrice, cfg => cfg.MapFrom(x => CharacteristicsFormulas.CalculateMasteryPrice(x.Mastery)))
            .ForMember(x => x.DexterityPrice, cfg => cfg.MapFrom(x => CharacteristicsFormulas.CalculateDexterityPrice(x.Dexterity)));

            this.CreateMap <Hero, MineViewModel>();

            this.CreateMap <Hero, FarmViewModel>()
            .ForMember(x => x.Salary, cfg => cfg.MapFrom(x => FarmFormulas.CalculateFarmSalaryPerHour(x.Level.CurrentLevel)));

            this.CreateMap <Hero, BattlefieldViewModel>();

            this.CreateMap <Health, HeroHealthViewComponentModel>();

            this.CreateMap <Hero[], BattlefieldGetOpponentsViewModel>()
            .ForMember(x => x.Opponents, cfg => cfg.MapFrom(x => x));

            this.CreateMap <Inventory, InventoryViewModel>()
            .ForMember(x => x.UpgradeCost, cfg => cfg.MapFrom(x => InventoryFormulas.CalculateUpgradeCost(x.MaximumCapacity)));

            this.CreateMap <HeroEquipment, SmithEquipmentViewModel>()
            .ForMember(x => x.UpgradeCost, cfg => cfg.MapFrom(x => SmithFormulas.CalculateEquipmentUpgradeCost(x)));

            this.CreateMap <HeroAmulet, SmithAmuletViewModel>()
            .ForMember(x => x.UpgradeCost, cfg => cfg.MapFrom(x => SmithFormulas.CalculateAmuletUpgradeCost(x)));

            this.CreateMap <ShopEquipment[], ShopViewModel>()
            .ForMember(x => x.Items, cfg => cfg.MapFrom(x => x));

            this.CreateMap <ShopAmulet[], AmuletShopViewModel>()
            .ForMember(x => x.Items, cfg => cfg.MapFrom(x => x));

            this.CreateMap <ShopBonus[], HutBonusesViewModel>()
            .ForMember(x => x.Bonuses, cfg => cfg.MapFrom(x => x));

            this.CreateMap <Inventory, SmithViewModel>();

            this.CreateMap <Hero, BattlefieldOpponentViewModel>();

            this.CreateMap <Hero, HeroModifyBasicInfoInputModel>();

            this.CreateMap <Hero, LevelModifyInputModel>();

            this.CreateMap <Hero, HealthModifyInputModel>();

            this.CreateMap <Hero, ResourcePouchModifyInputModel>();

            this.CreateMap <Hero, CharacteristicsModifyInputModel>();

            this.CreateMap <Hero, ChronometerModifyInputModel>();

            this.CreateMap <ShopEquipment, EquipmentViewModel>();

            this.CreateMap <HeroEquipment, EquipmentViewModel>();

            this.CreateMap <ShopAmulet, AmuletViewModel>();

            this.CreateMap <HeroAmulet, AmuletViewModel>();

            this.CreateMap <HeroBonus, BonusViewModel>();

            this.CreateMap <Fight, FightLogViewModel>();

            this.CreateMap <Chronometer, SideMenuTimersViewComponentModel>();

            this.CreateMap <Inventory, SideMenuAmuletsViewComponentModel>();

            this.CreateMap <Inventory, SideMenuBonusesViewComponentModel>();

            this.CreateMap <ResourcePouch, HeroResourcesViewComponentModel>();

            this.CreateMap <ResourcePouch, SideMenuResourcesViewComponentModel>();

            this.CreateMap <Statistics, StatisticsAllViewModel>();

            this.CreateMap <Notification, NotificationViewModel>();

            this.CreateMap <MonsterInputModel, Monster>();

            this.CreateMap <Monster, MonsterInputModel>();

            this.CreateMap <AmuletBag, AmuletBagViewModel>();

            this.CreateMap <HeroAmulet, AmuletSelectViewModel>();

            this.CreateMap <Hero, DungeonIndexViewModel>();

            this.CreateMap <Hero, DungeonWalkingViewModel>();

            this.CreateMap <Hero, HarbourViewModel>();

            this.CreateMap <NewsInputModel, News>();

            this.CreateMap <News, NewsInputModel>();

            this.CreateMap <News, NewsListViewModel>();

            this.CreateMap <News, NewsDetailsViewModel>();
        }