Ability CreateConsumableAbilityFromData(string abilityName, int charges)
        {
            AbilityInfo consumableInfo = ConsumableDataReader.GetConsumableByName(abilityName);

            string  givenName         = consumableInfo.Name;
            Ability consumableAbility = new Ability(givenName, consumableInfo.AbilityCD, consumableInfo.ManaCost, charges);

            consumableAbility.SetTargetType(consumableInfo.targetType);
            consumableAbility.SetAbilityEffectType(consumableInfo.abilityEffectType);
            foreach (var effect in consumableInfo.abilityEffects)
            {
                AbilityEffect abilityEffect = new AbilityEffect()
                {
                    abilityType         = effect.abilityType,
                    damageType          = effect.damageType,
                    BaseAbilityStrength = effect.BaseAbilityStrength
                };
                consumableAbility.AddToEffectList(abilityEffect);
            }
            return(consumableAbility);

            // TODO... should never be allowed to happen, look inot more robust error handling
            return(null);
        }
Esempio n. 2
0
    // TODO...
    // This is temporary hack
    // As long as we can set up a cache's data,
    // It doesn't matter how we do it here, becasue i will be completely reworking Dungeon Gen soon
    private List <AbilityInfo> PopulateConsumableLoot(int cacheDifficulty)
    {
        List <AbilityInfo> consumableList = new List <AbilityInfo>();

        if (cacheDifficulty < 3)
        {
            int consumableMarker = Random.Range(1, 6);
            switch (consumableMarker)
            {
            case 1:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                break;

            case 2:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                break;

            case 3:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 4:
            case 5:
                break;
            }
        }
        else if (cacheDifficulty < 8)
        {
            int consumableMarker = Random.Range(1, 6);
            switch (consumableMarker)
            {
            case 1:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                break;

            case 2:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 3:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 4:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Dynamite"));
                break;

            case 5:
                break;
            }
        }
        else
        {
            int consumableMarker = Random.Range(1, 6);
            switch (consumableMarker)
            {
            case 1:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                break;

            case 2:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 3:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 4:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Dynamite"));
                break;

            case 5:
                break;
            }
        }

        return(consumableList);
    }