コード例 #1
0
 public static void StanceChange(PokemonProxy pm)
 {
     if (pm.SelectedMove.MoveE.Id == Ms.KINGS_SHIELD)
     {
         if (pm.CanChangeForm(681, 0) && RaiseAbility(pm, As.STANCE_CHANGE))
         {
             pm.ChangeForm(0, false, "StanceChangeShield");
         }
     }
     else if (pm.SelectedMove.MoveE.Move.Category != MoveCategory.Status && pm.CanChangeForm(681, 1) && RaiseAbility(pm, As.STANCE_CHANGE))
     {
         pm.ChangeForm(1, false, "StanceChangeSword");
     }
 }
コード例 #2
0
 public static void Illusion(PokemonProxy pm)
 {
     if (pm.AbilityE(As.ILLUSION))
     {
         foreach (var p in pm.Pokemon.Owner.Pokemons.Reverse())
         {
             if (p != pm && p.Hp > 0)
             {
                 pm.OnboardPokemon.SetCondition(Cs.Illusion, p.Pokemon);
                 break;
             }
         }
     }
 }
コード例 #3
0
ファイル: PTs.cs プロジェクト: gyyfifafans/PBO
 public static void ChangeForm(this PokemonProxy pm, int form, bool forever = false, string log = "FormChange")
 {
     pm.OnboardPokemon.ChangeForm(pm.OnboardPokemon.Form.Species.GetForm(form));
     if (forever)
     {
         pm.Pokemon.Form = pm.OnboardPokemon.Form;
     }
     pm.Controller.ReportBuilder.ChangeForm(pm, forever);
     if (log != null)
     {
         ShowLogPm(pm, log);
     }
     AbilityAttach.Execute(pm);
 }
コード例 #4
0
ファイル: PTs.cs プロジェクト: gyyfifafans/PBO
 public static void ConsumeItem(this PokemonProxy pm, bool cheekPouch = true)
 {
     pm.OnboardPokemon.SetTurnCondition(Cs.UsedItem, pm.Pokemon.Item);
     pm.Pokemon.UsedItem = pm.Pokemon.Item;
     if (ITs.Berry(pm.Pokemon.Item))
     {
         pm.OnboardPokemon.SetCondition(Cs.Belch);
         pm.Pokemon.UsedBerry = pm.Pokemon.Item;
         if (CanHpRecover(pm) && ATs.RaiseAbility(pm, As.CHEEK_POUCH))
         {
             HpRecoverByOneNth(pm, 3);
         }
     }
     RemoveItem(pm);
 }
コード例 #5
0
 /// <summary>
 /// null log to show default log
 /// </summary>
 /// <param name="by"></param>
 /// <param name="stat"></param>
 /// <param name="change"></param>
 /// <param name="showFail"></param>
 /// <param name="log"></param>
 /// <returns></returns>
 public static bool ChangeLv7D(this PokemonProxy pm, PokemonProxy by, StatType stat, int change, bool showFail, bool ability = false, string log = null)
 {
     change = CanChangeLv7D(pm, by, stat, change, showFail);
     if (change != 0)
     {
         if (ability)
         {
             ATs.RaiseAbility(pm);
         }
         ChangeLv7DImplement(pm, by, stat, change, log);
         ITs.WhiteHerb(pm);
         return(true);
     }
     return(false);
 }
コード例 #6
0
        public void Transform(PokemonProxy pm)
        {
            var o     = pm.GetOutward();
            var moves = new int[pm.Moves.Count()];
            var i     = 0;

            foreach (var m in pm.Moves)
            {
                moves[i++] = m.Move.Type.Id;
            }
            Add(new SetOutward()
            {
                Pm = pm.Id, Number = o.Form.Species.Number, Form = o.Form.Index, Moves = moves
            });
        }
コード例 #7
0
        public static void Trace(PokemonProxy sendout)
        {
            int ab = sendout.OnboardPokemon.Ability;

            if (Trace(ab))
            {
                foreach (var pm in sendout.Controller.Board[1 - sendout.Pokemon.TeamId].GetAdjacentPokemonsByOppositeX(sendout.OnboardPokemon.X))
                {
                    if (pm.RaiseAbility(As.TRACE))
                    {
                        pm.ChangeAbility(sendout.OnboardPokemon.Ability);
                        pm.Controller.ReportBuilder.ShowLog("Trace", sendout.Id, sendout.OnboardPokemon.Ability);
                    }
                }
            }
        }
コード例 #8
0
 public static void HpRecover(this PokemonProxy pm, int changeHp, bool showFail = false, string log = Ls.HpRecover, int arg1 = 0, bool consumeItem = false)
 {
     if (CanHpRecover(pm, showFail))
     {
         if (consumeItem)
         {
             pm.ConsumeItem();
         }
         if (changeHp == 0)
         {
             changeHp = 1;
         }
         ShowLogPm(pm, log, arg1);
         pm.Hp += changeHp;
     }
 }
コード例 #9
0
ファイル: Turn.cs プロジェクト: gyyfifafans/PBO
 private void SortActingPokemons()
 {
     for (int i = 0; i < ActingPokemons.Count - 1; i++)
     {
         int j;
         j = Controller.GetRandomInt(i, ActingPokemons.Count - 1);
         PokemonProxy temp = ActingPokemons[i];
         ActingPokemons[i] = ActingPokemons[j];
         ActingPokemons[j] = temp;
     }
     foreach (var p in Board.Pokemons)
     {
         p.CalculatePriority();
     }
     ActingPokemons.Sort(Comparer);
 }
コード例 #10
0
ファイル: ITs.cs プロジェクト: gyyfifafans/PBO
        public static void Seed(PokemonProxy pm)
        {
            var b = pm.Controller.Board;

            if (pm.ItemE(Is.Electric_Seed) && b.HasCondition(Cs.ElectricTerrain) || pm.ItemE(Is.Grassy_Seed) && b.HasCondition(Cs.GrassyTerrain))
            {
                pm.ShowLogPm("Seed", pm.Pokemon.Item);
                pm.ChangeLv7D(pm, StatType.Def, 1, false);
                pm.ConsumeItem();
            }
            if (pm.ItemE(Is.Misty_Seed) && b.HasCondition(Cs.MistyTerrain) || pm.ItemE(Is.Psychic_Seed) && b.HasCondition(Cs.PsychicTerrain))
            {
                pm.ShowLogPm("Seed", pm.Pokemon.Item);
                pm.ChangeLv7D(pm, StatType.SpDef, 1, false);
                pm.ConsumeItem();
            }
        }
コード例 #11
0
        public static double WeightModifier(PokemonProxy pm)
        {
            double m;
            int    id = pm.Ability;

            if (id == As.HEAVY_METAL)
            {
                m = 2d;
            }
            else if (id == As.LIGHT_METAL)
            {
                m = 0.5d;
            }
            else
            {
                m = 1d;
            }
            return(m);
        }
コード例 #12
0
        public static bool CanAddState(PokemonProxy pm, AttachedState state, PokemonProxy by, bool showFail)
        {
            if (state != AttachedState.SLP || !pm.Controller.GameSettings.SleepRule || pm.Pokemon.TeamId == by.Pokemon.TeamId)
            {
                goto TRUE;
            }
            var p = pm.Field.GetCondition <PokemonProxy>(Cs.RULE_SLP);

            if (p == null || p == pm || p.State != PokemonState.SLP && !p.OnboardPokemon.HasCondition(Cs.Yawn))
            {
                goto PREPARE;
            }
            pm.ShowLogPm("RULE_SLP");
            return(false);

PREPARE:
            pm.Field.SetCondition(Cs.RULE_SLP, pm);
TRUE:
            return(true);
        }
コード例 #13
0
 public bool Withdraw(PokemonProxy pm, string log, int arg1, bool canPursuit)
 {
     if (CanWithdraw(pm))
     {
         if (log != null) pm.ShowLogPm(log, arg1);
         STs.Withdrawing(pm, canPursuit);
         if (pm.Tile != null)
         {
             ReportBuilder.Withdraw(pm);
             var ability = pm.Ability;
             pm.Action = PokemonAction.InBall;
             pm.Tile.Pokemon = null;
             pm.OnboardPokemon = pm.NullOnboardPokemon;
             Controller.ActingPokemons.Remove(pm);
             ATs.Withdrawn(pm, ability);
             return true;
         }
     }
     return false;
 }
コード例 #14
0
        public Player(Controller controller, int teamId, int teamIndex, IPokemonData[] pokemons)
        {
            TeamId    = teamId;
            TeamIndex = teamIndex;
            var tiles = new List <Tile>();

            foreach (var t in controller.Board[teamId].Tiles)
            {
                if (controller.GameSettings.Mode.GetPlayerIndex(t.X) == teamIndex)
                {
                    tiles.Add(t);
                }
            }
            _tiles    = tiles.ToArray();
            _pokemons = new PokemonProxy[pokemons.Length];
            for (int i = 0; i < pokemons.Length; i++)
            {
                _pokemons[i] = new PokemonProxy(new Pokemon(controller, teamId * 50 + teamIndex * 10 + i, this, pokemons[i]));
            }
        }
コード例 #15
0
 private static bool CheckAbility(int ability, PokemonProxy pm, PokemonProxy by, AttachedState state, bool showFail)
 {
     if (pm.AbilityE(ability))
     {
         if (showFail)
         {
             pm.RaiseAbility();
             if (pm == by || state == AttachedState.Confuse)
             {
                 pm.ShowLogPm("Cant" + state);
             }
             else
             {
                 pm.NoEffect();
             }
         }
         return(true);
     }
     return(false);
 }
コード例 #16
0
 public static void WhiteHerb(PokemonProxy pm)
 {
     if (pm.ItemE(Is.WHITE_HERB))
     {
         Simple6D lvs   = (Simple6D)pm.OnboardPokemon.Lv5D;
         bool     raise = false;
         if (lvs.Atk < 0)
         {
             lvs.Atk = 0; raise = true;
         }
         if (lvs.Def < 0)
         {
             lvs.Def = 0; raise = true;
         }
         if (lvs.SpAtk < 0)
         {
             lvs.SpAtk = 0; raise = true;
         }
         if (lvs.SpDef < 0)
         {
             lvs.SpDef = 0; raise = true;
         }
         if (lvs.Speed < 0)
         {
             lvs.Speed = 0; raise = true;
         }
         if (pm.OnboardPokemon.AccuracyLv < 0)
         {
             pm.OnboardPokemon.AccuracyLv = 0; raise = true;
         }
         if (pm.OnboardPokemon.EvasionLv < 0)
         {
             pm.OnboardPokemon.EvasionLv = 0; raise = true;
         }
         if (raise)
         {
             pm.ShowLogPm("WhiteHerb", pm.Pokemon.Item);
             pm.ConsumeItem();
         }
     }
 }
コード例 #17
0
ファイル: PTs.cs プロジェクト: gyyfifafans/PBO
 public static bool CanHpRecover(this PokemonProxy pm, bool showFail = false)
 {
     if (pm.AliveOnboard)
     {
         if (pm.Hp == pm.Pokemon.MaxHp)
         {
             if (showFail)
             {
                 ShowLogPm(pm, "FullHp");
             }
             return(false);
         }
         if (pm.OnboardPokemon.HasCondition(Cs.HealBlock))
         {
             ShowLogPm(pm, "HealBlock");
             return(false);
         }
         return(true);
     }
     return(false);
 }
コード例 #18
0
        public static bool ChangeLv7D(this PokemonProxy pm, PokemonProxy by, MoveTypeE move)
        {
            bool r = false;
            var  c = move.Lv7DChanges;

            if (c != null)
            {
                bool showFail = move.Move.Category == MoveCategory.Status;
                if (c.Type1 == StatType.All)
                {
                    r = ChangeLv7D(pm, by, showFail, false, c.Change1, c.Change1, c.Change1, c.Change1, c.Change1);
                }
                else
                {
                    var ac = CanChangeLv7D(pm, by, c.Type1, c.Change1, showFail);
                    if (ac != 0)
                    {
                        ChangeLv7DImplement(pm, by, c.Type1, ac, null);
                        r = true;
                    }
                    ac = CanChangeLv7D(pm, by, c.Type2, c.Change2, showFail);
                    if (ac != 0)
                    {
                        ChangeLv7DImplement(pm, by, c.Type2, ac, null);
                        r = true;
                    }
                    ac = CanChangeLv7D(pm, by, c.Type3, c.Change3, showFail);
                    if (ac != 0)
                    {
                        ChangeLv7DImplement(pm, by, c.Type3, ac, null);
                        r = true;
                    }
                    if (r)
                    {
                        ITs.WhiteHerb(pm);
                    }
                }
            }
            return(r);
        }
コード例 #19
0
 public static void Attach(PokemonProxy pm)
 {
     if (pm.ItemE(Is.LEPPA_BERRY))
     {
         foreach (var m in pm.Moves)
         {
             if (m.PP == 0)
             {
                 m.PP += 10;
                 pm.ConsumeItem();
                 pm.ShowLogPm("ItemPPRecover", Is.LEPPA_BERRY, m.MoveE.Id);
                 return;
             }
         }
     }
     else
     {
         WhiteHerb(pm);
         HpChanged.Execute(pm);
         StateAdded.Execute(pm);
     }
 }
コード例 #20
0
 public static int CanChangeLv7D(this PokemonProxy pm, PokemonProxy by, StatType stat, int change, bool showFail)
 {
     if (stat == StatType.Invalid || change == 0 || !pm.AliveOnboard)
     {
         return(0);
     }
     change = Lv7DChanging.Execute(pm, by, stat, change, showFail);
     if (change != 0)
     {
         int oldValue = stat == StatType.Accuracy ? pm.OnboardPokemon.AccuracyLv : stat == StatType.Evasion ? pm.OnboardPokemon.EvasionLv : pm.OnboardPokemon.Lv5D.GetStat(stat);
         if (oldValue == 6 && change > 0)
         {
             if (showFail)
             {
                 ShowLogPm(pm, "7DMax", (int)stat);
             }
             return(0);
         }
         else if (oldValue == -6 && change < 0)
         {
             if (showFail)
             {
                 ShowLogPm(pm, "7DMin", (int)stat);
             }
             return(0);
         }
         int value = oldValue + change;
         if (value > 6)
         {
             change = 6 - oldValue;
         }
         else if (value < -6)
         {
             change = -6 - oldValue;
         }
     }
     return(change);
 }
コード例 #21
0
        public static void Withdrawn(PokemonProxy pm, int ability)
        {
            switch (ability)
            {
            case As.REGENERATOR:
                if (pm.Hp != 0)
                {
                    pm.Pokemon.Hp += pm.Pokemon.MaxHp / 3;
                }
                break;

            case As.NATURAL_CURE:
                if (pm.Hp != 0)
                {
                    pm.Pokemon.State = PokemonState.Normal;
                }
                break;

            case As.UNNERVE:
                foreach (var p in pm.Controller.GetOnboardPokemons(1 - pm.Pokemon.TeamId))
                {
                    ITs.Attach(p);
                }
                break;

            case As.PRIMORDIAL_SEA:
                DeSpWeather(pm, ability, Ls.DeHeavyRain);
                break;

            case As.DESOLATE_LAND:
                DeSpWeather(pm, ability, Ls.DeHarshSunlight);
                break;

            case As.DELTA_STREAM:
                DeSpWeather(pm, ability, Ls.DeMysteriousAirCurrent);
                break;
            }
        }
コード例 #22
0
ファイル: PTs.cs プロジェクト: gyyfifafans/PBO
        public static void CalculatePriority(this PokemonProxy pm)
        {
            pm.Priority       = 0;
            pm.ItemSpeedValue = 0;
            if (pm.Action != PokemonAction.WillSwitch)
            {
                var m = pm.SelectedMove.MoveE;
                pm.Priority = m.Priority;
                if (m.Move.Category == MoveCategory.Status && pm.AbilityE(As.PRANKSTER) || m.Move.Type == BattleType.Flying && pm.AbilityE(As.GALE_WINGS) && pm.Hp == pm.Pokemon.MaxHp || pm.AbilityE(As.Triage) && m.Heal)
                {
                    pm.Priority++;
                }
                switch (pm.Item)
                {
                case Is.LAGGING_TAIL:
                case Is.FULL_INCENSE:
                    pm.ItemSpeedValue = -1;
                    break;

                case Is.QUICK_CLAW:
                    if (pm.Controller.RandomHappen(20))
                    {
                        ShowLogPm(pm, "QuickItem", Is.QUICK_CLAW);
                        pm.ItemSpeedValue = 1;
                    }
                    break;

                case Is.CUSTAP_BERRY:
                    if (ATs.Gluttony(pm))
                    {
                        ShowLogPm(pm, "QuickItem", Is.CUSTAP_BERRY);
                        pm.ConsumeItem();
                        pm.ItemSpeedValue = 1;
                    }
                    break;
                }
            }
        }
コード例 #23
0
        public static void EffectHurtImplement(this PokemonProxy pm, int hp, string log = Ls.Hurt, int arg1 = 0, int arg2 = 0)
        {
            if (hp == 0)
            {
                hp = 1;
            }
            ShowLogPm(pm, log, arg1, arg2);
            pm.Hp -= hp;
            HpChanged.Execute(pm);
            pm.OnboardPokemon.SetTurnCondition(Cs.Assurance);

            if (pm.Hp > 0 && (pm.Ability == As.Emergency_Exit || pm.Ability == As.Wimp_Out) && pm.Hp <= pm.Pokemon.MaxHp / 2 && pm.Hp + hp > pm.Pokemon.MaxHp / 2)
            {
                pm.AtkContext.SetCondition(Cs.EjectButton, pm.Tile);
                if (pm.Ability == As.Emergency_Exit)
                {
                    pm.Controller.Withdraw(pm, "EmergencyExit", 0, true);
                }
                else if (pm.Ability == As.Wimp_Out)
                {
                    pm.Controller.Withdraw(pm, "WimpOut", 0, true);
                }
            }
        }
コード例 #24
0
        /// <summary>
        /// auto consume item
        /// </summary>
        /// <param name="pm"></param>
        /// <param name="stat"></param>
        /// <param name="change"></param>
        public static void ChangeLv5D(PokemonProxy pm, StatType stat, int change)
        {
            change = pm.CanChangeLv7D(pm, stat, change, false);
            if (change == 0)
            {
                return;
            }
            var    i = pm.Pokemon.Item;
            string log;

            switch (change)
            {
            case 1:
                log = "Item7DUp1";
                break;

            case 2:
                log = "Item7DUp2";
                break;

            case -1:
                log = "7DDown1";
                break;

            case -2:
                log = "7DDown2";
                break;

            default:
                log = change > 0 ? "Item7DUp3" : "7DDown3";
                break;
            }
            pm.OnboardPokemon.ChangeLv7D(stat, change);
            pm.ConsumeItem();
            pm.ShowLogPm(log, i, (int)stat);
        }
コード例 #25
0
        private static void AddStateImplement(this PokemonProxy pm, PokemonProxy by, AttachedState state, int turn, string log, int arg1)
        {
            switch (state)
            {
            case AttachedState.BRN:
                pm.Pokemon.State = PokemonState.BRN;
                goto POKEMON_STATE;

            case AttachedState.FRZ:
                pm.Pokemon.State = PokemonState.FRZ;
                pm.ShowLogPm(log ?? "EnFRZ", arg1);
                if (pm.CanChangeForm(492, 0))
                {
                    pm.ChangeForm(0, true);
                }
                goto DONE;

            case AttachedState.PAR:
                pm.Pokemon.State = PokemonState.PAR;
                goto POKEMON_STATE;

            case AttachedState.PSN:
                if (turn == 0)
                {
                    pm.Pokemon.State = PokemonState.PSN;
                }
                else
                {
                    pm.Pokemon.State = PokemonState.BadlyPSN;
                    pm.OnboardPokemon.SetCondition(Cs.BadlyPSN, pm.Controller.TurnNumber);
                }
                goto POKEMON_STATE;

            case AttachedState.SLP:
                pm.Pokemon.State   = PokemonState.SLP;
                pm.Pokemon.SLPTurn = turn == 0 ? pm.Controller.GetRandomInt(2, 4) : turn;
                goto POKEMON_STATE;

            case AttachedState.Confuse:
                pm.OnboardPokemon.SetCondition(Cs.Confuse, turn == 0 ? pm.Controller.GetRandomInt(2, 5) : turn);
                pm.ShowLogPm(log ?? "Confuse");
                goto DONE;

            case AttachedState.Attract:
                pm.OnboardPokemon.SetCondition(Cs.Attract, by);
                pm.ShowLogPm(log ?? "EnAttract", arg1);
                ITs.DestinyKnot(pm, by);
                goto DONE;

            case AttachedState.Trap:
            {
                var move = by.AtkContext.Move;
                var c    = new Condition();
                c.By   = by;
                c.Turn = pm.Controller.TurnNumber + (turn == 0 ? pm.Controller.GetRandomInt(4, 5) : turn) - 1;
                c.Move = move;
                c.Bool = by.Item == Is.BINDING_BAND;
                pm.OnboardPokemon.SetCondition(Cs.Trap, c);
                pm.ShowLogPm("EnTrap" + move.Id.ToString(), by.Id);
            }
                goto DONE;

            case AttachedState.Nightmare:
                pm.OnboardPokemon.SetCondition(Cs.Nightmare);
                pm.ShowLogPm("EnNightmare");
                goto DONE;

            case AttachedState.Torment:
                pm.OnboardPokemon.SetCondition(Cs.Torment, by);
                pm.ShowLogPm("EnTorment");
                goto DONE;

            case AttachedState.Disable:
            {
                var c = new Condition();
                c.Move = pm.LastMove;
                c.Turn = pm.Controller.TurnNumber + 3;         //4 - 1
                pm.OnboardPokemon.SetCondition(Cs.Disable, c);
                pm.ShowLogPm("EnDisable", c.Move.Id);
            }
                goto DONE;

            case AttachedState.Yawn:
            {
                var o = new Condition();
                o.Turn = pm.Controller.TurnNumber + 1;
                o.By   = by;       //睡眠规则
                pm.OnboardPokemon.AddCondition(Cs.Yawn, o);
            }
                pm.ShowLogPm("EnYawn");
                goto DONE;

            case AttachedState.HealBlock:
            {
                var o = new Condition();
                o.Turn = pm.Controller.TurnNumber + 5;
                o.By   = by;
                pm.OnboardPokemon.SetCondition(Cs.HealBlock, o);
            }
                pm.ShowLogPm("EnHealBlock");
                goto DONE;

            case AttachedState.SoundBlock:
            {
                var o = new Condition();
                o.Turn = pm.Controller.TurnNumber + 2;
                o.By   = by;
                pm.OnboardPokemon.SetCondition(Cs.SoundBlock, o);
            }
                pm.ShowLogPm("EnSoundBlock");
                goto DONE;

            case AttachedState.CanAttack:
            {
                var o = new Condition();
                o.BattleType = by.AtkContext.Move.Id == Ms.MIRACLE_EYE ? BattleType.Dark : BattleType.Ghost;
                o.By         = by;
                pm.OnboardPokemon.SetCondition(Cs.CanAttack, o);
                pm.ShowLogPm("CanAttack");
            }
                goto DONE;

            case AttachedState.LeechSeed:
                pm.OnboardPokemon.SetCondition(Cs.LeechSeed, by.Tile);
                pm.ShowLogPm("EnLeechSeed");
                goto DONE;

            case AttachedState.Embargo:
                pm.OnboardPokemon.SetCondition(Cs.Embargo);
                pm.ShowLogPm("EnEmbargo");
                goto DONE;

            case AttachedState.PerishSong:
                pm.OnboardPokemon.SetCondition(Cs.PerishSong, 3);
                goto DONE;

            case AttachedState.Ingrain:
                pm.OnboardPokemon.SetCondition(Cs.Ingrain);
                pm.ShowLogPm("EnIngrain");
                goto DONE;

#if DEBUG
            default:
                System.Diagnostics.Debugger.Break();
                return;
#endif
            }
POKEMON_STATE:
            pm.ShowLogPm(log ?? "En" + state.ToString(), arg1);
            if (state != AttachedState.FRZ && state != AttachedState.SLP)
            {
                ATs.Synchronize(pm, by, state, turn);
            }
DONE:
            StateAdded.Execute(pm);
        }
コード例 #26
0
        private static bool CanAddState(this PokemonProxy pm, PokemonProxy by, bool ability, AttachedState state, bool showFail)
        {
            if (!pm.AliveOnboard)
            {
                return(false);
            }
            string fail = pm.Controller.GameSettings.Mode.NeedTarget() ? "Fail" : Ls.Fail0;

            switch (state)
            {
            case AttachedState.BRN:
                if (pm.State == PokemonState.BRN)
                {
                    goto FAIL_BEENSTATE;
                }
                if (pm.OnboardPokemon.HasType(BattleType.Fire))
                {
                    goto FAIL_NOEFFECT;
                }
                goto STATE;

            case AttachedState.FRZ:
                if (pm.Controller.Weather == Weather.IntenseSunlight)
                {
                    goto FAIL_FAIL;                                                      //战报顺序未测
                }
                if (pm.State == PokemonState.FRZ)
                {
                    goto FAIL_BEENSTATE;
                }
                if (pm.OnboardPokemon.HasType(BattleType.Ice))
                {
                    goto FAIL_NOEFFECT;
                }
                goto STATE;

            case AttachedState.PAR:
                if (pm.State == PokemonState.PAR)
                {
                    goto FAIL_BEENSTATE;
                }
                if (pm.OnboardPokemon.HasType(BattleType.Electric))
                {
                    goto FAIL_NOEFFECT;
                }
                goto STATE;

            case AttachedState.PSN:
                if (pm.State == PokemonState.PSN || pm.State == PokemonState.BadlyPSN)
                {
                    if (showFail)
                    {
                        pm.ShowLogPm("BeenPSN");
                    }
                    return(false);
                }
                if (!by.AbilityE(As.Corrosion) && (pm.OnboardPokemon.HasType(BattleType.Poison) || pm.OnboardPokemon.HasType(BattleType.Steel)))
                {
                    goto FAIL_NOEFFECT;
                }
                goto STATE;

            case AttachedState.SLP:
                if (!(ability && pm.AbilityE(As.SOUNDPROOF)))
                {
                    foreach (var p in pm.Controller.OnboardPokemons)
                    {
                        if (p.Action == PokemonAction.Moving && p.AtkContext.Move.Id == Ms.UPROAR)
                        {
                            if (showFail)
                            {
                                if (p == pm)
                                {
                                    pm.ShowLogPm("UproarCantSLP2");
                                }
                                else
                                {
                                    pm.ShowLogPm("UproarCantSLP");
                                }
                            }
                            return(false);
                        }
                    }
                }
                if (pm.State == PokemonState.SLP)
                {
                    goto FAIL_BEENSTATE;
                }
                goto STATE;

            case AttachedState.Confuse:
                if (pm.OnboardPokemon.HasCondition(Cs.Confuse))
                {
                    goto FAIL_BEENSTATE;
                }
                return(!(Safeguard(pm, by, showFail) || ability && CheckAbility(As.OWN_TEMPO, pm, by, state, showFail)));

            case AttachedState.Attract:
                if (pm.OnboardPokemon.Gender == PokemonGender.None || by.OnboardPokemon.Gender == PokemonGender.None || pm.OnboardPokemon.Gender == by.OnboardPokemon.Gender)
                {
                    goto FAIL_NOEFFECT;
                }
                if (pm.OnboardPokemon.HasCondition(Cs.Attract))
                {
                    goto FAIL_FAIL;
                }
                return(!(ability && CheckAbility(As.OBLIVIOUS, pm, by, state, showFail)));

            case AttachedState.Trap:
                if (pm.OnboardPokemon.HasCondition(Cs.Trap))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.Nightmare:
                if (pm.State == PokemonState.SLP)
                {
                    if (pm.OnboardPokemon.HasCondition(Cs.Nightmare))
                    {
                        goto FAIL_FAIL;
                    }
                    else
                    {
                        return(true);
                    }
                }
                goto FAIL_NOEFFECT;    //战报已测

            case AttachedState.Torment:
                if (pm.OnboardPokemon.HasCondition(Cs.Torment))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.Disable:
                if (pm.LastMove == null || pm.OnboardPokemon.HasCondition(Cs.Disable))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.Yawn:
                if (pm.OnboardPokemon.HasCondition(Cs.Yawn))
                {
                    goto FAIL_FAIL;
                }
                return(CanAddXXX(pm, by, ability, AttachedState.SLP, showFail));

            case AttachedState.HealBlock:
                if (pm.OnboardPokemon.HasCondition(Cs.HealBlock))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.SoundBlock:
                if (pm.OnboardPokemon.HasCondition(Cs.SoundBlock))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.CanAttack:
                if (pm.OnboardPokemon.HasCondition(Cs.CanAttack))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.LeechSeed:
                if (pm.OnboardPokemon.HasType(BattleType.Grass))
                {
                    goto FAIL_NOEFFECT;
                }
                if (pm.OnboardPokemon.HasCondition(Cs.LeechSeed))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.Embargo:
                if (pm.OnboardPokemon.Ability == As.MULTITYPE || pm.OnboardPokemon.Ability == As.RKS_System)
                {
                    goto FAIL_NOEFFECT;
                }
                if (pm.OnboardPokemon.HasCondition(Cs.Embargo))
                {
                    goto FAIL_FAIL;
                }
                return(true);

            case AttachedState.PerishSong:
                return(!pm.OnboardPokemon.HasCondition(Cs.PerishSong));    //无需判断防音 never show fail

            case AttachedState.Ingrain:
                if (pm.OnboardPokemon.HasCondition(Cs.Ingrain))
                {
                    goto FAIL_FAIL;
                }
                return(true);
            }
FAIL_FAIL:
            if (showFail)
            {
                pm.Controller.ReportBuilder.ShowLog(fail);
            }
            return(false);

FAIL_NOEFFECT:
            if (showFail)
            {
                pm.NoEffect();
            }
            return(false);

FAIL_BEENSTATE:
            if (showFail)
            {
                pm.ShowLogPm("Been" + state);
            }
            return(false);

STATE:
            if (pm.State != PokemonState.Normal)
            {
                goto FAIL_FAIL;
            }
            return(CanAddXXX(pm, by, ability, state, showFail) && Rules.CanAddState(pm, state, by, showFail));
        }
コード例 #27
0
 public static bool CanAddState(this PokemonProxy pm, PokemonProxy by, AttachedState state, bool showFail)
 {
     return(CanAddState(pm, by, true, state, showFail));
 }
コード例 #28
0
ファイル: MoveTypeE.cs プロジェクト: gyyfifafans/PBO
 public MoveRange GetRange(PokemonProxy pm)
 {
     return(Id == Ms.CURSE ? pm.OnboardPokemon.HasType(BattleType.Ghost) ? MoveRange.SelectedTarget : MoveRange.Self : Move.Range);
 }
コード例 #29
0
 internal static bool Unnerve(PokemonProxy pm)
 {
     return(pm.OnboardPokemon.HasCondition(Cs.Unnerve) && pm.AbilityE(As.UNNERVE));
 }
コード例 #30
0
 public static bool Gluttony(PokemonProxy pm)
 {
     return(pm.Hp << 2 <= pm.Pokemon.MaxHp || pm.AbilityE(As.GLUTTONY) && pm.Hp << 1 <= pm.Pokemon.MaxHp);
 }