示例#1
0
        public Item Generate()
        {
            Monster monster = Monsters[rand.Next(Monsters.Count)];
            Item    item    = ResolveItem(monster.TreasureClass);
            Item    newItem;

            if (item is Weapon)
            {
                newItem = Weapon.DeepCopy(item as Weapon);
            }
            else if (item is Armor)
            {
                newItem = Armor.DeepCopy(item as Armor);
            }
            else
            {
                return(new Item());
            }
            if (rand.Next(2) == 1)
            {
                newItem.AddPrefix(Prefix.GeneratePrefix(Prefixes[rand.Next(Prefixes.Count)]));
            }
            if (rand.Next(2) == 1)
            {
                newItem.AddSuffix(Suffix.GenerateSuffix(Suffixes[rand.Next(Suffixes.Count)]));
            }

            newItem.RandomizeValue();

            return(newItem);

            /*
             * if(newItem is Weapon)
             *  return ((Weapon)newItem).ToString();
             * else if(newItem is Armor)
             *  return ((Armor)newItem).ToString();
             * else
             *  return newItem.ToString();
             */
        }
示例#2
0
 public void AddSuffix(Suffix suffix)
 {
     Suffixes.Add(suffix);
 }