Beispiel #1
0
 public GBEncounterData(PKM pkm, int gen, IEncounterable enc, GameVersion game)
 {
     Game       = game;
     Generation = gen;
     Encounter  = enc;
     if (Encounter is EncounterTrade trade)
     {
         if (pkm.HasOriginalMetLocation && trade.Level < pkm.Met_Level)
         {
             Level = pkm.Met_Level; // Crystal
         }
         else
         {
             Level = trade.Level;
         }
         Type = Generation == 2
             ? GBEncounterType.TradeEncounterG2
             : GBEncounterType.TradeEncounterG1;
     }
     else if (Encounter is EncounterStatic statc)
     {
         Level = statc.Level;
         Type  = statc.Moves != null && statc.Moves[0] != 0 && pkm.Moves.Contains(statc.Moves[0])
             ? GBEncounterType.SpecialEncounter
             : GBEncounterType.StaticEncounter;
     }
     else if (Encounter is EncounterSlot1 slot)
     {
         Level = pkm.HasOriginalMetLocation && slot.LevelMin >= pkm.Met_Level && pkm.Met_Level <= slot.LevelMax
             ? pkm.Met_Level // Crystal
             : slot.LevelMin;
         Type = GBEncounterType.WildEncounter;
     }
 }
Beispiel #2
0
 // Egg encounter
 public GBEncounterData(int species)
 {
     Generation = 2;
     Type       = GBEncounterType.EggEncounter;
     Level      = 5;
     WasEgg     = true;
     Species    = species;
 }
Beispiel #3
0
 // Egg encounter
 public GBEncounterData(int species, GameVersion game)
 {
     Generation = 2;
     Game       = game;
     Encounter  = new EncounterEgg {
         Species = species, Game = game, Level = 5
     };
     Type = GBEncounterType.EggEncounter;
 }
Beispiel #4
0
 public GBEncounterData(PKM pkm, int gen, object enc)
 {
     Generation = gen;
     Encounter  = enc;
     WasEgg     = false;
     if (Encounter is EncounterTrade)
     {
         var trade = (EncounterTrade)Encounter;
         Species = trade.Species;
         if (pkm.HasOriginalMetLocation && trade.Level < pkm.Met_Level)
         {
             Level = pkm.Met_Level; // Crystal
         }
         else
         {
             Level = trade.Level;
         }
         if (Generation == 2)
         {
             Type = GBEncounterType.TradeEncounterG2;
         }
         else
         {
             Type = GBEncounterType.TradeEncounterG1;
         }
     }
     else if (Encounter is EncounterStatic)
     {
         var statc = (EncounterStatic)Encounter;
         Species = statc.Species;
         Level   = statc.Level;
         if (statc.Moves != null && statc.Moves[0] != 0 && pkm.Moves.Contains(statc.Moves[0]))
         {
             Type = GBEncounterType.SpecialEncounter;
         }
         else
         {
             Type = GBEncounterType.StaticEncounter;
         }
     }
     else if (Encounter is EncounterSlot1)
     {
         var slot = (EncounterSlot1)Encounter;
         Species = slot.Species;
         if (pkm.HasOriginalMetLocation && slot.LevelMin >= pkm.Met_Level && pkm.Met_Level <= slot.LevelMax)
         {
             Level = pkm.Met_Level; // Crystal
         }
         else
         {
             Level = slot.LevelMin;
         }
         Type = GBEncounterType.WildEncounter;
     }
     MoveLevel = Level;
 }
Beispiel #5
0
        public GBEncounterData(PKM pkm, int gen, IEncounterable enc, GameVersion game)
        {
            Game       = game;
            Generation = gen;
            Encounter  = enc;
            switch (Encounter)
            {
            case EncounterTrade t:
                if (pkm.HasOriginalMetLocation && t.Level < pkm.Met_Level)
                {
                    Level = pkm.Met_Level;     // Crystal
                }
                else
                {
                    Level = t.Level;
                }
                Type = Generation == 2
                            ? GBEncounterType.TradeEncounterG2
                            : GBEncounterType.TradeEncounterG1;
                break;

            case EncounterStatic s:
                Level = s.Level;
                Type  = s.Moves != null && s.Moves[0] != 0 && pkm.Moves.Contains(s.Moves[0])
                        ? GBEncounterType.SpecialEncounter
                        : GBEncounterType.StaticEncounter;
                break;

            case EncounterSlot w:
                Level = pkm.HasOriginalMetLocation && w.LevelMin >= pkm.Met_Level && pkm.Met_Level <= w.LevelMax
                        ? pkm.Met_Level // Crystal
                        : w.LevelMin;
                Type = GBEncounterType.WildEncounter;
                break;
            }
        }