Exemplo n.º 1
0
        Ability CreateAbilityFromData(string abilityName, MonsterInfo mi = null)
        {
            AbilityInfo abilityInfo = abilityData.GetAbilityByName(abilityName);

            string givenName = abilityInfo.Name;

            if (mi != null)
            {
                givenName = mi.MonsterName;
            }
            Ability ability = new Ability(givenName, abilityInfo.AbilityCD, abilityInfo.ManaCost);

            ability.SetTargetType(abilityInfo.targetType);
            ability.SetAbilityEffectType(abilityInfo.abilityEffectType);
            foreach (var effect in abilityInfo.abilityEffects)
            {
                AbilityEffect abilityEffect = new AbilityEffect()
                {
                    abilityType         = effect.abilityType,
                    damageType          = effect.damageType,
                    BaseAbilityStrength = effect.BaseAbilityStrength
                };
                if (mi != null)
                {
                    abilityEffect.monsterInfo = mi;
                }
                ability.AddToEffectList(abilityEffect);
            }
            return(ability);

            // TODO... should never be allowed to happen, look inot more robust error handling
            return(null);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public void AddToEffectList(AbilityEffect effect)
 {
     effectList.Add(effect);
 }