示例#1
0
 private int GetWeight(Tiered <Item> tiered, Item item)
 {
     if (radioTreasure.Checked)
     {
         return(RandoTreasure.GetTreasureWeight(tiered, false, false));
     }
     else
     {
         return(RandoEnemies.GetDropWeight(tiered, (int)numericLevel.Value, SelectedType(), item.ID.StartsWith("it") && numericLevel.Value > 50));
     }
 }
示例#2
0
 public static int GetTreasureWeight(Tiered <Item> t, bool mission, bool missableOrRepeatable)
 {
     if (mission && t == TieredItems.Gil)
     {
         return(0);
     }
     if (missableOrRepeatable && t.Items.Where(i => i.ID.StartsWith("wea_")).Count() > 0)
     {
         return(0);
     }
     if (missableOrRepeatable && t.Items.Where(i => i.ID.StartsWith("material_o")).Count() > 0)
     {
         return((int)Math.Max(1, t.Weight * 4));
     }
     if (missableOrRepeatable && t.Items.Where(i => i.ID.StartsWith("material")).Count() > 0)
     {
         return((int)Math.Max(1, t.Weight * 8));
     }
     if (t.Items.Where(i => i.ID.StartsWith("it")).Count() > 0)
     {
         return(Math.Max(1, t.Weight * 4));
     }
     if (t.Items.Where(i => i.ID.StartsWith("acc")).Count() > 0)
     {
         return((int)Math.Max(1, t.Weight * 1.2));
     }
     if (t.Items.Where(i => i.ID.StartsWith("material_o")).Count() > 0)
     {
         return((int)Math.Max(1, t.Weight / 1.2));
     }
     if (t.Items.Where(i => i.ID.StartsWith("material")).Count() > 0)
     {
         return((int)Math.Max(1, t.Weight * 0.9));
     }
     return((int)(t.Weight * 2));
 }
示例#3
0
        public override void Randomize(BackgroundWorker backgroundWorker)
        {
            int rankAdj = Flags.ItemFlags.Drops.Range.Value;

            Items.items.ForEach(i =>
            {
                if (i.ID.StartsWith("wea_") && i.ID.EndsWith("_001"))
                {
                    blacklistedWeapons.Add(i);
                }
            });

            Dictionary <Treasure, Tuple <Item, int> > plando = main.treasurePlando1.GetTreasures();

            if (Flags.ItemFlags.Treasures)
            {
                plando.Values.ForEach(i =>
                {
                    if (i.Item1.ID.StartsWith("wea_") && i.Item1.ID.EndsWith("_001"))
                    {
                        blacklistedWeapons.Add(i.Item1);
                    }
                });
            }

            int completed = 0, index = -1;

            Flags.ItemFlags.Treasures.SetRand();
            treasures.IdList.Where(id => !id.ID.StartsWith("!")).ForEach(tID =>
            {
                Treasure current    = Treasures.treasures.Find(tr => tr.ID == tID.ID);
                DataStoreTreasure t = treasures[tID.ID];
                index++;
                Item item = Items.items.Where(i => i.ID == t.ItemID).FirstOrDefault();
                int rank  = -1;
                if (item != null && Flags.ItemFlags.Treasures)
                {
                    if (current != null && plando.ContainsKey(current))
                    {
                        Item newItem = plando[current].Item1;
                        int amount   = plando[current].Item2;
                        if (amount == -1)
                        {
                            Tiered <Item> tiered = TieredItems.manager.list.Find(tier => tier.Items.Contains(newItem));
                            amount = tiered.GetCount(RandomNum.RandInt(tiered.LowBound, tiered.HighBound), Int32.MaxValue);
                        }
                        t.ItemID = newItem.ID;
                        t.Count  = (uint)amount;
                    }
                    else
                    {
                        rank = TieredItems.manager.GetRank(item, (int)t.Count);
                        if (rank != -1)
                        {
                            if (rankAdj > 0)
                            {
                                rank = RandomNum.RandInt(Math.Max(0, rank - rankAdj), Math.Min(TieredItems.manager.GetHighBound(), rank + rankAdj));
                            }
                            Tuple <Item, int> newItem;
                            rank++;
                            do
                            {
                                rank--;
                                newItem = TieredItems.manager.Get(rank, Int32.MaxValue, tiered =>
                                                                  GetTreasureWeight(tiered, tID.ID.StartsWith("tre_ms"),
                                                                                    (tID.ID.StartsWith("tre_ms") && tID.ID.EndsWith("02")) ||
                                                                                    (tID.ID.StartsWith("tre_vpek") && Int32.Parse(tID.ID.Substring(tID.ID.Length - 3)) >= 26)));
                            } while (rank >= 0 && (newItem.Item1 == null || blacklistedWeapons.Contains(newItem.Item1)));
                            if (newItem.Item1.ID.StartsWith("wea_"))
                            {
                                blacklistedWeapons.Add(newItem.Item1);
                            }
                            t.ItemID = newItem.Item1.ID;
                            t.Count  = (uint)newItem.Item2;
                        }
                    }
                }

                ranks[index] = rank;

                completed++;

                backgroundWorker.ReportProgress(completed * 100 / treasures.DataList.Count);
            });
            RandomNum.ClearRand();

            if (Flags.ItemFlags.ShopLocations)
            {
                ShopMappings.Clear();
                Dictionary <Item, Item> shops = main.shopOrderPlando1.GetShopReplacements();

                List <string> shopsRemaining = new List <string>();

                Flags.ItemFlags.ShopLocations.SetRand();
                for (int i = 1; i <= 13; i++)
                {
                    string id = "key_shop_" + i.ToString("00");
                    if (i == 4 || shops.Values.Where(item => item.ID == id).Count() > 0)
                    {
                        continue;
                    }
                    shopsRemaining.Add(id);
                }
                shopsRemaining.Shuffle();

                ShopMappings.Add("key_shop_00", "key_shop_00");
                for (int i = 1; i <= 13; i++)
                {
                    string id = "key_shop_" + i.ToString("00");
                    if (i == 4)
                    {
                        continue;
                    }
                    if (shops.Keys.Where(item => item.ID == id).Count() > 0)
                    {
                        ShopMappings.Add(id, shops[shops.Keys.Where(item => item.ID == id).First()].ID);
                    }
                    else
                    {
                        ShopMappings.Add(id, shopsRemaining[0]);
                        shopsRemaining.RemoveAt(0);
                    }
                }

                treasures.DataList.ForEach(treasure =>
                {
                    if (treasure.ItemID.StartsWith("key_shop_"))
                    {
                        treasure.ItemID = ShopMappings[treasure.ItemID];
                    }
                });
                RandomNum.ClearRand();
            }
        }
示例#4
0
        public static int GetDropWeight(Tiered <Item> t, int enemyLevel, EnemyType type, bool forceNormalDrop)
        {
            if (t.Items.Where(i => i.ID == "").Count() > 0)
            {
                return(0);
            }
            float mult;

            if (type == EnemyType.Boss && !forceNormalDrop)
            {
                mult = 1 + .01f * (float)Math.Pow(enemyLevel - 50, .8f);
                if (t.Items.Where(i => i.ID.StartsWith("material_o")).Count() > 0)
                {
                    return((int)(t.Weight * 1.8 * mult));
                }
                if (t.Items.Where(i => i.ID.StartsWith("material")).Count() > 0)
                {
                    return(0);
                }
                if (t.Items.Where(i => i.ID.StartsWith("it")).Count() > 0)
                {
                    return(Math.Max(1, t.Weight / 4));
                }
                return((int)(t.Weight * 2 * mult));
            }
            else if (type == EnemyType.Rare)
            {
                mult = 1 + .01f * (float)Math.Pow(enemyLevel, .8f);
                if (t.Items.Where(i => i.ID.StartsWith("material_o")).Count() > 0)
                {
                    return((int)(t.Weight * 4.5 * mult));
                }
                if (t.Items.Where(i => i.ID.StartsWith("material")).Count() > 0)
                {
                    return((int)Math.Max(1, t.Weight / 1.5));
                }
                if (t.Items.Where(i => i.ID.StartsWith("wea_")).Count() > 0)
                {
                    return(0);
                }
                return((int)(t.Weight * mult));
            }
            else
            {
                mult = 1 + .01f * (float)Math.Pow(enemyLevel, .8f);
                if (t.Items.Where(i => i.ID.StartsWith("material_o")).Count() > 0)
                {
                    return((int)(t.Weight));
                }
                if (t.Items.Where(i => i.ID.StartsWith("material")).Count() > 0)
                {
                    return((int)(t.Weight * 18.2f));
                }
                if (t.Items.Where(i => i.ID.StartsWith("wea_")).Count() > 0)
                {
                    return(0);
                }
                if (t.Items.Contains(Items.Potion) || t.Items.Contains(Items.PhoenixDown) || t.Items.Contains(Items.Antidote) ||
                    t.Items.Contains(Items.HolyWater) || t.Items.Contains(Items.Painkiller) || t.Items.Contains(Items.FoulLiquid) ||
                    t.Items.Contains(Items.Wax) || t.Items.Contains(Items.Mallet))
                {
                    return((int)(t.Weight * 4.2f));
                }
                return((int)Math.Max(1, t.Weight / 22.5f * mult));
            }
        }
示例#5
0
 public static Ability GetNoDep(Tiered <Ability> tiered)
 {
     return(manager.Get(0, 1, tiered, a => true, true).Item1);
 }
示例#6
0
 public static Ability Get(Tiered <Ability> tiered, List <Ability> obtained)
 {
     return(manager.Get(0, 1, tiered, a => ((TieredDependent <Ability>)tiered).MeetsRequirement(a, obtained), true).Item1);
 }