示例#1
0
        //22.0 Gravity ends
        //23.0 Trick Room ends
        //24.0 Wonder Room ends
        //25.0 Magic Room ends
        private static void BoardCondition(Controller c)
        {
            var board = c.Board;
            int turn  = c.TurnNumber;

            if (board.GetCondition <int>(Cs.Gravity) == turn)
            {
                board.RemoveCondition(Cs.Gravity);
                c.ReportBuilder.ShowLog("DeGravity");
            }
            if (board.GetCondition <int>(Cs.TrickRoom) == turn)
            {
                board.RemoveCondition(Cs.TrickRoom);
                c.ReportBuilder.ShowLog("DeTrickRoom");
            }
            if (board.GetCondition <int>(Cs.WonderRoom) == turn)
            {
                foreach (var pm in c.OnboardPokemons)
                {
                    var stats = pm.OnboardPokemon.FiveD;
                    var d     = stats.Def;
                    stats.Def   = stats.SpDef;
                    stats.SpDef = d;
                }
                board.RemoveCondition(Cs.WonderRoom);
                c.ReportBuilder.ShowLog("DeWonderRoom");
            }
            if (board.GetCondition <int>(Cs.MagicRoom) == turn)
            {
                board.RemoveCondition(Cs.MagicRoom);
                c.ReportBuilder.ShowLog("DeMagicRoom");
                foreach (var pm in c.OnboardPokemons)
                {
                    ITs.Attach(pm);
                }
            }
            if (board.GetCondition <int>(Cs.WaterSport) == turn)
            {
                board.RemoveCondition(Cs.WaterSport);
                c.ReportBuilder.ShowLog("DeWaterSport");
            }
            if (board.GetCondition <int>(Cs.MudSport) == turn)
            {
                board.RemoveCondition(Cs.MudSport);
                c.ReportBuilder.ShowLog("DeMudSport");
            }
            var t = board.GetCondition <int>(Cs.GrassyTerrain);

            if (t == turn)
            {
                board.RemoveCondition(Cs.GrassyTerrain);
                c.ReportBuilder.ShowLog("DeGrassyTerrain");
            }
            else if (t == 0)
            {
                t = board.GetCondition <int>(Cs.ElectricTerrain);
                if (t == turn)
                {
                    board.RemoveCondition(Cs.ElectricTerrain);
                    c.ReportBuilder.ShowLog("DeElectricTerrain");
                }
                else if (t == 0 && board.GetCondition <int>(Cs.MistyTerrain) == turn)
                {
                    board.RemoveCondition(Cs.MistyTerrain);
                    c.ReportBuilder.ShowLog("DeMistyTerrain");
                }
                else if (t == 0 && board.GetCondition <int>(Cs.PsychicTerrain) == turn)
                {
                    board.RemoveCondition(Cs.PsychicTerrain);
                    c.ReportBuilder.ShowLog("DePsychicTerrain");
                }
            }
        }
示例#2
0
        //26.0 Uproar message
        //26.1 Speed Boost, Bad Dreams, Harvest, Moody
        //26.2 Toxic Orb activation, Flame Orb activation, Sticky Barb
        //26.3 pickup
        private static void Pokemon(Controller c)
        {
            foreach (var pm in c.OnboardPokemons.ToArray())
            {
                int ab = pm.Ability;
                if (pm.AtkContext != null && pm.AtkContext.Move.Id == Ms.UPROAR)
                {
                    if (pm.Action == PokemonAction.Moving)
                    {
                        pm.ShowLogPm("Uproar");
                    }
                    else if (pm.AtkContext.GetCondition(Cs.MultiTurn).Turn == 0)
                    {
                        pm.AtkContext.RemoveCondition(Cs.MultiTurn);
                        pm.ShowLogPm("DeUproar");
                    }
                }
                switch (ab)
                {
                case As.SPEED_BOOST:
                    if (pm.LastMoveTurn != 0)
                    {
                        pm.ChangeLv7D(pm, StatType.Speed, 1, false, true);
                    }
                    break;

                case As.BAD_DREAMS:
                {
                    bool first = true;
                    foreach (var target in c.Board[1 - pm.Pokemon.TeamId].Pokemons)
                    {
                        if (target.State == PokemonState.SLP)
                        {
                            if (first)
                            {
                                pm.RaiseAbility();
                                first = false;
                            }
                            target.EffectHurtByOneNth(8, Ls.BadDreams);
                        }
                    }
                }
                break;

                case As.HARVEST:
                    if (pm.Pokemon.Item == 0 && pm.Pokemon.UsedBerry != 0 && (c.Weather == Game.Weather.IntenseSunlight || c.RandomHappen(50)))
                    {
                        pm.RaiseAbility();
                        pm.SetItem(pm.Pokemon.UsedBerry);
                        pm.ShowLogPm("Harvest", pm.Pokemon.UsedBerry);
                        ITs.Attach(pm);
                    }
                    break;

                case As.MOODY:
                {
                    var up   = new List <StatType>(7);
                    var down = new List <StatType>(7);
                    foreach (var s in GameHelper.SEVEN_D)
                    {
                        if (pm.CanChangeLv7D(pm, s, 2, false) != 0)
                        {
                            up.Add(s);
                        }
                        if (pm.CanChangeLv7D(pm, s, -1, false) != 0)
                        {
                            down.Add(s);
                        }
                    }
                    if (up.Count != 0 && down.Count != 0)
                    {
                        pm.RaiseAbility();
                        if (up.Count != 0)
                        {
                            pm.ChangeLv7D(pm, up[c.GetRandomInt(0, up.Count - 1)], 2, false);
                        }
                        if (down.Count != 0)
                        {
                            pm.ChangeLv7D(pm, down[c.GetRandomInt(0, down.Count - 1)], -1, false);
                        }
                    }
                }
                break;
                }
                switch (pm.Item)
                {
                case Is.TOXIC_ORB:
                    pm.AddState(pm, AttachedState.PSN, false, 15, "ItemEnBadlyPSN", Is.TOXIC_ORB);
                    break;

                case Is.FLAME_ORB:
                    pm.AddState(pm, AttachedState.BRN, false, 0, "ItemEnBRN", Is.FLAME_ORB);
                    break;

                case Is.STICKY_BARB:
                    pm.EffectHurtByOneNth(8, Ls.ItemHurt, Is.STICKY_BARB);
                    break;
                }
                if (ab == As.PICKUP && pm.Pokemon.Item == 0)
                {
                    var items  = new List <int>();
                    var owners = new List <OnboardPokemon>();
                    foreach (var p in c.Board[1 - pm.Pokemon.TeamId].GetAdjacentPokemonsByOppositeX(pm.OnboardPokemon.X))
                    {
                        var i = p.OnboardPokemon.GetCondition <int>(Cs.UsedItem);
                        if (i != 0)
                        {
                            items.Add(i);
                            owners.Add(p.OnboardPokemon);
                        }
                    }
                    if (!items.Any())
                    {
                        foreach (var p in pm.Field.GetAdjacentPokemonsByX(pm.OnboardPokemon.X))
                        {
                            if (p != pm)
                            {
                                var i = p.OnboardPokemon.GetCondition <int>(Cs.UsedItem);
                                if (i != 0)
                                {
                                    items.Add(i);
                                    owners.Add(p.OnboardPokemon);
                                }
                            }
                        }
                    }
                    if (items.Any())
                    {
                        var i = c.GetRandomInt(0, items.Count - 1);
                        owners[i].RemoveCondition(Cs.UsedItem);
                        pm.RaiseAbility();
                        pm.SetItem(items[i]);
                        pm.ShowLogPm("Pickup", items[i]);
                        ITs.Attach(pm);
                    }
                }
                pm.CheckFaint();
            }
        }
示例#3
0
 //12.0 Taunt ends
 //13.0 Encore ends
 //14.0 Disable ends, Cursed Body ends
 //15.0 Magnet Rise ends
 //16.0 Telekinesis ends
 //17.0 Heal Block ends
 //18.0 Embargo ends
 //19.0 Yawn
 //20.0 Perish Song
 private static void PokemonCondition(Controller c)
 {
     foreach (var pm in c.OnboardPokemons)
     {
         int turn = pm.OnboardPokemon.GetCondition(Cs.Taunt, -1);
         if (turn == 0)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Taunt);
             pm.ShowLogPm("DeTaunt");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         var o = pm.OnboardPokemon.GetCondition(Cs.Encore);
         if (o != null && o.Turn == 0)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Encore);
             pm.ShowLogPm("DeEncore");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         var o = pm.OnboardPokemon.GetCondition(Cs.Disable);
         if (o != null && o.Turn == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Disable);
             pm.ShowLogPm("DeDisable");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         if (pm.OnboardPokemon.GetCondition <int>(Cs.MagnetRise) == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.MagnetRise);
             pm.ShowLogPm("DeMagnetRise");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         if (pm.OnboardPokemon.GetCondition <int>(Cs.Telekinesis) == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Telekinesis);
             pm.ShowLogPm("DeTelekinesis");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         var o = pm.OnboardPokemon.GetCondition(Cs.HealBlock);
         if (o != null && o.Turn == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.HealBlock);
             pm.ShowLogPm("DeHealBlock");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         var o = pm.OnboardPokemon.GetCondition(Cs.SoundBlock);
         if (o != null && o.Turn == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.SoundBlock);
             pm.ShowLogPm("DeSoundBlock");
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         if (pm.OnboardPokemon.GetCondition <int>(Cs.Embargo) == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Embargo);
             pm.ShowLogPm("DeEmbargo");
             ITs.Attach(pm);
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         if (pm.OnboardPokemon.GetCondition <int>(Cs.Charge) == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Charge);
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         if (pm.OnboardPokemon.GetCondition <int>(Cs.Laser_Focus) == c.TurnNumber)
         {
             pm.OnboardPokemon.RemoveCondition(Cs.Laser_Focus);
         }
     }
     foreach (var pm in c.OnboardPokemons)
     {
         var o = pm.OnboardPokemon.GetCondition(Cs.Yawn);
         if (o != null && o.Turn == c.TurnNumber)
         {
             pm.AddState(o.By, AttachedState.SLP, false);
             pm.OnboardPokemon.RemoveCondition(Cs.Yawn);
         }
     }
     foreach (var pm in c.OnboardPokemons.ToArray())
     {
         int turn = pm.OnboardPokemon.GetCondition <int>(Cs.PerishSong, -1);
         if (turn != -1)
         {
             pm.ShowLogPm("PerishSong", turn);
             if (turn == 0)
             {
                 pm.Faint();
             }
             else
             {
                 pm.OnboardPokemon.SetCondition(Cs.PerishSong, turn - 1);
             }
         }
     }
 }