コード例 #1
0
        public IHalfInningActions FillWalkActions(IHalfInningActions actions)
        {
            HalfInningActionsDto dto = Mapper.Map <HalfInningActionsDto>(actions);

            if (AreBasesLoaded(dto) == true)
            {
                dto.TotalRuns++;
            }
            else
            {
                if (dto.IsRunnerOnFirst && dto.IsRunnerOnSecond)
                {
                    dto.IsRunnerOnFirst = false;
                    dto.IsRunnerOnThird = true;
                }
                else if (dto.IsRunnerOnFirst)
                {
                    dto.IsRunnerOnFirst  = false;
                    dto.IsRunnerOnSecond = true;
                }
            }
            dto.IsRunnerOnFirst = true;

            return(dto);
        }
コード例 #2
0
        public IHalfInningActions FillSacraficeHitActions(IHalfInningActions actions)
        {
            HalfInningActionsDto dto = Mapper.Map <HalfInningActionsDto>(actions);

            dto.TotalOuts++;

            if (dto.TotalOuts >= 3)
            {
                dto.AdvanceToNextHalfInning = true;
            }
            else
            {
                if (dto.IsRunnerOnThird)
                {
                    dto.IsRunnerOnThird = false;
                    dto.TotalRuns++;
                }
                if (dto.IsRunnerOnSecond)
                {
                    dto.IsRunnerOnSecond = false;
                    dto.IsRunnerOnThird  = true;
                }
                if (dto.IsRunnerOnFirst)
                {
                    dto.IsRunnerOnFirst  = false;
                    dto.IsRunnerOnSecond = true;
                }
            }

            return(dto);
        }
コード例 #3
0
        public IHalfInningActions FillDoublePlayActions(IHalfInningActions actions)
        {
            HalfInningActionsDto dto = Mapper.Map <HalfInningActionsDto>(actions);

            if (HasBaseRunner(dto) == true)
            {
                dto.TotalOuts += 2;
            }
            else
            {
                dto.TotalOuts++;
            }

            if (dto.TotalOuts >= 3)
            {
                dto.AdvanceToNextHalfInning = true;
            }
            else
            {
                if (dto.IsRunnerOnFirst)
                {
                    dto.IsRunnerOnFirst = false;
                }
                else if (dto.IsRunnerOnSecond)
                {
                    dto.IsRunnerOnSecond = false;
                }
                else if (dto.IsRunnerOnThird)
                {
                    dto.IsRunnerOnThird = false;
                }
            }

            return(dto);
        }
コード例 #4
0
        public IHalfInningActions FillOutActions(IHalfInningActions actions)
        {
            HalfInningActionsDto dto = Mapper.Map <HalfInningActionsDto>(actions);

            dto.TotalOuts++;

            if (dto.TotalOuts >= 3)
            {
                dto.AdvanceToNextHalfInning = true;
            }

            return(dto);
        }
コード例 #5
0
        public IHalfInningActions FillHomeRunActions(IHalfInningActions actions)
        {
            HalfInningActionsDto dto = Mapper.Map <HalfInningActionsDto>(actions);

            if (dto.IsRunnerOnThird)
            {
                dto.IsRunnerOnThird = false;
                dto.TotalRuns++;
            }
            if (dto.IsRunnerOnSecond)
            {
                dto.IsRunnerOnSecond = false;
                dto.TotalRuns++;
            }
            if (dto.IsRunnerOnFirst)
            {
                dto.IsRunnerOnFirst = false;
                dto.TotalRuns++;
            }
            dto.TotalRuns++;

            return(dto);
        }