Beispiel #1
0
        private void Zap()
        {
            Spend(TimeToZap);

            if (Hit(this, Enemy, true))
            {
                if (Enemy == Dungeon.Hero && Random.Int(2) == 0)
                {
                    buffs.Buff.Prolong <Weakness>(Enemy, Weakness.Duration(Enemy));
                }

                var dmg = Random.Int(12, 18);
                Enemy.Damage(dmg, this);

                if (Enemy.IsAlive || Enemy != Dungeon.Hero)
                {
                    return;
                }

                Dungeon.Fail(Utils.Format(ResultDescriptions.MOB, Utils.Indefinite(Name), Dungeon.Depth));
                GLog.Negative(TxtShadowboltKilled, Name);
            }
            else
            {
                Enemy.Sprite.ShowStatus(CharSprite.Neutral, Enemy.DefenseVerb());
            }
        }
Beispiel #2
0
 public static bool ChangeNameScopeIsValid(this Weakness weakness, string name)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(weakness.Name, Errors.InvalidWeakness),
                AssertionConcern.AssertArgumentLength(weakness.Name, 2, 50, Errors.InvalidWeakness)
                ));
 }
Beispiel #3
0
        private void LireTableWeaknessStrengh()
        {
            commande.CommandText = "SELECT * FROM [Array Weakness and strengh]";
            OleDbDataReader reader = commande.ExecuteReader();

            while (reader.Read())
            {
                List <int> Tempo = new List <int>();

                Tempo.Add(reader.GetInt32(2));
                Tempo.Add(reader.GetInt32(3));
                Tempo.Add(reader.GetInt32(4));
                Tempo.Add(reader.GetInt32(5));
                Tempo.Add(reader.GetInt32(6));
                Tempo.Add(reader.GetInt32(7));
                Tempo.Add(reader.GetInt32(8));
                Tempo.Add(reader.GetInt32(9));
                Tempo.Add(reader.GetInt32(10));
                Tempo.Add(reader.GetInt32(11));
                Tempo.Add(reader.GetInt32(12));
                Tempo.Add(reader.GetInt32(13));
                Tempo.Add(reader.GetInt32(14));
                Tempo.Add(reader.GetInt32(15));
                Tempo.Add(reader.GetInt32(16));
                Tempo.Add(reader.GetInt32(17));
                Tempo.Add(reader.GetInt32(18));
                Tempo.Add(reader.GetInt32(19));

                Weakness.Add(Tempo);
            }
            reader.Close();
        }
        public async Task <IActionResult> Edit(int id, [Bind("WeaknessID,EnergyTypeID,WeaknessValue,LastUpdateDate")] Weakness weakness)
        {
            if (id != weakness.WeaknessID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(weakness);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WeaknessExists(weakness.WeaknessID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnergyTypeID"] = new SelectList(_context.EnergyTypes, "EnergyTypeID", "EnergyTypeID", weakness.EnergyTypeID);
            return(View(weakness));
        }
Beispiel #5
0
    private void Start()
    {
        wizard         = FindObjectOfType <Wizard>();
        gameController = FindObjectOfType <GameController>();

        // Give random weakness
        int            randWeakness = Random.Range(0, 3);
        SpriteRenderer weaknessIcon = transform.Find("weakness").GetComponent <SpriteRenderer>();

        switch (randWeakness)
        {
        case 0:
            weakness            = new Weakness(DamageType.Force);
            weaknessIcon.sprite = forceIcon;
            break;

        case 1:
            weakness            = new Weakness(DamageType.Burn);
            weaknessIcon.sprite = burnIcon;
            break;

        case 2:
            weakness            = new Weakness(DamageType.Shock);
            weaknessIcon.sprite = shockIcon;
            break;
        }
    }
        private static void AddWeakness(ListWeaknesses control, Weakness weakness)
        {
            TextBlock textBlockWeakness = new TextBlock();

            textBlockWeakness.Margin     = new Thickness(10, 5, 0, 0);
            textBlockWeakness.FontWeight = FontWeights.Black;
            textBlockWeakness.Text       = String.Format("{0} (x{1})", weakness.ClassName, weakness.Ratio);
            control.weaknessesListStackPanel.Children.Add(textBlockWeakness);
        }
Beispiel #7
0
    private Weakness GetDirection()
    {
        Weakness result = Weakness.Count;

        Vector2 direction = endPosition - startPosition;

        direction.Normalize();

        if (direction.x > -0.3f && direction.x < 0.3f)
        {
            if (direction.y < 0.0f)
            {
                result = Weakness.Down;
            }
            else if (direction.y > 0.0f)
            {
                result = Weakness.Up;
            }
        }
        else if (direction.y > -0.3f && direction.y < 0.3f)
        {
            if (direction.x < 0.0f)
            {
                result = Weakness.Left;
            }
            else
            {
                result = Weakness.Right;
            }
        }
        else if (direction.x < -0.3f)
        {
            if (direction.y < -0.3f)
            {
                result = Weakness.TopLeft;
            }
            else if (direction.y > 0.3f)
            {
                result = Weakness.DownLeft;
            }
        }
        else if (direction.x > 0.3f)
        {
            if (direction.y < -0.3f)
            {
                result = Weakness.TopRight;
            }
            else if (direction.y > 0.3f)
            {
                result = Weakness.DownRight;
            }
        }

        return(result);
    }
Beispiel #8
0
 public float this[ElementalType i]
 {
     get {
         Weakness w = Weaknesses.FirstOrDefault(weakness => weakness.ElementalType == i);
         if (default(Weakness).Equals(w))
         {
             return(1);
         }
         return(w.DamageMultiplier);
     }
 }
        public async Task <IActionResult> Create([Bind("WeaknessID,EnergyTypeID,WeaknessValue,LastUpdateDate")] Weakness weakness)
        {
            if (ModelState.IsValid)
            {
                _context.Add(weakness);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnergyTypeID"] = new SelectList(_context.EnergyTypes, "EnergyTypeID", "EnergyTypeID", weakness.EnergyTypeID);
            return(View(weakness));
        }
Beispiel #10
0
        public IWeakness AddWeakness([Required] string name, [NotNull] ISeverity severity)
        {
            IWeakness result = null;

            if (GetWeakness(name) == null)
            {
                result = new Weakness(this, name, severity);
                Add(result);
                RegisterEvents(result);
            }

            return(result);
        }
Beispiel #11
0
 public void TakeDamage(Damage damage)
 {
     if (Hp <= 0)
     {
         return;
     }
     damage = Weakness.ApplyAdditionalDamage(damage);
     Hp    -= damage.Amount;
     OnDamage?.Invoke();
     if (Hp <= 0)
     {
         OnDeath?.Invoke();
     }
 }
Beispiel #12
0
        public Weakness Create(CreateWeaknessCommand command)
        {
            var Weakness = new Weakness(command.Name, command.Description);

            Weakness.Validate();
            _repository.Create(Weakness);

            if (Commit())
            {
                return(Weakness);
            }

            return(null);
        }
        public bool CreateWeakness(WeaknessCreate model)
        {
            var newWeakness = new Weakness
            {
                WeaknessId = model.WeaknessId,
                Type       = model.Type,
                Value      = model.Value
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Weaknesses.Add(newWeakness);
                return(ctx.SaveChanges() == 1);
            }
        }
Beispiel #14
0
        public Hash(L l, Shelisp.Object test, Shelisp.Object weakness, Shelisp.Object size, Shelisp.Object rehash_size, Shelisp.Object rehash_threshold)
        {
            this.l = l;
            this.test = test;
            this.weakness = weakness;
            this.size = size;
            this.rehash_size = size;
            this.rehash_threshold = rehash_threshold;

            this.count = 0;
            // map weakness to our enum
            if (L.NILP (weakness)) {
                weakness_ = Weakness.None;
            }
            else if (weakness.LispEq (L.Qt)) {
                weakness_ = Weakness.KeyAndValue;
            }
            else if (weakness.LispEq (L.Qkey)) {
                weakness_ = Weakness.Key;
            }
            else if (weakness.LispEq (L.Qvalue)) {
                weakness_ = Weakness.Value;
            }
            else if (weakness.LispEq (L.Qkey_or_value)) {
                weakness_ = Weakness.KeyOrValue;
            }
            else if (weakness.LispEq (L.Qkey_and_value)) {
                weakness_ = Weakness.KeyAndValue;
            }
            else
                throw new Exception (string.Format ("invalid weakness {0}", weakness));

            compare = null;
            // use a builtin comparison function for the builtin test types
            if (test.LispEq (L.intern ("eq"))) {
                compare = compare_eq;
            }
            else if (test.LispEq (L.intern ("eql"))) {
                compare = compare_eql;
            }
            else if (test.LispEqual (L.intern ("equal"))) {
                compare = compare_equal;
            }

            table = new Tuple<Shelisp.Object,Shelisp.Object>[(int)((Number)size).boxed];
        }
Beispiel #15
0
        public static void WriteJson(this Weakness value, JsonWriter writer, JsonSerializer serializer)
        {
            switch (value)
            {
            case Weakness.Bug: serializer.Serialize(writer, "Bug"); break;

            case Weakness.Dark: serializer.Serialize(writer, "Dark"); break;

            case Weakness.Dragon: serializer.Serialize(writer, "Dragon"); break;

            case Weakness.Electric: serializer.Serialize(writer, "Electric"); break;

            case Weakness.Fairy: serializer.Serialize(writer, "Fairy"); break;

            case Weakness.Fighting: serializer.Serialize(writer, "Fighting"); break;

            case Weakness.Fire: serializer.Serialize(writer, "Fire"); break;

            case Weakness.Flying: serializer.Serialize(writer, "Flying"); break;

            case Weakness.Ghost: serializer.Serialize(writer, "Ghost"); break;

            case Weakness.Grass: serializer.Serialize(writer, "Grass"); break;

            case Weakness.Ground: serializer.Serialize(writer, "Ground"); break;

            case Weakness.Ice: serializer.Serialize(writer, "Ice"); break;

            case Weakness.Poison: serializer.Serialize(writer, "Poison"); break;

            case Weakness.Psychic: serializer.Serialize(writer, "Psychic"); break;

            case Weakness.Rock: serializer.Serialize(writer, "Rock"); break;

            case Weakness.Steel: serializer.Serialize(writer, "Steel"); break;

            case Weakness.Water: serializer.Serialize(writer, "Water"); break;
            }
        }
Beispiel #16
0
        /// <summary>
        /// Finds or adds new weakness for the POAM
        /// </summary>
        /// <param name="originalRecommendation">Original Recommendation of the POAM</param>
        /// <param name="risk">The Risk of the POAM</param>
        /// <returns>The weakness object</returns>
        private async Task <Weakness> CrateWeakness(string originalRecommendation, string risk)
        {
            Weakness weakness = null;

            //Find if the weakness exists
            weakness = await _context.Weaknesses.Where(item => item.OriginalRecommendation == originalRecommendation && item.Risk == risk).FirstOrDefaultAsync();

            // if the weakness does not exist, create a new weakness
            if (weakness == null)
            {
                weakness = new Weakness
                {
                    Risk = risk,
                    OriginalRecommendation = originalRecommendation
                };
                // Add the object to the database
                _context.Weaknesses.Add(weakness);
                // Save the object. This will get the ID field populated as well
                await _context.SaveChangesAsync();
            }
            return(weakness ?? throw new Exception(@"Weakness not found and/or could not be created"));
        }
Beispiel #17
0
        public static void Initialize(IServiceProvider services)
        {
            var env = services.GetRequiredService <IHostingEnvironment>();



            using (var context = new POAMDbContext(services.GetRequiredService <DbContextOptions <POAMDbContext> >()))
            {
                var authSystems = new List <AuthSystem>();
                if (!context.AuthSystems.Any())
                {
                    authSystems.Add(new AuthSystem {
                        Name = @"REGIS"
                    });
                    authSystems.Add(new AuthSystem {
                        Name = @"REDMACS"
                    });
                    authSystems.Add(new AuthSystem {
                        Name = @"Terremark"
                    });
                    context.AuthSystems.AddRange(authSystems);
                    context.SaveChanges();
                }

                var riskLevels = new List <RiskLevel>();
                if (!context.RiskLevels.Any())
                {
                    riskLevels.Add(new RiskLevel {
                        ID = 1, Name = "VL", Description = "Very Low"
                    });
                    riskLevels.Add(new RiskLevel {
                        ID = 2, Name = "L", Description = "Low"
                    });
                    riskLevels.Add(new RiskLevel {
                        ID = 3, Name = "M", Description = "Medium"
                    });
                    riskLevels.Add(new RiskLevel {
                        ID = 4, Name = "H", Description = "High"
                    });
                    riskLevels.Add(new RiskLevel {
                        ID = 5, Name = "VH", Description = "Very High"
                    });
                    context.RiskLevels.AddRange(riskLevels);
                    context.SaveChanges();
                }

                var statuses = new List <Status>();
                if (!context.Statuses.Any())
                {
                    statuses.Add(new Status {
                        ID = 1, Name = "Planned/Pending"
                    });
                    statuses.Add(new Status {
                        ID = 2, Name = "Canceled"
                    });
                    statuses.Add(new Status {
                        ID = 3, Name = "Completed"
                    });
                    statuses.Add(new Status {
                        ID = 4, Name = "In Progress"
                    });
                    statuses.Add(new Status {
                        ID = 5, Name = "Delayed"
                    });
                    statuses.Add(new Status {
                        ID = 6, Name = "Existing Risk Acceptance"
                    });
                    statuses.Add(new Status {
                        ID = 7, Name = "Risk Accpetance"
                    });
                    context.Statuses.AddRange(statuses);
                    context.SaveChanges();
                }

                var delayReasons = new List <DelayReason>();
                if (!context.DelayReasons.Any())
                {
                    delayReasons.Add(new DelayReason {
                        ID = 1, Name = "Weakness/Priority changed"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 2, Name = "Original completetion time underestimated"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 3, Name = "Funds not allocated/Insufficient funding"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 4, Name = "Assigned funds withdrawn"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 5, Name = "Dependency on other task(s)"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 6, Name = "Contractor delay"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 7, Name = "Procurement delay"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 8, Name = "Personnel shortage"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 9, Name = "Technology delay/dependency"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 10, Name = "Policy delay/dependency"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 11, Name = "Moratorium on development"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 12, Name = "Other"
                    });
                    delayReasons.Add(new DelayReason {
                        ID = 13, Name = "Not Applicable"
                    });
                    context.DelayReasons.AddRange(delayReasons);
                    context.SaveChanges();
                }

                var responsiblepocs = new List <ResponsiblePOC>();
                if (!context.ResponsiblePOCs.Any())
                {
                    responsiblepocs.Add(new ResponsiblePOC {
                        ID = new Guid(), Name = "Lai Lee-Birman", Description = "System Owner"
                    });
                    responsiblepocs.Add(new ResponsiblePOC {
                        ID = new Guid(), Name = "SOC", Description = "Security Office"
                    });
                    responsiblepocs.Add(new ResponsiblePOC {
                        ID = new Guid(), Name = "Jeremy Holmes", Description = "Information Steward"
                    });
                    context.ResponsiblePOCs.AddRange(responsiblepocs);
                    context.SaveChanges();
                }

                if (env.IsProduction())
                {
                    return;
                }

                if (!context.POAMs.Any())
                {
                    var weakness = new Weakness();
                    if (!context.Weaknesses.Any())
                    {
                        //weakness.ID = 1;
                        weakness.OriginalRecommendation = @"REGIS is not currently PIV-enabled.";
                        weakness.Risk = @"Risk: Lack of PIV implementation leaves the system more 
                                vulnerable to unauthorized access, making financial data that is transmitted through 
                                REGIS more vulnerable to unauthorized disclosure and modification.";
                    }

                    string recommendation = @"The Assessment Team recommends raising the Risk Level of this POAM from 
                                            Moderate to High as the scheduled completion date for PIV compliance was September 30, 2015.
                                            The Assessment Team recommends removing IA-7 from this POAM, as REGIS does not have any 
                                            cryptographic modules within its authorization boundary.The System Owner and developers 
                                            have determined that MyAccess is not an option for PIV implementation; the team is 
                                            researching the use of Integrated Windows Authentication (IWA) for PIV-enabled access.
                                            This POAM is delayed due to the System Owner working with the developers to determine 
                                            if IWA is a suitable option to implement PIV authentication; it was determined 
                                            that MyAccess was not a viable solution.";

                    var poam = new POAM
                    {
                        ActualFinishDate        = null,
                        ActualStartDate         = null,
                        AuthSystem              = authSystems.SingleOrDefault(item => item.Name == "REGIS"),
                        ControlID               = @"IA-2(1), IA-2(2), IA-2(8), IA-2(12), IA-5(2), IA-5(11), IA-7",
                        CostJustification       = @"Minimum Organizational Cost",
                        CreateDate              = DateTime.Now,
                        CSAMPOAMID              = "55475",
                        DelayReason             = delayReasons.FirstOrDefault(item => item.Name.StartsWith("Technology", StringComparison.OrdinalIgnoreCase)),
                        Number                  = 1,
                        PlannedFinishDate       = new DateTime(2018, 5, 1),
                        PlannedStartDate        = new DateTime(2017, 5, 1),
                        Recommendation          = recommendation,
                        ResourcesRequired       = 100.0M,
                        ResponsiblePOCs         = responsiblepocs.Where(item => item.Name == "Lai Lee-Birman" || item.Name == "SOC").ToList(),
                        RiskLevel               = riskLevels.SingleOrDefault(item => item.Name == "H"),
                        ScheduledCompletionDate = new DateTime(2016, 9, 1),
                        Status                  = statuses.SingleOrDefault(item => item.Name == "Delayed"),
                        Weakness                = weakness
                    };
                    context.POAMs.Add(poam);

                    weakness = new Weakness();
                    if (!context.Weaknesses.Any())
                    {
                        //weakness.ID = 2;
                        weakness.OriginalRecommendation = @"RA-2: During the assessment, REGIS information system data types were not validated by the Information Steward.
                                                            PL-2:  The System Characterization was unable to be properly updated with the most accurate system data types. ";
                        weakness.Risk = @"Risk: The risk of not properly categorizing the system makes it difficult to understand the scope of REGIS 
                                            and what the effect might be on the overall security posture of the system which may lead to improper security settings and management.  ";
                    }

                    recommendation = @"The Assessment Team recommends that the REGIS Information Steward provide additional information on the types of data that are stored 
                                        and transmitted by the system, in order to correctly verify the Security Categorization. Data types should be mapped to Information 
                                        Types in accordance with SP 800-60, Volume II, to verify the accuracy of the current FIPS 199 and overall FIPS 200 level of Moderate.
                                        The System Characterization should be reviewed and updated as necessary to document all changes that have been made to the system.
                                        This POAM is delayed because the REGIS Information Steward did not verify that the list of data types listed in the SCD are comprehensive, 
                                        to include all data types that REGIS stores, transmits and processes. ";

                    poam = new POAM
                    {
                        ActualFinishDate        = null,
                        ActualStartDate         = new DateTime(2016, 9, 1),
                        AuthSystem              = authSystems.SingleOrDefault(item => item.Name == "REGIS"),
                        ControlID               = @"PL-2, RA-2",
                        CostJustification       = @"Minimum Organizational Cost",
                        CreateDate              = DateTime.Now,
                        CSAMPOAMID              = "60028",
                        DelayReason             = delayReasons.FirstOrDefault(item => item.Name.StartsWith("Other", StringComparison.OrdinalIgnoreCase)),
                        Number                  = 2,
                        PlannedFinishDate       = new DateTime(2018, 5, 1),
                        PlannedStartDate        = new DateTime(2017, 5, 1),
                        Recommendation          = recommendation,
                        ResourcesRequired       = 100.0M,
                        ResponsiblePOCs         = responsiblepocs.Where(item => item.Name.Contains("Jeremy")).ToList(),
                        RiskLevel               = riskLevels.SingleOrDefault(item => item.Name == "H"),
                        ScheduledCompletionDate = new DateTime(2016, 9, 1),
                        Status                  = statuses.SingleOrDefault(item => item.Name == "Delayed"),
                        Weakness                = weakness
                    };
                    context.POAMs.Add(poam);
                    context.SaveChanges();
                }
            }
        }
Beispiel #18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TrainerId != 0L)
            {
                hash ^= TrainerId.GetHashCode();
            }
            if (TrainerKind != 0)
            {
                hash ^= TrainerKind.GetHashCode();
            }
            if (ScoutMethod != 0)
            {
                hash ^= ScoutMethod.GetHashCode();
            }
            if (Exclusivity != 0L)
            {
                hash ^= Exclusivity.GetHashCode();
            }
            if (TrainerBaseId != 0)
            {
                hash ^= TrainerBaseId.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Rarity != 0)
            {
                hash ^= Rarity.GetHashCode();
            }
            if (Role != 0)
            {
                hash ^= Role.GetHashCode();
            }
            if (MonsterId != 0UL)
            {
                hash ^= MonsterId.GetHashCode();
            }
            if (Move1Id != 0)
            {
                hash ^= Move1Id.GetHashCode();
            }
            if (Move2Id != 0)
            {
                hash ^= Move2Id.GetHashCode();
            }
            if (Move3Id != 0)
            {
                hash ^= Move3Id.GetHashCode();
            }
            if (Move4Id != 0)
            {
                hash ^= Move4Id.GetHashCode();
            }
            if (Weakness != 0)
            {
                hash ^= Weakness.GetHashCode();
            }
            if (StoryQuest != 0UL)
            {
                hash ^= StoryQuest.GetHashCode();
            }
            if (U16 != 0)
            {
                hash ^= U16.GetHashCode();
            }
            if (Passive1Id != 0)
            {
                hash ^= Passive1Id.GetHashCode();
            }
            if (Passive2Id != 0)
            {
                hash ^= Passive2Id.GetHashCode();
            }
            if (Passive3Id != 0)
            {
                hash ^= Passive3Id.GetHashCode();
            }
            if (Passive4Id != 0)
            {
                hash ^= Passive4Id.GetHashCode();
            }
            if (TeamSkill1Id != 0)
            {
                hash ^= TeamSkill1Id.GetHashCode();
            }
            if (TeamSkill2Id != 0)
            {
                hash ^= TeamSkill2Id.GetHashCode();
            }
            if (TeamSkill3Id != 0)
            {
                hash ^= TeamSkill3Id.GetHashCode();
            }
            if (TeamSkill4Id != 0)
            {
                hash ^= TeamSkill4Id.GetHashCode();
            }
            if (TeamSkill5Id != 0)
            {
                hash ^= TeamSkill5Id.GetHashCode();
            }
            if (U26 != 0)
            {
                hash ^= U26.GetHashCode();
            }
            if (U27 != 0)
            {
                hash ^= U27.GetHashCode();
            }
            if (Number != 0)
            {
                hash ^= Number.GetHashCode();
            }
            if (ScheduleId.Length != 0)
            {
                hash ^= ScheduleId.GetHashCode();
            }
            if (ExScheduleId.Length != 0)
            {
                hash ^= ExScheduleId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #19
0
        //Build a CardCat Object from JSON
        public static void BuildCardsFromJSON(ApplicationDbContext ctx, IWebHostEnvironment env, string JSONPath)
        {
            JArray obj = Newtonsoft.Json.JsonConvert.DeserializeObject <JArray>(File.ReadAllText(JSONPath));

            foreach (var result in obj)
            {
                Card        CardObj;
                Set         SetObj;
                SpecialCard SpecialCardObj;
                TrainerCard TrainerCardObj;
                PokemonCard PokemonCardObj;

                string WebPath = env.WebRootPath;

                WebClient webClient = new WebClient();

                Uri uriCardImageURL   = new Uri((string)result["imageUrl"]);
                Uri uriCardImageHiURL = new Uri((string)result["imageUrlHiRes"]);

                //Set base image directories
                string CardImageDirectory   = WebPath + "/Images/Cards/LowRes/" + uriCardImageURL.Segments.ElementAt(uriCardImageURL.Segments.Length - 2).TrimEnd('/');
                string CardImageHiDirectory = WebPath + "/Images/Cards/HighRes/" + uriCardImageHiURL.Segments.ElementAt(uriCardImageHiURL.Segments.Length - 2).TrimEnd('/');

                //Check if directory exists and create if it doesn't
                if (!Directory.Exists(CardImageDirectory))
                {
                    Directory.CreateDirectory(CardImageDirectory);
                }
                if (!Directory.Exists(CardImageHiDirectory))
                {
                    Directory.CreateDirectory(CardImageHiDirectory);
                }

                //Create the local image file paths
                string CardImageLocalFile   = uriCardImageURL.Segments.ElementAt(uriCardImageURL.Segments.Length - 2).TrimEnd('/') + uriCardImageURL.Segments.Last();
                string CardImageHiLocalFile = uriCardImageHiURL.Segments.ElementAt(uriCardImageHiURL.Segments.Length - 2).TrimEnd('/') + uriCardImageHiURL.Segments.Last();

                string CardImageLocalPath   = CardImageDirectory + "/" + CardImageLocalFile;
                string CardImageHiLocalPath = CardImageHiDirectory + "/" + CardImageHiLocalFile;

                try
                {
                    //Only download images if there isn't already a file with this name
                    if (!File.Exists(CardImageLocalPath))
                    {
                        webClient.DownloadFile(uriCardImageURL, CardImageLocalPath);
                    }
                }
                catch (System.Net.WebException we)
                {
                    Console.WriteLine("ERROR: " + we.Message + ": " + uriCardImageURL);
                    //throw we;
                }
                catch (Exception e)
                {
                    //ILogger logger = Get;
                    //logger.LogWarning("ERROR: " + e.Message + ": " + uriCardImageURL);
                    Console.WriteLine("ERROR: " + e.Message + ": " + uriCardImageURL);
                    throw e;
                }

                try
                {
                    //Only download images if there isn't already a file with this name
                    if (!File.Exists(CardImageHiLocalPath))
                    {
                        webClient.DownloadFile(uriCardImageHiURL, CardImageHiLocalPath);
                    }
                }
                catch (System.Net.WebException we)
                {
                    Console.WriteLine("ERROR: " + we.Message + ": " + uriCardImageHiURL);
                    //throw we;
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERROR: " + e.Message + ": " + uriCardImageHiURL);
                    throw e;
                }

                //Store the local image URL path for web access
                string CardImageLocalURL   = "/Images/Cards/LowRes/" + uriCardImageURL.Segments.ElementAt(uriCardImageURL.Segments.Length - 2) + CardImageLocalFile;
                string CardImageHiLocalURL = "/Images/Cards/HighRes/" + uriCardImageHiURL.Segments.ElementAt(uriCardImageHiURL.Segments.Length - 2) + CardImageHiLocalFile;


                //Get a Generic Set Object
                SetObj = ObjectBuilderHelper.GetSetByNameNoInsert(ctx, (string)result["set"]);

                switch ((string)result["supertype"])
                {
                case "Energy":
                    switch ((string)result["subtype"])
                    {
                    case "Basic":
                        //Basic Energy
                        CardObj = ctx.Cards.SingleOrDefault(m => m.CardName.Equals((string)result["name"]) && m.CardNum.Equals((string)result["number"]))
                                  ?? new Card
                        {
                            CardName            = (string)result["name"],
                            CardImageURL        = (string)result["imageUrl"],
                            CardImageHiURL      = (string)result["imageUrlHiRes"],
                            CardImageLocalURL   = CardImageLocalURL,
                            CardImageHiLocalURL = CardImageHiLocalURL,
                            CardCat             = ObjectBuilderHelper.GetCardCatByName(ctx, (string)result["supertype"]),
                            CardType            = ObjectBuilderHelper.GetCardTypeByName(ctx, (string)result["subtype"]),
                            Set            = ObjectBuilderHelper.GetSetByNameNoInsert(ctx, (string)result["set"]),
                            CardNum        = (string)result["number"],
                            Artist         = (string)result["artist"],
                            CardRarity     = ObjectBuilderHelper.GetCardRarityByName(ctx, (string)result["rarity"]),
                            LastUpdateDate = DateTime.Now
                        };

                        Console.WriteLine("INFO: Card: " + CardObj.CardNum + " " + CardObj.CardName);

                        ctx.AddOrUpdate(CardObj);
                        break;

                    case "Special":
                        //Special Energy
                        SpecialCardObj = ctx.SpecialCards.SingleOrDefault(m => m.CardName.Equals((string)result["name"]) && m.CardNum.Equals((string)result["number"]))
                                         ?? new SpecialCard
                        {
                            CardName            = (string)result["name"],
                            CardImageURL        = (string)result["imageUrl"],
                            CardImageHiURL      = (string)result["imageUrlHiRes"],
                            CardImageLocalURL   = CardImageLocalURL,
                            CardImageHiLocalURL = CardImageHiLocalURL,
                            CardCat             = ObjectBuilderHelper.GetCardCatByName(ctx, (string)result["supertype"]),
                            CardType            = ObjectBuilderHelper.GetCardTypeByName(ctx, (string)result["subtype"]),
                            Set            = ObjectBuilderHelper.GetSetByNameNoInsert(ctx, (string)result["set"]),
                            CardNum        = (string)result["number"],
                            Artist         = (string)result["artist"],
                            CardRarity     = ObjectBuilderHelper.GetCardRarityByName(ctx, (string)result["rarity"]),
                            LastUpdateDate = DateTime.Now
                        };

                        Console.WriteLine("INFO: Special Card: " + SpecialCardObj.CardNum + " " + SpecialCardObj.CardName);

                        //SpecialCardText
                        if (result["text"] != null && result["text"].HasValues)
                        {
                            List <SpecialCardSpecialCardText> specialCardCardTexts = new List <SpecialCardSpecialCardText>();
                            foreach (var textitem in result["text"])
                            {
                                SpecialCardText SpecialCardTextObj = ctx.SpecialCardTexts.SingleOrDefault(m => m.CardTextLine.Equals((string)textitem))
                                                                     ?? new SpecialCardText
                                {
                                    CardTextLine   = textitem.ToString(),
                                    LastUpdateDate = DateTime.Now
                                };

                                if (SpecialCardTextObj != null)
                                {
                                    SpecialCardSpecialCardText specialCardSpecialCardText = new SpecialCardSpecialCardText();
                                    //if (SpecialCardObj.SpecialCardSpecialCardTexts != null)
                                    //{
                                    //    specialCardSpecialCardText = SpecialCardTextObj.SpecialCardSpecialCardTexts.SingleOrDefault(m => m.CardID.Equals(SpecialCardObj.CardID) && m.CardTextID.Equals(SpecialCardTextObj.SpecialCardTextID));

                                    //    if (specialCardSpecialCardText == null)
                                    //    {

                                    //Check list for existing object
                                    if (!specialCardCardTexts.Exists(a => a.CardID.Equals(SpecialCardObj) && a.CardText.Equals(SpecialCardTextObj)))
                                    {
                                        if (SpecialCardObj.SpecialCardSpecialCardTexts != null)
                                        {
                                            specialCardSpecialCardText = SpecialCardTextObj.SpecialCardSpecialCardTexts.SingleOrDefault(m => m.CardID.Equals(SpecialCardObj) && m.CardTextID.Equals(SpecialCardTextObj));
                                        }

                                        if (specialCardSpecialCardText == null)
                                        {
                                            specialCardCardTexts.Add(
                                                new SpecialCardSpecialCardText
                                            {
                                                SpecialCard = SpecialCardObj,
                                                CardText    = SpecialCardTextObj
                                            }
                                                );
                                        }
                                    }
                                }
                            }

                            SpecialCardObj.SpecialCardSpecialCardTexts = specialCardCardTexts;
                        }
                        ctx.AddOrUpdate(SpecialCardObj);
                        break;

                    default:
                        break;
                    }
                    break;

                case "Pokémon":
                    //int ConvRetreatCost = 0;
                    //if (result["convertedRetreatCost"] is null)
                    //{
                    //    ConvRetreatCost = 0;
                    //} else
                    //{
                    //    ConvRetreatCost = (int)result["convertedRetreatCost"];
                    //}
                    int NationalPokedexNumValue = -1;
                    int HPValue = -1;

                    if (result["nationalPokedexNumber"] != null)
                    {
                        NationalPokedexNumValue = (int)result["nationalPokedexNumber"];
                    }

                    if (result["hp"] != null)
                    {
                        HPValue = (int)result["hp"];
                    }

                    //Set SetObj = ctx.Sets.SingleOrDefault(m => m.SetCode.Equals((string)result["SetCode"]));

                    PokemonCardObj = ctx.PokemonCards.SingleOrDefault(m => m.CardName.Equals((string)result["name"]) && m.CardNum.Equals((string)result["number"]) && m.SetID == SetObj.SetID)
                                     ?? new PokemonCard
                    {
                        CardName            = (string)result["name"],
                        CardImageURL        = (string)result["imageUrl"],
                        CardImageHiURL      = (string)result["imageUrlHiRes"],
                        CardImageLocalURL   = CardImageLocalURL,
                        CardImageHiLocalURL = CardImageHiLocalURL,
                        CardCat             = ObjectBuilderHelper.GetCardCatByName(ctx, (string)result["supertype"]),
                        CardType            = ObjectBuilderHelper.GetCardTypeByName(ctx, (string)result["subtype"]),
                        Set        = SetObj,
                        CardNum    = (string)result["number"],
                        Artist     = (string)result["artist"],
                        CardRarity = ObjectBuilderHelper.GetCardRarityByName(ctx, (string)result["rarity"]),
                        HP         = HPValue,
                        //ConvertedRetreatCost = ConvRetreatCost,
                        //ConvertedRetreatCost = GetValueOrDefault<int>(result["convertedRetreatCost"]),
                        NationalPokedexNumber = NationalPokedexNumValue,
                        EvolvesFrom           = (string)result["evolvesFrom"],
                        LastUpdateDate        = DateTime.Now
                    };

                    Console.WriteLine("INFO: Pokemon Card: " + PokemonCardObj.CardNum + " " + PokemonCardObj.CardName);

                    //PokemonTypes
                    if (result["types"] != null && result["types"].HasValues)
                    {
                        List <PokemonCardPokemonType> pokemonCardPokemonTypes = new List <PokemonCardPokemonType>();
                        foreach (var textitem in result["types"])
                        {
                            PokemonType PokemonTypeObj = GetPokemonTypeByName(ctx, (string)textitem);

                            pokemonCardPokemonTypes.Add(
                                new PokemonCardPokemonType
                            {
                                PokemonCard = PokemonCardObj,
                                PokemonType = PokemonTypeObj
                            }
                                );
                        }

                        PokemonCardObj.PokemonCardPokemonTypes = pokemonCardPokemonTypes;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    //EvolvesTo
                    if (result["evolvesTo"] != null && result["evolvesTo"].HasValues)
                    {
                        List <PokemonCardEvolvesTo> pokemonCardEvolvesTos = new List <PokemonCardEvolvesTo>();
                        foreach (var textitem in result["evolvesTo"])
                        {
                            EvolvesTo EvolvesToObj = GetEvolesToByName(ctx, (string)textitem);

                            //Check if the relationship exists and if not add it
                            if (EvolvesToObj != null)
                            {
                                PokemonCardEvolvesTo pokemonCardEvolvesTo = new PokemonCardEvolvesTo();
                                if (PokemonCardObj.PokemonCardEvolvesTos != null)
                                {
                                    pokemonCardEvolvesTo = PokemonCardObj.PokemonCardEvolvesTos.SingleOrDefault(m => m.CardID.Equals(PokemonCardObj) && m.EvolvesTo.Equals(EvolvesToObj));

                                    if (pokemonCardEvolvesTo == null)
                                    {
                                        pokemonCardEvolvesTos.Add(
                                            new PokemonCardEvolvesTo
                                        {
                                            PokemonCard = PokemonCardObj,
                                            EvolvesTo   = EvolvesToObj
                                        }
                                            );
                                    }
                                }
                                //else
                                //{
                                //    pokemonCardEvolvesTo.PokemonCard = PokemonCardObj;
                                //    pokemonCardEvolvesTo.EvolvesTo = EvolvesToObj;
                                //}
                            }
                        }

                        PokemonCardObj.PokemonCardEvolvesTos = pokemonCardEvolvesTos;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    //RetreatCosts
                    if (result["retreatCost"] != null && result["retreatCost"].HasValues)
                    {
                        List <PokemonCardRetreatCost> pokemonCardRetreatCosts = new List <PokemonCardRetreatCost>();
                        foreach (var textitem in result["retreatCost"])
                        {
                            EnergyType EnergyTypeObj = GetEnergyTypeByName(ctx, (string)textitem);

                            //Check if the relationship exists and if not add it
                            if (EnergyTypeObj != null)
                            {
                                PokemonCardRetreatCost pokemonCardRetreatCost = new PokemonCardRetreatCost();
                                if (PokemonCardObj.PokemonCardRetreatCosts != null)
                                {
                                    pokemonCardRetreatCost = PokemonCardObj.PokemonCardRetreatCosts.SingleOrDefault(m => m.CardID.Equals(PokemonCardObj.CardID) && m.EnergyType.Equals(EnergyTypeObj));

                                    if (pokemonCardRetreatCost == null)
                                    {
                                        //pokemonCardRetreatCosts.Add(
                                        //    new PokemonCardRetreatCost
                                        //    {
                                        //        PokemonCard = PokemonCardObj,
                                        //        EnergyType = EnergyTypeObj
                                        //    }
                                        //);
                                        pokemonCardRetreatCost.PokemonCard = PokemonCardObj;
                                        pokemonCardRetreatCost.EnergyType  = EnergyTypeObj;
                                    }
                                }
                                else
                                {
                                    pokemonCardRetreatCosts.Add(
                                        new PokemonCardRetreatCost
                                    {
                                        PokemonCard = PokemonCardObj,
                                        EnergyType  = EnergyTypeObj
                                    }
                                        );

                                    //pokemonCardRetreatCost.PokemonCard = PokemonCardObj;
                                    //pokemonCardRetreatCost.EnergyType = EnergyTypeObj;
                                }
                            }
                        }

                        PokemonCardObj.PokemonCardRetreatCosts = pokemonCardRetreatCosts;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    //Weaknesses
                    if (result["weaknesses"] != null && result["weaknesses"].HasValues)
                    {
                        //JArray obj2 = JArray.Parse(result["weaknesses"]);
                        //Newtonsoft.Json.JsonConvert.DeserializeObject<JArray>((string)result["weaknesses"]);
                        JArray obj2 = (JArray)result.SelectToken("weaknesses");

                        List <PokemonCardWeakness> pokemonCardWeaknesses = new List <PokemonCardWeakness>();

                        foreach (var result2 in obj2)
                        {
                            EnergyType EnergyTypeObj = GetEnergyTypeByName(ctx, (string)result2["type"]);

                            //Check list for existing object
                            if (!pokemonCardWeaknesses.Exists(a => a.Weakness.EnergyType.Equals(EnergyTypeObj) &&
                                                              a.Weakness.WeaknessValue.Equals((string)result2["value"])))
                            {
                                Weakness WeaknessObj = ctx.Weaknesses.SingleOrDefault(m => m.EnergyType.Equals(EnergyTypeObj) && m.WeaknessValue.Equals((string)result2["value"]))
                                                       ?? new Weakness
                                {
                                    EnergyType     = EnergyTypeObj,
                                    WeaknessValue  = (string)result2["value"],
                                    LastUpdateDate = DateTime.Now
                                };

                                //Check if the relationship exists and if not add it
                                if (WeaknessObj != null)
                                {
                                    PokemonCardWeakness pokemonCardWeakness = new PokemonCardWeakness();
                                    if (PokemonCardObj.PokemonCardWeaknesses != null)
                                    {
                                        pokemonCardWeakness = PokemonCardObj.PokemonCardWeaknesses.SingleOrDefault(m => m.CardID.Equals(PokemonCardObj.CardID) && m.Weakness.Equals(WeaknessObj));

                                        if (pokemonCardWeakness == null)
                                        {
                                            pokemonCardWeaknesses.Add(
                                                new PokemonCardWeakness
                                            {
                                                PokemonCard = PokemonCardObj,
                                                Weakness    = WeaknessObj
                                            }
                                                );
                                        }
                                    }
                                }
                            }
                        }

                        PokemonCardObj.PokemonCardWeaknesses = pokemonCardWeaknesses;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    //Resistance
                    if (result["resistances"] != null && result["resistances"].HasValues)
                    {
                        //JArray obj2 = JArray.Parse(result["weaknesses"]);
                        //Newtonsoft.Json.JsonConvert.DeserializeObject<JArray>((string)result["weaknesses"]);
                        JArray obj2 = (JArray)result.SelectToken("resistances");

                        List <PokemonCardResistance> pokemonCardResistances = new List <PokemonCardResistance>();

                        foreach (var result2 in obj2)
                        {
                            EnergyType EnergyTypeObj = GetEnergyTypeByName(ctx, (string)result2["type"]);

                            //Check if list already has the object in it
                            if (!pokemonCardResistances.Exists(a => a.Resistance.EnergyType.Equals(EnergyTypeObj) &&
                                                               a.Resistance.ResistanceValue.Equals((string)result2["value"])))
                            {
                                Resistance ResistanceObj = ctx.Resistances.SingleOrDefault(m => m.EnergyType.Equals(EnergyTypeObj) && m.ResistanceValue.Equals((string)result2["value"]))
                                                           ?? new Resistance
                                {
                                    EnergyType      = EnergyTypeObj,
                                    ResistanceValue = (string)result2["value"],
                                    LastUpdateDate  = DateTime.Now
                                };

                                if (ResistanceObj != null)
                                {
                                    PokemonCardResistance pokemonCardResistance = new PokemonCardResistance();
                                    if (PokemonCardObj.PokemonCardResistances != null)
                                    {
                                        pokemonCardResistance = PokemonCardObj.PokemonCardResistances.SingleOrDefault(m => m.CardID.Equals(PokemonCardObj.CardID) && m.Resistance.Equals(ResistanceObj));

                                        if (pokemonCardResistance == null)
                                        {
                                            pokemonCardResistances.Add(
                                                new PokemonCardResistance
                                            {
                                                PokemonCard = PokemonCardObj,
                                                Resistance  = ResistanceObj
                                            }
                                                );
                                        }
                                    }
                                }
                                //ctx.AddOrUpdate(pokemonCardResistances);
                                //ctx.SaveChanges();
                            }
                        }

                        PokemonCardObj.PokemonCardResistances = pokemonCardResistances;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    //Ability
                    if (result["ability"] != null && result["ability"].HasValues)
                    {
                        //JArray obj2 = JArray.Parse(result["weaknesses"]);
                        //Newtonsoft.Json.JsonConvert.DeserializeObject<JArray>((string)result["weaknesses"]);
                        JObject AbilityJSON = (JObject)result.SelectToken("ability");

                        List <PokemonCardAbility> pokemonCardAbilities = new List <PokemonCardAbility>();

                        //foreach (var result2 in obj2)
                        //{
                        // EnergyType EnergyTypeObj = GetEnergyTypeByName(ctx, (string)result2["type"]);
                        Ability AbilityObj = ctx.Abilities.SingleOrDefault(m => m.AbilityName.Equals((string)AbilityJSON["name"]) && m.AbilityText.Equals((string)AbilityJSON["text"]))
                                             ?? new Ability
                        {
                            AbilityName    = (string)AbilityJSON["name"],
                            AbilityText    = (string)AbilityJSON["text"],
                            AbilityType    = (string)AbilityJSON["type"],
                            LastUpdateDate = DateTime.Now
                        };

                        //Check if the relationship exists and if not add it
                        if (AbilityObj != null)
                        {
                            PokemonCardAbility pokemonCardAbility = new PokemonCardAbility();
                            if (PokemonCardObj.PokemonCardAbilities != null)
                            {
                                pokemonCardAbility = PokemonCardObj.PokemonCardAbilities.SingleOrDefault(m => m.CardID.Equals(PokemonCardObj.CardID) && m.Ability.Equals(AbilityObj));
                            }

                            if (pokemonCardAbility.Ability == null)
                            {
                                pokemonCardAbilities.Add(
                                    new PokemonCardAbility
                                {
                                    PokemonCard = PokemonCardObj,
                                    Ability     = AbilityObj
                                }
                                    );
                            }
                        }
                        //}

                        PokemonCardObj.PokemonCardAbilities = pokemonCardAbilities;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    //Attack
                    if (result["attacks"] != null && result["attacks"].HasValues)
                    {
                        JArray obj2 = (JArray)result.SelectToken("attacks");

                        List <PokemonCardAttack> pokemonCardAttacks = new List <PokemonCardAttack>();

                        foreach (var result2 in obj2)
                        {
                            //EnergyType EnergyTypeObj = GetEnergyTypeByName(ctx, (string)result2["type"]);
                            Attack AttackObj = ctx.Attacks.SingleOrDefault(m => m.AttackName.Equals((string)result2["name"]) && m.AttackText.Equals((string)result2["text"]))
                                               ?? new Attack
                            {
                                //EnergyType = EnergyTypeObj,
                                AttackName = (string)result2["name"],
                                AttackConvertedEnergyCost = (int)result2["convertedEnergyCost"],
                                AttackDamage   = (string)result2["damage"],
                                AttackText     = (string)result2["text"],
                                LastUpdateDate = DateTime.Now
                            };

                            //Energy for Attack
                            if (result2["cost"] != null && result2["cost"].HasValues)
                            {
                                List <AttackEnergy> attackEnergies = new List <AttackEnergy>();
                                foreach (var textitem in result2["cost"])
                                {
                                    EnergyType EnergyTypeObj = GetEnergyTypeByName(ctx, (string)textitem);

                                    attackEnergies.Add(
                                        new AttackEnergy
                                    {
                                        Attack     = AttackObj,
                                        EnergyType = EnergyTypeObj
                                    }
                                        );
                                }

                                AttackObj.AttackEnergies = attackEnergies;
                            }

                            //Check if the relationship exists and if not add it
                            if (AttackObj != null)
                            {
                                PokemonCardAttack pokemonCardAttack = new PokemonCardAttack();
                                if (PokemonCardObj.PokemonCardAttacks != null)
                                {
                                    pokemonCardAttack = PokemonCardObj.PokemonCardAttacks.SingleOrDefault(m => m.CardID.Equals(PokemonCardObj.CardID) && m.Attack.Equals(AttackObj));
                                }

                                if (pokemonCardAttack.Attack == null)
                                {
                                    pokemonCardAttacks.Add(
                                        new PokemonCardAttack
                                    {
                                        PokemonCard = PokemonCardObj,
                                        Attack      = AttackObj
                                    }
                                        );
                                }
                            }
                        }

                        PokemonCardObj.PokemonCardAttacks = pokemonCardAttacks;
                    }

                    ctx.AddOrUpdate(PokemonCardObj);
                    ctx.SaveChanges();

                    ctx.AddOrUpdate(PokemonCardObj);
                    break;

                case "Trainer":
                    TrainerCardObj = ctx.TrainerCards.SingleOrDefault(m => m.CardName.Equals((string)result["name"]) && m.CardNum.Equals((string)result["number"]))
                                     ?? new TrainerCard
                    {
                        CardName            = (string)result["name"],
                        CardImageURL        = (string)result["imageUrl"],
                        CardImageHiURL      = (string)result["imageUrlHiRes"],
                        CardImageLocalURL   = CardImageLocalURL,
                        CardImageHiLocalURL = CardImageHiLocalURL,
                        CardCat             = ObjectBuilderHelper.GetCardCatByName(ctx, (string)result["supertype"]),
                        CardType            = ObjectBuilderHelper.GetCardTypeByName(ctx, (string)result["subtype"]),
                        Set            = ObjectBuilderHelper.GetSetByNameNoInsert(ctx, (string)result["set"]),
                        CardNum        = (string)result["number"],
                        Artist         = (string)result["artist"],
                        CardRarity     = ObjectBuilderHelper.GetCardRarityByName(ctx, (string)result["rarity"]),
                        LastUpdateDate = DateTime.Now
                    };

                    Console.WriteLine("INFO: Trainer Card: " + TrainerCardObj.CardNum + " " + TrainerCardObj.CardName);

                    if (result["text"] != null && result["text"].HasValues)
                    {
                        List <TrainerCardTrainerCardText> trainerCardCardTexts = new List <TrainerCardTrainerCardText>();
                        foreach (var textitem in result["text"])
                        {
                            TrainerCardText TrainerCardTextObj = ctx.TrainerCardTexts.SingleOrDefault(m => m.CardTextLine.Equals((string)textitem))
                                                                 ?? new TrainerCardText
                            {
                                CardTextLine   = textitem.ToString(),
                                LastUpdateDate = DateTime.Now
                            };

                            if (TrainerCardTextObj != null)
                            {
                                TrainerCardTrainerCardText trainerCardTrainerCardText = new TrainerCardTrainerCardText();
                                //if (TrainerCardObj.TrainerCardTrainerCardTexts == null)
                                //{

                                //Check list for existing object
                                if (!trainerCardCardTexts.Exists(a => a.CardID.Equals(TrainerCardObj) && a.CardTextID.Equals(TrainerCardTextObj)))
                                {
                                    if (TrainerCardObj.TrainerCardTrainerCardTexts != null)
                                    {
                                        trainerCardTrainerCardText = TrainerCardTextObj.TrainerCardTrainerCardTexts.SingleOrDefault(m => m.CardID.Equals(TrainerCardObj) && m.CardTextID.Equals(TrainerCardTextObj));
                                    }

                                    if (trainerCardTrainerCardText == null)
                                    {
                                        trainerCardCardTexts.Add(
                                            new TrainerCardTrainerCardText
                                        {
                                            TrainerCard = TrainerCardObj,
                                            CardText    = TrainerCardTextObj
                                        }
                                            );
                                    }
                                }
                            }
                        }

                        TrainerCardObj.TrainerCardTrainerCardTexts = trainerCardCardTexts;
                    }
                    ctx.AddOrUpdate(TrainerCardObj);
                    break;

                default:
                    break;
                }
                //If Card - CardCat = Energy, CardType = Basic
                //If SpecialCard - CardCat = Energy. CardType = Special
                //If PokemonCard
                //If TrainerCar
                //GetCardByName(ctx, (string)result["pokemontypename"]);

                ctx.SaveChanges();
            }
        }
Beispiel #20
0
 public PokemonCard(Rarity rarity, TCGType type, TCGPokemon pokemon, Stage stage, HP hp, TCGPokemonMove[] moves, Weakness weakness, Resistance resistance, EnergyCost[] retreatCost)
     : this(rarity, type, pokemon, stage, hp, moves, weakness, resistance, retreatCost, null)
 {
 }
Beispiel #21
0
 //Weakness
 public override void OnBeginWeaknessInteraction(Weakness weakness)
 {
     weakness.OnInteract(projectile);
 }
Beispiel #22
0
 //Weakness
 public override void OnBeginWeaknessInteraction(Weakness weakness)
 {
     trace.Color = Parameter.WeatherEffectWeaknessColorModifier;
 }
 public XRoot(Weakness root) {
     this.doc = new XDocument(root.Untyped);
     this.rootObject = root;
 }
Beispiel #24
0
 public void RemoveWeakness(Element element)
 {
     Weakness.Remove(element);
 }
Beispiel #25
0
 public PokemonCard(Rarity rarity, TCGType type, TCGPokemon pokemon, Stage stage, HP hp, TCGPokemonMove[] moves, Weakness weakness, EnergyCost[] retreatCost, TCGPokemonPower pokemonPower)
     : this(rarity, type, pokemon, stage, hp, moves, weakness, null, retreatCost, pokemonPower)
 {
 }
Beispiel #26
0
        public virtual void Consume(Player player)
        {
            Effect e = null;

            switch (Metadata)
            {
            case 5:
                e = new NightVision
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 6:
                e = new NightVision
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 7:
                e = new Invisibility
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 8:
                e = new Invisibility
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 9:
                e = new JumpBoost
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 10:
                e = new JumpBoost
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 11:
                e = new JumpBoost
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 12:
                e = new FireResistance
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 13:
                e = new FireResistance
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 14:
                e = new Speed
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 15:
                e = new Speed
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 16:
                e = new Speed
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 17:
                e = new Slowness
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 18:
                e = new Slowness
                {
                    Duration = 4800,
                    Level    = 0
                };
                break;

            case 19:
                e = new WaterBreathing
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 20:
                e = new WaterBreathing
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 21:
                e = new InstantHealth
                {
                    Duration = 0,
                    Level    = 0
                };
                break;

            case 22:
                e = new InstantHealth
                {
                    Duration = 0,
                    Level    = 1
                };
                break;

            case 23:
                e = new InstantDamage
                {
                    Duration = 0,
                    Level    = 0
                };
                break;

            case 24:
                e = new InstantDamage
                {
                    Duration = 0,
                    Level    = 1
                };
                break;

            case 25:
                e = new Poison
                {
                    Duration = 900,
                    Level    = 0
                };
                break;

            case 26:
                e = new Poison
                {
                    Duration = 2400,
                    Level    = 0
                };
                break;

            case 27:
                e = new Poison
                {
                    Duration = 440,
                    Level    = 1
                };
                break;

            case 28:
                e = new Regeneration
                {
                    Duration = 900,
                    Level    = 0
                };
                break;

            case 29:
                e = new Regeneration
                {
                    Duration = 2400,
                    Level    = 0
                };
                break;

            case 30:
                e = new Regeneration
                {
                    Duration = 440,
                    Level    = 1
                };
                break;

            case 31:
                e = new Strength
                {
                    Duration = 3600,
                    Level    = 0
                };
                break;

            case 32:
                e = new Strength
                {
                    Duration = 9600,
                    Level    = 0
                };
                break;

            case 33:
                e = new Strength
                {
                    Duration = 1800,
                    Level    = 1
                };
                break;

            case 34:
                e = new Weakness
                {
                    Duration = 1800,
                    Level    = 0
                };
                break;

            case 35:
                e = new Weakness
                {
                    Duration = 4800,
                    Level    = 0
                };
                break;
            }

            if (e != null)
            {
                player.SetEffect(e);
            }
        }
Beispiel #27
0
 public PokemonCard(Rarity rarity, TCGType type, TCGPokemon pokemon, Stage stage, HP hp, TCGPokemonMove[] moves, Weakness weakness, Resistance resistance, EnergyCost[] cost, TCGPokemonPower pokemonPower)
     : base(rarity, pokemon.ToString())
 {
     this.Type        = type;
     this.Pokemon     = pokemon;
     this.Stage       = stage;
     this.HP          = hp;
     this.Moves       = moves;
     this.Weakness    = weakness;
     this.Resistance  = resistance;
     this.RetreatCost = RetreatCost;
     this.Power       = pokemonPower;
 }
Beispiel #28
0
        public void Effect(Player player, string effect, int level = 1, int duration = 20)
        {
            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strenght:
                    eff = new Strength();
                    break;

                case EffectType.InstandHealth:
                    eff = new InstandHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;

                case EffectType.Glowing:
                    eff = new Glowing();
                    break;

                case EffectType.Levitation:
                    eff = new Levitation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage(string.Format("{0} added effect {1} with strenght {2}", player.Username, effectType, level), MessageType.Raw);
                }
            }
        }
Beispiel #29
0
        public void Effect(Player player, string effect, int level, int duration)
        {
            if ("clear".Equals(effect, StringComparison.InvariantCultureIgnoreCase))
            {
                player.Level.BroadcastMessage($"Removed all effects for {player.Username}.", MessageType.Raw);
                player.RemoveAllEffects();
                return;
            }

            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strength:
                    eff = new Strength();
                    break;

                case EffectType.InstantHealth:
                    eff = new InstantHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage($"{player.Username} added effect {effectType} with strenght {level}", MessageType.Raw);
                }
            }
        }
Beispiel #30
0
 public PokemonCard(Rarity rarity, TCGType type, TCGPokemon pokemon, Stage stage, HP hp, TCGPokemonMove[] moves, Weakness weakness, Resistance resistance)
     : this(rarity, type, pokemon, stage, hp, moves, weakness, resistance, null, null)
 {
 }
Beispiel #31
0
        private static Effect GetEffect(EffectType prim)
        {
            Effect eff = null;

            switch (prim)
            {
            case EffectType.Speed:
                eff = new Speed();
                break;

            case EffectType.Slowness:
                eff = new Slowness();
                break;

            case EffectType.Haste:
                eff = new Haste();
                break;

            case EffectType.MiningFatigue:
                eff = new MiningFatigue();
                break;

            case EffectType.Strength:
                eff = new Strength();
                break;

            case EffectType.InstantHealth:
                eff = new InstantHealth();
                break;

            case EffectType.InstantDamage:
                eff = new InstantDamage();
                break;

            case EffectType.JumpBoost:
                eff = new JumpBoost();
                break;

            case EffectType.Nausea:
                eff = new Nausea();
                break;

            case EffectType.Regeneration:
                eff = new Regeneration();
                break;

            case EffectType.Resistance:
                eff = new Resistance();
                break;

            case EffectType.FireResistance:
                eff = new FireResistance();
                break;

            case EffectType.WaterBreathing:
                eff = new WaterBreathing();
                break;

            case EffectType.Invisibility:
                eff = new Invisibility();
                break;

            case EffectType.Blindness:
                eff = new Blindness();
                break;

            case EffectType.NightVision:
                eff = new NightVision();
                break;

            case EffectType.Hunger:
                eff = new Hunger();
                break;

            case EffectType.Weakness:
                eff = new Weakness();
                break;

            case EffectType.Poison:
                eff = new Poison();
                break;

            case EffectType.Wither:
                eff = new Wither();
                break;

            case EffectType.HealthBoost:
                eff = new HealthBoost();
                break;

            case EffectType.Absorption:
                eff = new Absorption();
                break;

            case EffectType.Saturation:
                eff = new Saturation();
                break;
            }
            return(eff);
        }
Beispiel #32
0
 public void AddWeakness(Element element)
 {
     Weakness.Add(element);
 }