public bool Execute(int questId)
        {
            var quest = questDal.Get(questId);

            heroService.RemoveEnergy(quest.RequiredLevel, myHero);
            if (quest.Monster != null)
            {
                if (Fight(quest.Monster))
                {
                    Win(quest);
                    heroDal.Update(myHero);
                    return(true);
                }
                Loss();
                heroDal.Update(myHero);
                return(false);
            }

            Win(quest);
            heroDal.Update(myHero);
            return(true);
        }
Exemplo n.º 2
0
        public bool Buy(int itemId, int quantity)
        {
            if (!eqService.HaveEmptySpace(myHero))
            {
                return(false);
            }

            var item = itemDal.Read(itemId);

            if (myHero.Money < item.Price)
            {
                return(false);
            }

            if (myHero.Level < item.RequiredLevel)
            {
                return(false);
            }

            heroService.RemoveMoney(item.Price, myHero);
            heroDal.Update(myHero);
            eqService.AddItem(itemId, myHero, quantity);
            return(true);
        }