示例#1
0
        private static Modifier AttackerItem(AtkContext atk)
        {
            if (atk.HasCondition(Cs.Gem))
            {
                return(0x1800);
            }
            switch (atk.Attacker.Item)
            {
            case Is.GRISEOUS_ORB:
                return(Orb(atk, 487, BattleType.Ghost));

            case Is.ADAMANT_ORB:
                return(Orb(atk, 483, BattleType.Steel));

            case Is.LUSTROUS_ORB:
                return(Orb(atk, 484, BattleType.Water));

            case Is.SILVERPOWDER:
            case Is.INSECT_PLATE:
                return(TypeItem(atk, BattleType.Bug));

            case Is.METAL_COAT:
            case Is.IRON_PLATE:
                return(TypeItem(atk, BattleType.Steel));

            case Is.SOFT_SAND:
            case Is.EARTH_PLATE:
                return(TypeItem(atk, BattleType.Ground));

            case Is.HARD_STONE:
            case Is.STONE_PLATE:
            case Is.ROCK_INCENSE:
                return(TypeItem(atk, BattleType.Rock));

            case Is.MIRACLE_SEED:
            case Is.MEADOW_PLATE:
            case Is.ROSE_INCENSE:
                return(TypeItem(atk, BattleType.Grass));

            case Is.BLACKGLASSES:
            case Is.DREAD_PLATE:
                return(TypeItem(atk, BattleType.Dark));

            case Is.BLACK_BELT:
            case Is.FIST_PLATE:
                return(TypeItem(atk, BattleType.Fighting));

            case Is.MAGNET:
            case Is.ZAP_PLATE:
                return(TypeItem(atk, BattleType.Electric));

            case Is.MYSTIC_WATER:
            case Is.SPLASH_PLATE:
            case Is.WAVE_INCENSE:
            case Is.SEA_INCENSE:
                return(TypeItem(atk, BattleType.Water));

            case Is.SHARP_BEAK:
            case Is.SKY_PLATE:
                return(TypeItem(atk, BattleType.Flying));

            case Is.POISON_BARB:
            case Is.TOXIC_PLATE:
                return(TypeItem(atk, BattleType.Poison));

            case Is.NEVERMELTICE:
            case Is.ICICLE_PLATE:
                return(TypeItem(atk, BattleType.Ice));

            case Is.SPELL_TAG:
            case Is.SPOOKY_PLATE:
                return(TypeItem(atk, BattleType.Ghost));

            case Is.TWISTEDSPOON:
            case Is.MIND_PLATE:
            case Is.ODD_INCENSE:
                return(TypeItem(atk, BattleType.Psychic));

            case Is.CHARCOAL:
            case Is.FLAME_PLATE:
                return(TypeItem(atk, BattleType.Fire));

            case Is.DRAGON_FANG:
            case Is.DRACO_PLATE:
                return(TypeItem(atk, BattleType.Dragon));

            case Is.PIXIE_PLATE:
                return(TypeItem(atk, BattleType.Fairy));

            case Is.SILK_SCARF:
                return(TypeItem(atk, BattleType.Normal));

            case Is.MUSCLE_BAND:
                return(Category(atk, MoveCategory.Physical));

            case Is.WISE_GLASSES:
                return(Category(atk, MoveCategory.Special));

            default:
                return(0x1000);
            }
        }
示例#2
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);
            }
        }