Ejemplo n.º 1
0
        /// <summary>
        /// Gets item per the location input
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public ItemModel GetItemByLocation(ItemLocationEnum Location)
        {
            switch (Location)
            {
            case ItemLocationEnum.Head:
                return(ItemModelHelper.GetItemModelFromGuid(this.Head));

            case ItemLocationEnum.Feet:
                return(ItemModelHelper.GetItemModelFromGuid(this.Feet));

            case ItemLocationEnum.LeftFinger:
                return(ItemModelHelper.GetItemModelFromGuid(this.LeftFinger));

            case ItemLocationEnum.RightFinger:
                return(ItemModelHelper.GetItemModelFromGuid(this.RightFinger));

            case ItemLocationEnum.PrimaryHand:
                return(ItemModelHelper.GetItemModelFromGuid(this.PrimaryHand));

            case ItemLocationEnum.Necklass:
                return(ItemModelHelper.GetItemModelFromGuid(this.Necklace));

            case ItemLocationEnum.OffHand:
                return(ItemModelHelper.GetItemModelFromGuid(this.OffHand));

            default:
                return(null);
            }
        }
        public void ItemModelHelper_GetItemModelFromGuid_Null_Should_ReturnNull()
        {
            // act
            var result = ItemModelHelper.GetItemModelFromGuid(null);

            // assert
            Assert.IsNull(result);
        }
        public async Task ItemModelHelper_GetItemModelFromGuid_Valid_Should_Pass()
        {
            // Arrange
            var ViewModel = ItemIndexViewModel.Instance;
            var dataTest  = new ItemModel {
                Name = "test"
            };
            await ViewModel.CreateAsync(dataTest);

            // act
            var result = ItemModelHelper.GetItemModelFromGuid(dataTest.Id);

            // assert
            Assert.AreEqual(dataTest, result);
        }
Ejemplo n.º 4
0
        // Add ItemModel
        // Looks up the ItemModel
        // Puts the ItemModel ID as a string in the location slot
        // If ItemModel is null, then puts null in the slot
        // Returns the ItemModel that was in the location
        public ItemModel AddItem(ItemLocationEnum itemlocation, string itemID)
        {
            ItemModel myReturn;

            switch (itemlocation)
            {
            case ItemLocationEnum.Feet:
                myReturn = ItemModelHelper.GetItemModelFromGuid(Feet);
                Feet     = itemID;
                break;

            case ItemLocationEnum.Head:
                myReturn = ItemModelHelper.GetItemModelFromGuid(Head);
                Head     = itemID;
                break;

            case ItemLocationEnum.Necklass:
                myReturn = ItemModelHelper.GetItemModelFromGuid(Necklace);
                Necklace = itemID;
                break;

            case ItemLocationEnum.PrimaryHand:
                myReturn    = ItemModelHelper.GetItemModelFromGuid(PrimaryHand);
                PrimaryHand = itemID;
                break;

            case ItemLocationEnum.OffHand:
                myReturn = ItemModelHelper.GetItemModelFromGuid(OffHand);
                OffHand  = itemID;
                break;

            case ItemLocationEnum.RightFinger:
                myReturn    = ItemModelHelper.GetItemModelFromGuid(RightFinger);
                RightFinger = itemID;
                break;

            case ItemLocationEnum.LeftFinger:
                myReturn   = ItemModelHelper.GetItemModelFromGuid(LeftFinger);
                LeftFinger = itemID;
                break;

            default:
                myReturn = null;
                break;
            }

            return(myReturn);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns list of all items possessed.
        /// </summary>
        /// <returns></returns>
        public List <ItemModel> DropAllItems()
        {
            var DroppedItems = new List <ItemModel>();

            if (this.Head != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.Head));
                this.Head = null;
            }

            if (this.Feet != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.Feet));
                this.Feet = null;
            }

            if (this.Necklace != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.Necklace));
                this.Necklace = null;
            }

            if (this.LeftFinger != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.LeftFinger));
                this.LeftFinger = null;
            }

            if (this.RightFinger != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.RightFinger));
                this.RightFinger = null;
            }

            if (this.PrimaryHand != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.PrimaryHand));
                this.PrimaryHand = null;
            }

            if (this.OffHand != null)
            {
                DroppedItems.Add(ItemModelHelper.GetItemModelFromGuid(this.OffHand));
                this.OffHand = null;
            }

            return(DroppedItems);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Roll the Damage Dice, and add to the Damage
        /// </summary>
        /// <returns></returns>
        public int GetDamageRollValue(bool CauseMaxDamage)
        {
            var myReturn = 0;

            var myItem = ItemModelHelper.GetItemModelFromGuid(PrimaryHand);

            if (myItem != null)
            {
                if (CauseMaxDamage)
                {
                    myReturn += myItem.Damage;
                }
                else
                {
                    // Dice of the weapon.  So sword of Damage 10 is d10
                    myReturn += DiceHelper.RollDice(1, myItem.Damage);
                }
            }

            // Add in the Level as extra damage per game rules
            myReturn += GetDamageLevelBonus;

            return(myReturn);
        }
Ejemplo n.º 7
0
        // Walk all the Items on the Character.
        // Add together all Items that modify the Attribute Enum Passed in
        // Return the sum
        public int GetItemBonus(AttributeEnum attributeEnum)
        {
            AttackWithGoSUItem = false;
            var       myReturn = 0;
            ItemModel myItem;

            myItem = ItemModelHelper.GetItemModelFromGuid(Head);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    if (myItem.Attribute == AttributeEnum.Attack || myItem.Attribute == AttributeEnum.Defense)
                    {
                        myItem.ItemUseCount--; // Hackathon #27
                    }

                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }

                    DropIfBrokenItem(myItem);
                }
            }

            myItem = ItemModelHelper.GetItemModelFromGuid(Necklace);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    myItem.ItemUseCount--;
                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }
                    DropIfBrokenItem(myItem);
                }
            }

            myItem = ItemModelHelper.GetItemModelFromGuid(PrimaryHand);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    myItem.ItemUseCount--;
                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }
                    DropIfBrokenItem(myItem);
                }
            }

            myItem = ItemModelHelper.GetItemModelFromGuid(OffHand);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    myItem.ItemUseCount--;
                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }
                    DropIfBrokenItem(myItem);
                }
            }

            myItem = ItemModelHelper.GetItemModelFromGuid(RightFinger);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    myItem.ItemUseCount--;
                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }
                    DropIfBrokenItem(myItem);
                }
            }

            myItem = ItemModelHelper.GetItemModelFromGuid(LeftFinger);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    myItem.ItemUseCount--;
                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }
                    DropIfBrokenItem(myItem);
                }
            }

            myItem = ItemModelHelper.GetItemModelFromGuid(Feet);
            if (myItem != null)
            {
                if (myItem.Attribute == attributeEnum)
                {
                    myItem.ItemUseCount--;
                    myReturn += myItem.Value;

                    // Adding for 43 of hackathon
                    if (myItem.Description.Equals("Go SU RedHawks"))
                    {
                        AttackWithGoSUItem = true;
                        // Adding the value once again to make the effect 2X
                        myReturn += myItem.Value;
                    }
                    DropIfBrokenItem(myItem);
                }
            }

            return(myReturn);
        }