Ejemplo n.º 1
0
        public GameParticipant GetGit(PartOfBody attackedPart)
        {
            if (attackedPart == blocked)
            {
                return(Block(this, attackedPart));
            }

            return(TakeWound(this));
        }
Ejemplo n.º 2
0
        public User GetGit(PartOfBody attackedPart)
        {
            if (attackedPart == blocked)
            {
                return(Block(this, attackedPart));
            }

            return(TakeWound(this));
        }
Ejemplo n.º 3
0
        public async Task <int> AddAsync(string name, string partOfBody)
        {
            var exercise = await _exerciseRepository.CheckIfExistsAsync(name);

            exercise = new Exercise(name, PartOfBody.GetPart(partOfBody));

            await _exerciseRepository.AddAsync(exercise);

            return(exercise.Id);
        }
Ejemplo n.º 4
0
        public new void GetHit(PartOfBody point, int dm)
        {
            SetBlock(GetBlock());
            switch (point)
            {
            case PartOfBody.Head: hits[0] += 1; break;

            case PartOfBody.Body: hits[1] += 1; break;

            case PartOfBody.Legs: hits[2] += 1; break;
            }
            base.GetHit(point, dm);
        }
Ejemplo n.º 5
0
 public void GetHit(PartOfBody pob)
 {
     if (pob == Blocked)
     {
         onBlock(this, new GamerArgs(this.Name, this.Hp));
     }
     else
     {
         this.Hp -= 20;
         onWound(this, new GamerArgs(this.Name, this.Hp));
         if (this.Hp <= 0)
         {
             onDeath(this, new GamerArgs(this.Name, this.Hp));
         }
     }
 }
Ejemplo n.º 6
0
        public async Task UpdateAsync(int id, string name, string partOfBody)
        {
            var exercise = await _exerciseRepository.GetOrFailAsync(id);

            // If exercise has the same name, ensure that name will be searching for exercise with this name
            if (await _exerciseRepository.AnyAsync(p => p.Name == name))
            {
                if (exercise.Name != name)
                {
                    throw new NameInUseException(nameof(Exercise), name);
                }
            }

            exercise.SetName(name);
            exercise.PartOfBody.Id = PartOfBody.GetPart(partOfBody).Id;

            await _exerciseRepository.UpdateAsync(exercise);
        }
Ejemplo n.º 7
0
        public async Task <PagedList <Exercise> > GetAllAsync(string name, string partOfBody, PaginationQuery paginationQuery)
        {
            IQueryable <Exercise> query = _context.Exercises.Include(e => e.PartOfBody)
                                          .AsNoTracking();

            if (name is not null)
            {
                query = query.Where(e => e.Name.Contains(name));
            }

            if (partOfBody is not null)
            {
                query = query.Where(e => e.PartOfBody.Name == PartOfBody.GetPart(partOfBody).Name);
            }

            return(await PagedList <Exercise> .ToPagedList(query.OrderBy(e => e.Name),
                                                           paginationQuery.PageNumber,
                                                           paginationQuery.PageSize));
        }
Ejemplo n.º 8
0
        /*Аватар получает оплеуху, аватар оценивет получил он урон или взошла сегодня его счастливая звезда
         * Если заблокировал, то логично вылетает событие Block, и так далее, то безвременой кончины */
        public void GetHit(PartOfBody point, int dm)
        {
            if (point == blocked)
            {
                Block(name, hp);
            }
            else
            {
                hp -= dm;

                if (hp <= 0)
                {
                    Death(name, hp);
                }
                else
                {
                    Wound(name, hp);
                }
            }
        }
Ejemplo n.º 9
0
 public void SetBlock(PartOfBody blockedPart)
 {
     blocked = blockedPart;
 }
Ejemplo n.º 10
0
 private GameParticipant BlockHandler(GameParticipant user, PartOfBody blockedPart)
 {
     logsForm.UpdateLogs(user.name + " blocked the attack, " + blockedPart + " kick blocked \r");
     return(user);
 }
Ejemplo n.º 11
0
 private new void SetBlock(PartOfBody block)
 {
     this.blocked = block;
 }
Ejemplo n.º 12
0
 /* Устанавливает блок из вне, то есть блок ставит пользователь и его запоминает аватар*/
 public void SetBlock(PartOfBody block)
 {
     this.blocked = block;
 }
Ejemplo n.º 13
0
 private User BlockHandler(User user, PartOfBody blockedPart)
 {
     LogsRichTextBox.Text += user.name + " blocked the attack, " + blockedPart + " kick blocked \r";
     return(user);
 }
Ejemplo n.º 14
0
 public void SetBlock(PartOfBody pob)
 {
     Blocked = pob;
 }
Ejemplo n.º 15
0
 public async Task AddPartOfBody(PartOfBody p)
 {
     await db.PartsOfBody.AddAsync(p);
 }