Exemple #1
0
 public void setStates(SavedMedicalStates states)
 {
     clearStates();
     foreach (MedicalState state in states.getStates())
     {
         this.states.Add(state);
         if (StateAdded != null)
         {
             StateAdded.Invoke(this, state);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Use the current setup of the scene to create a "normal" state.
 /// </summary>
 public void sceneLoaded(SimScene scene)
 {
     sceneLoadNormalState                  = this.createState("Normal");
     sceneLoadNormalState.Notes.Notes      = "Normal";
     sceneLoadNormalState.Notes.DataSource = "Automatic";
     sceneLoadNormalState.Thumbnail        = imageRenderer.renderImage(imageProperties);
     states.Add(sceneLoadNormalState);
     if (StateAdded != null)
     {
         StateAdded.Invoke(this, sceneLoadNormalState);
     }
 }
Exemple #3
0
 public void addState(MedicalState state)
 {
     //No states and normal state defined, add it as the first state.
     if (states.Count == 0)
     {
         states.Add(sceneLoadNormalState);
         if (StateAdded != null)
         {
             StateAdded.Invoke(this, sceneLoadNormalState);
         }
     }
     states.Add(state);
     if (state.Thumbnail == null)
     {
         state.Thumbnail = imageRenderer.renderImage(imageProperties);
     }
     if (StateAdded != null)
     {
         StateAdded.Invoke(this, state);
     }
 }
Exemple #4
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);
     }
 }
Exemple #5
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);
        }