Beispiel #1
0
        public static UsableItem getUsableItemFromData(UsableItemData data, Dictionary <long, AbilityData> abilityDataDictionary, Dictionary <long, EffectData> effectDataDictionary)
        {
            Item       i  = getItemFromItemData(data, abilityDataDictionary, effectDataDictionary);
            UsableItem ui = new UsableItem()
            {
                activeEffects  = i.activeEffects,
                ID             = i.ID,
                name           = i.name,
                passiveEffects = i.passiveEffects,
                sheetname      = i.sheetname,
                spriteindex    = i.spriteindex,
                type           = i.type,
                uses           = data.uses,
                actionPoints   = data.actionPoints,
                price          = data.price
            };


            if (data.itemAbility.Count > 0)
            {
                List <Ability> abilityList = new List <Ability>();

                foreach (long l in data.itemAbility)
                {
                    if (abilityDataDictionary.ContainsKey(l))
                    {
                        abilityList.Add(AbilityFactory.getAbilityFromAbilityData(abilityDataDictionary[l], effectDataDictionary));
                    }
                }
                ui.itemAbility = abilityList.FirstOrDefault(); //hack?  can we have multiple abilities on usable items?
            }
            return(ui);
        }
Beispiel #2
0
        public static UsableItem getUsableItemFromData(UsableItemData data, Dictionary<long, AbilityData> abilityDataDictionary, Dictionary<long, EffectData> effectDataDictionary)
        {
            Item i = getItemFromItemData(data, abilityDataDictionary, effectDataDictionary);
            UsableItem ui = new UsableItem()
            {

                activeEffects = i.activeEffects,
                ID = i.ID,
                name = i.name,
                passiveEffects = i.passiveEffects,
                sheetname = i.sheetname,
                spriteindex = i.spriteindex,
                type = i.type,
                uses = data.uses,
                actionPoints = data.actionPoints,
                price = data.price

            };


            if (data.itemAbility.Count > 0)
            {
                List<Ability> abilityList = new List<Ability>();

                foreach (long l in data.itemAbility)
                {
                    if (abilityDataDictionary.ContainsKey(l))
                    {
                        abilityList.Add(AbilityFactory.getAbilityFromAbilityData(abilityDataDictionary[l], effectDataDictionary));
                    }

                }
                ui.itemAbility = abilityList.FirstOrDefault(); //hack?  can we have multiple abilities on usable items?
            }
            return ui;
        }