Пример #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_GetItemModelNameFromGuid_Null_Should_ReturnNull()
        {
            // act
            var result = ItemModelHelper.GetItemModelNameFromGuid(null);

            // assert
            Assert.IsNull(result);
        }
 /// <summary>
 /// Loading Item values to the labels
 /// </summary>
 /// <param name="data"></param>
 public void LoadValues(GenericViewModel <CharacterModel> data)
 {
     HeadItem.Text        = ItemModelHelper.GetItemModelNameFromGuid(data.Data.Head);
     NecklaceItem.Text    = ItemModelHelper.GetItemModelNameFromGuid(data.Data.Necklace);
     PrimaryHandItem.Text = ItemModelHelper.GetItemModelNameFromGuid(data.Data.PrimaryHand);
     OffHandItem.Text     = ItemModelHelper.GetItemModelNameFromGuid(data.Data.OffHand);
     RightFingerItem.Text = ItemModelHelper.GetItemModelNameFromGuid(data.Data.RightFinger);
     LeftFingerItem.Text  = ItemModelHelper.GetItemModelNameFromGuid(data.Data.LeftFinger);
     FeetItem.Text        = ItemModelHelper.GetItemModelNameFromGuid(data.Data.Feet);
 }
        public async Task ItemModelHelper_GetItemModelNameFromGuid_ValidId_Should_Pass()
        {
            // Arrange
            var ViewModel = ItemIndexViewModel.Instance;
            var dataTest  = new ItemModel {
                Name = "test"
            };
            await ViewModel.CreateAsync(dataTest);

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

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

            // act
            var result = ItemModelHelper.GetItemModelNameFromGuid("abcd");

            // assert
            Assert.IsNull(result);
        }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
        }