Пример #1
0
    public static UtilityAbility ScaleUtilityAbility(float points, float cooldown, float mp, float baseMp, string targetType, List <AbilityAttribute> abilityAttributes, AbilitySkillTree skillTree)
    {
        var startingPoints = points;
        var newAbility     = new UtilityAbility {
            points      = points,
            cooldown    = cooldown,
            mpUsage     = mp,
            baseMpUsage = baseMp,
            targetType  = targetType,
            level       = AbilityCalculator.GetLevelFromPoints(startingPoints),
            skillTree   = skillTree
        };

        ModifyUtilityAbilityPointsForQualities(newAbility);
        foreach (var attribute in abilityAttributes)
        {
            var pointCost = AbilityAttributeAppraiser.Appraise(newAbility, attribute);
            points -= pointCost;
            if (points >= 0)
            {
                newAbility.attributes.Add(attribute);
                newAbility.points -= pointCost;
            }
            else
            {
                points += pointCost;
            }
        }
        newAbility.name        = AbilityNamer.Name(newAbility);
        newAbility.description = AbilityDescriber.Describe(newAbility);
        newAbility.xp          = GetXpFromLevel(newAbility.level);
        SetMpUsage(newAbility);
        return(newAbility);
    }
Пример #2
0
    public static AttackAbility ScaleAttackAbility(float points, Element element, BaseStat baseStat, float damageRatio, float dotDamageRatio, float dotTime, bool isRanged, float cooldown, float mp, float baseMp, float radius, int icon, int hitEffect, int projectile, int aoe, List <AbilityAttribute> abilityAttributes, AbilitySkillTree skillTree)
    {
        var startingPoints = points;
        List <AbilityAttribute> paralysis = new List <AbilityAttribute>();

        foreach (var attribute in abilityAttributes)
        {
            if (attribute.type == "paralyze")
            {
                paralysis.Add(attribute);
            }
        }
        if (paralysis.Count > 0 && cooldown == 0)
        {
            foreach (var attribute in paralysis)
            {
                abilityAttributes.Remove(attribute);
            }
        }
        var newAbility = new AttackAbility {
            element          = element,
            baseStat         = baseStat,
            dotTime          = dotTime,
            isRanged         = isRanged,
            cooldown         = cooldown,
            mpUsage          = mp,
            baseMpUsage      = baseMp,
            radius           = radius,
            points           = points,
            icon             = icon,
            hitEffect        = hitEffect,
            rangedProjectile = projectile,
            aoe       = aoe,
            level     = AbilityCalculator.GetLevelFromPoints(startingPoints),
            skillTree = skillTree
        };

        ModifyAttackAbilityPointsForQualities(newAbility);
        points = newAbility.points;
        int count = 0;

        foreach (var attribute in abilityAttributes)
        {
            if (attribute.priority >= 50)
            {
                var pointCost = AbilityAttributeAppraiser.Appraise(newAbility, attribute);
                if (count < 4)
                {
                    points -= pointCost;
                }
                if (count < 4 && points >= 0)
                {
                    newAbility.attributes.Add(attribute);
                    newAbility.points -= pointCost;
                }
                else if (count < 4 && points < 0)
                {
                    points += pointCost;
                }
                count++;
            }
            else
            {
                newAbility.attributes.Add(attribute);
            }
        }
        var totalDamage   = AttackAbilityGenerator.CalculateDamage(points);
        var regularDamage = totalDamage * damageRatio / (damageRatio + dotDamageRatio);
        var dotDamage     = totalDamage * dotDamageRatio / (damageRatio + dotDamageRatio);

        newAbility.damage      = regularDamage;
        newAbility.dotDamage   = dotDamage;
        newAbility.name        = AbilityNamer.Name(newAbility);
        newAbility.description = AbilityDescriber.Describe(newAbility);
        newAbility.xp          = GetXpFromLevel(newAbility.level);
        SetMpUsage(newAbility);
        return(newAbility);
    }