示例#1
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);
        }
示例#2
0
        public static void RaiseItemByMove(PokemonProxy pm, int id, PokemonProxy by)
        {
            var op = pm.OnboardPokemon;

            switch (id)
            {
            case Is.WHITE_HERB:
            {
                bool raise = false;
                var  lvs   = (Simple6D)op.Lv5D;
                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 (op.AccuracyLv < 0)
                {
                    op.AccuracyLv = 0; raise = true;
                }
                if (op.EvasionLv < 0)
                {
                    op.EvasionLv = 0; raise = true;
                }
                if (raise)
                {
                    pm.ShowLogPm("WhiteHerb");
                }
            }
            break;

            case Is.MENTAL_HERB:
                if (op.RemoveCondition(Cs.Attract))
                {
                    pm.ShowLogPm("ItemDeAttract", Is.MENTAL_HERB);
                }
                break;

            case Is.KINGS_ROCK:
                op.AddTurnCondition(Cs.Flinch);
                break;

            case Is.LIGHT_BALL:
                pm.AddState(by, AttachedState.PAR, false);
                break;

            case Is.POISON_BARB:
                pm.AddState(by, AttachedState.PSN, false);
                break;

            case Is.TOXIC_ORB:
                pm.AddState(by, AttachedState.PSN, false, 15);    //战报待验证
                break;

            case Is.FLAME_ORB:
                pm.AddState(by, AttachedState.BRN, false);    //战报
                break;

            case Is.RAZOR_FANG:
                op.AddTurnCondition(Cs.Flinch);
                break;

            case Is.CHERI_BERRY:
                if (pm.State == PokemonState.PAR)
                {
                    pm.DeAbnormalState();                                  //战报
                }
                break;

            case Is.CHESTO_BERRY:
                if (pm.State == PokemonState.PAR)
                {
                    pm.DeAbnormalState();
                }
                break;

            case Is.PECHA_BERRY:
                if (pm.State == PokemonState.PAR)
                {
                    pm.DeAbnormalState();
                }
                break;

            case Is.RAWST_BERRY:
                if (pm.State == PokemonState.BRN)
                {
                    pm.DeAbnormalState();
                }
                break;

            case Is.ASPEAR_BERRY:
                if (pm.State == PokemonState.FRZ)
                {
                    pm.DeAbnormalState();
                }
                break;

            case Is.LEPPA_BERRY:
                foreach (var m in pm.Moves)
                {
                    if (m.PP == 0)
                    {
                        m.PP += 10;
                        pm.ShowLogPm("ItemPPRecover", Is.LEPPA_BERRY, m.MoveE.Id);
                        return;
                    }
                }
                foreach (var m in pm.Moves)
                {
                    if (m.PP != m.Move.PP.Origin)
                    {
                        m.PP += 10;
                        pm.ShowLogPm("ItemPPRecover", Is.LEPPA_BERRY, m.MoveE.Id);
                        return;
                    }
                }
                break;

            case Is.ORAN_BERRY:
                pm.HpRecover(10, false, Ls.ItemHpRecover, Is.ORAN_BERRY);
                break;

            case Is.PERSIM_BERRY:
                if (op.RemoveCondition(Cs.Confuse))
                {
                    pm.ShowLogPm("DeConfuse");
                }
                break;

            case Is.LUM_BERRY:
                if (pm.State != PokemonState.Normal)
                {
                    pm.DeAbnormalState();
                }
                break;

            case Is.SITRUS_BERRY:
                pm.HpRecoverByOneNth(3, false, Ls.ItemHpRecover, Is.SITRUS_BERRY);
                break;

            case Is.FIGY_BERRY:
            case Is.WIKI_BERRY:
            case Is.MAGO_BERRY:
            case Is.AGUAV_BERRY:
            case Is.IAPAPA_BERRY:
                pm.HpRecoverByOneNth(8, false, Ls.ItemHpRecover, id);
                if (pm.Pokemon.Nature.DislikeTaste(GetTaste(id)))
                {
                    pm.AddState(pm, AttachedState.Confuse, false);
                }
                break;

            case Is.LIECHI_BERRY:
                pm.ChangeLv7D(by, StatType.Atk, 1, false);
                break;

            case Is.GANLON_BERRY:
                pm.ChangeLv7D(by, StatType.Def, 1, false);
                break;

            case Is.SALAC_BERRY:
                pm.ChangeLv7D(by, StatType.Speed, 1, false);
                break;

            case Is.PETAYA_BERRY:
                pm.ChangeLv7D(by, StatType.SpAtk, 1, false);
                break;

            case Is.APICOT_BERRY:
                pm.ChangeLv7D(by, StatType.SpDef, 1, false);
                break;

            case Is.LANSAT_BERRY:
                if (pm.OnboardPokemon.AddCondition(Cs.FocusEnergy))
                {
                    pm.ShowLogPm("ItemEnFocusEnergy", Is.LANSAT_BERRY);
                }
                break;

            case Is.STARF_BERRY:
            {
                var ss = new List <StatType>();
                if (pm.CanChangeLv7D(by, StatType.Atk, 2, false) != 0)
                {
                    ss.Add(StatType.Atk);
                }
                if (pm.CanChangeLv7D(by, StatType.Def, 2, false) != 0)
                {
                    ss.Add(StatType.Def);
                }
                if (pm.CanChangeLv7D(by, StatType.SpAtk, 2, false) != 0)
                {
                    ss.Add(StatType.SpAtk);
                }
                if (pm.CanChangeLv7D(by, StatType.SpDef, 2, false) != 0)
                {
                    ss.Add(StatType.SpDef);
                }
                if (pm.CanChangeLv7D(by, StatType.Speed, 2, false) != 0)
                {
                    ss.Add(StatType.Speed);
                }
                var n = ss.Count;
                if (n != 0)
                {
                    pm.ChangeLv7D(by, ss[pm.Controller.GetRandomInt(0, n - 1)], 2, false);
                }
            }
            break;

            case Is.MICLE_BERRY:
                if (pm.OnboardPokemon.AddCondition(Cs.MicleBerry))
                {
                    pm.ShowLogPm("MicleBerry", Is.MICLE_BERRY);
                }
                break;
            }
        }