Пример #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Hero()
            : base(EntityType.Hero)
        {
            sightRange = 20;
              hpMax = hp = 20;
              mpMax = mp = 20;
              weapon = (Weapon)ItemFactory.CreateItem( ItemType.Dagger );

              gear.Add( helm );
              gear.Add( shoulders );
              gear.Add( chest );
              gear.Add( belt );
              gear.Add( legs );
              gear.Add( boots );
              gear.Add( gloves );
              gear.Add( cloak );

              LoadEquippedGearImages();
        }
Пример #2
0
        /// <summary>
        /// Handles picking up inventory, adjusting item stats, money, postion counts and all that jazz
        /// </summary>
        /// <param name="item"></param>
        private void PickUpItem( Item item )
        {
            Core.UpdateHistory( "Recieved " + item.ToString() );

              if( item is TreasureChest )
              {
            foreach( Item itm in ((TreasureChest)item).contents )
              PickUpItem( itm );
              }
              else if( item is Weapon )
              {
            if( weapon == null )
            {
              weapon = (Weapon)item;
            }
            else
            {
              if( Core.Random(2)==0 )
            weapon.maxDmg++;
              else
            weapon.minDmg++;

              if( weapon.minDmg>weapon.maxDmg )
              {
            weapon.maxDmg = weapon.minDmg;
            weapon.minDmg--;
              }
            }
              }
              else if( item is HealthPotion )
              {
            healthPots++;
              }
              else if( item is ManaPotion )
              {
            manaPots++;
              }
              else if( item is Money )
              {
            money += ((Money)item).value;
              }
              else if( item is Armor )
              {
            if( item is Helm )
            {
              if( helm == null )
              {
            helm = (Helm)item;
              }
              else
              {
            helm.armor++;
              }
            }
            else if( item is Shoulders )
            {
              if( shoulders == null )
              {
            shoulders = (Shoulders)item;
              }
              else
              {
            shoulders.armor++;
              }
            }
            else if( item is Chest )
            {
              if( chest == null )
              {
            chest = (Chest)item;
              }
              else
              {
            chest.armor++;
              }
            }
            else if( item is Belt )
            {
              if( belt == null )
              {
            belt = (Belt)item;
              }
              else
              {
            belt.armor++;
              }
            }
            else if( item is Legs )
            {
              if( legs == null )
              {
            legs = (Legs)item;
              }
              else
              {
            legs.armor++;
              }
            }
            else if( item is Boots )
            {
              if( boots == null )
              {
            boots = (Boots)item;
              }
              else
              {
            boots.armor++;
              }
            }
            else if( item is Gloves )
            {
              if( gloves == null )
              {
            gloves = (Gloves)item;
              }
              else
              {
            gloves.armor++;
              }
            }
            else if( item is Cloak )
            {
              if( cloak == null )
              {
            cloak = (Cloak)item;
              }
              else
              {
            cloak.armor++;
              }
            }
              }
        }