コード例 #1
0
        /// <summary>
        /// contains battle log
        /// </summary>
        /// <param name="atk"></param>
        /// <returns></returns>
        public static bool Execute(AtkContext atk)
        {
            var aer = atk.Attacker;

            if (atk.Targets == null || atk.Target != null)
            {
                switch (atk.Move.Id)
                {
                case Ms.SKETCH:     //166
                case Ms.TELEPORT:
                case Ms.HAPPY_HOUR:
                    break;

                case Ms.SELFDESTRUCT:     //120
                case Ms.EXPLOSION:
                    if (aer.Controller.Board.Pokemons.RaiseAbility(As.DAMP) != null)
                    {
                        atk.FailAll("FailSp", atk.Attacker.Id, atk.Move.Id);
                        return(false);
                    }
                    return(true);

                case Ms.REST:     //156
                    if (aer.Hp == aer.Pokemon.MaxHp)
                    {
                        atk.FailAll("FullHp", aer.Id);
                        return(false);
                    }
                    if (!PTs.CanAddXXX(aer, aer, true, AttachedState.SLP, true))
                    {
                        atk.FailAll(null);
                        return(false);
                    }
                    return(true);

                case Ms.SNORE:     //173
                case Ms.SLEEP_TALK:
                    if (aer.State == PokemonState.SLP)
                    {
                        return(true);
                    }
                    break;

                case Ms.FAKE_OUT:     //252
                case Ms.MAT_BLOCK:
                    foreach (var m in aer.Moves)
                    {
                        if (m.HasUsed)
                        {
                            goto FAIL;
                        }
                    }
                    return(true);

                case Ms.STOCKPILE:     //254
                    if (aer.OnboardPokemon.GetCondition <int>(Cs.Stockpile) != 3)
                    {
                        return(true);
                    }
                    break;

                case Ms.SPIT_UP:     //255
                case Ms.SWALLOW:
                    if (aer.OnboardPokemon.HasCondition(Cs.Stockpile))
                    {
                        return(true);
                    }
                    break;

                case Ms.NATURAL_GIFT:     //363
                    if (ITs.CanLostItem(aer) && ITs.CanUseItem(aer) && ITs.Berry(aer.Pokemon.Item))
                    {
                        return(true);
                    }
                    break;

                case Ms.FLING:     //374
                    if (ITs.CanLostItem(aer) && ITs.CanUseItem(aer) && MoveBasePower.FlingPower(aer.Pokemon.Item) != 0)
                    {
                        return(true);
                    }
                    break;

                case Ms.ME_FIRST:     //382
                case Ms.SUCKER_PUNCH: //389
                {
                    var der = atk.Target.Defender;
                    var dm  = der.SelectedMove;
                    if (!(der.LastMoveTurn == der.Controller.TurnNumber || dm == null || dm.Move.Type.Category == MoveCategory.Status))
                    {
                        return(true);
                    }
                }
                break;

                case Ms.LAST_RESORT:     //387
                    foreach (var m in aer.Moves)
                    {
                        if (!m.HasUsed && m.MoveE.Id != Ms.LAST_RESORT)
                        {
                            goto FAIL;
                        }
                    }
                    return(true);

                case Ms.ALLY_SWITCH:
                    if (aer.Controller.GameSettings.Mode == GameMode.Double || aer.Controller.GameSettings.Mode == GameMode.Triple && aer.OnboardPokemon.X != 1)
                    {
                        return(true);
                    }
                    break;

                case Ms.BESTOW:     //516
                    if (aer.Pokemon.Item == 0 || ITs.NeverLostItem(aer.Pokemon))
                    {
                        return(true);
                    }
                    break;

                case Ms.BELCH:     //562
                    if (aer.OnboardPokemon.HasCondition(Cs.Belch))
                    {
                        return(true);
                    }
                    break;

                case Ms.HYPERSPACE_FURY:
                    if (aer.Pokemon.Form.Species.Number == Ps.HOOPA)
                    {
                        return(true);
                    }
                    break;

                default:
                    if (!atk.Move.HardToUseContinuously || ContinuousUse(atk))
                    {
                        return(true);
                    }
                    break;
                }
            }
FAIL:
            atk.FailAll();
            return(false);
        }
コード例 #2
0
ファイル: SearchPositionQuery.cs プロジェクト: BionStt/NHCM
        public async Task <List <SearchedPosition> > Handle(SearchPositionQuery request, CancellationToken cancellationToken)
        {
            List <SearchedPosition>    result       = new List <SearchedPosition>();
            List <SearchedOrgPosition> OrgPositions = await _mediator.Send(new SearchOrgPositionQuery()
            {
            }).ConfigureAwait(false);

            if (request.Id != null)
            {
                result = await(from p in _context.Position
                               join w in _context.WorkArea on p.WorkingAreaId equals w.Id into pw
                               from rpw in pw.DefaultIfEmpty()
                               join OP in OrgPositions on p.PositionTypeId equals OP.Id into OPs
                               from rops in OPs.DefaultIfEmpty()
                               join ST in _context.SalaryType on p.SalaryTypeId equals ST.Id into STs
                               from str in STs.DefaultIfEmpty()
                               join L in _context.Location on p.LocationId equals L.Id into Ls
                               from Lr in Ls.DefaultIfEmpty()
                               join PT in _context.PlanType on p.PlanTypeId equals PT.Id into PTs
                               from PTr in PTs.DefaultIfEmpty()
                               where p.Id == request.Id
                               select new SearchedPosition
                {
                    Id               = p.Id,
                    ParentId         = p.ParentId,
                    NodeId           = Convert.ToInt32(p.Id),
                    ParentNodeId     = Convert.ToInt32(p.ParentId),
                    WorkingAreaId    = p.WorkingAreaId,
                    Code             = p.Code,
                    PositionTypeId   = p.PositionTypeId,
                    LocationId       = p.LocationId,
                    SalaryTypeId     = p.SalaryTypeId,
                    Sorter           = p.Sorter,
                    OrganoGramId     = p.OrganoGramId,
                    PlanTypeId       = p.PlanTypeId,
                    WorkAreaText     = rpw.Title,
                    RankText         = rops.RankText,
                    PositionTypeText = rops.PositionTypeText,
                    OrgUnitText      = rops.OrgUnitText,
                    SalaryTypeText   = str.Dari,
                    LocationText     = Lr.Dari,
                    PlanTypeText     = PTr.Name,
                }).OrderBy(c => c.Sorter).DefaultIfEmpty().ToListAsync(cancellationToken);
            }
            //if (request.ParentId != null)
            //{
            //    result = await (from p in _context.Position
            //                    join w in _context.WorkArea on p.WorkingAreaId equals w.Id into pw
            //                    from rpw in pw.DefaultIfEmpty()
            //                    join OP in OrgPositions on p.PositionTypeId equals OP.Id into OPs
            //                    from rops in OPs.DefaultIfEmpty()
            //                    join ST in _context.SalaryType on p.SalaryTypeId equals ST.Id into STs
            //                    from str in STs.DefaultIfEmpty()
            //                    join L in _context.Location on p.LocationId equals L.Id into Ls
            //                    from Lr in Ls.DefaultIfEmpty()
            //                    join PT in _context.PlanType on p.PlanTypeId equals PT.Id into PTs
            //                    from PTr in PTs.DefaultIfEmpty()
            //                    where p.ParentId == request.ParentId
            //                    select new SearchedPosition
            //                    {
            //                        Id = p.Id,
            //                        ParentId = p.ParentId,
            //                        NodeId = Convert.ToInt32(p.Id),
            //                        ParentNodeId = Convert.ToInt32(p.ParentId),
            //                        WorkingAreaId = p.WorkingAreaId,
            //                        Code = p.Code,
            //                        PositionTypeId = p.PositionTypeId,
            //                        LocationId = p.LocationId,
            //                        SalaryTypeId = p.SalaryTypeId,
            //                        Sorter = p.Sorter,
            //                        OrganoGramId = p.OrganoGramId,
            //                        PlanTypeId = p.PlanTypeId,
            //                        WorkAreaText = rpw.Title,
            //                        RankText = rops.RankText,
            //                        PositionTypeText = rops.PositionTypeText,
            //                        OrgUnitText = rops.OrgUnitText,
            //                        SalaryTypeText = str.Dari,
            //                        LocationText = Lr.Dari,
            //                        PlanTypeText = PTr.Name,
            //                    }).OrderBy(c => c.Sorter).DefaultIfEmpty().ToListAsync(cancellationToken);
            //}

            else if (request.OrganoGramId != null)
            {
                result = await(from position in _context.Position
                               join w in _context.WorkArea on position.WorkingAreaId equals w.Id into pw
                               from rpw in pw.DefaultIfEmpty()
                               join OP in OrgPositions on position.PositionTypeId equals OP.Id into OPs
                               from rops in OPs.DefaultIfEmpty()
                               join ST in _context.SalaryType on position.SalaryTypeId equals ST.Id into STs
                               from str in STs.DefaultIfEmpty()
                               join L in _context.Location on position.LocationId equals L.Id into Ls
                               from Lr in Ls.DefaultIfEmpty()
                               join PT in _context.PlanType on position.PlanTypeId equals PT.Id into PTs
                               from PTr in PTs.DefaultIfEmpty()
                               where position.OrganoGramId == request.OrganoGramId
                               select new SearchedPosition
                {
                    Id               = position.Id,
                    ParentId         = position.ParentId,
                    NodeId           = Convert.ToInt32(position.Id),
                    ParentNodeId     = Convert.ToInt32(position.ParentId),
                    WorkingAreaId    = position.WorkingAreaId,
                    Code             = position.Code,
                    PositionTypeId   = position.PositionTypeId,
                    LocationId       = position.LocationId,
                    SalaryTypeId     = position.SalaryTypeId,
                    Sorter           = position.Sorter,
                    OrganoGramId     = position.OrganoGramId,
                    PlanTypeId       = position.PlanTypeId,
                    WorkAreaText     = rpw.Title,
                    RankText         = rops.RankText,
                    PositionTypeText = rops.PositionTypeText,
                    OrgUnitText      = rops.OrgUnitText,
                    SalaryTypeText   = str.Dari,
                    LocationText     = Lr.Dari,
                    PlanTypeText     = PTr.Name,
                }).OrderBy(c => c.Sorter).ToListAsync(cancellationToken);
            }
            return(result);
        }