Esempio n. 1
0
        private static void Generic(AtkContext atk)
        {
            var move = atk.Move;
            var aer  = atk.Attacker;

            if (move.PrepareOneTurn && PrepareOneTurn(atk))
            {
                return;
            }

            if (aer.Controller.GameSettings.Mode.XBound() != 1 && (move.Id == Ms.WATER_PLEDGE || move.Id == Ms.FIRE_PLEDGE || move.Id == Ms.GRASS_PLEDGE))
            {
                if (aer.Field.AddTurnCondition(Cs.Plege, move.Id))
                {
                    foreach (var pm in aer.Controller.ActingPokemons)
                    {
                        if (pm.Pokemon.TeamId == aer.Pokemon.TeamId && pm.SelectedMove != null &&
                            pm.SelectedMove.MoveE.Id != move.Id && (pm.SelectedMove.MoveE.Id == Ms.WATER_PLEDGE || pm.SelectedMove.MoveE.Id == Ms.FIRE_PLEDGE || pm.SelectedMove.MoveE.Id == Ms.GRASS_PLEDGE) &&
                            pm.CanMove)
                        {
                            aer.ShowLogPm(Ls.Pledge, pm.Id);
                            aer.Controller.Board.SetTurnCondition(Cs.NextActingPokemon, pm);
                            return;
                        }
                    }
                }
            }

            if (move.Snatchable)
            {
                foreach (var pm in atk.Controller.OnboardPokemons)
                {
                    if (pm.OnboardPokemon.HasCondition(Cs.Snatch))
                    {
                        pm.OnboardPokemon.RemoveCondition(Cs.Snatch);
                        pm.ShowLogPm("Snatch", aer.Id);
                        var s = new AtkContext(pm)
                        {
                            Move = move
                        };
                        InitAtkContext.Execute(s);
                        MoveE.BuildDefContext(s, null);
                        if (MoveNotFail.Execute(s))
                        {
                            MoveAct.Execute(s);
                        }
                        else
                        {
                            s.FailAll();
                        }
                        atk.SetAttackerAction(PokemonAction.Done);
                        return;
                    }
                }
            }

            if (move.MagicCoat && atk.Targets == null && !atk.HasCondition(Cs.IgnoreMagicCoat))
            {
                foreach (var p in aer.Controller.GetOnboardPokemons(1 - aer.Pokemon.TeamId))
                {
                    if (STs.MagicCoat(atk, p))
                    {
                        atk.SetCondition(Cs.MagicCoat, new List <PokemonProxy>()
                        {
                            p
                        });
                        atk.FailAll(null);
                        MoveE.MagicCoat(atk);
                        return;
                    }
                }
            }

            CalculateType.Execute(atk);

            if (atk.Type == BattleType.Fire && aer.OnboardPokemon.HasCondition(Cs.Powder))
            {
                aer.EffectHurtByOneNth(4, Ls.Powder);
                atk.FailAll(null);
                return;
            }
            if (atk.Move.Move.Category != MoveCategory.Status)
            {
                if (atk.Type == BattleType.Fire && aer.Controller.Board.GetCondition <int>(Cs.SpWeather) == As.PRIMORDIAL_SEA)
                {
                    atk.FailAll(Ls.HeavyRain);
                    return;
                }
                if (atk.Type == BattleType.Water && aer.Controller.Board.GetCondition <int>(Cs.SpWeather) == As.DESOLATE_LAND)
                {
                    atk.FailAll(Ls.HarshSunlight);
                    return;
                }
            }
            if (aer.AbilityE(As.PROTEAN) && aer.OnboardPokemon.SetTypes(atk.Type))
            {
                aer.RaiseAbility();
                aer.ShowLogPm("TypeChange", (int)atk.Type);
            }

            MoveE.FilterDefContext(atk);
            if (atk.Targets != null && atk.Target == null)
            {
                atk.FailAll(null);
            }
            else
            {
                MoveAct.Execute(atk);
                MoveE.MoveEnding(atk);
            }

            if (move.MagicCoat && atk.Targets != null)
            {
                MoveE.MagicCoat(atk);
            }
        }
        public static void Execute(PokemonProxy pm)
        {
            switch (pm.Ability)
            {
            case As.DRIZZLE:     //2
                STs.SetWeather(pm, Weather.Rain, true, false);
                break;

            case As.DROUGHT:
                STs.SetWeather(pm, Weather.IntenseSunlight, true, false);
                break;

            case As.SAND_STREAM:
                STs.SetWeather(pm, Weather.Sandstorm, true, false);
                break;

            case As.SNOW_WARNING:
                STs.SetWeather(pm, Weather.Hailstorm, true, false);
                break;

            case As.PRIMORDIAL_SEA:
                SpWeather(pm, Weather.Rain, Ls.EnHeavyRain);
                break;

            case As.DESOLATE_LAND:
                SpWeather(pm, Weather.IntenseSunlight, Ls.EnHarshSunlight);
                break;

            case As.DELTA_STREAM:
                SpWeather(pm, Weather.Normal, Ls.EnMysteriousAirCurrent);
                break;

            case As.LIMBER:     //7
                CantAddState(pm, PokemonState.PAR);
                break;

            case As.INSOMNIA:     //15
            case As.VITAL_SPIRIT: //72
                CantAddState(pm, PokemonState.SLP);
                break;

            case As.MAGMA_ARMOR:     //40
                CantAddState(pm, PokemonState.FRZ);
                break;

            case As.WATER_VEIL:     //41
                CantAddState(pm, PokemonState.BRN);
                break;

            case As.OBLIVIOUS:     //12
                if (pm.OnboardPokemon.RemoveCondition(Cs.Attract))
                {
                    pm.RaiseAbility();
                    pm.ShowLogPm("DeAttract");
                }
                break;

            case As.IMMUNITY:     //17
                if (pm.State == PokemonState.PSN || pm.State == PokemonState.BadlyPSN)
                {
                    pm.RaiseAbility();
                    pm.DeAbnormalState();
                }
                break;

            case As.OWN_TEMPO:     //20
                if (pm.OnboardPokemon.RemoveCondition(Cs.Confuse))
                {
                    pm.RaiseAbility();
                    pm.ShowLogPm("DeConfuse");
                }
                break;

            case As.IMPOSTER:
                Imposter(pm);
                break;

            case As.FRISK:
                Frisk(pm);
                break;

            case As.FLOWER_GIFT:
                WeatherObserver(pm, 421, pm.Controller.Weather == Weather.IntenseSunlight ? 1 : 0);
                break;

            case As.FORECAST:
            {
                var form = (int)pm.Controller.Weather;
                WeatherObserver(pm, 351, form > 3 ? 0 : form);
            }
            break;

            case As.FOREWARN:
                Forewarn(pm);
                break;

            case As.FLASH_FIRE:
                pm.OnboardPokemon.RemoveCondition(Cs.FlashFire);
                break;

            case As.AIR_LOCK:     //总觉得多个天气锁的可能会有问题,未测
                pm.RaiseAbility();
                pm.Controller.ReportBuilder.ShowLog("AirLock");
                if (pm.Controller.Board.Weather != Weather.Normal)
                {
                    ATs.WeatherChanged(pm.Controller);
                }
                break;

            case As.INTIMIDATE:
                pm.RaiseAbility();
                foreach (var p in pm.Controller.Board[1 - pm.Pokemon.TeamId].GetAdjacentPokemonsByOppositeX(pm.OnboardPokemon.X))
                {
                    if (p.OnboardPokemon.HasCondition(Cs.Substitute))
                    {
                        p.ShowLogPm("NoEffect");
                    }
                    else
                    {
                        p.ChangeLv7D(pm, StatType.Atk, -1, true);
                    }
                }
                break;

            case As.TRACE:
                Trace(pm);
                break;

            case As.PRESSURE:
                SimpleAttachRaise(pm, "Pressure");
                break;

            case As.MOLD_BREAKER:
                SimpleAttachRaise(pm, "MoldBreaker");
                break;

            case As.TURBOBLAZE:
                SimpleAttachRaise(pm, "Turboblaze");
                break;

            case As.TERAVOLT:
                SimpleAttachRaise(pm, "Teravolt");
                break;

            case As.DOWNLOAD:
                Download(pm);
                break;

            case As.ANTICIPATION:
                Anticipation(pm);
                break;

            case As.SLOW_START:
                pm.OnboardPokemon.SetCondition(Cs.SlowStart, pm.Controller.TurnNumber + 5);
                pm.RaiseAbility();
                pm.ShowLogPm("EnSlowStart");
                break;
            }
        }