Beispiel #1
0
        private static bool Confuse(PokemonProxy pm)
        {
            int count = pm.OnboardPokemon.GetCondition <int>(Cs.Confuse);

            if (count != 0)
            {
                if (--count > 0)
                {
                    pm.ShowLogPm("Confuse");
                    pm.OnboardPokemon.SetCondition(Cs.Confuse, count);
                    if (pm.Controller.OneNth(3))
                    {
                        pm.ShowLogPm(Ls.ConfuseWork);
                        var e = new GameEvents.ShowHp()
                        {
                            Pm = pm.Id
                        };
                        pm.Controller.ReportBuilder.Add(e);
                        pm.MoveHurt((pm.Pokemon.Lv * 2 / 5 + 2) * 40 * OnboardPokemon.Get5D(pm.OnboardPokemon.FiveD.Atk, pm.OnboardPokemon.Lv5D.Atk) / OnboardPokemon.Get5D(pm.OnboardPokemon.FiveD.Def, pm.OnboardPokemon.Lv5D.Def) / 50 + 2, true);
                        e.Hp = pm.Hp;
                        pm.CheckFaint();
                        //if (!pm.CheckFaint()) pm.Item.HpChanged(pm); //◇硝子玩偶◇ 22:21:00 你知道混乱打自己的时候不触发加HP的果子么
                        return(false);
                    }
                }
                else
                {
                    pm.OnboardPokemon.RemoveCondition(Cs.Confuse);
                    pm.ShowLogPm("DeConfuse");
                }
            }
            return(true);
        }
Beispiel #2
0
        private static bool Attract(PokemonProxy p)
        {
            var pm = p.OnboardPokemon.GetCondition <PokemonProxy>(Cs.Attract);

            if (pm != null)
            {
                p.ShowLogPm("Attract", pm.Id);
                if (p.Controller.RandomHappen(50))
                {
                    p.ShowLogPm("AttractWork");
                    return(false);
                }
            }
            return(true);
        }
 public static bool CanExecuteMove(PokemonProxy pm, MoveTypeE move)
 {
     //重力
     if (move.UnavailableWithGravity && pm.Controller.Board.HasCondition(Cs.Gravity))
     {
         pm.ShowLogPm("GravityCantUseMove", move.Id);
         return(false);
     }
     //回复封印
     if (move.Heal && pm.OnboardPokemon.HasCondition(Cs.HealBlock))
     {
         pm.ShowLogPm("HealBlockCantUseMove", move.Id);
         return(false);
     }
     return(true);
 }
Beispiel #4
0
 private static bool MentalHerb(PokemonProxy pm, Cs condition)
 {
     if (pm.OnboardPokemon.RemoveCondition(condition))
     {
         pm.ShowLogPm("De" + condition);
         return(true);
     }
     return(false);
 }
Beispiel #5
0
 private static bool Paralyzed(PokemonProxy p)
 {
     if (p.State == PokemonState.PAR && p.Controller.OneNth(4))
     {
         p.ShowLogPm("PARWork");
         return(false);
     }
     return(true);
 }
Beispiel #6
0
 private static bool Gravity(PokemonProxy p)
 {
     if (p.SelectedMove.MoveE.UnavailableWithGravity && p.Controller.Board.HasCondition(Cs.Gravity))
     {
         p.ShowLogPm("GravityCantUseMove", p.SelectedMove.MoveE.Id);
         return(false);
     }
     return(true);
 }
Beispiel #7
0
 private static bool Taunt(PokemonProxy p)
 {
     if (p.SelectedMove.MoveE.Move.Category == MoveCategory.Status && p.OnboardPokemon.HasCondition(Cs.Taunt))
     {
         p.ShowLogPm("Taunt", p.SelectedMove.MoveE.Id);
         return(false);
     }
     return(true);
 }
Beispiel #8
0
 private static bool SoundBlock(PokemonProxy pm)
 {
     if (pm.SelectedMove.MoveE.Sound && pm.OnboardPokemon.HasCondition(Cs.SoundBlock))
     {
         pm.ShowLogPm("SoundBlockCantUseMove", pm.SelectedMove.MoveE.Move.Id);
         return(false);
     }
     return(true);
 }
Beispiel #9
0
 private static bool FocusPunch(PokemonProxy p)
 {
     if (p.SelectedMove.MoveE.Id == Ms.FOCUS_PUNCH && p.OnboardPokemon.HasCondition(Cs.Damage))
     {
         p.ShowLogPm("DeFocusPunch");
         return(false);
     }
     return(true);
 }
Beispiel #10
0
        private static bool Disable(PokemonProxy p)
        {
            var c = p.OnboardPokemon.GetCondition(Cs.Disable);

            if (c != null && p.SelectedMove.MoveE == c.Move)
            {
                p.ShowLogPm("Disable", p.SelectedMove.MoveE.Id);
                return(false);
            }
            return(true);
        }
Beispiel #11
0
 private static bool CantLvDown(PokemonProxy pm, PokemonProxy by, StatType stat, int change, bool showFail, StatType s0)
 {
     if (stat == s0)
     {
         if (showFail)
         {
             pm.RaiseAbility();
             pm.ShowLogPm("7DLock", (int)stat);
         }
         return(true);
     }
     return(false);
 }
Beispiel #12
0
 private static bool Flinch(PokemonProxy pm)
 {
     if (pm.OnboardPokemon.HasCondition(Cs.Flinch))
     {
         pm.ShowLogPm("Flinch");
         if (pm.RaiseAbility(As.STEADFAST))
         {
             pm.ChangeLv7D(pm, StatType.Speed, 1, false);
         }
         return(false);
     }
     return(true);
 }
Beispiel #13
0
        private static void MentalHerb(PokemonProxy pm)
        {
            var a = pm.OnboardPokemon.RemoveCondition(Cs.Attract);

            if (a)
            {
                pm.ShowLogPm("ItemDeAttract", pm.Pokemon.Item);
            }
            if (a | MentalHerb(pm, Cs.Encore) | MentalHerb(pm, Cs.Taunt) | MentalHerb(pm, Cs.Torment) | MentalHerb(pm, Cs.Disable))
            {
                pm.ConsumeItem();
            }
        }
 public static bool Remaining1HP(PokemonProxy pm, bool ability)
 {
     if (pm.OnboardPokemon.HasCondition(Cs.Endure))
     {
         pm.ShowLogPm("Endure");
         return(true);
     }
     if (ability && pm.Hp == pm.Pokemon.MaxHp && pm.RaiseAbility(As.STURDY))
     {
         pm.ShowLogPm("Endure");
         return(true);
     }
     if (pm.ItemE(Is.FOCUS_BAND) && pm.Controller.OneNth(10) || pm.ItemE(Is.FOCUS_SASH) && pm.Hp == pm.Pokemon.MaxHp)
     {
         pm.ShowLogPm("FocusItem", pm.Pokemon.Item);
         if (pm.Pokemon.Item == Is.FOCUS_SASH)
         {
             pm.ConsumeItem();
         }
         return(true);
     }
     return(false);
 }
Beispiel #15
0
 private static bool Truant(PokemonProxy p)
 {
     if (p.AbilityE(As.TRUANT))
     {
         if (p.OnboardPokemon.GetCondition <int>(Cs.Truant) == p.Controller.TurnNumber)
         {
             p.RaiseAbility();
             p.ShowLogPm("Truant");
             return(false);
         }
         p.OnboardPokemon.SetCondition(Cs.Truant, p.Controller.TurnNumber + 1);
     }
     return(true);
 }
Beispiel #16
0
        public static void Execute(PokemonProxy pm)
        {
            switch (pm.Item)
            {
            case Is.MENTAL_HERB:
                MentalHerb(pm);
                break;

            case Is.CHERI_BERRY:
                DeStateBerry(pm, PokemonState.PAR);
                break;

            case Is.CHESTO_BERRY:
                DeStateBerry(pm, PokemonState.SLP);
                break;

            case Is.RAWST_BERRY:
                DeStateBerry(pm, PokemonState.BRN);
                break;

            case Is.ASPEAR_BERRY:
                DeStateBerry(pm, PokemonState.FRZ);
                break;

            case Is.PECHA_BERRY:
                if (pm.State == PokemonState.PSN || pm.State == PokemonState.BadlyPSN)
                {
                    var s = pm.State.ToString();
                    pm.DeAbnormalState("ItemDePSN", Is.PECHA_BERRY);
                    pm.ConsumeItem();
                }
                break;

            case Is.PERSIM_BERRY:
                if (pm.OnboardPokemon.RemoveCondition(Cs.Confuse))
                {
                    pm.ShowLogPm("ItemDeConfuse", Is.PERSIM_BERRY);
                    pm.ConsumeItem();
                }
                break;

            case Is.LUM_BERRY:
                if (pm.State != PokemonState.Normal)
                {
                    pm.DeAbnormalState("ItemDe" + pm.State.ToString(), Is.LUM_BERRY);
                    pm.ConsumeItem();
                }
                break;
            }
        }
 private static void Anticipation(PokemonProxy pm)
 {
     foreach (var p in pm.Controller.Board[1 - pm.Pokemon.TeamId].GetAdjacentPokemonsByOppositeX(pm.OnboardPokemon.X))
     {
         foreach (var m in p.Moves)
         {
             if (m.MoveE.Class == MoveClass.OHKO || m.MoveE.Move.Type.EffectRevise(pm.OnboardPokemon.Types) > 0)
             {
                 pm.RaiseAbility();
                 pm.ShowLogPm("Anticipation");
                 return;
             }
         }
     }
 }
Beispiel #18
0
 private static bool Sleeping(PokemonProxy pm)
 {
     if (pm.State == PokemonState.SLP)
     {
         pm.Pokemon.SLPTurn -= pm.AbilityE(As.EARLY_BIRD) ? 2 : 1;
         if (pm.Pokemon.SLPTurn <= 0 && !pm.AbilityE(As.Comatose))
         {
             pm.DeAbnormalState();
         }
         else
         {
             pm.ShowLogPm("SLP");
             return(pm.SelectedMove.MoveE.AvailableEvenSleeping || pm.AbilityE(As.Comatose));
         }
     }
     return(true);
 }
Beispiel #19
0
 private static bool Shell_Trap(PokemonProxy p)
 {
     if (p.SelectedMove.MoveE.Id == Ms.Shell_Trap)
     {
         if (p.OnboardPokemon.HasCondition(Cs.PhysicalDamage))
         {
             return(true);
         }
         else
         {
             p.ShowLogPm("DeShell_Trap");
             return(false);
         }
     }
     else
     {
         return(true);
     }
 }
Beispiel #20
0
        private static bool Imprison(PokemonProxy p)
        {
            var move = p.SelectedMove.MoveE;

            foreach (PokemonProxy pm in p.Controller.Board[1 - p.Pokemon.TeamId].GetAdjacentPokemonsByOppositeX(p.OnboardPokemon.X))
            {
                if (pm.OnboardPokemon.HasCondition(Cs.Imprison))
                {
                    foreach (MoveProxy m in pm.Moves)
                    {
                        if (m.MoveE == move)
                        {
                            p.ShowLogPm("Imprison", move.Id);
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Beispiel #21
0
 private static bool Frozen(PokemonProxy p)
 {
     if (p.State == PokemonState.FRZ)
     {
         if (p.SelectedMove.MoveE.SelfDeFrozen)
         {
             p.DeAbnormalState("DeFRZ2", p.SelectedMove.MoveE.Id);
         }
         else if (p.Controller.GetRandomInt(0, 3) == 0)
         {
             p.DeAbnormalState();
         }
         else
         {
             p.ShowLogPm("FRZ");
             return(false);
         }
     }
     return(true);
 }
        private static void Frisk(PokemonProxy pm)
        {
            var pms   = pm.Controller.GetOnboardPokemons(1 - pm.Pokemon.TeamId);
            var items = new List <int>();

            foreach (var p in pms)
            {
                if (p.Pokemon.Item != 0)
                {
                    items.Add(p.Pokemon.Item);
                }
            }
            if (items.Count == 0)
            {
                return;
            }
            int i = pm.Controller.GetRandomInt(0, items.Count - 1);

            pm.RaiseAbility();
            pm.ShowLogPm("Frisk", items[i]);
        }
        private static void Debut(Condition hazard, PokemonProxy pm)
        {
            switch (hazard.Move.Id)
            {
            case Ms.SPIKES:
                if (HasEffect.IsGroundAffectable(pm, true, false))
                {
                    pm.EffectHurtByOneNth(hazard.Int, Ls.Spikes);
                }
                break;

            case Ms.TOXIC_SPIKES:
                if (HasEffect.IsGroundAffectable(pm, true, false))
                {
                    if (pm.OnboardPokemon.HasType(BattleType.Poison))
                    {
                        De(pm.Controller.ReportBuilder, pm.Field, hazard.Move);
                    }
                    else if (pm.CanAddState(pm, AttachedState.PSN, false))
                    {
                        pm.AddState(pm, AttachedState.PSN, false, hazard.Bool ? 15 : 0);
                    }
                }
                break;

            case Ms.STEALTH_ROCK:
                int revise = BattleType.Rock.EffectRevise(pm.OnboardPokemon.Types);    //羽栖有效无效都无所谓
                int hp     = (revise > 0 ? pm.Pokemon.MaxHp << revise : pm.Pokemon.MaxHp >> -revise) >> 3;
                pm.EffectHurt(hp, Ls.StealthRock);
                break;

            case Ms.STICKY_WEB:
                if (HasEffect.IsGroundAffectable(pm, true, false))
                {
                    pm.ShowLogPm("StickyWeb");
                    pm.ChangeLv7D(null, StatType.Speed, -1, false, false);
                }
                break;
            }
        }
Beispiel #24
0
        public static int Execute(PokemonProxy pm, PokemonProxy by, StatType stat, int change, bool showFail)
        {
            var a = pm.Ability;

            if (change < 0 && by != pm)
            {
                if (pm.Field.HasCondition(Cs.Mist)) //根据百科非技能似乎不该发动,但排除了一下这样写肯定是对的
                {
                    if (showFail)
                    {
                        pm.ShowLogPm("Mist");
                    }
                    return(0);
                }
                if (by == null || pm.Pokemon.TeamId != by.Pokemon.TeamId)
                {
                    switch (a)
                    {
                    case As.CLEAR_BODY:
                    case As.WHITE_SMOKE:
                    case As.Full_Metal_Body:
                        if (showFail)
                        {
                            pm.RaiseAbility();
                            pm.ShowLogPm("7DLockAll");
                        }
                        return(0);

                    case As.KEEN_EYE:
                        if (CantLvDown(pm, by, stat, change, showFail, StatType.Accuracy))
                        {
                            return(0);
                        }
                        break;

                    case As.HYPER_CUTTER:
                        if (CantLvDown(pm, by, stat, change, showFail, StatType.Atk))
                        {
                            return(0);
                        }
                        break;

                    case As.BIG_PECKS:
                        if (CantLvDown(pm, by, stat, change, showFail, StatType.Def))
                        {
                            return(0);
                        }
                        break;
                    }
                }
                if (pm.OnboardPokemon.HasType(BattleType.Grass))
                {
                    foreach (var p in pm.Field.Pokemons)
                    {
                        if (p.AbilityE(As.FLOWER_VEIL))
                        {
                            if (showFail)
                            {
                                p.RaiseAbility();
                                pm.ShowLogPm("7DLock", (int)stat);
                            }
                            return(0);
                        }
                    }
                }
            }

            switch (a)
            {
            case As.SIMPLE: //86
                change <<= 1;
                break;

            case As.CONTRARY: //126
                change = 0 - change;
                break;
            }

            return(change);
        }
Beispiel #25
0
        public static void Execute(PokemonProxy pm)
        {
            switch (pm.Item)
            {
            case Is.ORAN_BERRY:     //135
                RecoverBerry(pm, 10);
                break;

            case Is.BERRY_JUICE:     //194
                RecoverBerry(pm, 20);
                break;

            case Is.SITRUS_BERRY:     //138
                if (pm.Hp << 1 < pm.Pokemon.MaxHp)
                {
                    pm.HpRecoverByOneNth(4, false, Ls.ItemHpRecover, Is.SITRUS_BERRY, true);
                }
                break;

            case Is.FIGY_BERRY:     //139
            case Is.WIKI_BERRY:     //140
            case Is.MAGO_BERRY:     //141
            case Is.AGUAV_BERRY:    //142
            case Is.IAPAPA_BERRY:   //143
                TastyBerry(pm);
                break;

            case Is.LIECHI_BERRY:     //181
                Up1Berry(pm, StatType.Atk);
                break;

            case Is.GANLON_BERRY:
                Up1Berry(pm, StatType.Def);
                break;

            case Is.SALAC_BERRY:
                Up1Berry(pm, StatType.Speed);
                break;

            case Is.PETAYA_BERRY:
                Up1Berry(pm, StatType.SpAtk);
                break;

            case Is.APICOT_BERRY:     //185
                Up1Berry(pm, StatType.SpDef);
                break;

            case Is.LANSAT_BERRY:     //186
                if (ATs.Gluttony(pm) && pm.OnboardPokemon.AddCondition(Cs.FocusEnergy))
                {
                    pm.ConsumeItem();
                    pm.ShowLogPm("ItemEnFocusEnergy", Is.LANSAT_BERRY);
                }
                break;

            case Is.STARF_BERRY:     //187
                StarfBerry(pm);
                break;

            case Is.MICLE_BERRY:     //189
                if (ATs.Gluttony(pm) && pm.OnboardPokemon.AddCondition(Cs.MicleBerry))
                {
                    pm.ConsumeItem();
                    pm.ShowLogPm("MicleBerry", Is.MICLE_BERRY);
                }
                break;
            }
        }
 private static void SimpleAttachRaise(PokemonProxy pm, string log)
 {
     pm.RaiseAbility();
     pm.ShowLogPm(log);
 }
        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;
            }
        }