Пример #1
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void LoadingFinished()
        {
            this.RarityData = CsvFiles.Get(Gamefile.Rarities).GetData <RarityData>(this.Rarity);

            if (this.RarityData == null)
            {
                throw new Exception("Spell " + this.GlobalId + " rarity is NULL.");
            }

            this.UnlockArenaData = CsvFiles.Get(Gamefile.Arenas).GetData <ArenaData>(this.UnlockArena);

            if (this.UnlockArenaData == null)
            {
                throw new Exception("UnlockArena not defined for spell " + this.GlobalId + ".");
            }

            if (!string.IsNullOrEmpty(this.ReleaseDate))
            {
                if (this.ReleaseDate == "Soon")
                {
                    this.ReleaseDateTime = new DateTime(2020, 1, 1);
                }
                else if (!DateTime.TryParse(this.ReleaseDate, out this.ReleaseDateTime))
                {
                    throw new Exception("ReleaseDate must be in format YYYY-MM-DD!");
                }
            }

            if (!this.NotInUse)
            {
                CsvFiles.Spells.Add(this);
            }
        }
Пример #2
0
        /// <summary>
        ///     Gets the chance for specified rarity.
        /// </summary>
        public int GetChanceForRarity(RarityData Data)
        {
            int Chance;

            if (this.BaseTreasureChestData != null)
            {
                if (this.ArenaData.GetUnlockedSpellCountForRarity(Data) < 1)
                {
                    return(0);
                }

                Chance = this.BaseTreasureChestData.GetChanceForRarity(Data);
            }
            else
            {
                switch (Data.Name)
                {
                case "Legendary":
                {
                    Chance = this.LegendaryChance;
                    break;
                }

                case "Epic":
                {
                    Chance = this.EpicChance;
                    break;
                }

                case "Rare":
                {
                    Chance = this.RareChance;
                    break;
                }

                default:
                {
                    Chance = 1;
                    break;
                }
                }
            }

            return(Chance);
        }
Пример #3
0
 /// <summary>
 ///     Gets the unlocked spell count for specified rarity.
 /// </summary>
 public int GetUnlockedSpellCountForRarity(RarityData Rarity)
 {
     return(this.UnlockedSpellsData[Rarity.Instance].Count);
 }